Beispiel #1
0
//1ms定时器中断服务程序
void* download_timer_thread(void* thread_arg){
	int exitthread=0;
	while(!exitthread){
		platform_usleep(1000*100);
		if (TimeOut>0) TimeOut--;		
	}
	return NULL;
}
// SangSpilling foregår ved å sette registerene A (X, Y) før en kaller opp interpreteren
int main(int argc, char **argv) {
	if((fd_mem = open("/dev/mem", O_RDWR | O_SYNC)) == -1) {
		printf("Could not get /dev/mem\n");
		return -1;
	}
	
	sid_kernel_timer = fopen("/dev/sid_timer", "r");
	if (sid_kernel_timer == NULL) {
		printf("Could not get /dev/sid_timer\n");
		return -1;
	}
	
	set_realtime();
	printWelcome();
	initGPIO();
	initPWM();

	// sjekk opp argv[1]
	if (argv[1]) {
		menu_init(argv[1]);
	} else {
		printf("Required parameter - top level directory not specified");
		exit(1);
	}
	
	if (argc > 2) {
		int z = strtol(argv[2], NULL, 10);
		printf("LCD reinit %d\n", z);
		lcd_reinit(z, z);
	} else {
		lcd_init();
	}
	
	while(1) {
		menu_run();
		
		if (inputSidFile != NULL) {
			int32_t next = c64_play();
			next = next * ((float) sh.hz / 1000000.0f);
            platform_usleep(next);
		} else {
			usleep(1000);
		}
	}
}
Beispiel #3
0
//Xms延时程序
static inline void DelayXms(WORD x)
{
    platform_usleep(x*1000);
}