/* **********************************************************************
 * *                                                                    *
 * *               Softplane Private Driver Definitions                 *
 * *                                                                    *
 * **********************************************************************
 * File: rda/softplane/softplane_def.h
 *
 *                        COPYRIGHT (c) 2002  BY
 *          SIGMET INCORPORATED, WESTFORD MASSACHUSETTS, U.S.A.
 * 
 * THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND  COPIED
 * ONLY  IN  ACCORDANCE WITH  THE  TERMS  OF  SUCH  LICENSE  AND WITH THE
 * INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE  OR  ANY OTHER
 * COPIES  THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY
 * OTHER PERSON.  NO TITLE TO AND OWNERSHIP OF  THE  SOFTWARE  IS  HEREBY
 * TRANSFERED.
 */

/* ------------------------------
 * Structures holding all of the control bits and all of the status
 * bits that might be used by an IO62 board and optional backpanel.
 */
struct splPCICardCnt {
  UINT4 iCPGio[ 5 ] ;		/* 20-bit TTL/CMOS to backpanel */
  UINT4 iIoGio[ 2 ] ;		/* 20-bit direct IO62 bit control */
  UINT4 iCPCnt ;		/* Connector panel control bits */
  UINT4 iCPDgCnt ;		/* Two 'DG' RS-422 output bits */
  UINT4 iIoForce[2] ;		/* IO62 line force Lo/Hi register */
  UINT4 iIoRelays ;		/* Two relays on IO62 board */
  UINT4 iTxB2B ;		/* Board-to-Board bits to send */
} ;

struct splPCICardSts {
  UINT4 iCPGio[ 5 ] ;		/* 20-bit TTL/CMOS from backpanel */
  UINT4 iIoGio[ 2 ] ;		/* 20-bit direct IO62 bit status */
  UINT4 iCPSts ;		/* Connector panel status bits */
  UINT4 iIoSts ;		/* IO62 PCI card monitor/status bits */
  UINT4 iRxB2B ;		/* Board-to-Board bits received */
} ;

/* ------------------------------
 * Opaque softplane driver information structure
 */
struct splRemapCard {		/* Map PCICard <--> splLogic */
  UINT4 lControlRunOnce ;	  /* Control outputs have run at least once */
  SINT4 iRemapCnt ;		  /* Number of control remappings */
  struct splRemapBit *pRemapCnt ; /* Maps struct splLogicCnt */
				  /*   to struct splPCICardCnt */

  SINT4 iRemapSts ;		  /* Number of status remappings */
  struct splRemapBit *pRemapSts ; /* Maps struct splPCICardSts */
				  /*   to struct splLogicSts */

  SINT4 nInternalCnt ;		/* Number of internal (non Linux) control */
  SINT4 nInternalSts ;		/*   and status signals that were assigned. */

  SINT4 nInfos ;		/* Number of AUX info structures */
  struct splRemapInfo *pInfo ;	/* ==> list of such structures */

  struct splPCICardCnt cardCnt ; /* Most recent physical I/O to/from */
  struct splPCICardSts cardSts ; /*   this card. */

  struct splPCICardSts stsMask ; /* Mask of status slots actually referenced */
} ;

struct spl_info {		
  /* PCI Cards that we were given to work with
   */
  Rvp8Rx *Rx[  RX8MAXUNITS ] ;
  Rvp8Tx *Tx[  TX8MAXUNITS ] ;
  Io62   *Io[ IO62MAXUNITS ] ;

  /* Bit remapping strucures for control and status on each I/O card
   * and backpanel.
   */
  struct splRemapCard remapCard[ IO62MAXUNITS ] ;

  pthread_mutex_t controlMutex ; /* Lock control output sequences */
  pthread_mutex_t  statusMutex ; /* Lock status input sequences */

  /* Logical I/O structures
   */
  struct splLogicCnt logicCnt ;
  struct splLogicCnt logicSts ;

  /* The original 'softplane.conf' file that got us here, and count of
   * errors during configuration
   */
  struct splConfig file ;
  SINT4 iConfigErrors ;
} ;
