diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2002-01-31 21:42:11 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2002-01-31 21:42:11 +0000 |
commit | 0286b9f6145f9664f6b0e196e24daee8be46b538 (patch) | |
tree | 5cdf87997238653f4083fe1c1326213040183044 /cpukit/pppd/rtemspppd.c | |
parent | 2002-01-31 Ralf Corsepius <corsepiu@faw.uni-ulm.de> (diff) | |
download | rtems-0286b9f6145f9664f6b0e196e24daee8be46b538.tar.bz2 |
2001-01-31 Mike Siers <mikes@poliac.com>
* Nice Update of PPPD support which eliminates the
requiremetn that drivers be in the termios TASK_DRIVEN mode.
Mike did significant testing and reports that it seems to be
more stable and handle larger packets better. This patch
replaces the termios tasks with more general pppd network
driver tasks. The functions pppinput() and pppstart() get
called from the interrupt service routine.
* Makefile.am, configure.ac, net/Makefile.am, net/bpf.h,
net/ethernet.h, net/if.c, net/if.h, net/if_arp.h, net/if_dl.h,
net/if_ethersubr.c, net/if_llc.h, net/if_loop.c, net/if_ppp.h,
net/if_pppvar.h, net/if_types.h, net/netisr.h, net/ppp-comp.h,
net/ppp_defs.h, net/pppcompress.h, net/radix.c, net/radix.h,
net/raw_cb.c, net/raw_cb.h, net/raw_usrreq.c, net/route.c,
net/route.h, net/rtsock.c, pppd/Makefile.am, pppd/README,
pppd/STATUS, pppd/auth.c, pppd/cbcp.c, pppd/ccp.c, pppd/ccp.h,
pppd/chap.c, pppd/chap.h, pppd/chap_ms.c, pppd/chap_ms.h,
pppd/chat.c, pppd/demand.c, pppd/fsm.c, pppd/fsm.h, pppd/ipcp.c,
pppd/ipcp.h, pppd/ipxcp.c, pppd/ipxcp.h, pppd/lcp.c, pppd/lcp.h,
pppd/magic.c, pppd/magic.h, pppd/options.c, pppd/patchlevel.h,
pppd/pathnames.h, pppd/pppd.8, pppd/pppd.h, pppd/rtemsmain.c,
pppd/rtemspppd.c, pppd/rtemspppd.h, pppd/sys-rtems.c, pppd/upap.c,
pppd/upap.h, pppd/utils.c, pppd/example/README,
pppd/example/netconfig.h, wrapup/Makefile.am: Modified.
* net/bsd-comp.c, net/if_ppp.c, net/ppp-deflate.c, net/ppp.h,
net/ppp_tty.c, net/pppcompress.c, net/zlib.c, net/zlib.h: New file.
* modem/, modem/.cvsignore, modem/Makefile.am, modem/ppp.c,
modem/ppp.h, modem/ppp_tty.c, modem/pppcompress.c: Subdirectory removed.
Diffstat (limited to 'cpukit/pppd/rtemspppd.c')
-rw-r--r-- | cpukit/pppd/rtemspppd.c | 55 |
1 files changed, 46 insertions, 9 deletions
diff --git a/cpukit/pppd/rtemspppd.c b/cpukit/pppd/rtemspppd.c index 5a821cdfaf..0089c01946 100644 --- a/cpukit/pppd/rtemspppd.c +++ b/cpukit/pppd/rtemspppd.c @@ -1,15 +1,18 @@ #include <rtems.h> +#include <rtems/rtems_bsdnet.h> #include "pppd.h" #include "rtemspppd.h" /* define pppd function prototypes */ extern void pppasyncattach(void); -extern int pppdmain(int, char **); +extern int pppdmain(int, char **); /* define global variables */ -rtems_id rtems_pppd_taskid; +rtems_id rtems_pppd_taskid; +rtems_pppd_hookfunction rtems_pppd_errorfp; +rtems_pppd_hookfunction rtems_pppd_exitfp; static rtems_task pppTask(rtems_task_argument arg) @@ -18,6 +21,7 @@ static rtems_task pppTask(rtems_task_argument arg) rtems_option options; rtems_event_set in; rtems_event_set out; + int iStatus; /* call function to setup ppp line discipline */ pppasyncattach(); @@ -38,27 +42,48 @@ static rtems_task pppTask(rtems_task_argument arg) else if ( out & RTEMS_EVENT_30 ) { /* connect request */ /* execute the pppd main code */ - pppdmain(0, NULL); + iStatus = pppdmain(0, NULL); + if ( iStatus == EXIT_OK ) { + /* check exit callback */ + if ( rtems_pppd_exitfp ) { + (*rtems_pppd_exitfp)(); + } + } + else { + /* check error callback */ + if ( rtems_pppd_errorfp ) { + (*rtems_pppd_errorfp)(); + } + } } } } /* terminate myself */ + rtems_pppd_taskid = 0; rtems_task_delete(RTEMS_SELF); } int rtems_pppd_initialize(void) { - int iReturn = (int)-1; + int iReturn = (int)-1; + rtems_unsigned32 priority = 100; rtems_status_code status; rtems_name taskName; + /* determine priority value */ + if ( rtems_bsdnet_config.network_task_priority ) { + priority = rtems_bsdnet_config.network_task_priority; + } + + /* initialize the exit hook */ + rtems_pppd_exitfp = (rtems_pppd_hookfunction)0; + + /* create the rtems task */ taskName = rtems_build_name( 'p', 'p', 'p', 'd' ); - status = rtems_task_create(taskName, - RTEMS_PPPD_TASK_PRIORITY, - RTEMS_PPPD_TASK_STACK_SIZE, - RTEMS_PPPD_TASK_INITIAL_MODES, - RTEMS_DEFAULT_ATTRIBUTES, + status = rtems_task_create(taskName, priority, 8192, + (RTEMS_PREEMPT|RTEMS_NO_TIMESLICE|RTEMS_NO_ASR|RTEMS_INTERRUPT_LEVEL(0)), + RTEMS_NO_FLOATING_POINT|RTEMS_LOCAL, &rtems_pppd_taskid); if ( status == RTEMS_SUCCESSFUL ) { status = rtems_task_start(rtems_pppd_taskid, pppTask, 0); @@ -114,6 +139,12 @@ int rtems_pppd_set_hook(int id, rtems_pppd_hookfunction hookfp) case RTEMS_PPPD_IPDOWN_HOOK: ip_down_hook = hookfp; break; + case RTEMS_PPPD_ERROR_HOOK: + rtems_pppd_errorfp = hookfp; + break; + case RTEMS_PPPD_EXIT_HOOK: + rtems_pppd_exitfp = hookfp; + break; default: iReturn = (int)-1; break; @@ -122,6 +153,12 @@ int rtems_pppd_set_hook(int id, rtems_pppd_hookfunction hookfp) return ( iReturn ); } +int rtems_pppd_set_dialer(rtems_pppd_dialerfunction dialerfp) +{ + pppd_dialer = dialerfp; + return ( (int)0 ); +} + int rtems_pppd_set_option(const char *pOption, const char *pValue) { int iReturn = (int)0; |