Пример #1
0
int main(int argc, char **argv) {
	std::vector<Common::UString> args;
	Common::Platform::getParameters(argc, argv, args);

	Aurora::GameID game = Aurora::kGameIDUnknown;

	int returnValue = 1;
	Command command = kCommandNone;
	Common::UString file;

	try {
		if (!parseCommandLine(args, returnValue, command, file, game))
			return returnValue;

		Aurora::RIMFile rim(new Common::ReadFile(file));

		if      (command == kCommandList)
			listFiles(rim, game);
		else if (command == kCommandExtract)
			extractFiles(rim, game);

	} catch (...) {
		Common::exceptionDispatcherError();
	}

	return 0;
}
Пример #2
0
__interrupt void TIM4_Updata_IRQHandler(void)
{
    sim();//关总中断

    
    TIM4->SR1 &=~BIT(0);//清标志位
    rim();//开总中断
}
Пример #3
0
/**
  * @brief this function checks if a NDEF message is available
	* @par Parameters None
  * @retval none
  */
static void User_DisplayMessageActiveHaltMode ( uint8_t PayloadLength )
{

	
		//Switch the clock to LSE and disable HSI
		#ifdef USE_LSE
			CLK_SYSCLKDivConfig(CLK_SYSCLKDiv_1);
			CLK_SYSCLKSourceConfig(CLK_SYSCLKSource_LSE);	
			CLK_SYSCLKSourceSwitchCmd(ENABLE);
			while (((CLK->SWCR)& 0x01)==0x01);
			CLK_HSICmd(DISABLE);
			CLK->ECKCR &= ~0x01; 
		#else
			CLK_SYSCLKDivConfig(CLK_SYSCLKDiv_1);
			CLK_SYSCLKSourceConfig(CLK_SYSCLKSource_LSI);
			CLK_SYSCLKSourceSwitchCmd(ENABLE);
			while (((CLK->SWCR)& 0x01)==0x01);
			CLK_HSICmd(DISABLE);
			CLK->ECKCR &= ~0x01; 
		#endif	
		
		// disable interupt				
		sim();
		// To copy function DISPLAYRAM in RAM section DISPLAY
		#ifdef _COSMIC_
			if (!(_fctcpy('D')))
				while(1);
		#endif
				
			Display_Ram (); // Call in RAM
			
		//	state_machine = STATE_VREF;
						
		#ifdef USE_HSI
			//Switch the clock to HSI
			CLK_SYSCLKDivConfig(CLK_SYSCLKDiv_16);
			CLK_HSICmd(ENABLE);
			while (((CLK->ICKCR)& 0x02)!=0x02);			
			CLK_SYSCLKSourceConfig(CLK_SYSCLKSource_HSI);
			CLK_SYSCLKSourceSwitchCmd(ENABLE);
			while (((CLK->SWCR)& 0x01)==0x01);
		#else
			CLK_SYSCLKDivConfig(CLK_SYSCLKDiv_2);
			// Select 2MHz HSE as system clock source 
			CLK_SYSCLKSourceConfig(CLK_SYSCLKSource_HSE);
			// wait until the target clock source is ready 
			while (((CLK->SWCR)& 0x01)==0x01);
			// wait until the target clock source is ready 
			CLK_SYSCLKSourceSwitchCmd(ENABLE);
		#endif
							
		// enable interupt				
		rim();
		

}
Пример #4
0
static NO_REG_SAVE void krn_thread_shell (void)
{
  //enable interrupts before thread start
#if defined(__CSMC__)
    _asm("rim");
#elif defined(__IAR_SYSTEMS_ICC__)
    rim();
#elif defined(__RCSTM8__)
    _rim_();
#endif

    //thread entry
    if (krn_thread_first && krn_thread_first->func)
    {
      krn_enter_thread(krn_thread_first->func);
    }
}
Пример #5
0
Файл: ppm.c Проект: eknl/gt3b
void ppm_set_value(u8 channel, u16 microsec01) {
    ppm_microsecs01 += microsec01;
    // ARR must be set to computed value - 1, that is why we are substracting
    //   5000, it is quicker way to "add 5000" and then substract 1 from result
    *(u16 *)(&ppm_values[(u8)(channel << 1)]) =
	(u16)(((u32)microsec01 * PPM_MUL_SERVO - PPM(500)) / PPM(1000));
    // for first channel, when we are still in HW SYNC generate, update
    //   new ARR values to get it applied now
    if (channel == 1) {
	sim();
	if (ppm_channel2 == 4) {
	    // next will be channel2, so we have channel1 in ARR now
	    TIM3_ARRH = ppm_values[2];
	    TIM3_ARRL = ppm_values[3];
	}
	rim();
    }
}
Пример #6
0
void main(void) {
    
    CLK_HSIPrescalerConfig(CLK_PRESCALER_HSIDIV1); // 16Mhz
    
    wl315_init();  
    flash_init();
    uart_init();
    
    // recovery the key value
    flash_read_key(LEARN_KEY1, &tKey1);
    flash_read_key(LEARN_KEY2, &tKey2);
    flash_read_key(LEARN_KEY3, &tKey3);
    flash_read_key(LEARN_KEY4, &tKey4);
    
    WL315_START();
    rim();
    
    /* Infinite loop */
    while (1) {
        wl315_learn_task(); // 按键学习任务
        uart_print_task();  // 串口打印任务
    }
}
Пример #7
0
int main(void)
{     
  u8 i,timediff = 0;  
  char lati[10],loni[11],signaldiff = 'V';
  time Realtime;
  Datapack temp;
  Sys_init();
  clear_OLED();
  setCharsOLED("Loading Now",30,3);
  keyinit();
  Ds1302_Init();
  httpInit();
  clear_OLED();
  uartbuf.countlat = 0;
  uartbuf.countlon = 0;
  uartbuf.countUTC = 0;
  Menu();
  clear_OLED();
  showTime(&timediff,&signaldiff);
  
  rim();
  while(1)
  { 
    
    if(readkey())
    {
      if(display_flag)
      {
	display_flag = 0;
	clear_OLED();
      }
      else
      {
	display_flag = 1;
	clear_OLED();
	timediff = 99;
	showTime(&timediff,&signaldiff); 
      }
    }
    if(UARTflag==1)
    {
      if(display_flag)
      {
      	showTime(&timediff,&signaldiff); 
      }
      if(uartbuf.status=='A')
      {
	temp = uartbuf;
	//Sendpack(&uartbuf);
	for(i=0;i<10;i++)
	{
	  if(((uartbuf.longitude[i]>='0' && uartbuf.longitude[i] <='9') || uartbuf.longitude[i] =='.'))
	  {
	    loni[i] = uartbuf.longitude[i];
	    lati[i] = uartbuf.latitude[i];
	  }
	  else
	  {
	    //sendChars("AB");
	    break;
	  }
	  if(i==9)
	  {
	    loni[10] = uartbuf.longitude[10];
	    temp = uartbuf;
	    Send_PostMessage(&temp,&lati,&loni);
	    if(signaldiff!='A')
	    {
	      if(display_flag==1)
	      {
	      	SendSignal('A');
	      }
	      signaldiff = 'A';
	    }
	    uartbuf.countlat = 0;
	    uartbuf.countlon = 0;
	    uartbuf.countUTC = 0;
	    uartbuf.status = 'V';
	  }
	}
	
      }
      else
      {
	if(signaldiff!='V')
	{
	  if(display_flag == 1)
	  {
	      signaldiff = 'V';
	  }
	  SendSignal('V');
	}
      }
      UARTflag=0;	
      rim();
    }
    //printf("¶¨");
    //delay_ms(1);
    //addrOLED(1,2); 
    //setCharOLED('X');
  }  
}
Пример #8
0
/**
  * @brief  Main program.
  * @param  None
  * @retval None
  */
void main(void)
{
	CLK_Config();
	FlashInit();

	sim();									// disable interrupts

	GPIO_Init(GPIOA, GPIO_Pin_All, GPIO_Mode_Out_PP_Low_Fast);
	GPIO_Init(GPIOB, GPIO_Pin_All, GPIO_Mode_Out_PP_Low_Fast);
	GPIO_Init(GPIOC, GPIO_Pin_All, GPIO_Mode_Out_PP_Low_Fast);
	GPIO_Init(GPIOD, GPIO_Pin_All, GPIO_Mode_Out_PP_Low_Fast);
	GPIO_Init(GPIOE, GPIO_Pin_All, GPIO_Mode_Out_PP_Low_Fast);
	GPIO_Init(GPIOF, GPIO_Pin_All, GPIO_Mode_Out_PP_Low_Fast);
	GPIO_Init(GPIOG, GPIO_Pin_All, GPIO_Mode_Out_PP_Low_Fast);

	delay1s(5);

	#ifdef DEBUG
		AppTrace_Init();
    	printf("\r\nSTM8L152 Start ...\r\n");
	#endif
	
	LED_Init();
    LED1_ON();
	scheduler_init();

	// Build count init event 
	count_event.eCount_event = COUNT_INIT;
	app_sched_event_put(&count_event,sizeof(count_event),count_event_handler);
	
	// Build key init event 
	key_event.eKey_event = KEY_INIT;
	app_sched_event_put(&key_event,sizeof(key_event),key_event_handler);
	
	// Build the valve standby event 
	valve_event.eValve_event = VALVE_STANDBY_EVENT;
	app_sched_event_put(&valve_event,sizeof(valve_event),valve_event_handler);
    
    // Build the LCD init event 
	lcd_event.eLcd_event = LCD_INIT;
	app_sched_event_put(&lcd_event,sizeof(lcd_event),lcd_event_handler);

	// Build the beeper init event 
	beeper_event.eBeeper_event = BEEPER_INIT;
	app_sched_event_put(&beeper_event,sizeof(beeper_event),beeper_event_handler);

	// Build the cc1120 Init event 
	cc112x_event.eCC112x_event = CC112X_INIT_EVENT;
	app_sched_event_put(&cc112x_event,sizeof(cc112x_event),cc112x_event_handler);

	// Build the IC card Init event 
	ic_card_event.eIC_event = IC_CARD_INIT;
	app_sched_event_put(&ic_card_event,sizeof(ic_card_event),ic_event_handler);

	// Build the IC card Init event 
	battery_event.eBattery_event = INT_BATTERY_EVENT;
	app_sched_event_put(&battery_event,sizeof(battery_event),battery_event_handler);

    // enable interrupts 
	rim();
    LED1_OFF();
	 
	// Infinite loop 
  	while (1)
  	{
		app_sched_execute();
		app_evt_wait();
  	}
}
Пример #9
0
/**
  * @brief Current measurement in different MCU modes:
		RUN/HALT/LowPower withouto LCD/LowPower with LCD
	* @caller main and ADC_Icc_Test
  * @param MCU state
  * @retval ADC value.
  */
u16 ADC_Icc_Test(u8 Mcu_State)
{
  uint16_t res;
	uint8_t i;
	
/* Test MCU state for configuration */
  switch (Mcu_State)
  {
    /* test Run mode nothing to do */	
    case MCU_RUN:
      break;

    /* Low power mode */		
    case MCU_LPR:
      Halt_Init();
      sim();
      /* To prepare to start counter */
      GPIO_HIGH(CTN_GPIO_PORT,CTN_CNTEN_GPIO_PIN);
  
      /* To configure Low Power */			
      LPR_init();
      break;

    /* Halt mode */
    case MCU_HALT:
      /* Init for Halt mode  */
      Halt_Init();
      sim();	
      
      /* To prepare to start counter */
      GPIO_HIGH(CTN_GPIO_PORT,CTN_CNTEN_GPIO_PIN);
  
      /* Falling edge for start counter */		
      GPIO_LOW(CTN_GPIO_PORT,CTN_CNTEN_GPIO_PIN);
      delay_10us(1);
      
      /* MCU in halt during measurement */	
      /* Wake up by Interrupt done counter Input Port E pin 6 */
      halt();
      break;
    
    case MCU_LPR_LCD:
      PWR->CSR2 = 0x2;
      sim();
      /* To configure GPIO for reduce current. */
      GPIO_LowPower_Config();

      /* To prepare to start counter */
      GPIO_HIGH(CTN_GPIO_PORT,CTN_CNTEN_GPIO_PIN);

      /* To configure Low Power */
      LPR_init();
      break;		
  }
	
  sim();

/* re-start ADC chanel 24 for Current measurement */
  ADC_Icc_Init();	
	
/* Read ADC for current measurmeent */
/* initialize result */
  res = 0;

  for(i=8; i>0; i--)
  {
    /* start ADC convertion by software */
    ADC_SoftwareStartConv(ADC1);
    
    /* wait until end-of-covertion */
    while( ADC_GetFlagStatus(ADC1, ADC_FLAG_EOC) == 0 );
    
    /* read ADC convertion result */
    res += ADC_GetConversionValue(ADC1);
  }
	
  /* ICC_CNT_EN invalid */
  GPIO_HIGH(CTN_GPIO_PORT,CTN_CNTEN_GPIO_PIN);
 
  GPIO_Init(BUTTON_GPIO_PORT, USER_GPIO_PIN,GPIO_Mode_In_FL_IT);

  rim();
	
/* Disable ADC 1 for reduce current */
  ADC_Cmd(ADC1, DISABLE);

  CLK_PeripheralClockConfig(CLK_Peripheral_ADC1, DISABLE);

  if (Mcu_State !=MCU_LPR_LCD)
  {
    CLK_PeripheralClockConfig(CLK_Peripheral_RTC, ENABLE);
    LCD_GLASS_Init();
  }

  return (res>>3);
}
Пример #10
0
int main(void)
{
  int ch;
  WINDOW *reg_win;
  const char *runhalt[]={"Running","Halted ","Trap   "};

  preload();
  rim();

  df32_init();

  // get ncurses going
  initscr();
  raw();			// turn off line buffering
  noecho();
  keypad(stdscr,TRUE);		// lets us use function keys etc
  scrollok(stdscr,TRUE);
  reg_win=newwin(1,79,23,0);	// define a register window

  nodelay(stdscr, TRUE);	// nonblocking tty IO

  // set up the registers and stuff
  l=0;ac=0;			// AC and Link
  pc=07000;			// PC is set for ODT HIGH
  sr=0;				// SR is clear
  ifr=0; ifrb=0; dfr=0;		// Extended memory registers

  tty_pun_f=1;			// TTY flags preset
  tty_rdr_f=0;
  tty_pun_clk=0;
  cycles=0;			// cycle count
  halt=0;

  // initial display code goes here
  mvwprintw(reg_win,0,0,"PC: %05o L: %o AC: %04o MB: %04o %s", (010000*ifr)+pc,l,ac,core[(010000*ifr)+pc],runhalt[halt]);
  wrefresh(reg_win);

  // main loop begins
  while(ch!=KEY_F(12)) { 	// if the key pressed was F11, we'll leave
    ch = getch();		// get a keystroke
    if (ch!=ERR) {		// there actually *is* a keystroke
      switch (ch) {
        case KEY_F(2):		// F2 is single-step
	  functionmesh(core[pc+(010000*ifr)]);	// do the instruction
  	  break;
        case KEY_F(3):		// F3 is halt/run
	  halt=!halt;		// pretty simple really
	  break;
	case KEY_F(4):		// interrupt (sssh, nasty cheat)
	  core[00000]=pc+1;
	  pc=00001;
	  break;
	case KEY_F(9):
	  pc=07000;
	  halt=0;
	  break;
	default:
          tty_rdr_buf=ch;		// keep that ready for later, in the reader buffer
          tty_rdr_f=1;		// raise the flag, there's a character ready
      }
      // Eeeew.  This bit is horrible.  It prints the registers when we single-step
      // it's actually done every time we press a key.  Ick.  I hate this bit
      // in fact, let's have a *** FIXME *** right here
      mvwprintw(reg_win,0,0,"PC: %05o L: %o AC: %04o MB: %04o %s", (010000*ifr)+pc,l,ac,core[(010000*ifr)+pc],runhalt[halt]);
      wrefresh(reg_win);
    }

    cycles++;			// increase the cycle counter

    if(!halt) {			// CPU is running, let's do the instruction
      functionmesh(core[pc+(01000*ifr)]);
    }				// we can always add more here later

    tty_run();			// handle the TTY
    df32_run();
    // more peripheral handlers will go here
  }

  endwin();			// leave ncurses mode
  return (0);
}