shithub: hantro9

ref: 3296f28705a08bd9daff92a677b0fa76098941dd
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);
}