This commit is contained in:
adamdunkels 2007-03-25 12:13:04 +00:00
parent c3457e82a4
commit 0c0d823dbf
2 changed files with 18 additions and 5 deletions

View file

@ -28,7 +28,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* $Id: route-discovery.c,v 1.2 2007/03/25 12:06:28 adamdunkels Exp $ * $Id: route-discovery.c,v 1.3 2007/03/25 12:13:04 adamdunkels Exp $
*/ */
/** /**
@ -208,7 +208,7 @@ static const struct nf_callbacks rreq_callbacks = {rreq_packet_received, NULL};
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
void void
route_discovery_open(struct route_discovery_conn *c, route_discovery_open(struct route_discovery_conn *c,
clock_time time, clock_time_t time,
u16_t channels, u16_t channels,
const struct route_discovery_callbacks *callbacks) const struct route_discovery_callbacks *callbacks)
{ {

View file

@ -28,7 +28,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* @(#)$Id: tcprudolph0.c,v 1.1 2007/03/23 00:03:25 adamdunkels Exp $ * @(#)$Id: tcprudolph0.c,v 1.4 2007/03/25 12:14:45 adamdunkels Exp $
*/ */
#include <stdio.h> #include <stdio.h>
@ -40,11 +40,13 @@
#include "net/uip.h" #include "net/uip.h"
#include "dev/leds.h"
#include "cfs/cfs.h" #include "cfs/cfs.h"
#include "codeprop.h" #include "codeprop.h"
#include "rudolph0.h" #include "net/rime/rudolph0.h"
#define DEBUG 0 #define DEBUG 0
#if DEBUG #if DEBUG
@ -119,6 +121,7 @@ PT_THREAD(recv_tcpthread(struct pt *pt))
/* Read the rest of the data. */ /* Read the rest of the data. */
do { do {
leds_toggle(LEDS_RED);
if(uip_len > 0) { if(uip_len > 0) {
s.fd = cfs_open("codeprop.out", CFS_WRITE + CFS_APPEND); s.fd = cfs_open("codeprop.out", CFS_WRITE + CFS_APPEND);
cfs_seek(s.fd, s.addr); cfs_seek(s.fd, s.addr);
@ -133,7 +136,7 @@ PT_THREAD(recv_tcpthread(struct pt *pt))
PT_YIELD_UNTIL(pt, uip_newdata()); PT_YIELD_UNTIL(pt, uip_newdata());
} }
} while(s.addr < s.len); } while(s.addr < s.len);
leds_off(LEDS_RED);
#if DEBUG #if DEBUG
{ {
@ -190,6 +193,8 @@ write_chunk(struct rudolph0_conn *c, int offset, int flag,
char *data, int datalen) char *data, int datalen)
{ {
int fd; int fd;
leds_toggle(LEDS_YELLOW);
if(flag == RUDOLPH0_FLAG_NEWFILE) { if(flag == RUDOLPH0_FLAG_NEWFILE) {
printf("+++ rudolph0 new file incoming at %lu\n", clock_time()); printf("+++ rudolph0 new file incoming at %lu\n", clock_time());
@ -198,6 +203,7 @@ write_chunk(struct rudolph0_conn *c, int offset, int flag,
if(elfloader_autostart_processes != NULL) { if(elfloader_autostart_processes != NULL) {
PRINTF("Stopping old programs.\n"); PRINTF("Stopping old programs.\n");
autostart_exit(elfloader_autostart_processes); autostart_exit(elfloader_autostart_processes);
elfloader_autostart_processes = NULL;
} }
} else { } else {
@ -216,6 +222,7 @@ write_chunk(struct rudolph0_conn *c, int offset, int flag,
if(flag == RUDOLPH0_FLAG_LASTCHUNK) { if(flag == RUDOLPH0_FLAG_LASTCHUNK) {
printf("+++ rudolph0 entire file received at %lu\n", clock_time()); printf("+++ rudolph0 entire file received at %lu\n", clock_time());
start_program(); start_program();
leds_off(LEDS_YELLOW);
} }
} }
static int static int
@ -223,12 +230,17 @@ read_chunk(struct rudolph0_conn *c, int offset, char *to, int maxsize)
{ {
int fd; int fd;
int ret; int ret;
leds_toggle(LEDS_GREEN);
fd = cfs_open("hej", CFS_READ); fd = cfs_open("hej", CFS_READ);
cfs_seek(fd, offset); cfs_seek(fd, offset);
ret = cfs_read(fd, to, maxsize); ret = cfs_read(fd, to, maxsize);
/* printf("read_chunk %d bytes at %d, %d\n", ret, offset, (unsigned char)to[0]);*/ /* printf("read_chunk %d bytes at %d, %d\n", ret, offset, (unsigned char)to[0]);*/
if(ret < maxsize) {
leds_off(LEDS_GREEN);
}
cfs_close(fd); cfs_close(fd);
return ret; return ret;
} }
@ -255,6 +267,7 @@ PROCESS_THREAD(tcp_loader_process, ev, data)
if(elfloader_autostart_processes != NULL) { if(elfloader_autostart_processes != NULL) {
PRINTF("Stopping old programs.\n"); PRINTF("Stopping old programs.\n");
autostart_exit(elfloader_autostart_processes); autostart_exit(elfloader_autostart_processes);
elfloader_autostart_processes = NULL;
} }
} else { } else {
PRINTF(("codeprop: uip_connected() and data != NULL\n")); PRINTF(("codeprop: uip_connected() and data != NULL\n"));