Debug output
This commit is contained in:
parent
576cb01fb4
commit
2f079ca8e2
7 changed files with 84 additions and 28 deletions
|
@ -30,7 +30,7 @@
|
||||||
*
|
*
|
||||||
* Author: Adam Dunkels <adam@sics.se>
|
* Author: Adam Dunkels <adam@sics.se>
|
||||||
*
|
*
|
||||||
* $Id: abc.c,v 1.10 2007/03/28 19:51:33 adamdunkels Exp $
|
* $Id: abc.c,v 1.11 2007/03/29 23:18:22 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -54,6 +54,14 @@ struct abc_hdr {
|
||||||
|
|
||||||
LIST(channels);
|
LIST(channels);
|
||||||
|
|
||||||
|
#define DEBUG 0
|
||||||
|
#if DEBUG
|
||||||
|
#include <stdio.h>
|
||||||
|
#define PRINTF(...) printf(__VA_ARGS__)
|
||||||
|
#else
|
||||||
|
#define PRINTF(...)
|
||||||
|
#endif
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
abc_open(struct abc_conn *c, u16_t channel,
|
abc_open(struct abc_conn *c, u16_t channel,
|
||||||
|
@ -77,7 +85,7 @@ abc_send(struct abc_conn *c)
|
||||||
if(rimebuf_hdralloc(sizeof(struct abc_hdr))) {
|
if(rimebuf_hdralloc(sizeof(struct abc_hdr))) {
|
||||||
struct abc_hdr *hdr = rimebuf_hdrptr();
|
struct abc_hdr *hdr = rimebuf_hdrptr();
|
||||||
|
|
||||||
DEBUGF(1, "%d: abc: abc_send on channel %d\n", rimeaddr_node_addr.u16, c->channel);
|
PRINTF("%d: abc: abc_send on channel %d\n", rimeaddr_node_addr.u16, c->channel);
|
||||||
|
|
||||||
hdr->channel = c->channel;
|
hdr->channel = c->channel;
|
||||||
rimebuf_compact();
|
rimebuf_compact();
|
||||||
|
@ -95,7 +103,7 @@ abc_input_packet(void)
|
||||||
|
|
||||||
hdr = rimebuf_dataptr();
|
hdr = rimebuf_dataptr();
|
||||||
|
|
||||||
DEBUGF(1, "%d: abc: abc_input_packet on channel %d\n", rimeaddr_node_addr.u16, hdr->channel);
|
PRINTF("%d: abc: abc_input_packet on channel %d\n", rimeaddr_node_addr.u16, hdr->channel);
|
||||||
|
|
||||||
if(rimebuf_hdrreduce(sizeof(struct abc_hdr))) {
|
if(rimebuf_hdrreduce(sizeof(struct abc_hdr))) {
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* $Id: ctimer.c,v 1.2 2007/03/25 12:05:51 adamdunkels Exp $
|
* $Id: ctimer.c,v 1.3 2007/03/29 23:18:22 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -45,6 +45,14 @@
|
||||||
|
|
||||||
LIST(ctimer_list);
|
LIST(ctimer_list);
|
||||||
|
|
||||||
|
#define DEBUG 0
|
||||||
|
#if DEBUG
|
||||||
|
#include <stdio.h>
|
||||||
|
#define PRINTF(...) printf(__VA_ARGS__)
|
||||||
|
#else
|
||||||
|
#define PRINTF(...)
|
||||||
|
#endif
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
PROCESS(ctimer_process, "ctimer process");
|
PROCESS(ctimer_process, "ctimer process");
|
||||||
PROCESS_THREAD(ctimer_process, ev, data)
|
PROCESS_THREAD(ctimer_process, ev, data)
|
||||||
|
@ -81,7 +89,7 @@ void
|
||||||
ctimer_set(struct ctimer *c, clock_time_t t,
|
ctimer_set(struct ctimer *c, clock_time_t t,
|
||||||
void (*f)(void *), void *ptr)
|
void (*f)(void *), void *ptr)
|
||||||
{
|
{
|
||||||
DEBUGF(3, "ctimer_set %p %d\n", c, t);
|
PRINTF("ctimer_set %p %d\n", c, t);
|
||||||
c->p = PROCESS_CURRENT();
|
c->p = PROCESS_CURRENT();
|
||||||
c->f = f;
|
c->f = f;
|
||||||
c->ptr = ptr;
|
c->ptr = ptr;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* \addtogroup rime-ibc
|
* \addtogroup rimeibc
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* $Id: ibc.c,v 1.8 2007/03/25 12:05:51 adamdunkels Exp $
|
* $Id: ibc.c,v 1.9 2007/03/29 23:18:22 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -51,6 +51,14 @@ struct ibc_hdr {
|
||||||
rimeaddr_t sender;
|
rimeaddr_t sender;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define DEBUG 0
|
||||||
|
#if DEBUG
|
||||||
|
#include <stdio.h>
|
||||||
|
#define PRINTF(...) printf(__VA_ARGS__)
|
||||||
|
#else
|
||||||
|
#define PRINTF(...)
|
||||||
|
#endif
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static void
|
static void
|
||||||
recv_from_abc(struct abc_conn *bc)
|
recv_from_abc(struct abc_conn *bc)
|
||||||
|
@ -62,7 +70,7 @@ recv_from_abc(struct abc_conn *bc)
|
||||||
rimeaddr_copy(&sender, &hdr->sender);
|
rimeaddr_copy(&sender, &hdr->sender);
|
||||||
|
|
||||||
rimebuf_hdrreduce(sizeof(struct ibc_hdr));
|
rimebuf_hdrreduce(sizeof(struct ibc_hdr));
|
||||||
DEBUGF(1, "%d: ibc: recv_from_bc\n", rimeaddr_node_addr.u16);
|
PRINTF("%d: ibc: recv_from_bc\n", rimeaddr_node_addr.u16);
|
||||||
c->u->recv(c, &sender);
|
c->u->recv(c, &sender);
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
@ -85,7 +93,7 @@ ibc_close(struct ibc_conn *c)
|
||||||
int
|
int
|
||||||
ibc_send(struct ibc_conn *c)
|
ibc_send(struct ibc_conn *c)
|
||||||
{
|
{
|
||||||
DEBUGF(1, "%d: ibc_send\n", rimeaddr_node_addr.u16);
|
PRINTF("%d: ibc_send\n", rimeaddr_node_addr.u16);
|
||||||
if(rimebuf_hdralloc(sizeof(struct ibc_hdr))) {
|
if(rimebuf_hdralloc(sizeof(struct ibc_hdr))) {
|
||||||
struct ibc_hdr *hdr = rimebuf_hdrptr();
|
struct ibc_hdr *hdr = rimebuf_hdrptr();
|
||||||
rimeaddr_copy(&hdr->sender, &rimeaddr_node_addr);
|
rimeaddr_copy(&hdr->sender, &rimeaddr_node_addr);
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* $Id: rimebuf.c,v 1.6 2007/03/24 16:42:36 adamdunkels Exp $
|
* $Id: rimebuf.c,v 1.7 2007/03/29 23:18:22 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -51,6 +51,14 @@ static u8_t rimebuf[RIMEBUF_SIZE + RIMEBUF_HDR_SIZE];
|
||||||
|
|
||||||
static u8_t *rimebufptr;
|
static u8_t *rimebufptr;
|
||||||
|
|
||||||
|
#define DEBUG 0
|
||||||
|
#if DEBUG
|
||||||
|
#include <stdio.h>
|
||||||
|
#define PRINTF(...) printf(__VA_ARGS__)
|
||||||
|
#else
|
||||||
|
#define PRINTF(...)
|
||||||
|
#endif
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
rimebuf_clear(void)
|
rimebuf_clear(void)
|
||||||
|
@ -92,11 +100,11 @@ rimebuf_copyto_hdr(u8_t *to)
|
||||||
#if DEBUG_LEVEL > 0
|
#if DEBUG_LEVEL > 0
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
DEBUGF(0, "rimebuf_write_hdr: header:\n");
|
PRINTF("rimebuf_write_hdr: header:\n");
|
||||||
for(i = hdrptr; i < RIMEBUF_HDR_SIZE; ++i) {
|
for(i = hdrptr; i < RIMEBUF_HDR_SIZE; ++i) {
|
||||||
DEBUGF(0, "0x%02x, ", rimebuf[i]);
|
PRINTF("0x%02x, ", rimebuf[i]);
|
||||||
}
|
}
|
||||||
DEBUGF(0, "\n");
|
PRINTF("\n");
|
||||||
}
|
}
|
||||||
#endif /* DEBUG_LEVEL */
|
#endif /* DEBUG_LEVEL */
|
||||||
memcpy(to, rimebuf + hdrptr, RIMEBUF_HDR_SIZE - hdrptr);
|
memcpy(to, rimebuf + hdrptr, RIMEBUF_HDR_SIZE - hdrptr);
|
||||||
|
@ -116,13 +124,13 @@ rimebuf_copyto(u8_t *to)
|
||||||
for(i = hdrptr; i < RIMEBUF_HDR_SIZE; ++i) {
|
for(i = hdrptr; i < RIMEBUF_HDR_SIZE; ++i) {
|
||||||
bufferptr += sprintf(bufferptr, "0x%02x, ", rimebuf[i]);
|
bufferptr += sprintf(bufferptr, "0x%02x, ", rimebuf[i]);
|
||||||
}
|
}
|
||||||
DEBUGF(0, "rimebuf_write: header: %s\n", buffer);
|
PRINTF("rimebuf_write: header: %s\n", buffer);
|
||||||
bufferptr = buffer;
|
bufferptr = buffer;
|
||||||
bufferptr[0] = 0;
|
bufferptr[0] = 0;
|
||||||
for(i = bufptr; i < buflen + bufptr; ++i) {
|
for(i = bufptr; i < buflen + bufptr; ++i) {
|
||||||
bufferptr += sprintf(bufferptr, "0x%02x, ", rimebufptr[i]);
|
bufferptr += sprintf(bufferptr, "0x%02x, ", rimebufptr[i]);
|
||||||
}
|
}
|
||||||
DEBUGF(0, "rimebuf_write: data: %s\n", buffer);
|
PRINTF("rimebuf_write: data: %s\n", buffer);
|
||||||
}
|
}
|
||||||
#endif /* DEBUG_LEVEL */
|
#endif /* DEBUG_LEVEL */
|
||||||
memcpy(to, rimebuf + hdrptr, RIMEBUF_HDR_SIZE - hdrptr);
|
memcpy(to, rimebuf + hdrptr, RIMEBUF_HDR_SIZE - hdrptr);
|
||||||
|
@ -157,7 +165,7 @@ rimebuf_hdrreduce(int size)
|
||||||
void
|
void
|
||||||
rimebuf_set_datalen(u16_t len)
|
rimebuf_set_datalen(u16_t len)
|
||||||
{
|
{
|
||||||
DEBUGF(0, "rimebuf_set_len: len %d\n", len);
|
PRINTF("rimebuf_set_len: len %d\n", len);
|
||||||
buflen = len;
|
buflen = len;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* $Id: ruc.c,v 1.7 2007/03/23 10:46:35 adamdunkels Exp $
|
* $Id: ruc.c,v 1.8 2007/03/29 23:18:22 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -58,6 +58,14 @@ enum {
|
||||||
|
|
||||||
static u8_t seqno;
|
static u8_t seqno;
|
||||||
|
|
||||||
|
#define DEBUG 0
|
||||||
|
#if DEBUG
|
||||||
|
#include <stdio.h>
|
||||||
|
#define PRINTF(...) printf(__VA_ARGS__)
|
||||||
|
#else
|
||||||
|
#define PRINTF(...)
|
||||||
|
#endif
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static void
|
static void
|
||||||
sent_by_suc(struct suc_conn *suc)
|
sent_by_suc(struct suc_conn *suc)
|
||||||
|
@ -71,12 +79,12 @@ recv_from_suc(struct suc_conn *suc, rimeaddr_t *from)
|
||||||
struct ruc_conn *c = (struct ruc_conn *)suc;
|
struct ruc_conn *c = (struct ruc_conn *)suc;
|
||||||
struct ruc_hdr *hdr = rimebuf_dataptr();
|
struct ruc_hdr *hdr = rimebuf_dataptr();
|
||||||
|
|
||||||
DEBUGF(4, "%d: ruc: recv_from_suc type %d seqno %d\n", rimeaddr_node_addr.u16,
|
PRINTF("%d: ruc: recv_from_suc type %d seqno %d\n", rimeaddr_node_addr.u16,
|
||||||
hdr->type, hdr->seqno);
|
hdr->type, hdr->seqno);
|
||||||
|
|
||||||
if(hdr->type == TYPE_ACK) {
|
if(hdr->type == TYPE_ACK) {
|
||||||
if(hdr->seqno == seqno) {
|
if(hdr->seqno == seqno) {
|
||||||
DEBUGF(4, "%d: ruc: ACKed\n", rimeaddr_node_addr.u16);
|
PRINTF("%d: ruc: ACKed\n", rimeaddr_node_addr.u16);
|
||||||
++seqno;
|
++seqno;
|
||||||
suc_cancel(&c->c);
|
suc_cancel(&c->c);
|
||||||
if(c->u->sent != NULL) {
|
if(c->u->sent != NULL) {
|
||||||
|
@ -96,7 +104,7 @@ recv_from_suc(struct suc_conn *suc, rimeaddr_t *from)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(send_ack) {
|
if(send_ack) {
|
||||||
DEBUGF(4, "%d: ruc: Sending ACK to %d for %d\n",
|
PRINTF("%d: ruc: Sending ACK to %d for %d\n",
|
||||||
rimeaddr_node_addr.u16, from->u16,
|
rimeaddr_node_addr.u16, from->u16,
|
||||||
packet_seqno);
|
packet_seqno);
|
||||||
rimebuf_clear();
|
rimebuf_clear();
|
||||||
|
@ -106,7 +114,7 @@ recv_from_suc(struct suc_conn *suc, rimeaddr_t *from)
|
||||||
hdr->seqno = packet_seqno;
|
hdr->seqno = packet_seqno;
|
||||||
suc_send(&c->c, from);
|
suc_send(&c->c, from);
|
||||||
} else {
|
} else {
|
||||||
DEBUGF(4, "%d: Not sending ACK\n", rimeaddr_node_addr.u16);
|
PRINTF("%d: Not sending ACK\n", rimeaddr_node_addr.u16);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* $Id: suc.c,v 1.7 2007/03/25 21:43:23 adamdunkels Exp $
|
* $Id: suc.c,v 1.8 2007/03/29 23:18:22 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -42,12 +42,20 @@
|
||||||
#include "net/rime.h"
|
#include "net/rime.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#define DEBUG 0
|
||||||
|
#if DEBUG
|
||||||
|
#include <stdio.h>
|
||||||
|
#define PRINTF(...) printf(__VA_ARGS__)
|
||||||
|
#else
|
||||||
|
#define PRINTF(...)
|
||||||
|
#endif
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static void
|
static void
|
||||||
recv_from_uc(struct uc_conn *uc, rimeaddr_t *from)
|
recv_from_uc(struct uc_conn *uc, rimeaddr_t *from)
|
||||||
{
|
{
|
||||||
register struct suc_conn *c = (struct suc_conn *)uc;
|
register struct suc_conn *c = (struct suc_conn *)uc;
|
||||||
DEBUGF(3, "%d: suc: recv_from_uc from %d %p\n",
|
PRINTF("%d: suc: recv_from_uc from %d %p\n",
|
||||||
rimeaddr_node_addr.u16, from->u16, c);
|
rimeaddr_node_addr.u16, from->u16, c);
|
||||||
if(c->u->recv != NULL) {
|
if(c->u->recv != NULL) {
|
||||||
c->u->recv(c, from);
|
c->u->recv(c, from);
|
||||||
|
@ -79,7 +87,7 @@ send(void *ptr)
|
||||||
{
|
{
|
||||||
struct suc_conn *c = ptr;
|
struct suc_conn *c = ptr;
|
||||||
|
|
||||||
DEBUGF(3, "%d: suc: resend to %d\n",
|
PRINTF("%d: suc: resend to %d\n",
|
||||||
rimeaddr_node_addr.u16, c->receiver.u16);
|
rimeaddr_node_addr.u16, c->receiver.u16);
|
||||||
queuebuf_to_rimebuf(c->buf);
|
queuebuf_to_rimebuf(c->buf);
|
||||||
uc_send(&c->c, &c->receiver);
|
uc_send(&c->c, &c->receiver);
|
||||||
|
@ -108,7 +116,7 @@ suc_send_stubborn(struct suc_conn *c, rimeaddr_t *receiver)
|
||||||
rimeaddr_copy(&c->receiver, receiver);
|
rimeaddr_copy(&c->receiver, receiver);
|
||||||
ctimer_set(&c->t, CLOCK_SECOND, send, c);
|
ctimer_set(&c->t, CLOCK_SECOND, send, c);
|
||||||
|
|
||||||
DEBUGF(3, "%d: suc_send_stubborn to %d\n", rimeaddr_node_addr.u16, c->receiver.u16);
|
PRINTF("%d: suc_send_stubborn to %d\n", rimeaddr_node_addr.u16, c->receiver.u16);
|
||||||
uc_send(&c->c, &c->receiver);
|
uc_send(&c->c, &c->receiver);
|
||||||
if(c->u->sent != NULL) {
|
if(c->u->sent != NULL) {
|
||||||
c->u->sent(c);
|
c->u->sent(c);
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* 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;
|
rimeaddr_t receiver;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define DEBUG 0
|
||||||
|
#if DEBUG
|
||||||
|
#include <stdio.h>
|
||||||
|
#define PRINTF(...) printf(__VA_ARGS__)
|
||||||
|
#else
|
||||||
|
#define PRINTF(...)
|
||||||
|
#endif
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static void
|
static void
|
||||||
recv_from_ibc(struct ibc_conn *ibc, rimeaddr_t *from)
|
recv_from_ibc(struct ibc_conn *ibc, rimeaddr_t *from)
|
||||||
{
|
{
|
||||||
struct uc_conn *c = (struct uc_conn *)ibc;
|
struct uc_conn *c = (struct uc_conn *)ibc;
|
||||||
struct uc_hdr *hdr = rimebuf_dataptr();
|
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);
|
rimeaddr_node_addr.u16, hdr->receiver.u16, c, hdr);
|
||||||
if(rimeaddr_cmp(&hdr->receiver, &rimeaddr_node_addr)) {
|
if(rimeaddr_cmp(&hdr->receiver, &rimeaddr_node_addr)) {
|
||||||
rimebuf_hdrreduce(sizeof(struct uc_hdr));
|
rimebuf_hdrreduce(sizeof(struct uc_hdr));
|
||||||
|
@ -79,7 +87,7 @@ uc_close(struct uc_conn *c)
|
||||||
int
|
int
|
||||||
uc_send(struct uc_conn *c, rimeaddr_t *receiver)
|
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))) {
|
if(rimebuf_hdralloc(sizeof(struct uc_hdr))) {
|
||||||
struct uc_hdr *hdr = rimebuf_hdrptr();
|
struct uc_hdr *hdr = rimebuf_hdrptr();
|
||||||
rimeaddr_copy(&hdr->receiver, receiver);
|
rimeaddr_copy(&hdr->receiver, receiver);
|
||||||
|
|
Loading…
Reference in a new issue