www.pudn.com > vxworks0108.rar > sysLibExt.h


#ifndef SYSLIBEXT_H
#define SYSLIBEXT_H

#ifdef __cplusplus
extern "C" {
#endif

#include "sysLib.h"


/*--------- User callable routines and official BSP variables -------------*/

STATUS
sysVmeIntConnect
	(
	 VOIDFUNCPTR *	vector,		/* interrupt vector	to attach */
	 VOIDFUNCPTR	routine,	/* routine to be called	*/
	 int			parameter	/* parameter to	be passed to routine */
	);

STATUS
sysVmeIntDeconnectAll
	(
	 VOIDFUNCPTR *	vector		/* interrupt vector	to detach */
	);

STATUS
sysVmeIntDisconnect
	(
	 VOIDFUNCPTR *	vector,		/* interrupt vector	to attach */
	 VOIDFUNCPTR	routine,	/* routine to be called	*/
	 int			parameter	/* parameter to	be passed to routine */
	);

STATUS sysIntEnable
	(
	int	intLevel		/* interrupt level to enable (1-7) */
	);

STATUS sysIntDisable
	(
	int	intLevel		/* interrupt level to disable (1-7)	*/
	);

int	sysBusIntAck
	(
	int	intLevel		/* interrupt level to acknowledge */
	);

STATUS sysBusIntGen
	(
	int	level,			/* interrupt level to generate	  */
	int	vector			/* interrupt vector	for	interrupt */
	);

STATUS sysVmeDmaCnfgGet
	(
	UINT32 *xferType,	/* output: Ptr to VMEbus data transfer type	*/
			/* Valid range:					*/
			/* (DCTL_VDW_8	| DCTL_VCT_SINGLE)		*/
			/* (DCTL_VDW_16	| DCTL_VCT_SINGLE)		*/
			/* (DCTL_VDW_32	| DCTL_VCT_SINGLE)		*/
			/* (DCTL_VDW_64	| DCTL_VCT_SINGLE)		*/
			/* (DCTL_VDW_32	| DCTL_VCT_BLK)		   ** BLT  	*/
			/* (DCTL_VDW_64	| DCTL_VCT_BLK)		   ** MBLT 	*/
	UINT32 *addrSpace,	/* output: Ptr to VMEbus Address Space type	*/
			/* Valid range:					*/
			/* DCTL_VAS_A16					*/
			/* DCTL_VAS_A24					*/
			/* DCTL_VAS_A32					*/
	UINT32 *dataType,	/* output: Ptr to Program/Data AM Code		*/
			/* Valid range:					*/
			/* DCTL_PGM_DATA				*/
			/* DCTL_PGM_PRGM				*/
	UINT32 *userType	/* output: Ptr to Supervisor/User AM Code	*/
			/* Valid range:					*/
			/* DCTL_SUPER_USER				*/
			/* DCTL_SUPER_SUP				*/
	);

STATUS sysVmeDmaCnfgSet
	(
	UINT32 xferType,	/* input: VMEbus data transfer type		*/
			/* Valid range:					*/
			/* (DCTL_VDW_8	| DCTL_VCT_SINGLE)		*/
			/* (DCTL_VDW_16	| DCTL_VCT_SINGLE)		*/
			/* (DCTL_VDW_32	| DCTL_VCT_SINGLE)		*/
			/* (DCTL_VDW_64	| DCTL_VCT_SINGLE)		*/
			/* (DCTL_VDW_32	| DCTL_VCT_BLK)			** BLT	*/
			/* (DCTL_VDW_64	| DCTL_VCT_BLK)			** MBLT	*/
	UINT32 addrSpace,	/* input: VMEbus Address Space type		*/
			/* Valid range:					*/
			/* DCTL_VAS_A16					*/
			/* DCTL_VAS_A24					*/
			/* DCTL_VAS_A32					*/
	UINT32 dataType,	/* imput: Ptr to Program/Data AM Code		*/
			/* Valid range:					*/
			/* DCTL_PGM_DATA				*/
			/* DCTL_PGM_PRGM				*/
	UINT32 userType	/* input: Supervisor/User AM Code		*/
			/* Valid range:					*/
			/* DCTL_SUPER_USER				*/
			/* DCTL_SUPER_SUP				*/
	);

STATUS sysVmeDmaStatusGet
	(
	UINT32	*transferStatus	/* State of	DMA	transfer defined as	*/
				/* DGCS	register status	bits		*/
				/* DGCS_ACT	 | DGCS_STOP | DGCS_HALT |	*/
				/* DGCS_DONE | DGCS_LERR | DGCS_VERR |	*/
				/* DGCS_P_ERR				*/
	);

STATUS sysVmeDmaL2VCopy
	(
	UCHAR  *localAddr,		/* Local Address as	seen by	the	CPU	*/
	UCHAR  *localVmeAddr,	/* VMEbus Address as seen by the CPU */
	UINT32	nbytes
	);

STATUS sysVmeDmaV2LCopy
	(
	UCHAR  *localVmeAddr,	/* VMEbus Address as seen by the CPU */
	UCHAR  *localAddr,		/* Local Address as	seen by	the	CPU	*/
	UINT32	nbytes
	);

BOOL sysVmeGetBusTrapFlag();

void sysVmeLock(void);

void sysVmeUnlock(void);

STATUS sysUnivIntConnect
	(
	int		univIntType,  /* the interrupt type	to connect with	*/
	VOIDFUNCPTR	routine,	  /* routine to	be called */
	int		parameter	  /* parameter to be passed	to routine */
	);

STATUS sysUnivIntEnable
	(
	int	univIntType	/* interrupt type */
	);

STATUS sysUnivIntDisable
	(
	int	univIntType	/* interrupt type */
	);

int	sysUnivIntLevelSet
	(
	int	 univIntLvl	/* Universe	interrupt level	*/
	);

void sysDumpUniverseRegs (void);

void sysVmeMasterMap (void);

void sysVmeSlaveMap	(void);

void sysDumpMpcRegs	(void);

void sysDumpZ8536TimerRegs (void);

void sysUsDelay
	(
	UINT32	delay		/* length of time in microsec to delay */
	);


STATUS  sysBusProbe
    (
    char   * adrs,  /* address to be probed */
    int      mode,  /* VX_READ or VX_WRITE */
    int      length,    /* 1, 2 or 4 byte probe */
    char   * pVal   /* address of value to write OR */
            /* address of location to place value read */
    );


STATUS sysLocalToPciAdrs
    (
    int     adrsSpace,  /* pci address space where busAdrs resides */
    char *  localAdrs,  /* local address to convert */
    char ** pBusAdrs    /* where to return the pci address */
    );

STATUS sysPciToLocalAdrs
    (
    int     adrsSpace,  /* pci address space where busAdrs resides */
    char *  busAdrs,    /* pci bus address to convert */
    char ** pLocalAdrs  /* where to return local (=cpu) address */
    );

STATUS sysDramToPciAdrs
    (
    char *  localAdrs,    /* pci bus address to convert */
    char ** pBusAdrs  /* where to return local (=cpu) address */
    );

STATUS sysPciToDramAdrs
    (
    char *  busAdrs,    /* pci bus address to convert */
    char ** pLocalAdrs  /* where to return local (=cpu) address */
    );


STATUS  sysCpuTempGet (int *pTemp);

void    sysResetVg4 (void);

void    sysResetPci (void);

void    sysResetVME (void);

void    sysMemMapDetect (void);

int     sysUnlockExtRegSet (void);

void    sysLockExtRegSet (int lockKey);

STATUS  sysUserLedConfig (int ledMode);

STATUS  sysUserLedOn (void);

STATUS  sysUserLedOff (void);

void    sysCardFailLedOn (void);

void    sysCardFailLedOff (void);


/*
 * mailbox extensions
 */
void * sysVmeMailboxAlloc(void);
void sysVmeMailboxFree(void *mbox);
STATUS sysVmeMailboxConnect
    (
    void *mbox,		/* mailbox handle. Here actually the mbox number. */
    VOIDFUNCPTR routine,    /* routine called at each mailbox interrupt */
    void *arg             /* argument with which to call routine      */
    );
STATUS sysVmeMailboxEnable
    (
    void *mbox           /* mailbox handle. Here actually mbox number */
    );
STATUS sysVmeMailboxDisable
    (
    void *mbox           /* mailbox handle. Here actually mbox number */
    );
UINT32 sysVmeMailboxAddrGet(void *mbox);
UINT32 sysVmeMailboxLocalAddrGet(void *mbox);
UINT32 sysVmeMailboxDataGet(void *mbox);


/*
 * NVSRAM routines in mem/nvRam.c
 */
STATUS nvSramWriteEnable (void);
STATUS nvSramWriteDisable (void);
STATUS nvSramGet
    (
    char *string,    /* where to copy non-volatile RAM    */
    int strLen,      /* maximum number of bytes to copy   */
    int offset       /* byte offset into non-volatile RAM */
    );
STATUS nvSramSet
    (
    char *string,     /* string to be copied into non-volatile RAM */
    int strLen,       /* maximum number of bytes to copy           */
    int offset        /* byte offset into non-volatile RAM         */
    );
STATUS nvSramFill
    (
    int ch,         /* character with which to fill non-volatile RAM */
    int nbytes,     /* number of bytes to fill                       */
    int offset      /* byte offset into non-volatile RAM             */
    );


/*
 * PMON related routines in sysLib.c
 */
STATUS sysToPmon(void);
STATUS sysToPmon(void);
STATUS sysPmonNextFlAdrsWrite
    (
    UINT adrs       /* address to write */
    );



/*--------- BSP Internal declarations -------------------------------------*/

extern unsigned long	sysDeviceAddressSCSI;
extern unsigned char	sysIrqLevelSCSI;
extern unsigned int	    sysIrqVectorSCSI;

#define SYM53C860_VENDOR_ID	0x1000
#define SYM53C860_DEVICE_ID	0x0006


/* TolerANT Enable required for NCR860 Ultra-SCSI enabled */
#define VG4_SIOP_HW_REGS    {0,0,0,0,0,1,0,0,0,0,0}

/* NCR8xx delay loop count */
#define NCR810_DELAY_MULT       10

/* Ultra-SCSI NCR860 @ 80 MHz definitions */

#define NCR860_80MHZ_SYNC_DIV	0x01    /* 66-80Mhz input clock */

/*
#define NCR810_IN_BYTE(adr)       (sysInByte((int) adr))
#define NCR810_OUT_BYTE(adr,val)  (sysOutByte((int) adr, val))
#define NCR810_IN_16(adr)      (NCR810_SWAP_16(sysInWord((int) adr)))
#define NCR810_OUT_16(adr,val)  (sysOutWord((int) adr, NCR810_SWAP_16(val)))
#define NCR810_IN_32(adr)      (NCR810_SWAP_32(sysInLong((int) adr)))
#define NCR810_OUT_32(adr,val)  (sysOutLong((int) adr, NCR810_SWAP_32(val)))
*/

#if (_BYTE_ORDER == _BIG_ENDIAN)
#   define PCISWAP(x)       LONGSWAP(x)
#   define PCISWAP_SHORT(x) (MSB(x) | LSB(x) << 8)
#else
#   define PCISWAP(x)       (x)
#   define PCISWAP_SHORT(x) (x)
#endif

#ifdef __cplusplus
}
#endif

#endif