Commit d308adc9 authored by Ben Laughton's avatar Ben Laughton
Browse files

Changed Makefile structure so it's easier to switch between different builds.

Got rid of a few more compilation warnings.

Added diallerb option to use DiallerB for serial stream handle
arbitration instead of dialler.

Removed ability for PPP to use Dialler/DiallerB for timeouts and line
drop detection - nothing used these and they have no advantages over
PPP's internal routines for doing the same.
| Copyright 1998 Acorn Computers Ltd
|
| Licensed under the Apache License, Version 2.0 (the "License");
| you may not use this file except in compliance with the License.
| You may obtain a copy of the License at
|
| http://www.apache.org/licenses/LICENSE-2.0
|
| Unless required by applicable law or agreed to in writing, software
| distributed under the License is distributed on an "AS IS" BASIS,
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
| See the License for the specific language governing permissions and
| limitations under the License.
|
Dir <Obey$Dir>
wimpslot 2048k
amu_machine debug THROWBACK=-throwback CBLOCKDRIVERS=-DBLOCKDRIVERS ASMBLOCKDRIVERS={TRUE}
| Copyright 1998 Acorn Computers Ltd
|
| Licensed under the Apache License, Version 2.0 (the "License");
| you may not use this file except in compliance with the License.
| You may obtain a copy of the License at
|
| http://www.apache.org/licenses/LICENSE-2.0
|
| Unless required by applicable law or agreed to in writing, software
| distributed under the License is distributed on an "AS IS" BASIS,
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
| See the License for the specific language governing permissions and
| limitations under the License.
|
Dir <Obey$Dir>
wimpslot 2048k
amu_machine ram THROWBACK=-throwback CBLOCKDRIVERS=-DBLOCKDRIVERS ASMBLOCKDRIVERS={TRUE}
| Copyright 1998 Acorn Computers Ltd
|
| Licensed under the Apache License, Version 2.0 (the "License");
| you may not use this file except in compliance with the License.
| You may obtain a copy of the License at
|
| http://www.apache.org/licenses/LICENSE-2.0
|
| Unless required by applicable law or agreed to in writing, software
| distributed under the License is distributed on an "AS IS" BASIS,
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
| See the License for the specific language governing permissions and
| limitations under the License.
|
Dir <Obey$Dir>
wimpslot 2048k
amu_machine rom THROWBACK=-throwback CBLOCKDRIVERS=-DBLOCKDRIVERS ASMBLOCKDRIVERS={TRUE}
| Copyright 1998 Acorn Computers Ltd
|
| Licensed under the Apache License, Version 2.0 (the "License");
| you may not use this file except in compliance with the License.
| You may obtain a copy of the License at
|
| http://www.apache.org/licenses/LICENSE-2.0
|
| Unless required by applicable law or agreed to in writing, software
| distributed under the License is distributed on an "AS IS" BASIS,
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
| See the License for the specific language governing permissions and
| limitations under the License.
|
Dir <Obey$Dir>
wimpslot 2048k
amu_machine debug THROWBACK=-throwback ASMBLOCKDRIVERS={FALSE}
| Copyright 1998 Acorn Computers Ltd
|
| Licensed under the Apache License, Version 2.0 (the "License");
| you may not use this file except in compliance with the License.
| You may obtain a copy of the License at
|
| http://www.apache.org/licenses/LICENSE-2.0
|
| Unless required by applicable law or agreed to in writing, software
| distributed under the License is distributed on an "AS IS" BASIS,
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
| See the License for the specific language governing permissions and
| limitations under the License.
|
Dir <Obey$Dir>
wimpslot 8192k
amu_machine analyse THROWBACK=-throwback ASMBLOCKDRIVERS={FALSE}
| Copyright 1996 Acorn Computers Ltd
| Copyright 1998 Acorn Computers Ltd
|
| Licensed under the Apache License, Version 2.0 (the "License");
| you may not use this file except in compliance with the License.
......@@ -13,5 +13,5 @@
| limitations under the License.
|
Dir <Obey$Dir>
wimpslot 4000k
amu_machine all
wimpslot 2048k
amu_machine ram THROWBACK=-throwback ASMBLOCKDRIVERS={FALSE}
| Copyright 1996 Acorn Computers Ltd
| Copyright 1998 Acorn Computers Ltd
|
| Licensed under the Apache License, Version 2.0 (the "License");
| you may not use this file except in compliance with the License.
......@@ -13,5 +13,6 @@
| limitations under the License.
|
Dir <Obey$Dir>
wimpslot 5000k
amu_machine rom
wimpslot 2048k
amu_machine rom THROWBACK=-throwback ASMBLOCKDRIVERS={FALSE}
......@@ -17,102 +17,149 @@
# ***********************************
# *** C h a n g e L i s t ***
# ***********************************
# Date Name Description
# ---- ---- -----------
# 16-Jul-96 SMC Created
# Date Name Description
# ---- ---- -----------
# 1998-01-19 BAL Created
#
#
# Paths
#
EXP_HDR = <export$dir>
EXP_HDR = <export$dir>
#
# Generic options:
#
MKDIR = cdir
AS = objasm -tb
CC = cc
CMHG = cmhg
CP = copy
LD = link
RM = remove
MODSQZ = modsqz
WIPE = -wipe
CD = dir
MKDIR = cdir
AS = objasm
CC = cc
CMHG = cmhg
CP = copy
LD = <boot$dir>.library.link
RM = remove
MODSQZ = modsqz
WIPE = -wipe
ASMFLAGS = -depend !Depend ${THROWBACK} -predefine "BlockDrivers SETL ${ASMBLOCKDRIVERS}"
CFLAGS = -depend !Depend ${THROWBACK} ${INCLUDES} ${CBLOCKDRIVERS} -strict -wP -ffah
CMHGFLAGS = -depend !Depend ${THROWBACK} ${INCLUDES} ${CBLOCKDRIVERS} -p
CPFLAGS = ~cfr~v
WFLAGS = ~c~v
CPFLAGS = ~cfr~v
WFLAGS = ~c~v
DFLAGS_COMMON = -DINET -DCOMPAT_INET4 -DVJC
DFLAGS = ${DFLAGS_COMMON} -DNDEBUG
DDFLAGS = ${DFLAGS_COMMON} -DDEBUG -DDEBUG_TML -DTrace_TRACE
#
# Include files
# Libraries
#
INCLUDES= TCPIPLibs:,C:
CLIB = CLIB:o.stubs
RLIB = RISCOSLIB:o.risc_oslib
RSTUBS = RISCOSLIB:o.rstubs
ROMSTUBS = RISCOSLIB:o.romstubs
ROMCSTUBS = RISCOSLIB:o.romcstubs
ABSSYM = RISC_OSLib:o.c_AbsSym
INETLIB = TCPIPLibs:o.inetlibzm
SOCKLIB = TCPIPLibs:o.socklibzm
UNIXLIB = TCPIPLibs:o.unixlibzm
#
# Program specific options:
#
COMPONENT = PPP
TARGET = rm.PPP
ROMTARGET = aof.PPP
LIBS =\
${INETLIB}\
${SOCKLIB}\
${UNIXLIB}
# To compile a version of PPP which uses the blockdrivers uncomment the next
# line, ensure that o.blockdrive is in the list of object files and change
# ASMFLAGS so that the symbol BlockDrivers is predefined to {TRUE}
#
# The Makefile in pppd must also be changed
LIBSD =\
${INETLIB}\
${SOCKLIB}\
${UNIXLIB}\
<Lib$Dir>.svcprint.o.svcprint\
<Lib$Dir>.Trace.o.T_M_PL
BLOCKDRIVERS= #-DBLOCKDRIVERS
#
# Include files
#
INCLUDES = -ITCPIPLibs:,C:
#
# Program specific options:
#
COMPONENT = PPP
RAMTARGET = rm.PPP
ROMTARGET = aof.PPP
DEBUGTARGET = rm.PPPD
EXPORTS = ${EXP_DIR}.PPP
# You may want to link with TinyStubs. if you do, set LD to tlink and
# uncomment this TINYSTUBS, and comment out the STUBS
TINYSTUBS= #-DTINYSTUBS
STUBS= C:o.Stubs
#
# Export Paths for Messages module
#
#RESDIR = <resource$dir>.Resources2.PPP
ROMCSTUBS= RISC_OSLib:o.romcstubs
ABSSYM= RISC_OSLib:o.AbsSym
DEBUG= #-DDEBUG
OBJS =\
o.blockdrive\
o.if_ppp\
o.mbuf\
o.ppp_io\
o.ppphdr\
o.pppmodule\
o.serial\
o.slcompress\
COMPAT= -DCOMPAT_INET4
CFLAGS= -ffah -zM -I${INCLUDES} -DINET -DCOMPAT_INET4 ${DEBUG}\
-zps1 -Wp -depend !Depend -c -throwback -DVJC ${TINYSTUBS}\
${BLOCKDRIVERS}
OBJSD =\
od.blockdrive\
od.if_ppp\
od.mbuf\
od.ppp_io\
od.ppphdr\
od.pppmodule\
od.serial\
od.slcompress\
CMHGFLAGS= -p -I${INCLUDES} ${BLOCKDRIVERS} -depend !Depend
ASMFLAGS= -PreDefine "BlockDrivers SETL {FALSE}"
OBJSCP =\
cp.if_ppp\
cp.mbuf\
o.ppphdr\
cp.pppmodule\
cp.serial\
cp.slcompress\
OBJS= o.if_ppp o.slcompress o.pppmodule \
o.serial o.mbuf o.ppphdr o.ppp_io o.blockdrive \
${SOCKLIB} ${INETLIB} ${UNIXLIB} \
#o.svcprint
HDRS = h.PPPHdr
HDRS = h.ppphdr
#
# Rule patterns
#
.SUFFIXES: .o .h .s .c .cmhg
.c.o:; $(CC) $(CFLAGS) -o $@ $<
.s.o:; $(AS) ${ASMFLAGS} -o $@ $<
.cmhg.o:; ${CMHG} ${CMHGFLAGS} $< -o $@
.cmhg.h:; ${CMHG} ${CMHGFLAGS} $< -d $@
all: ${TARGET}
@echo ${COMPONENT}: all complete
.SUFFIXES: .o .od .cp .h .s .c .cmhg
.c.o:; ${CC} ${CFLAGS} ${DFLAGS} -c -zM -zps1 -o $@ $<
.c.od:; ${CC} ${CFLAGS} ${DDFLAGS} -c -zM -zps1 -fn -o $@ $<
.c.cp:; ${CC} ${CFLAGS} ${DFLAGS} -c -C -E $< >> $@
.s.o:; ${AS} ${ASMFLAGS} -o $@ $<
.s.od:; ${AS} ${ASMFLAGS} -o $@ $<
.cmhg.o:; ${CMHG} ${CMHGFLAGS} ${DFLAGS} -o $@ $<
.cmhg.od:; ${CMHG} ${CMHGFLAGS} ${DDFLAGS} -o $@ $<
.cmhg.h:; ${CMHG} ${CMHGFLAGS} ${DFLAGS} -d $@ $<
#
# RISC OS ROM build rules:
# Main rules:
#
ram: ${RAMTARGET}
@echo ${COMPONENT}: all complete
rom: ${ROMTARGET}
@echo ${COMPONENT}: rom module built
debug: ${DEBUGTARGET}
@echo ${COMPONENT}: debug build complete
analyse: pppd ${OBJSCP} ${HDRS}
@echo ${COMPONENT}: analysis build complete
export:
@echo ${COMPONENT}: export complete
......@@ -120,25 +167,45 @@ install_rom: ${ROMTARGET}
${CP} ${ROMTARGET} ${INSTDIR}.${COMPONENT} ${CPFLAGS}
@echo ${COMPONENT}: rom module installed
clean:
$(RM) $(HDRS)
$(WIPE) o.* $(WFLAGS)
$(WIPE) pppd.o.* $(WFLAGS)
$(WIPE) rm.* $(WFLAGS)
$(RM) link/sym
resources:
@echo ${COMPONENT}: resource files copied
clean: pppd
${RM} ${HDRS}
${WIPE} o.* ${WFLAGS}
${WIPE} od.* ${WFLAGS}
${WIPE} cp.* ${WFLAGS}
${WIPE} rm.* ${WFLAGS}
${WIPE} linked ${WFLAGS}
${WIPE} map ${WFLAGS}
${RM} ${RAMTARGET}
${RM} ${ROMTARGET}
${RM} ${DEBUGTARGET}
@echo ${COMPONENT}: cleaned
pppd:
Dir pppd
amu ${MFLAGS}
Up
#
# Target
#
${TARGET}: pppd $(OBJS) $(HDRS)
$(LD) -rmf -s link/sym -o rm.PPPu $(OBJS) $(STUBS) pppd.o.pppd
ModSqz rm.PPPu $@
${RAMTARGET}: pppd ${OBJS} ${HDRS} ${CLIB}
${LD} -rmf -o $@ pppd.o.pppd ${OBJS} ${LIBS} ${CLIB}
${MODSQZ} $@
#
# ROM Target
# ROM Target (re-linked at ROM Image build time)
#
${ROMTARGET}: pppd ${OBJS} $(HDRS)
${LD} -s link/sym -o $@ -aof ${OBJS} ${ROMCSTUBS} pppd.o.pppd
${ROMTARGET}: pppd ${OBJS} ${HDRS} ${ROMCSTUBS}
${LD} -o $@ -aof pppd.o.pppd ${OBJS} ${LIBS} ${ROMCSTUBS}
#
# Debug target
#
${DEBUGTARGET}: pppd ${OBJSD} ${HDRS} ${CLIB}
${LD} -rmf -o $@ pppd.od.pppd ${OBJSD} ${LIBSD} ${CLIB}
#
# Final link for the ROM Image (using given base address)
......@@ -151,14 +218,5 @@ rom_link:
${CP} linked.${COMPONENT} ${LINKDIR}.${COMPONENT} ${CPFLAGS}
@echo ${COMPONENT}: rom_link complete
#
# Some rules that need explicitly declaring
#
pppd:
Dir pppd
Amu
Up
s.blockdrive:: Internal.Driver
# Dynamic dependencies:
......@@ -69,11 +69,16 @@
* Paul Mackerras (paulus@cs.anu.edu.au).
*/
/* 1998-03-09: BAL
* Removed support for using the Dialler for idle-timeout. This was completely
* pointless as PPP's built-in idle timer works fine.
*/
/* from if_sl.c,v 1.11 84/10/04 12:54:47 rick Exp */
char *ack_if_ppp="Copyright (c) 1989 Carnegie Mellon University. "
"All rights reserved.";
static char *ack_if_ppp="Copyright (c) 1989 Carnegie Mellon University. "
"All rights reserved.";
#include <stdio.h>
#include <stdlib.h>
......@@ -537,12 +542,26 @@ int pppoutput(struct dib *ifp, struct mbuf *m0, const struct sockaddr *dst)
{
unsigned int status;
_swix (Dialler_Status, _OUT (0), &status);
if (dialler_flags & DiallerFlags_DiallerB)
{
_swix (DiallerB_Status, _OUT (0), &status);
}
else
{
_swix (Dialler_Status, _OUT (0), &status);
}
if ((status & (Dialler_ExecutingScript_Dial | Dialler_Connected)) == 0)
{
/* Dial up using previous settings */
_swix (Dialler_Dial, _INR (0, 4), 0, 0, 0, 0, 0);
if (dialler_flags & DiallerFlags_DiallerB)
{
_swix (DiallerB_Dial, _INR (0, 4), 0, 0, 0, 0, 0);
}
else
{
_swix (Dialler_Dial, _INR (0, 4), 0, 0, 0, 0, 0);
}
}
error = ENETUNREACH;
}
......@@ -585,13 +604,6 @@ int pppoutput(struct dib *ifp, struct mbuf *m0, const struct sockaddr *dst)
ifq = &sc->sc_fastq;
}
/* If the packet is TCP or UDP then prod the dialler to keep the line alive */
if ((dialler_flags & DiallerFlags_UsingDialler) &&
(ip->ip_p == IPPROTO_TCP || ip->ip_p == IPPROTO_UDP))
{
_swix (Dialler_ResetCounter, 0);
}
break;
#endif
case AF_UNSPEC:
......
......@@ -16,6 +16,12 @@
*
* Copyright (c) 1995 Acorn Computers Ltd., Cambridge, England
*
* 1998-03-09: BAL
* Added support for using DiallerB as well as Dialler for serial stream
* handle arbitration.
*
* Removed support for using Dialler to check for line drops as PPP's
* built in routines are perfectly good enough.
*/
#include <ctype.h>
#include <stdio.h>
......@@ -708,7 +714,6 @@ static int ppp_stats(_kernel_swi_regs *r)
static _kernel_oserror *ppp_alter_settings (_kernel_swi_regs *r)
{
unsigned int reason_code = (unsigned int) r->r[0];
int unit = r->r[1];
switch (reason_code)
......@@ -754,7 +759,6 @@ static _kernel_oserror *ppp_status (_kernel_swi_regs *r)
{
unsigned int reason_code = (unsigned int) r->r[0];
int interrupt_status;
int unit = r->r[1];
switch (reason_code)
......@@ -771,20 +775,7 @@ static _kernel_oserror *ppp_status (_kernel_swi_regs *r)
case PPP_Status_Connection:
if (modem)
{
#ifdef BLOCKDRIVERS
r->r[2] = (driver_modemcontrol() & 8) ? 1 : 0;
#else
ioctl_t ioctl;
ioctl.group = 0;
ioctl.reason = IOCtl_control_lines;
ioctl.reserved = 0;
ioctl.read = 1;
ioctl.write = 0;
_swix (OS_Args, _INR (0, 2), OS_Args_IOCtl, serial_in, &ioctl);
r->r[2] = (ioctl.data & IOCtl_control_line_DCD) ? 1 : 0;
#endif
r->r[2] = serial_dcd ();
}
/* atomic read of ppp phase */
......@@ -850,6 +841,7 @@ static void trace_enter (const char *fn)
{
int i;
Debug_Routine ("PPP");
for (i = 0; i < trace_depth; i++)
Debug_Routine (" |");
......@@ -946,20 +938,16 @@ _kernel_oserror *ppp_initialise(const char *cmd_tail, int pbase, void *pw)
}
#ifdef Trace_TRACE
pdebug ((LOG_DEBUG, "Initialising trace library"));
Trace_SetVerboseLevel (5);
/*
Trace_IgnoreFunctions (
"Printf syslog pppd* PDebug* trace* hup* upcall_handler pppinput pppioctl "
"putblock ppp_dequeue");
*/
"putblock ppp_dequeue message_* pr_log");
#if 0
Trace_IgnoreFunctions (
"Printf syslog PDebug* trace* pppinput putblock");
pdebug ((LOG_DEBUG, "Set functions to ignore"));
#endif
Trace_SetHandlers (trace_enter, trace_exit);
pdebug ((LOG_DEBUG, "Set trace handlers"));
Trace_InterceptAllFunctions ();
pdebug ((LOG_DEBUG, "Intercepted functions"));
#endif
#if 0
......@@ -1076,18 +1064,19 @@ static void handle_managerstatus(_kernel_swi_regs *r)
/* Module Service Call handler */
void ppp_sc_handler(int sn, _kernel_swi_regs *r, void *pw)
{
if (sn == Service_DiallerStatus)
{
/* syslog (LOG_INFO, "Service_DiallerStatus: %x", r->r[0]); */
NOT_USED (pw);
if ((r->r[0] & (Dialler_LineDropped | Dialler_RelinquishAccess)))
if ((dialler_flags & DiallerFlags_UsingDialler) &&
(sn == Service_DiallerStatus || sn == Service_DiallerBStatus))
{
if ( ( (dialler_flags & DiallerFlags_DiallerB) &&
sn == Service_DiallerBStatus) ||
( (dialler_flags & DiallerFlags_DiallerB) == 0 &&
sn == Service_DiallerStatus))
{
if ((r->r[0] & Dialler_DiallerDroppedLine) == Dialler_DiallerDroppedLine)
{
pppd_signal_handler (SIGTERM);
}
/* syslog (LOG_INFO, "Service_DiallerStatus: %x", r->r[0]); */
else
if (r->r[0] & Dialler_RelinquishAccess)
{
pppd_signal_handler (SIGHUP);
}
......
......@@ -16,6 +16,10 @@
*
* Copyright (c) 1995 Acorn Computers Ltd., Cambridge, England
*
* 1998-03-09: BAL
* Idle timer was mistakenly being incremented twice in hangup check handler.
* Removed reliance on Dialler for hangup check if dialler option is used on
* command line.
*/
#include <stdlib.h>
#include <stdio.h>
......@@ -102,10 +106,7 @@ extern void *module_wsp;
*/
static void release_ticker(void)
{
if ((dialler_flags & DiallerFlags_UsingDialler) == 0)
{
_swix(OS_RemoveTickerEvent, _INR(0,1), hupcheck_entry, module_wsp);
}
_swix(OS_RemoveTickerEvent, _INR(0,1), hupcheck_entry, module_wsp);
_swix(OS_Release, _INR(0,2), TickerV, ticker_handler, module_wsp);
}
......@@ -113,10 +114,7 @@ static void release_ticker(void)
static void release_upcall (void)
{
if ((dialler_flags & DiallerFlags_UsingDialler) == 0)
{
_swix(OS_RemoveTickerEvent, _INR(0,1), hupcheck_entry, module_wsp);
}
_swix(OS_RemoveTickerEvent, _INR(0,1), hupcheck_entry, module_wsp);
_swix(OS_Release, _INR (0, 2), UpCallV, upcall_entry, module_wsp);
}
......@@ -134,11 +132,10 @@ static _kernel_oserror *claim_ticker(void)
{
_kernel_oserror *e = NULL;
if ((dialler_flags & DiallerFlags_UsingDialler) == 0)
e=_swix(OS_CallEvery, _INR(0,2), 99, hupcheck_entry, module_wsp);
if (e)
{
e=_swix(OS_CallEvery, _INR(0,2), 99, hupcheck_entry, module_wsp);
if (e)
return e;
return e;
}
return _swix(OS_Claim, _INR(0,2), TickerV, ticker_handler, module_wsp);
......@@ -152,13 +149,10 @@ static _kernel_oserror *claim_upcall (void)
_kernel_oserror *e = NULL;
if ((dialler_flags & DiallerFlags_UsingDialler) == 0)
e = _swix(OS_CallEvery, _INR(0,2), 99, hupcheck_entry, module_wsp);
if (e)
{
e = _swix(OS_CallEvery, _INR(0,2), 99, hupcheck_entry, module_wsp);
if (e)
{
return e;
}
return e;
}
e = _swix (OS_Claim, _INR (0, 2), UpCallV, upcall_entry, module_wsp);
......@@ -181,35 +175,42 @@ static _kernel_oserror *claim_upcall (void)
/**********************************************************************/
#ifdef BLOCKDRIVERS
_kernel_oserror *hupcheck_handler(_kernel_swi_regs *r, void *pw)
{
NOT_USED (r);
NOT_USED (pw);
if (modem && (driver_modemcontrol() & 8) == 0)
/* Check DCD line */
if (modem && serial_dcd == 0)
{
/* DCD has been dropped */
_swix(OS_AddCallBack, _INR(0,1), hup_entry, module_wsp);
}
else
{
int interrupt_status;
/* atomic update of counter */
/* atomic update and test of counter */
interrupt_status = splhi ();
idle_time++;
if (idle_time_limit && ++idle_time >= idle_time_limit)
if (idle_time_limit > 0 && idle_time >= idle_time_limit)
{
int not_claimed;
restore_irqs (interrupt_status);
/* Issue Servive Call to indicate PPP is about to timeout. If this
* Service Call is claimed then do not timeout.
*/
_swix (OS_ServiceCall, _IN (1) | _OUT (1),
Service_PPPTimingOut, &not_claimed);
if (not_claimed)
{
_swix (OS_AddCallBack, _INR (0,1), term_entry, module_wsp);
}
else
{
/* another atomic counter update */
......@@ -218,73 +219,15 @@ _kernel_oserror *hupcheck_handler(_kernel_swi_regs *r, void *pw)
restore_irqs (interrupt_status);
}
}
else
restore_irqs (interrupt_status);
}
return NULL;
}
#else
_kernel_oserror *hupcheck_handler(_kernel_swi_regs *r, void *pw)
{
ioctl_t ioctl;
NOT_USED (r);
NOT_USED (pw);
ioctl.reason = IOCtl_control_lines;
ioctl.group = 0;
ioctl.reserved = 0;
ioctl.read = 1;
ioctl.write = 0;
_swix (OS_Args, _INR (0, 2), OS_Args_IOCtl, serial_in, &ioctl);
if (modem && (ioctl.data & IOCtl_control_line_DCD) == 0)
_swix(OS_AddCallBack, _INR (0, 1), hup_entry, module_wsp);
else
{
int interrupt_status;
/* atomic update of counter */
interrupt_status = splhi ();
idle_time++;
if (idle_time_limit && ++idle_time >= idle_time_limit)
{
int not_claimed;
restore_irqs (interrupt_status);
_swix (OS_ServiceCall, _IN (1) | _OUT (1),
Service_PPPTimingOut, &not_claimed);
if (not_claimed)
_swix (OS_AddCallBack, _INR (0,1), term_entry, module_wsp);
else
{
/* another atomic counter update */
interrupt_status = splhi ();
idle_time = 0;
restore_irqs (interrupt_status);
}
}
else
restore_irqs (interrupt_status);
}
return NULL;
}
#endif
/**********************************************************************/
_kernel_oserror *hup_handler(_kernel_swi_regs *r, void *pw)
......@@ -625,9 +568,22 @@ _kernel_oserror *serial_finalise(void)
}
#endif
if ((dialler_flags & DiallerFlags_UsingDialler))
if (dialler_flags & DiallerFlags_UsingDialler)
{
_swix (Dialler_Arbitrate, _IN (0), Dialler_Arbitrate_RelinquishAccess);
if (dialler_flags & DiallerFlags_DiallerB)
{
_swix (DiallerB_Arbitrate,
_IN (0),
Dialler_Arbitrate_RelinquishAccess);
}
else
{
_swix (Dialler_Arbitrate,
_IN (0),
Dialler_Arbitrate_RelinquishAccess);
}
}
return(NULL);
......@@ -656,8 +612,24 @@ _kernel_oserror *serial_initialise(struct ppp_softc *sc)
int io_access_granted;
e = _swix (Dialler_Arbitrate, _IN (0) | _OUT (0),
Dialler_Arbitrate_RequestIOAccess, &io_access_granted);
if (dialler_flags & DiallerFlags_DiallerB)
{
e = _swix (DiallerB_Arbitrate,
_IN (0) | _OUT (0),
Dialler_Arbitrate_RequestIOAccess,
&io_access_granted);
}
else
{
e = _swix (Dialler_Arbitrate,
_IN (0) | _OUT (0),
Dialler_Arbitrate_RequestIOAccess,
&io_access_granted);
}
if (e)
return (e);
......@@ -706,9 +678,28 @@ _kernel_oserror *serial_initialise(struct ppp_softc *sc)
/* Get the serial file handles from the dialler */
e = _swix (Dialler_Arbitrate, _IN (0) | _OUTR (0, 2),
Dialler_Arbitrate_RequestIOAccess,
&io_access_granted, &serial_in, &serial_out);
if (dialler_flags & DiallerFlags_DiallerB)
{
e = _swix (DiallerB_Arbitrate,
_IN (0) | _OUTR (0, 2),
Dialler_Arbitrate_RequestIOAccess,
&io_access_granted,
&serial_in,
&serial_out);
}
else
{
e = _swix (Dialler_Arbitrate,
_IN (0) | _OUTR (0, 2),
Dialler_Arbitrate_RequestIOAccess,
&io_access_granted,
&serial_in,
&serial_out);
}
if (e)
return (e);
......@@ -833,6 +824,54 @@ int upcall_handler (_kernel_swi_regs *r, void *pw)
#endif
/* -----------------------------------------------------------------------------
+
serial_dcd
Get the status of the DCD line.
Returns
0: DCD not asserted (ie. no carrier)
1: DCD asserted
-
*/
#ifdef BLOCKDRIVERS
extern serial_dcd (void)
{
if ((driver_modemcontrol() & 8) == 0)
{
return 0;
}
return 1;
}
#else
extern serial_dcd (void)
{
ioctl_t ioctl;
ioctl.reason = IOCtl_control_lines;
ioctl.group = 0;
ioctl.reserved = 0;
ioctl.read = 1;
ioctl.write = 0;
_swix (OS_Args, _INR (0, 2), OS_Args_IOCtl, serial_in, &ioctl);
if ((ioctl.data & IOCtl_control_line_DCD) == 0)
{
return 0;
}
return 1;
}
#endif
/**********************************************************************/
/* EOF serial.c */
......@@ -46,8 +46,9 @@
*
*/
char *ack_sl="Copyright (c) 1989 The Regents of the University of California. "
"All rights reserved.";
static char *ack_sl =
"Copyright (c) 1989 The Regents of the University of California. "
"All rights reserved.";
#include <assert.h>
#include <string.h>
......@@ -307,19 +308,22 @@ u_char sl_compress_tcp(struct mbuf *m, register struct ip *ip,
* with it. */
goto uncompressed;
if (deltaS = (u_short)(ntohs(th->th_win) - ntohs(oth->th_win))) {
deltaS = (u_short)(ntohs(th->th_win) - ntohs(oth->th_win));
if (deltaS) {
ENCODE(deltaS);
changes |= NEW_W;
}
if (deltaA = ntohl(th->th_ack) - ntohl(oth->th_ack)) {
deltaA = ntohl(th->th_ack) - ntohl(oth->th_ack);
if (deltaA) {
if (deltaA > 0xffff)
goto uncompressed;
ENCODE(deltaA);
changes |= NEW_A;
}
if (deltaS = ntohl(th->th_seq) - ntohl(oth->th_seq)) {
deltaS = ntohl(th->th_seq) - ntohl(oth->th_seq);
if (deltaS) {
if (deltaS > 0xffff)
goto uncompressed;
ENCODE(deltaS);
......
......@@ -12,33 +12,32 @@
; See the License for the specific language governing permissions and
; limitations under the License.
;
;// -*-Text-*-
;//
;// PPPHdr - cmhg header file for PPP module
;//
;// Copyright (c) 1995 Acorn Computers Ltd., Cambridge, England
;//
// PPPHdr - cmhg header file for PPP module
//
// Copyright (c) 1995 Acorn Computers Ltd., Cambridge, England
//
;// This must be built with CMHG 5.14 or later
// This must be built with CMHG 5.14 or later
title-string: PPP
#ifdef BLOCKDRIVERS
help-string: PPP 1.18 block driver serial interface
help-string: PPP 1.19 block driver serial interface
#else
help-string: PPP 1.18 DeviceFS serial interface
help-string: PPP 1.19 DeviceFS serial interface
#endif
initialisation-code: ppp_initialise
finalisation-code: ppp_quit
service-call-handler: ppp_sc_handler &9B, ; Service_EnumerateNetworkDrivers
&9F, ; Service_DCIProtocolStatus
&A2, ; Service_MbufManagerStatus
&B4 ; Service_DiallerService
service-call-handler: ppp_sc_handler &9B, // Service_EnumerateNetworkDrivers
&9F, // Service_DCIProtocolStatus
&A2, // Service_MbufManagerStatus
&B4, // Service_DiallerStatus
&C4 // Service_DiallerBStatus
generic-veneers: poll_entry/poll_handler,
callb_entry/callb_handler,
......@@ -47,7 +46,7 @@ generic-veneers: poll_entry/poll_handler,
hup_entry/hup_handler,
term_entry/term_handler,
hupcheck_entry/hupcheck_handler
#ifndef BLOCKDRIVERS
vector-handlers: upcall_entry/upcall_handler
#endif
......@@ -62,13 +61,13 @@ swi-decoding-table: PPP,
7 8 9 10 11 12 13 14 15,
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31,
AlterSettings Status
;//
;// YUCK - need to mess around with internationalised help, but cannot
;// use the automatic features added as part of RISC OS 3.5; cmhg's
;// handling of this used to be broken - this *must* be build with cmhg
;// version 4.55 or later.
;//
//
// YUCK - need to mess around with internationalised help, but cannot
// use the automatic features added as part of RISC OS 3.5; cmhg's
// handling of this used to be broken - this *must* be build with cmhg
// version 4.55 or later.
//
command-keyword-table: ppp_cli_handler
PPPInfo(min-args:0, max-args:0, help:,
invalid-syntax: "Syntax: *PPPInfo"),
......
Two different variants of PPP can be built: one to work with
blockdrivers and one to work with the new-style DeviceFS interface. For
ROM builds (under the new !Builder system) the build can be selected by
passing down options to PPP from the components file.
For the blockdriver version the entry in the components file should be:
PPP -options ASMBLOCKDRIVERS=TRUE CBLOCKDRIVERS=-DBLOCKDRIVERS
For the DeviceFS version the entry in the components file should be:
PPP -options ASMBLOCKDRIVERS=FALSE
/* Copyright 1997 Acorn Computers Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* File: dialler.h
* Purpose: Interface to Dialler SWIs, status codes etc.
* Author: B Laughton
* History: 07-Feb-97: BAL: created
* 25-Feb-97: BAL: added reason code masks courtesy of AH
* added R0 bit mask for entry to SWI Dialler_Status
*/
#ifndef dialler_h
#define dialler_h
/* =============================================================================
* Include header files
*/
/* CLib */
#include "kernel.h"
/* =============================================================================
* Define contants
*/
#ifndef Dialler_Dial
#define Dialler_Dial 0x04c6c0
#define Dialler_HangUp 0x04c6c1
#define Dialler_Status 0x04c6c2
#define Dialler_Answering 0x04c6c3
#define Dialler_Configure 0x04c6c4
#define Dialler_Register 0x04c6c5
#define Dialler_Arbitrate 0x04c6c6
#define Dialler_Timeout 0x04c6c7
#define Dialler_ResetCounter 0x04c6c8
#endif
/* Bit masks for r0 flags word on entry to SWI Dialler_Status */
#define Dialler_Status_ConnectTime 0x1
/* SWI Dialler_Arbitrate entry and exit values */
#define Dialler_Arbitrate_RequestIOAccess 0
#define Dialler_Arbitrate_RelinquishAccess 1
#define Dialler_IOAccessGranted_BlockDrivers 0
#define Dialler_IOAccessGranted_DualSerial 1
#define Dialler_IOAccessDenied_ActiveClient 64
#define Dialler_IOAccessDenied_NotConnected 65
#define Service_DiallerStatus 0xb4
/* Reason code masks */
#define Dialler_MajorReasonCodeMask 0xffff0000
#define Dialler_MinorReasonCodeMask 0x0000ff00
#define Dialler_GeneralInfoMask 0x000000ff
/* Major reason code (top two bytes of status word) */
#define Dialler_StateChanged 0x00010000
#define Dialler_LineDropped 0x00020000
/* Minor reason code (2nd byte of status word) */
#define Dialler_ConnectedFlagsMask 0x00000300
#define Dialler_Disconnected 0x00000000
#define Dialler_Connected 0x00000200
#define Dialler_ConnectedOutgoing 0x00000200
#define Dialler_ConnectedIncoming 0x00000300
#define Dialler_RelinquishAccess 0x00000400
#define Dialler_DiallerDroppedLine 0x00000000
#define Dialler_RemoteDroppedLine 0x00000800
/* General info (1st byte of status word) */
enum
{
Dialler_ExecutingScript_Dial = 1,
Dialler_ExecutingScript_Hangup,
Dialler_ExecutingScript_Answer,
Dialler_AbortedScript_Syntax,
Dialler_AbortedScript_Timeout,
Dialler_AbortedScript_NoCarrier,
Dialler_AbortedScript_Error,
Dialler_AbortedScript_NoDialtone,
Dialler_AbortedScript_Busy,
Dialler_AbortedScript_NoAnswer
};
#endif
......@@ -25,9 +25,11 @@
*/
#define check_errlevel(x) ((x) == ERRLVL_NO_ERRORS)
#if 0
#ifndef MAX
#define MAX(a,b) (((a)>(b))?(a):(b))
#endif
#endif
extern _kernel_oserror *pppd_main(int argc, char *argv[]);
......
......@@ -27,9 +27,9 @@
#define Module_Title "PPP"
#define Module_Help "PPP"
#define Module_VersionString "1.17"
#define Module_VersionNumber 117
#define Module_Date "30 Jul 1997"
#define Module_VersionString "1.19"
#define Module_VersionNumber 119
#define Module_Date "09 Mar 1998"
/*
......@@ -218,4 +218,41 @@ _kernel_oserror *timeout_handler(_kernel_swi_regs *r, void *pw);
_kernel_oserror *callb_handler(_kernel_swi_regs *r, void *pw);
_kernel_oserror *poll_handler(_kernel_swi_regs *r, void *pw);
/*
* Vector handlers
* ===============
*
* This is the name of the vector handler entry veneer
* compiled by CMHG. Use this name as an argument to SWI
* OS_Claim. (EventV claimants should use a CMHG event handler).
*
* Note that vector handlers were previously called IRQ handlers
* and were documented as being for attaching to IrqV. IrqV has
* long being deprecated; you should use OS_ClaimDeviceVector and
* a CMHG generic veneer instead.
*/
extern void upcall_entry(void);
/*
* This is the handler function you must write to handle the
* vector for which upcall_entry is the veneer function.
*
* If a handler function is installed onto a vector, then:
* Return 0 to intercept the call.
* Return 1 to pass on the call.
* If you use a vector handler veneer for any other purpose, always
* return non-0, and consider the use of a generic veneer instead.
* It is not currently possible to return an error from a vector
* handler.
*
* 'r' points to a vector of words containing the values of R0-R9 on
* entry to the veneer. If r is updated, the updated values will be
* loaded into R0-R9 on return from the handler.
*
* pw is the private word pointer ('R12') value with which the
* vector entry veneer is called.
*/
int upcall_handler(_kernel_swi_regs *r, void *pw);
#endif
......@@ -23,6 +23,8 @@ extern _kernel_oserror *event_handler(_kernel_swi_regs *ignore, void *pw);
extern _kernel_oserror *hup_handler(_kernel_swi_regs *ignore, void *pw);
extern _kernel_oserror *hupcheck_handler(_kernel_swi_regs *ignore, void *pw);
extern int serial_dcd (void);
extern int poll_pending;
extern volatile u_char *ring_start, *ring_limit;
......
......@@ -12,31 +12,137 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
CC= CC
LD= Link
LIB= libfile
AS= objasm
# Makefile for pppd
#
# ***********************************
# *** C h a n g e L i s t ***
# ***********************************
# Date Name Description
# ---- ---- -----------
# 1998-01-19 BAL Created
#
#
# Generic options:
#
MKDIR = cdir
AS = objasm
CC = cc
CMHG = cmhg
CP = copy
LD = <boot$dir>.library.link
RM = remove
MODSQZ = modsqz
WIPE = -wipe
ASMFLAGS = -depend !Depend ${THROWBACK}
CFLAGS = -depend !Depend ${THROWBACK} ${INCLUDES} ${CBLOCKDRIVERS} -strict -Wp -ffah
CPFLAGS = ~cfr~v
LDFLAGS = -aof
WFLAGS = ~c~v
DFLAGS_COMMON = -DCOMPAT_INET4 -DDEBUGMAIN -DDEBUGCHAP -DNO_DRAND48 -DVJC
DFLAGS = ${DFLAGS_COMMON} -DNDEBUG
DDFLAGS = ${DFLAGS_COMMON} -DDEBUG -DEBUGALL -DDEBUG_TML -DTrace_TRACE
#
# Include files
#
INCLUDES = -ITCPIPLibs:,C:
#
# Program specific options:
#
TARGET = o.pppd
DEBUGTARGET = od.pppd
OBJS =\
o.auth\
o.chap\
o.dea_crypt\
o.dea_data\
o.fsm\
o.ipcp\
o.lcp\
o.magic\
o.main\
o.md5\
o.minixlib\
o.options\
o.sys-riscos\
o.upap\
# To compile a version of PPP which uses the blockdrivers uncomment the next
# line
OBJSD =\
od.auth\
od.chap\
od.dea_crypt\
od.dea_data\
od.fsm\
od.ipcp\
od.lcp\
od.magic\
od.main\
od.md5\
od.minixlib\
od.options\
od.sys-riscos\
od.upap\
BLOCKDRIVERS= -DBLOCKDRIVERS
CCFLAGS= -Wp -depend !Depend -c -ITCPIPLibs:,C: -throwback -ffah\
-DDEBUGMAIN -DDEBUGCHAP -DNO_DRAND48 -DCOMPAT_INET4\
-DVJC -zM -zps1 ${BLOCKDRIVERS} # -DDEBUG -DDEBUGALL
LDFLAGS= -aof -o $@
OBJS= o.main o.magic o.fsm o.lcp o.ipcp o.upap o.chap \
o.auth o.options o.md5 o.sys-riscos o.minixlib \
o.dea_crypt o.dea_data
OBJSCP =\
cp.auth\
cp.chap\
cp.dea_crypt\
cp.fsm\
cp.ipcp\
cp.lcp\
cp.magic\
cp.main\
cp.md5\
cp.minixlib\
cp.options\
cp.sys-riscos\
cp.upap\
.SUFFIXES: .o .c
.c.o:; $(cc) $(ccflags) -o $@ $<
o.pppd: $(OBJS)
$(LD) $(LDFLAGS) $(OBJS)
#
# Rule patterns
#
.SUFFIXES: .o .od .cp .c .s
.c.o:; ${CC} ${CFLAGS} ${DFLAGS} -c -zM -zps1 -o $@ $<
.c.od:; ${CC} ${CFLAGS} ${DDFLAGS} -c -zM -zps1 -fn -o $@ $<
.c.cp:; ${CC} ${CFLAGS} ${DFLAGS} -c -C -E $< >> $@
.s.o:; $(AS) ${ASMFLAGS} -o $@ $<
.s.od:; $(AS) ${ASMFLAGS} -o $@ $<
#
# Main rules:
#
ram: ${TARGET}
rom: ${TARGET}
debug: ${DEBUGTARGET}
analyse: ${OBJSCP}
clean:
${WIPE} o.* ${WFLAGS}
${WIPE} od.* ${WFLAGS}
${WIPE} cp.* ${WFLAGS}
#
# Target
#
${TARGET}: ${OBJS}
${LD} ${LDFLAGS} -o $@ ${OBJS}
#
# Debug target
#
${DEBUGTARGET}: ${OBJSD}
${LD} ${LDFLAGS} -o $@ ${OBJSD}
o.dea_data: s.dea_data
$(AS) s.dea_data o.dea_data
# Dynamic dependencies:
......@@ -32,8 +32,9 @@
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
char *ack_auth="Copyright (c) 1993 The Australian National University. "
"All rights reserved.";
static char *ack_auth =
"Copyright (c) 1993 The Australian National University. "
"All rights reserved.";
#include <stdio.h>
#include <stddef.h>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment