Corrected debug output

This commit is contained in:
Niclas Finne 2012-01-21 10:53:05 +01:00
parent 7ca141b457
commit b65972d32d
3 changed files with 21 additions and 32 deletions

View file

@ -27,8 +27,6 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
*
* $Id: chameleon-bitopt.c,v 1.9 2010/05/28 06:18:39 nifi Exp $
*/ */
/** /**
@ -137,10 +135,8 @@ header_size(const struct packetbuf_attrlist *a)
continue; continue;
} }
#endif /* CHAMELEON_WITH_MAC_LINK_ADDRESSES */ #endif /* CHAMELEON_WITH_MAC_LINK_ADDRESSES */
/* PRINTF("chameleon header_size: header type %s (%d) len %d\n", /* PRINTF("chameleon header_size: header type %d len %d\n",
packetbuf_attr_strings[a->type], a->type, a->len);*/
a->type,
a->len);*/
len = a->len; len = a->len;
/* if(len < 8) { /* if(len < 8) {
len = 8; len = 8;
@ -269,9 +265,9 @@ pack_header(struct channel *c)
continue; continue;
} }
#endif /* CHAMELEON_WITH_MAC_LINK_ADDRESSES */ #endif /* CHAMELEON_WITH_MAC_LINK_ADDRESSES */
PRINTF("%d.%d: pack_header type %s, len %d, bitptr %d, ", PRINTF("%d.%d: pack_header type %d, len %d, bitptr %d, ",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
packetbuf_attr_strings[a->type], a->len, bitptr); a->type, a->len, bitptr);
/* len = (a->len & 0xf8) + ((a->len & 7) ? 8: 0);*/ /* len = (a->len & 0xf8) + ((a->len & 7) ? 8: 0);*/
len = a->len; len = a->len;
byteptr = bitptr / 8; byteptr = bitptr / 8;
@ -339,29 +335,27 @@ unpack_header(void)
continue; continue;
} }
#endif /* CHAMELEON_WITH_MAC_LINK_ADDRESSES */ #endif /* CHAMELEON_WITH_MAC_LINK_ADDRESSES */
PRINTF("%d.%d: unpack_header type %s, len %d, bitptr %d\n", PRINTF("%d.%d: unpack_header type %d, len %d, bitptr %d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
packetbuf_attr_strings[a->type], a->len, bitptr); a->type, a->len, bitptr);
/* len = (a->len & 0xf8) + ((a->len & 7) ? 8: 0);*/ /* len = (a->len & 0xf8) + ((a->len & 7) ? 8: 0);*/
len = a->len; len = a->len;
byteptr = bitptr / 8; byteptr = bitptr / 8;
if(PACKETBUF_IS_ADDR(a->type)) { if(PACKETBUF_IS_ADDR(a->type)) {
rimeaddr_t addr; rimeaddr_t addr;
get_bits((uint8_t *)&addr, &hdrptr[byteptr], bitptr & 7, len); get_bits((uint8_t *)&addr, &hdrptr[byteptr], bitptr & 7, len);
PRINTF("%d.%d: unpack_header type %s, addr %d.%d\n", PRINTF("%d.%d: unpack_header type %d, addr %d.%d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
packetbuf_attr_strings[a->type], a->type, addr.u8[0], addr.u8[1]);
addr.u8[0], addr.u8[1]);
packetbuf_set_addr(a->type, &addr); packetbuf_set_addr(a->type, &addr);
} else { } else {
packetbuf_attr_t val = 0; packetbuf_attr_t val = 0;
get_bits((uint8_t *)&val, &hdrptr[byteptr], bitptr & 7, len); get_bits((uint8_t *)&val, &hdrptr[byteptr], bitptr & 7, len);
packetbuf_set_attr(a->type, val); packetbuf_set_attr(a->type, val);
PRINTF("%d.%d: unpack_header type %s, val %d\n", PRINTF("%d.%d: unpack_header type %d, val %d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
packetbuf_attr_strings[a->type], a->type, val);
val);
} }
/* byteptr += len / 8;*/ /* byteptr += len / 8;*/
bitptr += len; bitptr += len;

View file

@ -28,7 +28,6 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* $Id: chameleon-raw.c,v 1.8 2010/05/28 06:18:39 nifi Exp $
*/ */
/** /**
@ -104,27 +103,25 @@ input(void)
continue; continue;
} }
#endif /* CHAMELEON_WITH_MAC_LINK_ADDRESSES */ #endif /* CHAMELEON_WITH_MAC_LINK_ADDRESSES */
PRINTF("%d.%d: unpack_header type %s, len %d\n", PRINTF("%d.%d: unpack_header type %d, len %d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
packetbuf_attr_strings[a->type], a->len); a->type, a->len);
len = (a->len & 0xf8) + ((a->len & 7) ? 8: 0); len = (a->len & 0xf8) + ((a->len & 7) ? 8: 0);
if(PACKETBUF_IS_ADDR(a->type)) { if(PACKETBUF_IS_ADDR(a->type)) {
const rimeaddr_t addr; const rimeaddr_t addr;
memcpy((uint8_t *)&addr, &hdrptr[byteptr], len / 8); memcpy((uint8_t *)&addr, &hdrptr[byteptr], len / 8);
PRINTF("%d.%d: unpack_header type %s, addr %d.%d\n", PRINTF("%d.%d: unpack_header type %d, addr %d.%d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
packetbuf_attr_strings[a->type], a->type, addr.u8[0], addr.u8[1]);
addr.u8[0], addr.u8[1]);
packetbuf_set_addr(a->type, &addr); packetbuf_set_addr(a->type, &addr);
} else { } else {
packetbuf_attr_t val = 0; packetbuf_attr_t val = 0;
memcpy((uint8_t *)&val, &hdrptr[byteptr], len / 8); memcpy((uint8_t *)&val, &hdrptr[byteptr], len / 8);
packetbuf_set_attr(a->type, val); packetbuf_set_attr(a->type, val);
PRINTF("%d.%d: unpack_header type %s, val %d\n", PRINTF("%d.%d: unpack_header type %d, val %d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
packetbuf_attr_strings[a->type], a->type, val);
val);
} }
byteptr += len / 8; byteptr += len / 8;
} }
@ -160,9 +157,9 @@ output(struct channel *c)
continue; continue;
} }
#endif /* CHAMELEON_WITH_MAC_LINK_ADDRESSES */ #endif /* CHAMELEON_WITH_MAC_LINK_ADDRESSES */
PRINTF("%d.%d: pack_header type %s, len %d\n", PRINTF("%d.%d: pack_header type %d, len %d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
packetbuf_attr_strings[a->type], a->len); a->type, a->len);
len = (a->len & 0xf8) + ((a->len & 7) ? 8: 0); len = (a->len & 0xf8) + ((a->len & 7) ? 8: 0);
if(PACKETBUF_IS_ADDR(a->type)) { if(PACKETBUF_IS_ADDR(a->type)) {
const rimeaddr_t *rimeaddr; const rimeaddr_t *rimeaddr;
@ -199,10 +196,8 @@ hdrsize(const struct packetbuf_attrlist *a)
size = 0; size = 0;
for(; a->type != PACKETBUF_ATTR_NONE; ++a) { for(; a->type != PACKETBUF_ATTR_NONE; ++a) {
/* PRINTF("chameleon header_size: header type %s (%d) len %d\n", /* PRINTF("chameleon header_size: header type %d len %d\n",
packetbuf_attr_strings[a->type], a->type, a->len);*/
a->type,
a->len);*/
#if CHAMELEON_WITH_MAC_LINK_ADDRESSES #if CHAMELEON_WITH_MAC_LINK_ADDRESSES
if(a->type == PACKETBUF_ADDR_SENDER || if(a->type == PACKETBUF_ADDR_SENDER ||
a->type == PACKETBUF_ADDR_RECEIVER) { a->type == PACKETBUF_ADDR_RECEIVER) {

View file

@ -82,7 +82,7 @@ sent_by_broadcast(struct broadcast_conn *broadcast, int status, int num_tx)
{ {
struct unicast_conn *c = (struct unicast_conn *)broadcast; struct unicast_conn *c = (struct unicast_conn *)broadcast;
PRINTF("%d.%d: uc: recv_from_broadcast, receiver %d.%d\n", PRINTF("%d.%d: uc: sent_by_broadcast, receiver %d.%d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[0], packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[0],
packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[1]); packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[1]);