inp006.c 5.97 KB

/**************************************************************************
 *                                                                        *
 *               Copyright (C) 1994, Silicon Graphics, Inc.               *
 *                                                                        *
 *  These coded instructions, statements, and computer programs  contain  *
 *  unpublished  proprietary  information of Silicon Graphics, Inc., 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 Silicon Graphics, Inc.  *
 *                                                                        *
 *************************************************************************/

#include <bstring.h>
#include <stdio.h>
#include <math.h>

#include <mbi.h>	/* from software-land */

#include "inp.h"

static void stallTileSync(void);
static void stallPipeSync(void);
static void stallFullSync(void);
static void stallLoadSync(void);
static void stallAttrValid(void);
static void stallStartPrim(void);
static void printTrailingCycles(void);

int
main(int argc, char *argv[])
{
	printHeader();
	resetFifo();
	initFifo();
	resetFifo();
	stallTileSync();
	stallPipeSync();
	stallFullSync();
	stallLoadSync();
	stallAttrValid();
	stallStartPrim();
	printTrailingCycles();
}

static void
doFULLSYNC(vector_t *vp)
{
	printf("#  FULLSYNC\n");

	vp->xbus_cs_valid = 1;

	vp->data[0] = (G_RDPFULLSYNC << 24);
	vp->data[1] = 0x0;
	printVector(vp, 1);
}
	
static void
doTILESYNC(vector_t *vp)
{
	printf("#  TILESYNC\n");

	vp->xbus_cs_valid = 1;

	vp->data[0] = (G_RDPTILESYNC << 24);
	vp->data[1] = 0x0;
	printVector(vp, 1);
}
	
static void
doPIPESYNC(vector_t *vp)
{
	printf("#  PIPESYNC\n");

	vp->xbus_cs_valid = 1;

	vp->data[0] = (G_RDPPIPESYNC << 24);
	vp->data[1] = 0x0;
	printVector(vp, 1);
}

static void
doLOADSYNC(vector_t *vp)
{
	printf("#  LOADSYNC\n");

	vp->xbus_cs_valid = 1;

	vp->data[0] = (G_RDPLOADSYNC << 24);
	vp->data[1] = 0x0;
	printVector(vp, 1);
}

static void
stallTileSync(void)
{
	int i;
	vector_t v;
	vector_t *vp = &v;

	bzero(vp, sizeof(*vp));

	vp->reset_l = 1;

	printf("# Verify ms_busy delays sync_tile_state \n");

	doTILESYNC(vp);

	vp->xbus_cs_valid = 0;
	vp->data64 = 0;
	vp->ms_busy = 1;

	printVector(vp, 1);
	printVector(vp, 1);

	vp->ms_busy = 0;

	printVector(vp, 1);

	vp->rel_sync_tile = 1;

	printVector(vp, 1);

	vp->rel_sync_tile = 0;

	printVector(vp, 1);
}

static void
stallPipeSync(void)
{
	int i;
	vector_t v;
	vector_t *vp = &v;

	bzero(vp, sizeof(*vp));

	vp->reset_l = 1;

	printf("# Verify ms_busy delays sync_pipe_state \n");

	doPIPESYNC(vp);

	vp->xbus_cs_valid = 0;
	vp->data64 = 0;
	vp->ms_busy = 1;

	printVector(vp, 1);
	printVector(vp, 1);

	vp->ms_busy = 0;

	printVector(vp, 1);

	vp->rel_sync_pipe = 1;

	printVector(vp, 1);

	vp->rel_sync_pipe = 0;

	printVector(vp, 1);
}

static void
stallFullSync(void)
{
	int i;
	vector_t v;
	vector_t *vp = &v;

	bzero(vp, sizeof(*vp));

	vp->reset_l = 1;

	printf("# Verify ms_busy delays sync_full_state \n");

	doFULLSYNC(vp);

	vp->xbus_cs_valid = 0;
	vp->data64 = 0;
	vp->ms_busy = 1;

	printVector(vp, 1);
	printVector(vp, 1);

	vp->ms_busy = 0;

	printVector(vp, 1);

	vp->rel_sync_full = 1;

	printVector(vp, 1);

	vp->rel_sync_full = 0;

	printVector(vp, 1);
}

static void
stallLoadSync(void)
{
	int i;
	vector_t v;
	vector_t *vp = &v;

	bzero(vp, sizeof(*vp));

	vp->reset_l = 1;

	printf("# Verify ms_busy delays sync_load_state \n");

	doLOADSYNC(vp);

	vp->xbus_cs_valid = 0;
	vp->data64 = 0;
	vp->ms_busy = 1;

	printVector(vp, 1);
	printVector(vp, 1);

	vp->ms_busy = 0;

	printVector(vp, 1);

	vp->rel_sync_load = 1;

	printVector(vp, 1);

	vp->rel_sync_load = 0;

	printVector(vp, 1);
}

static void
doTEXRECT(vector_t *vp)
{
	printf("#  TEXRECT\n");

	vp->xbus_cs_valid = 1;
	vp->rel_sync_tile = vp->rel_sync_pipe = vp->rel_sync_full = 0;

	vp->gtexr.cmd = G_TEXRECT;
	vp->gtexr.xl = 100;
	vp->gtexr.yl = 150;
	vp->gtexr.tile = 2;
	vp->gtexr.xh = 200;
	vp->gtexr.yh = 250;
	printVector(vp, 1);

	vp->data[0] = 0xaabbccdd;
	vp->data[1] = 0x00640064;
	printVector(vp, 1);
}

static void
doTEXRECTFLIP(vector_t *vp)
{
	printf("#  TEXRECTFLIP\n");

	vp->xbus_cs_valid = 1;
	vp->rel_sync_tile = vp->rel_sync_pipe = vp->rel_sync_full = 0;

	vp->gtexr.cmd = G_TEXRECTFLIP;
	vp->gtexr.xl = 100;
	vp->gtexr.yl = 50;
	vp->gtexr.tile = 2;
	vp->gtexr.xh = 200;
	vp->gtexr.yh = 150;
	printVector(vp, 1);

	vp->data[0] = 0xaabbccdd;
	vp->data[1] = 0x00640064;
	printVector(vp, 1);
}

static void
doSETBLENDCOLOR(vector_t *vp)
{
	printf("#  SETBLENDER\n");

	vp->xbus_cs_valid = 1;

	vp->gscol.cmd = G_SETBLENDCOLOR;
	vp->gscol.pad = 0;
	vp->gscol.prim_min_level = 0x0;	/* unused */
	vp->gscol.prim_level = 0x0;
	vp->gscol.color = 0x55667788;
	printVector(vp, 1);
}

static void
stallAttrValid(void)
{
	int i;
	vector_t v;
	vector_t *vp = &v;

	bzero(vp, sizeof(*vp));

	vp->reset_l = 1;

	printf("# Verify ms_busy delays attr_valid (and read_adrs)\n");

	doSETBLENDCOLOR(vp);

	vp->xbus_cs_valid = 0;
	vp->data64 = 0;
	vp->ms_busy = 1;

	printVector(vp, 1);

	vp->ms_busy = 0;

	printVector(vp, 1);

}

static void
doLOADBLOCK(vector_t *vp)
{
	printf("#  LOADBLOCK\n");

	vp->xbus_cs_valid = 1;

	vp->gltile.cmd = G_LOADBLOCK;
	vp->gltile.sl = 100;
	vp->gltile.tl = 150;
	vp->gltile.pad = 0;
	vp->gltile.tile = 1;
	vp->gltile.sh = 200;
	vp->gltile.th = 250;
	printVector(vp, 1);
}

static void
stallStartPrim(void)
{
	int i;
	vector_t v;
	vector_t *vp = &v;

	bzero(vp, sizeof(*vp));

	vp->reset_l = 1;

	printf("# Verify ms_busy delays start_prim (and shf_state)\n");

	doLOADBLOCK(vp);

	vp->xbus_cs_valid = 0;
	vp->data64 = 0;

	vp->ms_busy = 1;

	printVector(vp, 1);

	vp->ms_busy = 0;

	for (i = 0; i < 22; i++)
		printVector(vp, 1);

}

static void
printTrailingCycles(void)
{
	int i;
	vector_t v;
	vector_t *vp = &v;

	printf("# Trailing cycles\n");

	bzero(vp, sizeof(*vp));

	vp->reset_l = 1;

	for (i = 0; i < 6; i++)
		printVector(vp, 0);
}