/*
 *               Copyright (C) 2005, BroadOn Communications Corp.
 *
 *  These coded instructions, statements, and computer programs contain
 *  unpublished  proprietary information of BroadOn Communications Corp.,
 *  and  are protected by Federal copyright law. They may not be disclosed
 *  to  third  parties or copied or duplicated in any form, in whole or in
 *  part, without the prior written consent of BroadOn Communications Corp.
 *
 */

#ifndef	__TEST_H__
#define	__TEST_H__

// testable l2 memory region;

#define	TEST_L2_START	(16*1024)		// first 16k is boot1;
#define	TEST_L2_END		(320*1024)		// end of DA;

// cache regions in da;

#define	TEST_CACHE_START	(64*1024)
#define	TEST_CACHE_END		TEST_L2_END

#define	SD_TAP	12						// working tap;

// flush write buffer;

#define	wb_flush() IO_READ(L1_START)

// test structure;
// tests are responsible for setting their environment;

typedef struct test {
	u8 name[16];		// test name;
	void (*func)(struct test *, u32);
	u32 nth;			// nth pass;
	u32 state;			// state of test;
	u32 fail;			// fail flags;
	u32 arg[4];			// arguments;
} test_t;

#define	TNAME	{ 0 }

// tests.s exports;
// tests.sim points to this structure;

typedef struct sim {
	u32 sema;			// semaphore to sim; 
	test_t *tests;		// ptr to tests;
} sim_t;

// lib functions;

extern void set_dax(u32 acc, u32 ptr, int size);
extern void set_pt(u32 acc, u32 ptr, int size);
extern void inv_l1d(void);
extern u32 test_fail(test_t *tp);
extern void test_name(test_t *tp, char *name);
extern u32 test_loop(test_t *tp, u32 nth);
extern void sd_ctrl(u32 tap, u32 ctrl, int to);
extern void sd_init(u32 tap);

#endif	// __TEST_H__

