Rochester Institute of Technology
RIT Scholar Works
Theses
Thesis/Dissertation Collections
11-11-1987
Design and implementation of a local area network
utilizing Intel 310/80286 systems
James Leach
Follow this and additional works at:
http://scholarworks.rit.edu/theses
Recommended Citation
Abstract
Thegoal ofthis work wasto provide the foundation for a course in networking
by
developing
the hardware and software for a token ring Local Area Network (LAN). Anycourse work in networking would focus on the emerging International Standards
Organization (ISO) Open Systems Interconnections (OSI) model. This model provides a seven
layered structure, where each layer performs some logical aspect of the communication
process. Thus,thesoftware developed wouldhave toprovidethe
functionality
of a multiplelayereddesign,
implying
multipletaskscommunicatingby
operatingsystem primitives. Also,asimplified designwould minimize thetime forthose studentstrying toassimilate the basic
work priortoembarkingonthedesign oftheirown work.
Within an Intel 310system running the iRMX operating system, the LAN hardware
and software were developed. The package allows reliable transfer of files to the other
nodeson atoken ring LAN viaaccess
by
user programs to lower layers. In addition, the userhas a reasonable interface to interact with the file system of the home node. Once the
physical configuration of the LAN is established, the software is self-initializing and
self-monitoring for pathological cases. The software runs as an application task on each node,
TABLE OF
CONTENTS
Abstract
Table ofContents
ListofTables
ListofFigures
n vi vii 1.0 Introduction 1.1 Goals 1.2 Constraints 1 1 2
2.0 Development Environment
2.1 Intel 310 System
2.1.1 8086/80286 Differences 2.1.2 8086 Alternations . 2.1.3 116Board
2.2 DevelopmentSoftware
2.2.1 iRMXV6.0
2.2.1.1 Interrupts
2.2.1.2 System Configuration Files .
2.2.1.3 System Calls
2.2.1.3.1 iRUGCiRMX interface
2.2.1.3.2 LAN System Calls 2.2.2 Languages
2.2.2.1 Intel CCompilerCC86 2.2.2.2 Intel Assembler ASM86 2.2.2.3 iRMXC/AssemblerInterface 2.2.3 Utilities 2.2.3.1 Linker 2.2.3.2 Kermit 4 4 6 9 9 11 11 11 14 14 15 16 18 18 19 21 21 21 21
3.0 iRMX Bugaboos 3.1 Hardware
3.3 File I/O
3.4 Misc
24
24
4.0 The Network Model
4.1 ISO OSI Model
4.2 Layers
25
25
29
5.0 LAN Software
5.1 Overview
5.1.1 Task
Blocking
Mechanisms5.1.2 InterTask Communication
5.1.3 Software Organization
5.1.3.1 Files/Routines
5.1.3.2 Global Variables
5.2 Human Interface Layer Code
5.2.1
Functionality
5.2.2
Debugging
Capabilities.5.3 Transport Layer Code
5.4 Data Link Layer .
5.4.1 Overview
5.4.1.1 data packet
5.4.1.2 free token packet
5.4.1.3 resetpacket
5.4.2 Task State Diagram.
5.4.2.1 SenderState
5.4.2.2 SintState
5.4.2.3 RintState . .
5.4.3 Task State Diagram Interaction
5.4.3.1
Sending
A File .5.4.3.2
Receiving
A File5.4.3.3
Repeating
A File ....5.4.4 Software Task Communication Vs Task States
5.4.5
NodeState,
LAN Initialization And ErrorRecovery
5.4.6 Data Link LayerCode
5.4.6.1 Overview
5.4.6.2
Key
Decisions ...5.4.6.2.1 Packet
Handling
andRouting
5.4.6.2.2 Data
Integrity
5.4.6.2.3 LAN
Resetting
72
75
75
77
77
79
79
6.0 LAN Hardware ... .81
6.1 LAN
Topology
... 816.2 Node Environment .81
6.2.1 80286/10 Single Board Computer 81
6.2.2 116 Board 85
6.2.2.1 Programmable Peripheral Interface
(8255)
886.2.2.2 Resistor Packs 92
6.2.2.3 Interrupt Mask ... 93
6.2.3 Multibus I ... 93
6.3 IntraNode Hardware 93
. 6.3/1
Cabling
936.3.2 Patch Panel 95
6.4 Software Configuration Of Hardware 98
7.0
Debugging
Techniques7 1 Hardware/Software
Debugging
7.2 Low Level Software
Debugging
7.3 Application Software
Debugging
102
102
103
104
8.0 Conclusions 105
Appendix A
Bibliography
References
Technical Manuals
Intel iRMX Manuals
Appendix D Link and Compile Examples
Appendix E Kermit
Appendix F Source Code
Rint.c
Sint.c
Sender.c
Trans.c
Hi.c
Control.c
Dlutils.c
Cutils.c
Tutils.c
Common.h
LIST
OF TABLES
Table Description
2.1.2 Intel 310 8086/80286 Attribute Comparison
2.1.3 Intel 310 80286 I/O Port Addresses
2.1.4 Intel 310 8086 I/O Port Addresses
2.2.1 8086 Interrupt Level Utilization . .
2.2.2 80286 Interrupt Level Utilization . .
2.2.3 LAN Interrupt Utilization .
2.2.4 Cto iRMX System Call Link Libraries
2.2.5 PL/M and CData Types
2.2.6 LAN Software iRMX System Calls Used
4.1.1 OSI Model Layer
Functionality
4.2.1 LAN Layer
Functionality
5.1.1 Software TaskSource Code Files
5.1.2
Utility
Routine Source Code Files5.1.3 Global Variables ....
5.2.1 User Commands
5.2.2
Debugging
Commands ....5.4.1 Rint Task States ...
5.4.2 Rint Task ProcHDR Routine Decisions
6.2.1 8255 Port Addresses ....
6.2.2 1 16 Board Jumpers Removed ....
6.2.3 116 Board Jumpers Added
6.2.4 LAN
Topology
Via Patch Panel . . .7.1.1 PSCOPE Command Effects On Waveforms
LIST
OF FIGURES
Figure Description Page
2.0 2.1 2.2 4.1 4.2 5.1.1 5.1.2 5.1.3 5.4.1 5.4.2 5.4.3 5.4.4 5.4.5 5.4.6 5.4.7 5.4.8 5.4.9 5.4.10 5.4.10a 5.4.11 5.4.11a 5.4.12 5.4.12a 5.4.13 5.4.14 6.0 6.1 6.2
Development Environment .
8086 ProcessorBoard Standard Configuration
C
Masking
TechniquesThe Seven LayerOSI Model
The LAN Model . .
Software Structure
Task
Blocking
MechanismsTask Communication .
Data Packet Format
FreeToken Format
Reset Token Format
SenderState Diagram
SintState Diagram
RintState Diagram
File Send
File
Receiving
Task StatesRepeat Packet
Send Files
File Send Task States
File Receive
File
Receiving
Task StatesPacket Repeat
Repeat Packet Task States
NodeState Diagram ...
Code Task State ...
LAN
Topology
. ....The LAN/310 Hardware
Generating
The InterruptConfiguring
The Hardware6.6 8255 Interconnection
Showing
Patch Panel ... 946.6a Patch Panel Partial Schematic 97
6.7 8255 Control Word To Configure LAN
Software
996.8 8255 Set Command To Enable INTRb 100
1.0 Introduction
Establishing a Local Area Network (LAN) involves
integrating
several differentpiecesofhardwareand software. The LAN ismadeupofseveral computers,ornodes, linked
by
a communications medium of some sort. Each node consists of the generic systemhardware, the operating system, and LAN communications software. Information sent
between systems must pass through the system hardware and operating system. Thus, to
produce a LAN, the two pieces provided (the system hardware and operating system) must
be understood prior to creating the other two pieces (the communication medium and
communications software).
This thesis represents work that went along those lines. First, in order to
understand the development environment (the two pieces provided), attempts were made
to passdata through the Intel iRMX operating system and 310 system hardware. Although
iRMX training was available, no support was purchased from Intel. Thus, at times,
understanding the environment became a matter of experimenting until solutions were
found, iftheywere found. The discussion ofthis thesiswork mustthen begin with a look at
some oftheproblems encountered understanding theenvironment. Aswill be shown, these
problemsaffectedthedesignofthetwopieces producedforthisthesiswork.
1.1 Goals
The primary goal of the thesis is to provide a basis for subsequent course work in
data communications. To that end, the design was to be straight forward to provide the
studenta basisupon which to do hisown work. The softwarestructure wasto be based on
the International Standards Organization (ISO) Open System Interconnection (OSI) seven
layermodel,with separate software entitiesperformingeach layers'
file, allowingthe
flexibility
foreach layertoadd orremove its protocolsprior to passing theinformation to the nextlayer. Although thisthesis only implementstwo layers in anydepth
(thephysical and data link layers), thestructure must be provided to
develop
extensive layerprotocols.
To communicate between systems, a physical medium for data transfer must be
developed. After the 310 system peripheral I/O board is selected, some hardware must be
built to connect the separate systems. This intersystem physical connection must be more
thanjustcabling. A feature ofthishardware isthatit allowsan easymethod to reconfigure
theLANtopologywithout
disassembling
the310systems.A personal goal was to utilize Intel's C as the primary language. Intel provides
several compilers (PLVM, C, Fortran, and such), but uses the Intel proprietary language PL/M
to provide programming examples (several of which don't work) in the iRMX manuals
However, it was felt that a greater number of people would be familiar with C. Also, C
provided much more flexible use of pointerswhich were deemed essential for any effective
buffermanagement.
1.2 Constraints
The LAN was to be constrained
by
ComputerEngineering
resources and somedesign requirements. The resources consisted of several 310 systems, peripheral boards and
languages. The peripheralsincluded someintelligent (iSBC544)and dumb(iSBC534)terminal
support boards, and the general purpose iSBC116A I/O boards. The 116 board was
finally
selected sinceitprovided one I/O chip forthe LAN communications,and a second I/O chipto
control satellitehardware. Thus, projectsin distributedsystems could be addressed.
A token ring topology was specified. The 116 I/O board dictated an 8 bit parallel
not a requirement, it was of great interest for the software to support both the 8086 and
80286systems.
During development the vast majority oftime was spent on a small percentage of
the work: simply getting an interrupt. The Intel system 310 iRMX operating system proved
to be such a formidable obstacle that many blind alleys were investigated before
finding
amechanism to solve a single problem. Due to this, a primary requirement (for
self-preservation)wastominimizeoperatingsystem interaction. Thesystemcallswere limited to
asfewiRMXoperatingsystem primitives aspossible.
A similar desire was to utilize the iRMX operating system as configured
by
thefactory. The iRMX operating system is designed to be configurable, with several utilities to
help
the userchangethesystem to suithimself. However, itwasfeltthatwhatlittle use thedocumentationwas would bedilutedwithanychangesto thesystem asdelivered.
Anotherdesire wasto run all LAN softwareas an applicationtask. Although speed
has dictated that more and more network software be migrated to intelligent board
firmware, It wasfelt that the primary goal ofthe software was instruction. To that end, as
much has been left visible to the programmer as is possible. Development of firmware
seemed to be impractical due to the increased equipment needs for items such as prom
programmers,in-circuitemulators,and such. Thispackage runs as a usertask.
The overriding commentisthatiRMX and thehardware,toalarge degree,dictated
the LAN software design. While a top down design is preferred, one must understand the
functionality
of the hardware and system utilities. The design can be based on incorrectassumptions of these utilities. To discover those errors
during
the later stages of codedevelopmentcan leadtolengthyredesigns. Thus,the LANcode developmentshould involve
2.0 Development Environment
This section of the thesis shall describe the development environment used. It is
hoped thatthisskeleton ofinformationand references can providethereader withthe tools
necessaryto
develop
a similarpieceofcode.Figure 2.0 showseveral nodes connected
by
a ring. These nodes are the Intel 310system, each of which supports a general purpose development environment (terminal
support, printers, user interface, compilers, linkers, etc.). Figure 2.0 also shows a VAX and
IBM PC,whichconnecttoany Intel 310viaa kermit link. Kermitallowsfile transfer toeither
theVAX orIBMPC.
Each node consists of anIntel 310, witheither an 8086or80286 CPU. Although this
discussion will focuson the80286 based 310, the8086 version pertinent differencesshall be
noted. The operating system, iRMX shall also be discussed, with a brief description of the
system primitives used inthecode. Lastly,thelanguageand system utilities will be discussed
The discussions herewill provide referencesusing abbreviations in the master index
of the standard set of Intel iRMX documentation. The manuals consist of four volumes
having
several sections(themasterindex is inV4),assummarized in thebibliography.2.1 Intel 310 System
The Intel 310systems consists of a general purpose chassiswithaMultibus I bus. The
buscan support a variety of boards,
including
a processor board, memory, disk controllers,and assorted peripheral boards. Althoughthedevelopmentsystems used includeda general
purpose system (memory, hard disk,
floppy
drive), the discussion will focus onthe processorIntel System 3 10
IntelSystem 310
Intel System 310
ASCII Printer
Intel Svstem310
VAX/VMS Environment IBM PC
legend
KermitRS232
Link
There are two configurations of the 310 systems which have either 8086 or 80286
processor board. The only differences between these two systems that will be noted are
those thatpertainto the LANsoftware.
The 310 iRMX real time operating system is the user development environment.
Theoperatingsystem can be configured andis intended fortheusertomold andincorporate
into a product. Both the system hardware and iRMX software have been relatively
unchanged fromthe
factory
configuration.2.1.1 8086/80286Differences
The two different 310 systems have either 8086 or 80286 processor boards. From
the LAN perspective, the processor boards have some significantdifferences and similarities,
as summarizedintable2.1.2 below.
Attribute 8086 80286
Console Device 8251 8274
standard numberofterminal
ports
1 2
iLBXBus no yes
Programmed Interrupt Controller
8259A 8259A
Table 2.1.2 Intel 310 8086/80286 Attribute Comparison
The differentconsole devices meanscopingwith differentdata port addresses, and
transmit data ready (txrdy) and receive data ready (rxrdy) bit definitions in the status port.
Thenumber of standardterminal portsshall becomesignificantwhen addressing kermit.
the backplane, which is now used
by
the iLBX bus HOWEVER, the 116board places + 12volts on the TTLcircuitry, whichdestroysthe iLBXbus bufferson theCPU board. The iLBX bus
usesthe lowerthree slotsofthe 80286 310system only. Extensive searches have uncovered
nodocumentationonthisfact.
The 80286 systems have two serial ports, both driven
by
the Multi-Protocol SerialController(MPSC),8274. Althoughthesecond portcan be usedtosupport asecond user, the
Department of Computer Engineering 80286 310's have .5 Mbytes of memory. The user
needs .25 Mbytes(if you wantto enter super user mode), and iRMXwants about
.2 Mbytes.
This leaves around 50 Kbytes for the second user, which is not enough to do much of
anything. Thus, the second serial port can not be used for another terminal unless the
memoryisincreased.
The port addresses used
by
the LAN software are summarized for each system inPortAddress
(hex)
device
functionOOCO Master PIC Status port, ICW1
00C2 Master PIC interrupt mask
00D8 Serial I/O
(MPSC)
data
port, channel AOODA Serial I/O
(MPSC)
data port, channel BOODC Serial I/O
(MPSC)
status port, channel AOODE Serial I/O
(MPSC)
statusport, channel BTable 2.1.3 Intel 310 80286 I/O Port Addresses
Port Address
(hex)
device functionOOCO Master PIC Status port, ICW1
00C2 MasterPIC interrupt mask
00D8 Serial I/O
(8251)
data portOODA Serial I/O
(8251)
status port2.1.2 8086 Alterations
In thediscussion oninterrupts itshall be noted that the8086systems utilize master
interrupt level 4 with the printer. Unfortunately, this interrupt level was also used
by
theLAN software. The8086 processor board
factory jumpering
(see figure2.1) must be alteredto accommodate the LAN software. The alterations are remove 132/157 and add 157/162
Much ofthedetail ofthis
drawing
will be more evident afterthe hardwaresection hasbeenreviewed. The detail of figure 2.1 has been included because no drawings of the 8086
processor boards are available in the Department of Computer Engineering. This
drawing
wasgenerated
by
hand fromtheboard itselfToallow the 8086310's to be used for boththe LAN and printing, a manual switch
could be incorporated inthechassis.
2.1.3 116 Board
The Multibus I peripheral board selected for the communications was the iSBC
108A/116A combination memory and I/O expansion board. Most of the board
functionality
(16Kbytes RAM, 32Kbytes ROM, 16Kbytes PROM and serial I/O port) will not be addressed.
Instead,the focuswill be on the LAN specific portionsofthe board, the 48 parallel I/O lines
controlled
by
two Intel 8255A Programmable Peripheral Interface (PPI) devices. The 310systems will communicate via a single 8255 PPI. Some hardware shall be developed to
NTO 41
NT1 42
INT2
INT3
IIMT4
INT5
IIMT6
INT7 39
40
37
38
35
36
Multibus
250
-e-132
-Q
63 60
8279A
(PIC)
Figure 2.1 8086 Processor Board Standard Configuration
Parallel
Printer
Port
7438
(U19)
o 18
51 9 8
2.2 Development Software
2.2.1 iRMXV6.0
This section will not attempt to explain iRMX, but instead focus on the many
undocumented factsneeded to
develop
the LAN code. The information will focusprimarilyon interrupts, and the C /
Assembly
Language interface to those interrupts. Additionaltopics,suchasthesystemcalls, languagesand utilities shall alsobeaddressed.
Intel providesa wealth of documentation on both the iRMX operating system and
the 310 systems. Unfortunately, there was little or nothing on how to bind the interrupt
software withthehardware. The approached usedwasto look attheschematics and tryand
second guess howthingsworked. Tocomplicatematters, mostexamples are in PL/M, which
uses special utilityroutines not available in C. The results ofthis trial and error procedure is
summarizedhere.
2.2.1.1 Interrupts
The Intel documentationon interruptsseems pretty good. The examplesin nucleus
manual (NU) are all in PL/M, where an interrupt handler routine is identified
by
anINTERRUPT inthe proceduredefinition. Notethat the INTERRUPT tellsthe PL/M compiler to
generate a
jump
toassembly languageroutines atthebeginning
and end oftheactual code.These assembly language routinessave and restorethe processor state. InC,thiswill have to
bedone
by
hand.Thesingle board computershavetwo PICsthatcan betiered with masterand slave
interrupt controllers, but the system comes configured from the
factory
with a single PICinstalled. Thus,all referencestoslave interruptscanbe ignored.
unused interrupt levels must be located Tables 2 2 1 and 2.2.2 show the interrupt level
usageforthe8086and80286 310systems, respectively
Since the 544 boards were not used for the LAN, interrupt level 3 was used.
Interrupt level 4 was taken arbitrarily. Since all early development wasdone on the 80286
310 systems, itwas only discovered much later that the 8086 310 printer usage of interrupt
level 4conflictedwiththe LAN software. The fix forthe printer portisnoted insection 2. 1 2,
anddisplayed in figure2.1.
8259A
pin
interrupt level
(encoded)
hex
description
IRO 8 NPX
IR1 18 system debugger
IR2 28 system clock
(8253
timer0)
IR3 38 544communications controller
IR4 48 on board line printer
IR5 58 21 5G Winchester
hard drive
controller
IR6 68 system consol USART receiver
(RxReady)
IR7 78 system consol USARTtransmit
(TxReady)
8259A pin
interrupt level
(encoded)
hex
description
IRO 8 counter Oof the 8254 PIT
IR1 18 interrupt button on the
front
panelIR2 28 unused
IR3 38 544 communications controller
IR4 48 unused
IR5 58 21 5GWinchester
hard drive
controller
IR6 68 310 serial channel A and B
IR7 78 interruptfromslave PIC
Table 2.2.2 80286 Interrupt Level Utilization
It is
interesting
to describe the interrupt vectors this can be found in any 286hardware reference manual. There are 256 possible interrupt vectors, each
having
a fourbyte address. The vectors reside in memory locations 0 to 03FF hex. In table 8-4 (nucleus
manual NU 8-19) note that master interrupts 3 and 4 correspond to the decimal interrupt
table entries 59 and 60, respectively Thus, to locate the hard addresses for master level 4,
compute4*
60-1, or239. This information issummarized intable2 2.3.
master
interrupt level
encoded
interrupt level
interrupt
vector
table
address
(dec)
address
(hex)
sender 3 38H 59 235 EC
2.2.1.2 System Configuration Files
To understand a problem with task creation, the iRMX priority system must be
addressed. Atask can only create another task with a priority the same or higherthan the
original task. However,a Cmain task iscreated
by
thesystem with a defaultpriority. Itwillbe noted that in the project's code, this original main task is the lowest priority human
interface task. However, the main task mustspawn other tasks that cannot be of a lower
priority, and yet must be. Also, there may be a desire tocreate a task to preempt even the
interrupttasks(suchas atimer task). Toaddressthis problem,and toprovide a mechanismto
circumvent the iRMX priority system, a patch to the operating system was added. By
manipulating certain iRMX system configuration files, task priorities can be quite flexible.
SeeappendixCforthedetails.
It should be noted that this patch allows the user to create tasks which will run
beforethe iRMXsystem utilities. Unpredictableresults can occur when thisis done.
2.2.1.3 System Calls
The iRMXdocumentation provides ample system call descriptions,which thissection
will introduce. Of added interest isthe fact that C does not support the iRMX system call
interface, which shall be provided
by
some additional utilities. These utilities were providedby
iRUG (iRMX UserGroup),and will bediscussedfirst.As mentioned earlier, iRMX isa layered and configurable operating system. What
that means isthat there isa kernel, or nucleus as iRMX calls it. The layers are built on the
nucleus,likeconcentric circles aroundthenucleus. Theupperlayers depend uponsome or all
ofthe layersbelow. Thedocumentation for iRMX is built aroundthose layers, withseparate
sections on the nucleus, basic I/O system (BIOS), extended I/O system
(EIOS),
applicationIn order to utilize any system call from a particular layer, a
library
file must belinkedwiththe Cobjectroutine. Thesefilesaresummarized intable2.2.4,below.
layername iRMX
library
Clibrary
nucleus rcifl.lib rpifUib
BIOS icifl.lib ipifl lib
EIOS ecifl.lib epifl.lib
human interface hcifl.lib hpifl.lib
application loader Icifl.lib Ipifl. lib
Table 2.2.4 C Libraries To Access iRMX System Calls
2.2.1.3.1 iRUG C iRMXInterface
Standard iRMX does not provide a system call interface for C. The interface
provided
by
iRUG is arranged similarly to the standard iRMX file for any layer, as shown intable2.2.4. To usea particularlayer'ssystemcall, theappropriate
library
mustbe linked withtheusercode, ForaCroutine, boththe iRMXand C
library
files mustbelinked.The standard iRMX documentation can be used to understand system calls from C.
However,all examples and argumentinformationare provided from thePL/M pointof view.
By
understanding the corresponding C and PL/M data types (see table 2.2.5, below), thisdocumentation becomesquite readable. The information discussion ofthe system callswill
PL/M Data Type C Data Type
token unsigned int
pointer char *
word unsigned int
byte
charstring
stringTable 2.2.5 PL/M and C Data Types
2.2.1.3.2 LANSystemCalls
The LAN software uses a subset of the available iRMX system calls.The iRMX
documentation can be referenced for a detailed discussion of how each system call works.
This section summarizes the calls used in table 2.2 6 All calls are in the nucleus with the
category iRMX call
tasks rq$create$task
rq$get$task$tokens
rq$delete$job
task priority rq$get$priority
rq$set$priority
interrupts rq$set$interrupt rq$signal$interrupt rq$exit$interrupt rq$wait$interrupt rq$enable
time rq$sleep
mailboxes rq$create$mailbox rq$send$message rq$receive$message
exceptions rq$set$exception$handler rq$get$exception$handler
file I/O rq$s$create$file rq$s$attach$file rq$delete$connection
rq$s$open
rq$s$close
rq$s$read$move rq$s$write$move
2.2.2 Languages
Intel C and 8086 assembly language were used to
develop
the LAN code. Theassembly languagewas straightforward, but this C compiler is nottotally standard. What is
of more interest is the interfaces between C, ASM86 and iRMX. Since the LAN code is
primarily C,getting the iRMXsystem callsfor interrupts proved to be a lotoftrial and error.
Also, the C calling conventions must be understood to make calls to assembly language
routines.
Other than low level I/O, two assembly language routines are necessary. A C
interrupt handler is not possible because the processor state can not be saved with C
statements. Thus,the interrupt actuallyvectorstoassembly language routineswhich simply
savetheprocessorstate, call a Croutinetodothework, and then restoretheprocessor state.
2.2.2.1 IntelCCompiler CC86
Although reasonably good, be forewarned that this version of C has some
"wrinkles"
thatcan causedifficulties. The onefound isshown in figure2.2. NotethatAwill
A) if((MASK&data1) = = data2)
do something
B) temp = MASKSdata
if
(temp
= = data2)do something
figure2.2 C
Masking
TechniquesThe C compiler appends an underscore to each C symbol mentioned in the code.
Thus, thevariabledatawill be thesymbol tableas data All interaction betweenassembly
languageand C routines must
keep
thisstraight. A C routine called interrupt$handler mustbe called from assembly code as interrupt$handler This becomes necessary when the
assemblylanguageinterruptroutines calltheCroutinethatdoes thework.
The C compiler manual (iC-86 Compiler User's Guide, order number 122085-002,
1984) outlinestherequirementstogenerate objectcodefor linking. An exampleof a submit
filetocompileCsourceisshown inappendix C.
2.2.2.2 Intel ASM86AssemblyLanguage
The 8086assemblerwas used. Perhapsworth commentingon isthe fact that theC
and assemblylanguage routines mustbe madeknowntoeach other. The assembly language
requires an externto import C routine addresses, and a public toexport assembly language
routine addresses. From the file autils.a86, the
following
assembly language code is takenname proc name
extern rcvrinthandler :far
public rcvrinthandler ;
rcvrinthandler proc far
. . . saveprocessor state . .
call rcvrinthandler
. . restore processorstate . . .
iret
rcvrinthandler endp
The
following
Ccode interacts with the assembly language routine. Note that therq$enter$interrupt call placesthe address ofthe actual assembly language interrupt routine
intotheinterrupt vector.
main()
{
extern rcvr$int$handler ;
. . . initialize. . .
rq$set$interrupt(,,rcvr$int$handler ,,);
forever
loop
}
rcvr$int$handler()
{
. . perform I/O. . .
}
NotethattheCcompilerplaces a single underscore after all symbol names. Thus,
assembly language symbols must have the underscored there since the assembler does not
place underscores on assembly language symbols. For example, the assembly language
symbol rcvrinthandler pertains to the C rcvr$int$handler, which is a C routine. The
assembly language symbol rcvrinthandler (two underscores) is the procedure
rcvr$int$handler whichCusesinthe externstatement,and therq$set$interrupt call. The C
2.2.3.3 Assembler/iRMX Interface
The example inthe abovesection also points out howto bind the hard interrupt to
C routine via the assembly language routine. The rq$set$interrupt call actually fills the
interrupt vector with the address ofthe C symbol rcvr$int$handler , orassembly language
symbol
rcvrinthandler_
_(Caddsanother ). Then, when thehard interrupthappens, the
CPU vectors to the assembly language routine. That assembly language routine saves the
processor state and calls the C routine. When the C routine ends, the assembly language
routine restorestheprocessorstateand doesa return from interrupt.
2.2.3 Utilities
2.2.3.1 Linker LINK86
The LINK86 linker manual can be found in the utilities manual (iAPX 86,88 Family
Utilities User's Guide, Order Number 121616-004, 1982). The iRMX submit file used to link
theLAN softwaceisshowninappendix D
2.2.3.2 Kermit
The Department of Computer Engineering facilities included the 310 systems, IBM
PC's and access to the RIT VAX Cluster. Each of these facilities have compatible version of
kermit,which will allowtransferringofASCIIfiles. Thus, developmentof sourcecodecan be
done in a variety of environments so as to allow the 310's to be used
by
others or thesoftware development to be done elsewhere. A detailed description of a kermit session is
3.0 iRMXBugaboos
Thissectionchronicles problemswhich werenot solved. One very
frustrating
aspectofa lotofthese problems isthatthere isno way to verifythe proposed explanations. After
exhausting all possible approaches to these problems, the conclusions that were reached
reflected the only remaining alternative. It is very possible that another explanation exists
forthese problems, and that the people involvedsimply failed to thinkofit. However, these
problems were eventuallysimplyworked around.
3.1 Hardware
Theslots intheIntel 80286are not all identical. The bottom threeslots havean iLBX
bus incorporated forfast data transfer. However, the physical slot for the iLBX bus is also
used
by
the 1 16 board for 12volts. Since the iLBX isTTL, a buffer chip on the 80286 singleboardcomputeris destroyed (seesection2.1.1).
The 1 16board edge connectoris designed to goto a DB50,which servesastheback
panel connectionto the outside world. The DB50 pin numbering differs fromthe 1 16board
pinouts shown on the schematic. There is a close correspondence in that a cable can be
crimpedfroma 50pin edge connectortoa DB50suchthat the differenceinthe numbering is
only one apart. For instance, pin 1 on the board edge is pin 2 on the DB50. Pin 2 on the
board edge is pin 1 on the DB50. Although this seems like a small point, many cables were
ruinedbecauseofIntel's confusing pin assignment.
Dataisalwayscirculatingon theLAN. EvenaLAN sitting in an idlestate(i.e. no one
issending)requiresthat afreetoken be circulated onthering. Notall ofthe packet need be
received before knowing what to do with that packet. Thus, the correct approach is to
retransmit each portion ofthepacket received asitarrives. Thus, a particular packetcan be
design all nodes are continually
handling
data. However, ifthat data is handled totally atinterrupt level, experience shows that the low priority tasks do not geta chance to run. A
solutionto theproblem lies ineach node
delaying
priortoretransmittinga packetor portionthere of. This
delay
(via an rq$sleep) allows the lower priority tasks a chance to function.Obviously, this serious performance problem can be overcome in a production system
by
building
anindependent,concurrently executingring interface.3.2 Interrupts
Interruptscan notbe disabled for anyperiod of time. The system clock is interrupt
driven, and requires that interrupt to update system time counters. System calls such as
rq$sleepsimply never wakeupsince allinterrupthasbeen disabled.
The operatingsystem queues up hard interrupts. It wasthought that these queued
interrupts could be manipulated with the rq$disable and rq$enable system calls, since the
calls affecteda single interrupt level. Although any taskcan perform an rq$disable, only the
interrupttaskcan dotherq$enable
Queued interruptposed another problem. Aninterrupthandler makes a system call
rq$exit$interrupt or rq$signal$interrupt, which dequeues that interrupt as far as iRMX is
concerned. If a node is
doing
simultaneous sends and receives, iRMX is queueing anddequeueing
on two interrupt levels at the same time. It appeared that the system calls todequeueonone interrupt level affectstheother level, sinceinterrupts appeared to get lost.
That is, to dequeue on one interrupt level somehow dequeued the other level also. The
interrupt driven communication would simply stop, with no reason that could be
determined. After extensive experimentation, no other explanation could be isolated.
By
Any attemptsto talk
directly
to the system Programmable Interrupt Controller(PIC)are unsuccessful. By sending the correct data to the appropriate register, interrupts can be
disabled and enabled temporarily. Eventually, iRMX returns the PIC to its original state.
Apparently there is a copy ofthe mask registersomewhere in iRMX, and thatcopy is simply
restored. Interrupts disabled
by
writing to the PIC would simply become reenabled allby
themselves.
3.3 File I/O
C file I/O can not be used for
binary
data. For some unknown reason, C routinesplacea carriage return and line feed intothefile when told towrite a carriagereturn. Every
Croutine wastried: fputc, putchar, putw, fputs, fwrite,and fprintf.
Apparently, onlya Cmainroutine cancreatefilesthataresharable. Ifacreated task
creates its own file, when anothertask tries to open that file, the system crashes. Industry
sourceshavetold methat thejobmustbe an "I/OJob"
Repeated attemptstotryand create
an I/Ojob failed. Noteinthedesignthatas a result ofthis,the maintaskcreatesthe chatfile.
3.4 Miscellaneous
The readeris reminded that printf isqueue system I/O. In the case ofthissoftware,
which managed to die with frequent regularity,
debugging
printf's will not appear at thescreen. Arealtime iPrintf(whichwritesto the USART/MPSCdevice) wasdeveloped and must
beusedforall realtimework.
Along that line, when the system crashes, iRMXsendsa last gasp error code to the
user, viasomething analogousto a printf. Ifthe programmerislucky, afewcharactersfrom
the error code appear. This tells you the system detected a failure, and if you are lucky,
4.0 The Network Model
4.1 ISO OSI Model
The International Standards Organization (ISO) Open System Interconnection (OSI)
model subdivides the networking task into seven layers, each of which perform individual
functions. An in depth discussion of this topic can be found in [TAN81], which will be
summarized
briefly
herein.Figure 4.1 depicts the OSI model. In all node to node communications, there is a
sender, 0ton repeaters and areceiver node. Althoughthereis a logical connection fromthe
sender application (user interface) layer to the corresponding receiver application (user
interface) layer, it can be seenthat the actual data travelsa more complex route. The data
must filter down through all layers of the sender node, and travel through some layers of
each (if any) repeater node before arriving atthe receiver node. Each of these layers have
specifictasks to perform toinsurethatthedataarrivesintact.
A very brief summary ofthe network layer tasksare shown in table 4.1. Thistable
should give an intuitive feel for the tasks each layer performs. With this background, the
general organization oftheLAN software canbe examined
Assumethe user starts witha file to be sent. Each subsequentlayerwill coordinate
its task
by
adding data to that file. When the file arrives at the receiver node, thecorresponding layerlooksatthat datatofigure out whatto do This piggy
backing
of layerinformation to the actual data is a protocol. For instance, a transmitted file can have the
destinationfilenamewithintheprotocol data.
In transmission, each layer adds its protocol asthe data is sent to the next lower
Sender Node Repeater Node Receiver Node
application layer
presentation layer
sessionlayer
transportlayer
networklayer
data linklayer
physical layer
presentation
layer
transportlayer
networklayer
data linklayer
physicallayer
application
layer
presentation
layer
transportlayer
networklayer
datalinklayer
physical layer
simply as data. Thus, when the file arrives at the transport layer, there is application,
presentation,and sessionlayerprotocol information attached toit.
The file arrives atthe transport layer, where it must be reduced to a manageable
size (thereisalmost guaranteedto bea transmission failure in a fivemegabytefile transfer).
The file is broken upintoequal sized chunksofdata. A packet isformed when the chunk of
data iscombinedwith protocol information. Thisprotocol informationcan include awealth
of information, such as source node address, destination node address, cyclic redundancy
check(crc)orchecksum,andsuch.
The packet is sent to the network layer, which handles intra-node routing. Each
node transmits the packet via the data link layer, which provides an error free packet
transmissionmedium.
The packet arrives at a repeater node. This node notices the destination address
and uses algorithms todetermine a route. The packet is then sent to the next node on that
route. When the packet
finally
arrives atthedestination node, the packetisacceptedby
thetransport layer There, the multiple packets are reassembled intothe original file, which is
passed up layer to layer. During that process, each layer removesthe protocol information
layer task comments
application
defined
by
user LAN software userinterface
presentation data transformations
medium transformations
i.e. textcompression
i.e.
incompatible
terminals
session provides reliable processto process
communication
transport provides reliable
host
tohost
communicationshides
all networkdetails
from upperlayers
network routing
deals
in packetsdata
link provides reliable transmission mediumdealsin packets
packet
integrity
via checksum or crcphysical actual data transfer medium
deals in
bit
stream4.2 LAN Model
The LAN developed for the thesis is
loosely
based on the OSI model, as shown infigure4.2. The application, presentation and session layers have beencombined intoa single
human interface layer. Sincethe hardware configuration ofthe LAN isa token ring, routing
isa minimal issue (thepacket always goesto the next node onthe ring), sothe network layer
hasbeenincorporated intothedata link layer The data linkand physical layersareintact.
In this LAN software,thefeaturesof each layerareoutlinedin table4.2.1 below
layer task comments
application userinterface mustknow LAN logical
node names
transport providesLAN interface
to user
hidesall network details
from upper layers
converts LAN logical
node namesto LAN
addresses
data
link provides reliable transmission mediumdeals in packets
routes packetto next
node
packet
integrity
via "crc"physical actual data transfer medium
deals in
bit
streamSender Node Repeater Node Receiver Node
human
interface layer
transportlayer
data link layer
physicallayer
human
interface layer
transportlayer
data link layer
physical layer
human
interfacelayer
data linklayer
physical layer
5.0 LAN SoftwareDesign
Thissection will discussthe LAN software. In figure4.2, ofthe fourlayers, three are
software: the humaninterface,transport and data link. The physical layerwill beaddressed
inanother section.
5.1 Overview
The LAN software allowsthe usertosend filesand messagestoanother node, while
determining thestate ofthe local filesystem. However, beneath this surface the LAN must
administer itself not only to start up correctly, but to detect failures and correct them if
possible.
Failing
that,tonotifythe userofanycatastrophicfailurethatdisablesthe LAN.To describe the workings of this or any system, the parts must first be defined
before understanding how those parts interact. This overview shall describe these parts
(software tasks), and the mechanisms that allow the parts to interact (i.e. mailboxes,
software interrupts). By
interacting
it ismeant howtasksstartand stop eachother, and howtheycommunicate
The LAN model (figure4.2) providesthe foundation forthesoftwaredesign. Figure
5.1.1 showsthe threesoftware layers fleshed out withthetaskscontained in eachlayer. The
mechanical aspects ofthese tasks (file names, variablesand such) will also be presented so
thatthereader can explorethecodeasthediscussion develops
Itshouldbe notedthatwhile the transportand human interface layersare minimal,
the data link layer isimplemented in some depth. The data link layer is designed as a state
machine,where all ofthe tasksmustbeaware ofthestate oftheothertasks. Thestateflags
for each task are kept in global integer variables. Thus, any tasks can determine and/or
>> <D -Q E o> Q) 03 a c 0) c (0 .c * t-3 c O k_ 4-V a "O 3 k_ k_ c 0) <1> </> + c V
J
a
r
-a c 01;
i
1 0) Q> >. >. 03 03 _l .*-k_ >*_ o o Q. 3 01 035* <1)k_ 03
_1
>> 01 01 c _J
>> o C (0
03 o
r w 03
o k.
Ol
u
i/> </l n 01 01k- Q.
v/1 a. <
5.1.1 Task
Blocking
MechanismsFigure 5.1.2 shows the four iRMX system primitives used to block the tasks:
rq$wait$interrupt, rq$receive$message, gets, and rq$sleep. The first three are blocked
waiting for an event: an interrupt signaling inter-node I/O, a mailbox message signaling
inter-task I/O and gets signaling user input, respectively. The last, rq$sleep, is blocked on
time. The control taskwakesupeverysooften to monitorthe node. The interrupt handlers
arethe traditional interruptroutines which are vectored to upon interrupt.
Task priority isused to determine which runs first. As in mostsystems, the highest
priority (or in iRMX, the lowest numeric priority) runs first. In
looking
at figure 5.1.2, theindividual task prioritiescan be seen in theupper right corner ofthe task balloon. With the
exceptionoftheinterrupt handlers,the control task runs atthe highestpriority. Blocked on
atimer, control wakes up periodically to monitorthe state ofthe node. Control simplygoes
backtosleep unlesstheLAN needsresetting (timeout, resettoken, and such). The remaining
taskswakeupwhen data isreceived.
The handlers run when an interrupt is received, signaling input or output
being
received
by
the next node. These handlers simply make the rq$signal$interrupt call,notifying their respective interrupt tasks(blocked on a rq$wait$interrupt) that an interrupt
hasbeen received andthe I/Omustbe attendedto.
Thus, the control task blocks on time, and the handlers on interrupt which signal
intra-node communication. The human interfacetask blocksongets, a C utilitywhichwaits
foruserinput. The remainingtasksare blocked waitingfor communicationfrom the human
'
\
Ul 00 1/1 ^f
^
(N .* j=
rsi kJ u
rsi *-> Q. 3 k_ 0) -t-c
k_ \fy CT>
o> *->
-a 'fa k^
c 5
03 <a^
.c CT
c
^
k.
>
f
\
f
^
V "/
c rsi rsi rsi rsi 'k.7
OI Ol 03 iy> 0) E Ol > 3 O-c Oi I u 01 k. O" I k_ 01 D t-j 01r
a
/
rsi rsiA
ro rsi\
00 ro Q. 0> 03 k.J
IE7
3 k-k_ 0) 03 k^ 01r
^
c t/* o^A 01 rsi
w > (N
03 5 01 v* 0> o" i/> k. 01
o
^
ifO
Q.
01 Ol
0} c <&
.c c k. 0) <-> c
V
J
OI V"J
"5 J cr-o oc
J
5.1.2 InterTaskCommunication
As shown above, external inputs to the interrupt handlers orthe human interface
start the system. Information must flow from tasks to task via the iRMX primitives
mentioned as the
blocking
mechanism: rq$wait$interrupt and mailboxes. Figure 5.1.3showsthemultipletasks thatdoeithera rq$signal$interruptor mailboxsend towake upthe
blocked tasks.
Theinterrupt handlersarevectoredtovia a hard interrupt signalingdata I/O These
handlers then wake uptheircorresponding interrupt tasks via a rq$signal$interrupt system
call prior to going back to sleep. Thus, when the data I/O is signaled, the interrupt tasks
awaketodotheactual read or write. In thismannerinterrupttaskssint and rinttakecare of
the physical datareading and writing.
Itis importantthateachtaskknowswhattodowhenan inputarrives Inthecase of
the mailbox, the receiving task goes
by
the return mailbox token to determine what courseof action to ta^ke. When an rq$signal$interrupt wakes up an interrupt task from a
rq$wait$interrupt, thatinterrupttask knowswhatistobe done
by
various state flags in thesoftware. Themajor reason forthesenderportion
being
two tasks, sintand sender, isthat asingle task would have to manage both the mailbox and the rq$signal$interrupt from the
trans taskand interrupthandler, respectively.
It will be shown how control resets the LAN. To accomplish this, control does an
rq$signal$interruptto thehandlerswhichinturn passtheresetdowntothe nextlowertask.
In this mannera reset could filter down through all ofthe tasks. However, trans and hi are
not informed since only the data link layer need provide this dynamic self correction
5.1.3 Software Organization
Figure 5.1.1 showsthe task structure thatwill most simplify the discussion of how
the LAN functions. However, one must be able to locate the code that performs these
functions. This section will provide a road map to enable the reader to locate sections of
code
by
providing fileand routine names.Secondly, the issue of how the LAN software functions hinges on certain global
variablesthat describe the system. These variables will be listed and their functions
briefly
outlined.
5.1.3.1 Files
The LAN software filesare made upofC and a small number ofassembly language
routines. Inaddition to the tasks infigure 5.1.1,thereare utilityfileswhich providea
library
of routines. Each task in figure 5.1.1 has a source code file, as summarized in table 5 1.1.
Eachtaskmaycall
library
routinestobe found inotherfiles.Task File
Name Routine Name Description
rint.c rcvr$int$handler rint
receiver interrupthandler
receiver interrupttask
sint.c sender$int$handler sint
sender interrupthandler
senderinterrupttask
sender.c sender sendertask
control.c control background control task
trans.c trans transportlayertask
hi.c main human interface
task,
also c mainThe
library
of routinesis summarized in table 5.1.2 For the most part, the human interface and transportsubroutines are in cutils.c. The data link subroutines are in dlutils.c.All
debugging
and testing subroutines are in tutils.c. The low level assembly languageUtility
FileName Routine Name Description
dlutils.c
data
linklayer
utility routinesdocrc
computes"crc"
CreateFreeToken CreateResetPacket CreatePacket
InitHardware initializes LAN h/w
(PIC, 8255,
etc.)ProcResetToken processes resettoken
ProcHDR ProcRecEOT ProcRepeatEOT ProcDelEOT
cutils.c human interface/transport layer
utiltityroutines
GetSegment gets 16bitsegment register value
DetermineEnvironment 8086or80286system
"
CreateResources mailboxes, tokens
CreateTasks
InitExceptionStructures createslocal exception handler
structurefor inline error
handling
LanDir user "dir" command GetChatFile user "chat" command
GetArg
isolatesargumentfromcommandline
ParseCommand Parse command line
DisplayFile displaysan ASCII file
WriteFile writestext intoan ASCII
file
iPrintf doesreal time print
tutils.c iPutbyte iPrintPacket iPrintPacketHDR iPrintResetPacket iPrintFreePacket iPrintDataPacket
debugging
utility routines- alldisplay
real timeautils.a86 assemblerlow level routines
rcvrinthandler actual interruptroutines
senderinthandTer writestoconsol USART/MPSC poll
ConsolOutput_
readybit
readsfrom
hard
address5.1.3.2 Global Variables
There are several types of global variables. These include task tokens, mailbox
tokens, task state variables, and certain hardware information. Also, there are quite a few
debug
flags used to drive the debugging. These global variables are defined in the mainroutine, hi.c.
First, every iRMX entityhasatoken, or unique 16bit number, which identifiesthat
entity. The token value is used
by
iRMX in system calls, error codes and debuggers. Thetoken identifiesthe tasks and mailboxes. These iRMX tokens should not be confused with
theLANtokensofthe token ring network; they areentirely different entities.
The collection ofthe task statevariablesare used todefine the state ofthe system.
The data linklayer is defined as a state machinewhich functionsbased on thestate variable
values. The discussionsofthedatalink revolve aroundtheinteractionofthevariables.
The hardware information includes the different system console port USART or
MPSCforthe 8086or80286, respectively. Both theportaddressesand thestatusregisterare
different, and must be resolved at powerup before any intelligent I/Ocan take place Also,
the transmit ready and receiveready bitsare different,sothe masksto isolatethese bits are
set.
System wide debugging flags are used to enable and disable
displaying
of anyinformationthe user wishestosee in real time. RintTiK issetto zeroeverytime the receiver
interrupttaskwakesup, soshould RintTik exceed some maximumtime the node realizesthe
networkisprobably down. Debug variablesFreeTokenDelayand timeoutallow slowing and
speedinguptheLANsoftwaresoitcan beviewed ata veryslowpace
by
the user,if desired.There are inputand output packet buffers. The software uses the pointers inhead
and outheadtolocatethe packets within the buffers, allowing dynamic packet utilization.
Miscellaneous items includethe node, packet senderand packet receiver addresses.
All tasks will set a single bit in ResetACKto acknowledgethe task has returned to an initial
state. When all taskshave doneso,the controltask knowsthenode isup and running.
type global name description
Task Token RintToken receiver interrupttask token SintToken senderinterrupttask token
SenderToken
sendertask tokenTransToken transportlayertask token HiToken
human
interface task token ControlToken background control task tokenMailboxToken RintMbox SintMbox SenderMbox TransMbox
HiMbox TimerMbox
individual task mailboxes
State Variable RintState individual data linktaskstate
SintState variables
SenderState NodeState
Hardware Data costat consol status port address
codata consol data port address
txrdy
consol transmit readybit
mask(status
port)rxrdy consol receive ready bitmask (status port)
Debug
Flags ShowProtocol variousbinary debug
flags
vary ShowPacketsdebugging
outputto screen ShowStateGoodCRC
FreeTokenDelay
delay
before
relayingfree
token timeout time until timeoutdeclared
Time RintTik time countersetto zero each time
packet is received
Packet Pointers outp pointer intooutput packet
outhead pointerto head of output packet
inp
pointer into inputpacketinhead pointerto head of inputpacket
Miscellaneous NodeAddress address of node SourceAddress
file
sender address DestAddressfile
receiveraddressResetAck eachtasksacknowledges reset
by
setting a single bit5.2 Human Interface Layer
5.2.1 Functionality
The LAN software provides two types of capabilities to the user: internode
(between nodes) and intranode (within a single node). Intranode refers to the user
interaction withthe system on whichhe/she isworking. This includes itemssuch asgetting a
directory,andtypinga particularfile
Internode refers to
interacting
with another node, such as sending a file there.Basically, intranode is handled
by
the human interface while internode requires all of thelayers. Theeffects oftheinternode commandswill betracedthrough thetransportand data
link layers in the subsequent sections. However, for now the commands will be addressed
fromtheuserpoint ofview,assummarized intable5.2. 1
command type description example
:
dir intra showfiles in a
directory
dir
dir/user/world/mydir
type intra
display
ASCIIfile
toconsole
type filename
type /user/filename
help
intra displayson linehelp
screen
exit intra terminatesLAN software
copy inter copies
file
to anothernode(which gives
default
file
name)copy
filename
[to]
:nodename:
copy /user/filename
[to]
:nodename:chat inter usercreates message
dispalysat
Notethatintable 5.2. 1[ ] indicatesoptional,and intheiRMXtradition :: indicatesa
device.
The dir, type,
help
and exit commands seem relatively self-explanatory. On thesurface, copy and chatseem equallystraight forward. However, the implementation ofthe
mechanismenabling thesecommands represents a significantportion ofthedata link layer.
The copycommand allows sending anyASCII file in any
directory
to another node.Once at thedestination node, the file must go into a default
directory
under a default filename. Once there, the file contents will be displayed on the screen. The destination node
user canalso examine thefileviatheuser typecommand.
The chatcommand isslightlydifferentinthat theusercomposestheASCII fileatthe
screen. That ASCII file is automatically sent to the destination node where the file is
displayedsimilarlyto thecopyfile.
5.2.2 Debugging Capability
The debugging code wasincorporated intothe LAN software during development.
However,
by
creating userdefined binaryswitchtosuppress or allowdebugging
informationtoappearatthe screen, developmenttimewas reduced enormously. Thiscode has been left
intact so as to
help
anyone who should wish to use the LAN software as a base fordevelopment.
There aretwo basicdebugging commands: set and show. Show allows
displaying
packets, protocol and/or state information while the LAN runs. The set command allows
defining
theFreePacketDelay,timeoutorcrcgood/bad flag.The various test utilities in tutils.c allow view the packets
during
debugging. Inaddition, certain LAN state variables can be displayed. The ShowState and ShowProtocol
Toview any information real time, the usermustslow the data transmission down
to be viewed.
Setting
the timeout or FreePacketDelay accomplishes that. The timeoutdetermines how
long
the node waits untildeclaring
the LAN has failed since data has notarrived inacertainamountoftime. TheFreePacketDelaydetermines how
long
the node willhold afreetoken before relaying it. Thus, each node on the LAN must set the timeout value
quite high to stop the LAN from resetting. Once that is done, the
FreeTokenDelay
isincreased toallow theusertoreadtheinformation
being
displayedatthe screen.Thetimeoutnumber isin units of1/10of a second. Thisis determined
by
thecontroltask calling rq$sleep(TIK,&status), where TIK is defined in common.h as 10. Laborious
searches in the Intel documentation will reveal that the rq$sleep argument TIK has units of
10milliseconds.
The FreeTokenDelay is used similarly
by
rint.c todelay
beforedoing
any packetoutput. The rq$sleep(FreeTokenDelay,&status)call ismadetoallowthelowerpriority hiand
controltasks a little time to run. However,
by
letting
the user redefine this delay, the LANcan be slowed down to allow viewing of the packet and protocol information
FreeTokenDelayisoriginallysetto4 (milliseconds).
To summarize the time issues for debugging, first, the timeout must be reset to
around 10seconds (100units), and then the
delay
toaround 2 seconds(200 units). Thus, thedatathatappears atthe userscreen will remain 2*
nseconds(wherethereare n nodes).
command
argument(if
any) description
show packets
display
all packetsshow protocol
display
protocol informationshow state
display
state informationshow all same as showpackets, protocol and
state
show none
display
nodebug
informationshow
display
set of alldebug
variablessettimeout n * 10 msec settime until node timesout
set
delay
n * 1 msec setdelay
before any packet issenttonext node
set crc good
bad
normal situtation
forces all packetsto
be
sentwith abad data
integrity
checkTable 5.2.2
Debugging
Commands5.3 Transport Layer
As mentioned earlier, the transport layer provides a reliable host to host link, and
hides all details of the LAN from the human interface layer. First, the reliable link involves the correct handling of files moving to and from other nodes. This routing of files is the transport tasksprimary function. Secondly,
filtering
all LAN specificdetailsfrom the human interface includes itemssuch asconverting the human interface logical node namesto hardaddresses used
by
the lower layers.As implemented in this LAN, the primary task of trans is to serve as a message
A message from the hi task include the token of a file which contains the ASCII
command line input
by
the user. Hi has already parsed the command line for accuracy, sotrans need onlyvalidatethatthedestination node logical nameexists. Ifitexists, the logical
name isconvertedtoa hard address, and a mailbox messagetransmitted tothe sendertask.
If thenodedoesnotexist, the useris informed and the transaction isterminated.
Amessagefrom rintindicatesa file has been received. Thatfile isthendisplayed. In
the pathological case that the node is
being
reset, trans acknowledges the reset and goes5.4 Data Link LayerState Machine
The LANsoftware performsthreefunctions: send, receive orrelaypacket. First, the
formatof those packetswill be defined. With those formatsasa background, the software
will be examined from different viewpoints: high level state diagrams, software task
diagrams and code. These formats will be related to each other, as the explanation moves
froma high level totheactual code. Lastly, the LAN initialization and error recoverywill be
addressed.
5.4.1 Overview
There aretwo typesof packets: userand ringcontrol. The user packets are used for
data transfer, while the ring control packets are used to administer the LAN. The user
packets consist ofthefree and datapackets. The ringprotocol packetisthereset packet.
5.4.1.1 Data Packet
The data packet format isshown in figure 5.4.1. The reserved characters SOH, STX,
ETX and EOT are used
by
the rint interrupt task to drive some action. Note that thesereserved characters are FF, FE, FDand FC(hexidecimal) respectively Since onlyASCII filesare
transferred,there isnoconflictbetween dataand reserver characters. Thisis due to the fact
thatASCII characters all have the high data bit 0 while the reservered characters have the
high bitas1.
The SOH drivesrinttostartreceivinga packet. Anydata received priortoaSOHwill
bediscarded. All data received aftertheSOH is buffered. The STX tells rinttheentire header
has been received, and that routining decisions can be made. Based on the source and
SOH control
byte
source
address
dest
address
STX
data
CRCH CRCL ETX TR /TR EOT
FF FE 124bytes FD FC
User Packet
TokenType
0 Free
1 Busy
Last Packet
0 No 1 Yes
unused
/ACK FF
/NAK FE
/ACK FF
/NAK FE
The ETX signals that the previoustwo words contain thedata
integrity
check codeThe EOT signals the end of packet transmission. Since the LAN code buffers the entire
packet, theEOTsignalstherinttask tostarttheappropriateactionswiththepacket.
The packetis of fixed length, as defined in a C structure. Thus, the code provides
symbolssuch as p->SourceAddress,which makethe code much more readable. Itshould be
noted that the pointersinhead and outhead are passed as arguments to routines which use
them a pointersto the packet structure. Lint(C'ssemantic checking program)will show this
asanerror.
5.4.1.2 Free Token Packet
The free token packet format is shown in figure 5.4.2. This minimal packet has
enough information (SOH, STX and EOT) to allow the rmt interrupt task to change states
correctly.
The free token circulates when the ring is idle. Thus, when a data packet transfer
ends, a free token is placed ontothe ring. Thisfree token insures the ring integrity. Ifthe
free token s