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.
*
* 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;
}
#endif /* CHAMELEON_WITH_MAC_LINK_ADDRESSES */
/* PRINTF("chameleon header_size: header type %s (%d) len %d\n",
packetbuf_attr_strings[a->type],
a->type,
a->len);*/
/* PRINTF("chameleon header_size: header type %d len %d\n",
a->type, a->len);*/
len = a->len;
/* if(len < 8) {
len = 8;
@ -269,9 +265,9 @@ pack_header(struct channel *c)
continue;
}
#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],
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;
byteptr = bitptr / 8;
@ -339,29 +335,27 @@ unpack_header(void)
continue;
}
#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],
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;
byteptr = bitptr / 8;
if(PACKETBUF_IS_ADDR(a->type)) {
rimeaddr_t addr;
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],
packetbuf_attr_strings[a->type],
addr.u8[0], addr.u8[1]);
a->type, addr.u8[0], addr.u8[1]);
packetbuf_set_addr(a->type, &addr);
} else {
packetbuf_attr_t val = 0;
get_bits((uint8_t *)&val, &hdrptr[byteptr], bitptr & 7, len);
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],
packetbuf_attr_strings[a->type],
val);
a->type, val);
}
/* byteptr += len / 8;*/
bitptr += len;