inp007.c 3.12 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 loadTile(void);
static void loadBlock(void);
static void loadTlut(void);
static void initFifo(void);
static void printTrailingCycles(void);

int
main(int argc, char *argv[])
{
	printHeader();
	resetFifo();
	initFifo();
	resetFifo();
	loadTile();
	loadBlock();
	loadTlut();
	printTrailingCycles();
}

static void
doLOADTILE(vector_t *vp)
{
	printf("#  LOADTILE\n");

	vp->xbus_cs_valid = 1;

	vp->gltile.cmd = G_LOADTILE;
	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
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
doLOADTLUT(vector_t *vp)
{
	printf("#  LOADTLUT\n");

	vp->xbus_cs_valid = 1;

	vp->gltlut.cmd = G_LOADTLUT;
	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
loadTile(void)
{
	int i, j;
	vector_t v;
	vector_t *vp = &v;

	bzero(vp, sizeof(*vp));

	vp->reset_l = 1;

	for (i = 0; i < 4; i++) {
		vp->texel_size = i;
		doLOADTILE(vp);
		for (j = 0; j < 22; j++) {
			vp->xbus_cs_valid = 0;
			vp->data64 = 0;
			printVector(vp, 1);
		}
	}
}

static void
loadBlock(void)
{
	int i, j;
	vector_t v;
	vector_t *vp = &v;

	bzero(vp, sizeof(*vp));

	vp->reset_l = 1;

	for (i = 0; i < 4; i++) {
		vp->texel_size = i;
		doLOADBLOCK(vp);
		for (j = 0; j < 22; j++) {
			vp->xbus_cs_valid = 0;
			vp->data64 = 0;
			printVector(vp, 1);
		}
	}
}

static void
loadTlut(void)
{
	int i, j;
	vector_t v;
	vector_t *vp = &v;

	bzero(vp, sizeof(*vp));

	vp->reset_l = 1;

	for (i = 0; i < 4; i++) {
		vp->texel_size = i;
		doLOADTLUT(vp);
		for (j = 0; j < 22; j++) {
			vp->xbus_cs_valid = 0;
			vp->data64 = 0;
			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 < 3; i++)
		printVector(vp, 0);
}