diff --git a/Makefile.include b/Makefile.include index e8251c921..0c2988548 100644 --- a/Makefile.include +++ b/Makefile.include @@ -25,7 +25,7 @@ usage: @echo "make MAKETARGETS... [TARGET=(TARGET)] [savetarget] [targets]" targets: - @ls -1 $(CONTIKI)/platform | grep -v CVS + @ls -1 $(CONTIKI)/platform $(TARGETDIRS) | grep -v CVS savetarget: -@rm -f Makefile.target @@ -109,7 +109,7 @@ endif ### Include target makefile (TODO Unsafe?) -target_makefile := $(wildcard ${realpath $(CONTIKI)}/platform/$(TARGET)/Makefile.$(TARGET) ${foreach TDIR, $(TARGETDIRS), $(TDIR)/$(TARGET)/Makefile.$(TARGET)}) +target_makefile := $(wildcard $(CONTIKI)/platform/$(TARGET)/Makefile.$(TARGET) ${foreach TDIR, $(TARGETDIRS), $(TDIR)/$(TARGET)/Makefile.$(TARGET)}) # Check if the target makefile exists, and create the object directory if necessary. ifeq ($(strip $(target_makefile)),) diff --git a/apps/cmdd/cmdd.c b/apps/cmdd/cmdd.c index 2912b7410..6dfebe42f 100644 --- a/apps/cmdd/cmdd.c +++ b/apps/cmdd/cmdd.c @@ -25,10 +25,10 @@ static const char *prompt = "contiki> "; /*---------------------------------------------------------------------------*/ static char * CC_FASTCALL -n(u16_t num, char *ptr) +n(uint16_t num, char *ptr) { - u16_t d; - u8_t a, f; + uint16_t d; + uint8_t a, f; if(num == 0) { *ptr = '0'; diff --git a/apps/codeprop/codeprop-tmp.c b/apps/codeprop/codeprop-tmp.c index 06e7284ef..a6a4dfc28 100644 --- a/apps/codeprop/codeprop-tmp.c +++ b/apps/codeprop/codeprop-tmp.c @@ -104,18 +104,18 @@ static const char *err_msgs[] = #define UDPDATASIZE 32 struct codeprop_udphdr { - u16_t id; - u16_t type; + uint16_t id; + uint16_t type; #define TYPE_DATA 0x0001 #define TYPE_NACK 0x0002 - u16_t addr; - u16_t len; - u8_t data[UDPDATASIZE]; + uint16_t addr; + uint16_t len; + uint8_t data[UDPDATASIZE]; }; struct codeprop_tcphdr { - u16_t len; - u16_t pad; + uint16_t len; + uint16_t pad; }; static void uipcall(void *state); @@ -123,19 +123,19 @@ static void uipcall(void *state); PROCESS(codeprop_process, "Code propagator"); struct codeprop_state { - u8_t state; + uint8_t state; #define STATE_NONE 0 #define STATE_RECEIVING_TCPDATA 1 #define STATE_RECEIVING_UDPDATA 2 #define STATE_SENDING_UDPDATA 3 - u16_t count; - u16_t addr; - u16_t len; - u16_t id; + uint16_t count; + uint16_t addr; + uint16_t len; + uint16_t id; struct etimer sendtimer; struct timer nacktimer, timer, starttimer; - u8_t received; - u8_t send_counter; + uint8_t received; + uint8_t send_counter; struct pt tcpthread_pt; struct pt udpthread_pt; struct pt recv_udpthread_pt; @@ -198,10 +198,10 @@ PROCESS_THREAD(codeprop_process, ev, data) PROCESS_END(); } /*---------------------------------------------------------------------*/ -static u16_t +static uint16_t send_udpdata(struct codeprop_udphdr *uh) { - u16_t len; + uint16_t len; uh->type = UIP_HTONS(TYPE_DATA); uh->addr = uip_htons(s.addr); @@ -367,7 +367,7 @@ PT_THREAD(recv_udpthread(struct pt *pt)) static PT_THREAD(recv_tcpthread(struct pt *pt)) { - u8_t *dataptr; + uint8_t *dataptr; struct codeprop_tcphdr *th; int datalen = uip_datalen(); PT_BEGIN(pt); diff --git a/apps/codeprop/codeprop.c b/apps/codeprop/codeprop.c index 046755f7e..f0b822667 100644 --- a/apps/codeprop/codeprop.c +++ b/apps/codeprop/codeprop.c @@ -104,13 +104,13 @@ void codeprop_set_rate(clock_time_t time); #define UDPDATASIZE 32 struct codeprop_udphdr { - u16_t id; - u16_t type; + uint16_t id; + uint16_t type; #define TYPE_DATA 0x0001 #define TYPE_NACK 0x0002 - u16_t addr; - u16_t len; - u8_t data[UDPDATASIZE]; + uint16_t addr; + uint16_t len; + uint8_t data[UDPDATASIZE]; }; static void uipcall(void *state); @@ -118,19 +118,19 @@ static void uipcall(void *state); PROCESS(codeprop_process, "Code propagator"); struct codeprop_state { - u8_t state; + uint8_t state; #define STATE_NONE 0 #define STATE_RECEIVING_TCPDATA 1 #define STATE_RECEIVING_UDPDATA 2 #define STATE_SENDING_UDPDATA 3 - u16_t count; - u16_t addr; - u16_t len; - u16_t id; + uint16_t count; + uint16_t addr; + uint16_t len; + uint16_t id; struct etimer sendtimer; struct timer nacktimer, timer, starttimer; - u8_t received; - u8_t send_counter; + uint8_t received; + uint8_t send_counter; struct pt tcpthread_pt; struct pt udpthread_pt; struct pt recv_udpthread_pt; @@ -199,10 +199,10 @@ PROCESS_THREAD(codeprop_process, ev, data) PROCESS_END(); } /*---------------------------------------------------------------------*/ -static u16_t +static uint16_t send_udpdata(struct codeprop_udphdr *uh) { - u16_t len; + uint16_t len; uh->type = UIP_HTONS(TYPE_DATA); uh->addr = uip_htons(s.addr); @@ -360,7 +360,7 @@ PT_THREAD(recv_udpthread(struct pt *pt)) static PT_THREAD(recv_tcpthread(struct pt *pt)) { - u8_t *dataptr; + uint8_t *dataptr; struct codeprop_tcphdr *th; int datalen = uip_datalen(); diff --git a/apps/codeprop/codeprop.h b/apps/codeprop/codeprop.h index 4b5f967db..5ead82cb8 100644 --- a/apps/codeprop/codeprop.h +++ b/apps/codeprop/codeprop.h @@ -38,8 +38,8 @@ #define CODEPROP_DATA_PORT 6510 struct codeprop_tcphdr { - u16_t len; - u16_t pad; + uint16_t len; + uint16_t pad; }; PROCESS_NAME(codeprop_process); diff --git a/apps/codeprop/tcp_loader.c b/apps/codeprop/tcp_loader.c index bab36ca22..700ee5495 100644 --- a/apps/codeprop/tcp_loader.c +++ b/apps/codeprop/tcp_loader.c @@ -50,8 +50,8 @@ PROCESS(tcp_loader_process, "TCP loader"); static struct codeprop_state { - u16_t addr; - u16_t len; + uint16_t addr; + uint16_t len; struct pt tcpthread_pt; } s; diff --git a/apps/codeprop/tcp_loader2.c b/apps/codeprop/tcp_loader2.c index 115834de4..4b861473d 100644 --- a/apps/codeprop/tcp_loader2.c +++ b/apps/codeprop/tcp_loader2.c @@ -55,8 +55,8 @@ PROCESS(tcp_loader_process, "TCP loader"); static struct codeprop_state { - u16_t addr; - u16_t len; + uint16_t addr; + uint16_t len; struct pt tcpthread_pt; } s; diff --git a/apps/dhcp/dhcp.c b/apps/dhcp/dhcp.c index c492cf6df..9ea9b0605 100644 --- a/apps/dhcp/dhcp.c +++ b/apps/dhcp/dhcp.c @@ -48,7 +48,7 @@ set_statustext(char *text) } /*---------------------------------------------------------------------------*/ static char * -makebyte(u8_t byte, char *str) +makebyte(uint8_t byte, char *str) { if(byte >= 100) { *str++ = (byte / 100 ) % 10 + '0'; diff --git a/apps/email/smtp-socket.c b/apps/email/smtp-socket.c index 64dd2baf6..01ae54527 100644 --- a/apps/email/smtp-socket.c +++ b/apps/email/smtp-socket.c @@ -52,9 +52,9 @@ struct smtp_state { char *from; char *subject; char *msg; - u8_t msgwidth; - u8_t msgheight; - u8_t line; + uint8_t msgwidth; + uint8_t msgheight; + uint8_t line; }; static struct smtp_state s; @@ -209,7 +209,7 @@ smtp_configure(char *lhostname, uip_ipaddr_t *server) /*---------------------------------------------------------------------------*/ unsigned char smtp_send(char *to, char *cc, char *from, char *subject, - char *msg, u8_t msgwidth, u8_t msgheight) + char *msg, uint8_t msgwidth, uint8_t msgheight) { struct uip_conn *conn; diff --git a/apps/email/smtp.h b/apps/email/smtp.h index f420fa090..84c31958c 100644 --- a/apps/email/smtp.h +++ b/apps/email/smtp.h @@ -45,7 +45,7 @@ void smtp_configure(char *localhostname, uip_ipaddr_t *smtpserver); unsigned char smtp_send(char *to, char *cc, char *from, char *subject, char *msg, - u8_t msgwidth, u8_t msgheight); + uint8_t msgwidth, uint8_t msgheight); void smtp_appcall(void *state); diff --git a/apps/er-coap-03/er-coap-03-engine.c b/apps/er-coap-03/er-coap-03-engine.c index a11f7f5d0..610209f13 100644 --- a/apps/er-coap-03/er-coap-03-engine.c +++ b/apps/er-coap-03/er-coap-03-engine.c @@ -47,7 +47,7 @@ #define DEBUG 0 #if DEBUG #define PRINTF(...) printf(__VA_ARGS__) -#define PRINT6ADDR(addr) PRINTF("[%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x]", ((u8_t *)addr)[0], ((u8_t *)addr)[1], ((u8_t *)addr)[2], ((u8_t *)addr)[3], ((u8_t *)addr)[4], ((u8_t *)addr)[5], ((u8_t *)addr)[6], ((u8_t *)addr)[7], ((u8_t *)addr)[8], ((u8_t *)addr)[9], ((u8_t *)addr)[10], ((u8_t *)addr)[11], ((u8_t *)addr)[12], ((u8_t *)addr)[13], ((u8_t *)addr)[14], ((u8_t *)addr)[15]) +#define PRINT6ADDR(addr) PRINTF("[%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x]", ((uint8_t *)addr)[0], ((uint8_t *)addr)[1], ((uint8_t *)addr)[2], ((uint8_t *)addr)[3], ((uint8_t *)addr)[4], ((uint8_t *)addr)[5], ((uint8_t *)addr)[6], ((uint8_t *)addr)[7], ((uint8_t *)addr)[8], ((uint8_t *)addr)[9], ((uint8_t *)addr)[10], ((uint8_t *)addr)[11], ((uint8_t *)addr)[12], ((uint8_t *)addr)[13], ((uint8_t *)addr)[14], ((uint8_t *)addr)[15]) #define PRINTLLADDR(lladdr) PRINTF(" %02x:%02x:%02x:%02x:%02x:%02x ",(lladdr)->addr[0], (lladdr)->addr[1], (lladdr)->addr[2], (lladdr)->addr[3],(lladdr)->addr[4], (lladdr)->addr[5]) #define PRINTBITS(buf,len) { \ int i,j=0; \ diff --git a/apps/er-coap-03/er-coap-03-observing.c b/apps/er-coap-03/er-coap-03-observing.c index 82e8cbffa..2da95248c 100644 --- a/apps/er-coap-03/er-coap-03-observing.c +++ b/apps/er-coap-03/er-coap-03-observing.c @@ -44,7 +44,7 @@ #define DEBUG 0 #if DEBUG #define PRINTF(...) printf(__VA_ARGS__) -#define PRINT6ADDR(addr) PRINTF("[%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x]", ((u8_t *)addr)[0], ((u8_t *)addr)[1], ((u8_t *)addr)[2], ((u8_t *)addr)[3], ((u8_t *)addr)[4], ((u8_t *)addr)[5], ((u8_t *)addr)[6], ((u8_t *)addr)[7], ((u8_t *)addr)[8], ((u8_t *)addr)[9], ((u8_t *)addr)[10], ((u8_t *)addr)[11], ((u8_t *)addr)[12], ((u8_t *)addr)[13], ((u8_t *)addr)[14], ((u8_t *)addr)[15]) +#define PRINT6ADDR(addr) PRINTF("[%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x]", ((uint8_t *)addr)[0], ((uint8_t *)addr)[1], ((uint8_t *)addr)[2], ((uint8_t *)addr)[3], ((uint8_t *)addr)[4], ((uint8_t *)addr)[5], ((uint8_t *)addr)[6], ((uint8_t *)addr)[7], ((uint8_t *)addr)[8], ((uint8_t *)addr)[9], ((uint8_t *)addr)[10], ((uint8_t *)addr)[11], ((uint8_t *)addr)[12], ((uint8_t *)addr)[13], ((uint8_t *)addr)[14], ((uint8_t *)addr)[15]) #define PRINTLLADDR(lladdr) PRINTF("[%02x:%02x:%02x:%02x:%02x:%02x]",(lladdr)->addr[0], (lladdr)->addr[1], (lladdr)->addr[2], (lladdr)->addr[3],(lladdr)->addr[4], (lladdr)->addr[5]) #else #define PRINTF(...) diff --git a/apps/er-coap-03/er-coap-03-transactions.c b/apps/er-coap-03/er-coap-03-transactions.c index 2ed691d86..ef2c5b65e 100644 --- a/apps/er-coap-03/er-coap-03-transactions.c +++ b/apps/er-coap-03/er-coap-03-transactions.c @@ -46,7 +46,7 @@ #if DEBUG #include #define PRINTF(...) printf(__VA_ARGS__) -#define PRINT6ADDR(addr) PRINTF("[%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x]", ((u8_t *)addr)[0], ((u8_t *)addr)[1], ((u8_t *)addr)[2], ((u8_t *)addr)[3], ((u8_t *)addr)[4], ((u8_t *)addr)[5], ((u8_t *)addr)[6], ((u8_t *)addr)[7], ((u8_t *)addr)[8], ((u8_t *)addr)[9], ((u8_t *)addr)[10], ((u8_t *)addr)[11], ((u8_t *)addr)[12], ((u8_t *)addr)[13], ((u8_t *)addr)[14], ((u8_t *)addr)[15]) +#define PRINT6ADDR(addr) PRINTF("[%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x]", ((uint8_t *)addr)[0], ((uint8_t *)addr)[1], ((uint8_t *)addr)[2], ((uint8_t *)addr)[3], ((uint8_t *)addr)[4], ((uint8_t *)addr)[5], ((uint8_t *)addr)[6], ((uint8_t *)addr)[7], ((uint8_t *)addr)[8], ((uint8_t *)addr)[9], ((uint8_t *)addr)[10], ((uint8_t *)addr)[11], ((uint8_t *)addr)[12], ((uint8_t *)addr)[13], ((uint8_t *)addr)[14], ((uint8_t *)addr)[15]) #define PRINTLLADDR(lladdr) PRINTF("[%02x:%02x:%02x:%02x:%02x:%02x]",(lladdr)->addr[0], (lladdr)->addr[1], (lladdr)->addr[2], (lladdr)->addr[3],(lladdr)->addr[4], (lladdr)->addr[5]) #else #define PRINTF(...) diff --git a/apps/er-coap-03/er-coap-03.c b/apps/er-coap-03/er-coap-03.c index b02227ba2..10b95f59f 100644 --- a/apps/er-coap-03/er-coap-03.c +++ b/apps/er-coap-03/er-coap-03.c @@ -63,7 +63,7 @@ #if DEBUG #include #define PRINTF(...) printf(__VA_ARGS__) -#define PRINT6ADDR(addr) PRINTF("[%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x]", ((u8_t *)addr)[0], ((u8_t *)addr)[1], ((u8_t *)addr)[2], ((u8_t *)addr)[3], ((u8_t *)addr)[4], ((u8_t *)addr)[5], ((u8_t *)addr)[6], ((u8_t *)addr)[7], ((u8_t *)addr)[8], ((u8_t *)addr)[9], ((u8_t *)addr)[10], ((u8_t *)addr)[11], ((u8_t *)addr)[12], ((u8_t *)addr)[13], ((u8_t *)addr)[14], ((u8_t *)addr)[15]) +#define PRINT6ADDR(addr) PRINTF("[%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x]", ((uint8_t *)addr)[0], ((uint8_t *)addr)[1], ((uint8_t *)addr)[2], ((uint8_t *)addr)[3], ((uint8_t *)addr)[4], ((uint8_t *)addr)[5], ((uint8_t *)addr)[6], ((uint8_t *)addr)[7], ((uint8_t *)addr)[8], ((uint8_t *)addr)[9], ((uint8_t *)addr)[10], ((uint8_t *)addr)[11], ((uint8_t *)addr)[12], ((uint8_t *)addr)[13], ((uint8_t *)addr)[14], ((uint8_t *)addr)[15]) #define PRINTLLADDR(lladdr) PRINTF("[%02x:%02x:%02x:%02x:%02x:%02x]",(lladdr)->addr[0], (lladdr)->addr[1], (lladdr)->addr[2], (lladdr)->addr[3],(lladdr)->addr[4], (lladdr)->addr[5]) #else #define PRINTF(...) diff --git a/apps/er-coap-06/er-coap-06-engine.c b/apps/er-coap-06/er-coap-06-engine.c index ff1c3a4f4..f03e279f3 100644 --- a/apps/er-coap-06/er-coap-06-engine.c +++ b/apps/er-coap-06/er-coap-06-engine.c @@ -47,7 +47,7 @@ #define DEBUG 0 #if DEBUG #define PRINTF(...) printf(__VA_ARGS__) -#define PRINT6ADDR(addr) PRINTF("[%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x]", ((u8_t *)addr)[0], ((u8_t *)addr)[1], ((u8_t *)addr)[2], ((u8_t *)addr)[3], ((u8_t *)addr)[4], ((u8_t *)addr)[5], ((u8_t *)addr)[6], ((u8_t *)addr)[7], ((u8_t *)addr)[8], ((u8_t *)addr)[9], ((u8_t *)addr)[10], ((u8_t *)addr)[11], ((u8_t *)addr)[12], ((u8_t *)addr)[13], ((u8_t *)addr)[14], ((u8_t *)addr)[15]) +#define PRINT6ADDR(addr) PRINTF("[%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x]", ((uint8_t *)addr)[0], ((uint8_t *)addr)[1], ((uint8_t *)addr)[2], ((uint8_t *)addr)[3], ((uint8_t *)addr)[4], ((uint8_t *)addr)[5], ((uint8_t *)addr)[6], ((uint8_t *)addr)[7], ((uint8_t *)addr)[8], ((uint8_t *)addr)[9], ((uint8_t *)addr)[10], ((uint8_t *)addr)[11], ((uint8_t *)addr)[12], ((uint8_t *)addr)[13], ((uint8_t *)addr)[14], ((uint8_t *)addr)[15]) #define PRINTLLADDR(lladdr) PRINTF(" %02x:%02x:%02x:%02x:%02x:%02x ",(lladdr)->addr[0], (lladdr)->addr[1], (lladdr)->addr[2], (lladdr)->addr[3],(lladdr)->addr[4], (lladdr)->addr[5]) #define PRINTBITS(buf,len) { \ int i,j=0; \ diff --git a/apps/er-coap-06/er-coap-06-observing.c b/apps/er-coap-06/er-coap-06-observing.c index 43f5fff49..06c454883 100644 --- a/apps/er-coap-06/er-coap-06-observing.c +++ b/apps/er-coap-06/er-coap-06-observing.c @@ -44,7 +44,7 @@ #define DEBUG 0 #if DEBUG #define PRINTF(...) printf(__VA_ARGS__) -#define PRINT6ADDR(addr) PRINTF("[%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x]", ((u8_t *)addr)[0], ((u8_t *)addr)[1], ((u8_t *)addr)[2], ((u8_t *)addr)[3], ((u8_t *)addr)[4], ((u8_t *)addr)[5], ((u8_t *)addr)[6], ((u8_t *)addr)[7], ((u8_t *)addr)[8], ((u8_t *)addr)[9], ((u8_t *)addr)[10], ((u8_t *)addr)[11], ((u8_t *)addr)[12], ((u8_t *)addr)[13], ((u8_t *)addr)[14], ((u8_t *)addr)[15]) +#define PRINT6ADDR(addr) PRINTF("[%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x]", ((uint8_t *)addr)[0], ((uint8_t *)addr)[1], ((uint8_t *)addr)[2], ((uint8_t *)addr)[3], ((uint8_t *)addr)[4], ((uint8_t *)addr)[5], ((uint8_t *)addr)[6], ((uint8_t *)addr)[7], ((uint8_t *)addr)[8], ((uint8_t *)addr)[9], ((uint8_t *)addr)[10], ((uint8_t *)addr)[11], ((uint8_t *)addr)[12], ((uint8_t *)addr)[13], ((uint8_t *)addr)[14], ((uint8_t *)addr)[15]) #define PRINTLLADDR(lladdr) PRINTF("[%02x:%02x:%02x:%02x:%02x:%02x]",(lladdr)->addr[0], (lladdr)->addr[1], (lladdr)->addr[2], (lladdr)->addr[3],(lladdr)->addr[4], (lladdr)->addr[5]) #else #define PRINTF(...) diff --git a/apps/er-coap-06/er-coap-06-separate.c b/apps/er-coap-06/er-coap-06-separate.c index 292acca0d..ee935de3d 100644 --- a/apps/er-coap-06/er-coap-06-separate.c +++ b/apps/er-coap-06/er-coap-06-separate.c @@ -44,7 +44,7 @@ #define DEBUG 0 #if DEBUG #define PRINTF(...) printf(__VA_ARGS__) -#define PRINT6ADDR(addr) PRINTF("[%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x]", ((u8_t *)addr)[0], ((u8_t *)addr)[1], ((u8_t *)addr)[2], ((u8_t *)addr)[3], ((u8_t *)addr)[4], ((u8_t *)addr)[5], ((u8_t *)addr)[6], ((u8_t *)addr)[7], ((u8_t *)addr)[8], ((u8_t *)addr)[9], ((u8_t *)addr)[10], ((u8_t *)addr)[11], ((u8_t *)addr)[12], ((u8_t *)addr)[13], ((u8_t *)addr)[14], ((u8_t *)addr)[15]) +#define PRINT6ADDR(addr) PRINTF("[%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x]", ((uint8_t *)addr)[0], ((uint8_t *)addr)[1], ((uint8_t *)addr)[2], ((uint8_t *)addr)[3], ((uint8_t *)addr)[4], ((uint8_t *)addr)[5], ((uint8_t *)addr)[6], ((uint8_t *)addr)[7], ((uint8_t *)addr)[8], ((uint8_t *)addr)[9], ((uint8_t *)addr)[10], ((uint8_t *)addr)[11], ((uint8_t *)addr)[12], ((uint8_t *)addr)[13], ((uint8_t *)addr)[14], ((uint8_t *)addr)[15]) #define PRINTLLADDR(lladdr) PRINTF("[%02x:%02x:%02x:%02x:%02x:%02x]",(lladdr)->addr[0], (lladdr)->addr[1], (lladdr)->addr[2], (lladdr)->addr[3],(lladdr)->addr[4], (lladdr)->addr[5]) #else #define PRINTF(...) diff --git a/apps/er-coap-06/er-coap-06-transactions.c b/apps/er-coap-06/er-coap-06-transactions.c index 980fad7f3..47958bd8d 100644 --- a/apps/er-coap-06/er-coap-06-transactions.c +++ b/apps/er-coap-06/er-coap-06-transactions.c @@ -52,7 +52,7 @@ #if DEBUG #include #define PRINTF(...) printf(__VA_ARGS__) -#define PRINT6ADDR(addr) PRINTF("[%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x]", ((u8_t *)addr)[0], ((u8_t *)addr)[1], ((u8_t *)addr)[2], ((u8_t *)addr)[3], ((u8_t *)addr)[4], ((u8_t *)addr)[5], ((u8_t *)addr)[6], ((u8_t *)addr)[7], ((u8_t *)addr)[8], ((u8_t *)addr)[9], ((u8_t *)addr)[10], ((u8_t *)addr)[11], ((u8_t *)addr)[12], ((u8_t *)addr)[13], ((u8_t *)addr)[14], ((u8_t *)addr)[15]) +#define PRINT6ADDR(addr) PRINTF("[%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x]", ((uint8_t *)addr)[0], ((uint8_t *)addr)[1], ((uint8_t *)addr)[2], ((uint8_t *)addr)[3], ((uint8_t *)addr)[4], ((uint8_t *)addr)[5], ((uint8_t *)addr)[6], ((uint8_t *)addr)[7], ((uint8_t *)addr)[8], ((uint8_t *)addr)[9], ((uint8_t *)addr)[10], ((uint8_t *)addr)[11], ((uint8_t *)addr)[12], ((uint8_t *)addr)[13], ((uint8_t *)addr)[14], ((uint8_t *)addr)[15]) #define PRINTLLADDR(lladdr) PRINTF("[%02x:%02x:%02x:%02x:%02x:%02x]",(lladdr)->addr[0], (lladdr)->addr[1], (lladdr)->addr[2], (lladdr)->addr[3],(lladdr)->addr[4], (lladdr)->addr[5]) #else #define PRINTF(...) diff --git a/apps/er-coap-06/er-coap-06.c b/apps/er-coap-06/er-coap-06.c index 013001c48..62b86eb2d 100644 --- a/apps/er-coap-06/er-coap-06.c +++ b/apps/er-coap-06/er-coap-06.c @@ -48,7 +48,7 @@ #if DEBUG #include #define PRINTF(...) printf(__VA_ARGS__) -#define PRINT6ADDR(addr) PRINTF("[%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x]", ((u8_t *)addr)[0], ((u8_t *)addr)[1], ((u8_t *)addr)[2], ((u8_t *)addr)[3], ((u8_t *)addr)[4], ((u8_t *)addr)[5], ((u8_t *)addr)[6], ((u8_t *)addr)[7], ((u8_t *)addr)[8], ((u8_t *)addr)[9], ((u8_t *)addr)[10], ((u8_t *)addr)[11], ((u8_t *)addr)[12], ((u8_t *)addr)[13], ((u8_t *)addr)[14], ((u8_t *)addr)[15]) +#define PRINT6ADDR(addr) PRINTF("[%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x]", ((uint8_t *)addr)[0], ((uint8_t *)addr)[1], ((uint8_t *)addr)[2], ((uint8_t *)addr)[3], ((uint8_t *)addr)[4], ((uint8_t *)addr)[5], ((uint8_t *)addr)[6], ((uint8_t *)addr)[7], ((uint8_t *)addr)[8], ((uint8_t *)addr)[9], ((uint8_t *)addr)[10], ((uint8_t *)addr)[11], ((uint8_t *)addr)[12], ((uint8_t *)addr)[13], ((uint8_t *)addr)[14], ((uint8_t *)addr)[15]) #define PRINTLLADDR(lladdr) PRINTF("[%02x:%02x:%02x:%02x:%02x:%02x]",(lladdr)->addr[0], (lladdr)->addr[1], (lladdr)->addr[2], (lladdr)->addr[3],(lladdr)->addr[4], (lladdr)->addr[5]) #else #define PRINTF(...) diff --git a/apps/er-coap-07/er-coap-07-engine.c b/apps/er-coap-07/er-coap-07-engine.c index 245072b8e..0a226c7ac 100644 --- a/apps/er-coap-07/er-coap-07-engine.c +++ b/apps/er-coap-07/er-coap-07-engine.c @@ -47,7 +47,7 @@ #define DEBUG 0 #if DEBUG #define PRINTF(...) printf(__VA_ARGS__) -#define PRINT6ADDR(addr) PRINTF("[%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x]", ((u8_t *)addr)[0], ((u8_t *)addr)[1], ((u8_t *)addr)[2], ((u8_t *)addr)[3], ((u8_t *)addr)[4], ((u8_t *)addr)[5], ((u8_t *)addr)[6], ((u8_t *)addr)[7], ((u8_t *)addr)[8], ((u8_t *)addr)[9], ((u8_t *)addr)[10], ((u8_t *)addr)[11], ((u8_t *)addr)[12], ((u8_t *)addr)[13], ((u8_t *)addr)[14], ((u8_t *)addr)[15]) +#define PRINT6ADDR(addr) PRINTF("[%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x]", ((uint8_t *)addr)[0], ((uint8_t *)addr)[1], ((uint8_t *)addr)[2], ((uint8_t *)addr)[3], ((uint8_t *)addr)[4], ((uint8_t *)addr)[5], ((uint8_t *)addr)[6], ((uint8_t *)addr)[7], ((uint8_t *)addr)[8], ((uint8_t *)addr)[9], ((uint8_t *)addr)[10], ((uint8_t *)addr)[11], ((uint8_t *)addr)[12], ((uint8_t *)addr)[13], ((uint8_t *)addr)[14], ((uint8_t *)addr)[15]) #define PRINTLLADDR(lladdr) PRINTF(" %02x:%02x:%02x:%02x:%02x:%02x ",(lladdr)->addr[0], (lladdr)->addr[1], (lladdr)->addr[2], (lladdr)->addr[3],(lladdr)->addr[4], (lladdr)->addr[5]) #define PRINTBITS(buf,len) { \ int i,j=0; \ diff --git a/apps/er-coap-07/er-coap-07-observing.c b/apps/er-coap-07/er-coap-07-observing.c index 6c6ed7f1c..f242165be 100644 --- a/apps/er-coap-07/er-coap-07-observing.c +++ b/apps/er-coap-07/er-coap-07-observing.c @@ -44,7 +44,7 @@ #define DEBUG 0 #if DEBUG #define PRINTF(...) printf(__VA_ARGS__) -#define PRINT6ADDR(addr) PRINTF("[%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x]", ((u8_t *)addr)[0], ((u8_t *)addr)[1], ((u8_t *)addr)[2], ((u8_t *)addr)[3], ((u8_t *)addr)[4], ((u8_t *)addr)[5], ((u8_t *)addr)[6], ((u8_t *)addr)[7], ((u8_t *)addr)[8], ((u8_t *)addr)[9], ((u8_t *)addr)[10], ((u8_t *)addr)[11], ((u8_t *)addr)[12], ((u8_t *)addr)[13], ((u8_t *)addr)[14], ((u8_t *)addr)[15]) +#define PRINT6ADDR(addr) PRINTF("[%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x]", ((uint8_t *)addr)[0], ((uint8_t *)addr)[1], ((uint8_t *)addr)[2], ((uint8_t *)addr)[3], ((uint8_t *)addr)[4], ((uint8_t *)addr)[5], ((uint8_t *)addr)[6], ((uint8_t *)addr)[7], ((uint8_t *)addr)[8], ((uint8_t *)addr)[9], ((uint8_t *)addr)[10], ((uint8_t *)addr)[11], ((uint8_t *)addr)[12], ((uint8_t *)addr)[13], ((uint8_t *)addr)[14], ((uint8_t *)addr)[15]) #define PRINTLLADDR(lladdr) PRINTF("[%02x:%02x:%02x:%02x:%02x:%02x]",(lladdr)->addr[0], (lladdr)->addr[1], (lladdr)->addr[2], (lladdr)->addr[3],(lladdr)->addr[4], (lladdr)->addr[5]) #else #define PRINTF(...) diff --git a/apps/er-coap-07/er-coap-07-separate.c b/apps/er-coap-07/er-coap-07-separate.c index f27aed4a7..8cd89dcbe 100644 --- a/apps/er-coap-07/er-coap-07-separate.c +++ b/apps/er-coap-07/er-coap-07-separate.c @@ -44,7 +44,7 @@ #define DEBUG 0 #if DEBUG #define PRINTF(...) printf(__VA_ARGS__) -#define PRINT6ADDR(addr) PRINTF("[%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x]", ((u8_t *)addr)[0], ((u8_t *)addr)[1], ((u8_t *)addr)[2], ((u8_t *)addr)[3], ((u8_t *)addr)[4], ((u8_t *)addr)[5], ((u8_t *)addr)[6], ((u8_t *)addr)[7], ((u8_t *)addr)[8], ((u8_t *)addr)[9], ((u8_t *)addr)[10], ((u8_t *)addr)[11], ((u8_t *)addr)[12], ((u8_t *)addr)[13], ((u8_t *)addr)[14], ((u8_t *)addr)[15]) +#define PRINT6ADDR(addr) PRINTF("[%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x]", ((uint8_t *)addr)[0], ((uint8_t *)addr)[1], ((uint8_t *)addr)[2], ((uint8_t *)addr)[3], ((uint8_t *)addr)[4], ((uint8_t *)addr)[5], ((uint8_t *)addr)[6], ((uint8_t *)addr)[7], ((uint8_t *)addr)[8], ((uint8_t *)addr)[9], ((uint8_t *)addr)[10], ((uint8_t *)addr)[11], ((uint8_t *)addr)[12], ((uint8_t *)addr)[13], ((uint8_t *)addr)[14], ((uint8_t *)addr)[15]) #define PRINTLLADDR(lladdr) PRINTF("[%02x:%02x:%02x:%02x:%02x:%02x]",(lladdr)->addr[0], (lladdr)->addr[1], (lladdr)->addr[2], (lladdr)->addr[3],(lladdr)->addr[4], (lladdr)->addr[5]) #else #define PRINTF(...) diff --git a/apps/er-coap-07/er-coap-07-transactions.c b/apps/er-coap-07/er-coap-07-transactions.c index 739fd746a..bfca2a23b 100644 --- a/apps/er-coap-07/er-coap-07-transactions.c +++ b/apps/er-coap-07/er-coap-07-transactions.c @@ -53,7 +53,7 @@ #if DEBUG #include #define PRINTF(...) printf(__VA_ARGS__) -#define PRINT6ADDR(addr) PRINTF("[%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x]", ((u8_t *)addr)[0], ((u8_t *)addr)[1], ((u8_t *)addr)[2], ((u8_t *)addr)[3], ((u8_t *)addr)[4], ((u8_t *)addr)[5], ((u8_t *)addr)[6], ((u8_t *)addr)[7], ((u8_t *)addr)[8], ((u8_t *)addr)[9], ((u8_t *)addr)[10], ((u8_t *)addr)[11], ((u8_t *)addr)[12], ((u8_t *)addr)[13], ((u8_t *)addr)[14], ((u8_t *)addr)[15]) +#define PRINT6ADDR(addr) PRINTF("[%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x]", ((uint8_t *)addr)[0], ((uint8_t *)addr)[1], ((uint8_t *)addr)[2], ((uint8_t *)addr)[3], ((uint8_t *)addr)[4], ((uint8_t *)addr)[5], ((uint8_t *)addr)[6], ((uint8_t *)addr)[7], ((uint8_t *)addr)[8], ((uint8_t *)addr)[9], ((uint8_t *)addr)[10], ((uint8_t *)addr)[11], ((uint8_t *)addr)[12], ((uint8_t *)addr)[13], ((uint8_t *)addr)[14], ((uint8_t *)addr)[15]) #define PRINTLLADDR(lladdr) PRINTF("[%02x:%02x:%02x:%02x:%02x:%02x]",(lladdr)->addr[0], (lladdr)->addr[1], (lladdr)->addr[2], (lladdr)->addr[3],(lladdr)->addr[4], (lladdr)->addr[5]) #else #define PRINTF(...) diff --git a/apps/er-coap-07/er-coap-07.c b/apps/er-coap-07/er-coap-07.c index 1e3223b2e..a9aed1791 100644 --- a/apps/er-coap-07/er-coap-07.c +++ b/apps/er-coap-07/er-coap-07.c @@ -49,7 +49,7 @@ #if DEBUG #include #define PRINTF(...) printf(__VA_ARGS__) -#define PRINT6ADDR(addr) PRINTF("[%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x]", ((u8_t *)addr)[0], ((u8_t *)addr)[1], ((u8_t *)addr)[2], ((u8_t *)addr)[3], ((u8_t *)addr)[4], ((u8_t *)addr)[5], ((u8_t *)addr)[6], ((u8_t *)addr)[7], ((u8_t *)addr)[8], ((u8_t *)addr)[9], ((u8_t *)addr)[10], ((u8_t *)addr)[11], ((u8_t *)addr)[12], ((u8_t *)addr)[13], ((u8_t *)addr)[14], ((u8_t *)addr)[15]) +#define PRINT6ADDR(addr) PRINTF("[%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x]", ((uint8_t *)addr)[0], ((uint8_t *)addr)[1], ((uint8_t *)addr)[2], ((uint8_t *)addr)[3], ((uint8_t *)addr)[4], ((uint8_t *)addr)[5], ((uint8_t *)addr)[6], ((uint8_t *)addr)[7], ((uint8_t *)addr)[8], ((uint8_t *)addr)[9], ((uint8_t *)addr)[10], ((uint8_t *)addr)[11], ((uint8_t *)addr)[12], ((uint8_t *)addr)[13], ((uint8_t *)addr)[14], ((uint8_t *)addr)[15]) #define PRINTLLADDR(lladdr) PRINTF("[%02x:%02x:%02x:%02x:%02x:%02x]",(lladdr)->addr[0], (lladdr)->addr[1], (lladdr)->addr[2], (lladdr)->addr[3],(lladdr)->addr[4], (lladdr)->addr[5]) #else #define PRINTF(...) diff --git a/apps/erbium/erbium.c b/apps/erbium/erbium.c index 007b1ee2f..165a9c252 100644 --- a/apps/erbium/erbium.c +++ b/apps/erbium/erbium.c @@ -45,7 +45,7 @@ #define DEBUG 0 #if DEBUG #define PRINTF(...) printf(__VA_ARGS__) -#define PRINT6ADDR(addr) PRINTF(" %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x ", ((u8_t *)addr)[0], ((u8_t *)addr)[1], ((u8_t *)addr)[2], ((u8_t *)addr)[3], ((u8_t *)addr)[4], ((u8_t *)addr)[5], ((u8_t *)addr)[6], ((u8_t *)addr)[7], ((u8_t *)addr)[8], ((u8_t *)addr)[9], ((u8_t *)addr)[10], ((u8_t *)addr)[11], ((u8_t *)addr)[12], ((u8_t *)addr)[13], ((u8_t *)addr)[14], ((u8_t *)addr)[15]) +#define PRINT6ADDR(addr) PRINTF(" %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x ", ((uint8_t *)addr)[0], ((uint8_t *)addr)[1], ((uint8_t *)addr)[2], ((uint8_t *)addr)[3], ((uint8_t *)addr)[4], ((uint8_t *)addr)[5], ((uint8_t *)addr)[6], ((uint8_t *)addr)[7], ((uint8_t *)addr)[8], ((uint8_t *)addr)[9], ((uint8_t *)addr)[10], ((uint8_t *)addr)[11], ((uint8_t *)addr)[12], ((uint8_t *)addr)[13], ((uint8_t *)addr)[14], ((uint8_t *)addr)[15]) #define PRINTLLADDR(lladdr) PRINTF(" %02x:%02x:%02x:%02x:%02x:%02x ",(lladdr)->addr[0], (lladdr)->addr[1], (lladdr)->addr[2], (lladdr)->addr[3],(lladdr)->addr[4], (lladdr)->addr[5]) #else #define PRINTF(...) diff --git a/apps/ftp/ftp.c b/apps/ftp/ftp.c index 2d5cf7906..719e535cd 100644 --- a/apps/ftp/ftp.c +++ b/apps/ftp/ftp.c @@ -674,7 +674,7 @@ ftpc_connected(void *connection) } /*---------------------------------------------------------------------------*/ void -ftpc_data(u8_t *data, u16_t len) +ftpc_data(uint8_t *data, uint16_t len) { if(data == NULL) { show_statustext("Download complete", ""); diff --git a/apps/ftp/ftpc.c b/apps/ftp/ftpc.c index 0107cd7e0..81b1e1468 100644 --- a/apps/ftp/ftpc.c +++ b/apps/ftp/ftpc.c @@ -52,7 +52,7 @@ struct ftp_dataconn { #define CONNTYPE_LIST 0 #define CONNTYPE_FILE 1 - u16_t port; + uint16_t port; unsigned char filenameptr; char filename[MAX_FILENAMELEN]; @@ -128,7 +128,7 @@ ftpc_init(void) } /*---------------------------------------------------------------------------*/ void * -ftpc_connect(uip_ipaddr_t *ipaddr, u16_t port) +ftpc_connect(uip_ipaddr_t *ipaddr, uint16_t port) { struct ftp_connection *c; @@ -212,8 +212,8 @@ handle_input(struct ftp_connection *c) static void newdata(struct ftp_connection *c) { - u16_t i; - u8_t d; + uint16_t i; + uint8_t d; for(i = 0; i < uip_datalen(); ++i) { d = ((char *)uip_appdata)[i]; @@ -268,17 +268,17 @@ acked(struct ftp_connection *c) static void senddata(struct ftp_connection *c) { - u16_t len; + uint16_t len; switch(c->state) { case STATE_SEND_USER: - len = 5 + (u16_t)strlen(ftpc_username()) + 2; + len = 5 + (uint16_t)strlen(ftpc_username()) + 2; strcpy(uip_appdata, "USER "); strncpy((char *)uip_appdata + 5, ftpc_username(), uip_mss() - 5 - 2); strcpy((char *)uip_appdata + len - 2, "\r\n"); break; case STATE_SEND_PASS: - len = 5 + (u16_t)strlen(ftpc_password()) + 2; + len = 5 + (uint16_t)strlen(ftpc_password()) + 2; strcpy(uip_appdata, "PASS "); strncpy((char *)uip_appdata + 5, ftpc_password(), uip_mss() - 5 - 2); strcpy((char *)uip_appdata + len - 2, "\r\n"); @@ -290,7 +290,7 @@ senddata(struct ftp_connection *c) (c->dataconn.port) & 0xff); break; case STATE_SEND_OPTIONS: - len = (u16_t)strlen(options.commands[c->optionsptr]); + len = (uint16_t)strlen(options.commands[c->optionsptr]); strcpy(uip_appdata, options.commands[c->optionsptr]); break; case STATE_SEND_NLST: diff --git a/apps/ftp/ftpc.h b/apps/ftp/ftpc.h index 67e76e6af..f1f60392d 100644 --- a/apps/ftp/ftpc.h +++ b/apps/ftp/ftpc.h @@ -39,7 +39,7 @@ void ftpc_init(void); -void *ftpc_connect(uip_ipaddr_t *ipaddr, u16_t port); +void *ftpc_connect(uip_ipaddr_t *ipaddr, uint16_t port); char ftpc_list(void *connection); void ftpc_cwd(void *connection, char *dir); void ftpc_cdup(void *connection); @@ -63,6 +63,6 @@ void ftpc_closed(void); void ftpc_aborted(void); void ftpc_timedout(void); void ftpc_list_file(char *filename); -void ftpc_data(u8_t *data, u16_t len); +void ftpc_data(uint8_t *data, uint16_t len); #endif /* __FTPC_H__ */ diff --git a/apps/netconf/netconf.c b/apps/netconf/netconf.c index 62dc3239d..59ba3aa47 100644 --- a/apps/netconf/netconf.c +++ b/apps/netconf/netconf.c @@ -73,7 +73,7 @@ static void makestrings(void); /*-----------------------------------------------------------------------------------*/ static char * -makebyte(u8_t byte, char *str) +makebyte(uint8_t byte, char *str) { if(byte >= 100) { *str++ = (byte / 100 ) % 10 + '0'; diff --git a/apps/ping6/ping6.c b/apps/ping6/ping6.c index 369c001be..e2d5806c6 100644 --- a/apps/ping6/ping6.c +++ b/apps/ping6/ping6.c @@ -42,7 +42,7 @@ #if DEBUG #include #define PRINTF(...) printf(__VA_ARGS__) -#define PRINT6ADDR(addr) PRINTF(" %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x ", ((u8_t *)addr)[0], ((u8_t *)addr)[1], ((u8_t *)addr)[2], ((u8_t *)addr)[3], ((u8_t *)addr)[4], ((u8_t *)addr)[5], ((u8_t *)addr)[6], ((u8_t *)addr)[7], ((u8_t *)addr)[8], ((u8_t *)addr)[9], ((u8_t *)addr)[10], ((u8_t *)addr)[11], ((u8_t *)addr)[12], ((u8_t *)addr)[13], ((u8_t *)addr)[14], ((u8_t *)addr)[15]) +#define PRINT6ADDR(addr) PRINTF(" %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x ", ((uint8_t *)addr)[0], ((uint8_t *)addr)[1], ((uint8_t *)addr)[2], ((uint8_t *)addr)[3], ((uint8_t *)addr)[4], ((uint8_t *)addr)[5], ((uint8_t *)addr)[6], ((uint8_t *)addr)[7], ((uint8_t *)addr)[8], ((uint8_t *)addr)[9], ((uint8_t *)addr)[10], ((uint8_t *)addr)[11], ((uint8_t *)addr)[12], ((uint8_t *)addr)[13], ((uint8_t *)addr)[14], ((uint8_t *)addr)[15]) #define PRINTLLADDR(lladdr) PRINTF(" %02x:%02x:%02x:%02x:%02x:%02x ",lladdr->addr[0], lladdr->addr[1], lladdr->addr[2], lladdr->addr[3],lladdr->addr[4], lladdr->addr[5]) #else #define PRINTF(...) @@ -56,9 +56,9 @@ #define UIP_ICMP_BUF ((struct uip_icmp_hdr *)&uip_buf[uip_l2_l3_hdr_len]) static struct etimer ping6_periodic_timer; -static u8_t count = 0; +static uint8_t count = 0; static char command[20]; -static u16_t addr[8]; +static uint16_t addr[8]; uip_ipaddr_t dest_addr; PROCESS(ping6_process, "PING6 process"); @@ -66,7 +66,7 @@ AUTOSTART_PROCESSES(&ping6_process); /*---------------------------------------------------------------------------*/ -static u8_t +static uint8_t ping6handler(process_event_t ev, process_data_t data) { if(count == 0){ @@ -130,8 +130,8 @@ ping6handler(process_event_t ev, process_data_t data) uip_len = UIP_ICMPH_LEN + UIP_ICMP6_ECHO_REQUEST_LEN + UIP_IPH_LEN + PING6_DATALEN; - UIP_IP_BUF->len[0] = (u8_t)((uip_len - 40) >> 8); - UIP_IP_BUF->len[1] = (u8_t)((uip_len - 40) & 0x00FF); + UIP_IP_BUF->len[0] = (uint8_t)((uip_len - 40) >> 8); + UIP_IP_BUF->len[1] = (uint8_t)((uip_len - 40) & 0x00FF); UIP_ICMP_BUF->icmpchksum = 0; UIP_ICMP_BUF->icmpchksum = ~uip_icmp6chksum(); @@ -157,7 +157,7 @@ ping6handler(process_event_t ev, process_data_t data) PROCESS_THREAD(ping6_process, ev, data) { - u8_t cont = 1; + uint8_t cont = 1; PROCESS_BEGIN(); PRINTF("In Process PING6\n"); diff --git a/apps/rest-coap/coap-common.c b/apps/rest-coap/coap-common.c index deb4e222e..0ddff495d 100644 --- a/apps/rest-coap/coap-common.c +++ b/apps/rest-coap/coap-common.c @@ -30,7 +30,7 @@ #if DEBUG #include #define PRINTF(...) printf(__VA_ARGS__) -#define PRINT6ADDR(addr) PRINTF(" %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x ", ((u8_t *)addr)[0], ((u8_t *)addr)[1], ((u8_t *)addr)[2], ((u8_t *)addr)[3], ((u8_t *)addr)[4], ((u8_t *)addr)[5], ((u8_t *)addr)[6], ((u8_t *)addr)[7], ((u8_t *)addr)[8], ((u8_t *)addr)[9], ((u8_t *)addr)[10], ((u8_t *)addr)[11], ((u8_t *)addr)[12], ((u8_t *)addr)[13], ((u8_t *)addr)[14], ((u8_t *)addr)[15]) +#define PRINT6ADDR(addr) PRINTF(" %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x ", ((uint8_t *)addr)[0], ((uint8_t *)addr)[1], ((uint8_t *)addr)[2], ((uint8_t *)addr)[3], ((uint8_t *)addr)[4], ((uint8_t *)addr)[5], ((uint8_t *)addr)[6], ((uint8_t *)addr)[7], ((uint8_t *)addr)[8], ((uint8_t *)addr)[9], ((uint8_t *)addr)[10], ((uint8_t *)addr)[11], ((uint8_t *)addr)[12], ((uint8_t *)addr)[13], ((uint8_t *)addr)[14], ((uint8_t *)addr)[15]) #define PRINTLLADDR(lladdr) PRINTF(" %02x:%02x:%02x:%02x:%02x:%02x ",(lladdr)->addr[0], (lladdr)->addr[1], (lladdr)->addr[2], (lladdr)->addr[3],(lladdr)->addr[4], (lladdr)->addr[5]) #else #define PRINTF(...) diff --git a/apps/rest-coap/coap-server.c b/apps/rest-coap/coap-server.c index 2fb944325..6f20e364c 100644 --- a/apps/rest-coap/coap-server.c +++ b/apps/rest-coap/coap-server.c @@ -20,7 +20,7 @@ #if DEBUG #include #define PRINTF(...) printf(__VA_ARGS__) -#define PRINT6ADDR(addr) PRINTF(" %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x ", ((u8_t *)addr)[0], ((u8_t *)addr)[1], ((u8_t *)addr)[2], ((u8_t *)addr)[3], ((u8_t *)addr)[4], ((u8_t *)addr)[5], ((u8_t *)addr)[6], ((u8_t *)addr)[7], ((u8_t *)addr)[8], ((u8_t *)addr)[9], ((u8_t *)addr)[10], ((u8_t *)addr)[11], ((u8_t *)addr)[12], ((u8_t *)addr)[13], ((u8_t *)addr)[14], ((u8_t *)addr)[15]) +#define PRINT6ADDR(addr) PRINTF(" %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x ", ((uint8_t *)addr)[0], ((uint8_t *)addr)[1], ((uint8_t *)addr)[2], ((uint8_t *)addr)[3], ((uint8_t *)addr)[4], ((uint8_t *)addr)[5], ((uint8_t *)addr)[6], ((uint8_t *)addr)[7], ((uint8_t *)addr)[8], ((uint8_t *)addr)[9], ((uint8_t *)addr)[10], ((uint8_t *)addr)[11], ((uint8_t *)addr)[12], ((uint8_t *)addr)[13], ((uint8_t *)addr)[14], ((uint8_t *)addr)[15]) #define PRINTLLADDR(lladdr) PRINTF(" %02x:%02x:%02x:%02x:%02x:%02x ",(lladdr)->addr[0], (lladdr)->addr[1], (lladdr)->addr[2], (lladdr)->addr[3],(lladdr)->addr[4], (lladdr)->addr[5]) #else #define PRINTF(...) @@ -420,10 +420,10 @@ handle_incoming_data(void) int error=NO_ERROR; char buf[MAX_PAYLOAD_LEN]; - PRINTF("uip_datalen received %u \n",(u16_t)uip_datalen()); + PRINTF("uip_datalen received %u \n",(uint16_t)uip_datalen()); char* data = (char *)uip_appdata + uip_ext_len; - u16_t datalen = uip_datalen() - uip_ext_len; + uint16_t datalen = uip_datalen() - uip_ext_len; int data_size = 0; diff --git a/apps/rest-common/rest.c b/apps/rest-common/rest.c index c1b383c44..b28ae1bd5 100644 --- a/apps/rest-common/rest.c +++ b/apps/rest-common/rest.c @@ -7,7 +7,7 @@ #if DEBUG #include #define PRINTF(...) printf(__VA_ARGS__) -#define PRINT6ADDR(addr) PRINTF(" %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x ", ((u8_t *)addr)[0], ((u8_t *)addr)[1], ((u8_t *)addr)[2], ((u8_t *)addr)[3], ((u8_t *)addr)[4], ((u8_t *)addr)[5], ((u8_t *)addr)[6], ((u8_t *)addr)[7], ((u8_t *)addr)[8], ((u8_t *)addr)[9], ((u8_t *)addr)[10], ((u8_t *)addr)[11], ((u8_t *)addr)[12], ((u8_t *)addr)[13], ((u8_t *)addr)[14], ((u8_t *)addr)[15]) +#define PRINT6ADDR(addr) PRINTF(" %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x ", ((uint8_t *)addr)[0], ((uint8_t *)addr)[1], ((uint8_t *)addr)[2], ((uint8_t *)addr)[3], ((uint8_t *)addr)[4], ((uint8_t *)addr)[5], ((uint8_t *)addr)[6], ((uint8_t *)addr)[7], ((uint8_t *)addr)[8], ((uint8_t *)addr)[9], ((uint8_t *)addr)[10], ((uint8_t *)addr)[11], ((uint8_t *)addr)[12], ((uint8_t *)addr)[13], ((uint8_t *)addr)[14], ((uint8_t *)addr)[15]) #define PRINTLLADDR(lladdr) PRINTF(" %02x:%02x:%02x:%02x:%02x:%02x ",(lladdr)->addr[0], (lladdr)->addr[1], (lladdr)->addr[2], (lladdr)->addr[3],(lladdr)->addr[4], (lladdr)->addr[5]) #else #define PRINTF(...) diff --git a/apps/rest-common/static-routing.c b/apps/rest-common/static-routing.c index 91cff3719..1be139f89 100644 --- a/apps/rest-common/static-routing.c +++ b/apps/rest-common/static-routing.c @@ -13,7 +13,7 @@ #if DEBUG #include #define PRINTF(...) printf(__VA_ARGS__) -#define PRINT6ADDR(addr) PRINTF(" %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x ", ((u8_t *)addr)[0], ((u8_t *)addr)[1], ((u8_t *)addr)[2], ((u8_t *)addr)[3], ((u8_t *)addr)[4], ((u8_t *)addr)[5], ((u8_t *)addr)[6], ((u8_t *)addr)[7], ((u8_t *)addr)[8], ((u8_t *)addr)[9], ((u8_t *)addr)[10], ((u8_t *)addr)[11], ((u8_t *)addr)[12], ((u8_t *)addr)[13], ((u8_t *)addr)[14], ((u8_t *)addr)[15]) +#define PRINT6ADDR(addr) PRINTF(" %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x ", ((uint8_t *)addr)[0], ((uint8_t *)addr)[1], ((uint8_t *)addr)[2], ((uint8_t *)addr)[3], ((uint8_t *)addr)[4], ((uint8_t *)addr)[5], ((uint8_t *)addr)[6], ((uint8_t *)addr)[7], ((uint8_t *)addr)[8], ((uint8_t *)addr)[9], ((uint8_t *)addr)[10], ((uint8_t *)addr)[11], ((uint8_t *)addr)[12], ((uint8_t *)addr)[13], ((uint8_t *)addr)[14], ((uint8_t *)addr)[15]) #define PRINTLLADDR(lladdr) PRINTF(" %02x:%02x:%02x:%02x:%02x:%02x ",(lladdr)->addr[0], (lladdr)->addr[1], (lladdr)->addr[2], (lladdr)->addr[3],(lladdr)->addr[4], (lladdr)->addr[5]) #else #define PRINTF(...) diff --git a/apps/rest-http/http-server.c b/apps/rest-http/http-server.c index 26385b493..256e37904 100644 --- a/apps/rest-http/http-server.c +++ b/apps/rest-http/http-server.c @@ -15,7 +15,7 @@ #if DEBUG #include #define PRINTF(...) printf(__VA_ARGS__) -#define PRINT6ADDR(addr) PRINTF(" %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x ", ((u8_t *)addr)[0], ((u8_t *)addr)[1], ((u8_t *)addr)[2], ((u8_t *)addr)[3], ((u8_t *)addr)[4], ((u8_t *)addr)[5], ((u8_t *)addr)[6], ((u8_t *)addr)[7], ((u8_t *)addr)[8], ((u8_t *)addr)[9], ((u8_t *)addr)[10], ((u8_t *)addr)[11], ((u8_t *)addr)[12], ((u8_t *)addr)[13], ((u8_t *)addr)[14], ((u8_t *)addr)[15]) +#define PRINT6ADDR(addr) PRINTF(" %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x ", ((uint8_t *)addr)[0], ((uint8_t *)addr)[1], ((uint8_t *)addr)[2], ((uint8_t *)addr)[3], ((uint8_t *)addr)[4], ((uint8_t *)addr)[5], ((uint8_t *)addr)[6], ((uint8_t *)addr)[7], ((uint8_t *)addr)[8], ((uint8_t *)addr)[9], ((uint8_t *)addr)[10], ((uint8_t *)addr)[11], ((uint8_t *)addr)[12], ((uint8_t *)addr)[13], ((uint8_t *)addr)[14], ((uint8_t *)addr)[15]) #define PRINTLLADDR(lladdr) PRINTF(" %02x:%02x:%02x:%02x:%02x:%02x ",(lladdr)->addr[0], (lladdr)->addr[1], (lladdr)->addr[2], (lladdr)->addr[3],(lladdr)->addr[4], (lladdr)->addr[5]) #else #define PRINTF(...) diff --git a/apps/servreg-hack/servreg-hack.c b/apps/servreg-hack/servreg-hack.c index 8a0165f2c..fdc68f238 100644 --- a/apps/servreg-hack/servreg-hack.c +++ b/apps/servreg-hack/servreg-hack.c @@ -330,7 +330,7 @@ send_udp_packet(struct uip_udp_conn *conn) } /*---------------------------------------------------------------------------*/ static void -parse_incoming_packet(const u8_t *buf, int len) +parse_incoming_packet(const uint8_t *buf, int len) { int numregs; int flags; diff --git a/apps/shell/shell-ping.c b/apps/shell/shell-ping.c index 4957a4fa7..4568e2861 100644 --- a/apps/shell/shell-ping.c +++ b/apps/shell/shell-ping.c @@ -85,8 +85,8 @@ send_ping(uip_ipaddr_t *dest_addr) uip_len = UIP_ICMPH_LEN + UIP_ICMP6_ECHO_REQUEST_LEN + UIP_IPH_LEN + PING_DATALEN; - UIP_IP_BUF->len[0] = (u8_t)((uip_len - 40) >> 8); - UIP_IP_BUF->len[1] = (u8_t)((uip_len - 40) & 0x00ff); + UIP_IP_BUF->len[0] = (uint8_t)((uip_len - 40) >> 8); + UIP_IP_BUF->len[1] = (uint8_t)((uip_len - 40) & 0x00ff); UIP_ICMP_BUF->icmpchksum = 0; UIP_ICMP_BUF->icmpchksum = ~uip_icmp6chksum(); @@ -116,11 +116,11 @@ send_ping(uip_ipaddr_t *dest_addr) UIP_ICMP_BUF->seqno = uip_htons(seqno++); uip_len = UIP_ICMPH_LEN + UIP_IPH_LEN + PING_DATALEN; - UIP_IP_BUF->len[0] = (u8_t)((uip_len) >> 8); - UIP_IP_BUF->len[1] = (u8_t)((uip_len) & 0x00ff); + UIP_IP_BUF->len[0] = (uint8_t)((uip_len) >> 8); + UIP_IP_BUF->len[1] = (uint8_t)((uip_len) & 0x00ff); UIP_ICMP_BUF->icmpchksum = 0; - UIP_ICMP_BUF->icmpchksum = ~uip_chksum((u16_t *)&(UIP_ICMP_BUF->type), + UIP_ICMP_BUF->icmpchksum = ~uip_chksum((uint16_t *)&(UIP_ICMP_BUF->type), UIP_ICMPH_LEN + PING_DATALEN); /* Calculate IP checksum. */ diff --git a/apps/shell/shell-rime-ping.c b/apps/shell/shell-rime-ping.c index 2fa0286df..ff8869d01 100644 --- a/apps/shell/shell-rime-ping.c +++ b/apps/shell/shell-rime-ping.c @@ -123,7 +123,7 @@ sent_mesh(struct mesh_conn *c) { } static void -recv_mesh(struct mesh_conn *c, const rimeaddr_t *from, u8_t hops) +recv_mesh(struct mesh_conn *c, const rimeaddr_t *from, uint8_t hops) { struct rime_ping_msg ping; char buf[64]; diff --git a/apps/shell/shell-rime.c b/apps/shell/shell-rime.c index 9a8d4a2fd..0403e3ecf 100644 --- a/apps/shell/shell-rime.c +++ b/apps/shell/shell-rime.c @@ -293,7 +293,7 @@ PROCESS_THREAD(shell_send_process, ev, data) } /*---------------------------------------------------------------------------*/ static void -recv_collect(const rimeaddr_t *originator, u8_t seqno, u8_t hops) +recv_collect(const rimeaddr_t *originator, uint8_t seqno, uint8_t hops) { struct collect_msg collect_msg; char *dataptr; diff --git a/apps/shell/shell-tcpsend.c b/apps/shell/shell-tcpsend.c index 019ca3b12..166cb5b08 100644 --- a/apps/shell/shell-tcpsend.c +++ b/apps/shell/shell-tcpsend.c @@ -82,7 +82,7 @@ telnet_text_output(struct telnet_state *s, char *text1, char *text2) } /*---------------------------------------------------------------------------*/ void -telnet_newdata(struct telnet_state *s, char *data, u16_t len) +telnet_newdata(struct telnet_state *s, char *data, uint16_t len) { shell_output(&tcpsend_command, data, len, "", 0); } diff --git a/apps/shell/shell-wget.c b/apps/shell/shell-wget.c index b52383391..401807fb1 100644 --- a/apps/shell/shell-wget.c +++ b/apps/shell/shell-wget.c @@ -191,7 +191,7 @@ shell_wget_init(void) } /*---------------------------------------------------------------------------*/ void -webclient_datahandler(char *data, u16_t len) +webclient_datahandler(char *data, uint16_t len) { if(len == 0) { running = 0; diff --git a/apps/telnet/simpletelnet.c b/apps/telnet/simpletelnet.c index 1efc45f3e..cbd744dd7 100644 --- a/apps/telnet/simpletelnet.c +++ b/apps/telnet/simpletelnet.c @@ -152,7 +152,7 @@ static void connect(void) { uip_ipaddr_t addr, *addrptr; - u16_t port; + uint16_t port; char *cptr; struct uip_conn *conn; @@ -310,7 +310,7 @@ telnet_timedout(struct telnet_state *s) } /*-----------------------------------------------------------------------------------*/ void -telnet_newdata(struct telnet_state *s, char *data, u16_t len) +telnet_newdata(struct telnet_state *s, char *data, uint16_t len) { petsciiconv_topetscii(data, len); data[len] = 0; diff --git a/apps/telnet/telnet.c b/apps/telnet/telnet.c index 8e7debc39..95ee9d059 100644 --- a/apps/telnet/telnet.c +++ b/apps/telnet/telnet.c @@ -44,7 +44,7 @@ #define FLAG_ABORT 2 /*-----------------------------------------------------------------------------------*/ unsigned char -telnet_send(struct telnet_state *s, char *text, u16_t len) +telnet_send(struct telnet_state *s, char *text, uint16_t len) { if(s->text != NULL) { return 1; @@ -104,7 +104,7 @@ senddata(struct telnet_state *s) } /*-----------------------------------------------------------------------------------*/ struct telnet_state * -telnet_connect(struct telnet_state *s, uip_ipaddr_t *addr, u16_t port) +telnet_connect(struct telnet_state *s, uip_ipaddr_t *addr, uint16_t port) { struct uip_conn *conn; diff --git a/apps/telnet/telnet.h b/apps/telnet/telnet.h index cb888a5a3..638b0c4f4 100644 --- a/apps/telnet/telnet.h +++ b/apps/telnet/telnet.h @@ -39,16 +39,16 @@ struct telnet_state { unsigned char flags; char *text; - u16_t textlen; - u16_t sentlen; + uint16_t textlen; + uint16_t sentlen; }; /*DISPATCHER_UIPCALL(telnet_app, s);*/ void telnet_app(void *s); -unsigned char telnet_send(struct telnet_state *s, char *text, u16_t len); +unsigned char telnet_send(struct telnet_state *s, char *text, uint16_t len); unsigned char telnet_close(struct telnet_state *s); unsigned char telnet_abort(struct telnet_state *s); -struct telnet_state *telnet_connect(struct telnet_state *s, uip_ipaddr_t *addr, u16_t port); +struct telnet_state *telnet_connect(struct telnet_state *s, uip_ipaddr_t *addr, uint16_t port); /* Callbacks, implemented by the caller. */ @@ -57,5 +57,5 @@ void telnet_closed(struct telnet_state *s); void telnet_sent(struct telnet_state *s); void telnet_aborted(struct telnet_state *s); void telnet_timedout(struct telnet_state *s); -void telnet_newdata(struct telnet_state *s, char *data, u16_t len); +void telnet_newdata(struct telnet_state *s, char *data, uint16_t len); #endif /* __TELNET_H__ */ diff --git a/apps/telnetd/telnetd.c b/apps/telnetd/telnetd.c index 1ee7bd586..d994629db 100644 --- a/apps/telnetd/telnetd.c +++ b/apps/telnetd/telnetd.c @@ -66,7 +66,7 @@ struct telnetd_state { char buf[TELNETD_CONF_LINELEN + 1]; char bufptr; uint16_t numsent; - u8_t state; + uint8_t state; #define STATE_NORMAL 0 #define STATE_IAC 1 #define STATE_WILL 2 @@ -239,7 +239,7 @@ senddata(void) } /*---------------------------------------------------------------------------*/ static void -get_char(u8_t c) +get_char(uint8_t c) { PRINTF("telnetd: get_char '%c' %d %d\n", c, c, s.bufptr); @@ -264,7 +264,7 @@ get_char(u8_t c) } /*---------------------------------------------------------------------------*/ static void -sendopt(u8_t option, u8_t value) +sendopt(uint8_t option, uint8_t value) { char line[4]; line[0] = (char)TELNET_IAC; @@ -278,8 +278,8 @@ sendopt(u8_t option, u8_t value) static void newdata(void) { - u16_t len; - u8_t c; + uint16_t len; + uint8_t c; uint8_t *ptr; len = uip_datalen(); diff --git a/apps/vnc/vnc-draw.h b/apps/vnc/vnc-draw.h index e6bc3947e..ec806a3b9 100644 --- a/apps/vnc/vnc-draw.h +++ b/apps/vnc/vnc-draw.h @@ -39,7 +39,7 @@ #include "net/uip_arch.h" /* Pointer to the bitmap area in memory. */ -extern u8_t vnc_draw_bitmap[]; +extern uint8_t vnc_draw_bitmap[]; /* Initialize the vnc-draw module. */ void vnc_draw_init(void); @@ -48,14 +48,14 @@ void vnc_draw_init(void); given by the "data" argument and the length of data is given by the "datalen" argument. The data format is one pixel per byte in bgr233 format (bbgggrrr). */ -void vnc_draw_pixelline(u16_t x, u16_t y, - u8_t *data, u16_t datalen); +void vnc_draw_pixelline(uint16_t x, uint16_t y, + uint8_t *data, uint16_t datalen); /* The following functions should return the x and y coordinates and the width and height of the viewport. */ -u16_t vnc_draw_viewport_x(void); -u16_t vnc_draw_viewport_y(void); -u16_t vnc_draw_viewport_w(void); -u16_t vnc_draw_viewport_h(void); +uint16_t vnc_draw_viewport_x(void); +uint16_t vnc_draw_viewport_y(void); +uint16_t vnc_draw_viewport_w(void); +uint16_t vnc_draw_viewport_h(void); #endif /* __VNC_DRAW_H__ */ diff --git a/apps/vnc/vnc-viewer.c b/apps/vnc/vnc-viewer.c index b83d2c63a..b4cd36878 100644 --- a/apps/vnc/vnc-viewer.c +++ b/apps/vnc/vnc-viewer.c @@ -48,7 +48,7 @@ #define RFB_SERVER_VERSION_STRING rfb_server_version_string /* "RFB 003.003" */ -static u8_t rfb_server_version_string[12] = +static uint8_t rfb_server_version_string[12] = {82,70,66,32,48,48,51,46,48,48,51,10}; #if 0 @@ -77,7 +77,7 @@ vnc_viewer_close(void) } /*-----------------------------------------------------------------------------------*/ void -vnc_viewer_connect(u16_t *server, u8_t display) +vnc_viewer_connect(uint16_t *server, uint8_t display) { struct uip_conn *conn; @@ -96,10 +96,10 @@ vnc_viewer_connect(u16_t *server, u8_t display) static void senddata(void) { - register u8_t *dataptr; - u16_t dataleft; + register uint8_t *dataptr; + uint16_t dataleft; - dataptr = (u8_t *)uip_appdata; + dataptr = (uint8_t *)uip_appdata; switch(vs->sendmsg) { case VNC_SEND_VERSION: @@ -115,7 +115,7 @@ senddata(void) case VNC_SEND_CINIT: PRINTF(("Sending CINIT\n")); /* Send one byte of client init. */ - *(u8_t *)dataptr = 1; + *(uint8_t *)dataptr = 1; uip_send(uip_appdata, 1); break; case VNC_SEND_PFMT: @@ -144,10 +144,10 @@ senddata(void) dataptr += sizeof(struct rfb_set_encodings); dataptr[0] = dataptr[1] = dataptr[2] = 0; dataptr[3] = RFB_ENC_RAW; - /* ((u8_t *)dataptr + sizeof(struct rfb_set_encodings))[4] = - ((u8_t *)dataptr + sizeof(struct rfb_set_encodings))[5] = - ((u8_t *)dataptr + sizeof(struct rfb_set_encodings))[6] = 0; - ((u8_t *)dataptr + sizeof(struct rfb_set_encodings))[7] = RFB_ENC_RRE;*/ + /* ((uint8_t *)dataptr + sizeof(struct rfb_set_encodings))[4] = + ((uint8_t *)dataptr + sizeof(struct rfb_set_encodings))[5] = + ((uint8_t *)dataptr + sizeof(struct rfb_set_encodings))[6] = 0; + ((uint8_t *)dataptr + sizeof(struct rfb_set_encodings))[7] = RFB_ENC_RRE;*/ uip_send(uip_appdata, sizeof(struct rfb_set_encodings) + 4); break; case VNC_SEND_UPDATERQ: @@ -230,7 +230,7 @@ senddata(void) } /*-----------------------------------------------------------------------------------*/ static void -buffer_data(u8_t *data, u16_t datalen) +buffer_data(uint8_t *data, uint16_t datalen) { PRINTF(("Buffering %d bytes of data\n", datalen)); @@ -254,11 +254,11 @@ clearbuffer(void) } /*-----------------------------------------------------------------------------------*/ /* Returns: the amount of bytes actually read. */ -static u16_t -recv_rectstate(u8_t *dataptr, u16_t datalen) +static uint16_t +recv_rectstate(uint8_t *dataptr, uint16_t datalen) { - u16_t pixels; - u16_t pixelsleft; + uint16_t pixels; + uint16_t pixelsleft; switch(vs->rectstate) { case VNC_RECTSTATE_RAW: @@ -309,7 +309,7 @@ recv_rectstate(u8_t *dataptr, u16_t datalen) rect can be drawn. */ static unsigned short recv_update_rect(CC_REGISTER_ARG struct rfb_fb_update_rect_hdr *rhdr, - u16_t dataleft) + uint16_t dataleft) { struct rfb_rre_hdr *rrehdr; @@ -319,7 +319,7 @@ recv_update_rect(CC_REGISTER_ARG struct rfb_fb_update_rect_hdr *rhdr, rhdr->encoding[2]) == 0) { switch(rhdr->encoding[3]) { case RFB_ENC_RAW: - vs->rectstateleft = (u32_t)uip_htons(rhdr->rect.w) * (u32_t)uip_htons(rhdr->rect.h); + vs->rectstateleft = (uint32_t)uip_htons(rhdr->rect.w) * (uint32_t)uip_htons(rhdr->rect.h); vs->rectstate = VNC_RECTSTATE_RAW; vs->rectstatex0 = vs->rectstatex = uip_htons(rhdr->rect.x); vs->rectstatey0 = vs->rectstatey = uip_htons(rhdr->rect.y); @@ -330,14 +330,14 @@ recv_update_rect(CC_REGISTER_ARG struct rfb_fb_update_rect_hdr *rhdr, break; case RFB_ENC_RRE: - rrehdr = (struct rfb_rre_hdr *)((u8_t *)rhdr + + rrehdr = (struct rfb_rre_hdr *)((uint8_t *)rhdr + sizeof(struct rfb_fb_update_rect_hdr)); PRINTF(("Received RRE subrects %d (%d)\n", (uip_htons(rrehdr->subrects[1]) << 16) + uip_htons(rrehdr->subrects[0]), rrehdr->bgpixel)); - vs->rectstateleft = ((u32_t)(uip_htons(rrehdr->subrects[1]) << 16) + - (u32_t)uip_htons(rrehdr->subrects[0])); + vs->rectstateleft = ((uint32_t)(uip_htons(rrehdr->subrects[1]) << 16) + + (uint32_t)uip_htons(rrehdr->subrects[0])); vs->rectstate = VNC_RECTSTATE_RRE; break; @@ -363,8 +363,8 @@ recv_update_rect(CC_REGISTER_ARG struct rfb_fb_update_rect_hdr *rhdr, * incoming message and returns the number of bytes of data that is to * be expected. */ -static u16_t -identify_data(CC_REGISTER_ARG u8_t *data, u16_t datalen) +static uint16_t +identify_data(CC_REGISTER_ARG uint8_t *data, uint16_t datalen) { switch(vs->waitmsg) { case VNC_WAIT_VERSION: @@ -405,7 +405,7 @@ identify_data(CC_REGISTER_ARG u8_t *data, u16_t datalen) default: uip_abort(); - PRINTF(("Weird message type received (%d)\n", *(u8_t *)uip_appdata)); + PRINTF(("Weird message type received (%d)\n", *(uint8_t *)uip_appdata)); return 0; } break; @@ -425,7 +425,7 @@ identify_data(CC_REGISTER_ARG u8_t *data, u16_t datalen) * Handles the data. */ static unsigned short -handle_data(CC_REGISTER_ARG u8_t *data, u16_t datalen) +handle_data(CC_REGISTER_ARG uint8_t *data, uint16_t datalen) { switch(vs->waitmsg) { @@ -461,7 +461,7 @@ handle_data(CC_REGISTER_ARG u8_t *data, u16_t datalen) uip_htons(((struct rfb_server_init *)data)->height), ((struct rfb_server_init *)data)->format.bps, ((struct rfb_server_init *)data)->format.depth, - ((u8_t *)data + sizeof(struct rfb_server_init))));*/ + ((uint8_t *)data + sizeof(struct rfb_server_init))));*/ vs->w = uip_htons(((struct rfb_server_init *)data)->width); vs->h = uip_htons(((struct rfb_server_init *)data)->height); vs->sendmsg = VNC_SEND_PFMT; @@ -490,7 +490,7 @@ handle_data(CC_REGISTER_ARG u8_t *data, u16_t datalen) break; default: - PRINTF(("Weird message type received (%d)\n", *(u8_t *)data)); + PRINTF(("Weird message type received (%d)\n", *(uint8_t *)data)); break; } break; @@ -525,15 +525,15 @@ handle_data(CC_REGISTER_ARG u8_t *data, u16_t datalen) * care of the next time this function is invoked (i.e., for the next * incoming data chunk). */ -static u8_t +static uint8_t newdata(void) { - u16_t datalen; - u16_t readlen; - u8_t *dataptr; + uint16_t datalen; + uint16_t readlen; + uint8_t *dataptr; datalen = uip_datalen(); - dataptr = (u8_t *)uip_appdata; + dataptr = (uint8_t *)uip_appdata; PRINTF(("newdata: %d bytes\n", datalen)); @@ -558,7 +558,7 @@ newdata(void) sequence for the data that is left in the incoming chunk. */ datalen -= vs->bufferleft; dataptr += vs->bufferleft; - buffer_data((u8_t *)uip_appdata, vs->bufferleft); + buffer_data((uint8_t *)uip_appdata, vs->bufferleft); handle_data(vs->buffer, vs->buffersize); clearbuffer(); } else { /* datalen < vs->bufferleft */ @@ -710,9 +710,9 @@ vnc_viewer_appcall(void * nullptr) } /*-----------------------------------------------------------------------------------*/ void -vnc_viewer_post_event(u8_t type, - u16_t data1, u16_t data2, - u16_t data3, u16_t data4) +vnc_viewer_post_event(uint8_t type, + uint16_t data1, uint16_t data2, + uint16_t data3, uint16_t data4) { register struct vnc_event *ev; struct vnc_event *ev0; diff --git a/apps/vnc/vnc-viewer.h b/apps/vnc/vnc-viewer.h index 443748e9e..2ae97c682 100644 --- a/apps/vnc/vnc-viewer.h +++ b/apps/vnc/vnc-viewer.h @@ -39,12 +39,12 @@ struct vnc_viewer_state; -/*typedef unsigned long u32_t;*/ +/*typedef unsigned long uint32_t;*/ void vnc_viewer_init(void); void vnc_viewer_appcall(void *nullptr); -void vnc_viewer_connect(u16_t *server, u8_t display); +void vnc_viewer_connect(uint16_t *server, uint8_t display); void vnc_viewer_close(void); /* Callback: redraws the VNC viewer bitmap area. */ @@ -63,9 +63,9 @@ void vnc_viewer_refresh(void); #define VNC_VIEWER_POST_UPDATERQ_EVENT(x1,y1,x2,y2) \ vnc_viewer_post_event(VNC_UPDATERQ_EVENT, x1, y1, x2, y2) -void vnc_viewer_post_event(u8_t event, - u16_t data1, u16_t data2, - u16_t data3, u16_t data4); +void vnc_viewer_post_event(uint8_t event, + uint16_t data1, uint16_t data2, + uint16_t data3, uint16_t data4); /* UIP_APPCALL: the name of the application function. This function must return void and take no arguments (i.e., C type "void @@ -75,22 +75,22 @@ void vnc_viewer_post_event(u8_t event, #endif struct vnc_key_event { - u8_t down; - u16_t key; + uint8_t down; + uint16_t key; }; struct vnc_pointer_event { - u8_t buttonmask; - u16_t x, y; + uint8_t buttonmask; + uint16_t x, y; }; struct vnc_updaterq_event { - u16_t x, y; - u16_t w, h; + uint16_t x, y; + uint16_t w, h; }; struct vnc_event { - u8_t type; + uint8_t type; union { struct vnc_key_event key; struct vnc_pointer_event ptr; @@ -133,34 +133,34 @@ enum vnc_rectstate { }; struct vnc_viewer_state { - u8_t close; - u16_t w, h; + uint8_t close; + uint16_t w, h; - u8_t sendmsg; + uint8_t sendmsg; - u8_t waitmsg; + uint8_t waitmsg; - u16_t rectsleft; + uint16_t rectsleft; - u8_t rectstate; - u32_t rectstateleft; - u16_t rectstatex, rectstatey; - u16_t rectstateh, rectstatew; - u16_t rectstatex0, rectstatey0; - u16_t rectstatex2, rectstatey2; + uint8_t rectstate; + uint32_t rectstateleft; + uint16_t rectstatex, rectstatey; + uint16_t rectstateh, rectstatew; + uint16_t rectstatex0, rectstatey0; + uint16_t rectstatex2, rectstatey2; - u16_t eventptr_acked; - u16_t eventptr_unacked; - u16_t eventptr_next; + uint16_t eventptr_acked; + uint16_t eventptr_unacked; + uint16_t eventptr_next; #define VNC_EVENTQUEUE_SIZE 32 struct vnc_event event_queue[VNC_EVENTQUEUE_SIZE]; - u16_t bufferleft; - u16_t buffersize; + uint16_t bufferleft; + uint16_t buffersize; #define VNC_BUFFERSIZE 64 - u8_t buffer[VNC_BUFFERSIZE]; + uint8_t buffer[VNC_BUFFERSIZE]; }; extern static struct vnc_viewer_state vnc_viewer_state; @@ -173,25 +173,25 @@ extern static struct vnc_viewer_state vnc_viewer_state; /* Generic rectangle - x, y coordinates, width and height. */ struct rfb_rect { - u16_t x; - u16_t y; - u16_t w; - u16_t h; + uint16_t x; + uint16_t y; + uint16_t w; + uint16_t h; }; /* Pixel format definition. */ struct rfb_pixel_format { - u8_t bps; /* Bits per pixel: 8, 16 or 32. */ - u8_t depth; /* Color depth: 8-32 */ - u8_t endian; /* 1 - big endian (motorola), 0 - little endian + uint8_t bps; /* Bits per pixel: 8, 16 or 32. */ + uint8_t depth; /* Color depth: 8-32 */ + uint8_t endian; /* 1 - big endian (motorola), 0 - little endian (x86) */ - u8_t truecolor; /* 1 - true color is used, 0 - true color is not used. */ + uint8_t truecolor; /* 1 - true color is used, 0 - true color is not used. */ /* The following fields are only used if true color is used. */ - u16_t red_max, green_max, blue_max; - u8_t red_shift, green_shift, blue_shift; - u8_t pad1; - u16_t pad2; + uint16_t red_max, green_max, blue_max; + uint8_t red_shift, green_shift, blue_shift; + uint8_t pad1; + uint16_t pad2; }; @@ -234,94 +234,94 @@ struct rfb_pixel_format { /* Server to client messages. */ struct rfb_server_init { - u16_t width; - u16_t height; + uint16_t width; + uint16_t height; struct rfb_pixel_format format; - u8_t namelength[4]; + uint8_t namelength[4]; /* Followed by name. */ }; struct rfb_fb_update { - u8_t type; - u8_t pad; - u16_t rects; /* Number of rectanges (struct rfb_fb_update_rect_hdr + + uint8_t type; + uint8_t pad; + uint16_t rects; /* Number of rectanges (struct rfb_fb_update_rect_hdr + data) that follows. */ }; struct rfb_fb_update_rect_hdr { struct rfb_rect rect; - u8_t encoding[4]; + uint8_t encoding[4]; }; struct rfb_copy_rect { - u16_t srcx; - u16_t srcy; + uint16_t srcx; + uint16_t srcy; }; struct rfb_rre_hdr { - u16_t subrects[2]; /* Number of subrectangles (struct + uint16_t subrects[2]; /* Number of subrectangles (struct rfb_rre_subrect) to follow. */ - u8_t bgpixel; + uint8_t bgpixel; }; struct rfb_rre_subrect { - u8_t pixel; + uint8_t pixel; struct rfb_rect rect; }; struct rfb_corre_rect { - u8_t x; - u8_t y; - u8_t w; - u8_t h; + uint8_t x; + uint8_t y; + uint8_t w; + uint8_t h; }; /* Client to server messages. */ struct rfb_set_pixel_format { - u8_t type; - u8_t pad; - u16_t pad2; + uint8_t type; + uint8_t pad; + uint16_t pad2; struct rfb_pixel_format format; }; struct rfb_fix_colormap_entries { - u8_t type; - u8_t pad; - u16_t firstcolor; - u16_t colors; + uint8_t type; + uint8_t pad; + uint16_t firstcolor; + uint16_t colors; }; struct rfb_set_encodings { - u8_t type; - u8_t pad; - u16_t encodings; + uint8_t type; + uint8_t pad; + uint16_t encodings; }; struct rfb_fb_update_request { - u8_t type; - u8_t incremental; - u16_t x; - u16_t y; - u16_t w; - u16_t h; + uint8_t type; + uint8_t incremental; + uint16_t x; + uint16_t y; + uint16_t w; + uint16_t h; }; struct rfb_key_event { - u8_t type; - u8_t down; - u16_t pad; - u8_t key[4]; + uint8_t type; + uint8_t down; + uint16_t pad; + uint8_t key[4]; }; #define RFB_BUTTON_MASK1 1 #define RFB_BUTTON_MASK2 2 #define RFB_BUTTON_MASK3 4 struct rfb_pointer_event { - u8_t type; - u8_t buttonmask; - u16_t x; - u16_t y; + uint8_t type; + uint8_t buttonmask; + uint16_t x; + uint16_t y; }; #endif /* __VNC_VIEWER_H__ */ diff --git a/apps/vnc/vnc.c b/apps/vnc/vnc.c index 71be06bd2..2618f423f 100644 --- a/apps/vnc/vnc.c +++ b/apps/vnc/vnc.c @@ -125,7 +125,7 @@ static void connect(void) { uip_ipaddr_t addr, *addrptr; - u16_t port; + uint16_t port; char *cptr; /* Find the first space character in host and put a zero there diff --git a/apps/webbrowser/htmlparser.c b/apps/webbrowser/htmlparser.c index c91ff5321..ed5c53e74 100644 --- a/apps/webbrowser/htmlparser.c +++ b/apps/webbrowser/htmlparser.c @@ -553,11 +553,11 @@ parse_tag(void) } } /*-----------------------------------------------------------------------------------*/ -static u16_t -parse_word(char *data, u8_t dlen) +static uint16_t +parse_word(char *data, uint8_t dlen) { - static u8_t i; - static u8_t len; + static uint8_t i; + static uint8_t len; unsigned char c; len = dlen; @@ -825,15 +825,15 @@ parse_word(char *data, u8_t dlen) } /*-----------------------------------------------------------------------------------*/ void -htmlparser_parse(char *data, u16_t datalen) +htmlparser_parse(char *data, uint16_t datalen) { - u16_t plen; + uint16_t plen; while(datalen > 0) { if(datalen > 255) { plen = parse_word(data, 255); } else { - plen = parse_word(data, (u8_t)datalen); + plen = parse_word(data, (uint8_t)datalen); } datalen -= plen; data += plen; diff --git a/apps/webbrowser/htmlparser.h b/apps/webbrowser/htmlparser.h index d5047aedb..6a4e70275 100644 --- a/apps/webbrowser/htmlparser.h +++ b/apps/webbrowser/htmlparser.h @@ -73,7 +73,7 @@ void htmlparser_renderstate(unsigned char state); /* Functions. */ void htmlparser_init(void); -void htmlparser_parse(char *data, u16_t len); +void htmlparser_parse(char *data, uint16_t len); #endif /* __HTMLPARSER_H__ */ diff --git a/apps/webbrowser/webclient.c b/apps/webbrowser/webclient.c index 5f8f93fa9..3c68d39f5 100644 --- a/apps/webbrowser/webclient.c +++ b/apps/webbrowser/webclient.c @@ -58,18 +58,18 @@ #define ISO_space 0x20 struct webclient_state { - u8_t timer; - u8_t state; - u8_t httpflag; + uint8_t timer; + uint8_t state; + uint8_t httpflag; - u16_t port; + uint16_t port; char host[40]; char file[WWW_CONF_MAX_URLLEN]; - u16_t getrequestptr; - u16_t getrequestleft; + uint16_t getrequestptr; + uint16_t getrequestleft; char httpheaderline[200]; - u16_t httpheaderlineptr; + uint16_t httpheaderlineptr; char mimetype[32]; }; @@ -117,8 +117,8 @@ init_connection(void) sizeof(http_crnl) - 1 + sizeof(http_host) - 1 + sizeof(http_crnl) - 1 + - (u16_t)strlen(http_user_agent_fields) + - (u16_t)strlen(s.file) + (u16_t)strlen(s.host); + (uint16_t)strlen(http_user_agent_fields) + + (uint16_t)strlen(s.file) + (uint16_t)strlen(s.host); s.getrequestptr = 0; s.httpheaderlineptr = 0; @@ -131,7 +131,7 @@ webclient_close(void) } /*-----------------------------------------------------------------------------------*/ unsigned char -webclient_get(const char *host, u16_t port, const char *file) +webclient_get(const char *host, uint16_t port, const char *file) { uip_ipaddr_t addr; struct uip_conn *conn; @@ -212,7 +212,7 @@ window_copy(int curptr, const char *data, unsigned char datalen) static void senddata(void) { - u16_t len; + uint16_t len; int curptr; if(s.getrequestleft > 0) { @@ -246,7 +246,7 @@ senddata(void) static void acked(void) { - u16_t len; + uint16_t len; if(s.getrequestleft > 0) { len = s.getrequestleft > uip_mss()? @@ -257,8 +257,8 @@ acked(void) } } /*-----------------------------------------------------------------------------------*/ -static u16_t -parse_statusline(u16_t len) +static uint16_t +parse_statusline(uint16_t len) { char *cptr; @@ -324,8 +324,8 @@ casecmp(char *str1, const char *str2, char len) return 0; } /*-----------------------------------------------------------------------------------*/ -static u16_t -parse_headers(u16_t len) +static uint16_t +parse_headers(uint16_t len) { char *cptr; static unsigned char i; @@ -393,7 +393,7 @@ parse_headers(u16_t len) static void newdata(void) { - u16_t len; + uint16_t len; len = uip_datalen(); diff --git a/apps/webbrowser/webclient.h b/apps/webbrowser/webclient.h index a4a27f5af..40821690c 100644 --- a/apps/webbrowser/webclient.h +++ b/apps/webbrowser/webclient.h @@ -43,7 +43,7 @@ /* Callback functions that have to be implemented by the application program. */ struct webclient_state; -void webclient_datahandler(char *data, u16_t len); +void webclient_datahandler(char *data, uint16_t len); void webclient_connected(void); void webclient_timedout(void); void webclient_aborted(void); @@ -52,7 +52,7 @@ void webclient_closed(void); /* Functions. */ void webclient_init(void); -unsigned char webclient_get(const char *host, u16_t port, const char *file); +unsigned char webclient_get(const char *host, uint16_t port, const char *file); void webclient_close(void); void webclient_appcall(void *state); diff --git a/apps/webbrowser/www.c b/apps/webbrowser/www.c index ed28e145e..915969019 100644 --- a/apps/webbrowser/www.c +++ b/apps/webbrowser/www.c @@ -553,7 +553,7 @@ PROCESS_THREAD(www_process, ev, data) * text entry widget in the browser window). */ static void -set_url(char *host, u16_t port, char *file) +set_url(char *host, uint16_t port, char *file) { char *urlptr; @@ -636,7 +636,7 @@ webclient_connected(void) * has arrived. */ void -webclient_datahandler(char *data, u16_t len) +webclient_datahandler(char *data, uint16_t len) { if(len > 0) { if(strcmp(webclient_mimetype(), http_texthtml) == 0) { diff --git a/apps/webserver-nano/httpd-cgi.c b/apps/webserver-nano/httpd-cgi.c index 9d62bc5b9..8a78bee0a 100644 --- a/apps/webserver-nano/httpd-cgi.c +++ b/apps/webserver-nano/httpd-cgi.c @@ -30,7 +30,6 @@ * * */ -/* Line endings in git repository are LF instead of CR-LF ? */ /* * This file includes functions that are called by the web server * scripts. The functions takes no argument, and the return value is @@ -185,19 +184,38 @@ static unsigned short generate_header(void *arg) { unsigned short numprinted=0; + #if WEBSERVER_CONF_HEADER_W3C #define _MSS1 100 static const char httpd_cgi_headerw[] HTTPD_STRING_ATTR = ""; numprinted+=httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_headerw); #endif + #if WEBSERVER_CONF_HEADER_ICON #define _MSS2 105 - static const char httpd_cgi_header1[] HTTPD_STRING_ATTR = "Contiki-nano"; +#ifdef WEBSERVER_CONF_PAGETITLE + static const char httpd_cgi_header1[] HTTPD_STRING_ATTR = "%s"; +#else + static const char httpd_cgi_header1[] HTTPD_STRING_ATTR = "Contiki-Nano"; +#endif #else #define _MSS2 52 - static const char httpd_cgi_header1[] HTTPD_STRING_ATTR = "Contiki-nano"; +#ifdef WEBSERVER_CONF_PAGETITLE + static const char httpd_cgi_header1[] HTTPD_STRING_ATTR = "%s"; +#else + static const char httpd_cgi_header1[] HTTPD_STRING_ATTR = "Contiki-Nano"; #endif +#endif + +#ifdef WEBSERVER_CONF_PAGETITLE +#define WAD ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN])->destipaddr.u8 +{ char buf[40]; + WEBSERVER_CONF_PAGETITLE; + numprinted+=httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_header1,buf); +} +#else numprinted+=httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_header1); +#endif #if WEBSERVER_CONF_HEADER_MENU #define _MSS3 32 @@ -273,7 +291,7 @@ generate_file_stats(void *arg) static const char httpd_cgi_filestat3[] HTTPD_STRING_ATTR = "%5u"; char tmp[20]; struct httpd_fsdata_file_noconst *f,fram; - u16_t i; + uint16_t i; unsigned short numprinted; /* Transfer arg from whichever flash that contains the html file to RAM */ httpd_fs_cpy(&tmp, s->u.ptr, 20); @@ -538,7 +556,7 @@ generate_sensor_readings(void *arg) static const char httpd_cgi_sensor2[] HTTPD_STRING_ATTR = "Battery : %s\n"; // static const char httpd_cgi_sensr12[] HTTPD_STRING_ATTR = "Temperature: %s Battery: %s
"; static const char httpd_cgi_sensor3[] HTTPD_STRING_ATTR = "Uptime : %02d:%02d:%02d\n"; - static const char httpd_cgi_sensor3d[] HTTPD_STRING_ATTR = "Uptime : %u days %02u:%02u:%02u/n"; + static const char httpd_cgi_sensor3d[] HTTPD_STRING_ATTR = "Uptime : %u days %02u:%02u:%02u\n"; // static const char httpd_cgi_sensor4[] HTTPD_STRING_ATTR = "Sleeping time : %02d:%02d:%02d (%d%%)
"; numprinted=0; @@ -624,7 +642,17 @@ uint8_t c; numprinted =httpd_snprintf((char *)uip_appdata, uip_mss(), httpd_cgi_sensor0,(unsigned int) (seconds-last_tempupdate)); } numprinted+=httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_sensor1, sensor_temperature); +#if CONTIKI_TARGET_REDBEE_ECONOTAG +/* Econotag at 3v55 with 10 ohms to LiFePO4 battery: 3680mv usb 3106 battery (meter 3.08). Take 3500 as breakpoint for USB connected */ + static const char httpd_cgi_sensor2u[] HTTPD_STRING_ATTR = "Vcc (USB) : %s\n"; + if(adc_reading[8]<1404) { + numprinted+=httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_sensor2u, sensor_extvoltage); + } else { + numprinted+=httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_sensor2, sensor_extvoltage); + } +#else numprinted+=httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_sensor2, sensor_extvoltage); +#endif // numprinted+=httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_sensr12, sensor_temperature,sensor_extvoltage); #if RADIOSTATS diff --git a/apps/webserver-nano/httpd-fs.c b/apps/webserver-nano/httpd-fs.c index c408c1294..3fb5ac30d 100644 --- a/apps/webserver-nano/httpd-fs.c +++ b/apps/webserver-nano/httpd-fs.c @@ -43,7 +43,7 @@ #include "httpd-fsdata.c" #if WEBSERVER_CONF_FILESTATS==1 -u16_t httpd_filecount[HTTPD_FS_NUMFILES]; +uint16_t httpd_filecount[HTTPD_FS_NUMFILES]; #endif /*-----------------------------------------------------------------------------------*/ void * @@ -52,7 +52,7 @@ httpd_fs_get_root() return (void *)HTTPD_FS_ROOT; } /*-----------------------------------------------------------------------------------*/ -u16_t +uint16_t httpd_fs_get_size() { return HTTPD_FS_SIZE; @@ -62,7 +62,7 @@ uint16_t httpd_fs_open(const char *name, struct httpd_fs_file *file) { #if WEBSERVER_CONF_FILESTATS - u16_t i = 0; + uint16_t i = 0; #endif struct httpd_fsdata_file_noconst *f,fram; @@ -105,7 +105,7 @@ void httpd_fs_init(void) { #if WEBSERVER_CONF_FILESTATS==1 - u16_t i; + uint16_t i; for(i = 0; i < HTTPD_FS_NUMFILES; i++) { httpd_filecount[i] = 0; } @@ -113,11 +113,11 @@ httpd_fs_init(void) } /*-----------------------------------------------------------------------------------*/ #if WEBSERVER_CONF_FILESTATS && 0 -u16_t +uint16_t httpd_fs_count(char *name) { struct httpd_fsdata_file_noconst *f; - u16_t i; + uint16_t i; i = 0; for(f = (struct httpd_fsdata_file_noconst *)HTTPD_FS_ROOT; diff --git a/apps/webserver-nano/httpd-fs.h b/apps/webserver-nano/httpd-fs.h index de44abee7..49a8778ab 100644 --- a/apps/webserver-nano/httpd-fs.h +++ b/apps/webserver-nano/httpd-fs.h @@ -44,8 +44,8 @@ struct httpd_fs_file { uint16_t httpd_fs_open(const char *name, struct httpd_fs_file *file); #if WEBSERVER_CONF_FILESTATS -extern u16_t httpd_filecount[]; -u16_t httpd_fs_count(char *name); +extern uint16_t httpd_filecount[]; +uint16_t httpd_fs_count(char *name); void* httpd_fs_get_root(void); #endif diff --git a/apps/webserver-nano/httpd-fs/status.shtml b/apps/webserver-nano/httpd-fs/status.shtml index b6574fbcb..d18b74e28 100644 --- a/apps/webserver-nano/httpd-fs/status.shtml +++ b/apps/webserver-nano/httpd-fs/status.shtml @@ -1,10 +1,10 @@ %! header -

Addresses

+

Addresses
%! addresses -

Neighbors

+

Neighbors
%! neighbors -

Routes

+

Routes
%! routes -

Sensors

+

Sensors
%! sensors %! file-stats . diff --git a/apps/webserver-nano/httpd-fsdata.c b/apps/webserver-nano/httpd-fsdata.c index 8f211b437..b0c514a5a 100644 --- a/apps/webserver-nano/httpd-fsdata.c +++ b/apps/webserver-nano/httpd-fsdata.c @@ -1,4 +1,4 @@ -/*********Generated by contiki/tools/makefsdata on 2011-09-10*********/ +/*********Generated by contiki/tools/makefsdata on 2012-02-21*********/ const char data_404_html[86] HTTPD_STRING_ATTR = { @@ -48,24 +48,23 @@ const char data_index_shtml[120] HTTPD_STRING_ATTR = { 0x21, 0x0a, 0x25, 0x21, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2d, 0x73, 0x74, 0x61, 0x74, 0x73, 0x20, 0x2e}; -const char data_status_shtml[158] HTTPD_STRING_ATTR = { +const char data_status_shtml[150] HTTPD_STRING_ATTR = { /* /status.shtml */ 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0x00, 0x25, 0x21, 0x20, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x0a, - 0x3c, 0x68, 0x34, 0x3e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x65, 0x73, 0x3c, 0x2f, 0x68, 0x34, 0x3e, 0x0a, 0x25, - 0x21, 0x20, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, - 0x73, 0x0a, 0x3c, 0x68, 0x34, 0x3e, 0x4e, 0x65, 0x69, 0x67, - 0x68, 0x62, 0x6f, 0x72, 0x73, 0x3c, 0x2f, 0x68, 0x34, 0x3e, - 0x0a, 0x25, 0x21, 0x20, 0x6e, 0x65, 0x69, 0x67, 0x68, 0x62, - 0x6f, 0x72, 0x73, 0x0a, 0x3c, 0x68, 0x34, 0x3e, 0x52, 0x6f, - 0x75, 0x74, 0x65, 0x73, 0x3c, 0x2f, 0x68, 0x34, 0x3e, 0x0a, - 0x25, 0x21, 0x20, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x73, 0x0a, - 0x3c, 0x68, 0x34, 0x3e, 0x53, 0x65, 0x6e, 0x73, 0x6f, 0x72, - 0x73, 0x3c, 0x2f, 0x68, 0x34, 0x3e, 0x0a, 0x25, 0x21, 0x20, - 0x73, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x73, 0x0a, 0x25, 0x21, - 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2d, 0x73, 0x74, 0x61, 0x74, - 0x73, 0x20, 0x2e, 0x0a}; + 0x3c, 0x70, 0x3e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x65, 0x73, 0x3c, 0x62, 0x72, 0x3e, 0x0a, 0x25, 0x21, 0x20, + 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x0a, + 0x3c, 0x70, 0x3e, 0x4e, 0x65, 0x69, 0x67, 0x68, 0x62, 0x6f, + 0x72, 0x73, 0x3c, 0x62, 0x72, 0x3e, 0x0a, 0x25, 0x21, 0x20, + 0x6e, 0x65, 0x69, 0x67, 0x68, 0x62, 0x6f, 0x72, 0x73, 0x0a, + 0x3c, 0x70, 0x3e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x73, 0x3c, + 0x62, 0x72, 0x3e, 0x0a, 0x25, 0x21, 0x20, 0x72, 0x6f, 0x75, + 0x74, 0x65, 0x73, 0x0a, 0x3c, 0x70, 0x3e, 0x53, 0x65, 0x6e, + 0x73, 0x6f, 0x72, 0x73, 0x3c, 0x62, 0x72, 0x3e, 0x0a, 0x25, + 0x21, 0x20, 0x73, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x73, 0x0a, + 0x25, 0x21, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2d, 0x73, 0x74, + 0x61, 0x74, 0x73, 0x20, 0x2e, 0x0a}; const char data_tcp_shtml[227] HTTPD_STRING_ATTR = { /* /tcp.shtml */ @@ -101,7 +100,7 @@ struct httpd_fsdata_file { const char *data; //offset to coffee file data const int len; //length of file data #if HTTPD_FS_STATISTICS == 1 //not enabled since list is in PROGMEM - u16_t count; //storage for file statistics + uint16_t count; //storage for file statistics #endif } */ @@ -113,4 +112,4 @@ const struct httpd_fsdata_file file_tcp_shtml[] HTTPD_STRING_ATTR ={{ fi #define HTTPD_FS_ROOT file_tcp_shtml #define HTTPD_FS_NUMFILES 5 -#define HTTPD_FS_SIZE 759 +#define HTTPD_FS_SIZE 751 diff --git a/apps/webserver-nano/httpd-fsdata.h b/apps/webserver-nano/httpd-fsdata.h index 0d514bacf..c77fdd65d 100644 --- a/apps/webserver-nano/httpd-fsdata.h +++ b/apps/webserver-nano/httpd-fsdata.h @@ -44,7 +44,7 @@ struct httpd_fsdata_file { const int len; #ifdef HTTPD_FS_STATISTICS #if HTTPD_FS_STATISTICS == 1 - u16_t count; + uint16_t count; #endif /* HTTPD_FS_STATISTICS */ #endif /* HTTPD_FS_STATISTICS */ }; @@ -56,7 +56,7 @@ struct httpd_fsdata_file_noconst { int len; #ifdef HTTPD_FS_STATISTICS #if HTTPD_FS_STATISTICS == 1 - u16_t count; + uint16_t count; #endif /* HTTPD_FS_STATISTICS */ #endif /* HTTPD_FS_STATISTICS */ }; diff --git a/apps/webserver-nano/httpd.h b/apps/webserver-nano/httpd.h index 6233edf81..7e9ab900a 100644 --- a/apps/webserver-nano/httpd.h +++ b/apps/webserver-nano/httpd.h @@ -49,6 +49,18 @@ * The advertised MSS is easily seen in wireshark. * Some example set a small MSS by default. rpl-border-router for example uses a receive window of 60. */ + + /* Titles of web pages served with the !header cgi can be configured to show characteristics of the node. + * For example "CD1A:3456" to show the node id and clock time of last access. + * Change this line and rebuild to make indentifiable instances. + * Undefine to reduce program size, giving "Contiki-Nano" title on all pages. + * WAD indexes into the uip destaddr field, which contains the address that we responded to. + */ +#define WEBSERVER_CONF_PAGETITLE sprintf(buf,"[%02x%02x]",WAD[14],WAD[15]); +//#define WEBSERVER_CONF_PAGETITLE sprintf(buf,"Nano[%02x%02x%02x]",WAD[13],WAD[14],WAD[15]); +//#define WEBSERVER_CONF_PAGETITLE sprintf(buf,"Nano[%02x%02x...%02x%02x]",WAD[0],WAD[1],WAD[14],WAD[15]); +//#define WEBSERVER_CONF_PAGETITLE sprintf(buf,"%2x%02x...%2x%02x [%lu]",WAD[0],WAD[1],WAD[14],WAD[15],clock_seconds()); + #ifndef WEBSERVER_CONF_NANO #if CONTIKI_TARGET_SKY || CONTIKI_TARGET_STK500 #define WEBSERVER_CONF_NANO 1 diff --git a/apps/webserver/httpd-fs.c b/apps/webserver/httpd-fs.c index e0909f633..c09131099 100644 --- a/apps/webserver/httpd-fs.c +++ b/apps/webserver/httpd-fs.c @@ -41,14 +41,14 @@ #include "httpd-fsdata.c" #if HTTPD_FS_STATISTICS -static u16_t count[HTTPD_FS_NUMFILES]; +static uint16_t count[HTTPD_FS_NUMFILES]; #endif /* HTTPD_FS_STATISTICS */ /*-----------------------------------------------------------------------------------*/ -static u8_t +static uint8_t httpd_fs_strcmp(const char *str1, const char *str2) { - u8_t i; + uint8_t i; i = 0; loop: @@ -70,7 +70,7 @@ int httpd_fs_open(const char *name, struct httpd_fs_file *file) { #if HTTPD_FS_STATISTICS - u16_t i = 0; + uint16_t i = 0; #endif /* HTTPD_FS_STATISTICS */ struct httpd_fsdata_file_noconst *f; @@ -98,7 +98,7 @@ void httpd_fs_init(void) { #if HTTPD_FS_STATISTICS - u16_t i; + uint16_t i; for(i = 0; i < HTTPD_FS_NUMFILES; i++) { count[i] = 0; } @@ -106,11 +106,11 @@ httpd_fs_init(void) } /*-----------------------------------------------------------------------------------*/ #if HTTPD_FS_STATISTICS -u16_t +uint16_t httpd_fs_count(char *name) { struct httpd_fsdata_file_noconst *f; - u16_t i; + uint16_t i; i = 0; for(f = (struct httpd_fsdata_file_noconst *)HTTPD_FS_ROOT; diff --git a/apps/webserver/httpd-fs.h b/apps/webserver/httpd-fs.h index 9abed703c..f61b691ae 100644 --- a/apps/webserver/httpd-fs.h +++ b/apps/webserver/httpd-fs.h @@ -50,7 +50,7 @@ int httpd_fs_open(const char *name, struct httpd_fs_file *file); #ifdef HTTPD_FS_STATISTICS #if HTTPD_FS_STATISTICS == 1 -u16_t httpd_fs_count(char *name); +uint16_t httpd_fs_count(char *name); #endif /* HTTPD_FS_STATISTICS */ #endif /* HTTPD_FS_STATISTICS */ diff --git a/apps/webserver/httpd-fsdata.h b/apps/webserver/httpd-fsdata.h index 0d514bacf..c77fdd65d 100644 --- a/apps/webserver/httpd-fsdata.h +++ b/apps/webserver/httpd-fsdata.h @@ -44,7 +44,7 @@ struct httpd_fsdata_file { const int len; #ifdef HTTPD_FS_STATISTICS #if HTTPD_FS_STATISTICS == 1 - u16_t count; + uint16_t count; #endif /* HTTPD_FS_STATISTICS */ #endif /* HTTPD_FS_STATISTICS */ }; @@ -56,7 +56,7 @@ struct httpd_fsdata_file_noconst { int len; #ifdef HTTPD_FS_STATISTICS #if HTTPD_FS_STATISTICS == 1 - u16_t count; + uint16_t count; #endif /* HTTPD_FS_STATISTICS */ #endif /* HTTPD_FS_STATISTICS */ }; diff --git a/core/ctk/ctk-vncfont.c b/core/ctk/ctk-vncfont.c index dd2e101fc..a75f28c58 100644 --- a/core/ctk/ctk-vncfont.c +++ b/core/ctk/ctk-vncfont.c @@ -29,7 +29,6 @@ * * This file is part of the Contiki VNC server * - * $Id: ctk-vncfont.c,v 1.1 2006/06/17 22:41:16 adamdunkels Exp $ * */ @@ -37,13 +36,12 @@ #define o 0x01 /* 1001 0010 */ #define X 0x02 /* 1111 0110 */ -#ifdef WITH_AVR +#ifdef __AVR__ #include +const unsigned char vncfont[] PROGMEM = { #else -#define prog_char const unsigned char +const unsigned char vncfont[] = { #endif - -prog_char ctk_vncfont[] = { /* char 0 */ X,o,_,_,_,_, o,X,_,_,_,_, diff --git a/core/ctk/ctk-vncserver.c b/core/ctk/ctk-vncserver.c index fa433ce76..b04d5b61f 100644 --- a/core/ctk/ctk-vncserver.c +++ b/core/ctk/ctk-vncserver.c @@ -240,9 +240,9 @@ vnc_server_update_remove(struct vnc_server_state *vs, */ /*-----------------------------------------------------------------------------------*/ static void -update_area(u8_t x, u8_t y, u8_t w, u8_t h) +update_area(uint8_t x, uint8_t y, uint8_t w, uint8_t h) { - u8_t i; + uint8_t i; if(h == 0 || w == 0) { return; @@ -266,7 +266,7 @@ update_area(u8_t x, u8_t y, u8_t w, u8_t h) static struct vnc_server_state * alloc_state(void) { - u8_t i; + uint8_t i; for(i = 0; i < CTK_VNCSERVER_CONF_NUMCONNS; ++i) { if(conns[i].state == VNC_DEALLOCATED) { return &conns[i]; diff --git a/core/ctk/vnc-out.c b/core/ctk/vnc-out.c index 69765e4e3..de8691778 100644 --- a/core/ctk/vnc-out.c +++ b/core/ctk/vnc-out.c @@ -70,14 +70,14 @@ #define BGR(b,g,r) (((b) << 6) | (g) << 3 | (r)) -static const u8_t menucolor[] = { +static const uint8_t menucolor[] = { BGR(3,7,7), /* Background. */ BGR(2,6,6), /* Anti-alias font color. */ BGR(0,0,0), /* Font color. */ }; -static const u8_t activemenucolor[] = { +static const uint8_t activemenucolor[] = { BGR(0,0,0), /* Background. */ BGR(2,5,5), /* Anti-alias font color. */ BGR(3,7,7), /* Font color. */ @@ -160,7 +160,7 @@ static const unsigned char iconcol_w[] = -static const u8_t * const colortheme[] = +static const uint8_t * const colortheme[] = { backgroundcolor, @@ -193,15 +193,15 @@ static const u8_t * const colortheme[] = static int mouse_x, mouse_y, mouse_button; #ifdef CTK_VNCSERVER_CONF_SCREEN -static u8_t *screen = CTK_VNCSERVER_CONF_SCREEN; +static uint8_t *screen = CTK_VNCSERVER_CONF_SCREEN; #else -static u8_t screen[CHARS_WIDTH * CHARS_HEIGHT]; +static uint8_t screen[CHARS_WIDTH * CHARS_HEIGHT]; #endif #ifdef CTK_VNCSERVER_CONF_COLORSCREEN -staitc u8_t *colorscreen = CTK_VNCSERVER_CONF_COLORSCREEN; +staitc uint8_t *colorscreen = CTK_VNCSERVER_CONF_COLORSCREEN; #else -static u8_t colorscreen[CHARS_WIDTH * CHARS_HEIGHT]; +static uint8_t colorscreen[CHARS_WIDTH * CHARS_HEIGHT]; #endif @@ -214,7 +214,7 @@ struct ctk_icon *icons[MAX_ICONS]; unsigned char vnc_out_add_icon(struct ctk_icon *icon) { - u8_t i; + uint8_t i; signed int empty; empty = -1; @@ -238,14 +238,14 @@ vnc_out_add_icon(struct ctk_icon *icon) void vnc_out_init(void) { - u16_t i; + uint16_t i; for(i = 0; i < CHARS_WIDTH * CHARS_HEIGHT; ++i) { screen[i] = 0x20; } } void -vnc_out_update_screen(u8_t xpos, u8_t ypos, u8_t c, u8_t color) +vnc_out_update_screen(uint8_t xpos, uint8_t ypos, uint8_t c, uint8_t color) { screen[xpos + ypos * CHARS_WIDTH] = c; colorscreen[xpos + ypos * CHARS_WIDTH] = color; @@ -253,9 +253,9 @@ vnc_out_update_screen(u8_t xpos, u8_t ypos, u8_t c, u8_t color) /*-----------------------------------------------------------------------------------*/ void vnc_out_update_area(struct vnc_server_state *vs, - u8_t x, u8_t y, u8_t w, u8_t h) + uint8_t x, uint8_t y, uint8_t w, uint8_t h) { - u8_t x2, y2, ax2, ay2; + uint8_t x2, y2, ax2, ay2; register struct vnc_server_update *a, *b; PRINTF(("update_area_connection: should update (%d:%d) (%d:%d)\n", @@ -420,21 +420,21 @@ check_updates(CC_REGISTER_ARG struct vnc_server_state *vs) } } /*-----------------------------------------------------------------------------------*/ -static u8_t tmp[CTK_VNCFONT_WIDTH * CTK_VNCFONT_HEIGHT]; +static uint8_t tmp[CTK_VNCFONT_WIDTH * CTK_VNCFONT_HEIGHT]; static void -makechar(CC_REGISTER_ARG char *ptr, u8_t x, u8_t y) +makechar(CC_REGISTER_ARG char *ptr, uint8_t x, uint8_t y) { - u8_t i, *tmpptr; - register u8_t *colorscheme; + uint8_t i, *tmpptr; + register uint8_t *colorscheme; unsigned char *bitmap; - u8_t b, b2; - u8_t xmove, ymove; + uint8_t b, b2; + uint8_t xmove, ymove; unsigned char c, color; color = colorscreen[x + y * CHARS_WIDTH]; c = screen[x + y * CHARS_WIDTH]; - colorscheme = (u8_t *)colortheme[color]; + colorscheme = (uint8_t *)colortheme[color]; /* First check if the character is a special icon character. These are to be interpreted in a special manner: the first character of @@ -457,7 +457,7 @@ makechar(CC_REGISTER_ARG char *ptr, u8_t x, u8_t y) if(bitmap != NULL) { bitmap = bitmap + ymove * 8*3; - colorscheme = (u8_t *)colortheme[VNC_OUT_ICONCOLOR + (c >> 6)]; + colorscheme = (uint8_t *)colortheme[VNC_OUT_ICONCOLOR + (c >> 6)]; switch(xmove) { case 0: for(i = 0; i < CTK_VNCFONT_HEIGHT; ++i) { @@ -523,7 +523,7 @@ makechar(CC_REGISTER_ARG char *ptr, u8_t x, u8_t y) void vnc_out_new(CC_REGISTER_ARG struct vnc_server_state *vs) { - u8_t i; + uint8_t i; vs->width = SCREEN_WIDTH; vs->height = SCREEN_HEIGHT; @@ -545,9 +545,9 @@ void vnc_out_send_blank(CC_REGISTER_ARG struct vnc_server_state *vs) { register struct rfb_fb_update *umsg; - u8_t *ptr; - u16_t len; - u8_t msglen; + uint8_t *ptr; + uint16_t len; + uint8_t msglen; vs->x = vs->y = 0; vs->x2 = vs->y2 = 0; @@ -557,7 +557,7 @@ vnc_out_send_blank(CC_REGISTER_ARG struct vnc_server_state *vs) umsg->type = RFB_FB_UPDATE; umsg->rects = UIP_HTONS(2); - ptr = (u8_t *)umsg + sizeof(struct rfb_fb_update); + ptr = (uint8_t *)umsg + sizeof(struct rfb_fb_update); len = sizeof(struct rfb_fb_update); msglen = vnc_server_draw_rect(ptr, 0, 0, @@ -590,15 +590,15 @@ static short tmpbuf[30]; void vnc_out_send_update(CC_REGISTER_ARG struct vnc_server_state *vs) { - u8_t x, y, x0; - u8_t msglen; - u16_t len, n; - u8_t *ptr; + uint8_t x, y, x0; + uint8_t msglen; + uint16_t len, n; + uint8_t *ptr; struct rfb_fb_update *umsg; register struct rfb_fb_update_rect_hdr *recthdr; struct rfb_rre_hdr *rrehdr; - u8_t c, color, lastcolor; - u8_t numblanks; + uint8_t c, color, lastcolor; + uint8_t numblanks; /* First, check if we need to feed the update function with a new pending update. */ @@ -615,7 +615,7 @@ vnc_out_send_update(CC_REGISTER_ARG struct vnc_server_state *vs) x0 = vs->x1; n = 0; msglen = 0; - ptr = (u8_t *)umsg + sizeof(struct rfb_fb_update); + ptr = (uint8_t *)umsg + sizeof(struct rfb_fb_update); len = sizeof(struct rfb_fb_update); /* Loop over all characters that are covered by this update. */ @@ -741,7 +741,7 @@ vnc_out_send_update(CC_REGISTER_ARG struct vnc_server_state *vs) recthdr->encoding[2] = 0; recthdr->encoding[3] = RFB_ENC_RAW; - makechar((u8_t *)recthdr + + makechar((uint8_t *)recthdr + sizeof(struct rfb_fb_update_rect_hdr), x, y); } @@ -837,7 +837,7 @@ void vnc_out_pointer_event(struct vnc_server_state *vs) { struct rfb_pointer_event *ev; - u16_t evx, evy; + uint16_t evx, evy; ev = (struct rfb_pointer_event *)uip_appdata; diff --git a/core/ctk/vnc-out.h b/core/ctk/vnc-out.h index 105ffd843..c1707e784 100644 --- a/core/ctk/vnc-out.h +++ b/core/ctk/vnc-out.h @@ -51,12 +51,12 @@ void vnc_out_acked(struct vnc_server_state *vs); void vnc_out_poll(struct vnc_server_state *vs); -void vnc_out_update_screen(u8_t x, u8_t y, u8_t c, u8_t color); +void vnc_out_update_screen(uint8_t x, uint8_t y, uint8_t c, uint8_t color); char vnc_out_getkey(void); char vnc_out_keyavail(void); void vnc_out_update_area(struct vnc_server_state *vs, - u8_t x, u8_t y, u8_t w, u8_t h); + uint8_t x, uint8_t y, uint8_t w, uint8_t h); #include "ctk/ctk.h" diff --git a/core/ctk/vnc-server.c b/core/ctk/vnc-server.c index 9193aad73..ad4624ddd 100644 --- a/core/ctk/vnc-server.c +++ b/core/ctk/vnc-server.c @@ -65,10 +65,10 @@ #define RFB_SERVER_VERSION_STRING rfb_server_version_string /* "RFB 003.003" */ -static u8_t rfb_server_version_string[12] = {82,70,66,32,48,48,51,46,48,48,51,10}; +static uint8_t rfb_server_version_string[12] = {82,70,66,32,48,48,51,46,48,48,51,10}; /* uVNC */ -static u8_t uvnc_name[4] = {117,86,78,67}; +static uint8_t uvnc_name[4] = {117,86,78,67}; #if 1 #define PRINTF(x) #else @@ -76,8 +76,8 @@ static u8_t uvnc_name[4] = {117,86,78,67}; #endif /*-----------------------------------------------------------------------------------*/ -u8_t -vnc_server_draw_rect(u8_t *ptr, u16_t x, u16_t y, u16_t w, u16_t h, u8_t c) +uint8_t +vnc_server_draw_rect(uint8_t *ptr, uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint8_t c) { register struct rfb_fb_update_rect_hdr *recthdr; struct rfb_rre_hdr *rrehdr; @@ -244,16 +244,16 @@ vnc_pointer_event(struct vnc_server_state *vs) } } /*-----------------------------------------------------------------------------------*/ -static u8_t +static uint8_t vnc_read_data(CC_REGISTER_ARG struct vnc_server_state *vs) { - u8_t *appdata; - u16_t len; + uint8_t *appdata; + uint16_t len; struct rfb_fb_update_request *req; - /* u8_t niter;*/ + /* uint8_t niter;*/ len = uip_datalen(); - appdata = (u8_t *)uip_appdata; + appdata = (uint8_t *)uip_appdata; /* First, check if there is data left to discard since last read. */ if(vs->readlen > 0) { diff --git a/core/ctk/vnc-server.h b/core/ctk/vnc-server.h index 8e910a2ef..b609a6891 100644 --- a/core/ctk/vnc-server.h +++ b/core/ctk/vnc-server.h @@ -37,9 +37,9 @@ /*struct vnc_server_updatearea { - u8_t active; - u8_t x, y; - u8_t w, h; + uint8_t active; + uint8_t x, y; + uint8_t w, h; };*/ struct vnc_server_update { @@ -49,29 +49,29 @@ struct vnc_server_update { #define VNC_SERVER_UPDATE_PARTS 1 #define VNC_SERVER_UPDATE_FULL 2 - u8_t type; + uint8_t type; - u8_t x, y; - u8_t w, h; + uint8_t x, y; + uint8_t w, h; }; struct vnc_server_state { - u16_t counter; - u8_t type; - u8_t state; - u16_t height, width; + uint16_t counter; + uint8_t type; + uint8_t state; + uint16_t height, width; - u8_t update_requested; + uint8_t update_requested; /* Variables used when sending screen updates. */ - u8_t x, y, x1, y1, x2, y2; - u8_t w, h; + uint8_t x, y, x1, y1, x2, y2; + uint8_t w, h; - u16_t readlen; - u8_t sendmsg; - u8_t button; + uint16_t readlen; + uint8_t sendmsg; + uint8_t button; struct vnc_server_update *updates_current; @@ -131,30 +131,30 @@ enum { #include "contiki-net.h" void vnc_server_send_data(struct vnc_server_state *vs); -u8_t vnc_server_draw_rect(u8_t *ptr, u16_t x, u16_t y, u16_t w, u16_t h, u8_t c); +uint8_t vnc_server_draw_rect(uint8_t *ptr, uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint8_t c); /* Generic rectangle - x, y coordinates, width and height. */ struct rfb_rect { - u16_t x; - u16_t y; - u16_t w; - u16_t h; + uint16_t x; + uint16_t y; + uint16_t w; + uint16_t h; }; /* Pixel format definition. */ struct rfb_pixel_format { - u8_t bps; /* Bits per pixel: 8, 16 or 32. */ - u8_t depth; /* Color depth: 8-32 */ - u8_t endian; /* 1 - big endian (motorola), 0 - little endian + uint8_t bps; /* Bits per pixel: 8, 16 or 32. */ + uint8_t depth; /* Color depth: 8-32 */ + uint8_t endian; /* 1 - big endian (motorola), 0 - little endian (x86) */ - u8_t truecolor; /* 1 - true color is used, 0 - true color is not used. */ + uint8_t truecolor; /* 1 - true color is used, 0 - true color is not used. */ /* The following fields are only used if true color is used. */ - u16_t red_max, green_max, blue_max; - u8_t red_shift, green_shift, blue_shift; - u8_t pad1; - u16_t pad2; + uint16_t red_max, green_max, blue_max; + uint8_t red_shift, green_shift, blue_shift; + uint8_t pad1; + uint16_t pad2; }; @@ -197,100 +197,100 @@ struct rfb_pixel_format { /* Server to client messages. */ struct rfb_server_init { - u16_t width; - u16_t height; + uint16_t width; + uint16_t height; struct rfb_pixel_format format; - u8_t namelength[4]; + uint8_t namelength[4]; /* Followed by name. */ }; struct rfb_fb_update { - u8_t type; - u8_t pad; - u16_t rects; /* Number of rectanges (struct rfb_fb_update_rect_hdr + + uint8_t type; + uint8_t pad; + uint16_t rects; /* Number of rectanges (struct rfb_fb_update_rect_hdr + data) that follows. */ }; struct rfb_fb_update_rect_hdr { struct rfb_rect rect; - u8_t encoding[4]; + uint8_t encoding[4]; }; struct rfb_copy_rect { - u16_t srcx; - u16_t srcy; + uint16_t srcx; + uint16_t srcy; }; struct rfb_rre_hdr { - u16_t subrects[2]; /* Number of subrectangles (struct + uint16_t subrects[2]; /* Number of subrectangles (struct rfb_rre_subrect) to follow. */ - u8_t bgpixel; + uint8_t bgpixel; }; struct rfb_rre_subrect { - u8_t pixel; + uint8_t pixel; struct rfb_rect rect; }; struct rfb_corre_rect { - u8_t x; - u8_t y; - u8_t w; - u8_t h; + uint8_t x; + uint8_t y; + uint8_t w; + uint8_t h; }; /* Client to server messages. */ struct rfb_set_pixel_format { - u8_t type; - u8_t pad; - u16_t pad2; + uint8_t type; + uint8_t pad; + uint16_t pad2; struct rfb_pixel_format format; }; struct rfb_fix_colormap_entries { - u8_t type; - u8_t pad; - u16_t firstcolor; - u16_t colors; + uint8_t type; + uint8_t pad; + uint16_t firstcolor; + uint16_t colors; }; struct rfb_set_encoding { - u8_t type; - u8_t pad; - u16_t encodings; + uint8_t type; + uint8_t pad; + uint16_t encodings; }; struct rfb_fb_update_request { - u8_t type; - u8_t incremental; - u16_t x; - u16_t y; - u16_t w; - u16_t h; + uint8_t type; + uint8_t incremental; + uint16_t x; + uint16_t y; + uint16_t w; + uint16_t h; }; struct rfb_key_event { - u8_t type; - u8_t down; - u16_t pad; - u8_t key[4]; + uint8_t type; + uint8_t down; + uint16_t pad; + uint8_t key[4]; }; #define RFB_BUTTON_MASK1 1 #define RFB_BUTTON_MASK2 2 #define RFB_BUTTON_MASK3 4 struct rfb_pointer_event { - u8_t type; - u8_t buttonmask; - u16_t x; - u16_t y; + uint8_t type; + uint8_t buttonmask; + uint16_t x; + uint16_t y; }; struct rfb_client_cut_text { - u8_t type; - u8_t pad[3]; - u8_t len[4]; + uint8_t type; + uint8_t pad[3]; + uint8_t len[4]; }; #endif /* __VNC_SERVER_H__ */ diff --git a/core/dev/slip.c b/core/dev/slip.c index cb8573e2a..d6a1c4fb0 100644 --- a/core/dev/slip.c +++ b/core/dev/slip.c @@ -51,12 +51,12 @@ PROCESS(slip_process, "SLIP driver"); -u8_t slip_active; +uint8_t slip_active; #if 1 #define SLIP_STATISTICS(statement) #else -u16_t slip_rubbish, slip_twopackets, slip_overflow, slip_ip_drop; +uint16_t slip_rubbish, slip_twopackets, slip_overflow, slip_ip_drop; #define SLIP_STATISTICS(statement) statement #endif @@ -81,10 +81,10 @@ enum { * they are discarded. */ -static u8_t state = STATE_TWOPACKETS; -static u16_t begin, end; -static u8_t rxbuf[RX_BUFSIZE]; -static u16_t pkt_end; /* SLIP_END tracker. */ +static uint8_t state = STATE_TWOPACKETS; +static uint16_t begin, end; +static uint8_t rxbuf[RX_BUFSIZE]; +static uint16_t pkt_end; /* SLIP_END tracker. */ static void (* input_callback)(void) = NULL; /*---------------------------------------------------------------------------*/ @@ -98,19 +98,19 @@ slip_set_input_callback(void (*c)(void)) * was used in slip-bridge.c */ //#if WITH_UIP -u8_t +uint8_t slip_send(void) { - u16_t i; - u8_t *ptr; - u8_t c; + uint16_t i; + uint8_t *ptr; + uint8_t c; slip_arch_writeb(SLIP_END); ptr = &uip_buf[UIP_LLH_LEN]; for(i = 0; i < uip_len; ++i) { if(i == UIP_TCPIP_HLEN) { - ptr = (u8_t *)uip_appdata; + ptr = (uint8_t *)uip_appdata; } c = *ptr++; if(c == SLIP_END) { @@ -128,12 +128,12 @@ slip_send(void) } //#endif /* WITH_UIP */ /*---------------------------------------------------------------------------*/ -u8_t +uint8_t slip_write(const void *_ptr, int len) { - const u8_t *ptr = _ptr; - u16_t i; - u8_t c; + const uint8_t *ptr = _ptr; + uint16_t i; + uint8_t c; slip_arch_writeb(SLIP_END); @@ -161,8 +161,8 @@ rxbuf_init(void) } /*---------------------------------------------------------------------------*/ /* Upper half does the polling. */ -static u16_t -slip_poll_handler(u8_t *outbuf, u16_t blen) +static uint16_t +slip_poll_handler(uint8_t *outbuf, uint16_t blen) { /* This is a hack and won't work across buffer edge! */ if(rxbuf[begin] == 'C') { @@ -212,7 +212,7 @@ slip_poll_handler(u8_t *outbuf, u16_t blen) * If pkt_end != begin it will not change again. */ if(begin != pkt_end) { - u16_t len; + uint16_t len; if(begin < pkt_end) { len = pkt_end - begin; @@ -275,12 +275,12 @@ PROCESS_THREAD(slip_process, ev, data) } slip_write(buf, 8); } else if(uip_len > 0 - && uip_len == (((u16_t)(BUF->len[0]) << 8) + BUF->len[1]) + && uip_len == (((uint16_t)(BUF->len[0]) << 8) + BUF->len[1]) && uip_ipchksum() == 0xffff) { #define IP_DF 0x40 if(BUF->ipid[0] == 0 && BUF->ipid[1] == 0 && BUF->ipoffset[0] & IP_DF) { - static u16_t ip_id; - u16_t nid = ip_id++; + static uint16_t ip_id; + uint16_t nid = ip_id++; BUF->ipid[0] = nid >> 8; BUF->ipid[1] = nid; nid = uip_htons(nid); diff --git a/core/dev/slip.h b/core/dev/slip.h index 3cd39c864..847ce26bc 100644 --- a/core/dev/slip.h +++ b/core/dev/slip.h @@ -42,7 +42,7 @@ PROCESS_NAME(slip_process); /** * Send an IP packet from the uIP buffer with SLIP. */ -u8_t slip_send(void); +uint8_t slip_send(void); /** * Input a SLIP byte. @@ -63,13 +63,13 @@ u8_t slip_send(void); */ int slip_input_byte(unsigned char c); -u8_t slip_write(const void *ptr, int len); +uint8_t slip_write(const void *ptr, int len); /* Did we receive any bytes lately? */ -extern u8_t slip_active; +extern uint8_t slip_active; /* Statistics. */ -extern u16_t slip_rubbish, slip_twopackets, slip_overflow, slip_ip_drop; +extern uint16_t slip_rubbish, slip_twopackets, slip_overflow, slip_ip_drop; /** * Set a function to be called when there is activity on the SLIP diff --git a/core/loader/cle.h b/core/loader/cle.h index 8c15b4080..0d4a755a4 100644 --- a/core/loader/cle.h +++ b/core/loader/cle.h @@ -37,9 +37,9 @@ */ /* These typedefs limits object file size! */ -typedef u16_t cle_off; /* Offset from start of file. */ -typedef u16_t cle_word; -typedef u16_t cle_half; +typedef uint16_t cle_off; /* Offset from start of file. */ +typedef uint16_t cle_word; +typedef uint16_t cle_half; /* Also used for address arithmetic (can't be void *). */ #ifdef __AVR__ diff --git a/core/loader/elfloader-avr.c b/core/loader/elfloader-avr.c index 6ae1c590e..d6b9bfc87 100644 --- a/core/loader/elfloader-avr.c +++ b/core/loader/elfloader-avr.c @@ -28,14 +28,12 @@ * * This file is part of the Contiki operating system. * - * @(#)$Id: elfloader-avr.c,v 1.10 2009/07/16 18:02:34 dak664 Exp $ */ #include #include #include #include -#include "dev/rs232.h" #include "elfloader-arch.h" #include "lib/mmem.h" #include //memset @@ -64,8 +62,8 @@ #define DEBUG 0 #if DEBUG -/*#define PRINTF(...) rs232_print_p(RS232_PORT_1, __VA_ARGS__)*/ -#define PRINTF(...) printf(__VA_ARGS__) +#include +#define PRINTF(FORMAT,args...) printf_P(PSTR(FORMAT),##args) #else #define PRINTF(...) #endif @@ -305,7 +303,7 @@ elfloader_arch_relocate(int fd, unsigned int sectionoffset, */ /* new solution */ - instr[2] = (u8_t) ((int)addr) & 0xff; + instr[2] = (uint8_t) ((int)addr) & 0xff; instr[3] = ((int)addr) >> 8; cfs_write(fd, instr, 4); break; diff --git a/core/net/dhcpc.c b/core/net/dhcpc.c index 241f5d3e4..5b2db719f 100644 --- a/core/net/dhcpc.c +++ b/core/net/dhcpc.c @@ -46,19 +46,19 @@ static struct dhcpc_state s; struct dhcp_msg { - u8_t op, htype, hlen, hops; - u8_t xid[4]; - u16_t secs, flags; - u8_t ciaddr[4]; - u8_t yiaddr[4]; - u8_t siaddr[4]; - u8_t giaddr[4]; - u8_t chaddr[16]; + uint8_t op, htype, hlen, hops; + uint8_t xid[4]; + uint16_t secs, flags; + uint8_t ciaddr[4]; + uint8_t yiaddr[4]; + uint8_t siaddr[4]; + uint8_t giaddr[4]; + uint8_t chaddr[16]; #ifndef UIP_CONF_DHCP_LIGHT - u8_t sname[64]; - u8_t file[128]; + uint8_t sname[64]; + uint8_t file[128]; #endif - u8_t options[312]; + uint8_t options[312]; }; #define BOOTP_BROADCAST 0x8000 @@ -90,11 +90,11 @@ struct dhcp_msg { #define DHCP_OPTION_REQ_LIST 55 #define DHCP_OPTION_END 255 -static u32_t xid; -static const u8_t magic_cookie[4] = {99, 130, 83, 99}; +static uint32_t xid; +static const uint8_t magic_cookie[4] = {99, 130, 83, 99}; /*---------------------------------------------------------------------------*/ -static u8_t * -add_msg_type(u8_t *optptr, u8_t type) +static uint8_t * +add_msg_type(uint8_t *optptr, uint8_t type) { *optptr++ = DHCP_OPTION_MSG_TYPE; *optptr++ = 1; @@ -102,8 +102,8 @@ add_msg_type(u8_t *optptr, u8_t type) return optptr; } /*---------------------------------------------------------------------------*/ -static u8_t * -add_server_id(u8_t *optptr) +static uint8_t * +add_server_id(uint8_t *optptr) { *optptr++ = DHCP_OPTION_SERVER_ID; *optptr++ = 4; @@ -111,8 +111,8 @@ add_server_id(u8_t *optptr) return optptr + 4; } /*---------------------------------------------------------------------------*/ -static u8_t * -add_req_ipaddr(u8_t *optptr) +static uint8_t * +add_req_ipaddr(uint8_t *optptr) { *optptr++ = DHCP_OPTION_REQ_IPADDR; *optptr++ = 4; @@ -120,8 +120,8 @@ add_req_ipaddr(u8_t *optptr) return optptr + 4; } /*---------------------------------------------------------------------------*/ -static u8_t * -add_req_options(u8_t *optptr) +static uint8_t * +add_req_options(uint8_t *optptr) { *optptr++ = DHCP_OPTION_REQ_LIST; *optptr++ = 3; @@ -131,8 +131,8 @@ add_req_options(u8_t *optptr) return optptr; } /*---------------------------------------------------------------------------*/ -static u8_t * -add_end(u8_t *optptr) +static uint8_t * +add_end(uint8_t *optptr) { *optptr++ = DHCP_OPTION_END; return optptr; @@ -166,7 +166,7 @@ create_msg(CC_REGISTER_ARG struct dhcp_msg *m) static void send_discover(void) { - u8_t *end; + uint8_t *end; struct dhcp_msg *m = (struct dhcp_msg *)uip_appdata; create_msg(m); @@ -175,13 +175,13 @@ send_discover(void) end = add_req_options(end); end = add_end(end); - uip_send(uip_appdata, (int)(end - (u8_t *)uip_appdata)); + uip_send(uip_appdata, (int)(end - (uint8_t *)uip_appdata)); } /*---------------------------------------------------------------------------*/ static void send_request(void) { - u8_t *end; + uint8_t *end; struct dhcp_msg *m = (struct dhcp_msg *)uip_appdata; create_msg(m); @@ -191,14 +191,14 @@ send_request(void) end = add_req_ipaddr(end); end = add_end(end); - uip_send(uip_appdata, (int)(end - (u8_t *)uip_appdata)); + uip_send(uip_appdata, (int)(end - (uint8_t *)uip_appdata)); } /*---------------------------------------------------------------------------*/ -static u8_t -parse_options(u8_t *optptr, int len) +static uint8_t +parse_options(uint8_t *optptr, int len) { - u8_t *end = optptr + len; - u8_t type = 0; + uint8_t *end = optptr + len; + uint8_t type = 0; while(optptr < end) { switch(*optptr) { @@ -229,7 +229,7 @@ parse_options(u8_t *optptr, int len) return type; } /*---------------------------------------------------------------------------*/ -static u8_t +static uint8_t parse_msg(void) { struct dhcp_msg *m = (struct dhcp_msg *)uip_appdata; @@ -250,8 +250,8 @@ static int msg_for_me(void) { struct dhcp_msg *m = (struct dhcp_msg *)uip_appdata; - u8_t *optptr = &m->options[4]; - u8_t *end = (u8_t*)uip_appdata + uip_datalen(); + uint8_t *optptr = &m->options[4]; + uint8_t *end = (uint8_t*)uip_appdata + uip_datalen(); if(m->op == DHCP_REPLY && memcmp(m->xid, &xid, sizeof(xid)) == 0 && @@ -340,7 +340,7 @@ PT_THREAD(handle_dhcp(process_event_t ev, void *data)) dhcpc_configured(&s); #define MAX_TICKS (~((clock_time_t)0) / 2) -#define MAX_TICKS32 (~((u32_t)0)) +#define MAX_TICKS32 (~((uint32_t)0)) #define IMIN(a, b) ((a) < (b) ? (a) : (b)) if((uip_ntohs(s.lease_time[0])*65536ul + uip_ntohs(s.lease_time[1]))*CLOCK_SECOND/2 diff --git a/core/net/dhcpc.h b/core/net/dhcpc.h index 528694483..87e02f7a3 100644 --- a/core/net/dhcpc.h +++ b/core/net/dhcpc.h @@ -38,13 +38,13 @@ struct dhcpc_state { char state; struct uip_udp_conn *conn; struct etimer etimer; - u32_t ticks; + uint32_t ticks; const void *mac_addr; int mac_len; - u8_t serverid[4]; + uint8_t serverid[4]; - u16_t lease_time[2]; + uint16_t lease_time[2]; uip_ipaddr_t ipaddr; uip_ipaddr_t netmask; uip_ipaddr_t dnsaddr; diff --git a/core/net/hc.c b/core/net/hc.c index eb7602eb6..ef2a48d50 100644 --- a/core/net/hc.c +++ b/core/net/hc.c @@ -48,27 +48,27 @@ #define FLAGS_BROADCASTDATA 0x4000 struct hc_hdr { - u16_t flagsport; + uint16_t flagsport; uip_ipaddr_t srcipaddr; }; struct udpip_hdr { /* IP header. */ - u8_t vhl, + uint8_t vhl, tos, len[2], ipid[2], ipoffset[2], ttl, proto; - u16_t ipchksum; + uint16_t ipchksum; uip_ipaddr_t srcipaddr, destipaddr; /* UDP header. */ - u16_t srcport, + uint16_t srcport, destport; - u16_t udplen; - u16_t udpchksum; + uint16_t udplen; + uint16_t udpchksum; }; #include @@ -100,7 +100,7 @@ hc_init(void) */ /*---------------------------------------------------------------------------*/ int -hc_compress(u8_t *buf, int len) +hc_compress(uint8_t *buf, int len) { struct hc_hdr *hdr; struct udpip_hdr *uhdr; @@ -162,7 +162,7 @@ hc_compress(u8_t *buf, int len) */ /*---------------------------------------------------------------------------*/ int -hc_inflate(u8_t *buf, int len) +hc_inflate(uint8_t *buf, int len) { struct udpip_hdr *uhdr; struct hc_hdr *hdr; diff --git a/core/net/hc.h b/core/net/hc.h index 8d5be19a4..b05560910 100644 --- a/core/net/hc.h +++ b/core/net/hc.h @@ -43,8 +43,8 @@ #include "net/uip.h" void hc_init(void); -int hc_compress(u8_t *buf, int len); -int hc_inflate(u8_t *buf, int len); +int hc_compress(uint8_t *buf, int len); +int hc_inflate(uint8_t *buf, int len); #define HC_HLEN 6 diff --git a/core/net/mac/cxmac.c b/core/net/mac/cxmac.c index ea3fcb070..4fec40d60 100644 --- a/core/net/mac/cxmac.c +++ b/core/net/mac/cxmac.c @@ -28,7 +28,6 @@ * * This file is part of the Contiki operating system. * - * $Id: cxmac.c,v 1.15 2010/10/03 20:37:32 adamdunkels Exp $ */ /** @@ -421,7 +420,7 @@ send_packet(void) uint8_t strobe[MAX_STROBE_SIZE]; int strobe_len, len; int is_broadcast = 0; - int is_reliable; +/*int is_reliable;*/ struct encounter *e; struct queuebuf *packet; int is_already_streaming = 0; @@ -450,8 +449,8 @@ send_packet(void) packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[1]); #endif /* UIP_CONF_IPV6 */ } - is_reliable = packetbuf_attr(PACKETBUF_ATTR_RELIABLE) || - packetbuf_attr(PACKETBUF_ATTR_ERELIABLE); +/* is_reliable = packetbuf_attr(PACKETBUF_ATTR_RELIABLE) || + packetbuf_attr(PACKETBUF_ATTR_ERELIABLE);*/ len = NETSTACK_FRAMER.create(); strobe_len = len + sizeof(struct cxmac_hdr); if(len < 0 || strobe_len > (int)sizeof(strobe)) { diff --git a/core/net/mac/xmac.c b/core/net/mac/xmac.c index 64d21c4a3..041685280 100644 --- a/core/net/mac/xmac.c +++ b/core/net/mac/xmac.c @@ -28,7 +28,6 @@ * * This file is part of the Contiki operating system. * - * $Id: xmac.c,v 1.60 2011/01/25 14:31:09 adamdunkels Exp $ */ /** @@ -463,7 +462,7 @@ send_packet(void) uint8_t strobe[MAX_STROBE_SIZE]; int strobe_len, len; int is_broadcast = 0; - int is_reliable; +/*int is_reliable; */ struct encounter *e; struct queuebuf *packet; int is_already_streaming = 0; @@ -491,8 +490,8 @@ send_packet(void) packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[1]); #endif /* UIP_CONF_IPV6 */ } - is_reliable = packetbuf_attr(PACKETBUF_ATTR_RELIABLE) || - packetbuf_attr(PACKETBUF_ATTR_ERELIABLE); +/* is_reliable = packetbuf_attr(PACKETBUF_ATTR_RELIABLE) || + packetbuf_attr(PACKETBUF_ATTR_ERELIABLE); */ packetbuf_set_attr(PACKETBUF_ATTR_MAC_ACK, 1); len = NETSTACK_FRAMER.create(); diff --git a/core/net/psock.c b/core/net/psock.c index 9d3d0781d..2300e6920 100644 --- a/core/net/psock.c +++ b/core/net/psock.c @@ -70,15 +70,15 @@ /*---------------------------------------------------------------------------*/ static void buf_setup(struct psock_buf *buf, - u8_t *bufptr, u16_t bufsize) + uint8_t *bufptr, uint16_t bufsize) { buf->ptr = bufptr; buf->left = bufsize; } /*---------------------------------------------------------------------------*/ -static u8_t -buf_bufdata(struct psock_buf *buf, u16_t len, - u8_t **dataptr, u16_t *datalen) +static uint8_t +buf_bufdata(struct psock_buf *buf, uint16_t len, + uint8_t **dataptr, uint16_t *datalen) { if(*datalen < buf->left) { memcpy(buf->ptr, *dataptr, *datalen); @@ -104,11 +104,11 @@ buf_bufdata(struct psock_buf *buf, u16_t len, } } /*---------------------------------------------------------------------------*/ -static u8_t -buf_bufto(CC_REGISTER_ARG struct psock_buf *buf, u8_t endmarker, - CC_REGISTER_ARG u8_t **dataptr, CC_REGISTER_ARG u16_t *datalen) +static uint8_t +buf_bufto(CC_REGISTER_ARG struct psock_buf *buf, uint8_t endmarker, + CC_REGISTER_ARG uint8_t **dataptr, CC_REGISTER_ARG uint16_t *datalen) { - u8_t c; + uint8_t c; while(buf->left > 0 && *datalen > 0) { c = *buf->ptr = **dataptr; ++*dataptr; @@ -233,7 +233,7 @@ PT_THREAD(psock_generator_send(CC_REGISTER_ARG struct psock *s, PT_END(&s->psockpt); } /*---------------------------------------------------------------------------*/ -u16_t +uint16_t psock_datalen(struct psock *psock) { return psock->bufsize - psock->buf.left; @@ -272,7 +272,7 @@ PT_THREAD(psock_readto(CC_REGISTER_ARG struct psock *psock, unsigned char c)) if(psock->readlen == 0) { PT_WAIT_UNTIL(&psock->psockpt, psock_newdata(psock)); psock->state = STATE_READ; - psock->readptr = (u8_t *)uip_appdata; + psock->readptr = (uint8_t *)uip_appdata; psock->readlen = uip_datalen(); } } while((buf_bufto(&psock->buf, c, @@ -300,7 +300,7 @@ PT_THREAD(psock_readbuf_len(CC_REGISTER_ARG struct psock *psock, uint16_t len)) if(psock->readlen == 0) { PT_WAIT_UNTIL(&psock->psockpt, psock_newdata(psock)); psock->state = STATE_READ; - psock->readptr = (u8_t *)uip_appdata; + psock->readptr = (uint8_t *)uip_appdata; psock->readlen = uip_datalen(); } } while(buf_bufdata(&psock->buf, psock->bufsize, diff --git a/core/net/psock.h b/core/net/psock.h index bdd6e95b6..d46b90956 100644 --- a/core/net/psock.h +++ b/core/net/psock.h @@ -100,7 +100,7 @@ * */ struct psock_buf { - u8_t *ptr; + uint8_t *ptr; unsigned short left; }; @@ -114,14 +114,14 @@ struct psock { struct pt pt, psockpt; /* Protothreads - one that's using the psock functions, and one that runs inside the psock functions. */ - const u8_t *sendptr; /* Pointer to the next data to be sent. */ - u8_t *readptr; /* Pointer to the next data to be read. */ + const uint8_t *sendptr; /* Pointer to the next data to be sent. */ + uint8_t *readptr; /* Pointer to the next data to be read. */ uint8_t *bufptr; /* Pointer to the buffer used for buffering incoming data. */ - u16_t sendlen; /* The number of bytes left to be sent. */ - u16_t readlen; /* The number of bytes left to be read. */ + uint16_t sendlen; /* The number of bytes left to be sent. */ + uint16_t readlen; /* The number of bytes left to be read. */ struct psock_buf buf; /* The structure holding the state of the input buffer. */ @@ -304,7 +304,7 @@ PT_THREAD(psock_readto(struct psock *psock, unsigned char c)); */ #define PSOCK_DATALEN(psock) psock_datalen(psock) -u16_t psock_datalen(struct psock *psock); +uint16_t psock_datalen(struct psock *psock); /** * Exit the protosocket's protothread. diff --git a/core/net/resolv.c b/core/net/resolv.c index ba952dd21..c5b750d57 100644 --- a/core/net/resolv.c +++ b/core/net/resolv.c @@ -101,8 +101,8 @@ PROCESS_THREAD(resolv_process, ev, data) /** \internal The DNS message header. */ struct dns_hdr { - u16_t id; - u8_t flags1, flags2; + uint16_t id; + uint8_t flags1, flags2; #define DNS_FLAG1_RESPONSE 0x80 #define DNS_FLAG1_OPCODE_STATUS 0x10 #define DNS_FLAG1_OPCODE_INVERSE 0x08 @@ -114,21 +114,21 @@ struct dns_hdr { #define DNS_FLAG2_ERR_MASK 0x0f #define DNS_FLAG2_ERR_NONE 0x00 #define DNS_FLAG2_ERR_NAME 0x03 - u16_t numquestions; - u16_t numanswers; - u16_t numauthrr; - u16_t numextrarr; + uint16_t numquestions; + uint16_t numanswers; + uint16_t numauthrr; + uint16_t numextrarr; }; /** \internal The DNS answer message structure. */ struct dns_answer { /* DNS answer record starts with either a domain name or a pointer to a name already present somewhere in the packet. */ - u16_t type; - u16_t class; - u16_t ttl[2]; - u16_t len; - u8_t ipaddr[4]; + uint16_t type; + uint16_t class; + uint16_t ttl[2]; + uint16_t len; + uint8_t ipaddr[4]; }; struct namemap { @@ -137,11 +137,11 @@ struct namemap { #define STATE_ASKING 2 #define STATE_DONE 3 #define STATE_ERROR 4 - u8_t state; - u8_t tmr; - u8_t retries; - u8_t seqno; - u8_t err; + uint8_t state; + uint8_t tmr; + uint8_t retries; + uint8_t seqno; + uint8_t err; char name[32]; uip_ipaddr_t ipaddr; }; @@ -155,7 +155,7 @@ struct namemap { static struct namemap names[RESOLV_ENTRIES]; -static u8_t seqno; +static uint8_t seqno; static struct uip_udp_conn *resolv_conn = NULL; @@ -276,8 +276,8 @@ newdata(void) unsigned char *nameptr; struct dns_answer *ans; struct dns_hdr *hdr; - static u8_t nquestions, nanswers; - static u8_t i; + static uint8_t nquestions, nanswers; + static uint8_t i; register struct namemap *namemapptr; hdr = (struct dns_hdr *)uip_appdata; @@ -293,7 +293,7 @@ newdata(void) /* The ID in the DNS header should be our entry into the name table. */ - i = (u8_t)uip_htons(hdr->id); + i = (uint8_t)uip_htons(hdr->id); namemapptr = &names[i]; if(i < RESOLV_ENTRIES && namemapptr->state == STATE_ASKING) { @@ -311,8 +311,8 @@ newdata(void) /* We only care about the question(s) and the answers. The authrr and the extrarr are simply discarded. */ - nquestions = (u8_t)uip_htons(hdr->numquestions); - nanswers = (u8_t)uip_htons(hdr->numanswers); + nquestions = (uint8_t)uip_htons(hdr->numquestions); + nanswers = (uint8_t)uip_htons(hdr->numanswers); /* Skip the name in the question. XXX: This should really be checked agains the name in the question, to be sure that they @@ -417,8 +417,8 @@ PROCESS_THREAD(resolv_process, ev, data) void resolv_query(const char *name) { - static u8_t i; - static u8_t lseq, lseqi; + static uint8_t i; + static uint8_t lseq, lseqi; register struct namemap *nameptr; lseq = lseqi = 0; @@ -466,7 +466,7 @@ resolv_query(const char *name) uip_ipaddr_t * resolv_lookup(const char *name) { - static u8_t i; + static uint8_t i; struct namemap *nameptr; /* Walk through the list to see if the name is in there. If it is diff --git a/core/net/rime/collect.c b/core/net/rime/collect.c index f51ba3a54..a73059cac 100644 --- a/core/net/rime/collect.c +++ b/core/net/rime/collect.c @@ -33,7 +33,6 @@ * * This file is part of the Contiki operating system. * - * $Id: collect.c,v 1.73 2011/01/18 16:05:53 adamdunkels Exp $ */ /** @@ -126,7 +125,7 @@ struct ack_msg { full, incoming packets are dropped instead of being forwarded. */ #define MAX_MAC_REXMITS 2 #define MAX_ACK_MAC_REXMITS 5 -#define REXMIT_TIME CLOCK_SECOND * 32 / NETSTACK_RDC_CHANNEL_CHECK_RATE +#define REXMIT_TIME (CLOCK_SECOND * 32 / NETSTACK_RDC_CHANNEL_CHECK_RATE) #define FORWARD_PACKET_LIFETIME_BASE REXMIT_TIME * 2 #define MAX_SENDING_QUEUE 3 * QUEUEBUF_NUM / 4 #define MIN_AVAILABLE_QUEUE_ENTRIES 4 diff --git a/core/net/rime/rime-udp.c b/core/net/rime/rime-udp.c index 3e0f154db..c59d41cda 100644 --- a/core/net/rime/rime-udp.c +++ b/core/net/rime/rime-udp.c @@ -50,7 +50,7 @@ #if DEBUG #include #define PRINTF(...) printf(__VA_ARGS__) -#define PRINT6ADDR(addr) PRINTF(" %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x ", ((u8_t *)addr)[0], ((u8_t *)addr)[1], ((u8_t *)addr)[2], ((u8_t *)addr)[3], ((u8_t *)addr)[4], ((u8_t *)addr)[5], ((u8_t *)addr)[6], ((u8_t *)addr)[7], ((u8_t *)addr)[8], ((u8_t *)addr)[9], ((u8_t *)addr)[10], ((u8_t *)addr)[11], ((u8_t *)addr)[12], ((u8_t *)addr)[13], ((u8_t *)addr)[14], ((u8_t *)addr)[15]) +#define PRINT6ADDR(addr) PRINTF(" %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x ", ((uint8_t *)addr)[0], ((uint8_t *)addr)[1], ((uint8_t *)addr)[2], ((uint8_t *)addr)[3], ((uint8_t *)addr)[4], ((uint8_t *)addr)[5], ((uint8_t *)addr)[6], ((uint8_t *)addr)[7], ((uint8_t *)addr)[8], ((uint8_t *)addr)[9], ((uint8_t *)addr)[10], ((uint8_t *)addr)[11], ((uint8_t *)addr)[12], ((uint8_t *)addr)[13], ((uint8_t *)addr)[14], ((uint8_t *)addr)[15]) #define PRINTLLADDR(lladdr) PRINTF(" %02x:%02x:%02x:%02x:%02x:%02x ",(lladdr)->addr[0], (lladdr)->addr[1], (lladdr)->addr[2], (lladdr)->addr[3],(lladdr)->addr[4], (lladdr)->addr[5]) #else #define PRINTF(...) diff --git a/core/net/rime/rimeaddr.c b/core/net/rime/rimeaddr.c index ae3896fc9..a409509cc 100644 --- a/core/net/rime/rimeaddr.c +++ b/core/net/rime/rimeaddr.c @@ -59,7 +59,7 @@ const rimeaddr_t rimeaddr_null = { { 0, 0, 0, 0, 0, 0, 0, 0 } }; void rimeaddr_copy(rimeaddr_t *dest, const rimeaddr_t *src) { - u8_t i; + uint8_t i; for(i = 0; i < RIMEADDR_SIZE; i++) { dest->u8[i] = src->u8[i]; } @@ -68,7 +68,7 @@ rimeaddr_copy(rimeaddr_t *dest, const rimeaddr_t *src) int rimeaddr_cmp(const rimeaddr_t *addr1, const rimeaddr_t *addr2) { - u8_t i; + uint8_t i; for(i = 0; i < RIMEADDR_SIZE; i++) { if(addr1->u8[i] != addr2->u8[i]) { return 0; diff --git a/core/net/rpl/rpl-dag.c b/core/net/rpl/rpl-dag.c old mode 100755 new mode 100644 index 6bea3d46d..9f52e41ef --- a/core/net/rpl/rpl-dag.c +++ b/core/net/rpl/rpl-dag.c @@ -99,6 +99,21 @@ MEMB(parent_memb, struct rpl_parent, rpl_instance_t instance_table[RPL_MAX_INSTANCES]; rpl_instance_t *default_instance; +/************************************************************************/ +/* lollipop greater than function. */ +/************************************************************************/ +int rpl_lollipop_greater_than(int a, int b) { + /* Check if we are comparing an initial value with an old value */ + if(a > RPL_LOLLIPOP_CIRCULAR_REGION && b <= RPL_LOLLIPOP_CIRCULAR_REGION) { + return (RPL_LOLLIPOP_MAX_VALUE + 1 + b - a) > RPL_LOLLIPOP_SEQUENCE_WINDOWS; + } + /* Otherwise check if a > b and comparable => ok, or + if they have wrapped and are still comparable */ + return (a > b && (a - b) < RPL_LOLLIPOP_SEQUENCE_WINDOWS) || + (a < b && (b - a) > (RPL_LOLLIPOP_CIRCULAR_REGION + 1- + RPL_LOLLIPOP_SEQUENCE_WINDOWS)); +} + /************************************************************************/ /* Remove DAG parents with a rank that is at least the same as minimum_rank. */ static void @@ -161,10 +176,9 @@ should_send_dao(rpl_instance_t *instance, rpl_dio_t *dio, rpl_parent_t *p) if(instance->mop == RPL_MOP_NO_DOWNWARD_ROUTES) { return 0; } + /* check if the new DTSN is more recent */ return p == instance->current_dag->preferred_parent && - (RPL_LOLLIPOP_GREATER_THAN(dio->dtsn, p->dtsn) || - ((RPL_LOLLIPOP_GREATER_THAN(p->dtsn, dio->dtsn)) && - RPL_LOLLIPOP_IS_INIT(dio->dtsn))); + (rpl_lollipop_greater_than(dio->dtsn, p->dtsn)); } /************************************************************************/ static int @@ -1127,18 +1141,18 @@ rpl_process_dio(uip_ipaddr_t *from, rpl_dio_t *dio) return; } - if(RPL_LOLLIPOP_GREATER_THAN(dio->version, dag->version)) { + if(rpl_lollipop_greater_than(dio->version, dag->version)) { if(dag->rank == ROOT_RANK(instance)) { PRINTF("RPL: Root received inconsistent DIO version number\n"); - dag->version = dio->version; - RPL_LOLLIPOP_INCREMENT(dag->version); - rpl_reset_dio_timer(instance); + dag->version = dio->version; + RPL_LOLLIPOP_INCREMENT(dag->version); + rpl_reset_dio_timer(instance); } else { global_repair(from, dag, dio); } return; } else { - if(RPL_LOLLIPOP_GREATER_THAN(dag->version, dio->version)) { + if(rpl_lollipop_greater_than(dag->version, dio->version)) { /* The DIO sender is on an older version of the DAG. */ PRINTF("RPL: old version received => inconsistency detected\n"); if(dag->joined) { diff --git a/core/net/rpl/rpl-of-etx.c b/core/net/rpl/rpl-of-etx.c index 466d86ca6..05a521c83 100644 --- a/core/net/rpl/rpl-of-etx.c +++ b/core/net/rpl/rpl-of-etx.c @@ -66,11 +66,6 @@ rpl_of_t rpl_of_etx = { 1 }; -#define NI_ETX_TO_RPL_ETX(etx) \ - ((etx) * (RPL_DAG_MC_ETX_DIVISOR / NEIGHBOR_INFO_ETX_DIVISOR)) -#define RPL_ETX_TO_NI_ETX(etx) \ - ((etx) / (RPL_DAG_MC_ETX_DIVISOR / NEIGHBOR_INFO_ETX_DIVISOR)) - /* Reject parents that have a higher link metric than the following. */ #define MAX_LINK_METRIC 10 @@ -90,8 +85,11 @@ calculate_path_metric(rpl_parent_t *p) { if(p == NULL || (p->mc.obj.etx == 0 && p->rank > ROOT_RANK(p->dag->instance))) { return MAX_PATH_COST * RPL_DAG_MC_ETX_DIVISOR; + } else { + long etx = p->link_metric; + etx = (etx * RPL_DAG_MC_ETX_DIVISOR) / NEIGHBOR_INFO_ETX_DIVISOR; + return p->mc.obj.etx + (uint16_t) etx; } - return p->mc.obj.etx + NI_ETX_TO_RPL_ETX(p->link_metric); } static void @@ -116,7 +114,8 @@ calculate_rank(rpl_parent_t *p, rpl_rank_t base_rank) } rank_increase = NEIGHBOR_INFO_FIX2ETX(INITIAL_LINK_METRIC) * DEFAULT_MIN_HOPRANKINC; } else { - rank_increase = NEIGHBOR_INFO_FIX2ETX(p->link_metric) * p->dag->instance->min_hoprankinc; + /* multiply first, then scale down to avoid truncation effects */ + rank_increase = NEIGHBOR_INFO_FIX2ETX(p->link_metric * p->dag->instance->min_hoprankinc); if(base_rank == 0) { base_rank = p->rank; } diff --git a/core/net/rpl/rpl-private.h b/core/net/rpl/rpl-private.h index a4fb43b83..94eaec0d8 100644 --- a/core/net/rpl/rpl-private.h +++ b/core/net/rpl/rpl-private.h @@ -129,7 +129,7 @@ #else #define DEFAULT_MIN_HOPRANKINC RPL_CONF_MIN_HOPRANKINC #endif -#define DEFAULT_MAX_RANKINC (3 * DEFAULT_MIN_HOPRANKINC) +#define DEFAULT_MAX_RANKINC (7 * DEFAULT_MIN_HOPRANKINC) #define DAG_RANK(fixpt_rank, instance) ((fixpt_rank) / (instance)->min_hoprankinc) diff --git a/core/net/rpl/rpl.h b/core/net/rpl/rpl.h index 66660e29f..e039cf98d 100644 --- a/core/net/rpl/rpl.h +++ b/core/net/rpl/rpl.h @@ -131,19 +131,12 @@ typedef uint16_t rpl_ocp_t; #define RPL_LOLLIPOP_CIRCULAR_REGION 127 #define RPL_LOLLIPOP_SEQUENCE_WINDOWS 16 #define RPL_LOLLIPOP_INIT RPL_LOLLIPOP_MAX_VALUE - RPL_LOLLIPOP_SEQUENCE_WINDOWS + 1 -#define RPL_LOLLIPOP_INCREMENT(counter) (counter > RPL_LOLLIPOP_CIRCULAR_REGION ?\ - (counter == RPL_LOLLIPOP_MAX_VALUE ? counter=0 : ++counter):\ - (counter == RPL_LOLLIPOP_CIRCULAR_REGION ? counter=0 : ++counter)) +#define RPL_LOLLIPOP_INCREMENT(ctr) (ctr > RPL_LOLLIPOP_CIRCULAR_REGION ? \ + ++ctr & RPL_LOLLIPOP_MAX_VALUE : \ + ++ctr & RPL_LOLLIPOP_CIRCULAR_REGION) + #define RPL_LOLLIPOP_IS_INIT(counter) (counter > RPL_LOLLIPOP_CIRCULAR_REGION) -#define RPL_LOLLIPOP_GREATER_THAN_LOCAL(A,B) (((A < B) && (RPL_LOLLIPOP_CIRCULAR_REGION + 1 - B + A < RPL_LOLLIPOP_SEQUENCE_WINDOWS)) || \ - ((A > B) && (A - B < RPL_LOLLIPOP_SEQUENCE_WINDOWS))) -#define RPL_LOLLIPOP_GREATER_THAN(A,B) ((A > RPL_LOLLIPOP_CIRCULAR_REGION )?\ - ((B > RPL_LOLLIPOP_CIRCULAR_REGION )?\ - RPL_LOLLIPOP_GREATER_THAN_LOCAL(A,B):\ - 0):\ - ((B > RPL_LOLLIPOP_CIRCULAR_REGION )?\ - 1:\ - RPL_LOLLIPOP_GREATER_THAN_LOCAL(A,B))) + /*---------------------------------------------------------------------------*/ /* DAG Metric Container Object Types, to be confirmed by IANA. */ #define RPL_DAG_MC_NONE 0 /* Local identifier for empty MC */ diff --git a/core/net/sicslowpan.c b/core/net/sicslowpan.c index 24d57ddbe..432c6831f 100644 --- a/core/net/sicslowpan.c +++ b/core/net/sicslowpan.c @@ -72,12 +72,12 @@ #define DEBUG 0 #if DEBUG /* PRINTFI and PRINTFO are defined for input and output to debug one without changing the timing of the other */ -u8_t p; +uint8_t p; #include #define PRINTF(...) printf(__VA_ARGS__) #define PRINTFI(...) printf(__VA_ARGS__) #define PRINTFO(...) printf(__VA_ARGS__) -#define PRINT6ADDR(addr) PRINTF(" %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x ", ((u8_t *)addr)[0], ((u8_t *)addr)[1], ((u8_t *)addr)[2], ((u8_t *)addr)[3], ((u8_t *)addr)[4], ((u8_t *)addr)[5], ((u8_t *)addr)[6], ((u8_t *)addr)[7], ((u8_t *)addr)[8], ((u8_t *)addr)[9], ((u8_t *)addr)[10], ((u8_t *)addr)[11], ((u8_t *)addr)[12], ((u8_t *)addr)[13], ((u8_t *)addr)[14], ((u8_t *)addr)[15]) +#define PRINT6ADDR(addr) PRINTF(" %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x ", ((uint8_t *)addr)[0], ((uint8_t *)addr)[1], ((uint8_t *)addr)[2], ((uint8_t *)addr)[3], ((uint8_t *)addr)[4], ((uint8_t *)addr)[5], ((uint8_t *)addr)[6], ((uint8_t *)addr)[7], ((uint8_t *)addr)[8], ((uint8_t *)addr)[9], ((uint8_t *)addr)[10], ((uint8_t *)addr)[11], ((uint8_t *)addr)[12], ((uint8_t *)addr)[13], ((uint8_t *)addr)[14], ((uint8_t *)addr)[15]) #define PRINTLLADDR(lladdr) PRINTF(" %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x ",lladdr->addr[0], lladdr->addr[1], lladdr->addr[2], lladdr->addr[3],lladdr->addr[4], lladdr->addr[5],lladdr->addr[6], lladdr->addr[7]) #define PRINTPACKETBUF() PRINTF("RIME buffer: "); for(p = 0; p < packetbuf_datalen(); p++){PRINTF("%.2X", *(rime_ptr + p));} PRINTF("\n") #define PRINTUIPBUF() PRINTF("UIP buffer: "); for(p = 0; p < uip_len; p++){PRINTF("%.2X", uip_buf[p]);}PRINTF("\n") @@ -192,14 +192,14 @@ extern struct sicslowpan_nh_compressor SICSLOWPAN_NH_COMPRESSOR; * We initialize it to the beginning of the rime buffer, then * access different fields by updating the offset rime_hdr_len. */ -static u8_t *rime_ptr; +static uint8_t *rime_ptr; /** * rime_hdr_len is the total length of (the processed) 6lowpan headers * (fragment headers, IPV6 or HC1, HC2, and HC1 and HC2 non compressed * fields). */ -static u8_t rime_hdr_len; +static uint8_t rime_hdr_len; /** * The length of the payload in the Rime buffer. @@ -207,13 +207,13 @@ static u8_t rime_hdr_len; * headers (can be the IP payload if the IP header only is compressed * or the UDP payload if the UDP header is also compressed) */ -static u8_t rime_payload_len; +static uint8_t rime_payload_len; /** * uncomp_hdr_len is the length of the headers before compression (if HC2 * is used this includes the UDP header in addition to the IP header). */ -static u8_t uncomp_hdr_len; +static uint8_t uncomp_hdr_len; /** @} */ #if SICSLOWPAN_CONF_FRAG @@ -377,7 +377,7 @@ addr_context_lookup_by_prefix(uip_ipaddr_t *ipaddr) /*--------------------------------------------------------------------*/ /** \brief find the context with the given number */ static struct sicslowpan_addr_context* -addr_context_lookup_by_number(u8_t number) +addr_context_lookup_by_number(uint8_t number) { /* Remove code to avoid warnings and save flash if no context is used */ #if SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS > 0 @@ -712,9 +712,9 @@ compress_hdr_hc06(rimeaddr_t *rime_destaddr) *hc06_ptr = SICSLOWPAN_NHC_UDP_CS_P_11; PRINTF("IPHC: remove 12 b of both source & dest with prefix 0xFOB\n"); *(hc06_ptr + 1) = - (u8_t)((UIP_HTONS(UIP_UDP_BUF->srcport) - + (uint8_t)((UIP_HTONS(UIP_UDP_BUF->srcport) - SICSLOWPAN_UDP_4_BIT_PORT_MIN) << 4) + - (u8_t)((UIP_HTONS(UIP_UDP_BUF->destport) - + (uint8_t)((UIP_HTONS(UIP_UDP_BUF->destport) - SICSLOWPAN_UDP_4_BIT_PORT_MIN)); hc06_ptr += 2; } else if((UIP_HTONS(UIP_UDP_BUF->destport) & 0xff00) == SICSLOWPAN_UDP_8_BIT_PORT_MIN) { @@ -723,7 +723,7 @@ compress_hdr_hc06(rimeaddr_t *rime_destaddr) PRINTF("IPHC: leave source, remove 8 bits of dest with prefix 0xF0\n"); memcpy(hc06_ptr + 1, &UIP_UDP_BUF->srcport, 2); *(hc06_ptr + 3) = - (u8_t)((UIP_HTONS(UIP_UDP_BUF->destport) - + (uint8_t)((UIP_HTONS(UIP_UDP_BUF->destport) - SICSLOWPAN_UDP_8_BIT_PORT_MIN)); hc06_ptr += 4; } else if((UIP_HTONS(UIP_UDP_BUF->srcport) & 0xff00) == SICSLOWPAN_UDP_8_BIT_PORT_MIN) { @@ -731,7 +731,7 @@ compress_hdr_hc06(rimeaddr_t *rime_destaddr) *hc06_ptr = SICSLOWPAN_NHC_UDP_CS_P_10; PRINTF("IPHC: remove 8 bits of source with prefix 0xF0, leave dest. hch: %i\n", *hc06_ptr); *(hc06_ptr + 1) = - (u8_t)((UIP_HTONS(UIP_UDP_BUF->srcport) - + (uint8_t)((UIP_HTONS(UIP_UDP_BUF->srcport) - SICSLOWPAN_UDP_8_BIT_PORT_MIN)); memcpy(hc06_ptr + 2, &UIP_UDP_BUF->destport, 2); hc06_ptr += 4; @@ -1147,9 +1147,9 @@ compress_hdr_hc1(rimeaddr_t *rime_destaddr) RIME_HC1_HC_UDP_PTR[RIME_HC1_HC_UDP_TTL] = UIP_IP_BUF->ttl; RIME_HC1_HC_UDP_PTR[RIME_HC1_HC_UDP_PORTS] = - (u8_t)((UIP_HTONS(UIP_UDP_BUF->srcport) - + (uint8_t)((UIP_HTONS(UIP_UDP_BUF->srcport) - SICSLOWPAN_UDP_PORT_MIN) << 4) + - (u8_t)((UIP_HTONS(UIP_UDP_BUF->destport) - SICSLOWPAN_UDP_PORT_MIN)); + (uint8_t)((UIP_HTONS(UIP_UDP_BUF->destport) - SICSLOWPAN_UDP_PORT_MIN)); memcpy(&RIME_HC1_HC_UDP_PTR[RIME_HC1_HC_UDP_CHKSUM], &UIP_UDP_BUF->udpchksum, 2); rime_hdr_len += SICSLOWPAN_HC1_HC_UDP_HDR_LEN; uncomp_hdr_len += UIP_UDPH_LEN; diff --git a/core/net/sicslowpan.h b/core/net/sicslowpan.h index cb73db599..2af071edf 100644 --- a/core/net/sicslowpan.h +++ b/core/net/sicslowpan.h @@ -183,9 +183,9 @@ * offset field is just not used */ /* struct sicslowpan_frag_hdr { */ -/* u16_t dispatch_size; */ -/* u16_t tag; */ -/* u8_t offset; */ +/* uint16_t dispatch_size; */ +/* uint16_t tag; */ +/* uint8_t offset; */ /* }; */ /** @@ -197,21 +197,21 @@ * structure */ /* struct sicslowpan_hc1_hdr { */ -/* u8_t dispatch; */ -/* u8_t encoding; */ -/* u8_t ttl; */ +/* uint8_t dispatch; */ +/* uint8_t encoding; */ +/* uint8_t ttl; */ /* }; */ /** * \brief HC1 followed by HC_UDP */ /* struct sicslowpan_hc1_hc_udp_hdr { */ -/* u8_t dispatch; */ -/* u8_t hc1_encoding; */ -/* u8_t hc_udp_encoding; */ -/* u8_t ttl; */ -/* u8_t ports; */ -/* u16_t udpchksum; */ +/* uint8_t dispatch; */ +/* uint8_t hc1_encoding; */ +/* uint8_t hc_udp_encoding; */ +/* uint8_t ttl; */ +/* uint8_t ports; */ +/* uint16_t udpchksum; */ /* }; */ /** @@ -219,9 +219,9 @@ * each context can have upto 8 bytes */ struct sicslowpan_addr_context { - u8_t used; /* possibly use as prefix-length */ - u8_t number; - u8_t prefix[8]; + uint8_t used; /* possibly use as prefix-length */ + uint8_t number; + uint8_t prefix[8]; }; /** @@ -248,7 +248,7 @@ struct sicslowpan_addr_context { * compressed multicast address is known. It is true * if the 9-bit group is the all nodes or all routers * group. - * \param a is typed u8_t * + * \param a is typed uint8_t * */ #define sicslowpan_is_mcast_addr_decompressable(a) \ (((*a & 0x01) == 0) && \ diff --git a/core/net/slipdev.c b/core/net/slipdev.c index ba20b065b..63b079538 100644 --- a/core/net/slipdev.c +++ b/core/net/slipdev.c @@ -76,10 +76,10 @@ #define SLIP_ESC_END 0334 #define SLIP_ESC_ESC 0335 -static u8_t slip_buf[UIP_BUFSIZE]; +static uint8_t slip_buf[UIP_BUFSIZE]; -static u16_t len, tmplen; -static u8_t lastc; +static uint16_t len, tmplen; +static uint8_t lastc; /*-----------------------------------------------------------------------------------*/ /** @@ -93,12 +93,12 @@ static u8_t lastc; * \return This function will always return UIP_FW_OK. */ /*-----------------------------------------------------------------------------------*/ -u8_t +uint8_t slipdev_send(void) { - u16_t i; - u8_t *ptr; - u8_t c; + uint16_t i; + uint8_t *ptr; + uint8_t c; slipdev_char_put(SLIP_END); @@ -140,10 +140,10 @@ slipdev_send(void) * zero if no packet is available. */ /*-----------------------------------------------------------------------------------*/ -u16_t +uint16_t slipdev_poll(void) { - u8_t c; + uint8_t c; while(slipdev_char_poll(&c)) { switch(c) { diff --git a/core/net/slipdev.h b/core/net/slipdev.h index 17e80bfff..cc2c44633 100644 --- a/core/net/slipdev.h +++ b/core/net/slipdev.h @@ -57,7 +57,7 @@ * * \param c The character to be put on the serial device. */ -void slipdev_char_put(u8_t c); +void slipdev_char_put(uint8_t c); /** * Poll the serial device for a character. @@ -77,11 +77,11 @@ void slipdev_char_put(u8_t c); * \retval 0 If no character is available. * \retval Non-zero If a character is available. */ -u8_t slipdev_char_poll(u8_t *c); +uint8_t slipdev_char_poll(uint8_t *c); void slipdev_init(void); -u8_t slipdev_send(void); -u16_t slipdev_poll(void); +uint8_t slipdev_send(void); +uint16_t slipdev_poll(void); #endif /* __SLIPDEV_H__ */ diff --git a/core/net/tcpdump.c b/core/net/tcpdump.c index c6789eebd..66cf68d6d 100644 --- a/core/net/tcpdump.c +++ b/core/net/tcpdump.c @@ -38,15 +38,15 @@ struct ip_hdr { /* IP header. */ - u8_t vhl, + uint8_t vhl, tos, len[2], ipid[2], ipoffset[2], ttl, proto; - u16_t ipchksum; - u8_t srcipaddr[4], + uint16_t ipchksum; + uint8_t srcipaddr[4], destipaddr[4]; }; @@ -60,27 +60,27 @@ struct tcpip_hdr { /* IP header. */ - u8_t vhl, + uint8_t vhl, tos, len[2], ipid[2], ipoffset[2], ttl, proto; - u16_t ipchksum; - u8_t srcipaddr[4], + uint16_t ipchksum; + uint8_t srcipaddr[4], destipaddr[4]; /* TCP header. */ - u16_t srcport, + uint16_t srcport, destport; - u8_t seqno[4], + uint8_t seqno[4], ackno[4], tcpoffset, flags, wnd[2]; - u16_t tcpchksum; - u8_t urgp[2]; - u8_t optdata[4]; + uint16_t tcpchksum; + uint8_t urgp[2]; + uint8_t optdata[4]; }; #define ICMP_ECHO_REPLY 0 @@ -88,43 +88,43 @@ struct tcpip_hdr { struct icmpip_hdr { /* IP header. */ - u8_t vhl, + uint8_t vhl, tos, len[2], ipid[2], ipoffset[2], ttl, proto; - u16_t ipchksum; - u8_t srcipaddr[4], + uint16_t ipchksum; + uint8_t srcipaddr[4], destipaddr[4]; /* The ICMP and IP headers. */ /* ICMP (echo) header. */ - u8_t type, icode; - u16_t icmpchksum; - u16_t id, seqno; + uint8_t type, icode; + uint16_t icmpchksum; + uint16_t id, seqno; }; /* The UDP and IP headers. */ struct udpip_hdr { /* IP header. */ - u8_t vhl, + uint8_t vhl, tos, len[2], ipid[2], ipoffset[2], ttl, proto; - u16_t ipchksum; - u8_t srcipaddr[4], + uint16_t ipchksum; + uint8_t srcipaddr[4], destipaddr[4]; /* UDP header. */ - u16_t srcport, + uint16_t srcport, destport; - u16_t udplen; - u16_t udpchksum; + uint16_t udplen; + uint16_t udpchksum; }; #define ETHBUF ((struct eth_hdr *)&packet[0]) @@ -158,10 +158,10 @@ tcpflags(unsigned char flags, char *flagsstr) } /*---------------------------------------------------------------------------*/ static char * CC_FASTCALL -n(u16_t num, char *ptr) +n(uint16_t num, char *ptr) { - u16_t d; - u8_t a, f; + uint16_t d; + uint8_t a, f; if(num == 0) { *ptr = '0'; @@ -195,8 +195,8 @@ s(char *str, char *ptr) } /*---------------------------------------------------------------------------*/ int -tcpdump_format(u8_t *packet, u16_t packetlen, - char *buf, u16_t buflen) +tcpdump_format(uint8_t *packet, uint16_t packetlen, + char *buf, uint16_t buflen) { char flags[8]; if(IPBUF->proto == UIP_PROTO_ICMP) { diff --git a/core/net/tcpdump.h b/core/net/tcpdump.h index 54f06d4b1..c49a7322c 100644 --- a/core/net/tcpdump.h +++ b/core/net/tcpdump.h @@ -35,7 +35,7 @@ #include "uip.h" -int tcpdump_format(u8_t *packet, u16_t packetlen, - char *printbuf, u16_t printbuflen); +int tcpdump_format(uint8_t *packet, uint16_t packetlen, + char *printbuf, uint16_t printbuflen); #endif /* __TCPDUMP_H__ */ diff --git a/core/net/tcpip.c b/core/net/tcpip.c index 53f6feb38..e65123f0b 100644 --- a/core/net/tcpip.c +++ b/core/net/tcpip.c @@ -90,7 +90,7 @@ extern struct etimer uip_reass_timer; * \internal Structure for holding a TCP port and a process ID. */ struct listenport { - u16_t port; + uint16_t port; struct process *p; }; @@ -109,9 +109,9 @@ enum { /* Called on IP packet output. */ #if UIP_CONF_IPV6 -static u8_t (* outputfunc)(uip_lladdr_t *a); +static uint8_t (* outputfunc)(uip_lladdr_t *a); -u8_t +uint8_t tcpip_output(uip_lladdr_t *a) { int ret; @@ -124,14 +124,14 @@ tcpip_output(uip_lladdr_t *a) } void -tcpip_set_outputfunc(u8_t (*f)(uip_lladdr_t *)) +tcpip_set_outputfunc(uint8_t (*f)(uip_lladdr_t *)) { outputfunc = f; } #else -static u8_t (* outputfunc)(void); -u8_t +static uint8_t (* outputfunc)(void); +uint8_t tcpip_output(void) { if(outputfunc != NULL) { @@ -142,7 +142,7 @@ tcpip_output(void) } void -tcpip_set_outputfunc(u8_t (*f)(void)) +tcpip_set_outputfunc(uint8_t (*f)(void)) { outputfunc = f; } @@ -226,7 +226,7 @@ packet_input(void) #if UIP_TCP #if UIP_ACTIVE_OPEN struct uip_conn * -tcp_connect(uip_ipaddr_t *ripaddr, u16_t port, void *appstate) +tcp_connect(uip_ipaddr_t *ripaddr, uint16_t port, void *appstate) { struct uip_conn *c; @@ -245,7 +245,7 @@ tcp_connect(uip_ipaddr_t *ripaddr, u16_t port, void *appstate) #endif /* UIP_ACTIVE_OPEN */ /*---------------------------------------------------------------------------*/ void -tcp_unlisten(u16_t port) +tcp_unlisten(uint16_t port) { static unsigned char i; struct listenport *l; @@ -263,7 +263,7 @@ tcp_unlisten(u16_t port) } /*---------------------------------------------------------------------------*/ void -tcp_listen(u16_t port) +tcp_listen(uint16_t port) { static unsigned char i; struct listenport *l; @@ -306,7 +306,7 @@ udp_attach(struct uip_udp_conn *conn, } /*---------------------------------------------------------------------------*/ struct uip_udp_conn * -udp_new(const uip_ipaddr_t *ripaddr, u16_t port, void *appstate) +udp_new(const uip_ipaddr_t *ripaddr, uint16_t port, void *appstate) { struct uip_udp_conn *c; uip_udp_appstate_t *s; @@ -324,7 +324,7 @@ udp_new(const uip_ipaddr_t *ripaddr, u16_t port, void *appstate) } /*---------------------------------------------------------------------------*/ struct uip_udp_conn * -udp_broadcast_new(u16_t port, void *appstate) +udp_broadcast_new(uint16_t port, void *appstate) { uip_ipaddr_t addr; struct uip_udp_conn *conn; @@ -343,7 +343,7 @@ udp_broadcast_new(u16_t port, void *appstate) #endif /* UIP_UDP */ /*---------------------------------------------------------------------------*/ #if UIP_CONF_ICMP6 -u8_t +uint8_t icmp6_new(void *appstate) { if(uip_icmp6_conns.appstate.p == PROCESS_NONE) { uip_icmp6_conns.appstate.p = PROCESS_CURRENT(); @@ -354,7 +354,7 @@ icmp6_new(void *appstate) { } void -tcpip_icmp6_call(u8_t type) +tcpip_icmp6_call(uint8_t type) { if(uip_icmp6_conns.appstate.p != PROCESS_NONE) { /* XXX: This is a hack that needs to be updated. Passing a pointer (&type) diff --git a/core/net/tcpip.h b/core/net/tcpip.h index 12573d1ec..1ff5060ce 100644 --- a/core/net/tcpip.h +++ b/core/net/tcpip.h @@ -126,7 +126,7 @@ CCIF void tcp_attach(struct uip_conn *conn, * \param port The port number in network byte order. * */ -CCIF void tcp_listen(u16_t port); +CCIF void tcp_listen(uint16_t port); /** * Close a listening TCP port. @@ -140,7 +140,7 @@ CCIF void tcp_listen(u16_t port); * \param port The port number in network byte order. * */ -CCIF void tcp_unlisten(u16_t port); +CCIF void tcp_unlisten(uint16_t port); /** * Open a TCP connection to the specified IP address and port. @@ -165,7 +165,7 @@ CCIF void tcp_unlisten(u16_t port); * memory could not be allocated for the connection. * */ -CCIF struct uip_conn *tcp_connect(uip_ipaddr_t *ripaddr, u16_t port, +CCIF struct uip_conn *tcp_connect(uip_ipaddr_t *ripaddr, uint16_t port, void *appstate); /** @@ -226,7 +226,7 @@ void udp_attach(struct uip_udp_conn *conn, * \return A pointer to the newly created connection, or NULL if * memory could not be allocated for the connection. */ -CCIF struct uip_udp_conn *udp_new(const uip_ipaddr_t *ripaddr, u16_t port, +CCIF struct uip_udp_conn *udp_new(const uip_ipaddr_t *ripaddr, uint16_t port, void *appstate); /** @@ -241,7 +241,7 @@ CCIF struct uip_udp_conn *udp_new(const uip_ipaddr_t *ripaddr, u16_t port, * \return A pointer to the newly created connection, or NULL if * memory could not be allocated for the connection. */ -struct uip_udp_conn *udp_broadcast_new(u16_t port, void *appstate); +struct uip_udp_conn *udp_broadcast_new(uint16_t port, void *appstate); /** * Bind a UDP connection to a local port. @@ -302,14 +302,14 @@ CCIF extern process_event_t tcpip_icmp6_event; * If an application registers here, it will be polled with a * process_post_synch every time an ICMPv6 packet is received. */ -u8_t icmp6_new(void *appstate); +uint8_t icmp6_new(void *appstate); /** * This function is called at reception of an ICMPv6 packet * If an application registered as an ICMPv6 listener (with * icmp6_new), it will be called through a process_post_synch() */ -void tcpip_icmp6_call(u8_t type); +void tcpip_icmp6_call(uint8_t type); #endif /*UIP_CONF_ICMP6*/ /** @} */ @@ -341,11 +341,11 @@ CCIF void tcpip_input(void); * The eventual parameter is the MAC address of the destination. */ #if UIP_CONF_IPV6 -u8_t tcpip_output(uip_lladdr_t *); -void tcpip_set_outputfunc(u8_t (* f)(uip_lladdr_t *)); +uint8_t tcpip_output(uip_lladdr_t *); +void tcpip_set_outputfunc(uint8_t (* f)(uip_lladdr_t *)); #else -u8_t tcpip_output(void); -void tcpip_set_outputfunc(u8_t (* f)(void)); +uint8_t tcpip_output(void); +void tcpip_set_outputfunc(uint8_t (* f)(void)); #endif /** diff --git a/core/net/uaodv-def.h b/core/net/uaodv-def.h index 7a0f68846..9c60a229b 100644 --- a/core/net/uaodv-def.h +++ b/core/net/uaodv-def.h @@ -54,17 +54,17 @@ struct uaodv_rtentry { uip_ipaddr_t dest_addr; uip_ipaddr_t next_hop; uip_ipaddr_t precursors[NUM_PRECURSORS]; - u32_t dest_seqno; - u16_t lifetime; - u8_t dest_seqno_flag; - u8_t route_flags; - u8_t hop_count; + uint32_t dest_seqno; + uint16_t lifetime; + uint8_t dest_seqno_flag; + uint8_t route_flags; + uint8_t hop_count; }; #endif /* Generic AODV message */ struct uaodv_msg { - u8_t type; + uint8_t type; }; /* AODV RREQ message */ @@ -76,15 +76,15 @@ struct uaodv_msg { #define UAODV_RREQ_UNKSEQNO (1 << 3) struct uaodv_msg_rreq { - u8_t type; - u8_t flags; - u8_t reserved; - u8_t hop_count; - u32_t rreq_id; + uint8_t type; + uint8_t flags; + uint8_t reserved; + uint8_t hop_count; + uint32_t rreq_id; uip_ipaddr_t dest_addr; - u32_t dest_seqno; + uint32_t dest_seqno; uip_ipaddr_t orig_addr; - u32_t orig_seqno; + uint32_t orig_seqno; }; /* AODV RREP message */ @@ -93,14 +93,14 @@ struct uaodv_msg_rreq { #define UAODV_RREP_ACK (1 << 6) struct uaodv_msg_rrep { - u8_t type; - u8_t flags; - u8_t prefix_sz; /* prefix_sz:5 */ - u8_t hop_count; + uint8_t type; + uint8_t flags; + uint8_t prefix_sz; /* prefix_sz:5 */ + uint8_t hop_count; uip_ipaddr_t dest_addr; - u32_t dest_seqno; + uint32_t dest_seqno; uip_ipaddr_t orig_addr; - u32_t lifetime; + uint32_t lifetime; }; /* AODV RERR message */ @@ -109,13 +109,13 @@ struct uaodv_msg_rrep { #define UAODV_RERR_UNKNOWN (1 << 6) /* Non standard extension /bg. */ struct uaodv_msg_rerr { - u8_t type; - u8_t flags; - u8_t reserved; - u8_t dest_count; + uint8_t type; + uint8_t flags; + uint8_t reserved; + uint8_t dest_count; struct { uip_ipaddr_t addr; - u32_t seqno; + uint32_t seqno; } unreach[1]; }; @@ -123,23 +123,23 @@ struct uaodv_msg_rerr { #define UAODV_RREP_ACK_TYPE 4 struct uaodv_msg_rrep_ack { - u8_t type; - u8_t reserved; + uint8_t type; + uint8_t reserved; }; #define RREP_HELLO_INTERVAL_EXT 1 /* Per RFC 3561. */ #define RREQ_BAD_HOP_EXT 101 /* Non standard extension /bg */ struct uaodv_extension { - u8_t type; - u8_t length; - /* u8_t value[length]; */ + uint8_t type; + uint8_t length; + /* uint8_t value[length]; */ }; struct uaodv_bad_hop_ext { - u8_t type; - u8_t length; - u8_t unused1, unused2; + uint8_t type; + uint8_t length; + uint8_t unused1, unused2; uip_ipaddr_t addrs[1]; }; diff --git a/core/net/uaodv-rt.c b/core/net/uaodv-rt.c index 9e02181d8..b3f667d16 100644 --- a/core/net/uaodv-rt.c +++ b/core/net/uaodv-rt.c @@ -62,7 +62,7 @@ uaodv_rt_init(void) /*---------------------------------------------------------------------------*/ struct uaodv_rt_entry * uaodv_rt_add(uip_ipaddr_t *dest, uip_ipaddr_t *nexthop, - unsigned hop_count, const u32_t *seqno) + unsigned hop_count, const uint32_t *seqno) { struct uaodv_rt_entry *e; diff --git a/core/net/uaodv-rt.h b/core/net/uaodv-rt.h index bf8876246..f94d03a92 100644 --- a/core/net/uaodv-rt.h +++ b/core/net/uaodv-rt.h @@ -47,14 +47,14 @@ struct uaodv_rt_entry { struct uaodv_rt_entry *next; uip_ipaddr_t dest; uip_ipaddr_t nexthop; - u32_t hseqno; /* In host byte order! */ - u8_t hop_count; - u8_t is_bad; /* Only one bit is used. */ + uint32_t hseqno; /* In host byte order! */ + uint8_t hop_count; + uint8_t is_bad; /* Only one bit is used. */ }; struct uaodv_rt_entry * uaodv_rt_add(uip_ipaddr_t *dest, uip_ipaddr_t *nexthop, - unsigned hop_count, const u32_t *seqno); + unsigned hop_count, const uint32_t *seqno); struct uaodv_rt_entry *uaodv_rt_lookup_any(uip_ipaddr_t *dest); struct uaodv_rt_entry *uaodv_rt_lookup(uip_ipaddr_t *dest); void uaodv_rt_remove(struct uaodv_rt_entry *e); diff --git a/core/net/uaodv.c b/core/net/uaodv.c index 12973d430..e01fe8c23 100644 --- a/core/net/uaodv.c +++ b/core/net/uaodv.c @@ -62,9 +62,9 @@ PROCESS(uaodv_process, "uAODV"); static struct uip_udp_conn *bcastconn, *unicastconn; /* Compare sequence numbers as per RFC 3561. */ -#define SCMP32(a, b) ((s32_t)((a) - (b))) +#define SCMP32(a, b) ((int32_t)((a) - (b))) -static CC_INLINE u32_t +static CC_INLINE uint32_t last_known_seqno(uip_ipaddr_t *host) { struct uaodv_rt_entry *route = uaodv_rt_lookup_any(host); @@ -76,24 +76,24 @@ last_known_seqno(uip_ipaddr_t *host) } -static u32_t rreq_id, my_hseqno; /* In host byte order! */ +static uint32_t rreq_id, my_hseqno; /* In host byte order! */ #define NFWCACHE 16 static struct { uip_ipaddr_t orig; - u32_t id; + uint32_t id; } fwcache[NFWCACHE]; static CC_INLINE int -fwc_lookup(const uip_ipaddr_t *orig, const u32_t *id) +fwc_lookup(const uip_ipaddr_t *orig, const uint32_t *id) { unsigned n = (orig->u8[2] + orig->u8[3]) % NFWCACHE; return fwcache[n].id == *id && uip_ipaddr_cmp(&fwcache[n].orig, orig); } static CC_INLINE void -fwc_add(const uip_ipaddr_t *orig, const u32_t *id) +fwc_add(const uip_ipaddr_t *orig, const uint32_t *id) { unsigned n = (orig->u8[2] + orig->u8[3]) % NFWCACHE; fwcache[n].id = *id; @@ -206,7 +206,7 @@ send_rreq(uip_ipaddr_t *addr) /*---------------------------------------------------------------------------*/ static void send_rrep(uip_ipaddr_t *dest, uip_ipaddr_t *nexthop, uip_ipaddr_t *orig, - u32_t *seqno, unsigned hop_count) + uint32_t *seqno, unsigned hop_count) { struct uaodv_msg_rrep *rm = (struct uaodv_msg_rrep *)uip_appdata; @@ -225,7 +225,7 @@ send_rrep(uip_ipaddr_t *dest, uip_ipaddr_t *nexthop, uip_ipaddr_t *orig, } /*---------------------------------------------------------------------------*/ static void -send_rerr(uip_ipaddr_t *addr, u32_t *seqno) +send_rerr(uip_ipaddr_t *addr, uint32_t *seqno) { struct uaodv_msg_rerr *rm = (struct uaodv_msg_rerr *)uip_appdata; @@ -284,17 +284,17 @@ handle_incoming_rreq(void) #ifdef AODV_BAD_HOP_EXTENSION if(uip_len > (sizeof(*rm) + 2)) { struct uaodv_bad_hop_ext *ext = (void *)(uip_appdata + sizeof(*rm)); - u8_t *end = uip_appdata + uip_len; + uint8_t *end = uip_appdata + uip_len; for(; - (u8_t *)ext < end; - ext = (void *)((u8_t *)ext + ext->length + 2)) { - u8_t *eend = (u8_t *)ext + ext->length; + (uint8_t *)ext < end; + ext = (void *)((uint8_t *)ext + ext->length + 2)) { + uint8_t *eend = (uint8_t *)ext + ext->length; if(eend > end) eend = end; if(ext->type == RREQ_BAD_HOP_EXT) { uip_ipaddr_t *a; - for(a = ext->addrs; (u8_t *)a < eend; a++) { + for(a = ext->addrs; (uint8_t *)a < eend; a++) { if(uip_ipaddr_cmp(a, &uip_hostaddr)) { print_debug("BAD_HOP drop\n"); return; @@ -330,7 +330,7 @@ handle_incoming_rreq(void) } if (fw != NULL) { - u32_t net_seqno; + uint32_t net_seqno; print_debug("RREQ for known route\n"); uip_ipaddr_copy(&dest_addr, &rm->dest_addr); @@ -339,7 +339,7 @@ handle_incoming_rreq(void) send_rrep(&dest_addr, &rt->nexthop, &orig_addr, &net_seqno, fw->hop_count + 1); } else if(uip_ipaddr_cmp(&rm->dest_addr, &uip_hostaddr)) { - u32_t net_seqno; + uint32_t net_seqno; print_debug("RREQ for our address\n"); uip_ipaddr_copy(&dest_addr, &rm->dest_addr); @@ -381,7 +381,7 @@ handle_incoming_rrep(void) /* Useless HELLO message? */ if(uip_ipaddr_cmp(&BUF->destipaddr, &uip_broadcast_addr)) { #ifdef AODV_RESPOND_TO_HELLOS - u32_t net_seqno; + uint32_t net_seqno; #ifdef CC2420_RADIO int ret = cc2420_check_remote(uip_udp_sender()->u16[1]); @@ -518,7 +518,7 @@ static enum { } command; static uip_ipaddr_t bad_dest; -static u32_t bad_seqno; /* In network byte order! */ +static uint32_t bad_seqno; /* In network byte order! */ void uaodv_bad_dest(uip_ipaddr_t *dest) diff --git a/core/net/uip-ds6.h b/core/net/uip-ds6.h index dc608ef16..49b6f13a7 100644 --- a/core/net/uip-ds6.h +++ b/core/net/uip-ds6.h @@ -194,8 +194,8 @@ typedef struct uip_ds6_prefix { uip_ipaddr_t ipaddr; uint8_t length; uint8_t advertise; - u32_t vlifetime; - u32_t plifetime; + uint32_t vlifetime; + uint32_t plifetime; uint8_t l_a_reserved; /**< on-link and autonomous flags + 6 reserved bits */ } uip_ds6_prefix_t; #else /* UIP_CONF_ROUTER */ diff --git a/core/net/uip-fw.c b/core/net/uip-fw.c index d1ad38da9..bb42f2490 100644 --- a/core/net/uip-fw.c +++ b/core/net/uip-fw.c @@ -76,45 +76,45 @@ static struct uip_fw_netif *defaultnetif = NULL; struct tcpip_hdr { /* IP header. */ - u8_t vhl, + uint8_t vhl, tos; - u16_t len, + uint16_t len, ipid, ipoffset; - u8_t ttl, + uint8_t ttl, proto; - u16_t ipchksum; + uint16_t ipchksum; uip_ipaddr_t srcipaddr, destipaddr; /* TCP header. */ - u16_t srcport, + uint16_t srcport, destport; - u8_t seqno[4], + uint8_t seqno[4], ackno[4], tcpoffset, flags, wnd[2]; - u16_t tcpchksum; - u8_t urgp[2]; - u8_t optdata[4]; + uint16_t tcpchksum; + uint8_t urgp[2]; + uint8_t optdata[4]; }; struct icmpip_hdr { /* IP header. */ - u8_t vhl, + uint8_t vhl, tos, len[2], ipid[2], ipoffset[2], ttl, proto; - u16_t ipchksum; + uint16_t ipchksum; uip_ipaddr_t srcipaddr, destipaddr; /* ICMP (echo) header. */ - u8_t type, icode; - u16_t icmpchksum; - u16_t id, seqno; - u8_t payload[1]; + uint8_t type, icode; + uint16_t icmpchksum; + uint16_t id, seqno; + uint8_t payload[1]; }; /* ICMP ECHO. */ @@ -138,20 +138,20 @@ struct icmpip_hdr { * duplicate packets. */ struct fwcache_entry { - u16_t timer; + uint16_t timer; uip_ipaddr_t srcipaddr; uip_ipaddr_t destipaddr; - u16_t ipid; - u8_t proto; - u8_t unused; + uint16_t ipid; + uint8_t proto; + uint8_t unused; #if notdef - u16_t payload[2]; + uint16_t payload[2]; #endif #if UIP_REASSEMBLY > 0 - u16_t len, offset; + uint16_t len, offset; #endif }; @@ -242,7 +242,7 @@ time_exceeded(void) /* Calculate the ICMP checksum. */ ICMPBUF->icmpchksum = 0; - ICMPBUF->icmpchksum = ~uip_chksum((u16_t *)&(ICMPBUF->type), 36); + ICMPBUF->icmpchksum = ~uip_chksum((uint16_t *)&(ICMPBUF->type), 36); /* Set the IP destination address to be the source address of the original packet. */ @@ -255,7 +255,7 @@ time_exceeded(void) IP header (20) = 56. */ uip_len = 56; ICMPBUF->len[0] = 0; - ICMPBUF->len[1] = (u8_t)uip_len; + ICMPBUF->len[1] = (uint8_t)uip_len; /* Fill in the other fields in the IP header. */ ICMPBUF->vhl = 0x45; @@ -351,7 +351,7 @@ find_netif(void) * function is passed unmodified as a return value. */ /*------------------------------------------------------------------------------*/ -u8_t +uint8_t uip_fw_output(void) { struct uip_fw_netif *netif; @@ -400,7 +400,7 @@ uip_fw_output(void) * the packet should be processed locally. */ /*------------------------------------------------------------------------------*/ -u8_t +uint8_t uip_fw_forward(void) { struct fwcache_entry *fw; diff --git a/core/net/uip-fw.h b/core/net/uip-fw.h index 4b1d8c1cc..244b93e6f 100644 --- a/core/net/uip-fw.h +++ b/core/net/uip-fw.h @@ -56,7 +56,7 @@ struct uip_fw_netif { linked in a list. */ uip_ipaddr_t ipaddr; /**< The IP address of this interface. */ uip_ipaddr_t netmask; /**< The netmask of the interface. */ - u8_t (* output)(void); + uint8_t (* output)(void); /**< A pointer to the function that sends a packet. */ }; @@ -93,8 +93,8 @@ struct uip_fw_netif { * \hideinitializer */ #define uip_fw_setipaddr(netif, addr) \ - do { (netif)->ipaddr[0] = ((u16_t *)(addr))[0]; \ - (netif)->ipaddr[1] = ((u16_t *)(addr))[1]; } while(0) + do { (netif)->ipaddr[0] = ((uint16_t *)(addr))[0]; \ + (netif)->ipaddr[1] = ((uint16_t *)(addr))[1]; } while(0) /** * Set the netmask of a network interface. * @@ -105,12 +105,12 @@ struct uip_fw_netif { * \hideinitializer */ #define uip_fw_setnetmask(netif, addr) \ - do { (netif)->netmask[0] = ((u16_t *)(addr))[0]; \ - (netif)->netmask[1] = ((u16_t *)(addr))[1]; } while(0) + do { (netif)->netmask[0] = ((uint16_t *)(addr))[0]; \ + (netif)->netmask[1] = ((uint16_t *)(addr))[1]; } while(0) void uip_fw_init(void); -u8_t uip_fw_forward(void); -u8_t uip_fw_output(void); +uint8_t uip_fw_forward(void); +uint8_t uip_fw_output(void); void uip_fw_register(struct uip_fw_netif *netif); void uip_fw_default(struct uip_fw_netif *netif); void uip_fw_periodic(void); diff --git a/core/net/uip-icmp6.c b/core/net/uip-icmp6.c index a8b01b5a4..4d6ae90b3 100644 --- a/core/net/uip-icmp6.c +++ b/core/net/uip-icmp6.c @@ -50,7 +50,7 @@ #if DEBUG #include #define PRINTF(...) printf(__VA_ARGS__) -#define PRINT6ADDR(addr) PRINTF(" %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x ", ((u8_t *)addr)[0], ((u8_t *)addr)[1], ((u8_t *)addr)[2], ((u8_t *)addr)[3], ((u8_t *)addr)[4], ((u8_t *)addr)[5], ((u8_t *)addr)[6], ((u8_t *)addr)[7], ((u8_t *)addr)[8], ((u8_t *)addr)[9], ((u8_t *)addr)[10], ((u8_t *)addr)[11], ((u8_t *)addr)[12], ((u8_t *)addr)[13], ((u8_t *)addr)[14], ((u8_t *)addr)[15]) +#define PRINT6ADDR(addr) PRINTF(" %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x ", ((uint8_t *)addr)[0], ((uint8_t *)addr)[1], ((uint8_t *)addr)[2], ((uint8_t *)addr)[3], ((uint8_t *)addr)[4], ((uint8_t *)addr)[5], ((uint8_t *)addr)[6], ((uint8_t *)addr)[7], ((uint8_t *)addr)[8], ((uint8_t *)addr)[9], ((uint8_t *)addr)[10], ((uint8_t *)addr)[11], ((uint8_t *)addr)[12], ((uint8_t *)addr)[13], ((uint8_t *)addr)[14], ((uint8_t *)addr)[15]) #define PRINTLLADDR(lladdr) PRINTF(" %02x:%02x:%02x:%02x:%02x:%02x ",lladdr->addr[0], lladdr->addr[1], lladdr->addr[2], lladdr->addr[3],lladdr->addr[4], lladdr->addr[5]) #else #define PRINTF(...) @@ -75,7 +75,7 @@ void uip_icmp6_echo_request_input(void) { #if UIP_CONF_IPV6_RPL - u8_t temp_ext_len; + uint8_t temp_ext_len; #endif /* UIP_CONF_IPV6_RPL */ /* * we send an echo reply. It is trivial if there was no extension @@ -159,7 +159,7 @@ uip_icmp6_echo_request_input(void) } /*---------------------------------------------------------------------------*/ void -uip_icmp6_error_output(u8_t type, u8_t code, u32_t param) { +uip_icmp6_error_output(uint8_t type, uint8_t code, uint32_t param) { /* check if originating packet is not an ICMP error*/ if (uip_ext_len) { diff --git a/core/net/uip-icmp6.h b/core/net/uip-icmp6.h index 804f7a993..ca4b576bf 100644 --- a/core/net/uip-icmp6.h +++ b/core/net/uip-icmp6.h @@ -99,7 +99,7 @@ /** \brief ICMPv6 Error message constant part */ typedef struct uip_icmp6_error{ - u32_t param; + uint32_t param; } uip_icmp6_error; /** \name ICMPv6 RFC4443 Message processing and sending */ @@ -120,7 +120,7 @@ uip_icmp6_echo_request_input(void); * \param type 32 bit parameter of the error message, semantic depends on error */ void -uip_icmp6_error_output(u8_t type, u8_t code, u32_t param); +uip_icmp6_error_output(uint8_t type, uint8_t code, uint32_t param); /** * \brief Send an icmpv6 message diff --git a/core/net/uip-nd6.c b/core/net/uip-nd6.c index 47ada0b20..985703a8d 100644 --- a/core/net/uip-nd6.c +++ b/core/net/uip-nd6.c @@ -154,7 +154,7 @@ uip_nd6_ns_input(void) PRINTF("\n"); UIP_STAT(++uip_stat.nd6.recv); - u8_t flags; + uint8_t flags; #if UIP_CONF_IPV6_CHECKS if((UIP_IP_BUF->ttl != UIP_ND6_HOP_LIMIT) || @@ -403,11 +403,11 @@ uip_nd6_na_input(void) * booleans. the three last one are not 0 or 1 but 0 or 0x80, 0x40, 0x20 * but it works. Be careful though, do not use tests such as is_router == 1 */ - u8_t is_llchange = 0; - u8_t is_router = ((UIP_ND6_NA_BUF->flagsreserved & UIP_ND6_NA_FLAG_ROUTER)); - u8_t is_solicited = + uint8_t is_llchange = 0; + uint8_t is_router = ((UIP_ND6_NA_BUF->flagsreserved & UIP_ND6_NA_FLAG_ROUTER)); + uint8_t is_solicited = ((UIP_ND6_NA_BUF->flagsreserved & UIP_ND6_NA_FLAG_SOLICITED)); - u8_t is_override = + uint8_t is_override = ((UIP_ND6_NA_BUF->flagsreserved & UIP_ND6_NA_FLAG_OVERRIDE)); #if UIP_CONF_IPV6_CHECKS diff --git a/core/net/uip-neighbor.c b/core/net/uip-neighbor.c index 3a31527f4..7e74714b2 100644 --- a/core/net/uip-neighbor.c +++ b/core/net/uip-neighbor.c @@ -55,7 +55,7 @@ struct neighbor_entry { uip_ipaddr_t ipaddr; struct uip_neighbor_addr addr; - u8_t time; + uint8_t time; }; static struct neighbor_entry entries[ENTRIES]; @@ -86,7 +86,7 @@ void uip_neighbor_add(uip_ipaddr_t *ipaddr, struct uip_neighbor_addr *addr) { int i, oldest; - u8_t oldest_time; + uint8_t oldest_time; /* printf("Adding neighbor with link address %02x:%02x:%02x:%02x:%02x:%02x\n", addr->addr.addr[0], addr->addr.addr[1], addr->addr.addr[2], addr->addr.addr[3], diff --git a/core/net/uip-over-mesh.c b/core/net/uip-over-mesh.c index 7ed2cf9a6..8655188ab 100644 --- a/core/net/uip-over-mesh.c +++ b/core/net/uip-over-mesh.c @@ -196,7 +196,7 @@ uip_over_mesh_make_announced_gateway(void) const static struct trickle_callbacks trickle_call = {gateway_announce_recv}; /*---------------------------------------------------------------------------*/ void -uip_over_mesh_init(u16_t channels) +uip_over_mesh_init(uint16_t channels) { PRINTF("Our address is %d.%d (%d.%d.%d.%d)\n", @@ -215,7 +215,7 @@ uip_over_mesh_init(u16_t channels) route_set_lifetime(30); } /*---------------------------------------------------------------------------*/ -u8_t +uint8_t uip_over_mesh_send(void) { rimeaddr_t receiver; diff --git a/core/net/uip-over-mesh.h b/core/net/uip-over-mesh.h index fa241387d..43eb5dd8e 100644 --- a/core/net/uip-over-mesh.h +++ b/core/net/uip-over-mesh.h @@ -45,8 +45,8 @@ #include "net/uip-fw.h" #include "net/rime.h" -void uip_over_mesh_init(u16_t channels); -u8_t uip_over_mesh_send(void); +void uip_over_mesh_init(uint16_t channels); +uint8_t uip_over_mesh_send(void); void uip_over_mesh_set_gateway_netif(struct uip_fw_netif *netif); void uip_over_mesh_set_gateway(rimeaddr_t *gw); diff --git a/core/net/uip-split.c b/core/net/uip-split.c index f7ff2333e..e84cc53ea 100644 --- a/core/net/uip-split.c +++ b/core/net/uip-split.c @@ -49,7 +49,7 @@ void uip_split_output(void) { #if UIP_TCP - u16_t tcplen, len1, len2; + uint16_t tcplen, len1, len2; /* We only try to split maximum sized TCP segments. */ if(BUF->proto == UIP_PROTO_TCP && @@ -111,7 +111,7 @@ uip_split_output(void) #endif /* UIP_CONF_IPV6 */ /* uip_appdata += len1;*/ - memcpy(uip_appdata, (u8_t *)uip_appdata + len1, len2); + memcpy(uip_appdata, (uint8_t *)uip_appdata + len1, len2); uip_add32(BUF->seqno, len1); BUF->seqno[0] = uip_acc32[0]; diff --git a/core/net/uip-udp-packet.c b/core/net/uip-udp-packet.c index 3ef0fb30e..5a7e814e9 100644 --- a/core/net/uip-udp-packet.c +++ b/core/net/uip-udp-packet.c @@ -40,7 +40,7 @@ #include "contiki-conf.h" -extern u16_t uip_slen; +extern uint16_t uip_slen; #include "net/uip-udp-packet.h" diff --git a/core/net/uip.c b/core/net/uip.c index 3fe8dfff0..444ee308b 100644 --- a/core/net/uip.c +++ b/core/net/uip.c @@ -138,15 +138,15 @@ void *uip_sappdata; /* The uip_appdata pointer points to void *uip_urgdata; /* The uip_urgdata pointer points to urgent data (out-of-band data), if present. */ -u16_t uip_urglen, uip_surglen; +uint16_t uip_urglen, uip_surglen; #endif /* UIP_URGDATA > 0 */ -u16_t uip_len, uip_slen; +uint16_t uip_len, uip_slen; /* The uip_len is either 8 or 16 bits, depending on the maximum packet size. */ -u8_t uip_flags; /* The uip_flags variable is used for +uint8_t uip_flags; /* The uip_flags variable is used for communication between the TCP/IP stack and the application program. */ struct uip_conn *uip_conn; /* uip_conn always points to the current @@ -155,7 +155,7 @@ struct uip_conn *uip_conn; /* uip_conn always points to the current struct uip_conn uip_conns[UIP_CONNS]; /* The uip_conns array holds all TCP connections. */ -u16_t uip_listenports[UIP_LISTENPORTS]; +uint16_t uip_listenports[UIP_LISTENPORTS]; /* The uip_listenports list all currently listning ports. */ #if UIP_UDP @@ -163,24 +163,24 @@ struct uip_udp_conn *uip_udp_conn; struct uip_udp_conn uip_udp_conns[UIP_UDP_CONNS]; #endif /* UIP_UDP */ -static u16_t ipid; /* Ths ipid variable is an increasing +static uint16_t ipid; /* Ths ipid variable is an increasing number that is used for the IP ID field. */ -void uip_setipid(u16_t id) { ipid = id; } +void uip_setipid(uint16_t id) { ipid = id; } -static u8_t iss[4]; /* The iss variable is used for the TCP +static uint8_t iss[4]; /* The iss variable is used for the TCP initial sequence number. */ #if UIP_ACTIVE_OPEN || UIP_UDP -static u16_t lastport; /* Keeps track of the last port used for +static uint16_t lastport; /* Keeps track of the last port used for a new connection. */ #endif /* UIP_ACTIVE_OPEN || UIP_UDP */ /* Temporary variables. */ -u8_t uip_acc32[4]; -static u8_t c, opt; -static u16_t tmp16; +uint8_t uip_acc32[4]; +static uint8_t c, opt; +static uint16_t tmp16; /* Structures and definitions. */ #define TCP_FIN 0x01 @@ -238,7 +238,7 @@ void uip_log(char *msg); #if ! UIP_ARCH_ADD32 void -uip_add32(u8_t *op32, u16_t op16) +uip_add32(uint8_t *op32, uint16_t op16) { uip_acc32[3] = op32[3] + (op16 & 0xff); uip_acc32[2] = op32[2] + (op16 >> 8); @@ -268,12 +268,12 @@ uip_add32(u8_t *op32, u16_t op16) #if ! UIP_ARCH_CHKSUM /*---------------------------------------------------------------------------*/ -static u16_t -chksum(u16_t sum, const u8_t *data, u16_t len) +static uint16_t +chksum(uint16_t sum, const uint8_t *data, uint16_t len) { - u16_t t; - const u8_t *dataptr; - const u8_t *last_byte; + uint16_t t; + const uint8_t *dataptr; + const uint8_t *last_byte; dataptr = data; last_byte = data + len - 1; @@ -299,17 +299,17 @@ chksum(u16_t sum, const u8_t *data, u16_t len) return sum; } /*---------------------------------------------------------------------------*/ -u16_t -uip_chksum(u16_t *data, u16_t len) +uint16_t +uip_chksum(uint16_t *data, uint16_t len) { - return uip_htons(chksum(0, (u8_t *)data, len)); + return uip_htons(chksum(0, (uint8_t *)data, len)); } /*---------------------------------------------------------------------------*/ #ifndef UIP_ARCH_IPCHKSUM -u16_t +uint16_t uip_ipchksum(void) { - u16_t sum; + uint16_t sum; sum = chksum(0, &uip_buf[UIP_LLH_LEN], UIP_IPH_LEN); DEBUG_PRINTF("uip_ipchksum: sum 0x%04x\n", sum); @@ -317,16 +317,16 @@ uip_ipchksum(void) } #endif /*---------------------------------------------------------------------------*/ -static u16_t -upper_layer_chksum(u8_t proto) +static uint16_t +upper_layer_chksum(uint8_t proto) { - u16_t upper_layer_len; - u16_t sum; + uint16_t upper_layer_len; + uint16_t sum; #if UIP_CONF_IPV6 - upper_layer_len = (((u16_t)(BUF->len[0]) << 8) + BUF->len[1]); + upper_layer_len = (((uint16_t)(BUF->len[0]) << 8) + BUF->len[1]); #else /* UIP_CONF_IPV6 */ - upper_layer_len = (((u16_t)(BUF->len[0]) << 8) + BUF->len[1]) - UIP_IPH_LEN; + upper_layer_len = (((uint16_t)(BUF->len[0]) << 8) + BUF->len[1]) - UIP_IPH_LEN; #endif /* UIP_CONF_IPV6 */ /* First sum pseudoheader. */ @@ -334,7 +334,7 @@ upper_layer_chksum(u8_t proto) /* IP protocol and length fields. This addition cannot carry. */ sum = upper_layer_len + proto; /* Sum IP source and destination addresses. */ - sum = chksum(sum, (u8_t *)&BUF->srcipaddr, 2 * sizeof(uip_ipaddr_t)); + sum = chksum(sum, (uint8_t *)&BUF->srcipaddr, 2 * sizeof(uip_ipaddr_t)); /* Sum TCP header and data. */ sum = chksum(sum, &uip_buf[UIP_IPH_LEN + UIP_LLH_LEN], @@ -344,7 +344,7 @@ upper_layer_chksum(u8_t proto) } /*---------------------------------------------------------------------------*/ #if UIP_CONF_IPV6 -u16_t +uint16_t uip_icmp6chksum(void) { return upper_layer_chksum(UIP_PROTO_ICMP6); @@ -352,14 +352,14 @@ uip_icmp6chksum(void) } #endif /* UIP_CONF_IPV6 */ /*---------------------------------------------------------------------------*/ -u16_t +uint16_t uip_tcpchksum(void) { return upper_layer_chksum(UIP_PROTO_TCP); } /*---------------------------------------------------------------------------*/ #if UIP_UDP_CHECKSUMS -u16_t +uint16_t uip_udpchksum(void) { return upper_layer_chksum(UIP_PROTO_UDP); @@ -396,7 +396,7 @@ uip_init(void) /*---------------------------------------------------------------------------*/ #if UIP_ACTIVE_OPEN struct uip_conn * -uip_connect(uip_ipaddr_t *ripaddr, u16_t rport) +uip_connect(uip_ipaddr_t *ripaddr, uint16_t rport) { register struct uip_conn *conn, *cconn; @@ -462,7 +462,7 @@ uip_connect(uip_ipaddr_t *ripaddr, u16_t rport) /*---------------------------------------------------------------------------*/ #if UIP_UDP struct uip_udp_conn * -uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport) +uip_udp_new(const uip_ipaddr_t *ripaddr, uint16_t rport) { register struct uip_udp_conn *conn; @@ -507,7 +507,7 @@ uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport) #endif /* UIP_UDP */ /*---------------------------------------------------------------------------*/ void -uip_unlisten(u16_t port) +uip_unlisten(uint16_t port) { for(c = 0; c < UIP_LISTENPORTS; ++c) { if(uip_listenports[c] == port) { @@ -518,7 +518,7 @@ uip_unlisten(u16_t port) } /*---------------------------------------------------------------------------*/ void -uip_listen(u16_t port) +uip_listen(uint16_t port) { for(c = 0; c < UIP_LISTENPORTS; ++c) { if(uip_listenports[c] == 0) { @@ -532,22 +532,22 @@ uip_listen(u16_t port) #if UIP_REASSEMBLY && !UIP_CONF_IPV6 #define UIP_REASS_BUFSIZE (UIP_BUFSIZE - UIP_LLH_LEN) -static u8_t uip_reassbuf[UIP_REASS_BUFSIZE]; -static u8_t uip_reassbitmap[UIP_REASS_BUFSIZE / (8 * 8)]; -static const u8_t bitmap_bits[8] = {0xff, 0x7f, 0x3f, 0x1f, +static uint8_t uip_reassbuf[UIP_REASS_BUFSIZE]; +static uint8_t uip_reassbitmap[UIP_REASS_BUFSIZE / (8 * 8)]; +static const uint8_t bitmap_bits[8] = {0xff, 0x7f, 0x3f, 0x1f, 0x0f, 0x07, 0x03, 0x01}; -static u16_t uip_reasslen; -static u8_t uip_reassflags; +static uint16_t uip_reasslen; +static uint8_t uip_reassflags; #define UIP_REASS_FLAG_LASTFRAG 0x01 -static u8_t uip_reasstmr; +static uint8_t uip_reasstmr; #define IP_MF 0x20 -static u8_t +static uint8_t uip_reass(void) { - u16_t offset, len; - u16_t i; + uint16_t offset, len; + uint16_t i; /* If ip_reasstmr is zero, no packet is present in the buffer, so we write the IP header of the fragment into the reassembly @@ -633,7 +633,7 @@ uip_reass(void) /* Check the last byte in the bitmap. It should contain just the right amount of bits. */ if(uip_reassbitmap[uip_reasslen / (8 * 8)] != - (u8_t)~bitmap_bits[uip_reasslen / 8 & 7]) { + (uint8_t)~bitmap_bits[uip_reasslen / 8 & 7]) { goto nullreturn; } @@ -661,7 +661,7 @@ uip_reass(void) #endif /* UIP_REASSEMBLY */ /*---------------------------------------------------------------------------*/ static void -uip_add_rcv_nxt(u16_t n) +uip_add_rcv_nxt(uint16_t n) { uip_add32(uip_conn->rcv_nxt, n); uip_conn->rcv_nxt[0] = uip_acc32[0]; @@ -671,7 +671,7 @@ uip_add_rcv_nxt(u16_t n) } /*---------------------------------------------------------------------------*/ void -uip_process(u8_t flag) +uip_process(uint8_t flag) { register struct uip_conn *uip_connr = uip_conn; @@ -1143,7 +1143,7 @@ uip_process(u8_t flag) /* Calculate the ICMP checksum. */ ICMPBUF->icmpchksum = 0; - ICMPBUF->icmpchksum = ~uip_chksum((u16_t *)&(ICMPBUF->type), 36); + ICMPBUF->icmpchksum = ~uip_chksum((uint16_t *)&(ICMPBUF->type), 36); /* Set the IP destination address to be the source address of the original packet. */ @@ -1156,7 +1156,7 @@ uip_process(u8_t flag) size of the IP header (20) = 56. */ uip_len = 36 + UIP_IPH_LEN; ICMPBUF->len[0] = 0; - ICMPBUF->len[1] = (u8_t)uip_len; + ICMPBUF->len[1] = (uint8_t)uip_len; ICMPBUF->ttl = UIP_TTL; ICMPBUF->proto = UIP_PROTO_ICMP; @@ -1386,8 +1386,8 @@ uip_process(u8_t flag) } else if(opt == TCP_OPT_MSS && uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 1 + c] == TCP_OPT_MSS_LEN) { /* An MSS option with the right option length. */ - tmp16 = ((u16_t)uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 2 + c] << 8) | - (u16_t)uip_buf[UIP_IPTCPH_LEN + UIP_LLH_LEN + 3 + c]; + tmp16 = ((uint16_t)uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 2 + c] << 8) | + (uint16_t)uip_buf[UIP_IPTCPH_LEN + UIP_LLH_LEN + 3 + c]; uip_connr->initialmss = uip_connr->mss = tmp16 > UIP_TCP_MSS? UIP_TCP_MSS: tmp16; @@ -1675,7 +1675,7 @@ uip_process(u8_t flag) and the application will retransmit it. This is called the "persistent timer" and uses the retransmission mechanim. */ - tmp16 = ((u16_t)BUF->wnd[0] << 8) + (u16_t)BUF->wnd[1]; + tmp16 = ((uint16_t)BUF->wnd[0] << 8) + (uint16_t)BUF->wnd[1]; if(tmp16 > uip_connr->initialmss || tmp16 == 0) { tmp16 = uip_connr->initialmss; @@ -1938,14 +1938,14 @@ uip_process(u8_t flag) return; } /*---------------------------------------------------------------------------*/ -u16_t -uip_htons(u16_t val) +uint16_t +uip_htons(uint16_t val) { return UIP_HTONS(val); } -u32_t -uip_htonl(u32_t val) +uint32_t +uip_htonl(uint32_t val) { return UIP_HTONL(val); } diff --git a/core/net/uip.h b/core/net/uip.h index acc4b5a8b..3724d4418 100644 --- a/core/net/uip.h +++ b/core/net/uip.h @@ -62,17 +62,17 @@ */ #if UIP_CONF_IPV6 typedef union uip_ip6addr_t { - u8_t u8[16]; /* Initializer, must come first!!! */ - u16_t u16[8]; + uint8_t u8[16]; /* Initializer, must come first!!! */ + uint16_t u16[8]; } uip_ip6addr_t; typedef uip_ip6addr_t uip_ipaddr_t; #else /* UIP_CONF_IPV6 */ typedef union uip_ip4addr_t { - u8_t u8[4]; /* Initializer, must come first!!! */ - u16_t u16[2]; + uint8_t u8[4]; /* Initializer, must come first!!! */ + uint16_t u16[2]; #if 0 - u32_t u32; + uint32_t u32; #endif } uip_ip4addr_t; typedef uip_ip4addr_t uip_ipaddr_t; @@ -83,21 +83,21 @@ typedef uip_ip4addr_t uip_ipaddr_t; /** \brief 16 bit 802.15.4 address */ typedef struct uip_802154_shortaddr { - u8_t addr[2]; + uint8_t addr[2]; } uip_802154_shortaddr; /** \brief 64 bit 802.15.4 address */ typedef struct uip_802154_longaddr { - u8_t addr[8]; + uint8_t addr[8]; } uip_802154_longaddr; /** \brief 802.11 address */ typedef struct uip_80211_addr { - u8_t addr[6]; + uint8_t addr[6]; } uip_80211_addr; /** \brief 802.3 address */ typedef struct uip_eth_addr { - u8_t addr[6]; + uint8_t addr[6]; } uip_eth_addr; @@ -245,7 +245,7 @@ void uip_init(void); * * This function may be used at boot time to set the initial ip_id. */ -void uip_setipid(u16_t id); +void uip_setipid(uint16_t id); /** @} */ @@ -512,7 +512,7 @@ CCIF extern uip_buf_t uip_aligned_buf; * * \param port A 16-bit port number in network byte order. */ -void uip_listen(u16_t port); +void uip_listen(uint16_t port); /** * Stop listening to the specified port. @@ -526,7 +526,7 @@ void uip_listen(u16_t port); * * \param port A 16-bit port number in network byte order. */ -void uip_unlisten(u16_t port); +void uip_unlisten(uint16_t port); /** * Connect to a remote host using TCP. @@ -560,7 +560,7 @@ void uip_unlisten(u16_t port); * or NULL if no connection could be allocated. * */ -struct uip_conn *uip_connect(uip_ipaddr_t *ripaddr, u16_t port); +struct uip_conn *uip_connect(uip_ipaddr_t *ripaddr, uint16_t port); @@ -828,7 +828,7 @@ CCIF void uip_send(const void *data, int len); * \return The uip_udp_conn structure for the new connection, or NULL * if no connection could be allocated. */ -struct uip_udp_conn *uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport); +struct uip_udp_conn *uip_udp_new(const uip_ipaddr_t *ripaddr, uint16_t rport); /** * Remove a UDP connection. @@ -1043,10 +1043,10 @@ struct uip_udp_conn *uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport); */ #if !UIP_CONF_IPV6 #define uip_ipaddr_maskcmp(addr1, addr2, mask) \ - (((((u16_t *)addr1)[0] & ((u16_t *)mask)[0]) == \ - (((u16_t *)addr2)[0] & ((u16_t *)mask)[0])) && \ - ((((u16_t *)addr1)[1] & ((u16_t *)mask)[1]) == \ - (((u16_t *)addr2)[1] & ((u16_t *)mask)[1]))) + (((((uint16_t *)addr1)[0] & ((uint16_t *)mask)[0]) == \ + (((uint16_t *)addr2)[0] & ((uint16_t *)mask)[0])) && \ + ((((uint16_t *)addr1)[1] & ((uint16_t *)mask)[1]) == \ + (((uint16_t *)addr2)[1] & ((uint16_t *)mask)[1]))) #else #define uip_ipaddr_prefixcmp(addr1, addr2, length) (memcmp(addr1, addr2, length>>3) == 0) #endif @@ -1095,8 +1095,8 @@ struct uip_udp_conn *uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport); * \hideinitializer */ #define uip_ipaddr_mask(dest, src, mask) do { \ - ((u16_t *)dest)[0] = ((u16_t *)src)[0] & ((u16_t *)mask)[0]; \ - ((u16_t *)dest)[1] = ((u16_t *)src)[1] & ((u16_t *)mask)[1]; \ + ((uint16_t *)dest)[0] = ((uint16_t *)src)[0] & ((uint16_t *)mask)[0]; \ + ((uint16_t *)dest)[1] = ((uint16_t *)src)[1] & ((uint16_t *)mask)[1]; \ } while(0) /** @@ -1107,7 +1107,7 @@ struct uip_udp_conn *uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport); * Example: \code uip_ipaddr_t ipaddr; - u8_t octet; + uint8_t octet; uip_ipaddr(&ipaddr, 1,2,3,4); octet = uip_ipaddr1(&ipaddr); @@ -1127,7 +1127,7 @@ struct uip_udp_conn *uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport); * Example: \code uip_ipaddr_t ipaddr; - u8_t octet; + uint8_t octet; uip_ipaddr(&ipaddr, 1,2,3,4); octet = uip_ipaddr2(&ipaddr); @@ -1147,7 +1147,7 @@ struct uip_udp_conn *uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport); * Example: \code uip_ipaddr_t ipaddr; - u8_t octet; + uint8_t octet; uip_ipaddr(&ipaddr, 1,2,3,4); octet = uip_ipaddr3(&ipaddr); @@ -1167,7 +1167,7 @@ struct uip_udp_conn *uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport); * Example: \code uip_ipaddr_t ipaddr; - u8_t octet; + uint8_t octet; uip_ipaddr(&ipaddr, 1,2,3,4); octet = uip_ipaddr4(&ipaddr); @@ -1193,8 +1193,8 @@ struct uip_udp_conn *uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport); # define UIP_HTONS(n) (n) # define UIP_HTONL(n) (n) # else /* UIP_BYTE_ORDER == UIP_BIG_ENDIAN */ -# define UIP_HTONS(n) (u16_t)((((u16_t) (n)) << 8) | (((u16_t) (n)) >> 8)) -# define UIP_HTONL(n) (((u32_t)UIP_HTONS(n) << 16) | UIP_HTONS((u32_t)(n) >> 16)) +# define UIP_HTONS(n) (uint16_t)((((uint16_t) (n)) << 8) | (((uint16_t) (n)) >> 8)) +# define UIP_HTONL(n) (((uint32_t)UIP_HTONS(n) << 16) | UIP_HTONS((uint32_t)(n) >> 16)) # endif /* UIP_BYTE_ORDER == UIP_BIG_ENDIAN */ #else #error "UIP_HTONS already defined!" @@ -1208,14 +1208,14 @@ struct uip_udp_conn *uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport); * network byte order, use the UIP_HTONS() macro instead. */ #ifndef uip_htons -CCIF u16_t uip_htons(u16_t val); +CCIF uint16_t uip_htons(uint16_t val); #endif /* uip_htons */ #ifndef uip_ntohs #define uip_ntohs uip_htons #endif #ifndef uip_htonl -CCIF u32_t uip_htonl(u32_t val); +CCIF uint32_t uip_htonl(uint32_t val); #endif /* uip_htonl */ #ifndef uip_ntohl #define uip_ntohl uip_htonl @@ -1233,7 +1233,7 @@ CCIF u32_t uip_htonl(u32_t val); CCIF extern void *uip_appdata; #if UIP_URGDATA > 0 -/* u8_t *uip_urgdata: +/* uint8_t *uip_urgdata: * * This pointer points to any urgent data that has been received. Only * present if compiled with support for urgent data (UIP_URGDATA). @@ -1265,16 +1265,16 @@ extern void *uip_urgdata; * packet. * */ -CCIF extern u16_t uip_len; +CCIF extern uint16_t uip_len; /** * The length of the extension headers */ -extern u8_t uip_ext_len; +extern uint8_t uip_ext_len; /** @} */ #if UIP_URGDATA > 0 -extern u16_t uip_urglen, uip_surglen; +extern uint16_t uip_urglen, uip_surglen; #endif /* UIP_URGDATA > 0 */ @@ -1291,27 +1291,27 @@ extern u16_t uip_urglen, uip_surglen; struct uip_conn { uip_ipaddr_t ripaddr; /**< The IP address of the remote host. */ - u16_t lport; /**< The local TCP port, in network byte order. */ - u16_t rport; /**< The local remote TCP port, in network byte + uint16_t lport; /**< The local TCP port, in network byte order. */ + uint16_t rport; /**< The local remote TCP port, in network byte order. */ - u8_t rcv_nxt[4]; /**< The sequence number that we expect to + uint8_t rcv_nxt[4]; /**< The sequence number that we expect to receive next. */ - u8_t snd_nxt[4]; /**< The sequence number that was last sent by + uint8_t snd_nxt[4]; /**< The sequence number that was last sent by us. */ - u16_t len; /**< Length of the data that was previously sent. */ - u16_t mss; /**< Current maximum segment size for the + uint16_t len; /**< Length of the data that was previously sent. */ + uint16_t mss; /**< Current maximum segment size for the connection. */ - u16_t initialmss; /**< Initial maximum segment size for the + uint16_t initialmss; /**< Initial maximum segment size for the connection. */ - u8_t sa; /**< Retransmission time-out calculation state + uint8_t sa; /**< Retransmission time-out calculation state variable. */ - u8_t sv; /**< Retransmission time-out calculation state + uint8_t sv; /**< Retransmission time-out calculation state variable. */ - u8_t rto; /**< Retransmission time-out. */ - u8_t tcpstateflags; /**< TCP state and flags. */ - u8_t timer; /**< The retransmission timer. */ - u8_t nrtx; /**< The number of retransmissions for the last + uint8_t rto; /**< Retransmission time-out. */ + uint8_t tcpstateflags; /**< TCP state and flags. */ + uint8_t timer; /**< The retransmission timer. */ + uint8_t nrtx; /**< The number of retransmissions for the last segment sent. */ /** The application state. */ @@ -1340,7 +1340,7 @@ CCIF extern struct uip_conn uip_conns[UIP_CONNS]; /** * 4-byte array used for the 32-bit sequence number calculations. */ -extern u8_t uip_acc32[4]; +extern uint8_t uip_acc32[4]; /** @} */ /** @@ -1348,9 +1348,9 @@ extern u8_t uip_acc32[4]; */ struct uip_udp_conn { uip_ipaddr_t ripaddr; /**< The IP address of the remote peer. */ - u16_t lport; /**< The local port number in network byte order. */ - u16_t rport; /**< The remote port number in network byte order. */ - u8_t ttl; /**< Default time-to-live. */ + uint16_t lport; /**< The local port number in network byte order. */ + uint16_t rport; /**< The remote port number in network byte order. */ + uint8_t ttl; /**< Default time-to-live. */ /** The application state. */ uip_udp_appstate_t appstate; @@ -1467,13 +1467,13 @@ struct uip_stats { -/* u8_t uip_flags: +/* uint8_t uip_flags: * * When the application is called, uip_flags will contain the flags * that are defined in this file. Please read below for more * information. */ -CCIF extern u8_t uip_flags; +CCIF extern uint8_t uip_flags; /* The following flags may be set in the global variable uip_flags before calling the application callback. The UIP_ACKDATA, @@ -1518,14 +1518,14 @@ CCIF extern u8_t uip_flags; * \retval 1: drop pkt * \retval 2: ICMP error message to send */ -/*static u8_t +/*static uint8_t uip_ext_hdr_options_process(); */ /* uip_process(flag): * * The actual uIP function which does all the work. */ -void uip_process(u8_t flag); +void uip_process(uint8_t flag); /* The following flags are passed as an argument to the uip_process() function. They are used to distinguish between the two cases where @@ -1567,67 +1567,67 @@ void uip_process(u8_t flag); struct uip_tcpip_hdr { #if UIP_CONF_IPV6 /* IPv6 header. */ - u8_t vtc, + uint8_t vtc, tcflow; - u16_t flow; - u8_t len[2]; - u8_t proto, ttl; + uint16_t flow; + uint8_t len[2]; + uint8_t proto, ttl; uip_ip6addr_t srcipaddr, destipaddr; #else /* UIP_CONF_IPV6 */ /* IPv4 header. */ - u8_t vhl, + uint8_t vhl, tos, len[2], ipid[2], ipoffset[2], ttl, proto; - u16_t ipchksum; + uint16_t ipchksum; uip_ipaddr_t srcipaddr, destipaddr; #endif /* UIP_CONF_IPV6 */ /* TCP header. */ - u16_t srcport, + uint16_t srcport, destport; - u8_t seqno[4], + uint8_t seqno[4], ackno[4], tcpoffset, flags, wnd[2]; - u16_t tcpchksum; - u8_t urgp[2]; - u8_t optdata[4]; + uint16_t tcpchksum; + uint8_t urgp[2]; + uint8_t optdata[4]; }; /* The ICMP and IP headers. */ struct uip_icmpip_hdr { #if UIP_CONF_IPV6 /* IPv6 header. */ - u8_t vtc, + uint8_t vtc, tcf; - u16_t flow; - u8_t len[2]; - u8_t proto, ttl; + uint16_t flow; + uint8_t len[2]; + uint8_t proto, ttl; uip_ip6addr_t srcipaddr, destipaddr; #else /* UIP_CONF_IPV6 */ /* IPv4 header. */ - u8_t vhl, + uint8_t vhl, tos, len[2], ipid[2], ipoffset[2], ttl, proto; - u16_t ipchksum; + uint16_t ipchksum; uip_ipaddr_t srcipaddr, destipaddr; #endif /* UIP_CONF_IPV6 */ /* ICMP header. */ - u8_t type, icode; - u16_t icmpchksum; + uint8_t type, icode; + uint16_t icmpchksum; #if !UIP_CONF_IPV6 - u16_t id, seqno; - u8_t payload[1]; + uint16_t id, seqno; + uint8_t payload[1]; #endif /* !UIP_CONF_IPV6 */ }; @@ -1636,30 +1636,30 @@ struct uip_icmpip_hdr { struct uip_udpip_hdr { #if UIP_CONF_IPV6 /* IPv6 header. */ - u8_t vtc, + uint8_t vtc, tcf; - u16_t flow; - u8_t len[2]; - u8_t proto, ttl; + uint16_t flow; + uint8_t len[2]; + uint8_t proto, ttl; uip_ip6addr_t srcipaddr, destipaddr; #else /* UIP_CONF_IPV6 */ /* IP header. */ - u8_t vhl, + uint8_t vhl, tos, len[2], ipid[2], ipoffset[2], ttl, proto; - u16_t ipchksum; + uint16_t ipchksum; uip_ipaddr_t srcipaddr, destipaddr; #endif /* UIP_CONF_IPV6 */ /* UDP header. */ - u16_t srcport, + uint16_t srcport, destport; - u16_t udplen; - u16_t udpchksum; + uint16_t udplen; + uint16_t udpchksum; }; /* @@ -1671,22 +1671,22 @@ struct uip_udpip_hdr { struct uip_ip_hdr { #if UIP_CONF_IPV6 /* IPV6 header */ - u8_t vtc; - u8_t tcflow; - u16_t flow; - u8_t len[2]; - u8_t proto, ttl; + uint8_t vtc; + uint8_t tcflow; + uint16_t flow; + uint8_t len[2]; + uint8_t proto, ttl; uip_ip6addr_t srcipaddr, destipaddr; #else /* UIP_CONF_IPV6 */ /* IPV4 header */ - u8_t vhl, + uint8_t vhl, tos, len[2], ipid[2], ipoffset[2], ttl, proto; - u16_t ipchksum; + uint16_t ipchksum; uip_ipaddr_t srcipaddr, destipaddr; #endif /* UIP_CONF_IPV6 */ }; @@ -1714,20 +1714,20 @@ struct uip_ip_hdr { */ /* common header part */ typedef struct uip_ext_hdr { - u8_t next; - u8_t len; + uint8_t next; + uint8_t len; } uip_ext_hdr; /* Hop by Hop option header */ typedef struct uip_hbho_hdr { - u8_t next; - u8_t len; + uint8_t next; + uint8_t len; } uip_hbho_hdr; /* destination option header */ typedef struct uip_desto_hdr { - u8_t next; - u8_t len; + uint8_t next; + uint8_t len; } uip_desto_hdr; /* We do not define structures for PAD1 and PADN options */ @@ -1741,18 +1741,18 @@ typedef struct uip_desto_hdr { * parse the 4 first bytes */ typedef struct uip_routing_hdr { - u8_t next; - u8_t len; - u8_t routing_type; - u8_t seg_left; + uint8_t next; + uint8_t len; + uint8_t routing_type; + uint8_t seg_left; } uip_routing_hdr; /* fragmentation header */ typedef struct uip_frag_hdr { - u8_t next; - u8_t res; - u16_t offsetresmore; - u32_t id; + uint8_t next; + uint8_t res; + uint16_t offsetresmore; + uint32_t id; } uip_frag_hdr; /* @@ -1760,57 +1760,57 @@ typedef struct uip_frag_hdr { * it contains type an length, which is true for all options but PAD1 */ typedef struct uip_ext_hdr_opt { - u8_t type; - u8_t len; + uint8_t type; + uint8_t len; } uip_ext_hdr_opt; /* PADN option */ typedef struct uip_ext_hdr_opt_padn { - u8_t opt_type; - u8_t opt_len; + uint8_t opt_type; + uint8_t opt_len; } uip_ext_hdr_opt_padn; #if UIP_CONF_IPV6_RPL /* RPL option */ typedef struct uip_ext_hdr_opt_rpl { - u8_t opt_type; - u8_t opt_len; - u8_t flags; - u8_t instance; - u16_t senderrank; + uint8_t opt_type; + uint8_t opt_len; + uint8_t flags; + uint8_t instance; + uint16_t senderrank; } uip_ext_hdr_opt_rpl; #endif /* UIP_CONF_IPV6_RPL */ /* TCP header */ struct uip_tcp_hdr { - u16_t srcport; - u16_t destport; - u8_t seqno[4]; - u8_t ackno[4]; - u8_t tcpoffset; - u8_t flags; - u8_t wnd[2]; - u16_t tcpchksum; - u8_t urgp[2]; - u8_t optdata[4]; + uint16_t srcport; + uint16_t destport; + uint8_t seqno[4]; + uint8_t ackno[4]; + uint8_t tcpoffset; + uint8_t flags; + uint8_t wnd[2]; + uint16_t tcpchksum; + uint8_t urgp[2]; + uint8_t optdata[4]; }; /* The ICMP headers. */ struct uip_icmp_hdr { - u8_t type, icode; - u16_t icmpchksum; + uint8_t type, icode; + uint16_t icmpchksum; #if !UIP_CONF_IPV6 - u16_t id, seqno; + uint16_t id, seqno; #endif /* !UIP_CONF_IPV6 */ }; /* The UDP headers. */ struct uip_udp_hdr { - u16_t srcport; - u16_t destport; - u16_t udplen; - u16_t udpchksum; + uint16_t srcport; + uint16_t destport; + uint16_t udplen; + uint16_t udpchksum; }; @@ -1863,7 +1863,7 @@ struct uip_udp_hdr { * * When processing extension headers, we should record somehow which one we * see, because you cannot have twice the same header, except for destination - * We store all this in one u8_t bitmap one bit for each header expected. The + * We store all this in one uint8_t bitmap one bit for each header expected. The * order in the bitmap is the order recommended in RFC2460 */ #define UIP_EXT_HDR_BITMAP_HBHO 0x01 @@ -2148,7 +2148,7 @@ CCIF extern uip_lladdr_t uip_lladdr; * * \return The Internet checksum of the buffer. */ -u16_t uip_chksum(u16_t *buf, u16_t len); +uint16_t uip_chksum(uint16_t *buf, uint16_t len); /** * Calculate the IP header checksum of the packet header in uip_buf. @@ -2159,7 +2159,7 @@ u16_t uip_chksum(u16_t *buf, u16_t len); * \return The IP header checksum of the IP header in the uip_buf * buffer. */ -u16_t uip_ipchksum(void); +uint16_t uip_ipchksum(void); /** * Calculate the TCP checksum of the packet in uip_buf and uip_appdata. @@ -2170,7 +2170,7 @@ u16_t uip_ipchksum(void); * \return The TCP checksum of the TCP segment in uip_buf and pointed * to by uip_appdata. */ -u16_t uip_tcpchksum(void); +uint16_t uip_tcpchksum(void); /** * Calculate the UDP checksum of the packet in uip_buf and uip_appdata. @@ -2181,14 +2181,14 @@ u16_t uip_tcpchksum(void); * \return The UDP checksum of the UDP segment in uip_buf and pointed * to by uip_appdata. */ -u16_t uip_udpchksum(void); +uint16_t uip_udpchksum(void); /** * Calculate the ICMP checksum of the packet in uip_buf. * * \return The ICMP checksum of the ICMP packet in uip_buf */ -u16_t uip_icmp6chksum(void); +uint16_t uip_icmp6chksum(void); #endif /* __UIP_H__ */ diff --git a/core/net/uip6.c b/core/net/uip6.c index cb3c4c6bd..027532c61 100644 --- a/core/net/uip6.c +++ b/core/net/uip6.c @@ -125,16 +125,16 @@ uip_lladdr_t uip_lladdr = {{0x00,0x06,0x98,0x00,0x02,0x32}}; * field in the header before the fragmentation header, hence we need a pointer * to this field. */ -u8_t *uip_next_hdr; +uint8_t *uip_next_hdr; /** \brief bitmap we use to record which IPv6 headers we have already seen */ -u8_t uip_ext_bitmap = 0; +uint8_t uip_ext_bitmap = 0; /** * \brief length of the extension headers read. updated each time we process * a header */ -u8_t uip_ext_len = 0; +uint8_t uip_ext_len = 0; /** \brief length of the header options read */ -u8_t uip_ext_opt_offset = 0; +uint8_t uip_ext_opt_offset = 0; /** @} */ /*---------------------------------------------------------------------------*/ @@ -176,11 +176,11 @@ void *uip_sappdata; #if UIP_URGDATA > 0 /* The uip_urgdata pointer points to urgent data (out-of-band data), if present */ void *uip_urgdata; -u16_t uip_urglen, uip_surglen; +uint16_t uip_urglen, uip_surglen; #endif /* UIP_URGDATA > 0 */ /* The uip_len is either 8 or 16 bits, depending on the maximum packet size.*/ -u16_t uip_len, uip_slen; +uint16_t uip_len, uip_slen; /** @} */ /*---------------------------------------------------------------------------*/ @@ -189,19 +189,19 @@ u16_t uip_len, uip_slen; /* The uip_flags variable is used for communication between the TCP/IP stack and the application program. */ -u8_t uip_flags; +uint8_t uip_flags; /* uip_conn always points to the current connection (set to NULL for UDP). */ struct uip_conn *uip_conn; /* Temporary variables. */ #if (UIP_TCP || UIP_UDP) -static u8_t c; +static uint8_t c; #endif #if UIP_ACTIVE_OPEN || UIP_UDP /* Keeps track of the last port used for a new connection. */ -static u16_t lastport; +static uint16_t lastport; #endif /* UIP_ACTIVE_OPEN || UIP_UDP */ /** @} */ @@ -234,15 +234,15 @@ static u16_t lastport; struct uip_conn uip_conns[UIP_CONNS]; /* The uip_listenports list all currently listning ports. */ -u16_t uip_listenports[UIP_LISTENPORTS]; +uint16_t uip_listenports[UIP_LISTENPORTS]; /* The iss variable is used for the TCP initial sequence number. */ -static u8_t iss[4]; +static uint8_t iss[4]; /* Temporary variables. */ -u8_t uip_acc32[4]; -static u8_t opt; -static u16_t tmp16; +uint8_t uip_acc32[4]; +static uint8_t opt; +static uint16_t tmp16; #endif /* UIP_TCP */ /** @} */ @@ -268,7 +268,7 @@ struct uip_icmp6_conn uip_icmp6_conns; /*---------------------------------------------------------------------------*/ #if (!UIP_ARCH_ADD32 && UIP_TCP) void -uip_add32(u8_t *op32, u16_t op16) +uip_add32(uint8_t *op32, uint16_t op16) { uip_acc32[3] = op32[3] + (op16 & 0xff); uip_acc32[2] = op32[2] + (op16 >> 8); @@ -298,12 +298,12 @@ uip_add32(u8_t *op32, u16_t op16) #if ! UIP_ARCH_CHKSUM /*---------------------------------------------------------------------------*/ -static u16_t -chksum(u16_t sum, const u8_t *data, u16_t len) +static uint16_t +chksum(uint16_t sum, const uint8_t *data, uint16_t len) { - u16_t t; - const u8_t *dataptr; - const u8_t *last_byte; + uint16_t t; + const uint8_t *dataptr; + const uint8_t *last_byte; dataptr = data; last_byte = data + len - 1; @@ -329,17 +329,17 @@ chksum(u16_t sum, const u8_t *data, u16_t len) return sum; } /*---------------------------------------------------------------------------*/ -u16_t -uip_chksum(u16_t *data, u16_t len) +uint16_t +uip_chksum(uint16_t *data, uint16_t len) { - return uip_htons(chksum(0, (u8_t *)data, len)); + return uip_htons(chksum(0, (uint8_t *)data, len)); } /*---------------------------------------------------------------------------*/ #ifndef UIP_ARCH_IPCHKSUM -u16_t +uint16_t uip_ipchksum(void) { - u16_t sum; + uint16_t sum; sum = chksum(0, &uip_buf[UIP_LLH_LEN], UIP_IPH_LEN); PRINTF("uip_ipchksum: sum 0x%04x\n", sum); @@ -347,8 +347,8 @@ uip_ipchksum(void) } #endif /*---------------------------------------------------------------------------*/ -static u16_t -upper_layer_chksum(u8_t proto) +static uint16_t +upper_layer_chksum(uint8_t proto) { /* gcc 4.4.0 - 4.6.1 (maybe 4.3...) with -Os on 8 bit CPUS incorrectly compiles: * int bar (int); @@ -359,10 +359,10 @@ upper_layer_chksum(u8_t proto) * upper_layer_len triggers this bug unless it is declared volatile. * See https://sourceforge.net/apps/mantisbt/contiki/view.php?id=3 */ - volatile u16_t upper_layer_len; - u16_t sum; + volatile uint16_t upper_layer_len; + uint16_t sum; - upper_layer_len = (((u16_t)(UIP_IP_BUF->len[0]) << 8) + UIP_IP_BUF->len[1] - uip_ext_len); + upper_layer_len = (((uint16_t)(UIP_IP_BUF->len[0]) << 8) + UIP_IP_BUF->len[1] - uip_ext_len); PRINTF("Upper layer checksum len: %d from: %d\n", upper_layer_len, UIP_IPH_LEN + UIP_LLH_LEN + uip_ext_len); @@ -371,7 +371,7 @@ upper_layer_chksum(u8_t proto) /* IP protocol and length fields. This addition cannot carry. */ sum = upper_layer_len + proto; /* Sum IP source and destination addresses. */ - sum = chksum(sum, (u8_t *)&UIP_IP_BUF->srcipaddr, 2 * sizeof(uip_ipaddr_t)); + sum = chksum(sum, (uint8_t *)&UIP_IP_BUF->srcipaddr, 2 * sizeof(uip_ipaddr_t)); /* Sum TCP header and data. */ sum = chksum(sum, &uip_buf[UIP_IPH_LEN + UIP_LLH_LEN + uip_ext_len], @@ -380,7 +380,7 @@ upper_layer_chksum(u8_t proto) return (sum == 0) ? 0xffff : uip_htons(sum); } /*---------------------------------------------------------------------------*/ -u16_t +uint16_t uip_icmp6chksum(void) { return upper_layer_chksum(UIP_PROTO_ICMP6); @@ -388,7 +388,7 @@ uip_icmp6chksum(void) } /*---------------------------------------------------------------------------*/ #if UIP_TCP -u16_t +uint16_t uip_tcpchksum(void) { return upper_layer_chksum(UIP_PROTO_TCP); @@ -396,7 +396,7 @@ uip_tcpchksum(void) #endif /* UIP_TCP */ /*---------------------------------------------------------------------------*/ #if UIP_UDP && UIP_UDP_CHECKSUMS -u16_t +uint16_t uip_udpchksum(void) { return upper_layer_chksum(UIP_PROTO_UDP); @@ -432,7 +432,7 @@ uip_init(void) /*---------------------------------------------------------------------------*/ #if UIP_TCP && UIP_ACTIVE_OPEN struct uip_conn * -uip_connect(uip_ipaddr_t *ripaddr, u16_t rport) +uip_connect(uip_ipaddr_t *ripaddr, uint16_t rport) { register struct uip_conn *conn, *cconn; @@ -528,7 +528,7 @@ remove_ext_hdr(void) /*---------------------------------------------------------------------------*/ #if UIP_UDP struct uip_udp_conn * -uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport) +uip_udp_new(const uip_ipaddr_t *ripaddr, uint16_t rport) { register struct uip_udp_conn *conn; @@ -573,7 +573,7 @@ uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport) /*---------------------------------------------------------------------------*/ #if UIP_TCP void -uip_unlisten(u16_t port) +uip_unlisten(uint16_t port) { for(c = 0; c < UIP_LISTENPORTS; ++c) { if(uip_listenports[c] == port) { @@ -584,7 +584,7 @@ uip_unlisten(u16_t port) } /*---------------------------------------------------------------------------*/ void -uip_listen(u16_t port) +uip_listen(uint16_t port) { for(c = 0; c < UIP_LISTENPORTS; ++c) { if(uip_listenports[c] == 0) { @@ -599,15 +599,15 @@ uip_listen(u16_t port) #if UIP_CONF_IPV6_REASSEMBLY #define UIP_REASS_BUFSIZE (UIP_BUFSIZE - UIP_LLH_LEN) -static u8_t uip_reassbuf[UIP_REASS_BUFSIZE]; +static uint8_t uip_reassbuf[UIP_REASS_BUFSIZE]; -static u8_t uip_reassbitmap[UIP_REASS_BUFSIZE / (8 * 8)]; +static uint8_t uip_reassbitmap[UIP_REASS_BUFSIZE / (8 * 8)]; /*the first byte of an IP fragment is aligned on an 8-byte boundary */ -static const u8_t bitmap_bits[8] = {0xff, 0x7f, 0x3f, 0x1f, +static const uint8_t bitmap_bits[8] = {0xff, 0x7f, 0x3f, 0x1f, 0x0f, 0x07, 0x03, 0x01}; -static u16_t uip_reasslen; -static u8_t uip_reassflags; +static uint16_t uip_reasslen; +static uint8_t uip_reassflags; #define UIP_REASS_FLAG_LASTFRAG 0x01 #define UIP_REASS_FLAG_FIRSTFRAG 0x02 @@ -625,19 +625,19 @@ static u8_t uip_reassflags; struct etimer uip_reass_timer; /* timer for reassembly */ -u8_t uip_reass_on; /* equal to 1 if we are currently reassembling a packet */ +uint8_t uip_reass_on; /* equal to 1 if we are currently reassembling a packet */ -static u32_t uip_id; /* For every packet that is to be fragmented, the source +static uint32_t uip_id; /* For every packet that is to be fragmented, the source node generates an Identification value that is present in all the fragments */ #define IP_MF 0x0001 -static u16_t +static uint16_t uip_reass(void) { - u16_t offset=0; - u16_t len; - u16_t i; + uint16_t offset=0; + uint16_t len; + uint16_t i; /* If ip_reasstmr is zero, no packet is present in the buffer */ /* We first write the unfragmentable part of IP header into the reassembly @@ -753,7 +753,7 @@ uip_reass(void) /* Check the last byte in the bitmap. It should contain just the right amount of bits. */ if(uip_reassbitmap[uip_reasslen >> 6] != - (u8_t)~bitmap_bits[(uip_reasslen >> 3) & 7]) { + (uint8_t)~bitmap_bits[(uip_reasslen >> 3) & 7]) { return 0; } @@ -813,7 +813,7 @@ uip_reass_over(void) /*---------------------------------------------------------------------------*/ #if UIP_TCP static void -uip_add_rcv_nxt(u16_t n) +uip_add_rcv_nxt(uint16_t n) { uip_add32(uip_conn->rcv_nxt, n); uip_conn->rcv_nxt[0] = uip_acc32[0]; @@ -827,7 +827,7 @@ uip_add_rcv_nxt(u16_t n) /** * \brief Process the options in Destination and Hop By Hop extension headers */ -static u8_t +static uint8_t ext_hdr_options_process(void) { /* @@ -887,7 +887,7 @@ ext_hdr_options_process(void) } case 0x80: uip_icmp6_error_output(ICMP6_PARAM_PROB, ICMP6_PARAMPROB_OPTION, - (u32_t)UIP_IPH_LEN + uip_ext_len + uip_ext_opt_offset); + (uint32_t)UIP_IPH_LEN + uip_ext_len + uip_ext_opt_offset); return 2; } /* in the cases were we did not discard, update ext_opt* */ @@ -901,7 +901,7 @@ ext_hdr_options_process(void) /*---------------------------------------------------------------------------*/ void -uip_process(u8_t flag) +uip_process(uint8_t flag) { #if UIP_TCP register struct uip_conn *uip_connr = uip_conn; @@ -1342,7 +1342,7 @@ uip_process(u8_t flag) * RFC 2460 send error message parameterr problem, code unrecognized * next header, pointing to the next header field */ - uip_icmp6_error_output(ICMP6_PARAM_PROB, ICMP6_PARAMPROB_NEXTHEADER, (u32_t)(uip_next_hdr - (uint8_t *)UIP_IP_BUF)); + uip_icmp6_error_output(ICMP6_PARAM_PROB, ICMP6_PARAMPROB_NEXTHEADER, (uint32_t)(uip_next_hdr - (uint8_t *)UIP_IP_BUF)); UIP_STAT(++uip_stat.ip.drop); UIP_STAT(++uip_stat.ip.protoerr); UIP_LOG("ip6: unrecognized header"); @@ -1721,8 +1721,8 @@ uip_process(u8_t flag) } else if(opt == TCP_OPT_MSS && uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 1 + c] == TCP_OPT_MSS_LEN) { /* An MSS option with the right option length. */ - tmp16 = ((u16_t)uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 2 + c] << 8) | - (u16_t)uip_buf[UIP_IPTCPH_LEN + UIP_LLH_LEN + 3 + c]; + tmp16 = ((uint16_t)uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 2 + c] << 8) | + (uint16_t)uip_buf[UIP_IPTCPH_LEN + UIP_LLH_LEN + 3 + c]; uip_connr->initialmss = uip_connr->mss = tmp16 > UIP_TCP_MSS? UIP_TCP_MSS: tmp16; @@ -2015,7 +2015,7 @@ uip_process(u8_t flag) and the application will retransmit it. This is called the "persistent timer" and uses the retransmission mechanim. */ - tmp16 = ((u16_t)UIP_TCP_BUF->wnd[0] << 8) + (u16_t)UIP_TCP_BUF->wnd[1]; + tmp16 = ((uint16_t)UIP_TCP_BUF->wnd[0] << 8) + (uint16_t)UIP_TCP_BUF->wnd[1]; if(tmp16 > uip_connr->initialmss || tmp16 == 0) { tmp16 = uip_connr->initialmss; @@ -2269,14 +2269,14 @@ uip_process(u8_t flag) return; } /*---------------------------------------------------------------------------*/ -u16_t -uip_htons(u16_t val) +uint16_t +uip_htons(uint16_t val) { return UIP_HTONS(val); } -u32_t -uip_htonl(u32_t val) +uint32_t +uip_htonl(uint32_t val) { return UIP_HTONL(val); } diff --git a/core/net/uip_arch.h b/core/net/uip_arch.h index 9ee37578c..7a5b369c2 100644 --- a/core/net/uip_arch.h +++ b/core/net/uip_arch.h @@ -81,7 +81,7 @@ * * \param op16 A 16-bit integer in host byte order. */ -void uip_add32(u8_t *op32, u16_t op16); +void uip_add32(uint8_t *op32, uint16_t op16); /** * Calculate the Internet checksum over a buffer. @@ -102,7 +102,7 @@ void uip_add32(u8_t *op32, u16_t op16); * * \return The Internet checksum of the buffer. */ -u16_t uip_chksum(u16_t *buf, u16_t len); +uint16_t uip_chksum(uint16_t *buf, uint16_t len); /** * Calculate the IP header checksum of the packet header in uip_buf. @@ -113,7 +113,7 @@ u16_t uip_chksum(u16_t *buf, u16_t len); * \return The IP header checksum of the IP header in the uip_buf * buffer. */ -u16_t uip_ipchksum(void); +uint16_t uip_ipchksum(void); /** * Calculate the TCP checksum of the packet in uip_buf and uip_appdata. @@ -128,9 +128,9 @@ u16_t uip_ipchksum(void); * \return The TCP checksum of the TCP segment in uip_buf and pointed * to by uip_appdata. */ -u16_t uip_tcpchksum(void); +uint16_t uip_tcpchksum(void); -u16_t uip_udpchksum(void); +uint16_t uip_udpchksum(void); /** @} */ /** @} */ diff --git a/core/net/uip_arp.c b/core/net/uip_arp.c index d3f656df4..0d6c4b454 100644 --- a/core/net/uip_arp.c +++ b/core/net/uip_arp.c @@ -65,11 +65,11 @@ struct arp_hdr { struct uip_eth_hdr ethhdr; - u16_t hwtype; - u16_t protocol; - u8_t hwlen; - u8_t protolen; - u16_t opcode; + uint16_t hwtype; + uint16_t protocol; + uint8_t hwlen; + uint8_t protolen; + uint16_t opcode; struct uip_eth_addr shwaddr; uip_ipaddr_t sipaddr; struct uip_eth_addr dhwaddr; @@ -79,14 +79,14 @@ struct arp_hdr { struct ethip_hdr { struct uip_eth_hdr ethhdr; /* IP header. */ - u8_t vhl, + uint8_t vhl, tos, len[2], ipid[2], ipoffset[2], ttl, proto; - u16_t ipchksum; + uint16_t ipchksum; uip_ipaddr_t srcipaddr, destipaddr; }; @@ -98,19 +98,19 @@ struct ethip_hdr { struct arp_entry { uip_ipaddr_t ipaddr; struct uip_eth_addr ethaddr; - u8_t time; + uint8_t time; }; static const struct uip_eth_addr broadcast_ethaddr = {{0xff,0xff,0xff,0xff,0xff,0xff}}; -static const u16_t broadcast_ipaddr[2] = {0xffff,0xffff}; +static const uint16_t broadcast_ipaddr[2] = {0xffff,0xffff}; static struct arp_entry arp_table[UIP_ARPTAB_SIZE]; static uip_ipaddr_t ipaddr; -static u8_t i, c; +static uint8_t i, c; -static u8_t arptime; -static u8_t tmpage; +static uint8_t arptime; +static uint8_t tmpage; #define BUF ((struct arp_hdr *)&uip_buf[0]) #define IPBUF ((struct ethip_hdr *)&uip_buf[0]) diff --git a/core/net/uip_arp.h b/core/net/uip_arp.h index 5bb074ad7..e499db834 100644 --- a/core/net/uip_arp.h +++ b/core/net/uip_arp.h @@ -63,7 +63,7 @@ CCIF extern struct uip_eth_addr uip_ethaddr; struct uip_eth_hdr { struct uip_eth_addr dest; struct uip_eth_addr src; - u16_t type; + uint16_t type; }; #define UIP_ETHTYPE_ARP 0x0806 diff --git a/core/net/uipopt.h b/core/net/uipopt.h index d36c1df59..cbad2c3b5 100644 --- a/core/net/uipopt.h +++ b/core/net/uipopt.h @@ -644,8 +644,8 @@ void uip_log(char *msg); #define UIP_APPCALL httpd_appcall struct httpd_state { - u8_t state; - u16_t count; + uint8_t state; + uint16_t count; char *dataptr; char *script; }; diff --git a/core/sys/pt.h b/core/sys/pt.h index 3f1467c62..9433a1086 100644 --- a/core/sys/pt.h +++ b/core/sys/pt.h @@ -30,7 +30,6 @@ * * Author: Adam Dunkels * - * $Id: pt.h,v 1.3 2008/10/14 12:46:39 nvt-se Exp $ */ /** @@ -112,7 +111,7 @@ struct pt { * * \hideinitializer */ -#define PT_BEGIN(pt) { char PT_YIELD_FLAG = 1; LC_RESUME((pt)->lc) +#define PT_BEGIN(pt) { char PT_YIELD_FLAG = 1; if (PT_YIELD_FLAG) {;} LC_RESUME((pt)->lc) /** * Declare the end of a protothread. diff --git a/cpu/6502/ctk/ctk-mouse.c b/cpu/6502/ctk/ctk-mouse.c index b8183293d..cc2330631 100644 --- a/cpu/6502/ctk/ctk-mouse.c +++ b/cpu/6502/ctk/ctk-mouse.c @@ -44,7 +44,7 @@ #if CTK_CONF_MOUSE_SUPPORT static struct mouse_pos pos; -static u8_t okay; +static uint8_t okay; /*-----------------------------------------------------------------------------------*/ void diff --git a/cpu/6502/dhcp/dhcp-client.c b/cpu/6502/dhcp/dhcp-client.c index d9fc4c779..d74da6a50 100644 --- a/cpu/6502/dhcp/dhcp-client.c +++ b/cpu/6502/dhcp/dhcp-client.c @@ -77,7 +77,7 @@ AUTOSTART_PROCESSES(&dhcp_process); /*-----------------------------------------------------------------------------------*/ static char * -makebyte(u8_t byte, char *str) +makebyte(uint8_t byte, char *str) { if(byte >= 100) { *str++ = (byte / 100 ) % 10 + '0'; diff --git a/cpu/6502/lib/config.c b/cpu/6502/lib/config.c index cc65c41c3..3c025a2fd 100644 --- a/cpu/6502/lib/config.c +++ b/cpu/6502/lib/config.c @@ -48,7 +48,7 @@ static char * CC_FASTCALL ipaddrtoa(uip_ipaddr_t *ipaddr, char *buffer) { char *ptr = buffer; - u8_t i; + uint8_t i; for(i = 0; i < 4; ++i) { *ptr = '.'; diff --git a/cpu/6502/net/ethernet-drv.c b/cpu/6502/net/ethernet-drv.c index 4a5231d42..1433040c3 100644 --- a/cpu/6502/net/ethernet-drv.c +++ b/cpu/6502/net/ethernet-drv.c @@ -44,7 +44,7 @@ PROCESS(ethernet_process, "Ethernet driver"); /*---------------------------------------------------------------------------*/ -u8_t +uint8_t ethernet_output(void) { uip_arp_out(); diff --git a/cpu/6502/net/ethernet-drv.h b/cpu/6502/net/ethernet-drv.h index 325e753f9..080d762c5 100644 --- a/cpu/6502/net/ethernet-drv.h +++ b/cpu/6502/net/ethernet-drv.h @@ -37,12 +37,12 @@ #include "contiki.h" struct ethernet_config { - u16_t addr; + uint16_t addr; char name[12+1]; }; PROCESS_NAME(ethernet_process); -u8_t ethernet_output(void); +uint8_t ethernet_output(void); #endif /* __ETHERNET_DRV_H__ */ diff --git a/cpu/6502/net/ethernet.c b/cpu/6502/net/ethernet.c index 1681436e0..cfa80aa7d 100644 --- a/cpu/6502/net/ethernet.c +++ b/cpu/6502/net/ethernet.c @@ -46,11 +46,11 @@ struct { char signature[4]; struct uip_eth_addr ethernet_address; - u8_t *buffer; - u16_t buffer_size; - void __fastcall__ (* init)(u16_t reg); - u16_t (* poll)(void); - void __fastcall__ (* send)(u16_t len); + uint8_t *buffer; + uint16_t buffer_size; + void __fastcall__ (* init)(uint16_t reg); + uint16_t (* poll)(void); + void __fastcall__ (* send)(uint16_t len); void (* exit)(void); } *module; @@ -63,7 +63,7 @@ ethernet_init(struct ethernet_config *config) #ifndef ETHERNET struct mod_ctrl module_control = {cfs_read}; - u8_t byte; + uint8_t byte; module_control.callerdata = cfs_open(config->name, CFS_READ); if(module_control.callerdata < 0) { @@ -103,7 +103,7 @@ ethernet_init(struct ethernet_config *config) uip_setethaddr(module->ethernet_address); } /*---------------------------------------------------------------------------*/ -u16_t +uint16_t ethernet_poll(void) { return module->poll(); diff --git a/cpu/6502/net/ethernet.h b/cpu/6502/net/ethernet.h index ed050b379..05b7578a2 100644 --- a/cpu/6502/net/ethernet.h +++ b/cpu/6502/net/ethernet.h @@ -37,7 +37,7 @@ #define __ETHERNET_H__ void CC_FASTCALL ethernet_init(struct ethernet_config *config); -u16_t ethernet_poll(void); +uint16_t ethernet_poll(void); void ethernet_send(void); void ethernet_exit(void); diff --git a/cpu/6502/net/uip_arch.c b/cpu/6502/net/uip_arch.c index 88a5bbe7f..1666c5144 100644 --- a/cpu/6502/net/uip_arch.c +++ b/cpu/6502/net/uip_arch.c @@ -43,7 +43,7 @@ /*-----------------------------------------------------------------------------------*/ #pragma optimize(push, off) void -uip_add32(u8_t *op32, u16_t op16) +uip_add32(uint8_t *op32, uint16_t op16) { asm("ldy #3"); asm("jsr ldaxysp"); @@ -71,12 +71,12 @@ uip_add32(u8_t *op32, u16_t op16) } #pragma optimize(pop) /*-----------------------------------------------------------------------------------*/ -static u16_t chksum_ptr, chksum_len, chksum_tmp; -static u8_t chksum_protocol; -static u16_t chksum(void); +static uint16_t chksum_ptr, chksum_len, chksum_tmp; +static uint8_t chksum_protocol; +static uint16_t chksum(void); /*-----------------------------------------------------------------------------------*/ #pragma optimize(push, off) -u16_t +uint16_t chksum(void) { asm("lda #0"); @@ -172,14 +172,14 @@ chksum(void) { } #pragma optimize(pop) /*-----------------------------------------------------------------------------------*/ -u16_t -uip_chksum(u16_t *buf, u16_t len) +uint16_t +uip_chksum(uint16_t *buf, uint16_t len) { /* unsigned long sum; sum = 0; - chksum_ptr = (u16_t)buf; + chksum_ptr = (uint16_t)buf; while(len >= 256) { chksum_len = 256; sum += chksum(); @@ -199,28 +199,28 @@ uip_chksum(u16_t *buf, u16_t len) return sum;*/ chksum_len = len; - chksum_ptr = (u16_t)buf; + chksum_ptr = (uint16_t)buf; return chksum(); } /*-----------------------------------------------------------------------------------*/ -u16_t +uint16_t uip_ipchksum(void) { - chksum_ptr = (u16_t)uip_buf + UIP_LLH_LEN; + chksum_ptr = (uint16_t)uip_buf + UIP_LLH_LEN; chksum_len = UIP_IPH_LEN; return chksum(); } /*-----------------------------------------------------------------------------------*/ #pragma optimize(push, off) -static u16_t -transport_chksum(u8_t protocol) +static uint16_t +transport_chksum(uint8_t protocol) { chksum_protocol = protocol; - chksum_ptr = (u16_t)&uip_buf[UIP_LLH_LEN + UIP_IPH_LEN]; + chksum_ptr = (uint16_t)&uip_buf[UIP_LLH_LEN + UIP_IPH_LEN]; chksum_len = UIP_TCPH_LEN; chksum_tmp = chksum(); - chksum_ptr = (u16_t)uip_appdata; + chksum_ptr = (uint16_t)uip_appdata; asm("lda _uip_aligned_buf+3+%b", UIP_LLH_LEN); asm("sec"); asm("sbc #%b", UIP_IPTCPH_LEN); @@ -313,16 +313,16 @@ transport_chksum(u8_t protocol) #pragma optimize(pop) /*-----------------------------------------------------------------------------------*/ -u16_t +uint16_t uip_tcpchksum(void) { return transport_chksum(IP_PROTO_TCP); #if 0 - chksum_ptr = (u16_t)&uip_buf[UIP_LLH_LEN + UIP_IPH_LEN]; + chksum_ptr = (uint16_t)&uip_buf[UIP_LLH_LEN + UIP_IPH_LEN]; chksum_len = UIP_TCPH_LEN; chksum_tmp = chksum(); - chksum_ptr = (u16_t)uip_appdata; + chksum_ptr = (uint16_t)uip_appdata; asm("lda _uip_buf+3+%b", UIP_LLH_LEN); asm("sec"); asm("sbc #%b", UIP_IPTCPH_LEN); @@ -416,16 +416,16 @@ uip_tcpchksum(void) /*-----------------------------------------------------------------------------------*/ #if UIP_UDP_CHECKSUMS -u16_t +uint16_t uip_udpchksum(void) { return transport_chksum(IP_PROTO_UDP); #if 0 - chksum_ptr = (u16_t)&uip_buf[20 + UIP_LLH_LEN]; + chksum_ptr = (uint16_t)&uip_buf[20 + UIP_LLH_LEN]; chksum_len = 20; chksum_tmp = chksum(); - chksum_ptr = (u16_t)uip_appdata; + chksum_ptr = (uint16_t)uip_appdata; asm("lda _uip_buf+3+%b", UIP_LLH_LEN); asm("sec"); asm("sbc #40"); diff --git a/cpu/arm/at91sam7s/loader/codeprop-otf.c b/cpu/arm/at91sam7s/loader/codeprop-otf.c index 5a914ae74..f676d8d22 100644 --- a/cpu/arm/at91sam7s/loader/codeprop-otf.c +++ b/cpu/arm/at91sam7s/loader/codeprop-otf.c @@ -106,18 +106,18 @@ static const char *err_msgs[] = #define UDPDATASIZE 32 struct codeprop_udphdr { - u16_t id; - u16_t type; + uint16_t id; + uint16_t type; #define TYPE_DATA 0x0001 #define TYPE_NACK 0x0002 - u16_t addr; - u16_t len; - u8_t data[UDPDATASIZE]; + uint16_t addr; + uint16_t len; + uint8_t data[UDPDATASIZE]; }; struct codeprop_tcphdr { - u16_t len; - u16_t pad; + uint16_t len; + uint16_t pad; }; static void uipcall(void *state); @@ -125,19 +125,19 @@ static void uipcall(void *state); PROCESS(codeprop_process, "Code propagator"); struct codeprop_state { - u8_t state; + uint8_t state; #define STATE_NONE 0 #define STATE_RECEIVING_TCPDATA 1 #define STATE_RECEIVING_UDPDATA 2 #define STATE_SENDING_UDPDATA 3 - u16_t count; - u16_t addr; - u16_t len; - u16_t id; + uint16_t count; + uint16_t addr; + uint16_t len; + uint16_t id; struct etimer sendtimer; struct timer nacktimer, timer, starttimer; - u8_t received; - u8_t send_counter; + uint8_t received; + uint8_t send_counter; struct pt tcpthread_pt; struct pt udpthread_pt; struct pt recv_udpthread_pt; @@ -200,10 +200,10 @@ PROCESS_THREAD(codeprop_process, ev, data) PROCESS_END(); } /*---------------------------------------------------------------------*/ -static u16_t +static uint16_t send_udpdata(struct codeprop_udphdr *uh) { - u16_t len; + uint16_t len; uh->type = UIP_HTONS(TYPE_DATA); uh->addr = uip_htons(s.addr); diff --git a/cpu/arm/common/usb/cdc-eth/cdc-eth.c b/cpu/arm/common/usb/cdc-eth/cdc-eth.c index ac9e729a6..e46b978d0 100644 --- a/cpu/arm/common/usb/cdc-eth/cdc-eth.c +++ b/cpu/arm/common/usb/cdc-eth/cdc-eth.c @@ -46,7 +46,7 @@ init_recv_buffer() recv_buffer.flags = USB_BUFFER_SHORT_END | USB_BUFFER_NOTIFY; } -u8_t +uint8_t usbeth_send(void) { if ((xmit_buffer[0].flags & USB_BUFFER_SUBMITTED)) return UIP_FW_DROPPED; diff --git a/cpu/arm/common/usb/cdc-eth/dhcps.c b/cpu/arm/common/usb/cdc-eth/dhcps.c index fd295f831..3fb619d37 100644 --- a/cpu/arm/common/usb/cdc-eth/dhcps.c +++ b/cpu/arm/common/usb/cdc-eth/dhcps.c @@ -315,7 +315,7 @@ static uip_ipaddr_t bcast_addr; static void send_offer(struct uip_udp_conn *conn, struct dhcps_client_lease *lease) { - u8_t *end; + uint8_t *end; struct dhcp_msg *m = (struct dhcp_msg *)uip_appdata; create_msg(m); @@ -327,13 +327,13 @@ send_offer(struct uip_udp_conn *conn, struct dhcps_client_lease *lease) end = add_config(end); end = add_end(end); uip_ipaddr_copy(&conn->ripaddr, &bcast_addr); - uip_send(uip_appdata, (int)(end - (u8_t *)uip_appdata)); + uip_send(uip_appdata, (int)(end - (uint8_t *)uip_appdata)); } static void send_ack(struct uip_udp_conn *conn, struct dhcps_client_lease *lease) { - u8_t *end; + uint8_t *end; uip_ipaddr_t ciaddr; struct dhcp_msg *m = (struct dhcp_msg *)uip_appdata; @@ -347,13 +347,13 @@ send_ack(struct uip_udp_conn *conn, struct dhcps_client_lease *lease) end = add_end(end); memcpy(&ciaddr, &lease->ipaddr,4); uip_ipaddr_copy(&conn->ripaddr, &bcast_addr); - uip_send(uip_appdata, (int)(end - (u8_t *)uip_appdata)); + uip_send(uip_appdata, (int)(end - (uint8_t *)uip_appdata)); printf("ACK\n"); } static void send_nack(struct uip_udp_conn *conn) { - u8_t *end; + uint8_t *end; struct dhcp_msg *m = (struct dhcp_msg *)uip_appdata; create_msg(m); @@ -364,7 +364,7 @@ send_nack(struct uip_udp_conn *conn) end = add_end(end); uip_ipaddr_copy(&conn->ripaddr, &bcast_addr); - uip_send(uip_appdata, (int)(end - (u8_t *)uip_appdata)); + uip_send(uip_appdata, (int)(end - (uint8_t *)uip_appdata)); printf("NACK\n"); } diff --git a/cpu/avr/dev/debug.c b/cpu/avr/dev/debug.c index 9e4fec4e7..bd330f0f1 100644 --- a/cpu/avr/dev/debug.c +++ b/cpu/avr/dev/debug.c @@ -15,7 +15,7 @@ delay(void) } /*-----------------------------------------------------------------------------------*/ static char buffer[40]; -static prog_char hextab[] = +static const char hextab[] PROGMEM = {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'}; /*-----------------------------------------------------------------------------------*/ static void @@ -60,7 +60,7 @@ debug_print16(unsigned short v) } /*-----------------------------------------------------------------------------------*/ void -debug_print(prog_char *str) +debug_print(char *str) { /* unsigned char i; diff --git a/cpu/avr/dev/lanc111.c b/cpu/avr/dev/lanc111.c index fd372706a..a19798605 100644 --- a/cpu/avr/dev/lanc111.c +++ b/cpu/avr/dev/lanc111.c @@ -476,17 +476,17 @@ #define MSBV(bit) (1 << ((bit) - 8)) -#define nic_outlb(addr, val) (*(volatile u8_t *)(addr) = (val)) -#define nic_outhb(addr, val) (*(volatile u8_t *)((addr) + 1) = (val)) -#define nic_outwx(addr, val) (*(volatile u16_t *)(addr) = (val)) +#define nic_outlb(addr, val) (*(volatile uint8_t *)(addr) = (val)) +#define nic_outhb(addr, val) (*(volatile uint8_t *)((addr) + 1) = (val)) +#define nic_outwx(addr, val) (*(volatile uint16_t *)(addr) = (val)) #define nic_outw(addr, val) { \ - *(volatile u8_t *)(addr) = (u8_t)(val); \ - *((volatile u8_t *)(addr) + 1) = (u8_t)((val) >> 8); \ + *(volatile uint8_t *)(addr) = (uint8_t)(val); \ + *((volatile uint8_t *)(addr) + 1) = (uint8_t)((val) >> 8); \ } -#define nic_inlb(addr) (*(volatile u8_t *)(addr)) -#define nic_inhb(addr) (*(volatile u8_t *)((addr) + 1)) -#define nic_inw(addr) (*(volatile u16_t *)(addr)) +#define nic_inlb(addr) (*(volatile uint8_t *)(addr)) +#define nic_inhb(addr) (*(volatile uint8_t *)((addr) + 1)) +#define nic_inw(addr) (*(volatile uint16_t *)(addr)) #define nic_bs(bank) nic_outlb(NIC_BSR, bank) @@ -513,11 +513,11 @@ * * \return Contents of the PHY interface rgister. */ -static u8_t NicPhyRegSelect(u8_t reg, u8_t we) +static uint8_t NicPhyRegSelect(uint8_t reg, uint8_t we) { - u8_t rs; - u8_t msk; - u8_t i; + uint8_t rs; + uint8_t msk; + uint8_t i; nic_bs(3); rs = (nic_inlb(NIC_MGMT) & ~(MGMT_MCLK | MGMT_MDO)) | MGMT_MDOE; @@ -577,11 +577,11 @@ static u8_t NicPhyRegSelect(u8_t reg, u8_t we) * * \return Contents of the specified register. */ -static u16_t NicPhyRead(u8_t reg) +static uint16_t NicPhyRead(uint8_t reg) { - u16_t rc = 0; - u8_t rs; - u8_t i; + uint16_t rc = 0; + uint8_t rs; + uint8_t i; /* Select register for reading. */ rs = NicPhyRegSelect(reg, 0); @@ -613,10 +613,10 @@ static u16_t NicPhyRead(u8_t reg) * \param reg PHY register number. * \param val Value to write. */ -static void NicPhyWrite(u8_t reg, u16_t val) +static void NicPhyWrite(uint8_t reg, uint16_t val) { - u16_t msk; - u8_t rs; + uint16_t msk; + uint8_t rs; /* Select register for writing. */ rs = NicPhyRegSelect(reg, 1); @@ -649,10 +649,10 @@ static void NicPhyWrite(u8_t reg, u16_t val) */ static int NicPhyConfig(void) { - u16_t phy_sor; - u16_t phy_sr; - u16_t phy_to; - u16_t mode; + uint16_t phy_sor; + uint16_t phy_sr; + uint16_t phy_to; + uint16_t mode; /* * Reset the PHY and wait until this self clearing bit @@ -739,7 +739,7 @@ static int NicPhyConfig(void) * * \return 0 on success or -1 on timeout. */ -static INLINE int NicMmuWait(u16_t tmo) +static INLINE int NicMmuWait(uint16_t tmo) { while (tmo--) { if ((nic_inlb(NIC_MMUCR) & MMUCR_BUSY) == 0) @@ -803,9 +803,9 @@ static int NicReset(void) * * \param mac Six byte unique MAC address. */ -static int NicStart(CONST u8_t * mac) +static int NicStart(CONST uint8_t * mac) { - u8_t i; + uint8_t i; if (NicReset()) return -1; @@ -843,8 +843,8 @@ static int NicStart(CONST u8_t * mac) #if 0 static void NicInterrupt(void *arg) { - u8_t isr; - u8_t imr; + uint8_t isr; + uint8_t imr; NICINFO *ni = (NICINFO *) ((NUTDEVICE *) arg)->dev_dcb; ni->ni_interrupts++; @@ -912,11 +912,11 @@ static void NicInterrupt(void *arg) /* * Write data block to the NIC. */ -static void NicWrite(u8_t * buf, u16_t len) +static void NicWrite(uint8_t * buf, uint16_t len) { - register u16_t l = len - 1; - register u8_t ih = (u16_t) l >> 8; - register u8_t il = (u8_t) l; + register uint16_t l = len - 1; + register uint8_t ih = (uint16_t) l >> 8; + register uint8_t il = (uint8_t) l; if (!len) return; @@ -931,11 +931,11 @@ static void NicWrite(u8_t * buf, u16_t len) /* * Read data block from the NIC. */ -static void NicRead(u8_t * buf, u16_t len) +static void NicRead(uint8_t * buf, uint16_t len) { - register u16_t l = len - 1; - register u8_t ih = (u16_t) l >> 8; - register u8_t il = (u8_t) l; + register uint16_t l = len - 1; + register uint8_t ih = (uint16_t) l >> 8; + register uint8_t il = (uint8_t) l; if (!len) return; @@ -960,9 +960,9 @@ static void NicRead(u8_t * buf, u16_t len) static NETBUF *NicGetPacket(void) { NETBUF *nb = 0; - //u8_t *buf; - u16_t fsw; - u16_t fbc; + //uint8_t *buf; + uint16_t fsw; + uint16_t fbc; /* Check the fifo empty bit. If it is set, then there is nothing in the receiver fifo. */ @@ -1028,9 +1028,9 @@ static NETBUF *NicGetPacket(void) #if 0 static int NicPutPacket(NETBUF * nb) { - u16_t sz; - u8_t odd = 0; - u8_t imsk; + uint16_t sz; + uint8_t odd = 0; + uint8_t imsk; //printf("[P]"); /* @@ -1130,7 +1130,7 @@ PROCESS_THREAD(lanc111_process, ev, data) IFNET *ifn; NICINFO *ni; NETBUF *nb;*/ - u8_t imsk; + uint8_t imsk; static struct etimer et; /* dev = arg; diff --git a/cpu/avr/dev/rs232.c b/cpu/avr/dev/rs232.c index 44621f777..94cf5035f 100644 --- a/cpu/avr/dev/rs232.c +++ b/cpu/avr/dev/rs232.c @@ -384,14 +384,6 @@ rs232_set_input(uint8_t port, int (*f)(unsigned char)) #endif } -void -rs232_print_p(uint8_t port, prog_char *buf) -{ - while(pgm_read_byte(buf)) { - rs232_send(port, pgm_read_byte(buf)); - ++buf; - } -} /*---------------------------------------------------------------------------*/ void rs232_print(uint8_t port, char *buf) diff --git a/cpu/avr/dev/rs232.h b/cpu/avr/dev/rs232.h index 531459007..c1b1de415 100644 --- a/cpu/avr/dev/rs232.h +++ b/cpu/avr/dev/rs232.h @@ -31,7 +31,6 @@ * Author: Adam Dunkels * Simon Barner * - * @(#)$Id: rs232.h,v 1.6 2008/11/29 18:36:12 c_oflynn Exp $ */ #ifndef __RS232_H__ @@ -111,19 +110,6 @@ rs232_set_input(uint8_t port, int (* f)(unsigned char)); * configured for this function to work. */ void -rs232_print_p(uint8_t port, prog_char *buf); - -/** - * \brief Print a text string on RS232 - * \param port The RS232 port to be used. - * \param str A pointer to the string that is to be printed - * - * This function prints a string to RS232. The string must - * be terminated by a null byte. The RS232 module must be - * correctly initalized and configured for this function - * to work. - */ -void rs232_print(uint8_t port, char *buf); /** diff --git a/cpu/avr/dev/rtl8019-drv.c b/cpu/avr/dev/rtl8019-drv.c index a65a68dd5..fbcf81854 100644 --- a/cpu/avr/dev/rtl8019-drv.c +++ b/cpu/avr/dev/rtl8019-drv.c @@ -42,7 +42,7 @@ PROCESS(rtl8019_process, "RTL8019 driver"); /*---------------------------------------------------------------------------*/ -u8_t +uint8_t rtl8019_output(void) { uip_arp_out(); diff --git a/cpu/avr/dev/rtl8019-drv.h b/cpu/avr/dev/rtl8019-drv.h index 513891a07..f11a86e28 100644 --- a/cpu/avr/dev/rtl8019-drv.h +++ b/cpu/avr/dev/rtl8019-drv.h @@ -41,6 +41,6 @@ PROCESS_NAME(rtl8019_process); -u8_t rtl8019_output(void); +uint8_t rtl8019_output(void); #endif /* __RTL8019_DRV_H__ */ diff --git a/cpu/avr/dev/usb/compiler.h b/cpu/avr/dev/usb/compiler.h index 4a398f5d2..e60828eb3 100644 --- a/cpu/avr/dev/usb/compiler.h +++ b/cpu/avr/dev/usb/compiler.h @@ -332,7 +332,7 @@ typedef char r_uart_ptchar; #define _ConstType_ __flash #define _MemType_ #define _GenericType_ __generic -#define FLASH PROGMEM +#define FLASH const PROGMEM #define XDATA #define IDATA #define DATA diff --git a/cpu/avr/dev/usb/rndis/rndis.c b/cpu/avr/dev/usb/rndis/rndis.c index 42c3b2b4e..8cef778b7 100644 --- a/cpu/avr/dev/usb/rndis/rndis.c +++ b/cpu/avr/dev/usb/rndis/rndis.c @@ -93,7 +93,7 @@ extern U8 data_to_transfer; /** * \brief List of supported RNDIS OID's */ -prog_uint32_t OIDSupportedList[] = { +const uint32_t OIDSupportedList[] PROGMEM = { /* Required General */ OID_GEN_SUPPORTED_LIST , OID_GEN_HARDWARE_STATUS , diff --git a/cpu/avr/dev/usb/usb_standard_request.c b/cpu/avr/dev/usb/usb_standard_request.c index 93ac02d0b..7371f63f8 100644 --- a/cpu/avr/dev/usb/usb_standard_request.c +++ b/cpu/avr/dev/usb/usb_standard_request.c @@ -250,6 +250,7 @@ void usb_get_string_descriptor_sram(U8 string_type) { dummy = Usb_read_byte(); //!< don't care of wIndex field dummy = Usb_read_byte(); + if (dummy) {;} //avoid gcc unused variable warning requested_length = Usb_read_byte(); //!< read wLength requested_length |= Usb_read_byte()<<8; @@ -341,6 +342,7 @@ void usb_get_string_descriptor(U8 string_type) { dummy = Usb_read_byte(); //!< don't care of wIndex field dummy = Usb_read_byte(); + if (dummy) {;} requested_length = Usb_read_byte(); //!< read wLength requested_length |= Usb_read_byte()<<8; @@ -468,6 +470,7 @@ void usb_get_descriptor(void) default: dummy = Usb_read_byte(); dummy = Usb_read_byte(); + if (dummy) {;} LSBwLength = Usb_read_byte(); MSBwLength = Usb_read_byte(); byteswereread=1; @@ -567,6 +570,7 @@ U8 dummy; dummy = Usb_read_byte(); //!< dummy read dummy = Usb_read_byte(); //!< dummy read + if (dummy) {;} wIndex = Usb_read_byte(); switch(bmRequestType) @@ -617,6 +621,7 @@ U8 dummy; { wValue = Usb_read_byte(); dummy = Usb_read_byte(); //!< dummy read + if (dummy) {;} if (wValue == FEATURE_ENDPOINT_HALT) { @@ -673,6 +678,7 @@ U8 dummy; { wValue = Usb_read_byte(); dummy = Usb_read_byte(); //!< dummy read + if (dummy) {;} if (wValue == FEATURE_ENDPOINT_HALT) { @@ -730,6 +736,7 @@ void usb_set_interface (void) alt_setting = Usb_read_byte(); dummy = Usb_read_byte(); + if (dummy) {;} interface = Usb_read_byte(); if(usb_user_set_alt_interface(interface, alt_setting)) { diff --git a/cpu/avr/mtarch.c b/cpu/avr/mtarch.c index d9bcd35ec..d5323c255 100644 --- a/cpu/avr/mtarch.c +++ b/cpu/avr/mtarch.c @@ -33,7 +33,6 @@ * \author Adam Dunkels * \author Simon Barner * - * @(#)$Id: mtarch.c,v 1.1 2006/12/22 16:55:53 barner Exp $ */ #include @@ -214,6 +213,12 @@ void mtarch_pstart(void) { +} +/*--------------------------------------------------------------------------*/ +void +mtarch_stop(struct mtarch_thread *t) +{ + } /*--------------------------------------------------------------------------*/ int diff --git a/cpu/avr/radio/rf230bb/atmega128rfa1_registermap.h b/cpu/avr/radio/rf230bb/atmega128rfa1_registermap.h index 986001f6d..2a86c547d 100644 --- a/cpu/avr/radio/rf230bb/atmega128rfa1_registermap.h +++ b/cpu/avr/radio/rf230bb/atmega128rfa1_registermap.h @@ -81,6 +81,7 @@ #define SR_CCA_REQUEST 0x08, 0x80, 7 #define SR_CCA_DONE 0x01, 0x80, 7 #define SR_CCA_STATUS 0x01, 0x40, 6 +#define SR_AACK_SET_PD 0x2e, 0x20, 5 /* RF230 register assignments, for reference */ diff --git a/cpu/avr/radio/rf230bb/rf230bb.c b/cpu/avr/radio/rf230bb/rf230bb.c index 5ec848a9c..477c561fe 100644 --- a/cpu/avr/radio/rf230bb/rf230bb.c +++ b/cpu/avr/radio/rf230bb/rf230bb.c @@ -855,9 +855,6 @@ rf230_transmit(unsigned short payload_len) /* This automatically does the PLL calibrations */ if (hal_get_slptr()) { #if defined(__AVR_ATmega128RFA1__) - if (radiowason) DEBUGFLOW('e'); - radiowason=0; -// DEBUGFLOW('j'); ENERGEST_ON(ENERGEST_TYPE_LED_RED); #if RF230BB_CONF_LEDONPORTE1 PORTE|=(1<stack[i] = i; @@ -57,15 +57,15 @@ mtarch_start(struct mtarch_thread *t, /* A parameter for method for thread function. */ - *t->sp = (u16_t)data; + *t->sp = (uint16_t)data; --t->sp; /* This will be a return address of thread function. */ - *t->sp = (u16_t)mt_exit; + *t->sp = (uint16_t)mt_exit; --t->sp; /* The thread function, is used as a return address of mtarch_switch. */ - *t->sp = (u16_t)function; + *t->sp = (uint16_t)function; --t->sp; /* @@ -82,7 +82,7 @@ mtarch_start(struct mtarch_thread *t, } /*--------------------------------------------------------------------------*/ static struct mtarch_thread *running_thread; -static u16_t *sptmp; +static uint16_t *sptmp; static void mtarch_switch() { @@ -180,7 +180,7 @@ mtarch_pstart() int mtarch_stack_usage(struct mtarch_thread *t) { - u16_t i; + uint16_t i; for (i = 0; i < MTARCH_STACKSIZE; i++) { if (t->stack[i] != i) { return MTARCH_STACKSIZE - i; diff --git a/cpu/cc2430/mtarch.h b/cpu/cc2430/mtarch.h index 9c458be98..f5d2b80b2 100644 --- a/cpu/cc2430/mtarch.h +++ b/cpu/cc2430/mtarch.h @@ -48,12 +48,12 @@ struct mtarch_thread { * On top of the mtarch_thread must be the address for the stack pointer. * See details at mtarch_switch in mtarch.c */ - u16_t *sp; + uint16_t *sp; /* * Stack is 2-byte wide, so please note that you need 2 * MTARCH_STACKSIZE * bytes for the stack area for each thread. */ - u16_t stack[MTARCH_STACKSIZE]; + uint16_t stack[MTARCH_STACKSIZE]; }; /* diff --git a/cpu/cc2430/uip_arch-asm.S b/cpu/cc2430/uip_arch-asm.S index 0f9decbc1..e64ddf45a 100644 --- a/cpu/cc2430/uip_arch-asm.S +++ b/cpu/cc2430/uip_arch-asm.S @@ -27,7 +27,7 @@ .area _CODE ;; --------------------------------- - ;; void uip_add32(u8_t *op32, u16_t op16); + ;; void uip_add32(uint8_t *op32, uint16_t op16); ;; Stack; retl reth op32l op32h op16l op16h ;; ABCDEHL____ ;; return void @@ -102,7 +102,7 @@ _uip_add32_nocarry0: _uip_add32_end:: ;; --------------------------------- - ;; static u16_t chksum(u16_t sum, const u8_t *data, u16_t len) + ;; static uint16_t chksum(uint16_t sum, const uint8_t *data, uint16_t len) ;; Stack; retl reth suml sumh datal datah lenl lenh ;; ABCDEHL____ ;; return HL @@ -188,11 +188,11 @@ _uip_arch_chksum_loop_exit: _uip_arch_chksum_end:: ;; --------------------------------- - ;; u16_t uip_chksum(void); + ;; uint16_t uip_chksum(void); ;; Stack; retl reth datal datah lenl lenh ;; ABCDEHL____ ;; return HL - ;; return htons(chksum(0, (u8_t *)data, len)); + ;; return htons(chksum(0, (uint8_t *)data, len)); ;; --------------------------------- _uip_chksum_start:: _uip_chksum: diff --git a/cpu/cc2430/uip_arch.c b/cpu/cc2430/uip_arch.c index c0010c69a..afa6b601e 100644 --- a/cpu/cc2430/uip_arch.c +++ b/cpu/cc2430/uip_arch.c @@ -41,15 +41,15 @@ #include #include "uip_arch.h" -static const u16_t sizeof_uip_ipaddr_t = sizeof(uip_ipaddr_t); -static const u16_t offset_tcpip_hdr_len = offsetof(struct uip_tcpip_hdr, len); -static const u16_t offset_tcpip_hdr_srcipaddr = offsetof(struct uip_tcpip_hdr, srcipaddr); +static const uint16_t sizeof_uip_ipaddr_t = sizeof(uip_ipaddr_t); +static const uint16_t offset_tcpip_hdr_len = offsetof(struct uip_tcpip_hdr, len); +static const uint16_t offset_tcpip_hdr_srcipaddr = offsetof(struct uip_tcpip_hdr, srcipaddr); /*--------------------------------------------------------------------------*/ static void upper_layer_chksum() { __asm ;; --------------------------------- - ;; static u16_t upper_layer_chksum(u8_t proto); + ;; static uint16_t upper_layer_chksum(uint8_t proto); ;; Stack; retl reth ;; @param C proto ;; ABCDEHL____ @@ -142,12 +142,12 @@ __endasm; } /*--------------------------------------------------------------------------*/ -u16_t +uint16_t uip_ipchksum(void) { __asm ;; --------------------------------- - ;; u16_t uip_ipchksum(void); + ;; uint16_t uip_ipchksum(void); ;; Stack; retl reth ;; ABCDEHL____ ;; return HL @@ -164,12 +164,12 @@ __endasm; /*--------------------------------------------------------------------------*/ #if UIP_CONF_IPV6 -u16_t +uint16_t uip_icmp6chksum(void) { __asm ;; --------------------------------- - ;; u16_t uip_icmp6chksum(void); + ;; uint16_t uip_icmp6chksum(void); ;; Stack; retl reth ;; ABCDEHL____ ;; return HL @@ -181,12 +181,12 @@ __endasm; #endif /* UIP_CONF_IPV6 */ /*--------------------------------------------------------------------------*/ -u16_t +uint16_t uip_tcpchksum(void) { __asm ;; --------------------------------- - ;; u16_t uip_tcpchksum(void); + ;; uint16_t uip_tcpchksum(void); ;; Stack; retl reth ;; ABCDEHL____ ;; return HL @@ -198,12 +198,12 @@ __endasm; /*--------------------------------------------------------------------------*/ #if UIP_UDP_CHKSUMS -u16_t +uint16_t uip_udpchksum(void) { __asm ;; --------------------------------- - ;; u16_t uip_udpchksum(void); + ;; uint16_t uip_udpchksum(void); ;; Stack; retl reth ;; ABCDEHL____ ;; return HL diff --git a/cpu/mc1322x/contiki-mc1322x-conf.h b/cpu/mc1322x/contiki-mc1322x-conf.h index c5acbb1d6..e7fce0aaa 100644 --- a/cpu/mc1322x/contiki-mc1322x-conf.h +++ b/cpu/mc1322x/contiki-mc1322x-conf.h @@ -47,12 +47,14 @@ typedef int32_t s32_t; /* Pre-allocated memory for loadable modules heap space (in bytes)*/ #define MMEM_CONF_SIZE 256 -typedef uint32_t clock_time_t; +/* These names are deprecated, use C99 names. */ typedef unsigned char u8_t; typedef unsigned short u16_t; typedef unsigned long u32_t; typedef unsigned short uip_stats_t; +typedef uint32_t clock_time_t; + void clock_delay(unsigned int us2); void clock_wait(int ms10); void clock_set_seconds(unsigned long s); diff --git a/cpu/msp430/dev/button.h b/cpu/msp430/dev/button.h index 840d0176c..4542fcacc 100644 --- a/cpu/msp430/dev/button.h +++ b/cpu/msp430/dev/button.h @@ -35,8 +35,8 @@ #define BUTTON_MSG_TYPE 1 struct button_msg { - u8_t type; - u8_t value; + uint8_t type; + uint8_t value; }; void button_init(struct process *proc); diff --git a/cpu/msp430/uip-ipchksum.c b/cpu/msp430/uip-ipchksum.c index 5ed3736f3..c32359f6d 100644 --- a/cpu/msp430/uip-ipchksum.c +++ b/cpu/msp430/uip-ipchksum.c @@ -42,18 +42,18 @@ /*---------------------------------------------------------------------------*/ #ifdef UIP_ARCH_IPCHKSUM #ifdef __IAR_SYSTEMS_ICC__ -u16_t +uint16_t uip_ipchksum(void) { return 0; } #else -u16_t +uint16_t uip_ipchksum(void) { /* Assumes proper alignement of uip_buf. */ - u16_t *p = (u16_t *)&uip_buf[UIP_LLH_LEN]; - register u16_t sum; + uint16_t *p = (uint16_t *)&uip_buf[UIP_LLH_LEN]; + register uint16_t sum; sum = p[0]; asmv("add %[p], %[sum]": [sum] "+r" (sum): [p] "m" (p[1])); diff --git a/cpu/native/net/tapdev-drv.c b/cpu/native/net/tapdev-drv.c index 44fe64d28..89dd9630b 100644 --- a/cpu/native/net/tapdev-drv.c +++ b/cpu/native/net/tapdev-drv.c @@ -48,7 +48,7 @@ PROCESS(tapdev_process, "TAP driver"); /*---------------------------------------------------------------------------*/ #if !UIP_CONF_IPV6 -u8_t +uint8_t tapdev_output(void) { uip_arp_out(); diff --git a/cpu/native/net/tapdev-drv.h b/cpu/native/net/tapdev-drv.h index f5b3b3720..c5def8bf0 100644 --- a/cpu/native/net/tapdev-drv.h +++ b/cpu/native/net/tapdev-drv.h @@ -38,6 +38,6 @@ PROCESS_NAME(tapdev_process); -u8_t tapdev_output(void); +uint8_t tapdev_output(void); #endif /* __TAPDEV_DRV_H__ */ diff --git a/cpu/native/net/tapdev.c b/cpu/native/net/tapdev.c index 1996e17a3..f00785d12 100644 --- a/cpu/native/net/tapdev.c +++ b/cpu/native/net/tapdev.c @@ -122,7 +122,7 @@ tapdev_init(void) lasttime = 0; } /*---------------------------------------------------------------------------*/ -u16_t +uint16_t tapdev_poll(void) { fd_set fdset; diff --git a/cpu/native/net/tapdev.h b/cpu/native/net/tapdev.h index d3c1d53c8..0c9005fb6 100644 --- a/cpu/native/net/tapdev.h +++ b/cpu/native/net/tapdev.h @@ -38,7 +38,7 @@ #define __TAPDEV_H__ void tapdev_init(void); -u16_t tapdev_poll(void); +uint16_t tapdev_poll(void); void tapdev_send(void); void tapdev_exit(void); diff --git a/cpu/native/net/tapdev6.c b/cpu/native/net/tapdev6.c index 6334bbe9a..b63f1ac46 100644 --- a/cpu/native/net/tapdev6.c +++ b/cpu/native/net/tapdev6.c @@ -77,17 +77,17 @@ static unsigned long lasttime; #define DEBUG 0 #if DEBUG #define PRINTF(...) printf(__VA_ARGS__) -#define PRINT6ADDR(addr) PRINTF("%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x", ((u8_t *)addr)[0], ((u8_t *)addr)[1], ((u8_t *)addr)[2], ((u8_t *)addr)[3], ((u8_t *)addr)[4], ((u8_t *)addr)[5], ((u8_t *)addr)[6], ((u8_t *)addr)[7], ((u8_t *)addr)[8], ((u8_t *)addr)[9], ((u8_t *)addr)[10], ((u8_t *)addr)[11], ((u8_t *)addr)[12], ((u8_t *)addr)[13], ((u8_t *)addr)[14], ((u8_t *)addr)[15]) +#define PRINT6ADDR(addr) PRINTF("%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x", ((uint8_t *)addr)[0], ((uint8_t *)addr)[1], ((uint8_t *)addr)[2], ((uint8_t *)addr)[3], ((uint8_t *)addr)[4], ((uint8_t *)addr)[5], ((uint8_t *)addr)[6], ((uint8_t *)addr)[7], ((uint8_t *)addr)[8], ((uint8_t *)addr)[9], ((uint8_t *)addr)[10], ((uint8_t *)addr)[11], ((uint8_t *)addr)[12], ((uint8_t *)addr)[13], ((uint8_t *)addr)[14], ((uint8_t *)addr)[15]) #else #define PRINTF(...) #define PRINT6ADDR(addr) #endif static void do_send(void); -u8_t tapdev_send(uip_lladdr_t *lladdr); +uint8_t tapdev_send(uip_lladdr_t *lladdr); -u16_t +uint16_t tapdev_poll(void) { fd_set fdset; @@ -192,7 +192,7 @@ do_send(void) } } /*---------------------------------------------------------------------------*/ -u8_t tapdev_send(uip_lladdr_t *lladdr) +uint8_t tapdev_send(uip_lladdr_t *lladdr) { /* * If L3 dest is multicast, build L2 multicast address diff --git a/cpu/native/net/tapdev6.h b/cpu/native/net/tapdev6.h index 2b93cbe06..8e025caa0 100644 --- a/cpu/native/net/tapdev6.h +++ b/cpu/native/net/tapdev6.h @@ -40,8 +40,8 @@ #include "contiki-net.h" void tapdev_init(void); -u8_t tapdev_send(uip_lladdr_t *lladdr); -u16_t tapdev_poll(void); +uint8_t tapdev_send(uip_lladdr_t *lladdr); +uint16_t tapdev_poll(void); void tapdev_do_send(void); void tapdev_exit(void); //math #endif /* __TAPDEV_H__ */ diff --git a/cpu/native/net/wpcap-drv.c b/cpu/native/net/wpcap-drv.c index bbba1bdf4..d9a1fd0e1 100644 --- a/cpu/native/net/wpcap-drv.c +++ b/cpu/native/net/wpcap-drv.c @@ -65,7 +65,7 @@ PROCESS(wpcap_process, "WinPcap driver"); /*---------------------------------------------------------------------------*/ #if !UIP_CONF_IPV6 -u8_t +uint8_t wpcap_output(void) { uip_arp_out(); diff --git a/cpu/native/net/wpcap-drv.h b/cpu/native/net/wpcap-drv.h index 5d0465369..d3f78e969 100644 --- a/cpu/native/net/wpcap-drv.h +++ b/cpu/native/net/wpcap-drv.h @@ -38,6 +38,6 @@ PROCESS_NAME(wpcap_process); -u8_t wpcap_output(void); +uint8_t wpcap_output(void); #endif /* __WPCAP_DRV_H__ */ diff --git a/cpu/native/net/wpcap.c b/cpu/native/net/wpcap.c index 6daf737ec..ce44c7dc8 100644 --- a/cpu/native/net/wpcap.c +++ b/cpu/native/net/wpcap.c @@ -185,7 +185,7 @@ init(void) /* Nothing to do here */ } /*---------------------------------------------------------------------------*/ -u8_t wfall_send(uip_lladdr_t *lladdr); +uint8_t wfall_send(uip_lladdr_t *lladdr); #if FALLBACK_HAS_ETHERNET_HEADERS #undef IPBUF #define IPBUF ((struct uip_tcpip_hdr *)&uip_buf[14]) @@ -597,7 +597,7 @@ wpcap_init(void) } /*---------------------------------------------------------------------------*/ -u16_t +uint16_t wpcap_poll(void) { struct pcap_pkthdr *packet_header; @@ -656,12 +656,12 @@ wpcap_poll(void) } // PRINTF("SIN: %lu\n", packet_header->caplen); CopyMemory(uip_buf, packet, packet_header->caplen); - return (u16_t)packet_header->caplen; + return (uint16_t)packet_header->caplen; } #ifdef UIP_FALLBACK_INTERFACE -u16_t +uint16_t wfall_poll(void) { struct pcap_pkthdr *packet_header; @@ -699,7 +699,7 @@ wfall_poll(void) } PRINTF("FIN: %lu\n", packet_header->caplen); CopyMemory(uip_buf, packet, packet_header->caplen); - return (u16_t)packet_header->caplen; + return (uint16_t)packet_header->caplen; } @@ -707,7 +707,7 @@ wfall_poll(void) /*---------------------------------------------------------------------------*/ #if UIP_CONF_IPV6 -u8_t +uint8_t wpcap_send(uip_lladdr_t *lladdr) { if(lladdr == NULL) { @@ -744,7 +744,7 @@ wpcap_send(uip_lladdr_t *lladdr) return 0; } #ifdef UIP_FALLBACK_INTERFACE -u8_t +uint8_t wfall_send(uip_lladdr_t *lladdr) { #if FALLBACK_HAS_ETHERNET_HEADERS diff --git a/cpu/native/net/wpcap.h b/cpu/native/net/wpcap.h index 2f4a0cc52..31ca0d763 100644 --- a/cpu/native/net/wpcap.h +++ b/cpu/native/net/wpcap.h @@ -37,11 +37,11 @@ #define __WPCAP_H__ void wpcap_init(void); -u16_t wpcap_poll(void); -u16_t wfall_poll(void); +uint16_t wpcap_poll(void); +uint16_t wfall_poll(void); #if UIP_CONF_IPV6 -u8_t wpcap_send(uip_lladdr_t *lladdr); -u8_t wfall_send(uip_lladdr_t *lladdr); +uint8_t wpcap_send(uip_lladdr_t *lladdr); +uint8_t wfall_send(uip_lladdr_t *lladdr); #else void wpcap_send(void); #endif diff --git a/cpu/stm32w108/cfs-coffee-arch.c b/cpu/stm32w108/cfs-coffee-arch.c index 789885c28..99b8e967b 100644 --- a/cpu/stm32w108/cfs-coffee-arch.c +++ b/cpu/stm32w108/cfs-coffee-arch.c @@ -525,7 +525,7 @@ void stm32w_flash_write(int32u address, const void * data, int32u length) halInternalFlashWrite(curr_page, (int16u *)buf, FLASH_PAGE_SIZE/2); ENERGEST_OFF(ENERGEST_TYPE_FLASH_WRITE); - data = (u8_t *)data + next_page - i; + data = (uint8_t *)data + next_page - i; i = next_page; } diff --git a/cpu/stm32w108/dev/stm32w-radio.c b/cpu/stm32w108/dev/stm32w-radio.c index fcbae0480..77f9d9b9d 100644 --- a/cpu/stm32w108/dev/stm32w-radio.c +++ b/cpu/stm32w108/dev/stm32w-radio.c @@ -227,7 +227,7 @@ static int stm32w_radio_init(void) return 0; } /*---------------------------------------------------------------------------*/ -int stm32w_radio_set_channel(u8_t channel) +int stm32w_radio_set_channel(uint8_t channel) { if (ST_RadioSetChannel(channel) == ST_SUCCESS) return 0; @@ -300,7 +300,7 @@ static int stm32w_radio_transmit(unsigned short payload_len) PRINTF("stm32w: sending %d bytes\r\n", payload_len); #if DEBUG > 1 - for(u8_t c=1; c <= stm32w_txbuf[0]-2; c++){ + for(uint8_t c=1; c <= stm32w_txbuf[0]-2; c++){ PRINTF("%x:",stm32w_txbuf[c]); } PRINTF("\r\n"); @@ -503,7 +503,7 @@ PROCESS_THREAD(stm32w_radio_process, ev, data) PRINTF("stm32w_radio_process: calling receiver callback\r\n"); #if DEBUG > 1 - for(u8_t c=1; c <= RCVD_PACKET_LEN; c++){ + for(uint8_t c=1; c <= RCVD_PACKET_LEN; c++){ PRINTF("%x",stm32w_rxbuf[c]); } PRINTF("\r\n"); diff --git a/cpu/stm32w108/dev/stm32w-radio.h b/cpu/stm32w108/dev/stm32w-radio.h index a2bdc3e54..dfb0a49cf 100644 --- a/cpu/stm32w108/dev/stm32w-radio.h +++ b/cpu/stm32w108/dev/stm32w-radio.h @@ -46,7 +46,7 @@ #include "hal/hal.h" #include "simplemac/include/phy-library.h" -int stm32w_radio_set_channel(u8_t channel); +int stm32w_radio_set_channel(uint8_t channel); short last_packet_rssi(); #define STM32W_MAX_PACKET_LEN 127 diff --git a/cpu/stm32w108/dev/uart1.c b/cpu/stm32w108/dev/uart1.c index 3a0db2742..b1dd0bf92 100644 --- a/cpu/stm32w108/dev/uart1.c +++ b/cpu/stm32w108/dev/uart1.c @@ -138,8 +138,8 @@ uart1_init(unsigned long ubr) GPIO_PBCFGL &= 0xF00F; GPIO_PBCFGL |= 0x0490; - u16_t uartper = (u32_t)24e6/(2*ubr); - u32_t rest = (u32_t)24e6%(2*ubr); + uint16_t uartper = (uint32_t)24e6/(2*ubr); + uint32_t rest = (uint32_t)24e6%(2*ubr); SC1_UARTFRAC = 0; diff --git a/cpu/stm32w108/rand.c b/cpu/stm32w108/rand.c index 2743b8617..ef1f3b8f1 100644 --- a/cpu/stm32w108/rand.c +++ b/cpu/stm32w108/rand.c @@ -49,7 +49,7 @@ int rand(void) { - u16_t rand_num; + uint16_t rand_num; ST_RadioGetRandomNumbers(&rand_num, 1); diff --git a/cpu/stm32w108/rtimer-arch.c b/cpu/stm32w108/rtimer-arch.c index 2c3b08f89..3c341e3ac 100644 --- a/cpu/stm32w108/rtimer-arch.c +++ b/cpu/stm32w108/rtimer-arch.c @@ -55,12 +55,12 @@ -static u32_t time_msb = 0; // Most significant bits of the current time. +static uint32_t time_msb = 0; // Most significant bits of the current time. // time of the next rtimer event. Initially is set to the max value. static rtimer_clock_t next_rtimer_time = 0; -static u16_t saved_TIM1CFG; +static uint16_t saved_TIM1CFG; /*---------------------------------------------------------------------------*/ @@ -150,7 +150,7 @@ void rtimer_arch_schedule(rtimer_clock_t t) { - PRINTF("rtimer_arch_schedule time %4x\r\n", /*((u32_t*)&t)+1,*/(u32_t)t); + PRINTF("rtimer_arch_schedule time %4x\r\n", /*((uint32_t*)&t)+1,*/(uint32_t)t); next_rtimer_time = t; diff --git a/cpu/stm32w108/uip_arch.c b/cpu/stm32w108/uip_arch.c index d02c7881a..55fa3d528 100644 --- a/cpu/stm32w108/uip_arch.c +++ b/cpu/stm32w108/uip_arch.c @@ -49,7 +49,7 @@ /*-----------------------------------------------------------------------------------*/ #if UIP_TCP void -uip_add32(u8_t *op32, u16_t op16) +uip_add32(uint8_t *op32, uint16_t op16) { uint32_t op32_align, uip_acc32_align; diff --git a/cpu/z80/lib/libconio_z80.c b/cpu/z80/lib/libconio_z80.c index 66209e395..e35f9d075 100644 --- a/cpu/z80/lib/libconio_z80.c +++ b/cpu/z80/lib/libconio_z80.c @@ -47,7 +47,7 @@ /*---------------------------------------------------------------------------*/ static void scroll() { unsigned char y; - u16_t src, dst; + uint16_t src, dst; for (y = 0; y < LIBCONIO_CONF_SCREEN_HEIGHT - 1; y++) { dst = LIBCONIO_VRAM_OFFSET(0, y); src = LIBCONIO_VRAM_OFFSET(0, y + 1); @@ -85,7 +85,7 @@ void ctk_arch_draw_char(char c, unsigned char ypos, unsigned char reversed, unsigned char color) { - u16_t off; + uint16_t off; adjust(&xpos, &ypos); off = LIBCONIO_VRAM_OFFSET(xpos, ypos); diff --git a/cpu/z80/loader/mef.c b/cpu/z80/loader/mef.c index 1b8567579..3b7a7403c 100644 --- a/cpu/z80/loader/mef.c +++ b/cpu/z80/loader/mef.c @@ -50,9 +50,9 @@ mef_load(unsigned char* offset) { unsigned char* start = offset; unsigned char areasize = load_byte(); - u16_t relocsize; + uint16_t relocsize; unsigned int i, j; - u16_t checksum = 0; + uint16_t checksum = 0; unsigned char* buf; struct Relocation reloc; @@ -94,12 +94,12 @@ mef_reloc(unsigned char* offset, struct Relocation *reloc) } offset += reloc->address; if (reloc->mode & MEF_RELOC_MSB_BYTE) { - *offset = (unsigned char) ((reloc->data + (u16_t) offset) >> 8); + *offset = (unsigned char) ((reloc->data + (uint16_t) offset) >> 8); } else if (reloc->mode & MEF_RELOC_LSB_BYTE) { - *offset = (unsigned char) ((reloc->data + (u16_t) offset) & 0xff); + *offset = (unsigned char) ((reloc->data + (uint16_t) offset) & 0xff); } else { /* word */ - *offset++ = (unsigned char) ((reloc->data + (u16_t) offset) & 0xff); - *offset = (unsigned char) ((reloc->data + (u16_t) offset) >> 8); + *offset++ = (unsigned char) ((reloc->data + (uint16_t) offset) & 0xff); + *offset = (unsigned char) ((reloc->data + (uint16_t) offset) >> 8); } } diff --git a/cpu/z80/loader/mef.h b/cpu/z80/loader/mef.h index 34ce8dcec..f00c86c5f 100644 --- a/cpu/z80/loader/mef.h +++ b/cpu/z80/loader/mef.h @@ -66,8 +66,8 @@ struct Area { unsigned char mode; - u16_t size; - u16_t checksum; + uint16_t size; + uint16_t checksum; }; /* @@ -82,8 +82,8 @@ struct Area { struct Relocation { unsigned char mode; - u16_t address; - u16_t data; + uint16_t address; + uint16_t data; }; unsigned char load_byte(); diff --git a/cpu/z80/mtarch.c b/cpu/z80/mtarch.c index 97614ad43..50f9959dc 100644 --- a/cpu/z80/mtarch.c +++ b/cpu/z80/mtarch.c @@ -47,7 +47,7 @@ void mtarch_start(struct mtarch_thread *t, void (*function)(void *), void *data) { - u16_t i; + uint16_t i; for(i = 0; i < MTARCH_STACKSIZE; i++) { t->stack[i] = i; @@ -57,15 +57,15 @@ mtarch_start(struct mtarch_thread *t, /* A parameter for method for thread function. */ - *t->sp = (u16_t)data; + *t->sp = (uint16_t)data; --t->sp; /* This will be a return address of thread function. */ - *t->sp = (u16_t)mt_exit; + *t->sp = (uint16_t)mt_exit; --t->sp; /* The thread function, is used as a return address of mtarch_switch. */ - *t->sp = (u16_t)function; + *t->sp = (uint16_t)function; --t->sp; /* @@ -82,7 +82,7 @@ mtarch_start(struct mtarch_thread *t, } /*--------------------------------------------------------------------------*/ static struct mtarch_thread *running_thread; -static u16_t *sptmp; +static uint16_t *sptmp; static void mtarch_switch() { @@ -180,7 +180,7 @@ mtarch_pstart() int mtarch_stack_usage(struct mtarch_thread *t) { - u16_t i; + uint16_t i; for (i = 0; i < MTARCH_STACKSIZE; i++) { if (t->stack[i] != i) { return MTARCH_STACKSIZE - i; diff --git a/cpu/z80/mtarch.h b/cpu/z80/mtarch.h index 9c458be98..f5d2b80b2 100644 --- a/cpu/z80/mtarch.h +++ b/cpu/z80/mtarch.h @@ -48,12 +48,12 @@ struct mtarch_thread { * On top of the mtarch_thread must be the address for the stack pointer. * See details at mtarch_switch in mtarch.c */ - u16_t *sp; + uint16_t *sp; /* * Stack is 2-byte wide, so please note that you need 2 * MTARCH_STACKSIZE * bytes for the stack area for each thread. */ - u16_t stack[MTARCH_STACKSIZE]; + uint16_t stack[MTARCH_STACKSIZE]; }; /* diff --git a/cpu/z80/uip_arch-asm.S b/cpu/z80/uip_arch-asm.S index 0f9decbc1..e64ddf45a 100644 --- a/cpu/z80/uip_arch-asm.S +++ b/cpu/z80/uip_arch-asm.S @@ -27,7 +27,7 @@ .area _CODE ;; --------------------------------- - ;; void uip_add32(u8_t *op32, u16_t op16); + ;; void uip_add32(uint8_t *op32, uint16_t op16); ;; Stack; retl reth op32l op32h op16l op16h ;; ABCDEHL____ ;; return void @@ -102,7 +102,7 @@ _uip_add32_nocarry0: _uip_add32_end:: ;; --------------------------------- - ;; static u16_t chksum(u16_t sum, const u8_t *data, u16_t len) + ;; static uint16_t chksum(uint16_t sum, const uint8_t *data, uint16_t len) ;; Stack; retl reth suml sumh datal datah lenl lenh ;; ABCDEHL____ ;; return HL @@ -188,11 +188,11 @@ _uip_arch_chksum_loop_exit: _uip_arch_chksum_end:: ;; --------------------------------- - ;; u16_t uip_chksum(void); + ;; uint16_t uip_chksum(void); ;; Stack; retl reth datal datah lenl lenh ;; ABCDEHL____ ;; return HL - ;; return htons(chksum(0, (u8_t *)data, len)); + ;; return htons(chksum(0, (uint8_t *)data, len)); ;; --------------------------------- _uip_chksum_start:: _uip_chksum: diff --git a/cpu/z80/uip_arch.c b/cpu/z80/uip_arch.c index fde5b9a14..739d57cc4 100644 --- a/cpu/z80/uip_arch.c +++ b/cpu/z80/uip_arch.c @@ -41,15 +41,15 @@ #include #include "uip_arch.h" -static const u16_t sizeof_uip_ipaddr_t = sizeof(uip_ipaddr_t); -static const u16_t offset_tcpip_hdr_len = offsetof(struct uip_tcpip_hdr, len); -static const u16_t offset_tcpip_hdr_srcipaddr = offsetof(struct uip_tcpip_hdr, srcipaddr); +static const uint16_t sizeof_uip_ipaddr_t = sizeof(uip_ipaddr_t); +static const uint16_t offset_tcpip_hdr_len = offsetof(struct uip_tcpip_hdr, len); +static const uint16_t offset_tcpip_hdr_srcipaddr = offsetof(struct uip_tcpip_hdr, srcipaddr); /*--------------------------------------------------------------------------*/ static void upper_layer_chksum() { __asm ;; --------------------------------- - ;; static u16_t upper_layer_chksum(u8_t proto); + ;; static uint16_t upper_layer_chksum(uint8_t proto); ;; Stack; retl reth ;; @param C proto ;; ABCDEHL____ @@ -142,12 +142,12 @@ __endasm; } /*--------------------------------------------------------------------------*/ -u16_t +uint16_t uip_ipchksum(void) { __asm ;; --------------------------------- - ;; u16_t uip_ipchksum(void); + ;; uint16_t uip_ipchksum(void); ;; Stack; retl reth ;; ABCDEHL____ ;; return HL @@ -164,12 +164,12 @@ __endasm; /*--------------------------------------------------------------------------*/ #if UIP_CONF_IPV6 -u16_t +uint16_t uip_icmp6chksum(void) { __asm ;; --------------------------------- - ;; u16_t uip_icmp6chksum(void); + ;; uint16_t uip_icmp6chksum(void); ;; Stack; retl reth ;; ABCDEHL____ ;; return HL @@ -181,12 +181,12 @@ __endasm; #endif /* UIP_CONF_IPV6 */ /*--------------------------------------------------------------------------*/ -u16_t +uint16_t uip_tcpchksum(void) { __asm ;; --------------------------------- - ;; u16_t uip_tcpchksum(void); + ;; uint16_t uip_tcpchksum(void); ;; Stack; retl reth ;; ABCDEHL____ ;; return HL @@ -198,12 +198,12 @@ __endasm; /*--------------------------------------------------------------------------*/ #if UIP_UDP_CHKSUMS -u16_t +uint16_t uip_udpchksum(void) { __asm ;; --------------------------------- - ;; u16_t uip_udpchksum(void); + ;; uint16_t uip_udpchksum(void); ;; Stack; retl reth ;; ABCDEHL____ ;; return HL diff --git a/doc/example-packet-drv.c b/doc/example-packet-drv.c index e89c917b8..ab81a7a96 100644 --- a/doc/example-packet-drv.c +++ b/doc/example-packet-drv.c @@ -29,7 +29,7 @@ PROCESS(example_packet_driver_process, "Example packet driver process"); * The packet is located in the uip_buf[] buffer, and the length of the * packet is in the uip_len variable. */ -u8_t +uint8_t example_packet_driver_output(void) { let_the_hardware_send_the_packet(uip_buf, uip_len); diff --git a/doc/example-packet-drv.h b/doc/example-packet-drv.h index 64a7c3cff..8ebfe7fc0 100644 --- a/doc/example-packet-drv.h +++ b/doc/example-packet-drv.h @@ -19,6 +19,6 @@ PROCESS_NAME(example_packet_driver_process); /* * Finally we declare the output function for use with uIP packet forwarding. */ -u8_t example_packet_driver_output(void); +uint8_t example_packet_driver_output(void); #endif /* __EXAMPLE_PACKET_DRV_H__ */ diff --git a/doc/sicslowpan-doc.txt b/doc/sicslowpan-doc.txt index 9e3c64f85..43f3ea71a 100644 --- a/doc/sicslowpan-doc.txt +++ b/doc/sicslowpan-doc.txt @@ -75,11 +75,11 @@ The format of a 802.15.4 address is defined in uip.h. \code /** \brief 64 bit 802.15.4 address */ struct uip_802154_shortaddr { - u8_t addr[2]; + uint8_t addr[2]; }; /** \brief 16 bit 802.15.4 address */ struct uip_802154_longaddr { - u8_t addr[8]; + uint8_t addr[8]; }; /** \brief 802.15.4 address */ typedef struct uip_802154_longaddr uip_lladdr_t; diff --git a/doc/uip-doc.txt b/doc/uip-doc.txt index d84ae0916..63df9f0df 100644 --- a/doc/uip-doc.txt +++ b/doc/uip-doc.txt @@ -820,7 +820,7 @@ parts, first the "Hello" part and then the "world!" part. #define STATE_WORLD 2 struct example6_state { - u8_t state; + uint8_t state; char *textptr; int textlen; }; diff --git a/doc/uip6-doc.txt b/doc/uip6-doc.txt index 2c9c2aabe..42320c603 100644 --- a/doc/uip6-doc.txt +++ b/doc/uip6-doc.txt @@ -75,8 +75,8 @@ bytes as we do not have larger buffers. An IPv6 address has 128 bits and is defined as follows: \code typedef union uip_ip6addr_t { - u8_t u8[16] - u16_t u16[8]; + uint8_t u8[16] + uint16_t u16[8]; } uip_ip6addr_t; \endcode @@ -299,7 +299,7 @@ The link-layer influences the following IP layer objects: #UIP_LLADDR_LEN. \code struct uip_eth_addr { - u8_t addr[6]; + uint8_t addr[6]; }; typedef struct uip_eth_addr uip_lladdr_t; #define UIP_LLADDR_LEN 6 diff --git a/examples/er-rest-example/coap-client-example.c b/examples/er-rest-example/coap-client-example.c index 1bd5f1fac..0709449d2 100644 --- a/examples/er-rest-example/coap-client-example.c +++ b/examples/er-rest-example/coap-client-example.c @@ -64,7 +64,7 @@ #define DEBUG 0 #if DEBUG #define PRINTF(...) printf(__VA_ARGS__) -#define PRINT6ADDR(addr) PRINTF("[%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x]", ((u8_t *)addr)[0], ((u8_t *)addr)[1], ((u8_t *)addr)[2], ((u8_t *)addr)[3], ((u8_t *)addr)[4], ((u8_t *)addr)[5], ((u8_t *)addr)[6], ((u8_t *)addr)[7], ((u8_t *)addr)[8], ((u8_t *)addr)[9], ((u8_t *)addr)[10], ((u8_t *)addr)[11], ((u8_t *)addr)[12], ((u8_t *)addr)[13], ((u8_t *)addr)[14], ((u8_t *)addr)[15]) +#define PRINT6ADDR(addr) PRINTF("[%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x]", ((uint8_t *)addr)[0], ((uint8_t *)addr)[1], ((uint8_t *)addr)[2], ((uint8_t *)addr)[3], ((uint8_t *)addr)[4], ((uint8_t *)addr)[5], ((uint8_t *)addr)[6], ((uint8_t *)addr)[7], ((uint8_t *)addr)[8], ((uint8_t *)addr)[9], ((uint8_t *)addr)[10], ((uint8_t *)addr)[11], ((uint8_t *)addr)[12], ((uint8_t *)addr)[13], ((uint8_t *)addr)[14], ((uint8_t *)addr)[15]) #define PRINTLLADDR(lladdr) PRINTF("[%02x:%02x:%02x:%02x:%02x:%02x]",(lladdr)->addr[0], (lladdr)->addr[1], (lladdr)->addr[2], (lladdr)->addr[3],(lladdr)->addr[4], (lladdr)->addr[5]) #else #define PRINTF(...) diff --git a/examples/er-rest-example/rest-server-example.c b/examples/er-rest-example/rest-server-example.c index 8373d9917..68183d1b1 100644 --- a/examples/er-rest-example/rest-server-example.c +++ b/examples/er-rest-example/rest-server-example.c @@ -95,7 +95,7 @@ #define DEBUG 0 #if DEBUG #define PRINTF(...) printf(__VA_ARGS__) -#define PRINT6ADDR(addr) PRINTF("[%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x]", ((u8_t *)addr)[0], ((u8_t *)addr)[1], ((u8_t *)addr)[2], ((u8_t *)addr)[3], ((u8_t *)addr)[4], ((u8_t *)addr)[5], ((u8_t *)addr)[6], ((u8_t *)addr)[7], ((u8_t *)addr)[8], ((u8_t *)addr)[9], ((u8_t *)addr)[10], ((u8_t *)addr)[11], ((u8_t *)addr)[12], ((u8_t *)addr)[13], ((u8_t *)addr)[14], ((u8_t *)addr)[15]) +#define PRINT6ADDR(addr) PRINTF("[%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x]", ((uint8_t *)addr)[0], ((uint8_t *)addr)[1], ((uint8_t *)addr)[2], ((uint8_t *)addr)[3], ((uint8_t *)addr)[4], ((uint8_t *)addr)[5], ((uint8_t *)addr)[6], ((uint8_t *)addr)[7], ((uint8_t *)addr)[8], ((uint8_t *)addr)[9], ((uint8_t *)addr)[10], ((uint8_t *)addr)[11], ((uint8_t *)addr)[12], ((uint8_t *)addr)[13], ((uint8_t *)addr)[14], ((uint8_t *)addr)[15]) #define PRINTLLADDR(lladdr) PRINTF("[%02x:%02x:%02x:%02x:%02x:%02x]",(lladdr)->addr[0], (lladdr)->addr[1], (lladdr)->addr[2], (lladdr)->addr[3],(lladdr)->addr[4], (lladdr)->addr[5]) #else #define PRINTF(...) diff --git a/examples/er-rest-example/static-routing.c b/examples/er-rest-example/static-routing.c index c2f0e3a25..628594892 100644 --- a/examples/er-rest-example/static-routing.c +++ b/examples/er-rest-example/static-routing.c @@ -12,7 +12,7 @@ #if DEBUG #include #define PRINTF(...) printf(__VA_ARGS__) -#define PRINT6ADDR(addr) PRINTF(" %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x ", ((u8_t *)addr)[0], ((u8_t *)addr)[1], ((u8_t *)addr)[2], ((u8_t *)addr)[3], ((u8_t *)addr)[4], ((u8_t *)addr)[5], ((u8_t *)addr)[6], ((u8_t *)addr)[7], ((u8_t *)addr)[8], ((u8_t *)addr)[9], ((u8_t *)addr)[10], ((u8_t *)addr)[11], ((u8_t *)addr)[12], ((u8_t *)addr)[13], ((u8_t *)addr)[14], ((u8_t *)addr)[15]) +#define PRINT6ADDR(addr) PRINTF(" %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x ", ((uint8_t *)addr)[0], ((uint8_t *)addr)[1], ((uint8_t *)addr)[2], ((uint8_t *)addr)[3], ((uint8_t *)addr)[4], ((uint8_t *)addr)[5], ((uint8_t *)addr)[6], ((uint8_t *)addr)[7], ((uint8_t *)addr)[8], ((uint8_t *)addr)[9], ((uint8_t *)addr)[10], ((uint8_t *)addr)[11], ((uint8_t *)addr)[12], ((uint8_t *)addr)[13], ((uint8_t *)addr)[14], ((uint8_t *)addr)[15]) #define PRINTLLADDR(lladdr) PRINTF(" %02x:%02x:%02x:%02x:%02x:%02x ",(lladdr)->addr[0], (lladdr)->addr[1], (lladdr)->addr[2], (lladdr)->addr[3],(lladdr)->addr[4], (lladdr)->addr[5]) #else #define PRINTF(...) diff --git a/examples/ipv6/native-border-router/slip-config.c b/examples/ipv6/native-border-router/slip-config.c index f36493eab..fb00d18cc 100644 --- a/examples/ipv6/native-border-router/slip-config.c +++ b/examples/ipv6/native-border-router/slip-config.c @@ -52,6 +52,8 @@ const char *slip_config_ipaddr; int slip_config_flowcontrol = 0; int slip_config_timestamp = 0; const char *slip_config_siodev = NULL; +const char *slip_config_host = NULL; +const char *slip_config_port = NULL; char slip_config_tundev[32] = { "" }; uint16_t slip_config_basedelay = 0; @@ -101,6 +103,14 @@ slip_config_handle_arguments(int argc, char **argv) } break; + case 'a': + slip_config_host = optarg; + break; + + case 'p': + slip_config_port = optarg; + break; + case 'd': slip_config_basedelay = 10; if(optarg) slip_config_basedelay = atoi(optarg); @@ -121,6 +131,8 @@ fprintf(stderr," -B baudrate 9600,19200,38400,57600,115200,921600 (default 11 fprintf(stderr," -H Hardware CTS/RTS flow control (default disabled)\n"); fprintf(stderr," -L Log output format (adds time stamps)\n"); fprintf(stderr," -s siodev Serial device (default /dev/ttyUSB0)\n"); +fprintf(stderr," -a host Connect via TCP to server at \n"); +fprintf(stderr," -p port Connect via TCP to server at :\n"); fprintf(stderr," -t tundev Name of interface (default tun0)\n"); fprintf(stderr," -v[level] Verbosity level\n"); fprintf(stderr," -v0 No messages\n"); diff --git a/examples/ipv6/native-border-router/slip-dev.c b/examples/ipv6/native-border-router/slip-dev.c index eb1fab1c4..6075b4121 100644 --- a/examples/ipv6/native-border-router/slip-dev.c +++ b/examples/ipv6/native-border-router/slip-dev.c @@ -43,22 +43,24 @@ #include #include #include -#include #include +#include #include - -#include -#include - +#include +#include +#include +#include #include + #include "net/netstack.h" #include "net/packetbuf.h" #include "cmd.h" extern int slip_config_verbose; -extern const char *slip_config_ipaddr; extern int slip_config_flowcontrol; extern const char *slip_config_siodev; +extern const char *slip_config_host; +extern const char *slip_config_port; extern uint16_t slip_config_basedelay; extern speed_t slip_config_b_rate; @@ -82,6 +84,62 @@ void slip_send(int fd, unsigned char c); #define SLIP_ESC_END 0334 #define SLIP_ESC_ESC 0335 +/*---------------------------------------------------------------------------*/ +static void * +get_in_addr(struct sockaddr *sa) +{ + if(sa->sa_family == AF_INET) { + return &(((struct sockaddr_in*)sa)->sin_addr); + } + return &(((struct sockaddr_in6*)sa)->sin6_addr); +} +/*---------------------------------------------------------------------------*/ +static int +connect_to_server(const char *host, const char *port) +{ + /* Setup TCP connection */ + struct addrinfo hints, *servinfo, *p; + char s[INET6_ADDRSTRLEN]; + int rv, fd; + + memset(&hints, 0, sizeof hints); + hints.ai_family = AF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + + if((rv = getaddrinfo(host, port, &hints, &servinfo)) != 0) { + err(1, "getaddrinfo: %s", gai_strerror(rv)); + return -1; + } + + /* loop through all the results and connect to the first we can */ + for(p = servinfo; p != NULL; p = p->ai_next) { + if((fd = socket(p->ai_family, p->ai_socktype, p->ai_protocol)) == -1) { + perror("client: socket"); + continue; + } + + if(connect(fd, p->ai_addr, p->ai_addrlen) == -1) { + close(fd); + perror("client: connect"); + continue; + } + break; + } + + if(p == NULL) { + err(1, "can't connect to ``%s:%s''", host, port); + return -1; + } + + fcntl(fd, F_SETFL, O_NONBLOCK); + + inet_ntop(p->ai_family, get_in_addr((struct sockaddr *)p->ai_addr), + s, sizeof(s)); + + /* all done with this structure */ + freeaddrinfo(servinfo); + return fd; +} /*---------------------------------------------------------------------------*/ int is_sensible_string(const unsigned char *s, int len) @@ -318,8 +376,9 @@ write_to_serial(int outfd, const uint8_t *inbuf, int len) void write_to_slip(const uint8_t *buf, int len) { - /* printf("Packet to SLIP: %d\n", len); */ - write_to_serial(slipfd, buf, len); + if(slipfd > 0) { + write_to_serial(slipfd, buf, len); + } } /*---------------------------------------------------------------------------*/ static void @@ -398,11 +457,25 @@ slip_init(void) { setvbuf(stdout, NULL, _IOLBF, 0); /* Line buffered output. */ - if(slip_config_siodev != NULL) { + if(slip_config_host != NULL) { + if(slip_config_port == NULL) { + slip_config_port = "60001"; + } + slipfd = connect_to_server(slip_config_host, slip_config_port); + if(slipfd == -1) { + err(1, "can't connect to ``%s:%s''", slip_config_host, slip_config_port); + } + + } else if(slip_config_siodev != NULL) { + if(strcmp(slip_config_siodev, "null") == 0) { + /* Disable slip */ + return; + } slipfd = devopen(slip_config_siodev, O_RDWR | O_NONBLOCK); if(slipfd == -1) { err(1, "can't open siodev ``/dev/%s''", slip_config_siodev); } + } else { static const char *siodevs[] = { "ttyUSB0", "cuaU0", "ucom0" /* linux, fbsd6, fbsd5 */ @@ -422,10 +495,18 @@ slip_init(void) select_set_callback(slipfd, &slip_callback); - fprintf(stderr, "********SLIP started on ``/dev/%s''\n", slip_config_siodev); - stty_telos(slipfd); + if(slip_config_host != NULL) { + fprintf(stderr, "********SLIP opened to ``%s:%s''\n", slip_config_host, + slip_config_port); + } else { + fprintf(stderr, "********SLIP started on ``/dev/%s''\n", slip_config_siodev); + stty_telos(slipfd); + } slip_send(slipfd, SLIP_END); inslip = fdopen(slipfd, "r"); - if(inslip == NULL) err(1, "main: fdopen"); + if(inslip == NULL) { + err(1, "main: fdopen"); + } } +/*---------------------------------------------------------------------------*/ diff --git a/examples/ipv6/sky-websense/wget.c b/examples/ipv6/sky-websense/wget.c index c8668a897..59be94edf 100644 --- a/examples/ipv6/sky-websense/wget.c +++ b/examples/ipv6/sky-websense/wget.c @@ -138,7 +138,7 @@ PROCESS_THREAD(wget_process, ev, data) } /*---------------------------------------------------------------------------*/ void -webclient_datahandler(char *data, u16_t len) +webclient_datahandler(char *data, uint16_t len) { if(len == 0) { #if STATS diff --git a/examples/mb851/webserver-ajax/ajax-cgi.c b/examples/mb851/webserver-ajax/ajax-cgi.c index 68c0f20d6..a9679c071 100644 --- a/examples/mb851/webserver-ajax/ajax-cgi.c +++ b/examples/mb851/webserver-ajax/ajax-cgi.c @@ -176,10 +176,10 @@ make_neighbor(void *arg) char ipaddr_str[41]; uip_ip6addr(&ipaddr, NET_ADDR_A, NET_ADDR_B, NET_ADDR_C, NET_ADDR_D, - (u16_t)(((u16_t)(n->addr.u8[0]^0x02))<<8 | (u16_t)n->addr.u8[1]), - ((u16_t)(n->addr.u8[2]))<<8 | (u16_t)n->addr.u8[3], - (u16_t)(n->addr.u8[4])<<8 | n->addr.u8[5], - (u16_t)(n->addr.u8[6])<<8 | n->addr.u8[7]); + (uint16_t)(((uint16_t)(n->addr.u8[0]^0x02))<<8 | (uint16_t)n->addr.u8[1]), + ((uint16_t)(n->addr.u8[2]))<<8 | (uint16_t)n->addr.u8[3], + (uint16_t)(n->addr.u8[4])<<8 | n->addr.u8[5], + (uint16_t)(n->addr.u8[6])<<8 | n->addr.u8[7]); httpd_sprint_ip6(ipaddr, ipaddr_str); return snprintf((char *)uip_appdata, uip_mss(), @@ -200,10 +200,10 @@ make_neighbor(void *arg) */ return snprintf((char *)uip_appdata, uip_mss(), "

  • %02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\r\n", - (u16_t)(((u16_t)(n->addr.u8[0]^0x02))<<8 | (u16_t)n->addr.u8[1]), - ((u16_t)(n->addr.u8[2]))<<8 | (u16_t)n->addr.u8[3], - (u16_t)(n->addr.u8[4])<<8 | n->addr.u8[5], - (u16_t)(n->addr.u8[6])<<8 | n->addr.u8[7], + (uint16_t)(((uint16_t)(n->addr.u8[0]^0x02))<<8 | (uint16_t)n->addr.u8[1]), + ((uint16_t)(n->addr.u8[2]))<<8 | (uint16_t)n->addr.u8[3], + (uint16_t)(n->addr.u8[4])<<8 | n->addr.u8[5], + (uint16_t)(n->addr.u8[6])<<8 | n->addr.u8[7], n->addr.u8[0], n->addr.u8[1], n->addr.u8[2], diff --git a/examples/mb851/webserver-ajax/httpd-fs.c b/examples/mb851/webserver-ajax/httpd-fs.c index 26ec392bf..a563bcb2c 100644 --- a/examples/mb851/webserver-ajax/httpd-fs.c +++ b/examples/mb851/webserver-ajax/httpd-fs.c @@ -41,14 +41,14 @@ #include "httpd-fsdata.c" #if HTTPD_FS_STATISTICS -static u16_t count[HTTPD_FS_NUMFILES]; +static uint16_t count[HTTPD_FS_NUMFILES]; #endif /* HTTPD_FS_STATISTICS */ /*-----------------------------------------------------------------------------------*/ -static u8_t +static uint8_t httpd_fs_strcmp(const char *str1, const char *str2) { - u8_t i; + uint8_t i; i = 0; loop: @@ -70,7 +70,7 @@ int httpd_fs_open(const char *name, struct httpd_fs_file *file) { #if HTTPD_FS_STATISTICS - u16_t i = 0; + uint16_t i = 0; #endif /* HTTPD_FS_STATISTICS */ struct httpd_fsdata_file_noconst *f; @@ -98,7 +98,7 @@ void httpd_fs_init(void) { #if HTTPD_FS_STATISTICS - u16_t i; + uint16_t i; for(i = 0; i < HTTPD_FS_NUMFILES; i++) { count[i] = 0; } @@ -106,11 +106,11 @@ httpd_fs_init(void) } /*-----------------------------------------------------------------------------------*/ #if HTTPD_FS_STATISTICS -u16_t +uint16_t httpd_fs_count(char *name) { struct httpd_fsdata_file_noconst *f; - u16_t i; + uint16_t i; i = 0; for(f = (struct httpd_fsdata_file_noconst *)HTTPD_FS_ROOT; diff --git a/examples/ravenusbstick/fakeuip.c b/examples/ravenusbstick/fakeuip.c index fb5dc7ace..0b8bd57d6 100644 --- a/examples/ravenusbstick/fakeuip.c +++ b/examples/ravenusbstick/fakeuip.c @@ -11,13 +11,13 @@ uip_buf_t uip_aligned_buf; -u16_t uip_len; +uint16_t uip_len; struct uip_stats uip_stat; uip_lladdr_t uip_lladdr; -static u8_t (* output)(uip_lladdr_t *); +static uint8_t (* output)(uip_lladdr_t *); extern void mac_LowpanToEthernet(void); void tcpip_input( void ) { @@ -25,18 +25,18 @@ void tcpip_input( void ) mac_LowpanToEthernet(); } -u8_t tcpip_output(uip_lladdr_t * lladdr){ +uint8_t tcpip_output(uip_lladdr_t * lladdr){ if(output != NULL) { return output(lladdr); } return 0; } //Called from sicslowpan.c -void tcpip_set_outputfunc(u8_t (* f)(uip_lladdr_t *)) { +void tcpip_set_outputfunc(uint8_t (* f)(uip_lladdr_t *)) { output = f; } -u16_t uip_htons(u16_t val) { return UIP_HTONS(val);} +uint16_t uip_htons(uint16_t val) { return UIP_HTONS(val);} #if THEOLDWAY @@ -73,12 +73,12 @@ uip_ds6_set_addr_iid(uip_ipaddr_t * ipaddr, uip_lladdr_t * lladdr) /********** UIP.c ****************/ -static u16_t -chksum(u16_t sum, const u8_t *data, u16_t len) +static uint16_t +chksum(uint16_t sum, const uint8_t *data, uint16_t len) { - u16_t t; - const u8_t *dataptr; - const u8_t *last_byte; + uint16_t t; + const uint8_t *dataptr; + const uint8_t *last_byte; dataptr = data; last_byte = data + len - 1; @@ -104,19 +104,19 @@ chksum(u16_t sum, const u8_t *data, u16_t len) return sum; } -static u16_t -upper_layer_chksum(u8_t proto) +static uint16_t +upper_layer_chksum(uint8_t proto) { - u16_t upper_layer_len; - u16_t sum; + uint16_t upper_layer_len; + uint16_t sum; - upper_layer_len = (((u16_t)(UIP_IP_BUF->len[0]) << 8) + UIP_IP_BUF->len[1]) ; + upper_layer_len = (((uint16_t)(UIP_IP_BUF->len[0]) << 8) + UIP_IP_BUF->len[1]) ; /* First sum pseudoheader. */ /* IP protocol and length fields. This addition cannot carry. */ sum = upper_layer_len + proto; /* Sum IP source and destination addresses. */ - sum = chksum(sum, (u8_t *)&UIP_IP_BUF->srcipaddr, 2 * sizeof(uip_ipaddr_t)); + sum = chksum(sum, (uint8_t *)&UIP_IP_BUF->srcipaddr, 2 * sizeof(uip_ipaddr_t)); /* Sum TCP header and data. */ sum = chksum(sum, &uip_buf[UIP_IPH_LEN + UIP_LLH_LEN], @@ -126,7 +126,7 @@ upper_layer_chksum(u8_t proto) } /*---------------------------------------------------------------------------*/ -u16_t +uint16_t uip_icmp6chksum(void) { return upper_layer_chksum(UIP_PROTO_ICMP6); diff --git a/examples/rest-example/coap-client-example.c b/examples/rest-example/coap-client-example.c index c9e6e3776..e5772f103 100644 --- a/examples/rest-example/coap-client-example.c +++ b/examples/rest-example/coap-client-example.c @@ -10,7 +10,7 @@ #if DEBUG #include #define PRINTF(...) printf(__VA_ARGS__) -#define PRINT6ADDR(addr) PRINTF("%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x", ((u8_t *)addr)[0], ((u8_t *)addr)[1], ((u8_t *)addr)[2], ((u8_t *)addr)[3], ((u8_t *)addr)[4], ((u8_t *)addr)[5], ((u8_t *)addr)[6], ((u8_t *)addr)[7], ((u8_t *)addr)[8], ((u8_t *)addr)[9], ((u8_t *)addr)[10], ((u8_t *)addr)[11], ((u8_t *)addr)[12], ((u8_t *)addr)[13], ((u8_t *)addr)[14], ((u8_t *)addr)[15]) +#define PRINT6ADDR(addr) PRINTF("%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x", ((uint8_t *)addr)[0], ((uint8_t *)addr)[1], ((uint8_t *)addr)[2], ((uint8_t *)addr)[3], ((uint8_t *)addr)[4], ((uint8_t *)addr)[5], ((uint8_t *)addr)[6], ((uint8_t *)addr)[7], ((uint8_t *)addr)[8], ((uint8_t *)addr)[9], ((uint8_t *)addr)[10], ((uint8_t *)addr)[11], ((uint8_t *)addr)[12], ((uint8_t *)addr)[13], ((uint8_t *)addr)[14], ((uint8_t *)addr)[15]) #define PRINTLLADDR(lladdr) PRINTF(" %02x:%02x:%02x:%02x:%02x:%02x ",(lladdr)->addr[0], (lladdr)->addr[1], (lladdr)->addr[2], (lladdr)->addr[3],(lladdr)->addr[4], (lladdr)->addr[5]) #else #define PRINTF(...) @@ -77,7 +77,7 @@ send_data(void) static void handle_incoming_data() { - PRINTF("Incoming packet size: %u \n", (u16_t)uip_datalen()); + PRINTF("Incoming packet size: %u \n", (uint16_t)uip_datalen()); if (init_buffer(COAP_DATA_BUFF_SIZE)) { if (uip_newdata()) { coap_packet_t* response = (coap_packet_t*)allocate_buffer(sizeof(coap_packet_t)); diff --git a/examples/rest-example/rest-server-example.c b/examples/rest-example/rest-server-example.c index ee2f79348..d13d9c1d9 100644 --- a/examples/rest-example/rest-server-example.c +++ b/examples/rest-example/rest-server-example.c @@ -22,7 +22,7 @@ #if DEBUG #include #define PRINTF(...) printf(__VA_ARGS__) -#define PRINT6ADDR(addr) PRINTF(" %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x ", ((u8_t *)addr)[0], ((u8_t *)addr)[1], ((u8_t *)addr)[2], ((u8_t *)addr)[3], ((u8_t *)addr)[4], ((u8_t *)addr)[5], ((u8_t *)addr)[6], ((u8_t *)addr)[7], ((u8_t *)addr)[8], ((u8_t *)addr)[9], ((u8_t *)addr)[10], ((u8_t *)addr)[11], ((u8_t *)addr)[12], ((u8_t *)addr)[13], ((u8_t *)addr)[14], ((u8_t *)addr)[15]) +#define PRINT6ADDR(addr) PRINTF(" %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x ", ((uint8_t *)addr)[0], ((uint8_t *)addr)[1], ((uint8_t *)addr)[2], ((uint8_t *)addr)[3], ((uint8_t *)addr)[4], ((uint8_t *)addr)[5], ((uint8_t *)addr)[6], ((uint8_t *)addr)[7], ((uint8_t *)addr)[8], ((uint8_t *)addr)[9], ((uint8_t *)addr)[10], ((uint8_t *)addr)[11], ((uint8_t *)addr)[12], ((uint8_t *)addr)[13], ((uint8_t *)addr)[14], ((uint8_t *)addr)[15]) #define PRINTLLADDR(lladdr) PRINTF(" %02x:%02x:%02x:%02x:%02x:%02x ",(lladdr)->addr[0], (lladdr)->addr[1], (lladdr)->addr[2], (lladdr)->addr[3],(lladdr)->addr[4], (lladdr)->addr[5]) #else #define PRINTF(...) diff --git a/examples/sensinode/clock_test.c b/examples/sensinode/clock_test.c index 758b4d040..dfbe3d23d 100644 --- a/examples/sensinode/clock_test.c +++ b/examples/sensinode/clock_test.c @@ -19,7 +19,7 @@ PROCESS_THREAD(clock_test_process, ev, data) static struct etimer et; static clock_time_t count, start_count, end_count, diff; static unsigned long sec; - static u8_t i; + static uint8_t i; PROCESS_BEGIN(); @@ -56,7 +56,7 @@ PROCESS_THREAD(clock_test_process, ev, data) etimer_reset(&et); sec = clock_seconds(); - printf("%u seconds\n", (u16_t) sec); + printf("%u seconds\n", (uint16_t) sec); leds_toggle(LEDS_GREEN); i++; diff --git a/examples/sky-ip/httpd-fs.c b/examples/sky-ip/httpd-fs.c index 8b77643fd..3c6cc7f61 100644 --- a/examples/sky-ip/httpd-fs.c +++ b/examples/sky-ip/httpd-fs.c @@ -41,14 +41,14 @@ #include "httpd-fsdata.c" #if HTTPD_FS_STATISTICS -static u16_t count[HTTPD_FS_NUMFILES]; +static uint16_t count[HTTPD_FS_NUMFILES]; #endif /* HTTPD_FS_STATISTICS */ /*-----------------------------------------------------------------------------------*/ -static u8_t +static uint8_t httpd_fs_strcmp(const char *str1, const char *str2) { - u8_t i; + uint8_t i; i = 0; loop: @@ -70,7 +70,7 @@ int httpd_fs_open(const char *name, struct httpd_fs_file *file) { #if HTTPD_FS_STATISTICS - u16_t i = 0; + uint16_t i = 0; #endif /* HTTPD_FS_STATISTICS */ struct httpd_fsdata_file_noconst *f; @@ -98,7 +98,7 @@ void httpd_fs_init(void) { #if HTTPD_FS_STATISTICS - u16_t i; + uint16_t i; for(i = 0; i < HTTPD_FS_NUMFILES; i++) { count[i] = 0; } @@ -106,11 +106,11 @@ httpd_fs_init(void) } /*-----------------------------------------------------------------------------------*/ #if HTTPD_FS_STATISTICS -u16_t +uint16_t httpd_fs_count(char *name) { struct httpd_fsdata_file_noconst *f; - u16_t i; + uint16_t i; i = 0; for(f = (struct httpd_fsdata_file_noconst *)HTTPD_FS_ROOT; diff --git a/examples/sky-ip/httpd-fsdata.c b/examples/sky-ip/httpd-fsdata.c index fbeaea5c8..0b37f287b 100644 --- a/examples/sky-ip/httpd-fsdata.c +++ b/examples/sky-ip/httpd-fsdata.c @@ -436,7 +436,7 @@ struct httpd_fsdata_file { const char *data; //offset to coffee file data const int len; //length of file data #if HTTPD_FS_STATISTICS == 1 //not enabled since list is in PROGMEM - u16_t count; //storage for file statistics + uint16_t count; //storage for file statistics #endif } */ diff --git a/examples/test-ipv6/tapdev.h b/examples/test-ipv6/tapdev.h index 544cdb104..822f694da 100644 --- a/examples/test-ipv6/tapdev.h +++ b/examples/test-ipv6/tapdev.h @@ -40,7 +40,7 @@ #include "contiki-net.h" void tapdev_init(void); -u8_t tapdev_send(void); -u16_t tapdev_poll(void); +uint8_t tapdev_send(void); +uint16_t tapdev_poll(void); void tapdev_do_send(void); #endif /* __TAPDEV_H__ */ diff --git a/examples/test-ipv6/tapdev6.c b/examples/test-ipv6/tapdev6.c index 0b7b1ee2a..679d2517e 100644 --- a/examples/test-ipv6/tapdev6.c +++ b/examples/test-ipv6/tapdev6.c @@ -75,10 +75,10 @@ static unsigned long lasttime; #define IPBUF ((struct uip_tcpip_hdr *)&uip_buf[UIP_LLH_LEN]) static void do_send(void); -u8_t tapdev_send(void); +uint8_t tapdev_send(void); -u16_t +uint16_t tapdev_poll(void) { fd_set fdset; @@ -174,8 +174,8 @@ do_send(void) } /*---------------------------------------------------------------------------*/ #define DEBUG_PRINTF(...) printf(__VA_ARGS__) -#define DEBUG_PRINT6ADDR(addr) DEBUG_PRINTF("%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x", ((u8_t *)addr)[0], ((u8_t *)addr)[1], ((u8_t *)addr)[2], ((u8_t *)addr)[3], ((u8_t *)addr)[4], ((u8_t *)addr)[5], ((u8_t *)addr)[6], ((u8_t *)addr)[7], ((u8_t *)addr)[8], ((u8_t *)addr)[9], ((u8_t *)addr)[10], ((u8_t *)addr)[11], ((u8_t *)addr)[12], ((u8_t *)addr)[13], ((u8_t *)addr)[14], ((u8_t *)addr)[15]) -u8_t +#define DEBUG_PRINT6ADDR(addr) DEBUG_PRINTF("%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x", ((uint8_t *)addr)[0], ((uint8_t *)addr)[1], ((uint8_t *)addr)[2], ((uint8_t *)addr)[3], ((uint8_t *)addr)[4], ((uint8_t *)addr)[5], ((uint8_t *)addr)[6], ((uint8_t *)addr)[7], ((uint8_t *)addr)[8], ((uint8_t *)addr)[9], ((uint8_t *)addr)[10], ((uint8_t *)addr)[11], ((uint8_t *)addr)[12], ((uint8_t *)addr)[13], ((uint8_t *)addr)[14], ((uint8_t *)addr)[15]) +uint8_t tapdev_send(void) { struct uip_neighbor_addr *addr; diff --git a/examples/wget/wget.c b/examples/wget/wget.c index f540b6428..dfb336220 100644 --- a/examples/wget/wget.c +++ b/examples/wget/wget.c @@ -236,7 +236,7 @@ webclient_connected(void) * has arrived. */ void -webclient_datahandler(char *data, u16_t len) +webclient_datahandler(char *data, uint16_t len) { static unsigned long dload_bytes; int ret; diff --git a/examples/z1/ipv6/z1-websense/wget.c b/examples/z1/ipv6/z1-websense/wget.c index cf28758a1..2a7c0241c 100644 --- a/examples/z1/ipv6/z1-websense/wget.c +++ b/examples/z1/ipv6/z1-websense/wget.c @@ -107,7 +107,7 @@ PROCESS_THREAD(wget_process, ev, data) } /*---------------------------------------------------------------------------*/ void -webclient_datahandler(char *data, u16_t len) +webclient_datahandler(char *data, uint16_t len) { if(len == 0) { #if STATS diff --git a/examples/z1/test-adxl345.c b/examples/z1/test-adxl345.c index 005c8a7b4..48fa175dd 100644 --- a/examples/z1/test-adxl345.c +++ b/examples/z1/test-adxl345.c @@ -99,24 +99,24 @@ print_int(uint16_t reg){ /* accelerometer free fall detection callback */ void -accm_ff_cb(u8_t reg){ +accm_ff_cb(uint8_t reg){ L_ON(LEDS_B); process_post(&led_process, ledOff_event, NULL); - printf("~~[%u] Freefall detected! (0x%02X) -- ", ((u16_t) clock_time())/128, reg); + printf("~~[%u] Freefall detected! (0x%02X) -- ", ((uint16_t) clock_time())/128, reg); print_int(reg); } /*---------------------------------------------------------------------------*/ /* accelerometer tap and double tap detection callback */ void -accm_tap_cb(u8_t reg){ +accm_tap_cb(uint8_t reg){ process_post(&led_process, ledOff_event, NULL); if(reg & ADXL345_INT_DOUBLETAP){ L_ON(LEDS_G); - printf("~~[%u] DoubleTap detected! (0x%02X) -- ", ((u16_t) clock_time())/128, reg); + printf("~~[%u] DoubleTap detected! (0x%02X) -- ", ((uint16_t) clock_time())/128, reg); } else { L_ON(LEDS_R); - printf("~~[%u] Tap detected! (0x%02X) -- ", ((u16_t) clock_time())/128, reg); + printf("~~[%u] Tap detected! (0x%02X) -- ", ((uint16_t) clock_time())/128, reg); } print_int(reg); } @@ -145,11 +145,11 @@ PROCESS_THREAD(led_process, ev, data) { printf("Port1: %s\n", char2bin(P1IN)); */ /* -static u8_t b[9]; +static uint8_t b[9]; -static u8_t -*char2bin(u8_t x) { - u8_t z; +static uint8_t +*char2bin(uint8_t x) { + uint8_t z; b[8] = '\0'; for (z = 0; z < 8; z++) { b[7-z] = (x & (1 << z)) ? '1' : '0'; diff --git a/platform/avr-atmega128rfa1/apps/raven-ipso/raven-ipso.c b/platform/avr-atmega128rfa1/apps/raven-ipso/raven-ipso.c index 1ba134848..4e82eb959 100644 --- a/platform/avr-atmega128rfa1/apps/raven-ipso/raven-ipso.c +++ b/platform/avr-atmega128rfa1/apps/raven-ipso/raven-ipso.c @@ -69,18 +69,18 @@ #define cmd_len 8 #define data_len 20 -static u8_t seqno; +static uint8_t seqno; uip_ipaddr_t ping_addr; uip_ipaddr_t udp_addr; static struct uip_udp_conn *udp_conn; char udp_data[data_len]; static struct{ - u8_t frame[cmd_len]; - u8_t ndx; - u8_t len; - u8_t cmd; - u8_t done; + uint8_t frame[cmd_len]; + uint8_t ndx; + uint8_t len; + uint8_t cmd; + uint8_t done; } cmd; #define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN]) @@ -114,8 +114,8 @@ raven_ping6(void) memset((void *)UIP_ICMP_BUF + UIP_ICMPH_LEN, 0, 4); uip_len = UIP_ICMPH_LEN + UIP_ICMP6_ECHO_REQUEST_LEN + UIP_IPH_LEN; - UIP_IP_BUF->len[0] = (u8_t)((uip_len - 40) >> 8); - UIP_IP_BUF->len[1] = (u8_t)((uip_len - 40) & 0x00FF); + UIP_IP_BUF->len[0] = (uint8_t)((uip_len - 40) >> 8); + UIP_IP_BUF->len[1] = (uint8_t)((uip_len - 40) & 0x00FF); UIP_ICMP_BUF->icmpchksum = 0; UIP_ICMP_BUF->icmpchksum = ~uip_icmp6chksum(); @@ -140,7 +140,7 @@ send_frame(uint8_t cmd, uint8_t len, uint8_t *payload) } /*------------------------------------------------------------------*/ -static u8_t +static uint8_t raven_gui_loop(process_event_t ev, process_data_t data) { if(ev == tcpip_icmp6_event) { @@ -235,7 +235,7 @@ int raven_lcd_serial_input(unsigned char ch) PROCESS(raven_lcd_process, "Raven LCD interface process"); PROCESS_THREAD(raven_lcd_process, ev, data) { - u8_t error; + uint8_t error; PROCESS_BEGIN(); diff --git a/platform/avr-atmega128rfa1/apps/raven-lcd-interface/raven-lcd.c b/platform/avr-atmega128rfa1/apps/raven-lcd-interface/raven-lcd.c index 9fd7d7784..c4668f7d3 100644 --- a/platform/avr-atmega128rfa1/apps/raven-lcd-interface/raven-lcd.c +++ b/platform/avr-atmega128rfa1/apps/raven-lcd-interface/raven-lcd.c @@ -76,17 +76,17 @@ #include #include -static u8_t count = 0; -static u8_t seqno; +static uint8_t count = 0; +static uint8_t seqno; uip_ipaddr_t dest_addr; #define MAX_CMD_LEN 20 static struct{ - u8_t frame[MAX_CMD_LEN]; - u8_t ndx; - u8_t len; - u8_t cmd; - u8_t done; + uint8_t frame[MAX_CMD_LEN]; + uint8_t ndx; + uint8_t len; + uint8_t cmd; + uint8_t done; } cmd; #define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN]) @@ -138,8 +138,8 @@ seqno++; uip_len = UIP_ICMPH_LEN + UIP_ICMP6_ECHO_REQUEST_LEN + UIP_IPH_LEN + PING6_DATALEN; - UIP_IP_BUF->len[0] = (u8_t)((uip_len - 40) >> 8); - UIP_IP_BUF->len[1] = (u8_t)((uip_len - 40) & 0x00FF); + UIP_IP_BUF->len[0] = (uint8_t)((uip_len - 40) >> 8); + UIP_IP_BUF->len[1] = (uint8_t)((uip_len - 40) & 0x00FF); UIP_ICMP_BUF->icmpchksum = 0; UIP_ICMP_BUF->icmpchksum = ~uip_icmp6chksum(); @@ -262,13 +262,13 @@ ISR(TIMER2_COMPA_vect) #endif /* !AVR_CONF_USE32KCRYSTAL */ #if DEBUGSERIAL -u8_t serialcount; +uint8_t serialcount; char dbuf[30]; #endif /*---------------------------------------------------------------------------*/ extern uint16_t ledtimer; -static u8_t +static uint8_t raven_gui_loop(process_event_t ev, process_data_t data) { uint8_t i,activeconnections,radio_state; diff --git a/platform/avr-atmega128rfa1/apps/raven-webserver/httpd-cgi.c b/platform/avr-atmega128rfa1/apps/raven-webserver/httpd-cgi.c index 78fd68626..36a47a661 100644 --- a/platform/avr-atmega128rfa1/apps/raven-webserver/httpd-cgi.c +++ b/platform/avr-atmega128rfa1/apps/raven-webserver/httpd-cgi.c @@ -165,7 +165,7 @@ generate_file_stats(void *arg) static const char httpd_cgi_filestat3[] HTTPD_STRING_ATTR = "%5u"; char tmp[20]; struct httpd_fsdata_file_noconst *f,fram; - u16_t i; + uint16_t i; unsigned short numprinted; /* Transfer arg from whichever flash that contains the html file to RAM */ diff --git a/platform/avr-atmega128rfa1/apps/raven-webserver/httpd-fs.c b/platform/avr-atmega128rfa1/apps/raven-webserver/httpd-fs.c index f33eec073..21b0d7cdc 100644 --- a/platform/avr-atmega128rfa1/apps/raven-webserver/httpd-fs.c +++ b/platform/avr-atmega128rfa1/apps/raven-webserver/httpd-fs.c @@ -40,7 +40,7 @@ #include "httpd-fsdata.c" #if HTTPD_FS_STATISTICS==2 -u16_t httpd_filecount[HTTPD_FS_NUMFILES]; +uint16_t httpd_filecount[HTTPD_FS_NUMFILES]; #endif /* HTTPD_FS_STATISTICS */ /*-----------------------------------------------------------------------------------*/ @@ -50,18 +50,18 @@ httpd_fs_get_root() return (void *)HTTPD_FS_ROOT; } /*-----------------------------------------------------------------------------------*/ -u16_t +uint16_t httpd_fs_get_size() { return HTTPD_FS_SIZE; } /*-----------------------------------------------------------------------------------*/ -u16_t +uint16_t httpd_fs_open(const char *name, struct httpd_fs_file *file) { #if HTTPD_FS_STATISTICS - u16_t i = 0; + uint16_t i = 0; #endif /* HTTPD_FS_STATISTICS */ struct httpd_fsdata_file_noconst *f,fram; @@ -103,7 +103,7 @@ void httpd_fs_init(void) { #if HTTPD_FS_STATISTICS && 0 //count will already be zero at boot - u16_t i; + uint16_t i; for(i = 0; i < HTTPD_FS_NUMFILES; i++) { count[i] = 0; } @@ -111,11 +111,11 @@ httpd_fs_init(void) } /*-----------------------------------------------------------------------------------*/ #if HTTPD_FS_STATISTICS && 0 //Not needed, httpd_fs_open returns count -u16_t +uint16_t httpd_fs_count(char *name) { struct httpd_fsdata_file_noconst *f,fram; - u16_t i; + uint16_t i; i = 0; for(f = (struct httpd_fsdata_file_noconst *)HTTPD_FS_ROOT; diff --git a/platform/avr-atmega128rfa1/apps/raven-webserver/httpd-fs.h b/platform/avr-atmega128rfa1/apps/raven-webserver/httpd-fs.h index a40971b99..fc0893d55 100644 --- a/platform/avr-atmega128rfa1/apps/raven-webserver/httpd-fs.h +++ b/platform/avr-atmega128rfa1/apps/raven-webserver/httpd-fs.h @@ -41,7 +41,7 @@ #define HTTPD_FS_STATISTICS 2 //Puts count in RAM array #if HTTPD_FS_STATISTICS==2 -extern u16_t httpd_filecount[]; +extern uint16_t httpd_filecount[]; #endif /* HTTPD_FS_STATISTICS */ #include @@ -59,12 +59,12 @@ void httpd_fs_init(void); /* Returns root of http files in program flash */ void* httpd_fs_get_root(); /* Returns size of http files in any flash */ -u16_t httpd_fs_get_size(); +uint16_t httpd_fs_get_size(); /* Open a file in any flash and return statistics if enabled. If file is allocated by caller it will be filled in. If NULL, just file stats are returned. */ -u16_t httpd_fs_open(const char *name, struct httpd_fs_file *file); +uint16_t httpd_fs_open(const char *name, struct httpd_fs_file *file); #if COFFEE_FILES /* Coffee file system can be static or dynamic. If static, new files diff --git a/platform/avr-atmega128rfa1/apps/raven-webserver/httpd-fsdata.c b/platform/avr-atmega128rfa1/apps/raven-webserver/httpd-fsdata.c index 4480bb838..68d44b750 100644 --- a/platform/avr-atmega128rfa1/apps/raven-webserver/httpd-fsdata.c +++ b/platform/avr-atmega128rfa1/apps/raven-webserver/httpd-fsdata.c @@ -625,7 +625,7 @@ struct httpd_fsdata_file { const char *data; //offset to coffee file data const int len; //length of file data #if HTTPD_FS_STATISTICS == 1 //not enabled since list is in PROGMEM - u16_t count; //storage for file statistics + uint16_t count; //storage for file statistics #endif } */ diff --git a/platform/avr-atmega128rfa1/apps/raven-webserver/httpd-fsdata.h b/platform/avr-atmega128rfa1/apps/raven-webserver/httpd-fsdata.h index 9da15d820..f269ad75a 100644 --- a/platform/avr-atmega128rfa1/apps/raven-webserver/httpd-fsdata.h +++ b/platform/avr-atmega128rfa1/apps/raven-webserver/httpd-fsdata.h @@ -43,7 +43,7 @@ struct httpd_fsdata_file { const char *data; const int len; #if HTTPD_FS_STATISTICS == 1 - u16_t count; + uint16_t count; #endif /* HTTPD_FS_STATISTICS */ }; @@ -53,7 +53,7 @@ struct httpd_fsdata_file_noconst { char *data; int len; #if HTTPD_FS_STATISTICS == 1 - u16_t count; + uint16_t count; #endif /* HTTPD_FS_STATISTICS */ }; diff --git a/platform/avr-atmega128rfa1/contiki-conf.h b/platform/avr-atmega128rfa1/contiki-conf.h index b5bb94ef3..5ca971204 100644 --- a/platform/avr-atmega128rfa1/contiki-conf.h +++ b/platform/avr-atmega128rfa1/contiki-conf.h @@ -49,10 +49,12 @@ #endif #include +/* These names are deprecated, use C99 names. */ typedef int32_t s32_t; typedef unsigned char u8_t; typedef unsigned short u16_t; typedef unsigned long u32_t; + typedef unsigned short clock_time_t; typedef unsigned short uip_stats_t; typedef unsigned long off_t; diff --git a/platform/avr-atmega128rfa1/params.c b/platform/avr-atmega128rfa1/params.c index 480ee3ee5..aadbb83c4 100644 --- a/platform/avr-atmega128rfa1/params.c +++ b/platform/avr-atmega128rfa1/params.c @@ -77,9 +77,9 @@ extern uint8_t default_mac_address[8]; extern uint8_t default_server_name[16]; extern uint8_t default_domain_name[30]; #else -uint8_t default_mac_address[8] PROGMEM = PARAMS_EUI64ADDR; -uint8_t default_server_name[] PROGMEM = PARAMS_SERVERNAME; -uint8_t default_domain_name[] PROGMEM = PARAMS_DOMAINNAME; +const uint8_t default_mac_address[8] PROGMEM = PARAMS_EUI64ADDR; +const uint8_t default_server_name[] PROGMEM = PARAMS_SERVERNAME; +const uint8_t default_domain_name[] PROGMEM = PARAMS_DOMAINNAME; #endif #if PARAMETER_STORAGE==0 diff --git a/platform/avr-raven/apps/raven-ipso/raven-ipso.c b/platform/avr-raven/apps/raven-ipso/raven-ipso.c index 1ba134848..4e82eb959 100644 --- a/platform/avr-raven/apps/raven-ipso/raven-ipso.c +++ b/platform/avr-raven/apps/raven-ipso/raven-ipso.c @@ -69,18 +69,18 @@ #define cmd_len 8 #define data_len 20 -static u8_t seqno; +static uint8_t seqno; uip_ipaddr_t ping_addr; uip_ipaddr_t udp_addr; static struct uip_udp_conn *udp_conn; char udp_data[data_len]; static struct{ - u8_t frame[cmd_len]; - u8_t ndx; - u8_t len; - u8_t cmd; - u8_t done; + uint8_t frame[cmd_len]; + uint8_t ndx; + uint8_t len; + uint8_t cmd; + uint8_t done; } cmd; #define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN]) @@ -114,8 +114,8 @@ raven_ping6(void) memset((void *)UIP_ICMP_BUF + UIP_ICMPH_LEN, 0, 4); uip_len = UIP_ICMPH_LEN + UIP_ICMP6_ECHO_REQUEST_LEN + UIP_IPH_LEN; - UIP_IP_BUF->len[0] = (u8_t)((uip_len - 40) >> 8); - UIP_IP_BUF->len[1] = (u8_t)((uip_len - 40) & 0x00FF); + UIP_IP_BUF->len[0] = (uint8_t)((uip_len - 40) >> 8); + UIP_IP_BUF->len[1] = (uint8_t)((uip_len - 40) & 0x00FF); UIP_ICMP_BUF->icmpchksum = 0; UIP_ICMP_BUF->icmpchksum = ~uip_icmp6chksum(); @@ -140,7 +140,7 @@ send_frame(uint8_t cmd, uint8_t len, uint8_t *payload) } /*------------------------------------------------------------------*/ -static u8_t +static uint8_t raven_gui_loop(process_event_t ev, process_data_t data) { if(ev == tcpip_icmp6_event) { @@ -235,7 +235,7 @@ int raven_lcd_serial_input(unsigned char ch) PROCESS(raven_lcd_process, "Raven LCD interface process"); PROCESS_THREAD(raven_lcd_process, ev, data) { - u8_t error; + uint8_t error; PROCESS_BEGIN(); diff --git a/platform/avr-raven/apps/raven-lcd-interface/raven-lcd.c b/platform/avr-raven/apps/raven-lcd-interface/raven-lcd.c index d2624760a..070e5db5f 100644 --- a/platform/avr-raven/apps/raven-lcd-interface/raven-lcd.c +++ b/platform/avr-raven/apps/raven-lcd-interface/raven-lcd.c @@ -79,17 +79,17 @@ #include #include -static u8_t count = 0; -static u8_t seqno; +static uint8_t count = 0; +static uint8_t seqno; uip_ipaddr_t dest_addr; #define MAX_CMD_LEN 20 static struct{ - u8_t frame[MAX_CMD_LEN]; - u8_t ndx; - u8_t len; - u8_t cmd; - u8_t done; + uint8_t frame[MAX_CMD_LEN]; + uint8_t ndx; + uint8_t len; + uint8_t cmd; + uint8_t done; } cmd; #define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN]) @@ -137,8 +137,8 @@ raven_ping6(void) uip_len = UIP_ICMPH_LEN + UIP_ICMP6_ECHO_REQUEST_LEN + UIP_IPH_LEN + PING6_DATALEN; - UIP_IP_BUF->len[0] = (u8_t)((uip_len - 40) >> 8); - UIP_IP_BUF->len[1] = (u8_t)((uip_len - 40) & 0x00FF); + UIP_IP_BUF->len[0] = (uint8_t)((uip_len - 40) >> 8); + UIP_IP_BUF->len[1] = (uint8_t)((uip_len - 40) & 0x00FF); UIP_ICMP_BUF->icmpchksum = 0; UIP_ICMP_BUF->icmpchksum = ~uip_icmp6chksum(); @@ -253,12 +253,12 @@ ISR(TIMER2_COMPA_vect) #endif /* !AVR_CONF_USE32KCRYSTAL */ #if DEBUGSERIAL -u8_t serialcount; +uint8_t serialcount; char dbuf[30]; #endif /*---------------------------------------------------------------------------*/ -static u8_t +static uint8_t raven_gui_loop(process_event_t ev, process_data_t data) { uint8_t i,activeconnections,radio_state; diff --git a/platform/avr-raven/apps/raven-webserver/httpd-cgi.c b/platform/avr-raven/apps/raven-webserver/httpd-cgi.c index 3034775c8..f271c3738 100644 --- a/platform/avr-raven/apps/raven-webserver/httpd-cgi.c +++ b/platform/avr-raven/apps/raven-webserver/httpd-cgi.c @@ -166,7 +166,7 @@ generate_file_stats(void *arg) static const char httpd_cgi_filestat3[] HTTPD_STRING_ATTR = "%5u"; char tmp[20]; struct httpd_fsdata_file_noconst *f,fram; - u16_t i; + uint16_t i; unsigned short numprinted; /* Transfer arg from whichever flash that contains the html file to RAM */ diff --git a/platform/avr-raven/apps/raven-webserver/httpd-fs.c b/platform/avr-raven/apps/raven-webserver/httpd-fs.c index f33eec073..21b0d7cdc 100644 --- a/platform/avr-raven/apps/raven-webserver/httpd-fs.c +++ b/platform/avr-raven/apps/raven-webserver/httpd-fs.c @@ -40,7 +40,7 @@ #include "httpd-fsdata.c" #if HTTPD_FS_STATISTICS==2 -u16_t httpd_filecount[HTTPD_FS_NUMFILES]; +uint16_t httpd_filecount[HTTPD_FS_NUMFILES]; #endif /* HTTPD_FS_STATISTICS */ /*-----------------------------------------------------------------------------------*/ @@ -50,18 +50,18 @@ httpd_fs_get_root() return (void *)HTTPD_FS_ROOT; } /*-----------------------------------------------------------------------------------*/ -u16_t +uint16_t httpd_fs_get_size() { return HTTPD_FS_SIZE; } /*-----------------------------------------------------------------------------------*/ -u16_t +uint16_t httpd_fs_open(const char *name, struct httpd_fs_file *file) { #if HTTPD_FS_STATISTICS - u16_t i = 0; + uint16_t i = 0; #endif /* HTTPD_FS_STATISTICS */ struct httpd_fsdata_file_noconst *f,fram; @@ -103,7 +103,7 @@ void httpd_fs_init(void) { #if HTTPD_FS_STATISTICS && 0 //count will already be zero at boot - u16_t i; + uint16_t i; for(i = 0; i < HTTPD_FS_NUMFILES; i++) { count[i] = 0; } @@ -111,11 +111,11 @@ httpd_fs_init(void) } /*-----------------------------------------------------------------------------------*/ #if HTTPD_FS_STATISTICS && 0 //Not needed, httpd_fs_open returns count -u16_t +uint16_t httpd_fs_count(char *name) { struct httpd_fsdata_file_noconst *f,fram; - u16_t i; + uint16_t i; i = 0; for(f = (struct httpd_fsdata_file_noconst *)HTTPD_FS_ROOT; diff --git a/platform/avr-raven/apps/raven-webserver/httpd-fs.h b/platform/avr-raven/apps/raven-webserver/httpd-fs.h index a40971b99..fc0893d55 100644 --- a/platform/avr-raven/apps/raven-webserver/httpd-fs.h +++ b/platform/avr-raven/apps/raven-webserver/httpd-fs.h @@ -41,7 +41,7 @@ #define HTTPD_FS_STATISTICS 2 //Puts count in RAM array #if HTTPD_FS_STATISTICS==2 -extern u16_t httpd_filecount[]; +extern uint16_t httpd_filecount[]; #endif /* HTTPD_FS_STATISTICS */ #include @@ -59,12 +59,12 @@ void httpd_fs_init(void); /* Returns root of http files in program flash */ void* httpd_fs_get_root(); /* Returns size of http files in any flash */ -u16_t httpd_fs_get_size(); +uint16_t httpd_fs_get_size(); /* Open a file in any flash and return statistics if enabled. If file is allocated by caller it will be filled in. If NULL, just file stats are returned. */ -u16_t httpd_fs_open(const char *name, struct httpd_fs_file *file); +uint16_t httpd_fs_open(const char *name, struct httpd_fs_file *file); #if COFFEE_FILES /* Coffee file system can be static or dynamic. If static, new files diff --git a/platform/avr-raven/apps/raven-webserver/httpd-fsdata.h b/platform/avr-raven/apps/raven-webserver/httpd-fsdata.h index 9da15d820..f269ad75a 100644 --- a/platform/avr-raven/apps/raven-webserver/httpd-fsdata.h +++ b/platform/avr-raven/apps/raven-webserver/httpd-fsdata.h @@ -43,7 +43,7 @@ struct httpd_fsdata_file { const char *data; const int len; #if HTTPD_FS_STATISTICS == 1 - u16_t count; + uint16_t count; #endif /* HTTPD_FS_STATISTICS */ }; @@ -53,7 +53,7 @@ struct httpd_fsdata_file_noconst { char *data; int len; #if HTTPD_FS_STATISTICS == 1 - u16_t count; + uint16_t count; #endif /* HTTPD_FS_STATISTICS */ }; diff --git a/platform/avr-raven/contiki-conf.h b/platform/avr-raven/contiki-conf.h index 4ddcbfe91..fe7616444 100644 --- a/platform/avr-raven/contiki-conf.h +++ b/platform/avr-raven/contiki-conf.h @@ -56,10 +56,12 @@ #include +/* These names are deprecated, use C99 names. */ typedef int32_t s32_t; typedef unsigned char u8_t; typedef unsigned short u16_t; typedef unsigned long u32_t; + typedef unsigned short clock_time_t; typedef unsigned short uip_stats_t; typedef unsigned long off_t; diff --git a/platform/avr-raven/params.c b/platform/avr-raven/params.c index 480ee3ee5..aadbb83c4 100644 --- a/platform/avr-raven/params.c +++ b/platform/avr-raven/params.c @@ -77,9 +77,9 @@ extern uint8_t default_mac_address[8]; extern uint8_t default_server_name[16]; extern uint8_t default_domain_name[30]; #else -uint8_t default_mac_address[8] PROGMEM = PARAMS_EUI64ADDR; -uint8_t default_server_name[] PROGMEM = PARAMS_SERVERNAME; -uint8_t default_domain_name[] PROGMEM = PARAMS_DOMAINNAME; +const uint8_t default_mac_address[8] PROGMEM = PARAMS_EUI64ADDR; +const uint8_t default_server_name[] PROGMEM = PARAMS_SERVERNAME; +const uint8_t default_domain_name[] PROGMEM = PARAMS_DOMAINNAME; #endif #if PARAMETER_STORAGE==0 diff --git a/platform/avr-ravenusb/contiki-conf.h b/platform/avr-ravenusb/contiki-conf.h index 0e7911a24..127ef8ac0 100644 --- a/platform/avr-ravenusb/contiki-conf.h +++ b/platform/avr-ravenusb/contiki-conf.h @@ -58,6 +58,7 @@ #include #include +/* These names are deprecated, use C99 names. */ typedef int32_t s32_t; typedef unsigned char u8_t; typedef unsigned short u16_t; @@ -391,7 +392,7 @@ extern void mac_log_802_15_4_rx(const uint8_t* buffer, size_t total_len); #define RF230_MAX_TX_POWER 15 #define RF230_MIN_RX_POWER 30 */ - +#define RPL_CONF_ADJUST_LLH_LEN 1 #define UIP_CONF_ROUTER 1 #define UIP_CONF_ND6_SEND_RA 0 #define UIP_CONF_ND6_REACHABLE_TIME 600000 diff --git a/platform/avr-ravenusb/contiki-raven-main.c b/platform/avr-ravenusb/contiki-raven-main.c index b2abe2e21..37fdf49da 100644 --- a/platform/avr-ravenusb/contiki-raven-main.c +++ b/platform/avr-ravenusb/contiki-raven-main.c @@ -151,7 +151,7 @@ const struct uip_fallback_interface rpl_interface = { #include "net/rpl/rpl.h" // avr-objdump --section .bss -x ravenusbstick.elf -uint16_t dag_id[] PROGMEM = {0x1111, 0x1100, 0, 0, 0, 0, 0, 0x0011}; +const uint16_t dag_id[] PROGMEM = {0x1111, 0x1100, 0, 0, 0, 0, 0, 0x0011}; PROCESS(border_router_process, "RPL Border Router"); PROCESS_THREAD(border_router_process, ev, data) @@ -220,26 +220,26 @@ SIGNATURE = { FUSES ={.low = 0xde, .high = 0x99, .extended = 0xff,}; /* Save the default settings into program flash memory */ -uint8_t default_mac_address[8] PROGMEM = {0x02, 0x12, 0x13, 0xff, 0xfe, 0x14, 0x15, 0x16}; +const uint8_t default_mac_address[8] PROGMEM = {0x02, 0x12, 0x13, 0xff, 0xfe, 0x14, 0x15, 0x16}; #ifdef CHANNEL_802_15_4 -uint8_t default_channel PROGMEM = CHANNEL_802_15_4; +const uint8_t default_channel PROGMEM = CHANNEL_802_15_4; #else -uint8_t default_channel PROGMEM = 26; +const uint8_t default_channel PROGMEM = 26; #endif #ifdef IEEE802154_PANID -uint16_t default_panid PROGMEM = IEEE802154_PANID; +const uint16_t default_panid PROGMEM = IEEE802154_PANID; #else -uint16_t default_panid PROGMEM = 0xABCD; +const uint16_t default_panid PROGMEM = 0xABCD; #endif #ifdef IEEE802154_PANADDR -uint16_t default_panaddr PROGMEM = IEEE802154_PANID; +const uint16_t default_panaddr PROGMEM = IEEE802154_PANID; #else -uint16_t default_panaddr PROGMEM = 0; +const uint16_t default_panaddr PROGMEM = 0; #endif #ifdef RF230_MAX_TX_POWER -uint8_t default_txpower PROGMEM = RF230_MAX_TX_POWER; +const uint8_t default_txpower PROGMEM = RF230_MAX_TX_POWER; #else -uint8_t default_txpower PROGMEM = 0; +const uint8_t default_txpower PROGMEM = 0; #endif #if JACKDAW_CONF_RANDOM_MAC diff --git a/platform/avr-ravenusb/httpd-simple-avr.c b/platform/avr-ravenusb/httpd-simple-avr.c index 9c40d4e79..a82921342 100644 --- a/platform/avr-ravenusb/httpd-simple-avr.c +++ b/platform/avr-ravenusb/httpd-simple-avr.c @@ -146,13 +146,13 @@ PT_THREAD(send_string_P(struct httpd_state *s, char *str)) } #endif /*---------------------------------------------------------------------------*/ -char http_content_type_html[] PROGMEM = "Content-type: text/html\r\n\r\n"; +const char http_content_type_html[] PROGMEM = "Content-type: text/html\r\n\r\n"; static -PT_THREAD(send_headers(struct httpd_state *s, char *statushdr)) +PT_THREAD(send_headers(struct httpd_state *s, const char *statushdr)) { PSOCK_BEGIN(&s->sout); - PSOCK_GENERATOR_SEND(&s->sout, generate_string_P, statushdr); - PSOCK_GENERATOR_SEND(&s->sout, generate_string_P, http_content_type_html); + PSOCK_GENERATOR_SEND(&s->sout, generate_string_P, (char *) statushdr); + PSOCK_GENERATOR_SEND(&s->sout, generate_string_P, (char *) http_content_type_html); PSOCK_END(&s->sout); } /*---------------------------------------------------------------------------*/ @@ -241,9 +241,9 @@ ipaddr_add(const uip_ipaddr_t *addr) } } /*---------------------------------------------------------------------------*/ -char TOP1[] PROGMEM = "ContikiRPL(Jackdaw)"; -char TOP2[] PROGMEM = ""; -char BOTTOM[] PROGMEM = ""; +const char TOP1[] PROGMEM = "ContikiRPL(Jackdaw)"; +const char TOP2[] PROGMEM = ""; +const char BOTTOM[] PROGMEM = ""; #if UIP_CONF_IPV6 extern uip_ds6_nbr_t uip_ds6_nbr_cache[]; extern uip_ds6_route_t uip_ds6_routing_table[]; @@ -255,8 +255,8 @@ PT_THREAD(generate_routes(struct httpd_state *s)) uint8_t i=0; PSOCK_BEGIN(&s->sout); - PSOCK_GENERATOR_SEND(&s->sout, generate_string_P, TOP1); - PSOCK_GENERATOR_SEND(&s->sout, generate_string_P, TOP2); + PSOCK_GENERATOR_SEND(&s->sout, generate_string_P, (char *) TOP1); + PSOCK_GENERATOR_SEND(&s->sout, generate_string_P, (char *) TOP2); #if UIP_CONF_IPV6 //allow ip4 builds blen = 0; @@ -305,7 +305,7 @@ PT_THREAD(generate_routes(struct httpd_state *s)) PSOCK_GENERATOR_SEND(&s->sout, generate_string, buf); #endif /* UIP_CONF_IPV6 */ - PSOCK_GENERATOR_SEND(&s->sout, generate_string_P, BOTTOM); + PSOCK_GENERATOR_SEND(&s->sout, generate_string_P, (char *) BOTTOM); PSOCK_END(&s->sout); } @@ -317,9 +317,9 @@ httpd_simple_get_script(const char *name) return generate_routes; } /*---------------------------------------------------------------------------*/ -char http_header_200[] PROGMEM = "HTTP/1.0 200 OK\r\nServer: Jackdaw\r\nConnection: close\r\n"; -char http_header_404[] PROGMEM = "HTTP/1.0 404 Not found\r\nServer: Jackdaw\r\nConnection: close\r\n"; -char NOT_FOUND[] PROGMEM = "

    404 - file not found

    "; +const char http_header_200[] PROGMEM = "HTTP/1.0 200 OK\r\nServer: Jackdaw\r\nConnection: close\r\n"; +const char http_header_404[] PROGMEM = "HTTP/1.0 404 Not found\r\nServer: Jackdaw\r\nConnection: close\r\n"; +const char NOT_FOUND[] PROGMEM = "

    404 - file not found

    "; static PT_THREAD(handle_output(struct httpd_state *s)) { diff --git a/platform/avr-rcb/contiki-conf.h b/platform/avr-rcb/contiki-conf.h index 849575b1a..c02fd0cc1 100644 --- a/platform/avr-rcb/contiki-conf.h +++ b/platform/avr-rcb/contiki-conf.h @@ -115,6 +115,8 @@ typedef int32_t s32_t; typedef unsigned short clock_time_t; + +/* These names are deprecated, use C99 names. */ typedef unsigned char u8_t; typedef unsigned short u16_t; typedef unsigned long u32_t; diff --git a/platform/avr-rcb/contiki-rcb-main.c b/platform/avr-rcb/contiki-rcb-main.c index 9c562bff8..24d3cd07e 100644 --- a/platform/avr-rcb/contiki-rcb-main.c +++ b/platform/avr-rcb/contiki-rcb-main.c @@ -107,7 +107,7 @@ init_lowlevel(void) static struct etimer et; PROCESS_THREAD(rcb_leds, ev, data) { - u8_t error; + uint8_t error; PROCESS_BEGIN(); diff --git a/platform/avr-zigbit/contiki-conf.h b/platform/avr-zigbit/contiki-conf.h index c9f67fe9f..53aa6bf23 100644 --- a/platform/avr-zigbit/contiki-conf.h +++ b/platform/avr-zigbit/contiki-conf.h @@ -145,11 +145,13 @@ #include -typedef int32_t s32_t; +/* These names are deprecated, use C99 names. */ typedef unsigned short clock_time_t; typedef unsigned char u8_t; typedef unsigned short u16_t; typedef unsigned long u32_t; +typedef int32_t s32_t; + typedef unsigned short uip_stats_t; typedef unsigned long off_t; diff --git a/platform/c128/contiki-main.c b/platform/c128/contiki-main.c index 84489c56e..7ce943dc8 100644 --- a/platform/c128/contiki-main.c +++ b/platform/c128/contiki-main.c @@ -93,7 +93,7 @@ main(void) #if (WITH_GUI && WITH_MOUSE) { - static const u8_t mouse_sprite[64] = { + static const uint8_t mouse_sprite[64] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xE0, 0x00, 0x0F, 0xC0, 0x00, 0x0F, 0x80, 0x00, 0x0F, 0xC0, 0x00, 0x0D, 0xE0, 0x00, @@ -104,7 +104,7 @@ main(void) 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; memcpy((void*)0x0E00, mouse_sprite, sizeof(mouse_sprite)); - *(u8_t*)0x07F8 = 0x0E00 / 64; + *(uint8_t*)0x07F8 = 0x0E00 / 64; VIC.spr0_color = COLOR_WHITE; } #endif /* WITH_GUI && WITH_MOUSE */ diff --git a/platform/c64/contiki-main.c b/platform/c64/contiki-main.c index db60af8a3..dee2a72cd 100644 --- a/platform/c64/contiki-main.c +++ b/platform/c64/contiki-main.c @@ -91,7 +91,7 @@ main(void) #if (WITH_GUI && WITH_MOUSE) { - static const u8_t mouse_sprite[64] = { + static const uint8_t mouse_sprite[64] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xE0, 0x00, 0x0F, 0xC0, 0x00, 0x0F, 0x80, 0x00, 0x0F, 0xC0, 0x00, 0x0D, 0xE0, 0x00, @@ -102,7 +102,7 @@ main(void) 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; memcpy((void*)0x0340, mouse_sprite, sizeof(mouse_sprite)); - *(u8_t*)0x07F8 = 0x0340 / 64; + *(uint8_t*)0x07F8 = 0x0340 / 64; VIC.spr0_color = COLOR_WHITE; } #endif /* WITH_GUI && WITH_MOUSE */ diff --git a/platform/cooja/contiki-conf.h b/platform/cooja/contiki-conf.h index ca289258c..cc6bd0896 100644 --- a/platform/cooja/contiki-conf.h +++ b/platform/cooja/contiki-conf.h @@ -105,11 +105,13 @@ #define CCIF #define CLIF +/* These names are deprecated, use C99 names. */ #include typedef uint8_t u8_t; typedef uint16_t u16_t; typedef uint32_t u32_t; typedef int32_t s32_t; + typedef unsigned short uip_stats_t; #define CLOCK_CONF_SECOND 1000L diff --git a/platform/cooja/contiki-cooja-main.c b/platform/cooja/contiki-cooja-main.c index a64482def..9cdec2b8b 100644 --- a/platform/cooja/contiki-cooja-main.c +++ b/platform/cooja/contiki-cooja-main.c @@ -100,7 +100,7 @@ static uint8_t is_gateway; #if WITH_UIP6 #include "net/uip.h" #include "net/uip-ds6.h" -#define PRINT6ADDR(addr) printf("%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x", ((u8_t *)addr)[0], ((u8_t *)addr)[1], ((u8_t *)addr)[2], ((u8_t *)addr)[3], ((u8_t *)addr)[4], ((u8_t *)addr)[5], ((u8_t *)addr)[6], ((u8_t *)addr)[7], ((u8_t *)addr)[8], ((u8_t *)addr)[9], ((u8_t *)addr)[10], ((u8_t *)addr)[11], ((u8_t *)addr)[12], ((u8_t *)addr)[13], ((u8_t *)addr)[14], ((u8_t *)addr)[15]) +#define PRINT6ADDR(addr) printf("%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x", ((uint8_t *)addr)[0], ((uint8_t *)addr)[1], ((uint8_t *)addr)[2], ((uint8_t *)addr)[3], ((uint8_t *)addr)[4], ((uint8_t *)addr)[5], ((uint8_t *)addr)[6], ((uint8_t *)addr)[7], ((uint8_t *)addr)[8], ((uint8_t *)addr)[9], ((uint8_t *)addr)[10], ((uint8_t *)addr)[11], ((uint8_t *)addr)[12], ((uint8_t *)addr)[13], ((uint8_t *)addr)[14], ((uint8_t *)addr)[15]) #endif /* WITH_UIP6 */ PROCINIT(&etimer_process,&sensors_process); diff --git a/platform/cooja/net/radio-uip-uaodv.c b/platform/cooja/net/radio-uip-uaodv.c index c4ca21491..1e4546fbd 100644 --- a/platform/cooja/net/radio-uip-uaodv.c +++ b/platform/cooja/net/radio-uip-uaodv.c @@ -66,12 +66,12 @@ enum { struct buf_packet { struct buf_packet *next; - u8_t data[UIP_BUFSIZE]; + uint8_t data[UIP_BUFSIZE]; int len; - u8_t resends; - u8_t acked; - u8_t want_ack; - u16_t crc; + uint8_t resends; + uint8_t acked; + uint8_t want_ack; + uint16_t crc; uip_ipaddr_t finaldest; struct etimer etimer; }; @@ -87,21 +87,21 @@ static const struct radio_driver *radio; /*---------------------------------------------------------------------------*/ static void receiver(const struct radio_driver *d); -u8_t radio_uip_uaodv_send(void); +uint8_t radio_uip_uaodv_send(void); void radio_uip_uaodv_init(const struct radio_driver *d); -int radio_uip_handle_ack(u8_t *buf, int len); -u16_t radio_uip_calc_crc(u8_t *buf, int len); -int radio_uip_buffer_outgoing_packet(u8_t *buf, int len, uip_ipaddr_t *dest, int max_sends); -int radio_uip_is_ack(u8_t *buf, int len); -int radio_uip_uaodv_add_header(u8_t *buf, int len, uip_ipaddr_t *addr); -int radio_uip_uaodv_remove_header(u8_t *buf, int len); -void radio_uip_uaodv_change_header(u8_t *buf, int len, uip_ipaddr_t *addr); -int radio_uip_uaodv_header_exists(u8_t *buf, int len); +int radio_uip_handle_ack(uint8_t *buf, int len); +uint16_t radio_uip_calc_crc(uint8_t *buf, int len); +int radio_uip_buffer_outgoing_packet(uint8_t *buf, int len, uip_ipaddr_t *dest, int max_sends); +int radio_uip_is_ack(uint8_t *buf, int len); +int radio_uip_uaodv_add_header(uint8_t *buf, int len, uip_ipaddr_t *addr); +int radio_uip_uaodv_remove_header(uint8_t *buf, int len); +void radio_uip_uaodv_change_header(uint8_t *buf, int len, uip_ipaddr_t *addr); +int radio_uip_uaodv_header_exists(uint8_t *buf, int len); int radio_uip_uaodv_is_broadcast(uip_ipaddr_t *addr); -int radio_uip_uaodv_fwd_is_broadcast(u8_t *buf, int len); -int radio_uip_uaodv_fwd_is_me(u8_t *buf, int len); -int radio_uip_uaodv_dest_is_me(u8_t *buf, int len); -int radio_uip_uaodv_dest_port(u8_t *buf, int len); +int radio_uip_uaodv_fwd_is_broadcast(uint8_t *buf, int len); +int radio_uip_uaodv_fwd_is_me(uint8_t *buf, int len); +int radio_uip_uaodv_dest_is_me(uint8_t *buf, int len); +int radio_uip_uaodv_dest_port(uint8_t *buf, int len); /*---------------------------------------------------------------------------*/ /* Main process - handles (re)transmissions and acks */ @@ -117,10 +117,10 @@ PROCESS_THREAD(radio_uip_process, ev, data) if(ev == EVENT_SEND_ACK) { /* Prepare and send ack for given 16-bit CRC */ - u8_t ackPacket[ACK_PACKET_LENGTH]; + uint8_t ackPacket[ACK_PACKET_LENGTH]; memcpy(ackPacket, ACK_ID, ACK_ID_LENGTH); - ackPacket[ACK_CRC] = ((u16_t) data >> 8); - ackPacket[ACK_CRC+1] = ((u16_t) data & 0xff); + ackPacket[ACK_CRC] = ((uint16_t) data >> 8); + ackPacket[ACK_CRC+1] = ((uint16_t) data & 0xff); radio->send(ackPacket, ACK_PACKET_LENGTH); } else if(ev == PROCESS_EVENT_TIMER) { @@ -187,9 +187,9 @@ receiver(const struct radio_driver *d) { /* Send ack as soon as possible */ - u16_t crc; + uint16_t crc; crc = radio_uip_calc_crc(&uip_buf[UIP_LLH_LEN], uip_len); - process_post(&radio_uip_process, EVENT_SEND_ACK, (void*) (u32_t) crc); + process_post(&radio_uip_process, EVENT_SEND_ACK, (void*) (uint32_t) crc); } /* Strip header and receive packet */ @@ -197,7 +197,7 @@ receiver(const struct radio_driver *d) tcpip_input(); } /*---------------------------------------------------------------------------*/ -u8_t +uint8_t radio_uip_uaodv_send(void) { struct uaodv_rt_entry *route; @@ -261,10 +261,10 @@ radio_uip_uaodv_init(const struct radio_driver *d) radio->on(); } /*---------------------------------------------------------------------------*/ -u16_t -radio_uip_calc_crc(u8_t *buf, int len) +uint16_t +radio_uip_calc_crc(uint8_t *buf, int len) { - u16_t crcacc = 0xffff; + uint16_t crcacc = 0xffff; int counter; /* TODO Not effective */ @@ -275,11 +275,11 @@ radio_uip_calc_crc(u8_t *buf, int len) } /*---------------------------------------------------------------------------*/ int -radio_uip_buffer_outgoing_packet(u8_t *buf, int len, uip_ipaddr_t *dest, int max_sends) +radio_uip_buffer_outgoing_packet(uint8_t *buf, int len, uip_ipaddr_t *dest, int max_sends) { struct buf_packet *packet; - u16_t crc; + uint16_t crc; /* Calculate packet's unique CRC */ crc = radio_uip_calc_crc(&uip_buf[UIP_LLH_LEN], uip_len); @@ -323,7 +323,7 @@ radio_uip_buffer_outgoing_packet(u8_t *buf, int len, uip_ipaddr_t *dest, int max } /*---------------------------------------------------------------------------*/ int -radio_uip_is_ack(u8_t *buf, int len) +radio_uip_is_ack(uint8_t *buf, int len) { if (len != ACK_PACKET_LENGTH) return 0; @@ -333,12 +333,12 @@ radio_uip_is_ack(u8_t *buf, int len) } /*---------------------------------------------------------------------------*/ int -radio_uip_handle_ack(u8_t *buf, int len) +radio_uip_handle_ack(uint8_t *buf, int len) { struct buf_packet *packet; - u16_t ackCRC; + uint16_t ackCRC; - ackCRC = (u16_t) (buf[ACK_CRC] << 8) + (u16_t) (0xff&buf[ACK_CRC+1]); + ackCRC = (uint16_t) (buf[ACK_CRC] << 8) + (uint16_t) (0xff&buf[ACK_CRC+1]); /* Locate which packet was acknowledged */ for(packet = list_head(buf_packet_list); @@ -355,9 +355,9 @@ radio_uip_handle_ack(u8_t *buf, int len) } /*---------------------------------------------------------------------------*/ int -radio_uip_uaodv_add_header(u8_t *buf, int len, uip_ipaddr_t *addr) +radio_uip_uaodv_add_header(uint8_t *buf, int len, uip_ipaddr_t *addr) { - u8_t tempbuf[len]; + uint8_t tempbuf[len]; memcpy(tempbuf, buf, len); memcpy(&buf[FWD_PACKET_LENGTH], tempbuf, len); memcpy(buf, FWD_ID, FWD_ID_LENGTH); @@ -366,22 +366,22 @@ radio_uip_uaodv_add_header(u8_t *buf, int len, uip_ipaddr_t *addr) } /*---------------------------------------------------------------------------*/ int -radio_uip_uaodv_remove_header(u8_t *buf, int len) +radio_uip_uaodv_remove_header(uint8_t *buf, int len) { - u8_t tempbuf[len]; + uint8_t tempbuf[len]; memcpy(tempbuf, &buf[FWD_PACKET_LENGTH], len); memcpy(buf, tempbuf, len); return len - FWD_PACKET_LENGTH; } /*---------------------------------------------------------------------------*/ void -radio_uip_uaodv_change_header(u8_t *buf, int len, uip_ipaddr_t *addr) +radio_uip_uaodv_change_header(uint8_t *buf, int len, uip_ipaddr_t *addr) { memcpy(&buf[FWD_NEXT_IP], addr, 4); } /*---------------------------------------------------------------------------*/ int -radio_uip_uaodv_header_exists(u8_t *buf, int len) +radio_uip_uaodv_header_exists(uint8_t *buf, int len) { return !memcmp(buf, FWD_ID, FWD_ID_LENGTH); } @@ -393,25 +393,25 @@ radio_uip_uaodv_is_broadcast(uip_ipaddr_t *addr) } /*---------------------------------------------------------------------------*/ int -radio_uip_uaodv_fwd_is_broadcast(u8_t *buf, int len) +radio_uip_uaodv_fwd_is_broadcast(uint8_t *buf, int len) { return radio_uip_uaodv_is_broadcast((uip_ipaddr_t*) &buf[FWD_NEXT_IP]); } /*---------------------------------------------------------------------------*/ int -radio_uip_uaodv_fwd_is_me(u8_t *buf, int len) +radio_uip_uaodv_fwd_is_me(uint8_t *buf, int len) { return !memcmp(&buf[FWD_NEXT_IP], &uip_hostaddr, 4); } /*---------------------------------------------------------------------------*/ int -radio_uip_uaodv_dest_is_me(u8_t *buf, int len) +radio_uip_uaodv_dest_is_me(uint8_t *buf, int len) { return !memcmp((&((struct uip_udpip_hdr *)buf)->destipaddr), &uip_hostaddr, 4); } /*---------------------------------------------------------------------------*/ int -radio_uip_uaodv_dest_port(u8_t *buf, int len) +radio_uip_uaodv_dest_port(uint8_t *buf, int len) { if (len < sizeof(struct uip_udpip_hdr)) return -1; diff --git a/platform/cooja/net/radio-uip-uaodv.h b/platform/cooja/net/radio-uip-uaodv.h index 53faa8645..3aa3ace1c 100644 --- a/platform/cooja/net/radio-uip-uaodv.h +++ b/platform/cooja/net/radio-uip-uaodv.h @@ -40,7 +40,7 @@ void radio_uip_uaodv_init(const struct radio_driver *d); -u8_t +uint8_t radio_uip_uaodv_send(void); #endif /* __RADIO_UIP_UAODV_H__ */ diff --git a/platform/cooja/testapps/testcfs.c b/platform/cooja/testapps/testcfs.c index c2a51b807..d0248a58c 100644 --- a/platform/cooja/testapps/testcfs.c +++ b/platform/cooja/testapps/testcfs.c @@ -43,7 +43,7 @@ PROCESS_THREAD(test_cfs_process, ev, data) { static struct etimer et; static int fd; - static u16_t counter; + static uint16_t counter; static char buf[30]; PROCESS_BEGIN(); diff --git a/platform/cooja/testapps/testctimer.c b/platform/cooja/testapps/testctimer.c index ed98e8209..2929775cf 100644 --- a/platform/cooja/testapps/testctimer.c +++ b/platform/cooja/testapps/testctimer.c @@ -38,7 +38,7 @@ PROCESS(test_ctimer_process, "Callback timer test process"); AUTOSTART_PROCESSES(&test_ctimer_process); /*---------------------------------------------------------------------------*/ static struct ctimer ct; -static u16_t counter = 0; +static uint16_t counter = 0; /*---------------------------------------------------------------------------*/ static void callback(void *ptr) diff --git a/platform/cooja/testapps/testetimer.c b/platform/cooja/testapps/testetimer.c index 1672649ff..a1e28a553 100644 --- a/platform/cooja/testapps/testetimer.c +++ b/platform/cooja/testapps/testetimer.c @@ -40,7 +40,7 @@ AUTOSTART_PROCESSES(&test_etimer_process); PROCESS_THREAD(test_etimer_process, ev, data) { static struct etimer et; - static u16_t counter = 0; + static uint16_t counter = 0; PROCESS_BEGIN(); diff --git a/platform/esb/apps/pinger.c b/platform/esb/apps/pinger.c index f2402d4f6..1dd920585 100644 --- a/platform/esb/apps/pinger.c +++ b/platform/esb/apps/pinger.c @@ -40,10 +40,10 @@ PROCESS(pinger, "Pinger"); static struct uip_udp_conn *conn; struct data { - u8_t dummy_data[20]; - u16_t id; - u16_t seqno; - u8_t pingpong; + uint8_t dummy_data[20]; + uint16_t id; + uint16_t seqno; + uint8_t pingpong; #define PING 0 #define PONG 1 }; diff --git a/platform/esb/apps/radio-sniffer.c b/platform/esb/apps/radio-sniffer.c index 510709a0d..41d7c85ec 100644 --- a/platform/esb/apps/radio-sniffer.c +++ b/platform/esb/apps/radio-sniffer.c @@ -53,7 +53,7 @@ static void sniffer_callback(const struct radio_driver *driver) { static char buf[40]; - static u8_t packet[UIP_BUFSIZE]; + static uint8_t packet[UIP_BUFSIZE]; static int len; len = driver->read(packet, sizeof(packet)); if(len > 0) { diff --git a/platform/esb/dev/ds1629.c b/platform/esb/dev/ds1629.c index 3950d7678..ce922ecc4 100644 --- a/platform/esb/dev/ds1629.c +++ b/platform/esb/dev/ds1629.c @@ -106,10 +106,10 @@ cl_stop() } /*--------------------------------------------------------------------------*/ /* Writes a byte on the bus, returns the acknowledge bit. */ -static u16_t -cl_writeOnBus(u8_t byte) +static uint16_t +cl_writeOnBus(uint8_t byte) { - u16_t i, ack; + uint16_t i, ack; for(i=0;i<8;i++) { if(byte & 0x80) SDA_HIGH; else SDA_LOW; SCL_HIGH; @@ -126,11 +126,11 @@ cl_writeOnBus(u8_t byte) return ack; } /*--------------------------------------------------------------------------*/ -static u8_t -cl_readFromBus(u16_t ack) +static uint8_t +cl_readFromBus(uint16_t ack) { - u16_t i; - u8_t byte = 0; + uint16_t i; + uint8_t byte = 0; P5DIR &= 0xFE; /* P50(SDA) input */ for(i=0;i<8;i++) { byte = byte << 1; @@ -145,10 +145,10 @@ cl_readFromBus(u16_t ack) return byte; } /*--------------------------------------------------------------------------*/ -static u16_t -getReg16bit(u8_t acc, u16_t bitmask) +static uint16_t +getReg16bit(uint8_t acc, uint16_t bitmask) { - u16_t config = 0; + uint16_t config = 0; do cl_start(); while(!cl_writeOnBus(BUS_WRITE)); cl_writeOnBus(acc); @@ -166,7 +166,7 @@ getReg16bit(u8_t acc, u16_t bitmask) /*--------------------------------------------------------------------------*/ /* Only first 8 bit of Configuration Status Register can be set */ static void -setCSReg(u8_t setting) +setCSReg(uint8_t setting) { do cl_start(); while(!cl_writeOnBus(BUS_WRITE)); @@ -192,7 +192,7 @@ System_startConversion(void) static void initClock(void) { - u8_t csr = getReg16bit(ACC_CSR,0xFF00) >> 8; + uint8_t csr = getReg16bit(ACC_CSR,0xFF00) >> 8; if(csr!=CSR_DEFAULT) setCSReg(CSR_DEFAULT); /* if desired config isnt in clock => set it */ /* IMPORTANT: Ensure quartz is generating 32768 Hz */ /* (sometimes CH bit gets set when clock is read while reset) */ diff --git a/platform/esb/dev/ir.c b/platform/esb/dev/ir.c index 11bede1fa..5a5bdefb1 100644 --- a/platform/esb/dev/ir.c +++ b/platform/esb/dev/ir.c @@ -175,13 +175,13 @@ unsigned char recir_getAddress(void){ return ((recvdata & 0x07C0) >> 6); } unsigned char recir_getToggle(void){ return ((recvdata & 0x0800) >> 11); } unsigned char recir_getError(void){ return ((recvdata & 0x2000) >> 13); } -u16_t +uint16_t ir_data(void) { return recvdata; } -u8_t +uint8_t ir_poll(void) { if(recvdata & 0x1000) { diff --git a/platform/esb/dev/ir.h b/platform/esb/dev/ir.h index 1aef513f9..12c56be96 100644 --- a/platform/esb/dev/ir.h +++ b/platform/esb/dev/ir.h @@ -47,11 +47,11 @@ void ir_init(void); void ir_send(unsigned short low12bits); -u8_t ir_poll(void); +uint8_t ir_poll(void); #define IR_NODATA 0 #define IR_DATA 1 -u16_t ir_data(void); +uint16_t ir_data(void); void ir_irq(void); diff --git a/platform/mb851/contiki-conf.h b/platform/mb851/contiki-conf.h index a39d0d04a..333b3e729 100644 --- a/platform/mb851/contiki-conf.h +++ b/platform/mb851/contiki-conf.h @@ -58,10 +58,12 @@ #define CCIF #define CLIF +/* These names are deprecated, use C99 names. */ typedef uint8_t u8_t; typedef uint16_t u16_t; typedef uint32_t u32_t; typedef int32_t s32_t; + typedef unsigned short uip_stats_t; diff --git a/platform/mb851/contiki-init-net.c b/platform/mb851/contiki-init-net.c index 4d81f9c58..500ad6f09 100644 --- a/platform/mb851/contiki-init-net.c +++ b/platform/mb851/contiki-init-net.c @@ -48,7 +48,7 @@ #if DEBUG #include #define PRINTF(...) printf(__VA_ARGS__) -#define PRINT6ADDR(addr) PRINTF(" %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x ", ((u8_t *)addr)[0], ((u8_t *)addr)[1], ((u8_t *)addr)[2], ((u8_t *)addr)[3], ((u8_t *)addr)[4], ((u8_t *)addr)[5], ((u8_t *)addr)[6], ((u8_t *)addr)[7], ((u8_t *)addr)[8], ((u8_t *)addr)[9], ((u8_t *)addr)[10], ((u8_t *)addr)[11], ((u8_t *)addr)[12], ((u8_t *)addr)[13], ((u8_t *)addr)[14], ((u8_t *)addr)[15]) +#define PRINT6ADDR(addr) PRINTF(" %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x ", ((uint8_t *)addr)[0], ((uint8_t *)addr)[1], ((uint8_t *)addr)[2], ((uint8_t *)addr)[3], ((uint8_t *)addr)[4], ((uint8_t *)addr)[5], ((uint8_t *)addr)[6], ((uint8_t *)addr)[7], ((uint8_t *)addr)[8], ((uint8_t *)addr)[9], ((uint8_t *)addr)[10], ((uint8_t *)addr)[11], ((uint8_t *)addr)[12], ((uint8_t *)addr)[13], ((uint8_t *)addr)[14], ((uint8_t *)addr)[15]) #define PRINTLLADDR(lladdr) PRINTF(" %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x ",lladdr.u8[0], lladdr.u8[1], lladdr.u8[2], lladdr.u8[3],lladdr.u8[4], lladdr.u8[5], lladdr.u8[6], lladdr.u8[7]) #else #define PRINTF(...) diff --git a/platform/mb851/contiki-main.c b/platform/mb851/contiki-main.c index 916e3952c..7189caec6 100644 --- a/platform/mb851/contiki-main.c +++ b/platform/mb851/contiki-main.c @@ -72,7 +72,7 @@ #if DEBUG #include #define PRINTF(...) printf(__VA_ARGS__) -#define PRINT6ADDR(addr) PRINTF(" %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x ", ((u8_t *)addr)[0], ((u8_t *)addr)[1], ((u8_t *)addr)[2], ((u8_t *)addr)[3], ((u8_t *)addr)[4], ((u8_t *)addr)[5], ((u8_t *)addr)[6], ((u8_t *)addr)[7], ((u8_t *)addr)[8], ((u8_t *)addr)[9], ((u8_t *)addr)[10], ((u8_t *)addr)[11], ((u8_t *)addr)[12], ((u8_t *)addr)[13], ((u8_t *)addr)[14], ((u8_t *)addr)[15]) +#define PRINT6ADDR(addr) PRINTF(" %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x ", ((uint8_t *)addr)[0], ((uint8_t *)addr)[1], ((uint8_t *)addr)[2], ((uint8_t *)addr)[3], ((uint8_t *)addr)[4], ((uint8_t *)addr)[5], ((uint8_t *)addr)[6], ((uint8_t *)addr)[7], ((uint8_t *)addr)[8], ((uint8_t *)addr)[9], ((uint8_t *)addr)[10], ((uint8_t *)addr)[11], ((uint8_t *)addr)[12], ((uint8_t *)addr)[13], ((uint8_t *)addr)[14], ((uint8_t *)addr)[15]) #define PRINTLLADDR(lladdr) PRINTF(" %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x ",lladdr.u8[0], lladdr.u8[1], lladdr.u8[2], lladdr.u8[3],lladdr.u8[4], lladdr.u8[5], lladdr.u8[6], lladdr.u8[7]) #else #define PRINTF(...) @@ -96,7 +96,7 @@ set_rime_addr(void) { int i; union { - u8_t u8[8]; + uint8_t u8[8]; }eui64; //rimeaddr_t lladdr; diff --git a/platform/mbxxx/contiki-conf.h b/platform/mbxxx/contiki-conf.h index 03155b492..4dfba9020 100644 --- a/platform/mbxxx/contiki-conf.h +++ b/platform/mbxxx/contiki-conf.h @@ -57,12 +57,13 @@ #define CCIF #define CLIF +/* These names are deprecated, use C99 names. */ typedef uint8_t u8_t; typedef uint16_t u16_t; typedef uint32_t u32_t; typedef int32_t s32_t; -typedef unsigned short uip_stats_t; +typedef unsigned short uip_stats_t; //#define FIXED_NET_ADDRESS 1 //#define NET_ADDR_A 0x2001 diff --git a/platform/mbxxx/contiki-main.c b/platform/mbxxx/contiki-main.c index 33bb39748..6c9c88ba1 100644 --- a/platform/mbxxx/contiki-main.c +++ b/platform/mbxxx/contiki-main.c @@ -71,7 +71,7 @@ #if DEBUG #include #define PRINTF(...) printf(__VA_ARGS__) -#define PRINT6ADDR(addr) PRINTF(" %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x ", ((u8_t *)addr)[0], ((u8_t *)addr)[1], ((u8_t *)addr)[2], ((u8_t *)addr)[3], ((u8_t *)addr)[4], ((u8_t *)addr)[5], ((u8_t *)addr)[6], ((u8_t *)addr)[7], ((u8_t *)addr)[8], ((u8_t *)addr)[9], ((u8_t *)addr)[10], ((u8_t *)addr)[11], ((u8_t *)addr)[12], ((u8_t *)addr)[13], ((u8_t *)addr)[14], ((u8_t *)addr)[15]) +#define PRINT6ADDR(addr) PRINTF(" %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x ", ((uint8_t *)addr)[0], ((uint8_t *)addr)[1], ((uint8_t *)addr)[2], ((uint8_t *)addr)[3], ((uint8_t *)addr)[4], ((uint8_t *)addr)[5], ((uint8_t *)addr)[6], ((uint8_t *)addr)[7], ((uint8_t *)addr)[8], ((uint8_t *)addr)[9], ((uint8_t *)addr)[10], ((uint8_t *)addr)[11], ((uint8_t *)addr)[12], ((uint8_t *)addr)[13], ((uint8_t *)addr)[14], ((uint8_t *)addr)[15]) #define PRINTLLADDR(lladdr) PRINTF(" %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x ",lladdr.u8[0], lladdr.u8[1], lladdr.u8[2], lladdr.u8[3],lladdr.u8[4], lladdr.u8[5], lladdr.u8[6], lladdr.u8[7]) #else #define PRINTF(...) @@ -95,7 +95,7 @@ set_rime_addr(void) { int i; union { - u8_t u8[8]; + uint8_t u8[8]; }eui64; //rimeaddr_t lladdr; diff --git a/platform/minimal-net/contiki-conf.h b/platform/minimal-net/contiki-conf.h index 2483e8b5a..8ae127a4b 100644 --- a/platform/minimal-net/contiki-conf.h +++ b/platform/minimal-net/contiki-conf.h @@ -45,12 +45,15 @@ #define CCIF #define CLIF +/* These names are deprecated, use C99 names. */ typedef uint8_t u8_t; typedef uint16_t u16_t; typedef uint32_t u32_t; typedef int32_t s32_t; + typedef unsigned short uip_stats_t; + #if UIP_CONF_IPV6 /* The Windows build uses wpcap to connect to a host interface. It finds the interface by scanning for * an address, which can be specified here and overridden with the command line. diff --git a/platform/native/contiki-conf.h b/platform/native/contiki-conf.h index a388ab8d5..036b05e66 100644 --- a/platform/native/contiki-conf.h +++ b/platform/native/contiki-conf.h @@ -55,10 +55,12 @@ int select_set_callback(int fd, const struct select_callback *callback); #define CCIF #define CLIF +/* These names are deprecated, use C99 names. */ typedef uint8_t u8_t; typedef uint16_t u16_t; typedef uint32_t u32_t; typedef int32_t s32_t; + typedef unsigned short uip_stats_t; #define UIP_CONF_UDP 1 diff --git a/platform/pc-6001/apps/webserver-mini/httpd-fs.c b/platform/pc-6001/apps/webserver-mini/httpd-fs.c index a1c5e1cad..8b05717ed 100644 --- a/platform/pc-6001/apps/webserver-mini/httpd-fs.c +++ b/platform/pc-6001/apps/webserver-mini/httpd-fs.c @@ -42,14 +42,14 @@ #include "ctk/libconio_arch-small.h" #if HTTPD_FS_STATISTICS -static u16_t count[HTTPD_FS_NUMFILES]; +static uint16_t count[HTTPD_FS_NUMFILES]; #endif /* HTTPD_FS_STATISTICS */ /*-----------------------------------------------------------------------------------*/ -static u8_t +static uint8_t httpd_fs_strcmp(const char *str1, const char *str2) { - u8_t i; + uint8_t i; i = 0; loop: @@ -71,7 +71,7 @@ int httpd_fs_open(const char *name, struct httpd_fs_file *file) { #if HTTPD_FS_STATISTICS - u16_t i = 0; + uint16_t i = 0; #endif /* HTTPD_FS_STATISTICS */ char* ch; struct httpd_fsdata_file_noconst *f; @@ -101,7 +101,7 @@ void httpd_fs_init(void) { #if HTTPD_FS_STATISTICS - u16_t i; + uint16_t i; for(i = 0; i < HTTPD_FS_NUMFILES; i++) { count[i] = 0; } @@ -109,11 +109,11 @@ httpd_fs_init(void) } /*-----------------------------------------------------------------------------------*/ #if HTTPD_FS_STATISTICS -u16_t +uint16_t httpd_fs_count(char *name) { struct httpd_fsdata_file_noconst *f; - u16_t i; + uint16_t i; i = 0; for(f = (struct httpd_fsdata_file_noconst *)HTTPD_FS_ROOT; diff --git a/platform/pc-6001/apps/webserver-mini/httpd-fs.h b/platform/pc-6001/apps/webserver-mini/httpd-fs.h index 8252c2482..7ec27c032 100644 --- a/platform/pc-6001/apps/webserver-mini/httpd-fs.h +++ b/platform/pc-6001/apps/webserver-mini/httpd-fs.h @@ -50,7 +50,7 @@ int httpd_fs_open(const char *name, struct httpd_fs_file *file); #ifdef HTTPD_FS_STATISTICS #if HTTPD_FS_STATISTICS == 1 -u16_t httpd_fs_count(char *name); +uint16_t httpd_fs_count(char *name); #endif /* HTTPD_FS_STATISTICS */ #endif /* HTTPD_FS_STATISTICS */ diff --git a/platform/pc-6001/apps/webserver-mini/httpd-fsdata.h b/platform/pc-6001/apps/webserver-mini/httpd-fsdata.h index 02e418459..e4cc902c9 100644 --- a/platform/pc-6001/apps/webserver-mini/httpd-fsdata.h +++ b/platform/pc-6001/apps/webserver-mini/httpd-fsdata.h @@ -44,7 +44,7 @@ struct httpd_fsdata_file { const int len; #ifdef HTTPD_FS_STATISTICS #if HTTPD_FS_STATISTICS == 1 - u16_t count; + uint16_t count; #endif /* HTTPD_FS_STATISTICS */ #endif /* HTTPD_FS_STATISTICS */ }; @@ -56,7 +56,7 @@ struct httpd_fsdata_file_noconst { int len; #ifdef HTTPD_FS_STATISTICS #if HTTPD_FS_STATISTICS == 1 - u16_t count; + uint16_t count; #endif /* HTTPD_FS_STATISTICS */ #endif /* HTTPD_FS_STATISTICS */ }; diff --git a/platform/pc-6001/contiki-serial-main.c b/platform/pc-6001/contiki-serial-main.c index a3e05df16..bfd5cedbd 100644 --- a/platform/pc-6001/contiki-serial-main.c +++ b/platform/pc-6001/contiki-serial-main.c @@ -46,7 +46,7 @@ #undef RS232_INTR #ifdef RS232_INTR -void rs232_arch_writeb(u8_t ch); +void rs232_arch_writeb(uint8_t ch); void rs232_arch_init(int (* callback)(unsigned char), unsigned long ubr); #else #include "dev/rs232.h" diff --git a/platform/pc-6001/ctk/ctk-conio_arch.c b/platform/pc-6001/ctk/ctk-conio_arch.c index b02941444..4db83b76e 100644 --- a/platform/pc-6001/ctk/ctk-conio_arch.c +++ b/platform/pc-6001/ctk/ctk-conio_arch.c @@ -49,57 +49,57 @@ /* * Offset constants for assembler */ -const u8_t off_widget_x = offsetof(struct ctk_widget, x); -const u8_t off_widget_y = offsetof(struct ctk_widget, y); -const u8_t off_widget_w = offsetof(struct ctk_widget, w); -const u8_t off_widget_h = offsetof(struct ctk_widget, h); -const u8_t off_widget_type = offsetof(struct ctk_widget, type); -const u8_t off_widget_window = offsetof(struct ctk_widget, window); +const uint8_t off_widget_x = offsetof(struct ctk_widget, x); +const uint8_t off_widget_y = offsetof(struct ctk_widget, y); +const uint8_t off_widget_w = offsetof(struct ctk_widget, w); +const uint8_t off_widget_h = offsetof(struct ctk_widget, h); +const uint8_t off_widget_type = offsetof(struct ctk_widget, type); +const uint8_t off_widget_window = offsetof(struct ctk_widget, window); -const u8_t off_widget_label_text = offsetof(struct ctk_widget, widget) + +const uint8_t off_widget_label_text = offsetof(struct ctk_widget, widget) + offsetof(struct ctk_widget_label, text); -const u8_t off_widget_button_text = offsetof(struct ctk_widget, widget) + +const uint8_t off_widget_button_text = offsetof(struct ctk_widget, widget) + offsetof(struct ctk_widget_button, text); -const u8_t off_widget_textentry_text = offsetof(struct ctk_widget, widget) + +const uint8_t off_widget_textentry_text = offsetof(struct ctk_widget, widget) + offsetof(struct ctk_widget_textentry, text); -const u8_t off_widget_textentry_xpos = offsetof(struct ctk_widget, widget) + +const uint8_t off_widget_textentry_xpos = offsetof(struct ctk_widget, widget) + offsetof(struct ctk_widget_textentry, xpos); -const u8_t off_widget_textentry_ypos = offsetof(struct ctk_widget, widget) + +const uint8_t off_widget_textentry_ypos = offsetof(struct ctk_widget, widget) + offsetof(struct ctk_widget_textentry, ypos); -const u8_t off_widget_textentry_state = offsetof(struct ctk_widget, widget) + +const uint8_t off_widget_textentry_state = offsetof(struct ctk_widget, widget) + offsetof(struct ctk_widget_textentry, state); #if CTK_CONF_HYPERLINK -const u8_t off_widget_hyperlink_text = offsetof(struct ctk_widget, widget) + +const uint8_t off_widget_hyperlink_text = offsetof(struct ctk_widget, widget) + offsetof(struct ctk_widget_hyperlink, text); #endif /* CTK_CONF_HYPERLINK */ #if CTK_CONF_ICONS -const u8_t off_widget_icon_title = offsetof(struct ctk_widget, widget) + +const uint8_t off_widget_icon_title = offsetof(struct ctk_widget, widget) + offsetof(struct ctk_widget_icon, title); -const u8_t off_widget_icon_textmap = offsetof(struct ctk_widget, widget) + +const uint8_t off_widget_icon_textmap = offsetof(struct ctk_widget, widget) + offsetof(struct ctk_widget_icon, textmap); #endif /* CTK_CONF_ICONS */ -const u8_t off_window_x = offsetof(struct ctk_window, x); -const u8_t off_window_y = offsetof(struct ctk_window, y); -const u8_t off_window_h = offsetof(struct ctk_window, h); -const u8_t off_window_w = offsetof(struct ctk_window, w); -const u8_t off_window_inactive = offsetof(struct ctk_window, inactive); -const u8_t off_window_active = offsetof(struct ctk_window, active); -const u8_t off_window_next = offsetof(struct ctk_window, next); -const u8_t off_window_focused = offsetof(struct ctk_window, focused); +const uint8_t off_window_x = offsetof(struct ctk_window, x); +const uint8_t off_window_y = offsetof(struct ctk_window, y); +const uint8_t off_window_h = offsetof(struct ctk_window, h); +const uint8_t off_window_w = offsetof(struct ctk_window, w); +const uint8_t off_window_inactive = offsetof(struct ctk_window, inactive); +const uint8_t off_window_active = offsetof(struct ctk_window, active); +const uint8_t off_window_next = offsetof(struct ctk_window, next); +const uint8_t off_window_focused = offsetof(struct ctk_window, focused); #if CTK_CONF_MENUS -const u8_t off_menu_title = offsetof(struct ctk_menu, title); -const u8_t off_menu_active = offsetof(struct ctk_menu, active); -const u8_t off_menu_nitems = offsetof(struct ctk_menu, nitems); -const u8_t off_menu_items = offsetof(struct ctk_menu, items); -const u8_t off_menu_next = offsetof(struct ctk_menu, next); -const u8_t off_menuitem_title = offsetof(struct ctk_menuitem, title); -const u8_t size_menuitem = sizeof(struct ctk_menuitem); -const u8_t off_menus_open = offsetof(struct ctk_menus, open); -const u8_t off_menus_menus = offsetof(struct ctk_menus, menus); -const u8_t off_menus_desktopmenu = offsetof(struct ctk_menus, desktopmenu); +const uint8_t off_menu_title = offsetof(struct ctk_menu, title); +const uint8_t off_menu_active = offsetof(struct ctk_menu, active); +const uint8_t off_menu_nitems = offsetof(struct ctk_menu, nitems); +const uint8_t off_menu_items = offsetof(struct ctk_menu, items); +const uint8_t off_menu_next = offsetof(struct ctk_menu, next); +const uint8_t off_menuitem_title = offsetof(struct ctk_menuitem, title); +const uint8_t size_menuitem = sizeof(struct ctk_menuitem); +const uint8_t off_menus_open = offsetof(struct ctk_menus, open); +const uint8_t off_menus_menus = offsetof(struct ctk_menus, menus); +const uint8_t off_menus_desktopmenu = offsetof(struct ctk_menus, desktopmenu); #endif /*---------------------------------------------------------------------------*/ diff --git a/platform/pc-6001/dev/rs232-asm.S b/platform/pc-6001/dev/rs232-asm.S index ff91e01e2..1cdfd0183 100644 --- a/platform/pc-6001/dev/rs232-asm.S +++ b/platform/pc-6001/dev/rs232-asm.S @@ -65,7 +65,7 @@ _rs232_arch_putc_next2: .endif ;; --------------------------------- - ;; void rs232_writeb(u8_t c) + ;; void rs232_writeb(uint8_t c) ;; Stack; retl reth c ;; AF__D_HL____ ;; return void diff --git a/platform/redbee-dev/contiki-mc1322x-main.c b/platform/redbee-dev/contiki-mc1322x-main.c index 021ca6c22..b62d7f084 100644 --- a/platform/redbee-dev/contiki-mc1322x-main.c +++ b/platform/redbee-dev/contiki-mc1322x-main.c @@ -70,7 +70,7 @@ #if DEBUG #include #define PRINTF(...) printf(__VA_ARGS__) -#define PRINT6ADDR(addr) PRINTF(" %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x ", ((u8_t *)addr)[0], ((u8_t *)addr)[1], ((u8_t *)addr)[2], ((u8_t *)addr)[3], ((u8_t *)addr)[4], ((u8_t *)addr)[5], ((u8_t *)addr)[6], ((u8_t *)addr)[7], ((u8_t *)addr)[8], ((u8_t *)addr)[9], ((u8_t *)addr)[10], ((u8_t *)addr)[11], ((u8_t *)addr)[12], ((u8_t *)addr)[13], ((u8_t *)addr)[14], ((u8_t *)addr)[15]) +#define PRINT6ADDR(addr) PRINTF(" %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x ", ((uint8_t *)addr)[0], ((uint8_t *)addr)[1], ((uint8_t *)addr)[2], ((uint8_t *)addr)[3], ((uint8_t *)addr)[4], ((uint8_t *)addr)[5], ((uint8_t *)addr)[6], ((uint8_t *)addr)[7], ((uint8_t *)addr)[8], ((uint8_t *)addr)[9], ((uint8_t *)addr)[10], ((uint8_t *)addr)[11], ((uint8_t *)addr)[12], ((uint8_t *)addr)[13], ((uint8_t *)addr)[14], ((uint8_t *)addr)[15]) #define PRINTLLADDR(lladdr) PRINTF(" %02x:%02x:%02x:%02x:%02x:%02x ",(lladdr)->addr[0], (lladdr)->addr[1], (lladdr)->addr[2], (lladdr)->addr[3],(lladdr)->addr[4], (lladdr)->addr[5]) #else #define PRINTF(...) diff --git a/platform/redbee-econotag/contiki-mc1322x-main.c b/platform/redbee-econotag/contiki-mc1322x-main.c index 75fdd3d87..82f9f48b4 100644 --- a/platform/redbee-econotag/contiki-mc1322x-main.c +++ b/platform/redbee-econotag/contiki-mc1322x-main.c @@ -89,7 +89,7 @@ void rtimercycle(void) {rtimerflag=1;} #if DEBUG #include #define PRINTF(...) printf(__VA_ARGS__) -#define PRINT6ADDR(addr) PRINTF(" %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x ", ((u8_t *)addr)[0], ((u8_t *)addr)[1], ((u8_t *)addr)[2], ((u8_t *)addr)[3], ((u8_t *)addr)[4], ((u8_t *)addr)[5], ((u8_t *)addr)[6], ((u8_t *)addr)[7], ((u8_t *)addr)[8], ((u8_t *)addr)[9], ((u8_t *)addr)[10], ((u8_t *)addr)[11], ((u8_t *)addr)[12], ((u8_t *)addr)[13], ((u8_t *)addr)[14], ((u8_t *)addr)[15]) +#define PRINT6ADDR(addr) PRINTF(" %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x ", ((uint8_t *)addr)[0], ((uint8_t *)addr)[1], ((uint8_t *)addr)[2], ((uint8_t *)addr)[3], ((uint8_t *)addr)[4], ((uint8_t *)addr)[5], ((uint8_t *)addr)[6], ((uint8_t *)addr)[7], ((uint8_t *)addr)[8], ((uint8_t *)addr)[9], ((uint8_t *)addr)[10], ((uint8_t *)addr)[11], ((uint8_t *)addr)[12], ((uint8_t *)addr)[13], ((uint8_t *)addr)[14], ((uint8_t *)addr)[15]) #define PRINTLLADDR(lladdr) PRINTF(" %02x:%02x:%02x:%02x:%02x:%02x ",(lladdr)->addr[0], (lladdr)->addr[1], (lladdr)->addr[2], (lladdr)->addr[3],(lladdr)->addr[4], (lladdr)->addr[5]) #else #define PRINTF(...) diff --git a/platform/stepper-robot/contiki-conf.h b/platform/stepper-robot/contiki-conf.h index 50115db28..c457801af 100644 --- a/platform/stepper-robot/contiki-conf.h +++ b/platform/stepper-robot/contiki-conf.h @@ -13,6 +13,8 @@ #define WITH_ASCII 1 #define CLOCK_CONF_SECOND 100 + +/* These names are deprecated, use C99 names. */ typedef uint8_t u8_t; typedef uint16_t u16_t; typedef uint32_t u32_t; diff --git a/platform/stk500/contiki-conf.h b/platform/stk500/contiki-conf.h index ca0b85295..c0b26336b 100644 --- a/platform/stk500/contiki-conf.h +++ b/platform/stk500/contiki-conf.h @@ -65,6 +65,7 @@ unsigned long clock_seconds(void); typedef unsigned short uip_stats_t; +/* These names are deprecated, use C99 names. */ typedef uint8_t u8_t; typedef int8_t s8_t; typedef uint16_t u16_t; diff --git a/platform/stk501/contiki-stk501-main.c b/platform/stk501/contiki-stk501-main.c index 38ee2dc85..0baf2a259 100644 --- a/platform/stk501/contiki-stk501-main.c +++ b/platform/stk501/contiki-stk501-main.c @@ -58,6 +58,8 @@ /* Uncomment to enable demonstration of multi-threading libary */ /* #define MT_DEMO */ +#define PRINTF(FORMAT,args...) printf_P(PSTR(FORMAT),##args) + //TODO: What happened to cfs_eeprom_process? //PROCINIT(&etimer_process, &tcpip_process, &uip_fw_process, &cfs_eeprom_process); #if UIP_CONF_IPV6 @@ -72,8 +74,7 @@ static struct mt_thread threads[3]; static void thread_handler1 (void* data) { while (1) { - rs232_print_p (RS232_PORT_1, PSTR ("Thread 1. Data: ") ); - rs232_printf (RS232_PORT_1, "0x%x, %d\n", data, *(uint8_t*)data ); + PRINTF ("Thread 1. Data: 0x%x, %d\n", data, *(uint8_t*)data ); mt_yield (); } } @@ -81,8 +82,7 @@ void thread_handler1 (void* data) { static void thread_handler2 (void* data) { while (1) { - rs232_print_p (RS232_PORT_1, PSTR ("Thread 2. Data: ")); - rs232_printf (RS232_PORT_1, "0x%x, %d\n", data, *(uint8_t*)data ); + PRINTF ("Thread 2. Data: 0x%x, %d\n", data, *(uint8_t*)data ); mt_yield (); } } @@ -138,7 +138,7 @@ main(void) /* Perform rest of initializations */ process_start(&contiki_stk501_main_init_process, NULL); - rs232_print_p (RS232_PORT_1, PSTR ("Initialized.\n")); + PRINTF"Initialized.\n"); #ifdef MT_DEMO mt_start (&threads[0], thread_handler1, &d1); diff --git a/platform/stm32test/contiki-conf.h b/platform/stm32test/contiki-conf.h index b68fbd551..ee1ad8677 100644 --- a/platform/stm32test/contiki-conf.h +++ b/platform/stm32test/contiki-conf.h @@ -10,6 +10,8 @@ #define WITH_ASCII 1 #define CLOCK_CONF_SECOND 100 + +/* These names are deprecated, use C99 names. */ typedef uint8_t u8_t; typedef uint16_t u16_t; typedef uint32_t u32_t; diff --git a/platform/z1/dev/adxl345.c b/platform/z1/dev/adxl345.c index 3cd86f6e3..c19ad0031 100644 --- a/platform/z1/dev/adxl345.c +++ b/platform/z1/dev/adxl345.c @@ -46,8 +46,8 @@ #include "i2cmaster.h" /* Callback pointers when interrupt occurs */ -void (*accm_int1_cb)(u8_t reg); -void (*accm_int2_cb)(u8_t reg); +void (*accm_int1_cb)(uint8_t reg); +void (*accm_int2_cb)(uint8_t reg); process_event_t int1_event, int2_event; @@ -119,8 +119,8 @@ PROCESS(accmeter_process, "Accelerometer process"); */ void -accm_write_reg(u8_t reg, u8_t val) { - u8_t tx_buf[] = {reg, val}; +accm_write_reg(uint8_t reg, uint8_t val) { + uint8_t tx_buf[] = {reg, val}; i2c_transmitinit(ADXL345_ADDR); while (i2c_busy()); @@ -140,7 +140,7 @@ accm_write_reg(u8_t reg, u8_t val) { The data is then written from second byte and increasing. */ void -accm_write_stream(u8_t len, u8_t *data) { +accm_write_stream(uint8_t len, uint8_t *data) { i2c_transmitinit(ADXL345_ADDR); while (i2c_busy()); PRINTFDEBUG("I2C Ready to TX(stream)\n"); @@ -157,10 +157,10 @@ accm_write_stream(u8_t len, u8_t *data) { returns the value of the read register */ -u8_t -accm_read_reg(u8_t reg) { - u8_t retVal = 0; - u8_t rtx = reg; +uint8_t +accm_read_reg(uint8_t reg) { + uint8_t retVal = 0; + uint8_t rtx = reg; PRINTFDEBUG("READ_REG 0x%02X\n", reg); /* transmit the register to read */ @@ -187,8 +187,8 @@ accm_read_reg(u8_t reg) { */ void -accm_read_stream(u8_t reg, u8_t len, u8_t *whereto) { - u8_t rtx = reg; +accm_read_stream(uint8_t reg, uint8_t len, uint8_t *whereto) { + uint8_t rtx = reg; PRINTFDEBUG("READ_STR %u B from 0x%02X\n", len, reg); /* transmit the register to start reading from */ @@ -213,7 +213,7 @@ accm_read_stream(u8_t reg, u8_t len, u8_t *whereto) { int16_t accm_read_axis(enum ADXL345_AXIS axis){ int16_t rd = 0; - u8_t tmp[2]; + uint8_t tmp[2]; if(axis > Z_AXIS){ return 0; } @@ -234,13 +234,13 @@ accm_read_axis(enum ADXL345_AXIS axis){ */ void -accm_set_grange(u8_t grange){ +accm_set_grange(uint8_t grange){ if(grange > ADXL345_RANGE_16G) { // invalid g-range. PRINTFDEBUG("ADXL grange invalid: %u\n", grange); return; } - u8_t tempreg = 0; + uint8_t tempreg = 0; /* preserve the previous contents of the register */ tempreg = (accm_read_reg(ADXL345_DATA_FORMAT) & 0xFC); // zero out the last two bits (grange) diff --git a/platform/z1/dev/adxl345.h b/platform/z1/dev/adxl345.h index 8da72cf5c..c0cc6e7f6 100644 --- a/platform/z1/dev/adxl345.h +++ b/platform/z1/dev/adxl345.h @@ -79,7 +79,7 @@ void accm_init(void); reg register to write to val value to write */ -void accm_write_reg(u8_t reg, u8_t val); +void accm_write_reg(uint8_t reg, uint8_t val); /* Write several registers from a stream. args: @@ -88,14 +88,14 @@ void accm_write_reg(u8_t reg, u8_t val); First byte in stream must be the register address to begin writing to. The data is then written from the second byte and increasing. The address byte is not included in length len. */ -void accm_write_stream(u8_t len, u8_t *data); +void accm_write_stream(uint8_t len, uint8_t *data); /* Read one register. args: reg what register to read returns the value of the read register */ -u8_t accm_read_reg(u8_t reg); +uint8_t accm_read_reg(uint8_t reg); /* Read several registers in a stream. args: @@ -103,7 +103,7 @@ u8_t accm_read_reg(u8_t reg); len number of bytes to read whereto pointer to where the data is saved */ -void accm_read_stream(u8_t reg, u8_t len, u8_t *whereto); +void accm_read_stream(uint8_t reg, uint8_t len, uint8_t *whereto); /* Read an axis of the accelerometer (x, y or z). Return value is a signed 10 bit int. The resolution of the acceleration measurement can be increased up to 13 bit, but @@ -120,14 +120,14 @@ int16_t accm_read_axis(enum ADXL345_AXIS axis); Example: accm_set_grange(ADXL345_RANGE_4G); */ -void accm_set_grange(u8_t grange); +void accm_set_grange(uint8_t grange); /* Map interrupt (FF, tap, dbltap etc) to interrupt pin (IRQ_INT1, IRQ_INT2). This must come after accm_init() as the registers will otherwise be overwritten. */ void accm_set_irq(uint8_t int1, uint8_t int2); /* Macros for setting the pointers to callback functions from the interrupts. - The function will be called with an u8_t as parameter, containing the interrupt + The function will be called with an uint8_t as parameter, containing the interrupt flag register from the ADXL345. That way, several interrupts can be mapped to the same pin and be read from the */ #define ACCM_REGISTER_INT1_CB(ptr) accm_int1_cb = ptr; @@ -278,8 +278,8 @@ void accm_set_irq(uint8_t int1, uint8_t int2); #define ADXL345_SRATE_0_10 0x00 // 0.10 Hz, when I2C data rate >= 100 kHz /* Callback pointers for the interrupts */ -extern void (*accm_int1_cb)(u8_t reg); -extern void (*accm_int2_cb)(u8_t reg); +extern void (*accm_int1_cb)(uint8_t reg); +extern void (*accm_int2_cb)(uint8_t reg); /* Interrupt 1 and 2 events; ADXL345 signals interrupt on INT1 or INT2 pins, ISR is invoked and polls the accelerometer process which invokes the callbacks. */ diff --git a/platform/z1/dev/i2cmaster.c b/platform/z1/dev/i2cmaster.c index 14f43f8dc..54871467a 100644 --- a/platform/z1/dev/i2cmaster.c +++ b/platform/z1/dev/i2cmaster.c @@ -59,7 +59,7 @@ volatile unsigned int i; // volatile to prevent optimization // unsigned char prescale => SCL clock adjustment //----------------------------------------------------------------------------- void -i2c_receiveinit(u8_t slave_address) { +i2c_receiveinit(uint8_t slave_address) { UCB1CTL1 = UCSWRST; // Enable SW reset UCB1CTL0 = UCMST + UCMODE_3 + UCSYNC; // I2C Master, synchronous mode UCB1CTL1 = UCSSEL_2 | UCSWRST; // Use SMCLK, keep SW reset @@ -86,7 +86,7 @@ i2c_receiveinit(u8_t slave_address) { // unsigned char prescale => SCL clock adjustment //------------------------------------------------------------------------------ void -i2c_transmitinit(u8_t slave_address) { +i2c_transmitinit(uint8_t slave_address) { UCB1CTL1 |= UCSWRST; // Enable SW reset UCB1CTL0 |= (UCMST | UCMODE_3 | UCSYNC); // I2C Master, synchronous mode UCB1CTL1 = UCSSEL_2 + UCSWRST; // Use SMCLK, keep SW reset @@ -107,9 +107,9 @@ i2c_transmitinit(u8_t slave_address) { // OUT: unsigned char rx_buf => receive data buffer // OUT: int n_received => number of bytes read //------------------------------------------------------------------------------ -static volatile u8_t rx_byte_tot = 0; -u8_t -i2c_receive_n(u8_t byte_ctr, u8_t *rx_buf) { +static volatile uint8_t rx_byte_tot = 0; +uint8_t +i2c_receive_n(uint8_t byte_ctr, uint8_t *rx_buf) { rx_byte_tot = byte_ctr; rx_byte_ctr = byte_ctr; @@ -136,7 +136,7 @@ i2c_receive_n(u8_t byte_ctr, u8_t *rx_buf) { return 0; #else - u8_t n_received = 0; + uint8_t n_received = 0; PRINTFDEBUG(" RX Interrupts: NO \n"); @@ -157,14 +157,14 @@ i2c_receive_n(u8_t byte_ctr, u8_t *rx_buf) { //------------------------------------------------------------------------------ -// u8_t i2c_busy() +// uint8_t i2c_busy() // // This function is used to check if there is communication in progress. // // OUT: unsigned char => 0: I2C bus is idle, // 1: communication is in progress //------------------------------------------------------------------------------ -u8_t +uint8_t i2c_busy(void) { return (UCB1STAT & UCBBUSY); } @@ -191,9 +191,9 @@ i2c_enable(void) { // IN: unsigned char byte_ctr => number of bytes to be transmitted // unsigned char *tx_buf => Content to transmit. Read and transmitted from [0] to [byte_ctr] //------------------------------------------------------------------------------ -static volatile u8_t tx_byte_tot = 0; +static volatile uint8_t tx_byte_tot = 0; void -i2c_transmit_n(u8_t byte_ctr, u8_t *tx_buf) { +i2c_transmit_n(uint8_t byte_ctr, uint8_t *tx_buf) { tx_byte_tot = byte_ctr; tx_byte_ctr = byte_ctr; tx_buf_ptr = tx_buf; diff --git a/platform/z1/dev/i2cmaster.h b/platform/z1/dev/i2cmaster.h index beccf3f5f..192e99ea1 100644 --- a/platform/z1/dev/i2cmaster.h +++ b/platform/z1/dev/i2cmaster.h @@ -45,13 +45,13 @@ void i2c_enable(void); -void i2c_receiveinit(u8_t slave_address); -u8_t i2c_receive_n(u8_t byte_ctr, u8_t *rx_buf); +void i2c_receiveinit(uint8_t slave_address); +uint8_t i2c_receive_n(uint8_t byte_ctr, uint8_t *rx_buf); -void i2c_transmitinit(u8_t slave_address); -void i2c_transmit_n(u8_t byte_ctr, u8_t *tx_buf); +void i2c_transmitinit(uint8_t slave_address); +void i2c_transmit_n(uint8_t byte_ctr, uint8_t *tx_buf); -u8_t i2c_busy(void); +uint8_t i2c_busy(void); //XXX Should these defines be in the contiki-conf.h to make it more platform-independent? #define I2C_PxDIR P5DIR diff --git a/platform/z1/dev/tmp102.c b/platform/z1/dev/tmp102.c index 9bf4691d2..59d6b6de7 100644 --- a/platform/z1/dev/tmp102.c +++ b/platform/z1/dev/tmp102.c @@ -97,12 +97,12 @@ tmp102_init (void) */ void -tmp102_write_reg (u8_t reg, u16_t val) +tmp102_write_reg (uint8_t reg, uint16_t val) { - u8_t tx_buf[] = { reg, 0x00, 0x00 }; + uint8_t tx_buf[] = { reg, 0x00, 0x00 }; - tx_buf[1] = (u8_t) (val >> 8); - tx_buf[2] = (u8_t) (val & 0x00FF); + tx_buf[1] = (uint8_t) (val >> 8); + tx_buf[2] = (uint8_t) (val & 0x00FF); i2c_transmitinit (TMP102_ADDR); while (i2c_busy ()); @@ -117,15 +117,15 @@ tmp102_write_reg (u8_t reg, u16_t val) /* Read register. args: reg what register to read - returns the value of the read register type u16_t + returns the value of the read register type uint16_t */ -u16_t -tmp102_read_reg (u8_t reg) +uint16_t +tmp102_read_reg (uint8_t reg) { - u8_t buf[] = { 0x00, 0x00 }; - u16_t retVal = 0; - u8_t rtx = reg; + uint8_t buf[] = { 0x00, 0x00 }; + uint16_t retVal = 0; + uint8_t rtx = reg; PRINTFDEBUG ("READ_REG 0x%02X\n", reg); // transmit the register to read @@ -140,7 +140,7 @@ tmp102_read_reg (u8_t reg) i2c_receive_n (2, &buf[0]); while (i2c_busy ()); - retVal = (u16_t) (buf[0] << 8 | (buf[1])); + retVal = (uint16_t) (buf[0] << 8 | (buf[1])); return retVal; } @@ -150,10 +150,10 @@ tmp102_read_reg (u8_t reg) to make an interpretation of these 12 or 13-bit data, depending on configuration */ -u16_t +uint16_t tmp102_read_temp_raw (void) { - u16_t rd = 0; + uint16_t rd = 0; rd = tmp102_read_reg (TMP102_TEMP); diff --git a/platform/z1/dev/tmp102.h b/platform/z1/dev/tmp102.h index db6fd5112..3265e976d 100644 --- a/platform/z1/dev/tmp102.h +++ b/platform/z1/dev/tmp102.h @@ -53,19 +53,19 @@ void tmp102_init(void); reg register to write to val value to write */ -void tmp102_write_reg(u8_t reg, u16_t val); +void tmp102_write_reg(uint8_t reg, uint16_t val); /* Read one register. args: reg what register to read returns the value of the read register */ -u16_t tmp102_read_reg(u8_t reg); +uint16_t tmp102_read_reg(uint8_t reg); /* Read temperature in raw format no args needed */ -u16_t tmp102_read_temp_raw(); +uint16_t tmp102_read_temp_raw(); /* Read only integer part of the temperature in 1deg. precision. no args needed diff --git a/tools/avr-make-symbols b/tools/avr-make-symbols index d8365f5ba..83c6e591b 100755 --- a/tools/avr-make-symbols +++ b/tools/avr-make-symbols @@ -13,7 +13,7 @@ echo \#endif >> symbols.h echo \#include '"symbols.h"' > symbols.c echo \#include '' >> symbols.c -$NM $* | perl -ne 'print ".global $2\n$2 = 0x$1\n" if(/([0-9a-f]+) [ABDRST] (.+)$/);' | grep -v ^_ | grep -v _reset_vector | grep = | perl -ne 'print "static const prog_char s_$1 [] = \"$1\";\n" if(/(\w+) = (\w+)/)' | sort >> symbols.c +$NM $* | perl -ne 'print ".global $2\n$2 = 0x$1\n" if(/([0-9a-f]+) [ABDRST] (.+)$/);' | grep -v ^_ | grep -v _reset_vector | grep = | perl -ne 'print "static const unsigned char s_$1 [] PROGMEM = \"$1\";\n" if(/(\w+) = (\w+)/)' | sort >> symbols.c echo "PROGMEM const struct symbols symbols[] = {" >> symbols.c avr-nm $* | perl -ne 'print ".global $2\n$2 = 0x$1\n" if(/([0-9a-f]+) [ABDRST] (.+)$/);' | grep -v ^_ | grep -v _reset_vector | grep = | perl -ne 'print "{(const char*)s_$1, (void*)$2},\n" if(/(\w+) = (\w+)/)' | sort >> symbols.c diff --git a/tools/avr-makecoffeedata b/tools/avr-makecoffeedata index b8ef7b985..38697eaef 100644 --- a/tools/avr-makecoffeedata +++ b/tools/avr-makecoffeedata @@ -238,8 +238,8 @@ print(OUTPUT "$tab const struct httpd_fsdata_file *next; //actual flash address print(OUTPUT "$tab const char *name; //offset to coffee file name\n"); print(OUTPUT "$tab const char *data; //offset to coffee file data\n"); print(OUTPUT "$tab const int len; //length of file data\n"); -print(OUTPUT "#if HTTPD_FS_STATISTICS == 1 //not enabled since list is in PROGMEM\n"); -print(OUTPUT "$tab u16_t count; //storage for file statistics\n"); +print(OUTPUT "#if HTTPD_FS_STATISTICS == 1 //not enabled since list is in PROGMEM\n"); +print(OUTPUT "$tab uint16_t count; //storage for file statistics\n"); print(OUTPUT "#endif\n"); print(OUTPUT "}\n*/\n"); diff --git a/tools/makefsdata b/tools/makefsdata index 4d721b6a5..5ea48a611 100755 --- a/tools/makefsdata +++ b/tools/makefsdata @@ -323,8 +323,8 @@ print(OUTPUT "$tab const struct httpd_fsdata_file *next; //actual flash address print(OUTPUT "$tab const char *name; //offset to coffee file name\n"); print(OUTPUT "$tab const char *data; //offset to coffee file data\n"); print(OUTPUT "$tab const int len; //length of file data\n"); -print(OUTPUT "#if HTTPD_FS_STATISTICS == 1 //not enabled since list is in PROGMEM\n"); -print(OUTPUT "$tab u16_t count; //storage for file statistics\n"); +print(OUTPUT "#if HTTPD_FS_STATISTICS == 1 //not enabled since list is in PROGMEM\n"); +print(OUTPUT "$tab uint16_t count; //storage for file statistics\n"); print(OUTPUT "#endif\n"); print(OUTPUT "}\n*/\n"); diff --git a/tools/sky/uip6-bridge/fakeuip.c b/tools/sky/uip6-bridge/fakeuip.c index c79ae74ae..0b1592efc 100644 --- a/tools/sky/uip6-bridge/fakeuip.c +++ b/tools/sky/uip6-bridge/fakeuip.c @@ -12,13 +12,13 @@ uip_buf_t uip_aligned_buf; -u16_t uip_len; +uint16_t uip_len; struct uip_stats uip_stat; uip_lladdr_t uip_lladdr; -u16_t uip_htons(u16_t val) { return UIP_HTONS(val);} +uint16_t uip_htons(uint16_t val) { return UIP_HTONS(val);} uip_ds6_netif_t uip_ds6_if; @@ -69,12 +69,12 @@ uip_ds6_addr_add(uip_ipaddr_t *ipaddr, unsigned long vlifetime, uint8_t type) } /********** UIP.c ****************/ -static u16_t -chksum(u16_t sum, const u8_t *data, u16_t len) +static uint16_t +chksum(uint16_t sum, const uint8_t *data, uint16_t len) { - u16_t t; - const u8_t *dataptr; - const u8_t *last_byte; + uint16_t t; + const uint8_t *dataptr; + const uint8_t *last_byte; dataptr = data; last_byte = data + len - 1; @@ -100,19 +100,19 @@ chksum(u16_t sum, const u8_t *data, u16_t len) return sum; } -static u16_t -upper_layer_chksum(u8_t proto) +static uint16_t +upper_layer_chksum(uint8_t proto) { - u16_t upper_layer_len; - u16_t sum; + uint16_t upper_layer_len; + uint16_t sum; - upper_layer_len = (((u16_t)(UIP_IP_BUF->len[0]) << 8) + UIP_IP_BUF->len[1]) ; + upper_layer_len = (((uint16_t)(UIP_IP_BUF->len[0]) << 8) + UIP_IP_BUF->len[1]) ; /* First sum pseudoheader. */ /* IP protocol and length fields. This addition cannot carry. */ sum = upper_layer_len + proto; /* Sum IP source and destination addresses. */ - sum = chksum(sum, (u8_t *)&UIP_IP_BUF->srcipaddr, 2 * sizeof(uip_ipaddr_t)); + sum = chksum(sum, (uint8_t *)&UIP_IP_BUF->srcipaddr, 2 * sizeof(uip_ipaddr_t)); /* Sum TCP header and data. */ sum = chksum(sum, &uip_buf[UIP_IPH_LEN + UIP_LLH_LEN], @@ -122,7 +122,7 @@ upper_layer_chksum(u8_t proto) } /*---------------------------------------------------------------------------*/ -u16_t +uint16_t uip_icmp6chksum(void) { return upper_layer_chksum(UIP_PROTO_ICMP6); diff --git a/tools/stm32w/uip6_bridge/fakeuip.c b/tools/stm32w/uip6_bridge/fakeuip.c index 9054b2b96..f52c77ef5 100644 --- a/tools/stm32w/uip6_bridge/fakeuip.c +++ b/tools/stm32w/uip6_bridge/fakeuip.c @@ -12,13 +12,13 @@ uip_buf_t uip_aligned_buf; -u16_t uip_len; +uint16_t uip_len; struct uip_stats uip_stat; uip_lladdr_t uip_lladdr; -u16_t htons(u16_t val) { return UIP_HTONS(val);} +uint16_t htons(uint16_t val) { return UIP_HTONS(val);} uip_ds6_netif_t uip_ds6_if; @@ -69,12 +69,12 @@ uip_ds6_addr_add(uip_ipaddr_t *ipaddr, unsigned long vlifetime, uint8_t type) } /********** UIP.c ****************/ -static u16_t -chksum(u16_t sum, const u8_t *data, u16_t len) +static uint16_t +chksum(uint16_t sum, const uint8_t *data, uint16_t len) { - u16_t t; - const u8_t *dataptr; - const u8_t *last_byte; + uint16_t t; + const uint8_t *dataptr; + const uint8_t *last_byte; dataptr = data; last_byte = data + len - 1; @@ -100,19 +100,19 @@ chksum(u16_t sum, const u8_t *data, u16_t len) return sum; } -static u16_t -upper_layer_chksum(u8_t proto) +static uint16_t +upper_layer_chksum(uint8_t proto) { - u16_t upper_layer_len; - u16_t sum; + uint16_t upper_layer_len; + uint16_t sum; - upper_layer_len = (((u16_t)(UIP_IP_BUF->len[0]) << 8) + UIP_IP_BUF->len[1]) ; + upper_layer_len = (((uint16_t)(UIP_IP_BUF->len[0]) << 8) + UIP_IP_BUF->len[1]) ; /* First sum pseudoheader. */ /* IP protocol and length fields. This addition cannot carry. */ sum = upper_layer_len + proto; /* Sum IP source and destination addresses. */ - sum = chksum(sum, (u8_t *)&UIP_IP_BUF->srcipaddr, 2 * sizeof(uip_ipaddr_t)); + sum = chksum(sum, (uint8_t *)&UIP_IP_BUF->srcipaddr, 2 * sizeof(uip_ipaddr_t)); /* Sum TCP header and data. */ sum = chksum(sum, &uip_buf[UIP_IPH_LEN + UIP_LLH_LEN], @@ -122,7 +122,7 @@ upper_layer_chksum(u8_t proto) } /*---------------------------------------------------------------------------*/ -u16_t +uint16_t uip_icmp6chksum(void) { return upper_layer_chksum(UIP_PROTO_ICMP6); diff --git a/tools/stm32w/wpcapslip6/contiki-conf.h b/tools/stm32w/wpcapslip6/contiki-conf.h index 432dc4c22..1ca2c97c2 100644 --- a/tools/stm32w/wpcapslip6/contiki-conf.h +++ b/tools/stm32w/wpcapslip6/contiki-conf.h @@ -4,10 +4,12 @@ #define CCIF #define CLIF +/* These names are deprecated, use C99 names. */ typedef uint8_t u8_t; typedef uint16_t u16_t; typedef uint32_t u32_t; typedef int32_t s32_t; + typedef unsigned short uip_stats_t; #define UIP_CONF_UIP_IP4ADDR_T_WITH_U32 1 diff --git a/tools/stm32w/wpcapslip6/fakeuip.c b/tools/stm32w/wpcapslip6/fakeuip.c index 23513f1c6..3072bda84 100644 --- a/tools/stm32w/wpcapslip6/fakeuip.c +++ b/tools/stm32w/wpcapslip6/fakeuip.c @@ -11,16 +11,16 @@ #undef uip_buf unsigned char *uip_buf; -u16_t uip_len; +uint16_t uip_len; #define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN]) -static u16_t -chksum(u16_t sum, const u8_t *data, u16_t len) +static uint16_t +chksum(uint16_t sum, const uint8_t *data, uint16_t len) { - u16_t t; - const u8_t *dataptr; - const u8_t *last_byte; + uint16_t t; + const uint8_t *dataptr; + const uint8_t *last_byte; dataptr = data; last_byte = data + len - 1; @@ -46,19 +46,19 @@ chksum(u16_t sum, const u8_t *data, u16_t len) return sum; } -static u16_t -upper_layer_chksum(u8_t proto) +static uint16_t +upper_layer_chksum(uint8_t proto) { - u16_t upper_layer_len; - u16_t sum; + uint16_t upper_layer_len; + uint16_t sum; - upper_layer_len = (((u16_t)(UIP_IP_BUF->len[0]) << 8) + UIP_IP_BUF->len[1]) ; + upper_layer_len = (((uint16_t)(UIP_IP_BUF->len[0]) << 8) + UIP_IP_BUF->len[1]) ; /* First sum pseudoheader. */ /* IP protocol and length fields. This addition cannot carry. */ sum = upper_layer_len + proto; /* Sum IP source and destination addresses. */ - sum = chksum(sum, (u8_t *)&UIP_IP_BUF->srcipaddr, 2 * sizeof(uip_ipaddr_t)); + sum = chksum(sum, (uint8_t *)&UIP_IP_BUF->srcipaddr, 2 * sizeof(uip_ipaddr_t)); /* Sum TCP header and data. */ sum = chksum(sum, &uip_buf[UIP_IPH_LEN + UIP_LLH_LEN], @@ -68,7 +68,7 @@ upper_layer_chksum(u8_t proto) } /*---------------------------------------------------------------------------*/ -u16_t +uint16_t uip_icmp6chksum(void) { return upper_layer_chksum(UIP_PROTO_ICMP6); diff --git a/tools/stm32w/wpcapslip6/ip-process.c b/tools/stm32w/wpcapslip6/ip-process.c index 0616ece15..50b2cd84a 100644 --- a/tools/stm32w/wpcapslip6/ip-process.c +++ b/tools/stm32w/wpcapslip6/ip-process.c @@ -14,7 +14,7 @@ #undef uip_buf extern unsigned char *uip_buf; -extern u16_t uip_len; +extern uint16_t uip_len; #define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN]) @@ -200,7 +200,7 @@ uint8_t mac_createEthernetAddr(uint8_t * ethernet, uip_lladdr_t * lowpan) { /* uint8_t j, match; */ - u8_t tmp[8]; + uint8_t tmp[8]; memcpy(tmp,lowpan,sizeof(uip_lladdr_t)); @@ -247,7 +247,7 @@ void slide(uint8_t * data, uint8_t length, int16_t slide) -u16_t ip_process(unsigned char *buf, unsigned int len) +uint16_t ip_process(unsigned char *buf, unsigned int len) { uip_buf = buf; uip_len = len; diff --git a/tools/stm32w/wpcapslip6/ip-process.h b/tools/stm32w/wpcapslip6/ip-process.h index 426b855de..b09d110a3 100644 --- a/tools/stm32w/wpcapslip6/ip-process.h +++ b/tools/stm32w/wpcapslip6/ip-process.h @@ -1,6 +1,6 @@ #ifndef IP_PROCESS_H #define IP_PROCESS_H -u16_t ip_process(unsigned char *buf, unsigned int len); +uint16_t ip_process(unsigned char *buf, unsigned int len); #endif /* IP_PROCESS_H */ diff --git a/tools/stm32w/wpcapslip6/wpcapslip6.c b/tools/stm32w/wpcapslip6/wpcapslip6.c index 5d4f5d3cf..7ad9dd6c0 100755 --- a/tools/stm32w/wpcapslip6/wpcapslip6.c +++ b/tools/stm32w/wpcapslip6/wpcapslip6.c @@ -331,8 +331,8 @@ is_sensible_string(const unsigned char *s, int len) void serial_to_wpcap(FILE *inslip) { - u16_t buf_aligned[BUF_SIZE/2 + 42]; //extra for possible eth_hdr and ip_process expansion - u8_t *buf = (u8_t *)buf_aligned; + uint16_t buf_aligned[BUF_SIZE/2 + 42]; //extra for possible eth_hdr and ip_process expansion + uint8_t *buf = (uint8_t *)buf_aligned; static int inbufptr = 0, issensiblestring=1; int ret; diff --git a/tools/wpcapslip/contiki-conf.h b/tools/wpcapslip/contiki-conf.h index 432dc4c22..1ca2c97c2 100644 --- a/tools/wpcapslip/contiki-conf.h +++ b/tools/wpcapslip/contiki-conf.h @@ -4,10 +4,12 @@ #define CCIF #define CLIF +/* These names are deprecated, use C99 names. */ typedef uint8_t u8_t; typedef uint16_t u16_t; typedef uint32_t u32_t; typedef int32_t s32_t; + typedef unsigned short uip_stats_t; #define UIP_CONF_UIP_IP4ADDR_T_WITH_U32 1 diff --git a/tools/wpcapslip/wpcap.c b/tools/wpcapslip/wpcap.c index 5ad816184..b154cf436 100644 --- a/tools/wpcapslip/wpcap.c +++ b/tools/wpcapslip/wpcap.c @@ -121,14 +121,14 @@ static int (* pcap_sendpacket)(struct pcap *, unsigned char *, int); struct ethip_hdr { struct uip_eth_hdr ethhdr; /* IP header. */ - u8_t vhl, + uint8_t vhl, tos, len[2], ipid[2], ipoffset[2], ttl, proto; - u16_t ipchksum; + uint16_t ipchksum; uip_ipaddr_t srcipaddr, destipaddr; }; @@ -149,7 +149,7 @@ struct arp_hdr { struct arp_entry { uip_ipaddr_t ipaddr; struct uip_eth_addr ethaddr; - u8_t time; + uint8_t time; }; static struct uip_eth_addr uip_ethaddr = {{0,0,0,0,0,0}}; static const uip_ipaddr_t all_zeroes_addr = { { 0x0, /* rest is 0 */ } };