Exemplo n.º 1
0
/**
 *	This is the systems main entry, some call it a boot thread.
 *
 *	-- Absolutely nothing wrong with this being called main(), just it doesn't have
 *	-- the same prototype as you'd see in a linux program.
 **/
int main(void) {
	SetGpioFunction(47, 1);			// RDY led

	initFB();
	SetGpio(47, 1);
	videotest();

	DisableInterrupts();
	InitInterruptController();

	xTaskCreate(task1, "LED_0", 128, NULL, 0, NULL);
	xTaskCreate(task2, "LED_1", 128, NULL, 0, NULL);

	vTaskStartScheduler();

	/*
	 *	We should never get here, but just in case something goes wrong,
	 *	we'll place the CPU into a safe loop.
	 */
	while(1) {
		;
	}
}
Exemplo n.º 2
0
Arquivo: test.c Projeto: kisom/pmon
static int cmd_test(int ac,char **av)
{
long tests;
int i;
int j;
char cmd[200];
int  freq;  
char    fs[10], *fp;
tests=strtoul(av[1],0,0);

for(i=0;i<31;i++)
{   
    int t[8] = {0};
	int k = 0;
	int n = 0;
	int m = 0;
	
	int s = 0;
	if(!(tests&(1<<i)))continue;
	switch(1<<i)
	{
		case TEST_CPU:
			cputest();
			break;
		case TEST_MEM:
			memtest();
			break;
		case TEST_SERIAL:
			serialtest();
			break;
#if 0
        case TEST_PPPORT:
			pptest();
			break;
#endif
		case TEST_RTL0:
//			strcpy(cmd,"ifconfig em0 remove;ifconfig em1 remove;ifconfig rtl0 remove;ifconfig rtl0 192.168.2.1;");
//			strcpy(cmd,"ifconfig rtl0 remove;ifconfig rtl0 192.168.2.1;");
			strcpy(cmd,"set ifconfig rtl0:192.168.2.17;");
			do_cmd(cmd);
			printf("Plese plug net wire into rtl0\n");
			#if 0
			pause();
			#endif
			strcpy(cmd,"ping -c 12 192.168.2.231");
			do_cmd(cmd);
		#if 0  //xuhua
			t[7] = net_ping; 	
			printf("bbbbbbb=%d\n",net_ping);
			m = cmd_ping("ping", 4,  (char **){"ping", "-c", "10", "192.168.2.231"});
			printf("aaaaaaaaaaaaa=%d\n",m);
		#endif
			
			break;
#if 0
       case TEST_EM0:
			strcpy(cmd,"ifconfig em0 remove;ifconfig em1 remove;ifconfig rtl0 remove;ifconfig em0 192.168.2.1");
			do_cmd(cmd);
			printf("Plese plug net wire into em0\n");
			pause();
			strcpy(cmd,"ping -c 3 192.168.2.231");
			do_cmd(cmd);
			break;
		case TEST_EM1:
			strcpy(cmd,"ifconfig em0 remove;ifconfig em1 remove;ifconfig rtl0 remove;ifconfig em1 192.168.2.1;");
			do_cmd(cmd);
			printf("Plese plug net wire into em1\n");
			pause();
			strcpy(cmd,"ping -c 3 192.168.2.231");
			do_cmd(cmd);
			break;
#endif
#if 1			        
		case TEST_FREQ:
			freq = tgt_pipefreq ();
			sprintf(fs, "%d", freq);

			fp = fs + strlen(fs) - 6;
			fp[3] = '\0';
			fp[2] = fp[1];
			fp[1] = fp[0];
			fp[0] = '.';
			printf (" %s MHz\n", fs);
       
			freq = tgt_cpufreq ();
            sprintf(fs, "%d", freq);
			
			fp = fs + strlen(fs) - 6;
			fp[3] = '\0';
			fp[2] = fp[1];
			fp[1] = fp[0];
			fp[0] = '.';
			printf ("Bus @ %s MHz\n", fs);
			break;
#endif		
		case TEST_VIDEO:
			videotest();
			break;
		case TEST_HD:
			hdtest();
			break;
		case TEST_KBD:
			kbdtest();
			break;			
		case TEST_PCI:
			pcitest();
			break; 
#if 0
        case TEST_FLOPPY:
			fdtest();
			break;
#endif

#if 1		
        case TEST_ALL:
		    printf("begin to test cpu float calculation !!\n");
		    j = cputest();
			if ( j != 0 ) {printf("test cpu failure !!\n"); t[k] = 1;k++;t[k] = 0;}
			else {t[k] = 0;k++;}
			printf("continue test memory!!\n");
	        j = memtest();
			if ( j !=0 ) {printf("test memory failure !!\n");t[k] = 2;k++;t[k] = 0;}
			else {t[k] = 0;k++;}
			printf("continue test serial !!\n");
			j = serialtest();
			if ( j !=0 ) {printf("test serial failure !!\n");t[k] = 512;k++;t[k] = 0;}
			else {t[k] = 0;k++;}
           //test rtl0 
           // strcpy(cmd,"ifconfig rtl0 remove;ifconfig rtl0 192.168.2.1;");
            strcpy(cmd,"set ifconfig rtl0:192.168.2.17;");
			do_cmd(cmd); 
			printf("Plese plug net wire into rtl0\n");
			//pause();
			strcpy(cmd,"ping -c 12 192.168.2.231");
			do_cmd(cmd);
		#if 0  //xuhua add
		//	if (net_ping == 4){
			t[7]=net_ping;     
		//	printf("cccccccccccccc=%d\n",net_ping);//} //xuhua
		//	else
		//	    t[7] = 0;
		//	m = cmd_ping("ping", 4,  (char **){"ping", "-c", "4", "192.168.2.231"});
		//	printf("aaaaaaaaaaaaa=%d\n",m);
		#endif
			//#############
			//*****test cpu frequency**********//
			printf("Test cpu frequency");
			freq = tgt_pipefreq ();
			sprintf(fs, "%d", freq);

			fp = fs + strlen(fs) - 6;
			fp[3] = '\0';
			fp[2] = fp[1];
			fp[1] = fp[0];
			fp[0] = '.';
			printf (" %s MHz\n", fs);

			freq = tgt_cpufreq ();
			sprintf(fs, "%d", freq);

			fp = fs + strlen(fs) - 6;
			fp[3] = '\0';
			fp[2] = fp[1];
			fp[1] = fp[0];
			fp[0] = '.';
			printf ("Bus @ %s MHz\n", fs);
			delay(2000000);
			//****************************//
            j = videotest();
			if ( j!= 0 ) {printf("test video failure !!\n");t[k] = 64;k++;t[k] = 0;}
			else {t[k] = 0;k++;}
			#if 1
			printf("continue test hardware !!");
			j = hdtest();
			if ( j != 0 ) {printf("test harddisk failure !!\n");t[k] = 128;k++;t[k] = 0;}
			else {t[k] = 0;k++;}
			#endif
#if !(defined(VGA_NOTEBOOK_V1) || defined(VGA_NOTEBOOK_V2))
			printf("test kbd\n");
			j = kbdtest();
			if ( j != 0 ) {printf("test kbd failure !!\n");t[k] = 256;k++;t[k] = 0;}
			else 
#endif
			{t[k] = 0;k++;}
			printf("continue test pci !!\n");
			j = pcitest();
			if ( j != 0 ) {printf("test pci failure !!\n");t[k] = 32;k++;t[k] = 0;}
			t[k] = net_ping;
            
			for (;n<8;n++)
			  {
			   switch(t[n])
                {
			 	 case 1:
				      printf("test cpu float calculation error!!\n");
					  break;
				 case 2:
				      printf("test memory error!!\n");
					  break;
				 case 4:
				      printf("test net error with ping!!\n");
					  break;
				 case 512:
				      printf("test serial error!!\n");
					  break;
				 case 64:
				      printf("test video error!!\n");
					  break;
				 case 128:
				      printf("test harddisk error!!\n");
					  break;
				 case 256:
				      printf("test kbd error!!\n");
					  break;
				 case 32:
				      printf("test pci error!!\n");
				      break;
				}
			  }
	#if 1		  
		   while (k > 0){
		           t[0] |= t[k];
				   k--;
			       }
		   if ( t[0] == 0 ) 
			  printf("\t Test without error found\n");
		      printf("\nTest Over!!\n");
    #endif
# endif
			break;
}
	     #if 0
	        pause();
		 #endif
}

return 0;
}
Exemplo n.º 3
0
int main(int argc, char* argv[])
{
    printf("\n\n\n\n----- Phantom exec test v. 0.5\n\n");


    run_init_functions( INIT_LEVEL_PREPARE );
    run_init_functions( INIT_LEVEL_INIT ); // before video

    //drv_video_win32.mouse = mouse_callback;
    //video_drv = &drv_video_win32;
    //video_drv = &drv_video_x11;

    args(argc,argv);

    pvm_bulk_init( bulk_seek_f, bulk_read_f );

    pvm_video_init();
    video_drv->mouse = mouse_callback;

    drv_video_init_windows();
    init_main_event_q();
    init_new_windows();

    scr_mouse_set_cursor(drv_video_get_default_mouse_bmp());


    mem = malloc(size+1024*10);
    setDiffMem( mem, malloc(size+1024*10), size );

    hal_init( mem, size );
    //pvm_alloc_threaded_init(); // no threads yet - no lock

    run_init_functions( INIT_LEVEL_LATE );

#if 0
    videotest();
    //getchar();
    exit(0);
#endif

#if 0
    new_videotest();
    getchar();
    exit(0);
#endif


    char *dir = getenv("PHANTOM_HOME");
    char *rest = "plib/bin/classes";

    if( dir == NULL )
    {
        dir = "pcode";
        rest = "classes";
    }

    char fn[1024];
    snprintf( fn, 1024, "%s/%s", dir, rest );

    if( load_code( &bulk_code, &bulk_size, fn ) ) //"pcode/classes") )
    {
        printf("No bulk classes file '%s'\n", fn );
        exit(22);
    }
    bulk_read_pos = bulk_code;


    pvm_root_init();


    // TODO use stray catcher in pvm_test too
    //stray();

#if 0
//ui_loop( argc, argv, "test");
    printf("\nPhantom code finished\n" );
    //getchar();
    //{ char c; read( 0, &c, 1 ); }
	sleep(100);
#else
    dbg_init();
    kernel_debugger();
#endif

#if 0
    pvm_memcheck();

    printf("will run GC\n" );
    run_gc();

    printf("press enter\n" );
//    getchar();

    pvm_memcheck();

    save_mem(mem, size);
#endif
    return 0;
}