Padded struct codeprop_tcphdr to 4 bytes, to get around different
alignment on different platforms.
This commit is contained in:
parent
943a12613f
commit
7c8665fb89
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* @(#)$Id: codeprop-tmp.c,v 1.3 2006/12/18 15:17:47 fros4943 Exp $
|
* @(#)$Id: codeprop-tmp.c,v 1.4 2007/03/18 13:15:01 ksb Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** \addtogroup esb
|
/** \addtogroup esb
|
||||||
|
@ -115,6 +115,7 @@ struct codeprop_udphdr {
|
||||||
|
|
||||||
struct codeprop_tcphdr {
|
struct codeprop_tcphdr {
|
||||||
u16_t len;
|
u16_t len;
|
||||||
|
u16_t pad;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void uipcall(void *state);
|
static void uipcall(void *state);
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* @(#)$Id: codeprop.h,v 1.1 2006/06/18 07:44:36 adamdunkels Exp $
|
* @(#)$Id: codeprop.h,v 1.2 2007/03/18 13:15:01 ksb Exp $
|
||||||
*/
|
*/
|
||||||
#ifndef __CODEPROP_H__
|
#ifndef __CODEPROP_H__
|
||||||
#define __CODEPROP_H__
|
#define __CODEPROP_H__
|
||||||
|
@ -39,6 +39,7 @@
|
||||||
|
|
||||||
struct codeprop_tcphdr {
|
struct codeprop_tcphdr {
|
||||||
u16_t len;
|
u16_t len;
|
||||||
|
u16_t pad;
|
||||||
};
|
};
|
||||||
|
|
||||||
PROCESS_NAME(codeprop_process);
|
PROCESS_NAME(codeprop_process);
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* @(#)$Id: codeprop-otf.c,v 1.1 2007/03/07 16:07:26 ksb Exp $
|
* @(#)$Id: codeprop-otf.c,v 1.2 2007/03/18 13:15:02 ksb Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** \addtogroup esb
|
/** \addtogroup esb
|
||||||
|
@ -117,6 +117,7 @@ struct codeprop_udphdr {
|
||||||
|
|
||||||
struct codeprop_tcphdr {
|
struct codeprop_tcphdr {
|
||||||
u16_t len;
|
u16_t len;
|
||||||
|
u16_t pad;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void uipcall(void *state);
|
static void uipcall(void *state);
|
||||||
|
@ -366,7 +367,7 @@ PT_THREAD(recv_udpthread(struct pt *pt))
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
|
|
||||||
#define CODEPROP_TCPHDR_SIZE 2
|
#define CODEPROP_TCPHDR_SIZE sizeof(struct codeprop_tcphdr)
|
||||||
|
|
||||||
static
|
static
|
||||||
PT_THREAD(recv_tcpthread(struct pt *pt))
|
PT_THREAD(recv_tcpthread(struct pt *pt))
|
||||||
|
|
|
@ -33,10 +33,13 @@ CFLAGS+= -I stepper
|
||||||
|
|
||||||
cfs-ram.o: CFLAGS+= -DCFS_RAM_CONF_SIZE=4096
|
cfs-ram.o: CFLAGS+= -DCFS_RAM_CONF_SIZE=4096
|
||||||
|
|
||||||
all: $(KERNELS)
|
all: $(KERNELS) codeprop
|
||||||
|
|
||||||
sys-tst.elf: sys-tst.o $(ARCH) $(SYSTEM)
|
sys-tst.elf: sys-tst.o $(ARCH) $(SYSTEM)
|
||||||
|
|
||||||
robot-main-syms.elf: robot-main.o stepper-process.o $(ARCH) $(SYSTEM) $(SYSLIB) $(UIP) $(UIPDRIVERS) $(STEPPER) $(CODEPROP) $(DEBUG_IO)
|
robot-main-syms.elf: robot-main.o stepper-process.o $(ARCH) $(SYSTEM) $(SYSLIB) $(UIP) $(UIPDRIVERS) $(STEPPER) $(CODEPROP) $(DEBUG_IO)
|
||||||
|
|
||||||
|
codeprop: $(CONTIKI)/tools/codeprop.c
|
||||||
|
cc -g -Wall $< -o $@
|
||||||
|
|
||||||
include $(CONTIKI)/cpu/at91sam7s/Makefile.at91sam7s
|
include $(CONTIKI)/cpu/at91sam7s/Makefile.at91sam7s
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* @(#)$Id: codeprop.c,v 1.2 2006/08/02 14:33:37 bg- Exp $
|
* @(#)$Id: codeprop.c,v 1.3 2007/03/18 13:15:00 ksb Exp $
|
||||||
*/
|
*/
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -48,6 +48,9 @@
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
|
|
||||||
|
/* Should be included from codeprop.h, but the include paths in the makefiles
|
||||||
|
isn't set up for that. */
|
||||||
|
#define HDR_SIZE 4
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char **argv) {
|
main(int argc, char **argv) {
|
||||||
|
@ -96,7 +99,7 @@ main(int argc, char **argv) {
|
||||||
char buf[64000];
|
char buf[64000];
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
len = read(fd, &buf[2], sizeof(buf) - 2);
|
len = read(fd, &buf[HDR_SIZE], sizeof(buf) - HDR_SIZE);
|
||||||
if(len == 0) {
|
if(len == 0) {
|
||||||
printf("File successfully sent (%d bytes)\n", total);
|
printf("File successfully sent (%d bytes)\n", total);
|
||||||
len = read(s, buf, sizeof(buf));
|
len = read(s, buf, sizeof(buf));
|
||||||
|
@ -118,7 +121,7 @@ main(int argc, char **argv) {
|
||||||
total += len;
|
total += len;
|
||||||
buf[0] = len >> 8;
|
buf[0] = len >> 8;
|
||||||
buf[1] = len & 0xff;
|
buf[1] = len & 0xff;
|
||||||
if(write(s, buf, len + 2) == -1) {
|
if(write(s, buf, len + HDR_SIZE) == -1) {
|
||||||
perror("network send failed");
|
perror("network send failed");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue