Fix some compile issues with both coldfire and unix builds.
This commit is contained in:
parent
ae49c020d7
commit
eef68488bc
|
@ -30,12 +30,13 @@
|
|||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
* $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 <types.h>
|
||||
#include <string.h>
|
||||
|
||||
#define BYTE_ORDER BIG_ENDIAN
|
||||
#define IMM_ADDRESS (0x10000000)
|
||||
|
|
|
@ -32,6 +32,9 @@
|
|||
#ifndef __ARCH_CC_H__
|
||||
#define __ARCH_CC_H__
|
||||
|
||||
/* Include some files for defining library routines */
|
||||
#include <string.h>
|
||||
|
||||
/* Define platform endianness */
|
||||
#ifndef BYTE_ORDER
|
||||
#define BYTE_ORDER LITTLE_ENDIAN
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -28,8 +28,8 @@
|
|||
#include <sys/signal.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
//#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" ));
|
||||
|
||||
|
|
Loading…
Reference in New Issue