Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
ACC Programmer's Reference Guide > Chapter 4 ZCOM C I/F Library Routines

zport (3X)

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Index

NAME

zport - ACC interface card port configuration

SYNOPSIS

#include  <zcom/zcomsys.h>
#include <zcom/zcomstatus.h>
#include <zcom/zcomcall.h> /* if compliled with ANSI C (recommended) */

int32 zport (iftno, portno, rcode, action, cnfg, stat)

uint32 iftno;
uint32 portno;
uint32 rcode;
uint32 action;
zpconf_type cnfg
int32 *stat;

DESCRIPTION

Routine zport (action 0-3) configures the datacomm ports on an ACC interface card. This configuration is generally specific to the particular hardware implementation of the card and will vary depending on the card type. It is not usually called from application programs. The calling program (or thread) is suspended while this function is executed. All terminals on the port being changed must be disabled before the port configuration takes place. For example, use zcntl to disable a terminal using rcode 8. Examine your TTGEN configuration file to determine which ports are defined for which ACC interface cards and the terminals associated with each port.

Action 4 is used to activate the Port Break Routine of a the protocol specific firmware. Since Port configuration by-passes the normal terminal transmit queues, this function is used as a software interrupt to the protocol firmware to initiate a recovery process whenever there is a protocol problem and the transmit queues are "blocked up". If the protocol for the specified port does not support this facility, error status 8 is returned in stat.

The libraries libzcom_c.a and libpthread.a must be linked into the calling program by giving the options "-lzcom_c -lpthread" to cc(1) or ld(1).

Threads Considerations

This routine may be called from multi-threaded application using the POSIX (1003.1c) kernel threads API package. It has the following characteristics when called by multi-threaded application:

cancellation point

Thread cancellation can occur when a thread calls this routine.

async-cancel unsafe

The calling thread's cancelability type must be PTHREAD_CANCEL_DEFERRED if cancellation is enabled.

async-signal unsafe

It cannot be called from a signal handler

fork unsafe

It cannot be called by a child process after fork(2) but before exec(2).

PARAMETERS

iftno

ACC MUX interface number.

portno

Port number in the ACC interface card:

0..7

For Z7200A, Z7340A and Z7400A ACC interface cards

0..3

For the Z7300A ACC interface card

0..1

For the Z7350A ACC interface card

rcode

Request code:
1 - Use configuration in interface table
2 - Use data in cnfg

action

Configuration type:

ZCOM_ZMUXPORT_ALL

(0) - Set all modes (all fields)

ZCOM_ZMUXPORT_CONF

(1) - Set Configuration mode only (Ecode, Mode, Parity)

ZCOM_ZMUXPORT_BAUD

(2) - Set Baud Rate mode only (X.Clk, S.Clk, Baud Rate)

ZCOM_ZMUXPORT_PORT

(3) - Set Port mode only (Pmode, Pmode2)

ZCOM_ZMUXPORT_BRK

(4) - Port Break request

stat
(Return Param)

Status returned from the call:

PT_OK

(0) - No error

PT_INV_PORT

(1) - Port number out of range

PT_BAD_PARM

(2) - Bad parameter

PT_NOT_DSBL

(3) - Some terminals in this port not disabled

PT_BAD_BAUD

(4) - Bad baud rate

PT_ILL_SCLK

(5) - Illegal clock source

PT_ILL_PMODE

(6) - Illegal port mode

PT_NO_BREAK

(7) - Port failed self test

PT_NO_BREAK

(8) - BREAK routine not installed

PT_BAD_XCLK

(9) - Clock multiplier not compatible with mode

PT_NO_PLL

(10) - No DPLL available at this baud rate

PT_TOO_FAST

(11) - Async mode not available for baud > 38400

The status message text may be fetched using zcomstatus(3X) (req = ZCOM_MRQCODE_PORT, or 11).
cnfg

Configuration data (32 bits)

The cnfg parameter contains the following information for the Z7200A, Z7400A, Z7340A and Z7350A ACC interface cards:

15

14

13

12

11

10

9

8

7

6

5

4

3

2

1

0

Ecode

Sync

Mode

Parity

X. Clk

S. Clk

Baud 1

Pmode

Pmode2

Baud 2

0 = Not Used

Ecode

Value

Encoding modes

 

0 0

NRZ

 

0 1

NRZI

 

1 0

FM1 (transition = 1)

 

1 1

FM0 (transition = 0)

   

Ecode

Value

Sync mode select

 

0 0

8-Bit sync (monosync)

 

0 1

16-Bit sync (bisync)

 

1 0

SDLC Mode

 

1 1

External sync

   

Ecode

Value

Operating mode

 

0 0

Sync mode

 

0 1

Async 1 stop

 

1 0

Async 1.5 stop bits

 

1 1

Async 2 stop bits

   

Parity

Value

Parity select

 

0 0

No Parity

 

0 1

Odd parity

 

1 0

No Parity

 

1 1

Even parity

   

X.Clk

Value

Clock multiplier

 

0 0

X 1

 

0 1

X 16

 

1 0

X 32

 

1 1

X 64

   

S.Clk

Value

Clock source

 

0 0

External clock

 

0 1

Internal clock from BRG

 

1 0

X.21 clock source

 

1 1

DPPL output (must use BRG as source)

   

The baud rate is split between two 4-bit parameters (for compatibility reasons). If the Baud 1 parameter is 0, then Baud 2 is used. Rates listed in bold are not available on the Z7350A or Z7340A ACC interface cards. The Z7200A card does not support baud rates above 76800 and the Z7400A card does not support rates above 128000.

Baud 1

Value

Rate

Value

Rate

 

0000

Use Baud2

1000

19,200

 

0001

300

1001

38,400

 

0010

600

1010

48,000

 

0011

1,200

1011

57,600

 

0100

2,400

1100

76,800

 

0101

4,800

1101

64,000

 

0110

9,600

1110

128,000

 

0111

14,400

1111

256,000

     

Baud 2

Value

Rate

Value

Rate

 

0000

150

1000

768,000

 

0001

56,000

1001

1,024,000

 

0010

153,600

1010

1,228,800

 

0011

307,200

1011

1,536,000

 

0100

192,000

1100

1,544,000

 

1010

614,400

1101

2,048,000

 

0110

384,000

1110

Reserved
 

0111

512,000

1111

Reserved

Pmode

PmodeValuePmodeValue

Port mode

 

0 0

0 0

RS232 Mode

 

0 1

0 0

RS422 Mode

 

1 0

0 0

Loopback Mode (Tristate)

 

1 1i

0 0

X.21/V.11 Mode

 

0 0

0 1

V.35 (Z7340A and Z7350A only)

 

0 0

1 0

RS-449 (Z7340A and Z7350A only)

 

0 0

1 1

V.36 (Z7340A and Z7350A only)

 

All Other Values

Reserved

The Z7300A or Z7330A E1/T1 card uses the following configuration:

15

14

13

12

11

10

9

8

7

6

5

4

3

2

1

0

Ecode

Fmode

0 = not used

S. Clk

0 = not used

Pmode

0 = not used

0 = Not Used

Ecode

Value

Encoding modes

 

0 0

HDB3 - High Density Bipolar/3 zeros

 

0 1

B8ZS - Bipolar/8 Zero Substitution

 

1 0

AMI - Alternating Mark Inversion (AMI is not supported)

 

1 1

Not Defined

   

Fmode

Value

Frame Mode parameter

 

0000

T1: F4 - 4-Frame Multiframe

 

0001

T1: SF - 12-Frame Multiframe

 

0010

T1: ESF - Extended Superframe

 

0011

T1: F72 - Remote Switch Mode

 

0100

E1: DF - Doubleframe

 

0101

E1: MF - CRC Multiframe

 

0110

Transparent (voice) mode

S.Clk

Value

Clock source

 

0 0

External clock (slave)

 

0 1

Internal clock from BRG (master)

 

1 0

External RxC only (Exin)

 

1 1

DPPL output (use BRG as source)

   

Pmode

Value

Port Mode

0000

Reserved

 

....

 
 

0100

Reserved

 

0101

E1 Twisted pair DB9 120 ohm

 

0110

E1 Coax BNC 75 ohm

 

0111

T1 Twisted pair RJ45 100 ohm

 

1000

Loopback Mode (Tristate)

 

1001

E1 Twisted pair RJ45 100 ohm

 

1010

T1 Twisted pair DB9 120 ohm

 

1011

T1 Coax BNC 75 ohm

 

1100

Reserved

 

...

 
 

1111

Reserved

NOTES

  1. Notice that it is possible to change only one byte of the configuration word by using an appropriate 'action' parameter value. In this case, the other bytes remain unaffected. The new parameters remain in force until changed by another call or until the ZCOM subsystem is reinitialized. Normally, an application program should not be required to change the port configuration.

  2. To configure the timeslot and subchannel specification information on the ACC E1/T1 card, use the zconfig() function.

  3. The following is the zpconf_type data structure definition (from <zcom/zcomsys.h>). This shows how the cnfg data can be referenced by individual bit fields (zpconf_type.bits.<field>), by individual bytes (zpconf_type.pconfig[<bytenum>]), or by its entire 32-bit value (zpconf_type.pcval).

/*-- Port Configuration format --*/
typedef union {
struct { /* Port config for all non-E1/T1 cards. */
unsigned int ecode : 2; /* Encoding modes */
unsigned int sync : 2; /* Sync mode select */
unsigned int mode : 2; /* Operating mode */
unsigned int parity : 2; /* Parity select */
unsigned int xclock : 2; /* Clock multiplier */
unsigned int sclock : 2; /* Clock source */
unsigned int baud : 4; /* Baud rate value */
unsigned int pmode : 2; /* Port mode select - original */
unsigned int pmode2 : 2; /* Port mode select - extended */
unsigned int baud2 : 4; /* Extended baud rate value */
unsigned int spare : 8; /* Reserved, must be 0 */
} bits;
struct { /* E1/T1 port configuration (Z7300A) */
unsigned int ecode : 2; /* Encoding modes */
unsigned int frmode : 4; /* Framing mode */
unsigned int set0_1 : 4; /* Unused */
unsigned int sclk : 2; /* Clock source */
unsigned int set0_2 : 4; /* Unused */
unsigned int pmode : 4; /* Port Mode */
unsigned int set0_3 : 12; /* Unused */
} e1t1_bits;
int32 pcval; /* Must be signed, -1 means bad config */
uint8 pconfig[4]; /* 4 configuration bytes */
} zpconf_type;

RETURN VALUE

Routine zport returns 0 if successful. Otherwise, a non-zero error code is returned. See /opt/acc/include/zcom/zcomsys.h for the list of ZCOM error codes and their meanings.

When zport returns a zero error code, the return status stat indicates the completion status: zero means successful, while non-zero values indicate the reason for the problem. Note that status code 4, 5, 6, and 7 implies the associated port will now be inoperative. Another zport configuration request must be done to recover it.

EXAMPLE

This example puts an E1/T1 port into "loopback" (tristate) mode.

#include     <zcom/zcomsys.h>
#include <zcom/zcomcall.h>
int32 ierr;
uint32 iftno;
uint32 portno;
uint32 rcode;
uint32 action;
zpconf_type cnfg;
int32 stat;

iftno = 1; /* ACC MUX number 1 in TTGEN configuration file. */
portno = 2; /* Port #2 */
rcode = 2; /* We are providing the configuration in "cnfg". */
action = ZCOM_ZMUXPORT_PORT; /* Set only the port mode (Pmode, Pmode2) */
cnfg.e1t1_bits.pmode = 0x8;
if (ierr = \fBzport\fR (iftno, portno, rcode, action, cnfg, &stat)) {
/* error return code */ } else if (stat)
{
/* error return code */ } else {
/* good return code */
}

FILES

/opt/acc/include/zcom/zcomsys.h

ZCOM subsystem general include file, containing data types, data structures, constants, error codes, masks, etc. Note that this must be the first include file before any other ZCOM include files.

/opt/acc/include/zcom/zcomcall.h

ZCOM routine function prototypes (requires ANSI C compilation).

SEE ALSO

zconfig(3X)

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 2000 Hewlett-Packard Development Company, L.P.