inp.h 2.91 KB
typedef unsigned long int	u32;
typedef unsigned long long	u64;

typedef struct {
	union {
	    u32		u_data[2];
	    u64		u_data64;
	    Gsetimg	u_gimg;
	    Gsetcombine	u_gcomb;
	    Gsetcolor	u_gscol;
	    Gfillrect	u_gfillr;
	    Gsettile	u_gstile;
	    Gloadtile	u_gltile;
	    Gtexrect	u_gtexr;
	    Gloadtlut	u_gltlut;
	}	xbus_cs_data;
	int	xbus_cs_valid;
	int	ew_cs_busy;
	int	ms_busy;
	int	rel_sync_tile;
	int	rel_sync_pipe;
	int	rel_sync_full;
	int	rel_sync_load;
	int	texel_size;
	int	copy_fill;
	int	reset_l;
} vector_t;

#define	data	xbus_cs_data.u_data
#define	data64	xbus_cs_data.u_data64
#define	gimg	xbus_cs_data.u_gimg
#define	gcomb	xbus_cs_data.u_gcomb
#define	gscol	xbus_cs_data.u_gscol
#define	gfillr	xbus_cs_data.u_gfillr
#define	gstile	xbus_cs_data.u_gstile
#define	gltile	xbus_cs_data.u_gltile
#define	gtexr	xbus_cs_data.u_gtexr
#define	gltlut	xbus_cs_data.u_gltlut

static void
printHeader(void)
{
	printf("#\n");
	printf("#  command shuffle verification\n");
	printf("#\n");
	printf("gclk			@C 0(8) 1(8)\n");
	printf("xbus_cs_data[63:0]	@I @E 0\n");
	printf("xbus_cs_valid		@I @E 0\n");
	printf("ew_cs_busy		@I @E 0\n");
	printf("ms_busy			@I @E 0\n");
	printf("rel_sync_tile		@I @E 0\n");
	printf("rel_sync_pipe		@I @E 0\n");
	printf("rel_sync_full		@I @E 0\n");
	printf("rel_sync_load		@I @E 0\n");
	printf("texel_size[1:0]		@I @E 0\n");
	printf("copy_fill     		@I @E 0\n");
	printf("reset_l			@I @E 0\n");
	printf("dv_0			@I\n");
	printf("\n");
}

static void
printVector(vector_t *vp, int valid)
{
	printf("0x%08x 0x%08x %d %d %d %d %d %d %d %x %d %d %d\n",
		vp->data[0], vp->data[1],
		vp->xbus_cs_valid,
		vp->ew_cs_busy,
		vp->ms_busy,
		vp->rel_sync_tile,
		vp->rel_sync_pipe,
		vp->rel_sync_full,
		vp->rel_sync_load,
		vp->texel_size,
		vp->copy_fill,
		vp->reset_l,
		valid);
}

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

	bzero(vp, sizeof(*vp));

	printf("# Reset FIFO\n");

	vp->reset_l = 1;
	printVector(vp, 0);

	vp->reset_l = 0;
	printVector(vp, 0);

	vp->reset_l = 1;
	printVector(vp, 0);

}

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

	bzero(vp, sizeof(*vp));

	printf("# Initialize FIFO\n");

	vp->reset_l = 1;

	vp->xbus_cs_valid = 1;
	vp->data[0] = (G_NOOP << 24);
	vp->data[1] = 0x0;
	for (i = 0; i < 10; i++) {
		printVector(vp, 0);
	}

	vp->xbus_cs_valid = 0;
	vp->data64 = 0;
	for (i = 0; i < 3; i++)
		printVector(vp, 0);

	vp->xbus_cs_valid = 1;
	vp->data[0] = (G_NOOP << 24);
	vp->data[1] = 0x0;
	for (i = 0; i < 10; i++)
		printVector(vp, 0);

	vp->xbus_cs_valid = 0;
	vp->data64 = 0;
	for (i = 0; i < 3; i++)
		printVector(vp, 0);

	vp->xbus_cs_valid = 1;
	vp->data[0] = (G_NOOP << 24);
	vp->data[1] = 0x0;
	for (i = 0; i < 10; i++)
		printVector(vp, 0);

	vp->xbus_cs_valid = 0;
	vp->data64 = 0;
	for (i = 0; i < 3; i++)
		printVector(vp, 0);

	vp->xbus_cs_valid = 1;
	vp->data[0] = (G_NOOP << 24);
	vp->data[1] = 0x0;
	for (i = 0; i < 2; i++)
		printVector(vp, 0);
}