shithub: hantro9

ref: 6d9c27e525cb86a650ff7d4fc82fc27bb74fd59c
dir: /hantest.c/

View raw version
#include <u.h>
#include <libc.h>
#include "g1regs.h"
#include "vpuctx.h"

static u32int *g1;

void
main(int argc, char **argv)
{
	int i;
	u32int x;

	ARGBEGIN{
	}ARGEND

	if((g1 = segattach(0, "vpu_hantro_g1", 0, 0x200)) == (void*)-1)
		sysfatal("no G1");

	/* FIXME will use polling for now */
	g1[1] = SW_DEC_IRQ_DIS;

	/* run */
	g1[2] |= SW_DEC_CLK_GATE_E;
	x = (g1[1] |= SW_DEC_E);
	for(i = 0; i < 100; i++){
		sleep(1);
		if(g1[1] != x){
			print("irq changed from 0x%ux to 0x%ux\n", x, g1[1]);
			break;
		}
	}

	segdetach(g1);

	exits(nil);
}