Replaced NETSIM macro with general (and now actually working) solution in Makefile.include.

This commit is contained in:
oliverschmidt 2008-11-17 22:52:10 +00:00
parent 7ac49a573b
commit 7cf3165155
13 changed files with 66 additions and 66 deletions

View file

@ -28,7 +28,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: example-rudolph1.c,v 1.2 2008/02/24 22:15:46 adamdunkels Exp $
* $Id: example-rudolph1.c,v 1.3 2008/11/17 22:52:10 oliverschmidt Exp $
*/
/**
@ -51,10 +51,10 @@
#include <stdio.h>
#if NETSIM
#if CONTIKI_TARGET_NETSIM
#include "ether.h"
#include "node.h"
#endif /* NETSIM */
#endif /* CONTIKI_TARGET_NETSIM */
#define FILESIZE 2000
@ -67,13 +67,13 @@ write_chunk(struct rudolph1_conn *c, int offset, int flag,
uint8_t *data, int datalen)
{
int fd;
#if NETSIM
#if CONTIKI_TARGET_NETSIM
{
char buf[100];
sprintf(buf, "%d%%", (100 * (offset + datalen)) / FILESIZE);
ether_set_text(buf);
}
#endif /* NETSIM */
#endif /* CONTIKI_TARGET_NETSIM */
if(flag == RUDOLPH1_FLAG_NEWFILE) {
/*printf("+++ rudolph1 new file incoming at %lu\n", clock_time());*/
@ -109,7 +109,7 @@ write_chunk(struct rudolph1_conn *c, int offset, int flag,
break;
}
}
#if NETSIM
#if CONTIKI_TARGET_NETSIM
ether_send_done();
#endif
cfs_close(fd);
@ -138,14 +138,14 @@ static struct rudolph1_conn rudolph1;
static void
log_queuelen(struct rtimer *t, void *ptr)
{
#if NETSIM
#if CONTIKI_TARGET_NETSIM
extern uint8_t queuebuf_len, queuebuf_ref_len;
node_log("%d %d\n",
queuebuf_len,
queuebuf_ref_len);
rtimer_set(t, RTIMER_TIME(t) + RTIMER_ARCH_SECOND, 1,
log_queuelen, ptr);
#endif /* NETSIM */
#endif /* CONTIKI_TARGET_NETSIM */
}
/*---------------------------------------------------------------------------*/
@ -180,9 +180,9 @@ PROCESS_THREAD(example_rudolph1_process, ev, data)
cfs_close(fd);
}
rudolph1_send(&rudolph1, CLOCK_SECOND * 2);
#if NETSIM
#if CONTIKI_TARGET_NETSIM
ether_send_done();
#endif /* NETSIM */
#endif /* CONTIKI_TARGET_NETSIM */
}