iotest.h 5.79 KB

/*************************************************************************
 *
 *  File: iotest.h
 *
 *  Header file for the I/O test driver.
 *
 *  $Header: /root/leakn64/depot/rf/sw/bbplayer/iosim/src/iotest.h,v 1.4 2002/11/01 19:40:23 whs Exp $
 *
 */


#ifndef _IO_TEST_H_
#define _IO_TEST_H_
#include <stdio.h>

/**********************************************************************
 * General typedefs and definitions
 */
typedef volatile unsigned char          vu_char;
typedef volatile unsigned short         vu_short;
typedef volatile unsigned int           vu_int;
typedef volatile unsigned long long     vu_longlong;

#ifndef TRUE
#define TRUE    1
#endif

#ifndef FALSE
#define FALSE   0
#endif


/**********************************************************************
 * Typedefs
 */
/*
 * Test Command Structure
 */
typedef struct _tstCmdStruct {
        int     id;
        char    *desc;
        int     (*handler)(int, int, int, int );
        char	*name;
} TstCmd;


/**********************************************************************
 * Common definitions
 */
#define PASSED          1
#define FAILED          0

#define PASS_STR        "Passed"
#define FAIL_STR        "Failed"

#define STR_IN_DIR      "In/"
#define STR_OUT_DIR     "Out/"

#define BUF_SIZE        128
#define MSG_DATAOUT \
    "%08x %08x %08x %08x %08x %08x %08x %08x %08x\n"

#define MSG_WR_ERR      "ERROR: WR a=0x%x s=%d d:0x%x 0x%x 0x%x 0x%x\n"
#define MSG_RD_ERR      "ERROR: RD a=0x%x s=%d\n"

        /* test id, description, expected val, actual val, passed/failed */
#define TST_MSG_RES_STR "Test %3d (%15s: %08x %08x %08x %08x)\t"
#define TST_MSG_RES_STR2 "\n\t****ERROR: expected=%08x, actual=%08x\t\t"

/* IO operation types for reading/writing from/to RDRAM */
#define OP_READ		0
#define OP_WRITE	1


/**********************************************************************
 * Macro definitions
 */
#define FP_SET(fp)      ((fp) ? (fp) : stderr)

#define LOG_ERROR(exp,act)						\
                        fprintf(LogFp, TST_MSG_RES_STR2,		\
                                exp, act)

#define TST_PATTERN1    0x12000000
#define TST_PATTERN2    0x12340000
#define TST_PATTERN3    0x12345678
#define TST_WORD        0x12345678

#define RDRAM_PAGE_SIZE         2048
#define	RDRAM_BANK_SIZE		1048576
#define RDRAM_MAX_COUNT         2
#define PAGES_PER_RDRAM         512
#define	BANKS_PER_RDRAM		2
#define MAX_RDRAM_PAGES         (RDRAM_MAX_COUNT*PAGES_PER_RDRAM)


/***********************************************************************
 * External definitions
 */
extern int      IpcFd;
extern FILE     *LogFp;
extern FILE     *dumpFp;
extern char     *CmdFile;
extern int	errorTotal;
extern int	errorCount;
extern TstCmd	TstCmdTbl[];
extern int      NumberStallCycles;


/***********************************************************************
 * External declartions
 */
/*
 * Declaration of test routines
 */
extern int	LoadFile(char *, unsigned int, int);
extern int	UnloadFile(char *, unsigned int, int);

extern int	IoWrite(unsigned int, int, unsigned int *);
extern int	IoRead(unsigned int, int, unsigned int *);

extern void     RdramInit(int);
extern void     PiConfigDomain(unsigned int, int, int, int, int);

extern int	CpuWait(int, int, int, int);
extern int	rdramConfig(int, int, int, int);
extern int	piConfigDom1(int, int, int, int);
extern int	piConfigDom2(int, int, int, int);

extern int	MemRead(int, int, int, int);
extern int	MemReadCompare(int, int, int, int);
extern int	MemWrite(int, int, int, int);
extern int	MemWriteRead(int, int, int, int);
extern int      MemReadWrite(int, int, int, int);
extern int      MemReadWriteMask(int, int, int, int);
extern int	MemPollStatus(int, int, int, int);
extern int	MemCompare(int, int, int, int);
extern int	MemDump(int, int, int, int);
extern int	MemReadUntil(int, int, int, int);
extern int	MemReadCompMask(int, int, int, int);
extern int	MemReadCompMaskNoError(int, int, int, int);

extern int	rdramInit(int, int, int, int);
extern int	rdramTestSglRw(int, int, int, int);
extern int	rdramTestBlkRw(int, int, int, int);
extern int	rdramTestPgRw(int, int, int, int);

extern int	IoSpWrite(unsigned int, unsigned int);
extern int	IoSpRead(unsigned int);
extern int	IoSpDmaCopy(int, unsigned int, unsigned int, int);
extern int	SpTestStatus(int, int, int, int);
extern int	SpTestReg(int, int, int, int);
extern int	SpTestIoRead(int, int, int, int);
extern int	SpTestIoWrite(int, int, int, int);
extern int	SpTestDma(int, int, int, int);
extern int	SpTestDmaPg(int, int, int, int);

extern int	IoPiWrite(unsigned int, unsigned int);
extern int	IoPiRead(unsigned int);
extern int	IoPiDmaCopy(int, unsigned int, unsigned int, int);
extern int	PiTestStatus(int, int, int, int);
extern int	PiTestReg(int, int, int, int);
extern int	PiTestIoRead(int, int, int, int);
extern int	PiTestIoWrite(int, int, int, int);
extern int	PiTestDma(int, int, int, int);
extern int	PiTestDmaPg(int, int, int, int);

extern int	IoSiRead(unsigned int);
extern int	IoSiDmaCopy(int, unsigned int, unsigned int);
extern int	SiTestStatus(int, int, int, int);
extern int	SiTestReg(int, int, int, int);
extern int	SiTestIoRead(int, int, int, int);
extern int	SiTestIoWrite(int, int, int, int);
extern int	SiTestDma(int, int, int, int);
extern int	SiTestDmaPg(int, int, int, int);

extern void	AiInit(unsigned int, unsigned int);
extern int	AiTestInit(int, int, int, int);
extern int	AiTestStatus(int, int, int, int);
extern int	AiTestReg(int, int, int, int);
extern int	AiTestDma(int, int, int, int);
extern int	AiTestDmaPg(int, int, int, int);
extern int	AiCompareData(int, int, int, int);
extern int	AiStartDma(int, int, int, int);
extern int	AiCompareLength(int, int, int, int);

extern int	RDPList(int, int, int, int);
extern int	RDPListLoop(int, int, int, int);
extern int      RDPListCounter(int, int, int, int);

extern int	EbusTestPgRw(int, int, int, int);

#endif  /* _IO_TEST_H_ */