README.OpenSwitch12
Created by David Rowe 14/6/02

How to get started with the OpenSwitch12.

For historical reasons the OpenSwitch12 is also known as the V12PCI card, 
and the High Density Analogue (HDA) card.  These terms may be found in
the source code.

Hardware Configuration
----------------------

The OpenSwitch 12 card has 12 ports, divided into Bank A (8 ports), and
Bank B (4 ports).  Each bank can be individually configured as either loop
start (FXO) or station ports (FXS).

Bank	Ports	Configuration	Insert Headers
A	0..7	Loop Start	none
B	8..11	Loop Start	none
A	0..7	Station		JS1, JS2, JS5, JS6, H1-H16 inclusive
B	8..11	Station		JS3, JS4, JS8, JS7, H17-H24 inclusive

A typical configuration is to have Bank A configured for station
ports, and Bank B configured for loop start.  This provides 8 extensions
(station ports) and 4 external lines (loop start ports).

WARNING: - please double check your configuration.  Connecting a station
port to a loop-start phone line may damage the OpenSwitch12 and upset
your Telco.

Fail Over
---------

When power is removed from the OpenSwitch12 ports 0..3 will automatically
be connected to ports 8..11.  This provides automatic bypass for external
lines to extensions, for example during a power blackout or host PC failure.
Fail over is most useful when the OpenSwitch12 is configured for PBX
applications (e.g. Bank A station/Bank B loop start).

To enable fail over, insert headers H27-H34 inclusive.

Port Wiring
-----------

J1 - ports 0..3  (Bank A)
J2 - ports 4..7  (Bank A)
J3 - ports 8..11 (Bank B)

On each connector standard CAT-5 phone wiring EIA (TIA) 568A is used:

			J1	J2	J3
pair 1: pins 4 & 5	port 0	port 4	port 8
pair 2: pins 3 & 6	port 1	port 5	port 9
pair 3: pins 1 & 2	port 2	port 6	port 10
pair 4: pins 7 & 8	port 3	port 7	port 11
 
Software Quick Start
--------------------

1) From this dir 'make' (should make libvpb and hdafifo)
2) then 'make install'
3) cd to src
4) login as root, 'insmod vpbhp.o' - after this step a 'major number' will 
be printed to the
console, use this number in the next step.  
5) If you dont see anything printed out after 'insmod vpbhp.o', type 'dmesg',
and look for the 'major number'.
6) 'mknod /dev/vpbhp0 c 254 0' - note this example assumes the major number was 254.
7) chmod a+w /dev/vpbhp0 (allows all users to use vpb-driver)
7a) (Optional) If u wish u can logout as root here.
7b) (Check) If you type 'cat /proc/interrupts' a few times you should see the 
    number next to the 'vpbhp' entry incrementing about 1000 times every second.
    This tells us that the hda driver is processing interrupts.
8) (Optional) 'export VPB_MODEL=V12PCI', this specifies the hardware type for 
the user-mode driver.  If you have no other Voicetronix cards installed, then 
the hardware card will be detected automatically.
9) cd to unittest, and try these test programs

   - 'make tring' 
     './tring'
     This program will detect station card hook status (station ports) and 
     detect ring (loop start ports)

   - 'make recwav'
     './recwav test.wav 1 3' will record 3 seconds of audio from
     port 0 (1 maps to port 0, sorry for the inconsistency :-) ), and
     assumes port 0 is a station port

   - ' make playwav'
     './playwav test.wav 1' will pl;ay test.wav to port 0, 
     assuming it is configured as a station port

   - 'make tpbx'
     './tpbx' is a simple pbx application

