Debug output

This commit is contained in:
adamdunkels 2007-03-29 23:18:22 +00:00
parent 576cb01fb4
commit 2f079ca8e2
7 changed files with 84 additions and 28 deletions

View file

@ -28,7 +28,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: uc.c,v 1.7 2007/03/23 10:46:35 adamdunkels Exp $
* $Id: uc.c,v 1.8 2007/03/29 23:18:22 adamdunkels Exp $
*/
/**
@ -46,13 +46,21 @@ struct uc_hdr {
rimeaddr_t receiver;
};
#define DEBUG 0
#if DEBUG
#include <stdio.h>
#define PRINTF(...) printf(__VA_ARGS__)
#else
#define PRINTF(...)
#endif
/*---------------------------------------------------------------------------*/
static void
recv_from_ibc(struct ibc_conn *ibc, rimeaddr_t *from)
{
struct uc_conn *c = (struct uc_conn *)ibc;
struct uc_hdr *hdr = rimebuf_dataptr();
DEBUGF(2, "%d: uc: recv_from_ibc, receiver %d %p hdr %p\n",
PRINTF("%d: uc: recv_from_ibc, receiver %d %p hdr %p\n",
rimeaddr_node_addr.u16, hdr->receiver.u16, c, hdr);
if(rimeaddr_cmp(&hdr->receiver, &rimeaddr_node_addr)) {
rimebuf_hdrreduce(sizeof(struct uc_hdr));
@ -79,7 +87,7 @@ uc_close(struct uc_conn *c)
int
uc_send(struct uc_conn *c, rimeaddr_t *receiver)
{
DEBUGF(2, "%d: uc_send to %d\n", rimeaddr_node_addr.u16, receiver->u16);
PRINTF("%d: uc_send to %d\n", rimeaddr_node_addr.u16, receiver->u16);
if(rimebuf_hdralloc(sizeof(struct uc_hdr))) {
struct uc_hdr *hdr = rimebuf_hdrptr();
rimeaddr_copy(&hdr->receiver, receiver);