Пример #1
0
//********************************************************************
// Main Functions
//********************************************************************
void main(void) { //Main function
    Sys_Init(); // initialize board
    putchar(' '); //the quotes in this line may not format correctly
    Port_Init();//Init ports
    XBR0_Init();//init xbro
    PCA_Init();//init pca
    SMB_Init();//init smb
    printf("\r\n\n\n\nEmbedded Control Electric Compass and Ranger\n"); //print beginning message

    Calibration();//Run calibration
	comp_cal();	//Compass calibration
    Choose_heading();	//Heading choice 
	printf("\r\nheading error");
	while(1) {	//inf loop, 40 ms it returns the heading	

		if (new_heading){	//enough overflows for a new heading COMPASS STUFF
			new_heading = 0;//Clear new_heading
			heading = ReadCompass();	//get compass heading	
			Steering_Servo();	//run steer func
		}//end if new heading
		
		if (new_range) { //if 80 ms has passed
			new_range=0;//Clear new_range
			range=ReadRanger();//read ranger
			start_ping();//start ping
			counts++;//set up text function
			Drive_Motor();	//run drive func
		}//end if new_range

		if (counts == 3){	//prevoudly output prined every 200 ms, now every 180 ms
			print_output();//Print data function. Delete this if faster output is desired
		}//end if counts
	}//end inf while
}//end main
Пример #2
0
static void
init_qf (void)
{
	Sys_Init ();
	Cvar_Get ("developer", va ("%d", options.developer), 0, 0, 0);

	Memory_Init (malloc (1024 * 1024), 1024 * 1024);

	Cvar_Get ("pr_debug", "2", 0, 0, 0);
	Cvar_Get ("pr_boundscheck", "2", 0, 0, 0);

	pr.edicts = &edicts;
	pr.num_edicts = &num_edicts;
	pr.reserved_edicts = &reserved_edicts;
	pr.load_file = load_file;
	pr.allocate_progs_mem = allocate_progs_mem;
	pr.free_progs_mem = free_progs_mem;
	pr.no_exec_limit = 0;	// absolutely want a limit!
	pr.pr_trace = options.trace;

	PR_Init_Cvars ();
	PR_Init ();
	RUA_Init (&pr, 0);
	PR_Cmds_Init(&pr);
	BI_Init (&pr);
}
Пример #3
0
int main(int argc, char **argv)
{
	/* Initialize subsystems */
	Sys_Init();

	/* Set video mode */
	Video_SetMode();

	/* Initialize console */
	Gui_InitConsole();

	/* Draw background */
	Gui_DrawBackground();

	/* Initialize Wiimote */
	Wpad_Init();

	/* Print disclaimer */
	Disclaimer();

	/* Menu loop */
	Menu_Loop();

	/* Restart Wii */
	Restart_Wait();

	return 0;
}
Пример #4
0
//-----------------------------------------------------------------------------
// Main Function
//-----------------------------------------------------------------------------
void main(void)
{
    int heading = 0; 
    // initialize board
    Sys_Init();
    putchar(' '); //the quotes in this line may not format correctly
    Port_Init();
    XBR0_Init();
    PCA_Init();
    SMB0CR = 0x93; // set the frequency of the i2c bus to 95.41 kHz
    ENSMB = 1; //enable the SMBus
    //print beginning message
    //printf("Embedded Control Steering Calibration\n");
    //calibrate_steering();
    //printf("\rCalibrated\n");
    while(1){
        
        //Steering_Servo();
        //printf("H = %d\n",h_counts);
        if(h_counts%2){
            //printf("We are in %d", h_counts);
            heading = read_compass();
        }   
        if(!h_counts){
                printf("\rThe Heading is: %u\n", heading); //print the heading
            }
        
        //else{printf("\rthis is h_coutn %d\n",h_counts);}
    }
}
Пример #5
0
int main (int argc, char **argv)
{
    static quakeparms_t    parms;
    float time, oldtime, newtime;

    parms.memsize = 16*1024*1024;
    parms.membase = malloc (parms.memsize);
    parms.basedir = ".";
    parms.cachedir = NULL;

    COM_InitArgv (argc, argv);

    parms.argc = com_argc;
    parms.argv = com_argv;

    printf ("Host_Init\n");
    Host_Init (&parms);

	Sys_Init();

    // unroll the simulation loop to give the video side a chance to see _vid_default_mode
    Host_Frame( 0.1 );
    VID_SetDefaultMode();

    oldtime = Sys_FloatTime();
    while (1)
    {
		newtime = Sys_FloatTime();
		Host_Frame (newtime - oldtime);
		oldtime = newtime;
    }
	return 0;
}
Пример #6
0
int main (int c, char **v)
{
	quakeparms_t parms;
	
	enableCrunLoop = c > 0;

//	signal(SIGFPE, floating_point_exception_handler);
	signal(SIGFPE, SIG_IGN);

	parms.memsize = 16*1024*1024;
	parms.membase = malloc (parms.memsize);
	parms.basedir = basedir;
	parms.cachedir = cachedir;

	COM_InitArgv(c, v);
	parms.argc = com_argc;
	parms.argv = com_argv;

	Sys_Init();

    Host_Init(&parms);

	Cvar_RegisterVariable (&sys_nostdout);

    oldtime = Sys_FloatTime () - 0.1;

    if(enableCrunLoop) {
    	while(true) {
    		engineTick();
    	}
    } else {
    	AS3_GoAsync();	
    }
}
Пример #7
0
void main(void)
{
	Sys_Init();
	putchar(' ');
	XBR0_Init();
	SMB_Init();
	PCA_Init();
	Drive_Init();
	Port_Init();
	ADC_Init();
	ranger_pd_init();
	//fan angle initialization code goes here
	
	while(1)
	{
		voltage_update();
		if(SS)
		{
			Range_Update(); //update the range
			Drive_Motor(ranger_pd());
		}
	else
		Drive_Motor(PW_NEUT); //if ss is not flipped, put it in neutral

	}
}
Пример #8
0
int main(int argc, char *argv[])
{
	int r;
    
#if MEGAWANG
    if ((r = Sys_Init(argc, argv)) != 0) {
        return r;
    }
    if (!CSTEAM_Init()) {
		wm_msgbox("Error", "Could not initialize Steam. Please check that your Steam client is up and running.");
		return -1;
	}
#endif
	
	buildkeytranslationtable();
	
#ifdef HAVE_GTK2
	gtkbuild_init(&argc, &argv);
#endif
	startwin_open();

	_buildargc = argc;
	_buildargv = (const char **)argv;

	baselayer_init();
	r = app_main(argc, argv);

	startwin_close();
#ifdef HAVE_GTK2
	gtkbuild_exit(r);
#endif
	return r;
}
Пример #9
0
void main(void) {         
	Sys_Init();	//All init function
	putchar(' ');
	XBR0_Init();
	ADC_Init();    
	Port_Init();     
	PCA_Init();     
	SMB_Init();	//end the init function
	     
	lcd_clear();	
	lcd_print("initializing\r\n");
		

	PCA0CP2 = 0xFFFF - MOTOR_NEUT;
	PCA0CPL0 = 0xFFFF - PW_CENTER;
   	PCA0CPH0 = (0xFFFF - PW_CENTER) >> 8;
	while (n_Counts < 50);	//pause for a second?

	start_run();
	while (1) { 
		while(SS){            // if the slideswitch is off          
			slide_switch_off();
		}///end slide switch off
		while(!SS)	//while the slideswitch is on
		{
			Heading();
			Ranger();
			LCD_Print();	//print all values on the lcd
			printf("\n\r Range:%d  Compass:%d  PW:%d", range, heading, PW);	//print these on the secure crt for data aquisition
		}
	}	//end of the infinite while loop
}//end of the main function
Пример #10
0
int Sys_InitGame() {

   //Four args, three unused, and one I don't care to use.
   //char * gamedir[0x100];



   //gmodinfo might need zeroing out on server restarts and whatnot, but for the
   //first server, there ought to be no troubles.

   //Tracing sucks.
   SeedRandomNumberGenerator();

   Sys_InitMemory();

   if(Host_Init(&host_parms) == 0) { //failed.
      return(0);
   }

   Sys_Init(); //be after host_init, as cvars need memory.

   //COM_GetGameDirSize(gamedir, sizeof(gamedir));
   //Sys_InitAuthentication

   Host_InitializeGameDLL();
   Banlist_Init();
   NET_Config(1);

   return(1);
}
void main(void) {         
	Sys_Init();	//All init function
	putchar(' ');
	XBR0_Init();
	ADC_Init();    
	Port_Init();     
	PCA_Init();     
	SMB_Init();	//end the init function
	     
	lcd_clear();	
	lcd_print("initializing\r\n");
	printf("\n\n\n\rinitalizing");

	PCA0CP2 = 0xFFFF - MOTOR_NEUT;//set all to neutural
	PCA0CPL0 = 0xFFFF - PW_CENTER;
   	PCA0CPH0 = (0xFFFF - PW_CENTER) >> 8;

	pause();	//pause for a second?
	start_run();

	while (1) { 
		while(SS){            // if the slideswitch is off          
			slide_switch_off();
		}///end slide switch off
		while(!SS){	//while the slideswitch is on
			Heading();
			Ranger();
			LCD_Print();	//print all values on the lcd
			printf("\n\rRange:%d Compass:%d dh: %d, mPW: %d, sPW %d, batt:%d, obst: %d", range, heading, desired_heading, MOTOR_PW_AND_STEER_PW, STEER_PW, battery, near_obstical);	//print these on the secure crt for data aquisition
			//printf("\n\r Range:%d Compass:%d dh: %d, mPW: %d, sPW %d, obst: %d", range, heading, desired_heading, MOTOR_PW_AND_STEER_PW, STEER_PW, near_obstical);	//print these on the secure crt for data aquisition
		}//end slide switch on
	}	//end of the infinite while loop
}//end of the main function
Пример #12
0
int main()
{
	u8 Rx_Sta,abc;
	Sys_Init();
		
	if(Nrf24l01_Check() == SUCCESS)
		abc = 1;
	while(abc)
	{
//		MPU6050_Read();
		Rx_Sta = NRF_Rxpacket(NRF24L01_RXDATA);
/*		if (TX_Data_OK)
		{
			NRF_TxPacket_AP(Receive_Data, 23);
			TX_Data_OK = 0;
			if(test == 0)
			{
				LED_ON();
				test++;
			}
			else
			{
				LED_OFF();
				test = 0;
			}
		}*/
		if(Rx_Sta)
		{
			LED_ON();
//			printf("%s",NRF24L01_RXDATA);
		}
		else
			LED_OFF();
	}
}
Пример #13
0
static void
write_pcx (image_t *image)
{
	pcx_t      *pcx;
	int         pcx_len, i;
	byte        palette[768];
	QFile      *outfile;

	outfile = Qopen (options.outf_name, "wb");
	if (outfile == NULL) {
		fprintf (stderr, "Error opening output file %s.\n", options.outf_name);

		exit (1);
	}

	// quick and dirty greyscale palette
	for (i = 0; i < 256; i++) {
		palette[i * 3 + 0] = i;
		palette[i * 3 + 1] = i;
		palette[i * 3 + 2] = i;
	}

	Sys_Init ();

	Memory_Init (malloc (MEMSIZE), MEMSIZE);
	pcx = EncodePCX (image->image, image->width, image->height,
					 image->width, palette, false, &pcx_len);
	if (Qwrite (outfile, pcx, pcx_len) != pcx_len) {
		fprintf (stderr, "Error writing to %s\n", options.outf_name);
		exit (1);
	}
	Qclose (outfile);
}
int main(int argc, char **argv)
{
	/* Load Custom IOS */
	IOS_ReloadIOS(249);

	/* Initialize subsystems */
	Sys_Init();

	/* Set video mode */
	Video_SetMode();

	/* Initialize console */
	Gui_InitConsole();

	/* Draw background */
	Gui_DrawBackground();

	/* Initialize Wiimote subsystem */
	Wpad_Init();

	/* Initialize disc subsystem */
	Disc_Init();

	/* Mount SD card */
	Fat_MountSD();

	/* Menu loop */
	Menu_Loop();

	/* Restart */
	Restart();

	return 0;
}
Пример #15
0
/****************************************************************************//**
 * @brief        Main LED Blinking Program
 *               Blink the LED Which is Selected
 * @param[in]	 LED Which We Want to Blink
 * @return		 LED will Get Blink
 *******************************************************************************/
void main (void)
{
	Sys_Init();												// Initialize the System

	/* Loop Forever */
	while(1)
	{
		GPIO_toggleOutputOnPin(GPIO_PORT_P5,GPIO_PIN1);		// Toggle the Output Pin Selected

		Delay_Ms(1000);										// Provides Delay in ms
	}
}
Пример #16
0
void main(void) {
    // initialize board
    Sys_Init();
    putchar(' '); //the quotes in this line may not format correctly
    Port_Init();
    PCA_Init();
    SMB_Init();
    Interrupt_Init();
    printf("Starting\n\r");

    //print beginning message
    printf("Embedded Control Drive Motor Control\r\n");
    // Initialize motor in neutral and wait for 1 second
    MOTOR_PW = PW_NEUT;
	motorPW = 0xFFFF-MOTOR_PW;
    PCA0CPL2 = motorPW;
    PCA0CPH2 = motorPW>>8;
	printf("Pulse Width = %d\r\n",MOTOR_PW);
    c = 0;
    while (c < 50);								//wait 1 second in neutral
	printf("end wait \r\n");
    
    
    
    //Main Functionality
    while (1) {
        if (!SS1) { // If the slide switch is active, set PW to center
            PW = PWCENTER;
            PCA0CP0 = 0xFFFF - PW; // Update comparator with new PW value
            while (!SS1); // Wait...
        } else if (take_heading) { // Otherwise take a new heading
            reading = Read_Compass(); // Get current heading
            printf("%d\n\r", reading);
            Steering_Servo(reading); // Change PW based on current heading
            PCA0CP0 = 0xFFFF - PW; // Update comparator with new PW value
        }


        if (getRange) {
            getRange = 0; // Reset 80 ms flag
            range_val = read_ranger(); // Read the distance from the ranger
            printf("Range:			%d cm \r\n", range_val);
            printf("Pulse Width:	%d \r\n", MOTOR_PW);

            // Start a new ping
            Data[0] = 0x51; // write 0x51 to reg 0 of the ranger:
            i2c_write_data(addr, 0, Data, 1); // write one byte of data to reg 0 at addr
        }

        if (SS0) Drive_Motor(range_val);
        else Drive_Motor(45); // Hold the motor in neutral if the slide switch is off
    }
}
Пример #17
0
int main (int c, char **v)
{

	double		time, oldtime, newtime;
	quakeparms_t parms;
	int j;

//	static char cwd[1024];

//	signal(SIGFPE, floating_point_exception_handler);
	signal(SIGFPE, SIG_IGN);

	memset(&parms, 0, sizeof(parms));

	COM_InitArgv(c, v);
	parms.argc = com_argc;
	parms.argv = com_argv;

	parms.memsize = 16*1024*1024;

	j = COM_CheckParm("-mem");
	if (j)
		parms.memsize = (int) (Q_atof(com_argv[j+1]) * 1024 * 1024);
	parms.membase = malloc (parms.memsize);

	parms.basedir = basedir;
// caching is disabled by default, use -cachedir to enable
//	parms.cachedir = cachedir;

	noconinput = COM_CheckParm("-noconinput");
	if (!noconinput)
		fcntl(0, F_SETFL, fcntl (0, F_GETFL, 0) | FNDELAY);

	if (COM_CheckParm("-nostdout"))
		nostdout = 1;

	Sys_Init();

    Host_Init(&parms);

    oldtime = Sys_DoubleTime ();
    while (1)
    {
// find time spent rendering last frame
        newtime = Sys_DoubleTime ();
        time = newtime - oldtime;

		Host_Frame(time);
		oldtime = newtime;
    }

}
Пример #18
0
int main(int argc, char **argv)
{
	s32 ret;

	/* Load Custom IOS */
	ret = IOS_ReloadIOS(249);

	/* Initialize subsystems */
	Sys_Init();

	/* Set video mode */
	Video_SetMode();

	/* Initialize console */
	Gui_InitConsole();

	/* Draw bckground */
	Gui_DrawBackground();

	/* Initialize Wiimote subsystem */
	Wpad_Init();

	/* Check for Custom IOS */
	if (ret < 0) {
		printf("[+] ERROR: Could not load Custom IOS! (ret = %d)\n", ret);
		goto out;
	}

	/* Initialize ISFS */
	ret = ISFS_Initialize();
	if (ret < 0) {
		printf("[+] ERROR: Could not initialize ISFS! (ret = %d)\n", ret);
		goto out;
	}

	/* Mount ISFS */
	ret = ISFS_Mount();
	if (ret < 0) {
		printf("[+] ERROR: Could not mount ISFS! (ret = %d)\n", ret);
		goto out;
	}

	/* Menu loop */
	Menu_Loop();

out:
	/* Restart */
	Restart_Wait();

	return 0;
}
Пример #19
0
/*********************Main************************************/
int main(void)
{
  Sys_Init();		//系统初始化	
  
  while(1)
  {
    Data_Process();	//数据接收处理
    Display();		//显示
    Send2PC();          //发送数据到PC机
    delay_s(GAP);	//AM2301间隔至少2s才能读取一次  
  }

  return 0;
}
Пример #20
0
void main(void)
{
	char counting_loops = 0;
	// initialize board
	Sys_Init();
	putchar(' ');
	All_Init();
	Accel_Init(); // Provided function in i2c.h for accelerometer use

	PCA0CP2 = 0xFFFF - PW_NEUT;

	setup_count = 25;
	while (setup_count);

	LCD_calibrate_steering();
	printf("\rSteering Calibrated\n");
	lcd_print("Steering Calibrated\n");

	LCD_prompts();

	setup_count = 20;
	prev_h_counts = h_counts; //start the checking flag
	while(1)
	{

		if(!SSgain && calibrate_flag)
		{
			calibrate_accel();
			calibrate_flag = 0;
			//printf("calibrated once\n\r");
		}
		else if (SSgain){
			get_four_readings(); //if the flag is down then we update the car
			//printf("running damn car");
			Run_Car();

		}
		counting_loops = counting_loops ? counting_loops-1 : 5;
		//printf("once through loop %d \n\r",counting_loops);

		if(!counting_loops)
		{
			Info_LCD_print();

			//X accel. Y accel. DPW, SPW, total_time
			printf("%d, %d, %d, %d, %d\n\r", gx, gy, motor_pw, r, total_time);
		}
	}
}
Пример #21
0
int main (int argc, char **argv)
{
	double time, oldtime, newtime;

	printf ("Quake 2 DOS v%4.2f\n", VERSION);

// make sure there's an FPU
	signal(SIGNOFP, Sys_NoFPUExceptionHandler);
	signal(SIGABRT, Sys_DefaultExceptionHandler);
	signal(SIGALRM, Sys_DefaultExceptionHandler);
	signal(SIGKILL, Sys_DefaultExceptionHandler);
	signal(SIGQUIT, Sys_DefaultExceptionHandler);
	signal(SIGINT, Sys_DefaultExceptionHandler);

	if (fptest_temp >= 0.0)
		fptest_temp += 0.1;

	Sys_ParseEarlyArgs(argc, argv);
	Sys_DetectLFN();
	Sys_DetectWin95 ();
	Sys_PageInProgram ();

	_crt0_startup_flags &= ~_CRT0_FLAG_UNIX_SBRK; /* FS: We walked through all the data, now remove the sbrk flag so Win9x doesn't barf. */

	Sys_Init();

	Qcommon_Init (argc, argv);

	oldtime = Sys_Milliseconds ();

	if (!dedicated || !dedicated->value)
	{
		dos_registerintr(9, TrapKey);
	}

    /* main window message loop */
	while (1)
	{
		do
		{
			newtime = Sys_Milliseconds ();
			time = newtime - oldtime;
		}
		while (time < 1);

		Qcommon_Frame (time);
		oldtime = newtime;
	}
}
Пример #22
0
void AndroidInit(int width, int height)
{
	quakeparms_t parms;
	int j;
	int c = 0;
	char* v[] = {"quake", (char*) 0};
	
	scr_width = width;
	scr_height = height;

//	static char cwd[1024];

//	signal(SIGFPE, floating_point_exception_handler);
//  signal(SIGFPE, SIG_IGN);

	memset(&parms, 0, sizeof(parms));

	COM_InitArgv(c, v);
	parms.argc = com_argc;
	parms.argv = com_argv;

	parms.memsize = 16*1024*1024;

	j = COM_CheckParm("-mem");
	if (j)
		parms.memsize = (int) (Q_atof(com_argv[j+1]) * 1024 * 1024);
	parms.membase = malloc (parms.memsize);

	parms.basedir = basedir;
// caching is disabled by default, use -cachedir to enable
//	parms.cachedir = cachedir;

#if 0 // FNDELAY not implemented
	noconinput = COM_CheckParm("-noconinput");
	if (!noconinput)
		fcntl(0, F_SETFL, fcntl (0, F_GETFL, 0) | FNDELAY);
#endif

	if (COM_CheckParm("-nostdout"))
		nostdout = 1;

	Sys_Init();

    Host_Init(&parms);

    g_oldtime = Sys_DoubleTime ();
}
Пример #23
0
int main (int argc, char **argv)
{
	float		time, oldtime;

	APT_CheckNew3DS(&isN3DS);
	if(isN3DS)
		osSetSpeedupEnable(true);

	gfxInit(GSP_RGB565_OES,GSP_RGB565_OES,false);
	gfxSetDoubleBuffering(GFX_TOP, false);
	gfxSetDoubleBuffering(GFX_BOTTOM, false);
	gfxSet3D(true);
	consoleInit(GFX_BOTTOM, NULL);

	#ifdef _3DS_CIA
		if(chdir("sdmc:/3ds/ctrQuake") != 0)
			Sys_Error("Could not find folder: sdmc:/3ds/ctrQuake");
	#endif

	static quakeparms_t    parms;

	parms.memsize = 24*1024*1024;
	parms.membase = malloc (parms.memsize);
	parms.basedir = ".";

	COM_InitArgv (argc, argv);

	parms.argc = com_argc;
	parms.argv = com_argv;
	Host_Init (&parms);
	
	Sys_Init();

	oldtime = Sys_FloatTime() -0.1;
	while (aptMainLoop())
	{
		time = Sys_FloatTime();
		separation_distance = osGet3DSliderState();
		Host_Frame (time - oldtime);
		oldtime = time;
	}
	gfxExit();
	return 0;
}
Пример #24
0
int main(void)
{
	Sys_Init();										//系统初始化
	DS18B20_Link(); 								//连接DS18B20模块
	SIM900A_Link();									//连接GSM模块
	if(sim900a_send_cmd("AT+CMGF=1","OK",200))         return 1;	//设置文本模式 
	if(sim900a_send_cmd("AT+CSCS=\"UCS2\"","OK",200))  return 2;	//设置TE字符集为UCS2(2字节的UNICODE编码。还有UCS4,也就是4字节的UNICODE编码) 
	if(sim900a_send_cmd("AT+CSMP=17,0,2,25","OK",200)) return 3;	//设置短消息文本模式参数
	sim900a_data_ui(40,30);											//GSM信息界面UI
	LCD_Clear(BLUE);        //清屏
	while(1)
	{ 
		Show_Str_Mid(0,20,"基于GSM的实时温度查询系统",16,240); 				    	 	
		sim900a_sms_read();  
		LED0=!LED0;             //1.5s闪烁 
		delay_ms(1500);
		LCD_Fill(0,100,239,224,BLUE);
	} 	
}
Пример #25
0
void main(void)
{
	Sys_Init();
	putchar(' ');
	XBR0_Init();
	PCA_Init();
	i2c_Init();

	while(1)
	{
		if (new_range)
		{
			new_range = 0;
			cmrange = ReadRanger();
			Data[0] = 0x51;  //write 0x51 to reg 0 of the ranger:
			i2c_write_data(ranger_addr, 0,  Data, 1) ;  // write one byte of data to reg 0 at addr
			printf("range = %d\r\n", cmrange);
		}
	}
}
Пример #26
0
void Main_DoInit()
{
	// unprotect our entire PE image
	HMODULE hModule;
	if (SUCCEEDED(GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, (LPCSTR)Main_DoInit, &hModule)))
	{
		Main_UnprotectModule(hModule);
	}

	if (GetProcAddress(GetModuleHandle("kernel32.dll"), "InitializeSRWLock"))
	{
		LoadLibrary("gdimm_32.dll");
	}

	Sys_Init();

	// return to the original EP
	memcpy(originalEP, &originalCode, sizeof(originalCode));
	__asm jmp originalEP
}
Пример #27
0
static void
init_qf (void)
{
	Sys_Init ();

	Cvar_Get ("pr_debug", va ("%d", verbosity), 0, 0, "");
	Cvar_Get ("pr_source_path", source_path, 0, 0, "");
	PR_Init_Cvars ();
	PR_Init ();

	pr.edicts = &edicts;
	pr.num_edicts = &num_edicts;
	pr.reserved_edicts = &reserved_edicts;
	pr.file_error = file_error;
	pr.load_file = load_file;
	pr.allocate_progs_mem = allocate_progs_mem;
	pr.free_progs_mem = free_progs_mem;

	func_tab = Hash_NewTable (1021, 0, 0, 0);
	Hash_SetHashCompare (func_tab, func_hash, func_compare);
}
Пример #28
0
static void
qtv_init (void)
{
	qtv_cbuf = Cbuf_New (&id_interp);
	qtv_args = Cbuf_ArgsNew ();

	Sys_RegisterShutdown (qtv_shutdown);

	Sys_Init ();
	COM_ParseConfig ();
	Cvar_Get ("cmd_warncmd", "1", CVAR_NONE, NULL, NULL);

	qtv_memory_init ();

	QFS_Init ("qw");
	PI_Init ();

	qtv_console_plugin = Cvar_Get ("qtv_console_plugin", "server",
								   CVAR_ROM, 0, "Plugin used for the console");
	PI_RegisterPlugins (server_plugin_list);
	Con_Init (qtv_console_plugin->string);
	if (con_module)
		con_module->data->console->cbuf = qtv_cbuf;
	Sys_SetStdPrintf (qtv_print);

	qtv_sbar_init ();

	Netchan_Init_Cvars ();

	Cmd_StuffCmds (qtv_cbuf);
	Cbuf_Execute_Sets (qtv_cbuf);

	qtv_net_init ();
	Server_Init ();
	Client_Init ();

	Cmd_AddCommand ("quit", qtv_quit_f, "Shut down qtv");

	Cmd_StuffCmds (qtv_cbuf);
}
Пример #29
0
int main(int argc, char **argv)
{
	s32 ret;

	/* Initialize subsystems */
	Sys_Init();

	/* Set video mode */
	Video_SetMode();

	/* Initialize ISFS */
	ISFS_Initialize();
 
	/* Read config */
	Config_Read();

	/* Config menu */
	ret = SYS_ResetButtonDown();
	if (ret)
		Menu();

	/* Draw loading image */
	if(loaderCfg.showSplash)
		Gui_DrawLoading();

	/* Execute application */
	Loader_Execute();

	/* Draw error image */
	Gui_DrawError();

	/* Sleep */
	sleep(RESTART_SECONDS);

	/* Load System Menu */
	Sys_LoadMenu();

	return 0;
}
Пример #30
0
int main()
{
    int i = 0;
    _SWDTEN = 0;    // Disable watchdog timer
    _GIE    = 0;    // Disable interrupts

    ANSELB = ANSELC = ANSELD = ANSELE = ANSELG = 0;

    __delay32(8000000/2);   // Wait about 500ms before change to PLL

    Sys_Init();
    LED1_W = 1; LED2_W = 1; LED3_W = 1; LED4_W = 1; // turn off

    LED_Set_And_Wait(LEDOn, LEDOn, LEDOn, LEDOn, 1000);
    LED_Set_And_Wait(LEDOff, LEDOff, LEDOff, LEDOff, 1000);
   // LED_Set_And_Wait(LEDOn, LEDOn, LEDOn, LEDOn, 2000);
   // LED_Set_And_Wait(LEDOff, LEDOff, LEDOff, LEDOff, 2000);
   // LED_Set_And_Wait(LEDOn, LEDOn, LEDOn, LEDOn, 3000);
   // LED_Set_And_Wait(LEDOff, LEDOff, LEDOff, LEDOff, 3000);

    LED1_W = 1; LED2_W = 1; LED3_W = 1; LED4_W = 1; // turn off

    while(1)
    {
        WR_Handle_Comms();
        if(led)
        {
            i++;
            //if (rx_data == 200)
            //{
                LED_Set_And_Wait(LEDOn, LEDOn, LEDOn, LEDOn, 100);
                LED_Set_And_Wait(LEDOff, LEDOff, LEDOff, LEDOff, 100);
            //}
            //led = 0;
        }
    }
    return 0;
}