\documentclass[a4paper,german]{article}
\usepackage{linuxdoc-sgml}
\usepackage{qwertz}
\usepackage{url}
\usepackage[latin1]{inputenc}
\usepackage{t1enc}
\usepackage{babel}
\usepackage{epsfig}
\usepackage{null}
\def\addbibtoc{
\addcontentsline{toc}{section}{\numberline{\mbox{}}\relax\bibname}
}%end-preamble
\setcounter{page}{1}
\title{APD-2 + \"OBB X25 HOWTO
   }
\author{      Heimo Sch\"on \onlynameurl{{$<$}heimo.schoen@gmx.at{$>$}}
   }
\date{Version 0.7 , 14. October 1999
   }
\abstract{     Setup a \onlynameurl{RAD} PAD
     \onlynameurl{APD-2}
     to work in a \"OBB X25 environment
   }


\begin{document}
\maketitle

\section{Overview
   }


\subsection{About this HOWTO
    }

This document describes how to use the PAD built by 
\onlynameurl{RAD}. We use the 
\onlynameurl{APD-2} in a
special configuration for the Austrian Federal Railways
\onlynameurl{\"OBB}. The \"OBB X25
protocol is described in the "\"OBB X25 Pflichtenheft". This
protocol specifies the Layer 4 to 7 for vital and not-vital
comunication between railway-station equipment (e. q. interlocking, etc.).
The \"OBB X25 protocol specification uses the CCITT X.25 / X.21 
communication and uses PVC 1 for channel A and PVC 2 for channel B
transmission.

The two-channel transmission in channel A and channel B is used
for raising the safety of the connection. In channel B the data
is transmitted inverted. For more details cunsult the "\"OBB X25
Pflichtenheft".

Special thanks to Ing. Johann Berger 
\onlynameurl{{$<$}j.berger@online.edvg.co.at{$>$}}
for the help on getting
the first APD-2 and a complete X.25 testconfiguration
with Datus-PADs and X.25 Modems (Nokia SB64 and Siemens DAG64 types).

For details to the \"OBB X25 specification you should contact Johann Berger.

Thanks to Michael Smutka
\onlynameurl{{$<$}michael.smutka@teleweb.at{$>$}}
for his ideas and reviewing this document and the code.

If you have any suggestions to this document, than feel
free to contact me:

\begin{itemize}
\item Heimo Sch\"on \onlynameurl{{$<$}heimo.schoen@gmx.at{$>$}}
\item \onlynameurl{http://fly.to/heimo.schoen}
\end{itemize}


Have a lot of fun with this easy to use, easy to configure
and very small X.25 PAD APD-2 from RAD.






\subsection{Test configuration}

For testing the configuration in this document I used
the following testequipment:



\begin{tscreen}
\begin{verbatim}
            +-------+ +-------+
            |       |-|       |
 ch. A -----|       |V|MIC-24T|     +-----+
            | APD-2 |2| /21C  |-----|Modem|~~~~~~~~~~~~~~~+
 ch. B -----|       |4|       |     +-----+               |
            |       |-|       |                           |
            +-------+ +-------+               2-wire      |
                                              longdistance|
            +-------------+                   connection  |
            |             |                               |
 ch. A -----|             |         +-----+               |
            | Datus-PAD   |---------|Modem|~~~~~~~~~~~~~~~+
 ch. B -----|             |         +-----+
            |             |
            +-------------+

       APD-2 ........ PAD with two V.24(8pin-RJ45)/X.28 connectors
                      and one V.24(25pin-SUB-D)/X.25 connector
                      manufactored: RAD
       MIC-24T/21C .. Converter V.24(25pin-SUB-D) to
                      X.21(15pin-SUB-D) connector
                      manufactored: RAD
       Modem ........ X.21 Modem with 64 kBit/sec
                      e.q.: Nokia SB 64k
                            or
                            Siemens DAG 64
       Datus-PAD .... 5820 with 2 V.24 connectors and 1 X.21
                      connector
     
\end{verbatim}
\end{tscreen}




On channel A and B on both ends of the testconfiguration
(Datus-PAD and APD-2) we connected the Testrechner TR 
application, which you also can find on my homepage. You
may use any other applications with V.24 connection
with 19.200 baud, no parity, 8 Bit, 1 Stopbit.






\subsection{Version History
    }

\begin{itemize}
\item  0.1 01 Oct 1999 Cable Pin Diagram
\item  0.2 02 Oct 1999 First Pictures
\item  0.3 03 Oct 1999 Comparison Datus-Parameter with
RAD-Parameter and description of 
how configuring the RAD-PAD
\item  0.4 07 Oct 1999 description of the c-programm and
the parameter-input-script rad.cmd
\item  0.5 11 Oct 1999 Textfile to SGML
\item  0.6 12 Oct 1999 Minor text changes and release
\item  0.7 14 Oct 1999 Changes, corrections and ideas
from Michael Smutka.
Candidat for version 1.0
\end{itemize}











\section{HW connection to your RAD-PAD
   }


\subsection{Cable for RAD-PAD
    }

Build a cable with the following pinout:

  

\begin{tscreen}
\begin{verbatim}
       RJ 45 connector             9-pin  D-SUB
            +----+                 female  male
 CTS        |  8 |------------------- 8      4
 Sig.Gnd. +-+  7 |------------------- 5      5
 DTR      |    6 |------------------- 4      8
 TxD      |    5 |------------------- 3      2
 DCD      |    4 |------------------- 1      7
 RxD      |    3 |------------------- 2      3
 RTS      +-+  2 |------------------- 7      1
 Chass.Gnd. |  1 |-------------------- cover
            +----+


       RJ 45 connector              25-pin D-SUB
            +----+                  female  male
 CTS        |  8 |------------------- 5      20
 Sig.Gnd. +-+  7 |------------------- 7       7
 DTR      |    6 |------------------- 20      5
 TxD      |    5 |------------------- 2       3
 DCD      |    4 |------------------- 8       4
 RxD      |    3 |------------------- 3       2
 RTS      +-+  2 |------------------- 4       8
 Chass.Gnd. |  1 |------------------- 1       1
            +----+

(RJ45 connector view from frontside - cable goes into the paper)
      
\end{verbatim}
\end{tscreen}











\subsection{Description of the RJ45 Pins}

\begin{tscreen}
\begin{verbatim}
8  CTS          Clear to Send
                A positive level vorm PAD indicates that
                the terminal is allowed to send data.
                (only for Hardware-Flow-Control; isnīt
                in use in this configuration)
7  Sig.Gnd.     Signal Ground
                Common signal and DC power supply ground
6  DTR          Data Terminal Ready
                Used for end-to-end flow control.
                positive level from DTE, when it is ready
                (not in use in this configuration)
5  TxD          Transmit Data (this is the PADs input!!!)
                here the PAD receives the transmitted
                data from the other source
4  DCD          Data Carrier Detect
                Posoitive level from PAD whe the local
                and remote system are synchronized
3  RxD          Receive Data (this is the PADs output!!!)
                The other system receives on this pin
                the data from the PAD
2  RTS          Received by PAD from DTE, controls DCD at
                remote side.
1  Chass.Gnd.   Protective Chassis Ground
                (may be isolated from signal, or connected
                to it)
     
\end{verbatim}
\end{tscreen}


Connect the cable for example to CH2 of the RAD-PAD 
and on the other hand e.g. to ttyS1 (COM2) of your Linux
box.








\section{SW connection to your RAD-PAD
   }


\subsection{Terminalemulation minicom}

Start minicom on your linuxbox. You can type 
minicom com2, when you create the following minicom
configuration file:

\begin{tscreen}
\begin{verbatim}
# file: /etc/minicrc.com2
#
# this minicom configuration file is used to make
# a connection to a RAD-PAD via ttyS1 (COM2)
#
# Machine-generated file - use "minicom -s" to change parameters.
#
pr port             /dev/ttyS1
pu baudrate         9600
pu rtscts           No            
     
\end{verbatim}
\end{tscreen}











\section{Entering into your RAD-PAD
    }


\subsection{main menu}

After you connected your cable as described above, and
you started your minicom, you should receive a prompt
from your RAD-PAD. It should be a single "*".

If you didnīt receive this prompt, you should press CTRL+P
to exit the transfer-mode and obtain the PAD-prompt. Now
you should type 

\begin{tscreen}
\begin{verbatim}
CLR<CR> to disconnect the call.
     
\end{verbatim}
\end{tscreen}




Now verify that the PAD is free by typing the command 
\begin{tscreen}
\begin{verbatim}
STAT<CR>
     
\end{verbatim}
\end{tscreen}


When you can see the PAD-Prompts * sign you can connect
to the main-menue by typing 
\begin{tscreen}
\begin{verbatim}
CON 00<CR> 
     
\end{verbatim}
\end{tscreen}

or 
\begin{tscreen}
\begin{verbatim}
C 0<CR>
     
\end{verbatim}
\end{tscreen}


Now you
receive the following screen:

\begin{tscreen}
\begin{verbatim}
----------------------------------------------------------------------------------
      MAIN MENU
     -----------
   1) CONFIGURE
   2) SYSTEM CONTROL
   3) DIAGNOSTICS
   4) STATUS and STATISTICS
   5) LOGOUT

    Select: 
----------------------------------------------------------------------------------
     
\end{verbatim}
\end{tscreen}





\subsection{system status}

You can few your PADs status by choosing 4:

\begin{tscreen}
\begin{verbatim}
----------------------------------------------------------------------------------
                              SYSTEM  STATUS
                    --------------------------------------
Device ID: 0
Device MAC ADDRESS: 0020 D209 1DFE
RAM Size:           512  KByte              Free DATA buffers:      270
NOVRAM Size:         8   KByte              MIN DATA buffers in pool:  263
NOVRAM Utilization: 8  %

Par\Lnk|  1  |  2  |  3  |
-------|-----|-----|-----|
PROTOC |X.25 |X.28 |X.28 |
Sync   | NO  |     |     |
S loss |  0  |     |     |
I Pkts |  0  |  4  |  0  |
--------------------------

                      MAIN  STATUS and STATISTIC MENU
 1 - 3) Sync Links  A) Async Channels  P) Protocols  R) Refresh  <CR>) Exit

 Select option:                                                      
----------------------------------------------------------------------------------
     
\end{verbatim}
\end{tscreen}







\subsection{link 1 status}

For example the link 1 should bring:

\begin{tscreen}
\begin{verbatim}
----------------------------------------------------------------------------------
 DEVICE ID: 0
                   X.25 Link 1 Statistics
                  ------------------------------------------
 Protocol: X.25          Sync Status: NOT SYNC      Transmission Mode: DTE

 DRIVER (L1):                          X.25  (L3):
-------------     Tx         Rx      -------------        Tx         Rx
  Frames          0          0             I Packets      0          0
  Error           0          0             Clear          0          0
  R_FRAMEs in pool     53                  Reset          0          0
  Idle: OFF   CTS: ON                      Restart        0          0
                                           Packet size           128
 LAPB (L2):                                LGN                    0
-----------       Tx         Rx
  I Frames        0          0             LCN Type | LCNs  | Act | I Packets
  RR              0          0             ---------|-------|-----|----------
  RNR             0          0             Incoming | 1 - 5 |  0  |    0
  REJ             0          0             Two way  | 6 -10 |  0  |    0
  FRMR            0          0             Outgoing |11 -15 |  0  |    0
  N(S) errors     0
  State       DISCONNECTED PHASE
  Frame size            4108

  PRESS:  R - Refresh,         <CR> - EXIT:                   
----------------------------------------------------------------------------------
     
\end{verbatim}
\end{tscreen}







\subsection{link 2 status}

and link 2 should look like:

\begin{tscreen}
\begin{verbatim}
----------------------------------------------------------------------------------
 DEVICE ID: 0

                     Asynchronous    Channels   Status

-----------------------
 Param \ Chan |   2   |
--------------|-------|
Status        |  ENG  |
--------------|-------|
No of act LCNs|   1   |
I Packets     |  19   |
--------------|-------|
Autocall ID   | NONE  |
--------------|-------|
HW signal     |Unused |
--------------|-------|
BUFs to Netwrk|   1   |
BUFs to User  |   0   |
--------------|-------|
Tx Xoff       |  NO   |
Rx Xoff       |  NO   |
-----------------------

Enter Channel Number to Zoom,  R - Refresh,  NN:NN - Range,  <Q> - QUIT:
----------------------------------------------------------------------------------
     
\end{verbatim}
\end{tscreen}





\subsection{device status}

and on device 0 the channel 0 you should see this:

\begin{tscreen}
\begin{verbatim}
----------------------------------------------------------------------------------
                                              DEVICE ID: 0

                          CHANNEL  0    SESSION  1
                        ----------------------------
  Sub address : 0    ,  0             Profile No : 1     Transmit Xoff  : NO
                                      Page wait : OFF    Received Xoff  : NO
ses| LCN | Connected to  | I Packets  HW sig : Unused    BUFs to Network: 0
---|-----|---------------|----------  Type : SVC         BUFs to User   : 0
> 1|LOCAL|               |     0                         BUFs Outstand  : 0
  2|    N O T   A C T I V E                        Autocall ID : 0
  3|    N O T   A C T I V E                        State : DATA TRANSFER
  4|    N O T   A C T I V E                        Connection status : ENG


                      Current profile parameters :
1)rec chr:1     8)dis_out:0    15)edit   :1     22)p_wait :0    106)ch_brk :0
2)echo   :1     9)cr_pad :0    16)ch_del :127  100)bit/ch :3    107)ch_supp:0
3)d forw :2    10)l_fold :0    17)l_del  :24   101)dv_part:0    108)ch_subs:0
4)idl_t  :0    11)speed  :14   18)l_dis  :18   102)stp_bit:0    109)FF_pad :0
5)dv_flw :2    12)pad_flw:1    19)e_ser_s:2    103)s_flow :0    110)inactiv:0
6)s_sig  :5    13)autolf :4    20)echo_m :0    104)cnt_for:0    111)options:0
7)brk    :4    14)lf_pad :0    21)part_tr:3    105)esc_del:0    112)clr_tim:0

  PRESS:  1..4 - Session No,    R - Refresh,    ? - Help,    <CR> - EXIT:      
----------------------------------------------------------------------------------
     
\end{verbatim}
\end{tscreen}











\section{Configuration for OeBB PAD Mode
   }


\subsection{Warning
    }

In this chapter I want to show all parameters which have to be changed.
But be carefully, the chapters follow the APD-2 Handbook and not the way
how the configuration works really. The reason is, that if you would change
the asynchronous link first, you would loose the connection to the
configuration menue. Therefore you should use the automatic configuration
tool I wrote, or you should read carefully what the automatic configuration
program does really.




\subsection{start configuration
    }

Enter the configuration menue with typing 

\begin{tscreen}
\begin{verbatim}
     1<CR>
    
\end{verbatim}
\end{tscreen}


You should receive the following view:

\begin{tscreen}
\begin{verbatim}
----------------------------------------------------------------------------------
      Configuration menu
     --------------------
   1) Channel
   2) Profile
   3) Link
   4) System parameters
   5) PVC
   6) Call ID
   7) NUI
   8) Alias
   9) Routing table
  10) Funnel
  11) X.32
  12) Management
  13) X.25 Multicast
  14) IP Routing
  15) ISDN configuration
  CR) Exit

    Select:                        
----------------------------------------------------------------------------------
     
\end{verbatim}
\end{tscreen}


In the following chapters 4.1 to 4.15 I try to 
describe, which settings you need for a proper
OeBB X25/X.25/X.21 Connection.








\subsection{Channel configuration
    }

Press 

\begin{tscreen}
\begin{verbatim}
    1<CR> 
    
\end{verbatim}
\end{tscreen}


to enter the channel configuration

Press 

\begin{tscreen}
\begin{verbatim}
    5<CR>
    
\end{verbatim}
\end{tscreen}


to check channel types. You should see
the following:

\begin{tscreen}
\begin{verbatim}
----------------------------------------------------------------------------------
Chan |  2  |  3  |
-----|-----|-----|
Prot |X.28 |X.28 |
----------------------------------------------------------------------------------
     
\end{verbatim}
\end{tscreen}


Change the channel types of link 2 and 3 if not
X.28 Protocol set. Afterwards go back to configuration
menue by pressing and change to menue update channel
by typing 



\begin{tscreen}
\begin{verbatim}
     3<CR> 
    
\end{verbatim}
\end{tscreen}




and enter channelnumber 



\begin{tscreen}
\begin{verbatim}
     2<CR>
    
\end{verbatim}
\end{tscreen}






\begin{tscreen}
\begin{verbatim}
----------------------------------------------------------------------------------
      Channel   2  configuration
     -----------------------------
   1) Profile number ................. [  2  ] <===
   2) Outgoing call profile number ... [  0  ]
   3) Incoming call profile number ... [  0  ]
   4) Remote profile number .......... [  0  ]
   5) Autocall ID  ................... [  0  ]
   6) Alternate autocall ID .......... [  0  ]
   7) Autocall retries ............... [ 10  ]
   8) Autocall retry interval ........ [  5  ]
   9) Call alias ..................... [  0  ]
  10) Sub address 1 ...................[  2  ]
  11) Sub address 2 ...................[  0  ]
  12) NUI Group ID ................... [  0  ]
  13) Clear timer .................... [  0  ]
  14) Options ........................ [128  ] <===
   S) Save
  CR) Exit
----------------------------------------------------------------------------------
     
\end{verbatim}
\end{tscreen}


Change the parameters to the above settings.

Attention: Donīt foreget to save the changes with

\begin{tscreen}
\begin{verbatim}
     S<CR> !!!
    
\end{verbatim}
\end{tscreen}




After changing the parameters, duplicate line
2 to line 3 by typing 

\begin{tscreen}
\begin{verbatim}
----------------------------------------------------------------------------------
        1<CR>           duplicate channel
        2<CR>           source channel
        3:3<CR>         destination channel range
----------------------------------------------------------------------------------
     
\end{verbatim}
\end{tscreen}


This commands duplicate channel 2 to the range of channels 3 to channel 3.








\subsection{Profile configuration
    }

Enter the profile configuration for profile 1 with
typing 

\begin{tscreen}
\begin{verbatim}
    2<CR> 
    
\end{verbatim}
\end{tscreen}


and 

\begin{tscreen}
\begin{verbatim}
    3<CR> 
    
\end{verbatim}
\end{tscreen}


in the configuration menue.
You get the following view:



\begin{tscreen}
\begin{verbatim}
----------------------------------------------------------------------------------
      Profile 1    configuration
     -----------------------------
 1) Recall char ........... [0    ]        20) Echomask ............ [0    ]
 2) Echo .................. [0    ]        21) Parity treat ........ [0    ]
 3) Data forward char ..... [0    ]        22) Page wait ........... [0    ]
 4) Idle timer............. [2    ] <===  100) Bits/char ........... [3    ]
 5) Device flow control ... [0    ] <===  101) Dv_parity ........... [0    ]
 6) Service signal ........ [0    ]       102) Stop bits ........... [0    ]
 7) Break ................. [0    ] <===  103) Special flow ........ [0    ]
 8) Discard output ........ [0    ]       104) Count fwd ........... [0    ]
 9) CR padding ............ [0    ]       105) Esc_delay ........... [0    ]
10) Line folding .......... [0    ]       106) Character break ..... [0    ]
11) Speed ................. [15   ] <===  107) Character suppress .. [0    ]
12) Pad flow control ...... [0    ] <===  108) Character substitute  [0    ]
13) Linefeed insertion .... [0    ]       109) Form feed padding ... [0    ]
14) Linefeed padding ...... [0    ]       110) Inactivity .......... [0    ]
15) Editing ............... [0    ]       111) Options ............. [0    ]
16) Character delete ...... [0    ]       112) Clr Timer ........... [0    ]
17) Line delete ........... [0    ]       113) Subaddress in CUD ... [2    ]
18) Line display .......... [0    ]       114) DNIC ................ [0    ]
19) Edit service signals .. [0    ]         C) Copy
                                            S) Save      CR) Exit             
----------------------------------------------------------------------------------
     
\end{verbatim}
\end{tscreen}


When you changed all parameters of profile 1, than save
the profile with 

\begin{tscreen}
\begin{verbatim}
     S<CR> 
    
\end{verbatim}
\end{tscreen}


and leave to the profile configuration
menue.










\subsection{Link configuration}

Enter the link configuration for link 1 by activating fuction
"3 Link" in the configuration menue and function "3 Update Link parameters" in the link configuration menue. You 
get the following view:

\begin{tscreen}
\begin{verbatim}
----------------------------------------------------------------------------------
    X.25 Link 1    configuration
   ------------------------------
 1) Address ............... [0    ]
 2) DCE (1) / DTE (0)...... [0    ]     17) LGN ...................... [0    ]
 3) Extended mode ......... [0    ]     18) Lowest LCN (LIC) ......... [3    ] <===
 4) T1 .................... [5    ]     19) Amount of Incoming LCNs .. [5    ]
 5) T3 .................... [20   ]     20) Amount of Two Way LCNs ... [5    ]
 6) N2 .................... [10   ]     21) Amount of Outgoing LCNs .. [5    ]
 7) k ..................... [7    ]     22) Internal Clock ........... [0    ]
 8) w ..................... [2    ]     23) LINE option .............. [1024 ]
 9) T10 ................... [18   ]     24) Segment Size.............. [128  ]
10) T11 ................... [20   ]     25) Xid num .................. [0    ]
11) T12 ................... [18   ]     26) NUI Group ID ............. [0    ]
12) T13 ................... [18   ]     27) Physical interface option. [0    ]
13) Packet size ........... [128  ]     28) CUG subscription ......... [5    ]
14) In call options ....... [1    ]     S) Save
15) Out call options ...... [1    ]     CR) Exit
16) Subaddress length ..... [2    ]
----------------------------------------------------------------------------------
     
\end{verbatim}
\end{tscreen}


When you changed all parameters of link configuration, than save
the configuration with 
\begin{tscreen}
\begin{verbatim}
     S<CR>
     
\end{verbatim}
\end{tscreen}

and leave to the link configuration
menue.

        








\subsection{Systemparameter configuration
     }

Enter the systemparameter configuration by choosing
function "4 System parameters" in the configuration menue. You get the 
following view:

\begin{tscreen}
\begin{verbatim}
----------------------------------------------------------------------------------
      System parameters configuration
     ---------------------------------
   1) Device ID............................. [0    ]
   2) X.28 prompt .......................... [*    ]
   3) User password ........................ [XXXXXXXXXX]
   4) Super user password .................. [XXXXXXXXXX]
   5) Herald ............................... [CHANNEL NUMBER ]
   6) Bulletin ............................. [     ]
   7) Command port sub-address ............. [0    ]
   8) Command port alternate sub-address ... [0    ]
   9) Inner communication length ........... [2    ]
  10) Xon .................................. [17   ]
  11) Xoff ................................. [19   ]
  12) Max LCN .............................. [45   ]
  13) Max AIDs per link .................... [251  ]
  14) Async Handshake Sequence ............. [;    ]
   S) Save
  CR) Exit
                 Select:                      
----------------------------------------------------------------------------------
     
\end{verbatim}
\end{tscreen}


Normaly there should be nothing to change. If
you checked the systemparameters leave this 
screen and go back to the main menue.

        








\subsection{PVC configuration}

Enter the PVC configuration by choosing "5 PVC"
in the configuration menue. In the first step you 
should check if there exists a empty pvc-configuration
table. You can view the configured pvcs by choosing 
"4 Display  PVC s" in the PVC configuration menue. 
You should receive the following picture:



\begin{tscreen}
\begin{verbatim}
----------------------------------------------------------------------------------
par   \   PVC     |
------------------|
Source Link       |
Source Channel/LCN|
Destination Link  |
Destination LCN   |

   Press <RETURN> to continue          
----------------------------------------------------------------------------------
     
\end{verbatim}
\end{tscreen}


If your PVC-configuration dosnīt look like this you
should follow the reset procedure described at the
end of this document and reset all parameters in the
PAD and start again from the beginning with the setup
procedure.

For OeBB X25 we need on the X.25 link two PVCs. In the
next step we connect logicaly the two physikal links
2 and 3 to the first two PVCs on the physokal link 1,
which is the X.25 connector. Links 2 and 3 are V.24/X.28
PAD Links to the OeBB X25 Applikation.

\begin{tscreen}
\begin{verbatim}
----------------------------------------------------------------------------------
1<CR>                   add PVC
1<CR>                   PVC number 1
1<CR>                   Local PVC
1<CR>2<CR>              from channel 2
2<CR>1<CR>              to channel 1
3<CR>1<CR>              PVC 1
s<CR>                   save configuration
<CR>                    leave to pvc-config-menue

1<CR>                   add PVC
2<CR>                   PVC number 2
1<CR>                   Local PVC
1<CR>3<CR>              from channel 3
2<CR>1<CR>              to channel 1
3<CR>2<CR>              PVC 2
s<CR>                   save configuration
<CR>                    leave to pvc-config-menue
----------------------------------------------------------------------------------
     
\end{verbatim}
\end{tscreen}




By choosing "4 Display  PVC s" in the PVC configuration 
menue you should receive the following configuration:



\begin{tscreen}
\begin{verbatim}
----------------------------------------------------------------------------------
par   \   PVC     | 1   | 2   |
------------------|-----|-----|
Source Link       |LOCAL|LOCAL|
Source Channel/LCN| 2   | 3   |
Destination Link  | 1   | 1   |
Destination LCN   | 1   | 2   |

   Press <RETURN> to continue                  
----------------------------------------------------------------------------------
     
\end{verbatim}
\end{tscreen}







\subsection{Call ID configuration}

Normaly we donīt use Call IDs! Nothing to change here.

        




\subsection{NUI configuration}

Normaly we donīt use NUI! Nothing to change here.
(NUI = Network User ID)




\subsection{Alias configuration}

Normaly we donīt use aliases! Nothing to change here.




\subsection{Routing table configuration}

Normaly we donīt use routing tables! Nothing to change here.




\subsection{Funnel configuration}

Normaly we donīt use the funnel facility! Nothing to change here.




\subsection{X.32 support configuration}

Normaly we donīt use X.32! Nothing to change here.




\subsection{Management configuration}

Normaly we donīt use SNMP or Event-Reporting! 
Nothing to change here.




\subsection{X.25 Mulit Cast configuration}

Normaly we donīt use X.25 Multi Cast! Nothing to change here.




\subsection{IP Routing configuration}

Normaly we donīt use IP addresses! Nothing to change here.




\subsection{ISDN configuration}

Normaly we donīt use ISDN! Nothing to change here.




\section{Resetting / Troubleshooting}

If you configured your PAD in the above described way, and
the PAD dosnīt do what you indent that it should do, and 
you lost the connection to your PAD, because it is now
a transparent PAD and dosnīt accept your terminalemulation
connection, then you should do the following steps:





\begin{itemize}
\item plug off all connectors from your PAD (realy all: even the powersupply)
\item unscrew the housing of your PAD
\item switch jumper to possition INT
\item connect power-supply and wait approx. 1 Minute till
the sync-LED starts blinking
\item plug off power-supply
\item switch jumper to position NORMAL
\item reconnect all your connectors and the 
power supply
\end{itemize}


With this steps all your configurations your did before,
are lost. All RAD-PADs factory defaults are restored and
you can restart configuration procedure with a "clean" 
RAD-PAD.










\section{automatic configuring}


\subsection{Overview}

In the following chapters you find a small C-Program for
auto configure the APD-2. There is also the Makefile
the startscript and the inputscript which is read from
the C-program rad.c.




\subsection{rad.c}

\begin{tscreen}
\begin{verbatim}
/* 
* rad.c
*
* input parser for PAD-configuration scripts
* ==========================================
*
#
# Copyright (C) 1999 Heimo Schön <heimo.schoen@gmx.at>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
*/

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <assert.h>
#include <signal.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/ioctl.h>

int inputpid=0;

static int source_fh = 0;       // Filehandle
static int input_fh  = 0;       // Filehandle
static int out_fh    = 0;       // Filehandle
static int log_fh    = 0;       // Filehandle
unsigned char stty_buffer[10000];
unsigned char out_buffer[10000];
unsigned char source_buffer[10000];

void p_usage()
{
  fprintf(stderr, "  \n");
  fprintf(stderr, "  rad <command-file> <device>\n");
  fprintf(stderr, "  \n");
  fprintf(stderr, "       <command-file> filename of a file with\n");
  fprintf(stderr, "                      PAD-parameters; one command\n");
  fprintf(stderr, "                      in each line\n");
  fprintf(stderr, "  \n");
  fprintf(stderr, "       <device>       the serial device where rad can\n");
  fprintf(stderr, "                      find the PAD\n");
  fprintf(stderr, "  \n");
  fprintf(stderr, "  example:  rad test /dev/ttyW7\n");
  fprintf(stderr, "  \n");
}

void startinput()
{
  unsigned char in_buffer[10000];
  int rece = 0;

  in_buffer[0] = 0;

  if ( ( inputpid = fork() ) == 0 ) {
    while (1) {
      if ((rece = read(input_fh, in_buffer, 1024)) > 0) {
        in_buffer[rece] = 0;
        if (log_fh > 0)
          write(log_fh, in_buffer, strlen(in_buffer));
        fprintf(stdout, "%s", in_buffer);
        in_buffer[0] = 0;
      }
    }
  }
  fprintf(stdout, "reader forked with pid %d\n", inputpid);
}



void p_io()
{
  int rece = 0;
  char command[10000];
  int com_p = 0;

  while ( (rece = read(source_fh, source_buffer, 1)) == 1) {
    if (source_buffer[0] == '\n') {
      command[com_p] = 0;
      if (command[0] != '#') {
        sprintf(out_buffer, "%s\r",command);
        write(out_fh, out_buffer, strlen(out_buffer));
        com_p = 0;
        sleep(2);
      } else {
        command[com_p] = '\n';
        command[com_p+1] = 0;
        if (log_fh > 0)
          write(log_fh, command, strlen(command));
        fprintf(stdout, "%s", command);
        com_p = 0;
      }
    } else {
      command[com_p] = source_buffer[0];
      com_p++;
    }
  }
}

// -----------------------------------------------------------------------
int main (int argc, char *argv[])
{
  if (argc >= 3) {
    if (argc == 4)
      log_fh  = open (argv[3], O_WRONLY);
    source_fh = open (argv[1], O_RDONLY);
    out_fh    = open (argv[2], O_WRONLY);
    input_fh  = open (argv[2], O_RDONLY);
    sprintf(stty_buffer, 
            "stty 9600 -echo raw < %s  ", 
            argv[2]);
    fprintf(stdout,"%s\n",stty_buffer);
    system(stty_buffer);
  } else
    out_fh = 0;

  if (out_fh > 0) {
    startinput();                // fork the reader process
    p_io();                      // the command process
    kill(inputpid, SIGKILL);
  } else {
    p_usage();
  }  
}
     
\end{verbatim}
\end{tscreen}









\subsection{Makefile}

 The following listing should be copied into a file 
named Makefile. Afterwards you can type 
make clean ; make all ; make strip

\begin{tscreen}
\begin{verbatim}
      LDOPTIONS = -pedantic -Wall -g -DYY_SKIP_YYWRAP


                    OBJS = rad.o
                    SRCS = rad.c

all:    rad
        sudo chown root rad
        sudo chmod a+srw rad
 
rad:  $(OBJS) $(DEPLIBS)
        $(RM) $@
        $(CC) -o $@ $(LDENTRY)  $(OBJS) $(LDOPTIONS)  $(LIBS) $(LDLIBS) $(EXTRA_LOAD_FLAGS)

rad.stripped: rad
        $(CP) $< $@
        $(STRIP) $@

strip:: rad.stripped

clean::
        $(RM) rad *.o

depend::
        @if [ -n "$(SRCS)" ] ; then set -x;\
        $(DEPEND) $(DEPENDFLAGS) $(SRCS) ;\
        fi
     
\end{verbatim}
\end{tscreen}









\subsection{configuration script makerad}

Copy the following lines into a file named makerad. Dontīt
forget to chmod the script: chmod a+x makerad

\begin{tscreen}
\begin{verbatim}
#! /bin/bash
#
# makerad - configuring a RAD-PAD
#
# Copyright (C) 1999 Heimo Schön <heimo.schoen@gmx.at>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#

if [ $1 ] ; then
  if [ -e /dev/$1 ] ; then
    echo Send DATUS config to device /dev/$1
    export DATDEV=/dev/$1

        rad rad.cmd $DATDEV | tee rad.log

  else
    echo Could not find device /dev/$1
    echo "    example : $0 ttyS0"
  fi;
fi;
     
\end{verbatim}
\end{tscreen}









\subsection{Parameterscript}

Here you can find the complete Parameterscript for
configuring the APD-2. Check if you didnīt delete
blank lines in the following file. The blank lines
are very importent, because they generate a single
CARIAGE-RETURN for navigating in the PAD-Menues. After
the configuration is finished you have no connection
to the configuration menue. You have to reset the
APD-2 and to connect it to the testapplication.

\begin{tscreen}
\begin{verbatim}
#
# commandfile for configuring a RAD - PAD
#
# Copyright (C) 1999 Heimo Schön <heimo.schoen@gmx.at>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#
# Switching the PAD to Configuration Mode
C0

1
#
# =========================================
#
# Configuring the X.25 Link
3
3
# Par 18 to 3 = Lowest incoming LCN = 3
18
3
# Par 14 to 16 = assume PVC down on sync
#14
#16
# save it
s



#
#
# =========================================
#
# Making the PVC configuration
5
# add PVC 
1
# add PVC 1
1
# local PVC
1
# Line (channel) 2
1
2
# Link (channel) 1
2
1
# LCN logical channel number 1
3
1
# save and back again
s



#
#
#
# add PVC 
1
# add PVC 2
2
# local PVC
1
# Line (channel) 3
1
3
# Link (channel) 1
2
1
# LCN logical channel number 1
3
2
# save and back again
s






#
#
# =========================================
#
# back to config menue
1
# Update Profile 2
2
3
2
# Par 4 auf 1
4
2
# Par 5 auf 0
5
0
# Par 7 auf 0
7
0
# Par 11 auf 15
11
15
# Par 12 auf 0
12
0
# Par 110 auf 1
#110
#1
# save and out
s






#
#
# =========================================
#
# load channel 2 and 3 with Profile 2
#
# back to config menue
1
# load channel 2 with Profile 2
1
3
2
1
2
# save and out
s







# back to config menue
1
# load channel 3 with Profile 2
1
3
3
1
2
# save and out
s






# Action done
#
# =========================================
     
\end{verbatim}
\end{tscreen}















\section{Disclaimer}


\subsection{Comments}

I would appreciate (but do NOT REQUIRE) that any changes
(bugs, new features or spelling errors) be sent to me for
inspection, discussion and possible inclusion into the next
version.




\subsection{Copyright }

Dieses Dokument ist urheberrechtlich gesch\"utzt. Das Copyright 
liegt bei Heimo Sch\"on. 

Das Dokument darf gem\"a\ss{} der GNU General Public License verbreitet 
werden. Insbesondere bedeutet dieses, da\ss{} der Text sowohl \"uber 
elektronische wie auch physikalische Medien ohne die Zahlung von 
Lizenzgeb\"uhren verbreitet werden darf, solange dieser Copyright 
Hinweis nicht entfernt wird. Eine kommerzielle Verbreitung ist 
erlaubt und ausdr\"ucklich erw\"unscht. Bei einer Publikation in 
Papierform ist der Autor zu informieren. 

This howto is free documentation; you can redistribute it and/or 
modify it under the terms of the GNU General Public License as 
published by the Free Software Foundation; either version 2 of 
the License, or (at your option) any later version. 

This document is distributed in the hope that it will be useful, 
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
GNU General Public License for more details. 

You should have received a copy of the GNU General Public License 
along with this document; if not, write to the: 
Free Software Foundation, Inc., 675
Mass Ave, Cambridge, MA 02139, USA. 











\end{document}
