Beispiel #1
0
int main(int argc, char *argv[])
{
	int trans = 0;
    int fd;
#if 0
	unsigned long   slot, addr_target, addr_source, len;

	if ((trans = cmd_get_data_trans(argv[0], 2)) < 1)
			return 1;
    
	/*slot number*/
	slot= simple_strtoul(argv[1], (void *)0, 16);
    
	/* target address */
	addr_target= simple_strtoul(argv[2], (void *)0, 16);
    
	/* source address	*/
	addr_source = simple_strtoul(argv[3], (void *)0, 16);
    
	/* length */
	len = simple_strtoul(argv[4], (void *)0, 16);
#endif

    fd = open("/dev/misc/hi3511_pcit", O_RDWR);
    if (fd < 0 ) {
        perror("open");
        return -1;
    }
    
    trans = 2;

    /* access share window. */
	if(trans == 1){
	    test_window(fd);
	}else if(trans == 2) {
        test_dma(fd);        
    }else if(trans == 3) {
        test_doorbell(fd);        
	}else {
	    printf("no test cased excuted!\n");
    }	
    close(fd);
    return 0;
}
Beispiel #2
0
int main(void) {

	//uart_configureinterrupts(0, true, false, false, false);

	volatile uint16_t* basicvideo = (uint16_t*) 0x200000;
	volatile uint16_t* basicsound = (uint16_t*) 0x600000;

	vt100_resetdevice();
	vt100_setattributes();
	vt100_erase_screen();
	vt100_cursor_home_pos(1, 0);

	test_dma();

	//while(1){};

	//while (1) {

	//	printf("Hello, World! 0x%02"PRIx8"\n", input_port0);

	//	for (int y = 0; y < 128; y++) {
	//		for (int x = 0; x < (256 / 2); x++) {
	//			*(basicvideo + (((256 / 2) * y) + x)) = i;
	//if (y < 128 / 2) {
	//	*(basicvideo + (((256 / 2) * y) + x)) = x < (128 / 2) ? 0xE0E0 : 0x0707;
	//}
	//else {
	//	*(basicvideo + (((256 / 2) * y) + x)) = x < (128 / 2) ? 0x1818 : 0x1f1f;
	//}
	//		}
	//	}
	//	i++;
	//}

	uint16_t sr = machine_getstatusregister();
	machine_setstatusregister((sr & 0xf8ff));

	while (1) {
		vt100_cursor_save;
		vt100_erase_line();
		uint8_t port0 = input_port0;
		printf("pwm divisor 0x%04"PRIx16" ", *basicsound);
		if (port0 != 0xFF) {
			printf("port0 0x%02x - ", port0);
			if ((port0 & ~BUTTON_UP) == 0) {
				printf("UP ");
				*basicsound += 10;
			}
			if ((port0 & ~BUTTON_DOWN) == 0) {
				printf("DOWN ");
				*basicsound -= 10;
			}
			if ((port0 & ~BUTTON_LEFT) == 0) {
				printf("LEFT ");
				*basicsound -= 1;
			}
			if ((port0 & ~BUTTON_RIGHT) == 0) {
				printf("RIGHT ");
				*basicsound += 1;
			}
			if ((port0 & ~BUTTON_START) == 0) {
				printf("START ");
			}
			if ((port0 & ~BUTTON_A) == 0) {
				printf("A ");
			}
			if ((port0 & ~BUTTON_B) == 0) {
				printf("B ");
			}
			if ((port0 & ~BUTTON_C) == 0) {
				printf("C ");
			}
		}
		printf("\n");
		vt100_cursor_unsave();

	}

	return 0;
}