From eef68488bcec4cc0dd170dfa96903c32f7f3c067 Mon Sep 17 00:00:00 2001 From: davidhaas Date: Wed, 12 Feb 2003 15:09:15 +0000 Subject: [PATCH] Fix some compile issues with both coldfire and unix builds. --- ports/coldfire/include/arch/cc.h | 3 +- ports/unix/include/arch/cc.h | 3 ++ ports/unix/include/netif/sio.h | 2 +- ports/unix/netif/fifo.c | 28 +++++++-------- ports/unix/netif/pcapif.c | 4 +-- ports/unix/netif/sio.c | 60 ++++++++++++++++---------------- 6 files changed, 52 insertions(+), 48 deletions(-) diff --git a/ports/coldfire/include/arch/cc.h b/ports/coldfire/include/arch/cc.h index 8797a7b..a1233b0 100644 --- a/ports/coldfire/include/arch/cc.h +++ b/ports/coldfire/include/arch/cc.h @@ -30,12 +30,13 @@ * * Author: Adam Dunkels * - * $Id: cc.h,v 1.2 2003/02/11 20:59:49 davidhaas Exp $ + * $Id: cc.h,v 1.3 2003/02/12 15:09:15 davidhaas Exp $ */ #ifndef __CC_H__ #define __CC_H__ #include +#include #define BYTE_ORDER BIG_ENDIAN #define IMM_ADDRESS (0x10000000) diff --git a/ports/unix/include/arch/cc.h b/ports/unix/include/arch/cc.h index ed2bc6e..bc2be41 100644 --- a/ports/unix/include/arch/cc.h +++ b/ports/unix/include/arch/cc.h @@ -32,6 +32,9 @@ #ifndef __ARCH_CC_H__ #define __ARCH_CC_H__ +/* Include some files for defining library routines */ +#include + /* Define platform endianness */ #ifndef BYTE_ORDER #define BYTE_ORDER LITTLE_ENDIAN diff --git a/ports/unix/include/netif/sio.h b/ports/unix/include/netif/sio.h index 24a6555..e47a27e 100644 --- a/ports/unix/include/netif/sio.h +++ b/ports/unix/include/netif/sio.h @@ -4,7 +4,7 @@ #include "lwip/sys.h" #include "lwip/netif.h" #include "netif/fifo.h" -//#include "netif/pppif.h" +/*#include "netif/pppif.h"*/ /* BAUDRATE is defined in sio.c as it is implementation specific */ typedef struct sio_status_t { diff --git a/ports/unix/netif/fifo.c b/ports/unix/netif/fifo.c index 99122c2..eff3af7 100644 --- a/ports/unix/netif/fifo.c +++ b/ports/unix/netif/fifo.c @@ -22,14 +22,14 @@ u8_t fifoGet(fifo_t * fifo) { u8_t c; - sys_sem_wait(fifo->sem); // enter critical section + sys_sem_wait(fifo->sem); /* enter critical section */ if (fifo->dataslot == fifo->emptyslot) { - fifo->getWaiting = TRUE; // tell putFifo to signal us when data is available - sys_sem_signal(fifo->sem); // leave critical section (allow input from serial port..) - sys_sem_wait(fifo->getSem); // wait 4 data - sys_sem_wait(fifo->sem); // reenter critical section + fifo->getWaiting = TRUE; /* tell putFifo to signal us when data is available */ + sys_sem_signal(fifo->sem); /* leave critical section (allow input from serial port..) */ + sys_sem_wait(fifo->getSem); /* wait 4 data */ + sys_sem_wait(fifo->sem); /* reenter critical section */ } c = fifo->data[fifo->dataslot++]; @@ -39,7 +39,7 @@ u8_t fifoGet(fifo_t * fifo) { fifo->dataslot = 0; } - sys_sem_signal(fifo->sem); // leave critical section + sys_sem_signal(fifo->sem); /* leave critical section */ return c; } @@ -48,11 +48,11 @@ s16_t fifoGetNonBlock(fifo_t * fifo) { u16_t c; - sys_sem_wait(fifo->sem); // enter critical section + sys_sem_wait(fifo->sem); /* enter critical section */ if (fifo->dataslot == fifo->emptyslot) { - // empty fifo + /* empty fifo */ c = -1; } else @@ -65,7 +65,7 @@ s16_t fifoGetNonBlock(fifo_t * fifo) fifo->dataslot = 0; } } - sys_sem_signal(fifo->sem); // leave critical section + sys_sem_signal(fifo->sem); /* leave critical section */ return c; } @@ -75,7 +75,7 @@ void fifoPut(fifo_t * fifo, int fd) /* FIXME: mutex around struct data.. */ int cnt=0; - sys_sem_wait( fifo->sem ); // enter critical + sys_sem_wait( fifo->sem ); /* enter critical */ DEBUGF( SIO_FIFO_DEBUG,("fifoput: len%d dat%d empt%d --> ", fifo->len, fifo->dataslot, fifo->emptyslot ) ); @@ -105,7 +105,7 @@ void fifoPut(fifo_t * fifo, int fd) fifo->emptyslot = 0; DEBUGF( SIO_FIFO_DEBUG, ("(WRAP) ") ); - sys_sem_signal( fifo->sem ); // leave critical + sys_sem_signal( fifo->sem ); /* leave critical */ fifoPut( fifo, fd ); return; } @@ -115,7 +115,7 @@ void fifoPut(fifo_t * fifo, int fd) sys_sem_signal( fifo->getSem ); } - sys_sem_signal( fifo->sem ); // leave critical + sys_sem_signal( fifo->sem ); /* leave critical */ return; } @@ -125,7 +125,7 @@ void fifoInit(fifo_t * fifo) fifo->dataslot = 0; fifo->emptyslot = 0; fifo->len = 0; - fifo->sem = sys_sem_new(1); // critical section 1=free to enter - fifo->getSem = sys_sem_new(0); // 0 = no one waiting + fifo->sem = sys_sem_new(1); /* critical section 1=free to enter */ + fifo->getSem = sys_sem_new(0); /* 0 = no one waiting */ fifo->getWaiting = FALSE; } diff --git a/ports/unix/netif/pcapif.c b/ports/unix/netif/pcapif.c index 42ce7f8..c3be3ed 100644 --- a/ports/unix/netif/pcapif.c +++ b/ports/unix/netif/pcapif.c @@ -119,12 +119,12 @@ timeout(void *arg) ethhdr = p->payload; switch(htons(ethhdr->type)) { case ETHTYPE_IP: - arp_ip_input(netif, p); + etharp_ip_input(netif, p); pbuf_header(p, -14); netif->input(p, netif); break; case ETHTYPE_ARP: - p = arp_arp_input(netif, pcapif->ethaddr, p); + p = etharp_arp_input(netif, pcapif->ethaddr, p); if(p != NULL) { printf("ARP outout\n"); pbuf_free(p); diff --git a/ports/unix/netif/sio.c b/ports/unix/netif/sio.c index 6375d07..ea52dc2 100644 --- a/ports/unix/netif/sio.c +++ b/ports/unix/netif/sio.c @@ -28,8 +28,8 @@ #include #include -//#define BAUDRATE B19200 -//#define BAUDRATE B57600 +/*#define BAUDRATE B19200 */ +/*#define BAUDRATE B57600 */ #define BAUDRATE B115200 #ifndef TRUE @@ -45,10 +45,10 @@ #endif -// typedef struct siostruct_t -// { -// sio_status_t *sio; -// } siostruct_t; +/* typedef struct siostruct_t */ +/* { */ +/* sio_status_t *sio; */ +/* } siostruct_t; */ /** array of ((siostruct*)netif->state)->sio structs */ static sio_status_t statusar[2]; @@ -125,10 +125,10 @@ static int sio_init( char * device, int devnum, sio_status_t * siostat ) tcgetattr( fd,&oldtio ); /* save current port settings */ /* set new port settings */ /* see 'man termios' for further settings */ - newtio.c_cflag = BAUDRATE | CS8 | CLOCAL | CREAD; // | CRTSCTS; + newtio.c_cflag = BAUDRATE | CS8 | CLOCAL | CREAD; /* | CRTSCTS; */ newtio.c_iflag = 0; newtio.c_oflag = 0; - newtio.c_lflag = 0; //ECHO; + newtio.c_lflag = 0; /*ECHO; */ newtio.c_cc[VMIN] = 1; /* Read 1 byte at a time, no timer */ newtio.c_cc[VTIME] = 0; @@ -144,7 +144,7 @@ static int sio_init( char * device, int devnum, sio_status_t * siostat ) static void sio_speed( int fd, int speed ) { struct termios oldtio,newtio; - // int fd; + /* int fd; */ DEBUGF( 1,("sio_speed: baudcode:%d enter\n",speed ) ); @@ -158,10 +158,10 @@ static void sio_speed( int fd, int speed ) /* set new port settings * see 'man termios' for further settings */ - newtio.c_cflag = speed | CS8 | CLOCAL | CREAD; //§ | CRTSCTS; + newtio.c_cflag = speed | CS8 | CLOCAL | CREAD; /*§ | CRTSCTS; */ newtio.c_iflag = 0; newtio.c_oflag = 0; - newtio.c_lflag = 0; //ECHO; + newtio.c_lflag = 0; /*ECHO; */ newtio.c_cc[VMIN] = 1; /* Read 1 byte at a time, no timer */ newtio.c_cc[VTIME] = 0; @@ -174,7 +174,7 @@ static void sio_speed( int fd, int speed ) /* --public-functions----------------------------------------------------------------------------- */ void sio_send( u8_t c, sio_status_t * siostat ) { -// sio_status_t * siostat = ((siostruct_t*)netif->state)->sio; + /* sio_status_t * siostat = ((siostruct_t*)netif->state)->sio; */ if ( write( siostat->fd, &c, 1 ) <= 0 ) { @@ -184,7 +184,7 @@ void sio_send( u8_t c, sio_status_t * siostat ) void sio_send_string( u8_t *str, sio_status_t * siostat ) { -// sio_status_t * siostat = ((siostruct_t*)netif->state)->sio; + /* sio_status_t * siostat = ((siostruct_t*)netif->state)->sio; */ int len = strlen( (const char *)str ); if ( write( siostat->fd, str, len ) <= 0 ) @@ -198,27 +198,27 @@ void sio_send_string( u8_t *str, sio_status_t * siostat ) void sio_flush( sio_status_t * siostat ) { /* not implemented in unix as it is not needed */ - //sio_status_t * siostat = ((siostruct_t*)netif->state)->sio; + /*sio_status_t * siostat = ((siostruct_t*)netif->state)->sio; */ } -//u8_t sio_recv( struct netif * netif ) +/*u8_t sio_recv( struct netif * netif )*/ u8_t sio_recv( sio_status_t * siostat ) { -// sio_status_t * siostat = ((siostruct_t*)netif->state)->sio; + /* sio_status_t * siostat = ((siostruct_t*)netif->state)->sio; */ return fifoGet( &(siostat->myfifo) ); } s16_t sio_poll(sio_status_t * siostat) { -// sio_status_t * siostat = ((siostruct_t*)netif->state)->sio; + /* sio_status_t * siostat = ((siostruct_t*)netif->state)->sio;*/ return fifoGetNonBlock( &(siostat->myfifo) ); } void sio_expect_string( u8_t *str, sio_status_t * siostat ) { -// sio_status_t * siostat = ((siostruct_t*)netif->state)->sio; + /* sio_status_t * siostat = ((siostruct_t*)netif->state)->sio;*/ u8_t c; int finger=0; @@ -232,14 +232,14 @@ void sio_expect_string( u8_t *str, sio_status_t * siostat ) finger++; } else if ( finger > 0 ) { - //it might fit in the beginning? + /*it might fit in the beginning? */ if ( str[0] == c ) { finger = 1; } } if ( 0 == str[finger] ) - break; // done, we have a match + break; /* done, we have a match */ } DEBUGF( (PPP_DEBUG | SIO_DEBUG), ("[match]\n") ); } @@ -251,15 +251,15 @@ sio_status_t * sio_open( int devnum ) /* would be nice with dynamic memory alloc */ sio_status_t * siostate = &statusar[ devnum ]; -// siostruct_t * tmp; -// -// -// tmp = (siostruct_t*)(netif->state); -// tmp->sio = siostate; -// -// tmp = (siostruct_t*)(netif->state); -// -// ((sio_status_t*)(tmp->sio))->fd = 0; +/* siostruct_t * tmp; */ + + +/* tmp = (siostruct_t*)(netif->state); */ +/* tmp->sio = siostate; */ + +/* tmp = (siostruct_t*)(netif->state); */ + +/* ((sio_status_t*)(tmp->sio))->fd = 0; */ fifoInit( &siostate->myfifo ); @@ -289,7 +289,7 @@ sio_status_t * sio_open( int devnum ) */ void sio_change_baud( sioBaudrates baud, sio_status_t * siostat ) { -// sio_status_t * siostat = ((siostruct_t*)netif->state)->sio; + /* sio_status_t * siostat = ((siostruct_t*)netif->state)->sio;*/ DEBUGF( 1,("sio_change_baud\n" ));