inp006.c 1.98 KB
#include <bstring.h>
#include <stdio.h>

#include "inp.h"

static void passThrough(void);
static void initTwoCycleKeyMode(cc_t *);

int
main(int argc, char *argv[])
{
	printHeader();
	passThrough();
	printTrailingCycles();
}

static void
passThrough(void)
{
	cc_t cc;
	cc_t *ccp = &cc;
	int i;

	printf("# Verify X (SUBA) inputs are passed through to pixel outputs\n");

	initTwoCycleKeyMode(ccp);

	ccp->center_r = ccp->center_g = ccp->center_b = 0x0;
	ccp->scale_r = ccp->scale_g = ccp->scale_b = 0x0;

	for (i = 0; i < 9; i++) {
		ccp->tf_b = 1 << i;
		printVector(ccp, 1);
		printVector(ccp, 1);
	}
	ccp->tf_b = 0;

	for (i = 0; i < 9; i++) {
		ccp->tf_g = 1 << i;
		printVector(ccp, 1);
		printVector(ccp, 1);
	}
	ccp->tf_g = 0;

	for (i = 0; i < 9; i++) {
		ccp->tf_r = 1 << i;
		printVector(ccp, 1);
		printVector(ccp, 1);
	}
	ccp->tf_r = 0;
}

static void
initTwoCycleKeyMode(cc_t *ccp)
{
	bzero(ccp, sizeof(*ccp));

	ccp->ncyc = 1;		/* two cycle mode */
	ccp->st_span = 1;	/* set phase */
	ccp->key_en = 1;	/* enable keying */

	printf("# Start two cycle mode w/keying \n");

	printVector(ccp, 0);

	ccp->st_span = 0;		/* allow clocking to begin */

	printVector(ccp, 0);

	/* Initialize cycle 0 color selects to (0,0,0,1) */

	ccp->cc_x_sel_0_r = CC_SUBA_ZERO;
	ccp->cc_y_sel_0_r = CC_SUBB_ZERO;
	ccp->cc_a_sel_0_r = CC_MULT_ZERO;
	ccp->cc_c_sel_0_r = CC_ADD_ONE;

	/* Initialize cycle 0 alpha selects to (0,0,0,1) */

	ccp->cc_x_sel_0_a = CC_SUBA_ZERO_ALPHA;
	ccp->cc_y_sel_0_a = CC_SUBB_ZERO_ALPHA;
	ccp->cc_a_sel_0_a = CC_MULT_ZERO_ALPHA;
	ccp->cc_c_sel_0_a = CC_ADD_ONE_ALPHA;

	/* Initialize cycle 1 color selects to (tex 1, center, scale, tex 1) */

	ccp->cc_x_sel_1_r = CC_SUBA_TEX_1;
	ccp->cc_y_sel_1_r = CC_SUBB_CENTER;
	ccp->cc_a_sel_1_r = CC_MULT_SCALE;
	ccp->cc_c_sel_1_r = CC_ADD_TEX_1;

	/* Initialize cycle 1 alpha selects to (0,0,0,0) */

	ccp->cc_x_sel_1_a = CC_SUBA_ZERO_ALPHA;
	ccp->cc_y_sel_1_a = CC_SUBB_ZERO_ALPHA;
	ccp->cc_a_sel_1_a = CC_MULT_ZERO_ALPHA;
	ccp->cc_c_sel_1_a = CC_ADD_ZERO_ALPHA;
}