ppp support for ecos

This commit is contained in:
jani 2003-05-27 14:38:51 +00:00
parent 77ebfac7d0
commit fff576d8b8
5 changed files with 136 additions and 29 deletions

View File

@ -53,7 +53,7 @@
cdl_package CYGPKG_NET_LWIP { cdl_package CYGPKG_NET_LWIP {
display "lwIP" display "lwIP"
description "Lightweight TCP/IP stack" description "Lightweight TCP/IP stack"
requires {CYGPKG_IO_ETH_DRIVERS || (CYGPKG_LWIP_SLIP == 1)} requires {CYGPKG_IO_ETH_DRIVERS || (CYGPKG_LWIP_SLIP == 1) || (CYGPKG_LWIP_PPP == 1)}
compile core/mem.c \ compile core/mem.c \
core/memp.c \ core/memp.c \
@ -278,7 +278,7 @@ cdl_package CYGPKG_NET_LWIP {
cdl_option CYGPKG_LWIP_PBUF_LINK_HLEN { cdl_option CYGPKG_LWIP_PBUF_LINK_HLEN {
display "Allocation for a link level header" display "Allocation for a link level header"
flavor data flavor data
calculated {CYGPKG_LWIP_SLIP ? 0 : 16} calculated {CYGPKG_LWIP_SLIP || CYGPKG_LWIP_PPP ? 0 : 16}
description " description "
PBUF_LINK_HLEN: the number of bytes that should be allocated for a PBUF_LINK_HLEN: the number of bytes that should be allocated for a
link level header." link level header."
@ -296,7 +296,15 @@ cdl_package CYGPKG_NET_LWIP {
default_value 1 default_value 1
description "" description ""
}
cdl_option CYGPKG_LWIP_TCPIP_THREAD_PRIORITY {
display "tcpip thread priority"
flavor data
default_value 7
description "later"
} }
cdl_option CYGPKG_LWIP_TCP_TTL { cdl_option CYGPKG_LWIP_TCP_TTL {
display "Time To Live" display "Time To Live"
flavor data flavor data
@ -449,15 +457,60 @@ cdl_package CYGPKG_NET_LWIP {
default_value 0 default_value 0
description "IP over serial line" description "IP over serial line"
compile netif/slipif.c ecos/sio.c compile netif/slipif.c ecos/sio.c
cdl_option CYGPKG_LWIP_SLIPIF_THREAD_PRIORITY {
display "SLIP thread priority"
flavor data
default_value 8
description "later"
}
cdl_option CYGPKG_LWIP_SLIP_DEV { cdl_option CYGPKG_LWIP_SLIP_DEV {
display "Serial device" display "Serial device"
flavor data flavor data
default_value {"\"/dev/ser2\""} default_value {"\"/dev/ser0\""}
description " description "
Which serial port to use SLIP on." Which serial port to use SLIP on."
} }
} }
cdl_component CYGPKG_LWIP_PPP {
display "PPP"
flavor bool
requires CYGPKG_IO_SERIAL_DEVICES
default_value 0
description "The Point-to-Point Protocol"
compile netif/ppp/ppp.c \
netif/ppp/auth.c \
netif/ppp/pap.c \
netif/ppp/chap.c \
netif/ppp/chpms.c \
netif/ppp/fsm.c \
netif/ppp/ipcp.c \
netif/ppp/lcp.c \
netif/ppp/magic.c \
netif/ppp/md5.c \
netif/ppp/randm.c \
netif/ppp/vj.c \
netif/ppp/target.c \
ecos/sio.c
cdl_option CYGPKG_LWIP_PPP_DEV {
display "Serial device for PPP"
flavor data
default_value {"\"/dev/ser0\""}
description "
Which serial port to use PPP on."
}
cdl_option CYGPKG_LWIP_PPP_THREAD_PRIORITY {
display "PPP main thread priority"
flavor data
default_value 8
description "later"
}
}
cdl_component CYGPKG_LWIP_UDP_OPTIONS { cdl_component CYGPKG_LWIP_UDP_OPTIONS {
display "UDP" display "UDP"

View File

@ -35,7 +35,6 @@
#define __LWIPOPTS_H__ #define __LWIPOPTS_H__
/*include the configuration made with configtool*/ /*include the configuration made with configtool*/
#include <pkgconf/net_lwip.h> #include <pkgconf/net_lwip.h>
#define TCPIP_THREAD_PRIO 7
/* ---------- Memory options ---------- */ /* ---------- Memory options ---------- */
/* MEM_ALIGNMENT: should be set to the alignment of the CPU for which /* MEM_ALIGNMENT: should be set to the alignment of the CPU for which
lwIP is compiled. 4 byte alignment -> define MEM_ALIGNMENT to 4, 2 lwIP is compiled. 4 byte alignment -> define MEM_ALIGNMENT to 4, 2
@ -122,7 +121,7 @@ a lot of data that needs to be copied, this should be set high. */
#define TCP_SYNMAXRTX CYGPKG_LWIP_TCP_SYNMAXRTX #define TCP_SYNMAXRTX CYGPKG_LWIP_TCP_SYNMAXRTX
/* ---------- ARP options ---------- */ /* ---------- ARP options ---------- */
#define ARP_TABLE_SIZE CYGPKG_LWIP_ARP_TABLE_SIZE #define ARP_TABLE_SIZE CYGPKG_LWIP_ARP_TABLE_SIZE
/* ---------- IP options ---------- */ /* ---------- IP options ---------- */
/* Define IP_FORWARD to 1 if you wish to have the ability to forward /* Define IP_FORWARD to 1 if you wish to have the ability to forward
@ -154,16 +153,20 @@ a lot of data that needs to be copied, this should be set high. */
#define LWIP_UDP CYGPKG_LWIP_UDP #define LWIP_UDP CYGPKG_LWIP_UDP
#define UDP_TTL CYGPKG_LWIP_UDP_TTL #define UDP_TTL CYGPKG_LWIP_UDP_TTL
/* ---------- SLIP options --------- */ /* ---------- SLIP options --------- */
#define LWIP_SLIP defined(CYGPKG_LWIP_SLIP) #define LWIP_SLIP defined(CYGPKG_LWIP_SLIP)
#define SLIP_DEV CYGPKG_LWIP_SLIP_DEV #define SLIP_DEV CYGPKG_LWIP_SLIP_DEV
/* ---------- PPP options --------- */ /* ---------- PPP options --------- */
#define PPP_SUPPORT defined(CYGPKG_LWIP_PPP) #define PPP_SUPPORT defined(CYGPKG_LWIP_PPP)
#define PPP_DEV CYGPKG_LWIP_PPP_DEV #define PPP_DEV CYGPKG_LWIP_PPP_DEV
#define MD5_SUPPORT 1 #define MD5_SUPPORT 1
#define PAP_SUPPORT 1 #define PAP_SUPPORT 1
/* ------- Thread priorities ---------------*/
#define TCPIP_THREAD_PRIO CYGPKG_LWIP_TCPIP_THREAD_PRIORITY
#define SLIPIF_THREAD_PRIO CYGPKG_LWIP_SLIPIF_THREAD_PRIORITY
#define PPP_THREAD_PRIO CYGPKG_LWIP_PPP_THREAD_PRIORITY
/* ---------- Statistics options ---------- */ /* ---------- Statistics options ---------- */
#endif /* __LWIPOPTS_H__ */ #endif /* __LWIPOPTS_H__ */

View File

@ -41,10 +41,24 @@ struct netif mynetif;
static void ecosglue_init(void); static void ecosglue_init(void);
void lwip_set_addr(struct netif *netif); void lwip_set_addr(struct netif *netif);
#if PPP_SUPPORT #if PPP_SUPPORT
void pppMyCallback(void *a , int e) void
pppMyCallback(void *a , int e)
{ {
diag_printf("callback %d \n",e); diag_printf("callback %d \n",e);
} }
/* These temporarily here */
unsigned long
ppp_jiffies(void)
{
return cyg_current_time();
}
void
ppp_trace(int level, const char *format,...)
{
diag_printf(format);
}
#endif #endif
/* /*
* Called by the eCos application at startup * Called by the eCos application at startup

View File

@ -12,13 +12,15 @@ static cyg_io_handle_t ser;
static int len; static int len;
void sio_send(char c,void * dev) void
sio_send(char c,void * dev)
{ {
len = 1; len = 1;
cyg_io_write(*(cyg_io_handle_t*)dev, &c, &len); cyg_io_write(*(cyg_io_handle_t*)dev, &c, &len);
} }
char sio_recv(void * dev) char
sio_recv(void * dev)
{ {
char c; char c;
len = 1; len = 1;
@ -26,32 +28,39 @@ char sio_recv(void * dev)
return c; return c;
} }
int sio_write(void *dev, char *b, int size) int
sio_write(void *dev, char *b, int size)
{ {
int len = size; int len = size;
cyg_io_write(*(cyg_io_handle_t*)dev, b, &len); cyg_io_write(*(cyg_io_handle_t*)dev, b, &len);
return len; return len;
} }
int sio_read(void *dev, char *b, int size) int
sio_read(void *dev, char *b, int size)
{ {
int len = size; int len = size;
cyg_io_read(*(cyg_io_handle_t*)dev, b, &len); cyg_io_read(*(cyg_io_handle_t*)dev, b, &len);
return len; return len;
} }
void * sio_open(int devnum)
void *
sio_open(int devnum)
{ {
int res; int res;
cyg_uint32 nb = 0; cyg_uint32 nb = 0, len = 4;
char siodev[] = "/dev/serX";
#if LWIP_SLIP
if (devnum < 0 || devnum >9) #define SIODEV SLIP_DEV
return NULL; #elif PPP_SUPPORT
siodev[8] = '0' + devnum; #define SIODEV PPP_DEV
res = cyg_io_lookup(siodev, &ser); #endif
res = cyg_io_lookup(SIODEV, &ser);
if (res != ENOERR) if (res != ENOERR)
diag_printf("Cannot open %s\n", siodev); diag_printf("Cannot open %s\n", SIODEV);
cyg_io_set_config(ser, CYG_IO_SET_CONFIG_READ_BLOCKING, nb, 4);
res = cyg_io_set_config(ser, CYG_IO_SET_CONFIG_READ_BLOCKING, &nb, &len);
return &ser; return &ser;
} }

View File

@ -48,3 +48,31 @@ src/include/netif/etharp.h include/netif/etharp.h
src/include/netif/slipif.h include/netif/slipif.h src/include/netif/slipif.h include/netif/slipif.h
src/netif/etharp.c src/netif/etharp.c src/netif/etharp.c src/netif/etharp.c
src/netif/slipif.c src/netif/slipif.c src/netif/slipif.c src/netif/slipif.c
src/netif/ppp/ppp.c src/netif/ppp/ppp.c
src/netif/ppp/auth.c src/netif/ppp/auth.c
src/netif/ppp/chap.c src/netif/ppp/chap.c
src/netif/ppp/chpms.c src/netif/ppp/chpms.c
src/netif/ppp/pap.c src/netif/ppp/pap.c
src/netif/ppp/magic.c src/netif/ppp/magic.c
src/netif/ppp/md5.c src/netif/ppp/md5.c
src/netif/ppp/target.c src/netif/ppp/target.c
src/netif/ppp/fsm.c src/netif/ppp/fsm.c
src/netif/ppp/ipcp.c src/netif/ppp/ipcp.c
src/netif/ppp/lcp.c src/netif/ppp/lcp.c
src/netif/ppp/randm.c src/netif/ppp/randm.c
src/netif/ppp/vj.c src/netif/ppp/vj.c
src/netif/ppp/ppp.h src/netif/ppp/ppp.h
src/netif/ppp/pppdebug.h src/netif/ppp/pppdebug.h
src/netif/ppp/auth.h src/netif/ppp/auth.h
src/netif/ppp/chap.h src/netif/ppp/chap.h
src/netif/ppp/chpms.h src/netif/ppp/chpms.h
src/netif/ppp/pap.h src/netif/ppp/pap.h
src/netif/ppp/magic.h src/netif/ppp/magic.h
src/netif/ppp/md5.h src/netif/ppp/md5.h
src/netif/ppp/target.h src/netif/ppp/target.h
src/netif/ppp/fsm.h src/netif/ppp/fsm.h
src/netif/ppp/ipcp.h src/netif/ppp/ipcp.h
src/netif/ppp/lcp.h src/netif/ppp/lcp.h
src/netif/ppp/randm.h src/netif/ppp/randm.h
src/netif/ppp/vj.h src/netif/ppp/vj.h
src/netif/ppp/vjbsdhdr.h src/netif/ppp/vjbsdhdr.h