Ejemplo n.º 1
0
void Main_task(uint_32 temp)
{
    uint_32           error;
    MQX_FILE_PTR      flash_hdl;
	 _enet_address    enet_address;
    
    /* Sets the address of the MQX exit handler, which MQX calls when it exits */
    _mqx_set_exit_handler(_bootloader_exit);
    
    error = RTCS_create();
    if (error != RTCS_OK) 
    {
        printf("\nRTCS failed to initialize, error = %X", error);
        _task_block();
    }

    /* Enable IP forwarding */
    _IP_forward = TRUE;

#ifdef ENET_DEVICE
    ENET_get_mac_address (ENET_DEVICE, ENET_IPADDR, enet_address);
#endif

   printf("\nMQX version %s",_mqx_version);
   printf("\nBoot loader application (build: %s)", __DATE__);
   printf("\n");
 
   /* Open the flash device */
   flash_hdl = fopen(FLASH_NAME_INIT, NULL);
   if (flash_hdl == NULL) {
        printf("\nUnable to open flash device");
        _task_block();
   }

   /* Initialize Image Table if not exist image */
   if (BOOTLOADER_OK == _bootloader_init_table(flash_hdl))
   {
      Auto_boot_startup(flash_hdl); 
   }
   
   fclose(flash_hdl);
   printf("\n");
   /* Run the shell */
   Shell(Shell_commands, NULL);
   for(;;) 
   {
       printf("Shell exited, restarting...\n");
       Shell(Shell_commands, NULL);
   }
}
Ejemplo n.º 2
0
int main(int argc, char *argv[]) {

    FILE *fin;

    Shell shell = Shell(argc, argv);
    
    if (shell.getSourceFilename()[0] == '\0') {
        fin = stdin;
        shell.getMessage().print(NORMAL, "compiler: No source file provided. Reading from standard input");
    } else {
        if (shell.isStandardInput()) {
            shell.getMessage().print(WARNING, "compiler: ignoring option --stdin: using source file \"%s\"", shell.getSourceFilename());
        }
        fin = fopen(shell.getSourceFilename(), "r");
        if (!fin) {
            shell.getMessage().print(PANIC, "compiler: file \"%s\" not found", shell.getSourceFilename());
        }
        shell.getMessage().print(VERBOSE, "compiler: reading from source file \"%s\"", shell.getSourceFilename());
    }
    
    SymbolTable symbolTable = SymbolTable(shell.getMessage());
    
    Parser parser = Parser(fin, shell.getTabWidthParam(), &symbolTable, shell.getMessage());
    
    if (parser.read()) {
        shell.getMessage().print(NORMAL, "%i line%c processed: compile successful", parser.getScanner().getLinesRead(), parser.getScanner().getLinesRead() > 1 ? 's' : ' ' );

    } else {
        shell.getMessage().print(NORMAL, "%i errors: %i warnings: compile failed", parser.getMessage().getErrorCount(), parser.getMessage().getWarningCount());
    }
    
    return 0;

}
Ejemplo n.º 3
0
void Shell_task(uint_32 initial_data)
{
    while (1)
    {
        Shell(Shell_commands,NULL);    /* start shell */
    }
}
Ejemplo n.º 4
0
void shell_task(uint_32 datas)
{
    for (;;)  
    {
        /* Run the shell */
        Shell(Shell_commands, NULL);
        printf("Shell exited, restarting...\n");
    }
}
Ejemplo n.º 5
0
void Shell_task
(
    uint_32 temp
)
{
    /* Run the shell on the serial port */
    printf("Audio driver demo application\n");
    Shell(Shell_commands, NULL);
    _mqx_exit(0);
}
Ejemplo n.º 6
0
int _tmain(int argc,LPTSTR * argv){
	GetVersionEx(&_os_);
	SetConsoleTitle(_T("racaljk-host tools"));
	if (argc==1) Shell("-r");
	else
		if (!_tcscmp(_T("-r"),argv[1])) NormalEntry(false);
		else
			if (!_tcscmp(_T("-i"),argv[1])) Shell("-install");
			else
				if (!_tcscmp(_T("-install"),argv[1])) Func_Service_Install(argv[0]);
				else
					if (!_tcscmp(_T("-svc"),argv[1])) StartServiceCtrlDispatcher(STE);
					else 
						if (!_tcscmp(_T("-u"),argv[1])) Shell("-uninstall");
						else
							if (!_tcscmp(_T("-uninstall"),argv[1])) Func_Service_UnInstall();
							else _tprintf(_T("Bad Parameters.\n")),abort();
	return 0;
}
Ejemplo n.º 7
0
/*TASK*-----------------------------------------------------------------
*
* Function Name  : shell_task
* Returned Value : void
* Comments       :
*
*END------------------------------------------------------------------*/
void shell_task(uint_32 temp)
{
    /* Run the shell on the serial port */
    printf("SD card demo\n");
    for(;;)
    {
        Shell(Shell_commands, NULL);
        printf("Shell exited, restarting...\n");
    }
}
Ejemplo n.º 8
0
/*TASK*-----------------------------------------------------------------
*
* Function Name  : Shell_Task
* Returned Value : void
* Comments       :
*
*END------------------------------------------------------------------*/
void Shell_Task(uint_32 temp)
{ 

   /* Run the shell on the serial port */
   printf("Demo start\n\r");
   Ram_disk_start();
   for(;;)  {
      Shell(Shell_commands, NULL);
      printf("Shell exited, restarting...\n");
   }
}
Ejemplo n.º 9
0
/*TASK*-----------------------------------------------------------------
*
* Function Name  : Shell_Task
* Returned Value : void
* Comments       :
*
*END------------------------------------------------------------------*/
void Shell_Task(uint32_t temp)
{
   (void)temp; /* suppress 'unused variable' warning */

   /* Run the shell on the serial port */
   printf("Demo start\n\r");
   for(;;)  {
      Shell(Shell_commands, NULL);
      printf("Shell exited, restarting...\n");
   }
}
Ejemplo n.º 10
0
Archivo: csort.c Proyecto: eposts/Rich
void driver( enum sort atype, int *array, int elements,
            int random, int delay_factor )
{

switch( atype )
  {
	/* 所有排序算法 */
   case all    :
	/* 冒泡排序 */
   case bubble :
            Setscreen( array, elements, random );
            gprintf( &xaxis, &yaxis, *(sorts + bubble) );
            Bubble( array, elements, delay_factor );
            if ( atype != all ) break; else delay( 1350 );
	/* 延迟交换排序 */
   case delayed:
            Setscreen( array, elements, random );
            gprintf( &xaxis, &yaxis, *(sorts + delayed) );
            Delayed( array, elements, delay_factor );
            if ( atype != all ) break; else delay( 1350 );
	/* 希尔排序 */
   case shell  :
            Setscreen( array, elements, random );
            gprintf( &xaxis, &yaxis, *(sorts + shell ));
            Shell( array, elements, delay_factor );
            if ( atype != all ) break; else delay( 1350 );
	/* Metzner希尔排序 */
   case shell_metzner:
            Setscreen( array, elements, random );
            gprintf( &xaxis, &yaxis, *(sorts + shell_metzner) );
            Shell_Metzner( array, elements, delay_factor );
            if ( atype != all ) break; else delay( 1350 );
	/* 快速排序 */
   case quick  :
            Setscreen( array, elements, random );
            gprintf( &xaxis, &yaxis, *(sorts + quick) );
            Quicksort( array, 0, elements - 1, delay_factor );
            if ( atype != all ) break; else delay( 1350 );
	/* 插入排序 */
   case insertion:
            Setscreen( array, elements, random );
            gprintf( &xaxis, &yaxis, *(sorts + insertion) );
            Insertion( array, elements, delay_factor );
            if ( atype != all ) break; else delay( 1350 );
	/* 停止 */
   case stop:

   default:;
  }
}
Ejemplo n.º 11
0
/** Main function of the kernel */ 
int 
main() 
{
	uint16_t err;
	char args[12][128];
	extern multiboot_info_t *multiboot;

	
	err = arch_init();
	
	if(err)
	{
		arch_shutdown();
		while(1);
	}

	/* kernel start message */
	arch_kclear();
	arch_ksetcl(COL_H);
	printf("* %s %s (rev %s on %s)\n", NAME, RELEASE_NAME, REVISION, ARCH);
	arch_ksetcl(COL_N);
	puts("Loading...\n");
	printf("Kernel compiled with: %s\n", CONTENTS);
	
	/* mem initialization */
	printf("MemoryManager init, %s\n", ((!mm_init(arch_mem_total())) ? "done" : "fail"));
	

	/* Create all singleton elements */
	Managers::Instance = (Managers *) /*SINGLETON_ADDRESS; */ new Managers();
	Managers::Instance->archManager = new ArchManager();
	Managers::Instance->deviceManager = new DeviceManager();
	Managers::Instance->driverManager = new DriverManager();
	Managers::Instance->taskManager = new TaskManager();
	#ifdef VFS
		Managers::Instance->vfsManager = new VFSManager();
	#endif
	#ifdef NETWORK
		Managers::Instance->netManager = new NetworkManager();
	#endif
	#ifdef PCIBUS
		Managers::Instance->pciBus = new PciBus();
	#endif
	#ifdef UI
		Managers::Instance->uiManager = new UiManager();
	#endif
	#ifdef PRINT
		Managers::Instance->printManager = new PrintManager();
	#endif
	#ifdef MEDIA
		Managers::Instance->mediaManager = new MediaManager();
	#endif
	#ifdef SECURITY
		Managers::Instance->securityManager = new SecurityManager();
	#endif

	Instance = (void *) Managers::Instance;

	/* Parse cmdline commands */
	#ifdef X86
	{
		char *cmd = (char *) multiboot->cmdline;
		int i = 0;
		int k = 0;

		while(*cmd != 0)
		{
			if(*cmd == ' ')
			{
				args[k][i] = 0;
				k++;
				i = 0;
			}
			else
				args[k][i++] = *cmd;
			cmd++;
		}
		args[k][i] = 0;
		args[k+1][0] = 0;
	}
	#endif
	#ifdef PCIBUS
		Managers::Instance->pciBus->Update();
	#endif

	/* Probing all devices */
	printf("Probing devices: ");
	printf("%s\n", Managers::Instance->deviceManager->Probe() == 0 ? "none" : " ");


	/* Mounting filesystems */
	#ifdef VFS
		/* Parse kernel arguments to find a valid fs */
		char fs[16] = {};
		char dev[16] = {};

		int i;
		for(i = 0; (i < 12) && (args[i][0] != 0); i++)
		{
			if(strncmp(args[i], "dev=", strlen("dev=")) == 0)
				strcpy(dev, args[i]+strlen("dev="));
			else if(strncmp(args[i], "fs=", strlen("fs=")) == 0)
				strcpy(fs, args[i]+strlen("fs="));
		}


		/* If there's fs and dev infos, mount the partition */
		if((fs[0] != 0) && (dev[0] != 0))
		{
			bool state;

			printf("Mounting %s with %s, ", dev, fs);

			state = Managers::Instance->vfsManager->Mount("/", Managers::Instance->deviceManager->getDevice(dev), fs);
			state ? printf("done\n") : printf("fail\n");

			#if 0
			ReadDir d;
			i = 0;
			printf("Listing directory /\n");
			while(Managers::Instance->vfsManager->readDir("/", &d, i))
			{
				printf("\t%d -> %s\n", d.Node, d.Name);
				i++;
			}
			#endif
		}
	#endif

	/* Probing all network iface */
	#ifdef NETWORK
		printf("Probing network interfaces: ");
		printf("%s\n", Managers::Instance->netManager->Probe() == 0 ? "none" : " ");
	#endif

	Shell();
	#ifdef TEST
		/* Syscall test */
		printf("Testing syscall and global singleton... ");
		extern void TestSyscall();
		TestSyscall();

		/* Test elf file loading */
		printf("Executing test app\n");
		Managers::Instance->taskManager->Exec("/test", NULL, NULL);
	#endif

	#ifdef UI
		/*  if(!*/Managers::Instance->uiManager->Setup(); //)
		/* {
			printf("Cannot start ui.\n");
			#ifdef SHELL
				Shell();
			#endif
		}
		else*/
			Managers::Instance->uiManager->mainLoop();
	#endif
	#ifndef UI
		#ifdef SHELL
			Shell();
		#endif
	#endif

	printf("\nNothing to do. Infinite loop\n");

	while(1);
	return 0;	
}	
Ejemplo n.º 12
0
int main(int argc,char *argv[])
{
	char filename[STRING],*path;
	int opcja,TimeSrand=OFF,i,makebatch=OFF,OldPrn;
	
#ifdef MULTITHREAD
	/* UWAGA !
	Blokowanie sygnalu SIGCLD zapobiega powstawaniu procesow ZOMBI
	w przypadku wczesniejszego zakonczenia procesu potomnego
	konstrukcja nieprzenosna dziala pod Linux'em
	*/
	
	if(signal(SIGCLD,SIG_IGN)==SIG_ERR)
	{
		fprintf(stderr,"Problems trapping signal SIGCLD !\n");
		return 1;
	}
#endif
	
	sortAlphabetic();            /* Sortowanie polecen w kolejnosci alfabetycznej */
	OldDimRoz=32;                /* Liczba atomow do rekonstrukcji */
	DimBase=512;                 /* Wymiar sygnalu */
	epsylon=95.0F;               /* Dokladniosc rekonstrukcji */
	prn=ON;                      /* Drukowanie informacji */
	SamplingRate=1.0;            /* Czestotliwosc probkowania */
	ConvRate=1.0;                /* Wspolczynnik konwersji */
	RandomType=NOFUNCRND;        /* Sposob generacji atomow */
	DiadicStructure=OFF;         /* Diadyczna struktura slownika */
	FastMode=ON;                 /* Szybka generacja atomow (wymaga duzo pamieci) */
	VeryFastMode=ON;             /* Bardzo szybka generacja iloczynow skalarnych */
	DictionSize=70000;           /* Domyslny rozmiar slownika */
	Heuristic=OFF;               /* Wspomaganie heurystyczne */
	StartDictionSize=25000;      /* Rozmiar slownika do probkowania */
	MallatDiction=OFF;           /* Slownik Mallata */
	OverSampling=2;              /* Przeprobkowanie slownika */
	
	while((opcja=Getopt(argc,argv,"R:P:E:M:HhB:O:F:C:i:x:dsfN:TS:v:JD:X"))!=EOF)
	{
		switch(opcja)
		{
        case 'X':
			debug=1;
			break;
        case 'S':
			OverSampling=atoi(optarg);
        case 'T':
			MallatDiction=ON;
			DiadicStructure=ON;
			break;
        case 'N':
			Heuristic=ON;     /* Pozostale parametry domyslne w mp.c */
			sscanf(optarg,"%d,%d,%d,%d",&StartDictionSize,&ROctave,
				&RFreqency,&RPosition);
			break;
        case 'v':
			if(strcmp(optarg,"+")==0)
                FastMode=VeryFastMode=ON;
			else if(strcmp(optarg,"-")==0)
                VeryFastMode=OFF;
			else
			{
				fprintf(stderr,"Available options -v[-|+] !\n");
				return 1;
			}
			break;
        case 'P':
			if(strcmp(optarg,"+")==0)
                prn=ON;
			else if(strcmp(optarg,"-")==0)
                prn=OFF;
			else
			{
				fprintf(stderr,"Available options -P[-|+] !\n");
				return 1;
			}
			break;
        case 'f':
			FastMode=ON;
			break;
        case 's':
			FastMode=OFF;
			break;
        case 'd':
			DiadicStructure=ON;
			break;
        case 'R':
			DictionSize=atoi(optarg);
			break;
        case 'x':
			(void)strcpy((char *)FunctionCode,optarg);
			RandomType=FUNCRND;
			MallatDiction=OFF;
			break;
        case 'i':
			if(strcmp(optarg,"+")==0)
				TimeSrand=ON;
			else if(strcmp(optarg,"-")==0)
				TimeSrand=OFF;
			else
			{
				fprintf(stderr,"Available options -i[-|+] !\n");
				return 1;
			}
			break;
        case 'O':
			DimBase=atoi(optarg);
			break;
        case 'F':
			SamplingRate=atof(optarg);
			break;
        case 'C':
			ConvRate=atof(optarg);
			break;
        case 'B':
			(void)strcpy(filename,optarg);
			makebatch=ON;
			break;
        case 'M':
			OldDimRoz=atoi(optarg);
			break;
        case 'E':
			epsylon=atof(optarg);
			break;
        case 'J':  /* Wylaczenie buforowania */
			javaMode=ON;
			setvbuf(stdout,(char *)NULL,_IOLBF,0);
			setvbuf(stderr,(char *)NULL,_IOLBF,0);
			break;
        case 'D':
			AdaptiveConst=(float)atof(optarg);
			break;
        case 'H':
        case 'h':
        default:
			PrintHelp();
			return 0;
		}
	}
	
	SetTuneScale();

	OldPrn=prn;                           /* Blokowanie drukowanie inforamcji */
	prn=OFF;
	
	if(MallatDiction==ON)
		DictionSize=MakeMallatDictionary(DimBase,OverSampling,OFF);
	
	if((path=getenv("MP_PATH"))==NULL)       /* Sciezka dla batch'y  */
	{
		char path2[10]=".";

		if(prn==ON)
			/*PJD        fprintf(stderr,"\nWARNING: environment variable MP_PATH not set !\n");*/
			fprintf(stderr,"\nPath set to \".\" (HMPP env. var. not set)\n");
		SetBatchPath(path2);
	}
	else 
		SetBatchPath(path);
	
	if(Heuristic==ON)                     /* Poprawnosc konfiguracji */
	{
		if(StartDictionSize>=DictionSize)
			Heuristic=OFF;
		else if(FastMode==OFF)
			Heuristic=OFF;
		else if(DiadicStructure==OFF)
			Heuristic=OFF;
	}
	
	if(Heuristic==OFF)
		StartDictionSize=DictionSize;
	
	if(prn==ON && RandomType==FUNCRND)
		fprintf(stdout,"VAL= %s\n",FunctionCode);
	
	if(InicRandom(TimeSrand)==-1)
	{
		fprintf(stderr,"Problem initializing stochastic dictionary:(\n");
		return 1;
	}
	
	if((sygnal=MakeVector(3*DimBase))==NULL ||
		(OrgSygnal=MakeVector(DimBase))==NULL)
    {
		fprintf(stderr,"Memory allocation error (main:(\n");
		return 1;
    }
	
	for(i=0 ; i<3*DimBase ; i++)
		sygnal[i]=0.0F;
	
	for(i=0 ; i<DimBase ; i++)
		OrgSygnal[i]=0.0F;
	
	AllocStatus=ON;
	
	if(Batch(commands,"mp.cfg",NULL)==-1)      /* Plik konfiguracyjny */
	{
		char name[STRING];
		strcmp(name,BatchPath); strcat(name,"mp.cfg");
		if(Batch(commands,name,NULL)==-1)
			if(prn==ON)
				fprintf(stderr,"\nNo config file (mp.cfg)\n");
	}
	
	prn=OldPrn;                          /* mozna ustawic prn */

	if(makebatch==ON)
	{
		if(Batch(commands,filename,NULL)==-1)      /* Wykonanie skryptu */
		{
			fprintf(stderr,"cannot find script file %s\n",filename);
			return 1;
		}
	}
		
	if(prn==ON)
	{
		SourceVersion(NULL);
		SetMPP("");
	}
	
	Shell(commands,help);        /* Rozpoczecie trybu iteracyjnego */
	
	CloseRand2D();
	
	free((void *)sygnal);
	free((void *)OrgSygnal);

	CloseTune();
	return 0;
}
Ejemplo n.º 13
0
static void Telnetd_shell_fn (pointer dummy) 
{  
   Shell(Telnet_commands,NULL);
}
Ejemplo n.º 14
0
static void Telnetd_shell_fn (void *dummy) 
{  
   Shell(Telnet_commands,NULL);
}
Ejemplo n.º 15
0
void Main_task(uint_32 initial_data)
{
#if MQX_USE_LOGS || MQX_KERNEL_LOGGING
   _mqx_uint                 log_result;
#endif 
      
#if MQX_USE_LOGS
   /* create the log component */
   log_result = _log_create_component();
   if (log_result != MQX_OK) { 
      printf("Error: log component could not be created\n");
   } /* endif */
#endif
       

#if MQX_KERNEL_LOGGING == 1
   /* create log number 0 */
   log_result = _klog_create(9000, LOG_OVERWRITE);
   if (log_result != MQX_OK) { 
      printf("Error: log 0 could not be created\n");
   } /* endif */

   /* define kernel logging */
   _klog_control(0xFFFFFFFF, FALSE);
   _klog_control(
      KLOG_ENABLED                  |
      //KLOG_FUNCTIONS_ENABLED        |
      //KLOG_INTERRUPTS_ENABLED       |
      //KLOG_SYSTEM_CLOCK_INT_ENABLED |
      KLOG_CONTEXT_ENABLED          |
      //KLOG_TASKING_FUNCTIONS        |
      //KLOG_ERROR_FUNCTIONS          |
     // KLOG_MESSAGE_FUNCTIONS        |
      //KLOG_INTERRUPT_FUNCTIONS      |
      //KLOG_MEMORY_FUNCTIONS         |
      //KLOG_TIME_FUNCTIONS           |
      //KLOG_EVENT_FUNCTIONS          |
      //KLOG_NAME_FUNCTIONS           |
      //KLOG_MUTEX_FUNCTIONS          |
      //KLOG_SEMAPHORE_FUNCTIONS      |
      KLOG_WATCHDOG_FUNCTIONS, 
      TRUE
      );
#endif

   /*******************************
   * 
   * START YOUR CODING HERE
   *
   ********************************/   
          
   for (;;)   
   { 
      /* Run the shell */ 
      Shell(Shell_commands, NULL); 
      printf("Shell exited, restarting...\n"); 
   } 

   

}
Ejemplo n.º 16
0
void Telnetd_shell_fn(void) 
{  
  Shell(Telnet_commands,NULL);
}
Ejemplo n.º 17
0
void main()
{
	int			iOpcion = -1;
	int			f=0;
	ty_vec		vec_desord;
	//omp_set_num_threads(4);

		srand(2);//Siempre usar la semilla antes de llamar la funcion CargarVectorDesordenado, para generar siempre los mismos numeros
		system("cls");
		CargarVectorDesordenado(vec_desord);//Cargo en vector los numeros desordenados
		Menu();
		if(!(cin>>iOpcion))
		{
			LimpiarCin();
		}
		while(iOpcion!=0)
		{
			switch(iOpcion)
			{
				case 1:
					Burbujeo(vec_desord);
					srand(2);
					CargarVectorDesordenado(vec_desord);//Se vuelve a cargar el vector desordenado
					BurbujeoParalelo(vec_desord);
					srand(2);
					CargarVectorDesordenado(vec_desord);//Se vuelve a cargar el vector desordenado
				break;
				case 2:
					BurbujeoBidireccional(vec_desord);
					srand(2);
					CargarVectorDesordenado(vec_desord);//Se vuelve a cargar el vector desordenado
					BurbujeoBidireccionalParalelo(vec_desord);
					srand(2);
					CargarVectorDesordenado(vec_desord);//Se vuelve a cargar el vector desordenado
				break;
				case 3:
					Shell(vec_desord);
					srand(2);
					CargarVectorDesordenado(vec_desord);//Se vuelve a cargar el vector desordenado
					ShellParalelo(vec_desord);
					srand(2);
					CargarVectorDesordenado(vec_desord);//Se vuelve a cargar el vector desordenado
				break;
				case 4:
					InsertionSort(vec_desord);
					srand(2);
					CargarVectorDesordenado(vec_desord);//Se vuelve a cargar el vector desordenado
					InsertionSortParalelo(vec_desord);
					srand(2);
					CargarVectorDesordenado(vec_desord);//Se vuelve a cargar el vector desordenado
				break;
				default:
				cout<<"Debe ingresar un numero entre 0 y 4";
			}
			Menu();
			if(!(cin>>iOpcion))
			{
				LimpiarCin();
			}
		}
}