2070 Operating System Manual
2070 Operating System Manual
Operating System
Users Guide
December 2004
DISCLAIMER
2
Table of Contents
I Introduction
XI. Glossary
3
I. Introduction
Welcome to the software world of the 2070. Unlike it predecessor, the 170
controller, the 2070 controller uses an operating system which handles software and
hardware interaction and makes manufactures controller hardware virtually transparent to
application developers. This guide is an introduction for new users to the OS-9 operating
system. It is meant to be a primer as to how to use basic operating system commands,
how to load applications and how the controller is configured. Additionally, it also
explains the operating system memory structure and the sequence of events that occur
when the controller starts.
4
II. Connecting a PC to the 2070 Controller’s OS-9 Operating System
General interface with the operating system is by using a direct mode
communication cable (Shown below) running from a host computer on serial port 1 of
you PC to the C50S port of the 2070 and using program terminal emulation software such
as HyperTerminal.
Once the cable is properly connected between the 2070 controller and the PC, you
are ready to begin configuring HyperTerminal to communicate between the 2070
Controller’s OS-9 operating system, and your PC.
5
A. Configuring HyperTerminal to communicate with a 2070 controller
6
3. Create the name for your connection, and select the icon that you want to
represent that connection.
7
5. Select the baud, data bits, parity, stop bits and flow control as shown.
6. You should now be connected to the 2070. Note the lower left hand of the
screen shows “connected”.
8
7. To ensure that HyperTerminal properly displays all 2070 characters, select file
and the properties from the menu
8. After selecting the “Settings Tab”, select the “Windows Keys” functionality,
and set the terminal emulation to VT100.
9
9. Select the “ASCII Setup” button and ensure that the “Wrap lines that exceed
terminal with” is checked. Then select “OK” on the ASCII setup panel to
accept these settings.
10
11. Upon exiting the program, select yes when you are asked if you want to save
the session. This will allow you to preserve your settings for future sessions.
11
Upon restarting a saved session, you will be automatically connected with
the 2070.
DANGER
Never enter terminal commands while the controller is controlling an active intersection
as serious damage or injury may result
12
B. Sending files to the 2070 controller using HyperTerminal
1. On the 2070 controller type “chd /r2” to ensure your current data directory
is /r2
2. Type “kermit ri” on the 2070 controller for binary files or “kermit r” for
ASCII files.
13
5. Select “browse” in HyperTerminal and find the file that you want to
transfer. After selecting the file, select “Open”.
14
You should now see the file transferring from your PC to the 2070 Controller
15
III. File and Disk Structure
A. Types of memory
FLASH
First, although you can read data from the flash memory an infinite
number of times, it is only capable of only about 100,000 write cycles. This
means that after writing approximately 100,000 times to the flash, it will no
longer be able to accurately store new programs.
It is for this reason that we only store applications and support modules on
the flash drive. Image if we logged data to the flash. Even if we just wrote 50
bytes of intersection data just once every 15 minutes. That would mean 96 writes
to the flash drive per day, or 35,040 writes per year. In fact, in just 3 years you
would have over 105,000 writes to the flash, and the flash memory, containing the
traffic application would now be unreliable. Limiting the flash drive to
application data only, greatly increases the useful life of the 2070 Controller
16
So how much flash memory do you get to store your programs? The flash
memory used in the 2070 controller has a memory size of at least 8 megabytes
and is divided into 2 sections. This first section, 1 megabyte in size, is called the
boot area and is where the basic operating system and its support modules are
stored. To eliminate the problem of the user accidentally erasing this area and
rendering the controller unusable, this area is not normally accessible to the user.
The other area of the flash memory, which is available to the user, is a minimum
of 7 megabytes in size and is formatted similar to a computer hard drive. This user
area of memory is accessible through several descriptors named /f0, /f0wp, and
/f0fmt.
/f0wp is by default the drive that the terminal user interface is set to when
the controller boots up. /f0wp means that you are connected to the flash drive in a
write protected mode. You can read everything from the flash drive while you are
in this directory, but any function which requires writing to the drive will fail.
/f0 is the same drive as the /f0wp, but it is not write protected. Using this
descriptor name will allow users to write files to the flash disk, as well as
allowing other functions which require writing to the disk such as renaming files
or changing file attributes.
/f0fmt is the same as the /f0 drive in that you can read and write to the
flash, but this descriptor also gives the additional capability of allowing the user
to be able to reformat the entire /f0 drive. Use of the format command should
only be used when absolutely necessary because reformatting the drive will
destroy any data currently existing on the /f0 drive.
SRAM
Like the flash memory, the SRAM is divided up into 2 sections. The first
is not accessible to the user and is used by the operating system to reduce the
chance of corruption during a power failure when writing to the flash memory
17
The other area of the SRAM is much like the flash memory formatted as a
user accessible disk drive. It has been given the descriptors of /r0 and /r0fmt.
/r0fmt is exactly the same as the /r0 drive, but is format enabled. Just as
with the /f0 drive, reformatting the /r0 drive will destroy any existing data.
DRAM
18
B. File Structure
Much like any other computer the 2070 controller uses a specific file
structure. The typical folder structure for the Flash or /f0 drive is shown below.
BOOTOBJS
Traffic application parameters and logging files are stored on the SRAM
because it is much faster than the flash memory and has an unlimited number of
read and write cycles. Additionally, because the memory is held in its present
state for at least 30 days after power loss, there is little fear that even a lengthy
power outage will cause the stored application parameters to be lost.
19
IV. Basic Software Commands
The following is a list of the most commonly operating system commands for the
2070 controller.
20
deldir Deletes a directory
deldir DIRNAME Deletes the directory named DIRNAME
21
kill Kill a running process
kill 7 Kill process number 7. You can find out what process
number a particular application is using by using the
‘procs‘ command
22
tar File collection utility
tar cvf TARFILE /f0/TARDIRECTORY/* Collects all the files in the
directory named TARDIRECTORY into a single file named TARFILE
in the current data directory
tar cvf TARFILE FILENAME1 FILENAME2 FILENAME3 Collects all three
files in the current data directory named FILENAME1, FILENAME2
and FILENAME3 into a single file named TARFILE in the current
data directory
tar xvpf TARFILE Restores the single tar file to its original
files and file locations.
23
V. Example usage of selected OS-9 controller commands
attr startup
$ attr startup
------wr startup
date
$ date
March 2, 2004 Tuesday 4:59:33 pm
deldir
$ dir -e
Directory of . 14:08:23
Owner Last modified Attributes Sector Bytecount Name
------- ------------- ---------- ------ --------- ----
0.0 04/03/01 1403 d-ewrewr 5 64 EXAMPLE
$ deldir example
$ dir -e
Directory of . 14:08:45
Owner Last modified Attributes Sector Bytecount Name
------- ------------- ---------- ------ --------- ----
devs
$ devs
McCain 2070-1A/B 68360 OS-9/68K V3.2 (32 devices max)
24
dir
$ dir
Directory of . 16:55:26
CMDS ETC SYS VAL startenet
startup
dir –e
$ dir -e
Directory of . 17:00:07
Owner Last modified Attributes Sector Bytecount Name
------- ------------- ---------- ------ --------- ----
0.0 04/02/09 1857 d-ewrewr 4E3 1344 CMDS
0.0 04/02/18 2038 d-ewrewr 42 416 ETC
0.0 04/02/18 2038 d-ewrewr 52 96 SYS
0.0 03/09/21 1319 d-ewrewr 9 480 VAL
0.0 03/10/02 1722 ------wr D07 180 startenet
0.0 04/02/06 1232 ------wr 12 34 startup
dir /f0
$ dir /f0
dir /r0
$ dir /r0
Directory of /r0 17:01:40
KeyTarFile TEST chkmod chkser chktmr
dat.dat daterrorlog
dir –e /r0
$ dir -e /r0
25
format
$ format /r0fmt
Disk Formatter
OS-9/68K V3.2 Econolite 2070-1B(68360) v.20 - 68300
------------ Format Data ------------
Fixed values:
Physical floppy size: 5 1/4"
Sector size: 256
Physical Disk capacity: 3496 sectors
(894976 bytes)
Logical Disk capacity: 0 sectors
(0 bytes)
Sector offset: 0
Track offset: 0
LSN offset: $000000
Minimum sect allocation: 4
Variables:
Recording format: FM
Track density in TPI: 48
Sector interleave offset: 1
ident –m kernel
$ ident -m kernel
Header for: kernel
Module size: $6AB8 #27320
Owner: 0.0
Module CRC: $45344F Good CRC
Header parity: $1D35 Good parity
Edition: $177 #375
Ty/La At/Rev $C01 $A000
Permission: $555 -----e-r-e-r-e-r
Exec off: $4C #76
68000 System Mod, Object Code, Sharable, System State Process
26
iniz
$ devs
McCain 2070-1A/B 68360 OS-9/68K V3.2 (32 devices max)
$ iniz /r2
$ devs
McCain 2070-1A/B 68360 OS-9/68K V3.2 (32 devices max)
kill
$ procs
Id PId Grp.Usr Prior MemSiz Sig S CPU Time Age Module & I/O
2 0 0.0 128 0.50k 0 w 0.00 2:19 sysgo <>>>sp4
26 2 0.0 128 8.50k 0 w 0.32 1:40 shell <>>>sp4
47 26 0.0 128 5.00k 0 s 0.00 0:00 chkled <>>>sp4
49 26 0.0 128 19.25k 0 * 0.04 0:00 procs <>>>sp4
$ kill 47
$ procs
-47 Exited with Error #000:228
Id PId Grp.Usr Prior MemSiz Sig S CPU Time Age Module & I/O
2 0 0.0 128 0.50k 0 w 0.00 2:19 sysgo <>>>sp4
26 2 0.0 128 8.50k 0 w 0.34 1:40 shell <>>>sp4
50 26 0.0 128 19.25k 0 * 0.03 0:00 procs <>>>sp4
makdir FILENAME
$ dir
Directory of . 14:03:36
$ makdir EXAMPLE
$ dir
Directory of . 14:03:52
EXAMPLE
$ dir -e
Directory of . 14:03:55
Owner Last modified Attributes Sector Bytecount Name
------- ------------- ---------- ------ --------- ----
0.0 04/03/01 1403 d-ewrewr 5 64 EXAMPLE
27
mdir
$ mdir
Module Directory at 17:01:32
mdir -e
mdir -e
Addr Size Owner Perm Type Revs Ed # Lnk Module name
-------- -------- ----------- ---- ---- ---- ----- ----- --------------
01007800 27320 0.0 0555 Sys a000 375 2 kernel
0100e2b8 5660 0.0 0555 Sys a000 37 1 ioman
0100f8d4 12848 0.0 0555 Sys a000 18 1 fpu
01012b04 402 1.0 0555 Sys 8000 51 1 init
01012c96 456 0.0 0555 Sys a000 1 1 pit2070
01012e5e 284 0.0 0555 Sys a000 1 1 pwr2070
01012f7a 1944 0.0 0555 Sys a000 1 1 rtc2070
01013712 304 0.0 0555 Sys a000 1 3 tck2070
01013842 772 0.0 0555 Sys a000 1 1 z85230
01013b46 4838 1.0 0555 Prog c001 39 0 attr
01014e2c 2756 0.0 0555 Prog c001 10 0 break
010158f0 2670 1.0 0555 Prog c001 24 0 build
0101635e 18082 1.0 0555 Trap c009 6 0 cio
0101aa00 9688 1.0 0555 Prog c001 54 0 copy
0101cfd8 47918 1.0 0555 Trap c00a 25 2 csl
01028b06 3172 1.0 0555 Prog c001 23 0 date
0102976a 9544 1.0 0555 Prog c001 35 0 dcheck
0102bcb2 3038 1.0 0555 Prog c001 22 0 deiniz
0102c890 5000 1.0 0555 Prog c001 37 0 del
0102dc18 7310 1.0 0555 Prog c001 41 0 deldir
0102f8a6 3336 1.0 0555 Prog c001 16 0 devs
pd
$ pd
/f0wp
procs
$ procs
Id PId Grp.Usr Prior MemSiz Sig S CPU Time Age Module & I/O
2 0 0.0 128 18.75k 0 w 0.03 0:01 sysgo <>>>sp4
9 2 0.0 128 8.50k 0 w 0.07 0:00 shell <>>>sp4
12 9 0.0 128 19.25k 0 * 0.04 0:00 procs <>>>sp4
28
setime
$ setime
yy/mm/dd hh:mm:ss [am/pm]
Time:
March 2, 2004 Tuesday 5:00:37 pm
setime
tmode
tmode
/sp4
noupc bsb bsl echo lf null=0 nopause pag=24 bsp=08 del=18 eor=0D
eof=1B reprint=04 dup=01 psc=17 abort=03 quit=05 bse=08 bell=07
type=00 (par=none, cs=8, stop=1) baud=9600 xon=00 xoff=00 tabc=09
tabs=4
xmode
$ xmode /sp1
/sp1
noupc bsb bsl noecho lf null=0 nopause pag=24 bsp=08 del=18 eor=0D
eof=1B reprint=04 dup=01 psc=17 abort=03 quit=05 bse=08 bell=07
type=00 (par=none, cs=8, stop=1) baud=1200 xon=11 xoff=13 tabc=09
tabs=4
$ xmode /sp2
/sp2
noupc bsb bsl noecho lf null=0 nopause pag=24 bsp=08 del=18 eor=0D
eof=1B reprint=04 dup=01 psc=17 abort=03 quit=05 bse=08 bell=07
type=00 (par=none, cs=8, stop=1) baud=1200 xon=11 xoff=13 tabc=09
tabs=4
$ xmode /sp3
/sp3
noupc bsb bsl noecho lf null=0 nopause pag=24 bsp=08 del=18 eor=0D
eof=1B reprint=04 dup=01 psc=17 abort=03 quit=05 bse=08 bell=07
type=00 (par=none, cs=8, stop=1) baud=1200 xon=11 xoff=13 tabc=09
tabs=4
29
VI. Advanced shell topics
30
VII. Controller Startup Sequence
The 2070 controller, just like any other computer, starts up using a specific startup
sequence. This startup sequence allows programmers to automatically start their
application program anytime the controller is powered up. The startup sequence is shown
in the following series of flowcharts.
Init
Starts This flow chart
describes the
proper
operation to
the Sysgo
Init sets module
execution and data
directory
to /f0wp and sets
SYSGO as the first
Executable module
Sysgo
Starts
Sysgo sets
execution directory
to /f0wp/CMDS
YES Is Datakey NO
Present and
Valid?
Go to Sheet 2 Go to Sheet 4
Sheet 1 of 5
31
2070 Start Up Sequence Flow Chart
YES Is Datakey NO
Overide Byte
= to 1?
Go to Sheet 3
Sysgo forks
a shell
to /sp4
Sheet 2 of 5
32
2070 Start Up Sequence Flow Chart
YES Is Datakey NO
Overide Byte
= to 2?
Go to Sheet 4
Sysgo executes an
executable module
on the Datakey Shell monitored by Sysgo
Sysgo forks
a shell
to /sp4
Sheet 3 of 5
33
2070 Start Up Sequence Flow Chart
YES Is Opexec NO
Present?
Any YES
Shell monitored by Sysgo
Errors running
Opexec?
Sysgo forks
a shell
to /sp4
NO
Sysgo
exits Is shell
running? NO
Go to Sheet 4
Sheet 4 of 5
34
2070 Start Up Sequence Flow Chart
From Sheet 4
Is Startup NO
Shell monitored by Sysgo
Present?
Sysgo forks
a shell
YES to /sp4
Sysgo forks a
shell to
run Startup Is shell
running?
Sysgo
exits
Is shell
running?
Sheet 5 of 5
35
As you can see from the flow charts, the startup sequence can be fairly complex.
Essentially, the controller loads a boot image which contains all of the basic operating
system modules and gives the operating system the functionality it will need to run any
other process. An example of an operating system module that it loads into memory is
the ‘dir’ module which allows you to see the files in a directory.
The controller then runs a module named “SYSGO” which is the module that
vendors use to configure how all subsequent programs will be started. When SYSGO
runs, it checks to see if there is a valid Datakey present and if finds a key and determines
that the keys data is valid, it will attempt to load a script file or a module from the key. If
there is no Datakey present, the Datakey is not valid, or there is no script file or module
stored onto the key, SYSGO will then look for a binary module specifically named
“Opexec” loaded in the /f0 directory. If that program is present SYSGO will execute that
program. If that program is not present, SYSGO will then look for and execute an ASCII
script file specifically named “Startup” in the /f0 directory. SYSGO then creates a
terminal shell which gives users the ability to access the operating system if needed.
36
VIII. Loading and Deleting Controller Software
The procedure for loading virtually any application program on the controller is
the same.
b. Create a directory folder on the flash drive where you want to store your
file by typing “makdir /f0/DIRECTORYNAME”
c. Change your current data directory to /r2 by using the command “chd /r2”
d. Type “kermit ri” and select the binary file or files on your PC that you
wish to transfer to the controller
e. Type “kermit r” and select the ASCII files or files on you PC that you
wish to transfer to the controller
Application Data
PC
DRAM /r0
#3 Copy From
Database
/R2 to /F0
#1 Download
From PC to /R2
SRAM
Free Memory
Ramdrive /r2
#2 Set Program(s)
Attributes
37
IX. Using Ethernet
Ethernet, unlike other ports requires the initialization of a variety of different
driver and descriptor modules. In order to facilitate the proper loading of these modules a
script named “startspf” is already loaded on the flash memory under the “SYS” directory.
To load and start Ethernet on the 2070 controller type “/f0/sys/startspf” to start the
startspf script.
Configure Ethernet
$ ifconfig enet0
enet0: flags=8003<UP,BROADCAST,MULTICAST> mtu 1500
inet 255.191.255.222 netmask 0xff72ff47 broadcast 255.191.255.254
$ ifconfig enet0
enet0: flags=8003<UP,BROADCAST,MULTICAST> mtu 1500
inet 10.0.0.1 netmask 0xff000000 broadcast 10.255.255.255
$ ifconfig enet0
enet0: flags=8003<UP,BROADCAST,MULTICAST> mtu 1500
inet 10.0.0.1 netmask 0xffff0000 broadcast 10.0.255.255
$ ifconfig enet0
enet0: flags=8003<UP,BROADCAST,MULTICAST> mtu 1500
inet 10.0.0.1 netmask 0xff000000 broadcast 255.255.255.0
38
X. Operating System Error Codes Most Often Encountered
39
XI. Glossary
ASCII file A file which uses characters which are printable. If a file can be
opened and read with notepad, it is a ASCII file
Binary file A file which is not readable using a text file editor.
* Wildcard character
Flash Memory Memory which using unique electrical architecture allows the
memory to hold its memory state without power
Startup file ASCII file which has a series of text commands that are executed
one line at a time. It is the first file that the controller will execute
if there is no Opexec file found on the controller during the startup
sequence.
Opexec Binary file which if installed is the first executable file that the
controller will execute.
40