Exemplo n.º 1
0
int cps1_driver_init(void)
{
	m68000_init();

	z80_init();
	z80_bank = -1;

	if (machine_driver_type == MACHINE_qsound)
	{
		EEPROM_init(&qsound_eeprom_interface);
		cps1_nvram_read_write(0);
	}
	else if (machine_driver_type == MACHINE_wofhfh)
	{
		EEPROM_init(&qsound_eeprom_interface);
		cps1_nvram_read_write(0);
	}
	else if (machine_driver_type == MACHINE_pang3)
	{
		EEPROM_init(&pang3_eeprom_interface);
		cps1_nvram_read_write(0);
	}

	return 1;
}
Exemplo n.º 2
0
static void eeprom_handler(mame_file *file, int read_or_write)
{
	if (read_or_write)
	{
		if (file)
		{
			EEPROM_save(file);
		}
	}
	else
	{
		EEPROM_init(&eeprom_interface);
		if (file)
		{
			EEPROM_load(file);
		}
		else
		{
			// set default eeprom
			UINT8 eepdata[0x200];
			memset(eepdata, 0xff, 0x200);

			if (mame_stricmp(Machine->gamedrv->name, "slrasslt") == 0)
			{
				// magic number
				eepdata[0x4] = 0x96;
				eepdata[0x5] = 0x72;
			}

			EEPROM_set_data(eepdata, 0x200);
		}
	}
}
Exemplo n.º 3
0
static NVRAM_HANDLER( kickgoal )
{
	if (read_or_write) EEPROM_save(file);
	else
	{
		EEPROM_init(&eeprom_interface);
		if (file) EEPROM_load(file);
	}
}
Exemplo n.º 4
0
static NVRAM_HANDLER( eolith )
{
	if (read_or_write)
		EEPROM_save(file);
	else
	{
		EEPROM_init(&eeprom_interface_93C66);
		if (file)	EEPROM_load(file);
	}
}
Exemplo n.º 5
0
static NVRAM_HANDLER( policetr )
{
	if (read_or_write)
		EEPROM_save(file);
	else
	{
		EEPROM_init(&eeprom_interface_policetr);
		if (file)	EEPROM_load(file);
	}
}
Exemplo n.º 6
0
void nvram_handler_93C46(mame_file *file,int read_or_write)
{
	if (read_or_write)
		EEPROM_save(file);
	else
	{
		EEPROM_init(&eeprom_interface_93C46);
		if (file)	EEPROM_load(file);
	}
}
Exemplo n.º 7
0
static NVRAM_HANDLER( superchs )
{
	if (read_or_write)
		EEPROM_save(file);
	else
	{
		EEPROM_init(&superchs_eeprom_interface);

		if (file)
			EEPROM_load(file);
		else
			EEPROM_set_data(default_eeprom,128);  /* Default the wheel setup values */
	}
}
Exemplo n.º 8
0
static NVRAM_HANDLER( othunder )
{
	if (read_or_write)
		EEPROM_save(file);
	else
	{
		EEPROM_init(&eeprom_interface);

		if (file)
			EEPROM_load(file);
		else
			EEPROM_set_data(default_eeprom,128);  /* Default the gun setup values */
	}
}
Exemplo n.º 9
0
/****************************************************************
                NVRAM load/save/init
****************************************************************/
static NVRAM_HANDLER( xorworld )
{
	if (read_or_write)
	{
		EEPROM_save(file);
	}
	else
	{
		EEPROM_init(&eeprom_interface_93C46);

		if (file)
		{
			EEPROM_load(file);
		}
	}
}
Exemplo n.º 10
0
static NVRAM_HANDLER( gijoe )
{
	if (read_or_write)
		EEPROM_save(file);
	else
	{
		EEPROM_init(&eeprom_interface);

		if (file)
		{
			init_eeprom_count = 0;
			EEPROM_load(file);
		}
		else
			init_eeprom_count = 2720;
	}
}
Exemplo n.º 11
0
static NVRAM_HANDLER(nvram_handler)
{
	if (read_or_write)
		EEPROM_save(file);
	else
	{
		EEPROM_init(&eeprom_interface);

		if (file)
		{
			init_eeprom_count = 0;
			EEPROM_load(file);
		}
		else
			init_eeprom_count = 10;
	}
}
Exemplo n.º 12
0
void simpsons_nvram_handler(void *file,int read_or_write)
{
	if (read_or_write)
		EEPROM_save(file);
	else
	{
		EEPROM_init(&eeprom_interface);

		if (file)
		{
			init_eeprom_count = 0;
			EEPROM_load(file);
		}
		else
			init_eeprom_count = 10;
	}
}
Exemplo n.º 13
0
static NVRAM_HANDLER( pntnpuzl )
{
	if (read_or_write)
		EEPROM_save(file);
	else
	{
		EEPROM_init(&eeprom_interface);

		if (file)
			EEPROM_load(file);
		else
		{
			int length;
			UINT8 *dat;

			dat = EEPROM_get_data_pointer(&length);
			memset(dat, 0, length);
		}
	}
}
Exemplo n.º 14
0
static NVRAM_HANDLER( lethalen )
{
	if (read_or_write)
		EEPROM_save(file);
	else
	{
		EEPROM_init(&eeprom_interface);

		if (file)
		{
			init_eeprom_count = 0;
			EEPROM_load(file);
		}
		else
		{
			init_eeprom_count = 10;
			EEPROM_set_data(lethalen_default_eeprom,48);

		}
	}
}
Exemplo n.º 15
0
void cps2_driver_init(void)
{
	if (memory_length_user1)
	{
		m68000_init();
		m68000_set_encrypted_range(0, memory_length_user1 - 1, memory_region_user1);
	}
	else
	{
		m68000_init();
	}

	z80_init();
	z80_bank = -1;

	EEPROM_init();
	cps2_nvram_read_write(0);

        //SFA3 patch
	if (!strcmp(driver->name, "sfa3"))
		EEPROM_write_data(0x75, 0x04);
}
Exemplo n.º 16
0
//==================================================================================
//==================================================================================
//==================================================================================
int main()
{
	bool ver = 0;
	uint8_t cnt_link = 0;
	
	PLL_init();
	GPIO_init();
	TIM1_init();
	TIM2_init();
	TIM3_init();
	UART_init();
	WDT_init();
	EEPROM_init();
	
	SysTick_Config(SystemCoreClock/800);//~10 ms
	
	
	time.t1=5;
	time.t2=5;
	time.t3=5;
	time.t4=5;
	delay_ms(100);
	
	Segment[0]=0xFF;
	Segment[1]=0xFF;
	Segment[2]=0xFF;
	Segment[3]=0xFF;
	Segment[4]=0xFF;
	Segment[5]=0xFF;
	Segment[6]=0x7F;
	ALARM_ON;
	delay_ms(100);
	ALARM_OFF;
	delay_ms(1000);
	//
	//
	
  while(1)
	{
		if( TX_st )
		{
			TX_st = 0;
			
			if( cnt_link < LINK_COUNT )
			{
				link_PKBA();
				++cnt_link;
			}
			else
			{
				PKDU.error = true;
				cnt_link = 0;
			}
		}
		
		if( RX_ok && !PKDU.error )
		{
			uint8_t cnt_byte = 0, sum = 0;
			
			while( cnt_byte < RX_FRAME_SIZE )
			{
				sum += ArrayRX_PKBA[cnt_byte];
				++cnt_byte;
			}
			sum += 0xAA;
			
			if( !sum )
			{
				StatusPKBA.reg0 = ArrayRX_PKBA[0];
				StatusPKBA.reg1 = ArrayRX_PKBA[1];
				StatusPKBA.Error = (ArrayRX_PKBA[3]<<8) | ArrayRX_PKBA[2];
				StatusPKBA.RabReg0 = ArrayRX_PKBA[4];
				StatusPKBA.UGen = (ArrayRX_PKBA[6]<<8) | ArrayRX_PKBA[5];
				StatusPKBA.IGen = (ArrayRX_PKBA[8]<<8) | ArrayRX_PKBA[7];
				StatusPKBA.DT = ArrayRX_PKBA[9];
				StatusPKBA.DM = ArrayRX_PKBA[10];
				StatusPKBA.TM = ArrayRX_PKBA[11];
				StatusPKBA.NDiz = (ArrayRX_PKBA[13]<<8) | ArrayRX_PKBA[12];
				StatusPKBA.TBapEx = ArrayRX_PKBA[14];
				StatusPKBA.TBapIn = ArrayRX_PKBA[15];
				StatusPKBA.Led1 = ArrayRX_PKBA[16];
				StatusPKBA.Led2 = ArrayRX_PKBA[17];

				if( !ver )
				{
					ver = true;
					show_ver();
					delay_ms( 1500 );
					Segment[ 0 ] = 0;
					Segment[ 1 ] = 0;
					Segment[ 2 ] = 0;
					Segment[ 3 ] = 0;
					Segment[ 4 ] = 0;
				}
			cnt_link=0;
			}
			RX_ok=0;
		}
		
		__nop();
		
		Set_Error();
		
		if(!PKDU.error)
			ShowParam();
		
		if((PKDU.StatusKN>>4)&1)
		{
			maska_err = 0;
			StatusPKBA.Error=0;
			PKDU.error=false;
			cnt_link = 0;
		}
		
		if(((PKDU.StatusKN>>5)&1) && ((PKDU.StatusKN>>6)&1))
		{
			Segment[0] = 0xFF;
			Segment[1] = 0xFF;
			Segment[2] = 0xFF;
			Segment[3] = 0xFF;
			Segment[4] = 0xFF;
			Segment[5] = 0xFF;
			Segment[6] = 0x7F;
			
			while(((PKDU.StatusKN>>5)&1)&&((PKDU.StatusKN>>6)&1))
				IWDG_ReloadCounter();
		}
		
		ControlZvonok();
		
		write_hour();
		IWDG_ReloadCounter();
	}
}
Exemplo n.º 17
0
/* Main thread
 */
int main(void) {
  /* ChibiOS/RT init */
  halInit();
  chSysInit();

#ifdef STM32F303xC
  EEPROM_init();
#endif

  // TESTING
  // chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);

  /* Init USB */
  init_usb_driver(&USB_DRIVER);

  /* init printf */
  init_printf(NULL,sendchar_pf);

#ifdef MIDI_ENABLE
  setup_midi();
#endif

#ifdef SERIAL_LINK_ENABLE
  init_serial_link();
#endif

#ifdef VISUALIZER_ENABLE
  visualizer_init();
#endif


  host_driver_t* driver = NULL;

  /* Wait until the USB or serial link is active */
  while (true) {
    if(USB_DRIVER.state == USB_ACTIVE) {
      driver = &chibios_driver;
      break;
    }
#ifdef SERIAL_LINK_ENABLE
    if(is_serial_link_connected()) {
      driver = get_serial_link_driver();
      break;
    }
    serial_link_update();
#endif
    wait_ms(50);
  }

  /* Do need to wait here!
   * Otherwise the next print might start a transfer on console EP
   * before the USB is completely ready, which sometimes causes
   * HardFaults.
   */
  wait_ms(50);

  print("USB configured.\n");

  /* init TMK modules */
  keyboard_init();
  host_set_driver(driver);

#ifdef SLEEP_LED_ENABLE
  sleep_led_init();
#endif

  print("Keyboard start.\n");

  /* Main loop */
  while(true) {

    if(USB_DRIVER.state == USB_SUSPENDED) {
      print("[s]");
#ifdef VISUALIZER_ENABLE
      visualizer_suspend();
#endif
      while(USB_DRIVER.state == USB_SUSPENDED) {
        /* Do this in the suspended state */
#ifdef SERIAL_LINK_ENABLE
        serial_link_update();
#endif
        suspend_power_down(); // on AVR this deep sleeps for 15ms
        /* Remote wakeup */
        if(suspend_wakeup_condition()) {
          usbWakeupHost(&USB_DRIVER);
        }
      }
      /* Woken up */
      // variables has been already cleared by the wakeup hook
      send_keyboard_report();
#ifdef MOUSEKEY_ENABLE
      mousekey_send();
#endif /* MOUSEKEY_ENABLE */

#ifdef VISUALIZER_ENABLE
      visualizer_resume();
#endif
    }

    keyboard_task();
#ifdef CONSOLE_ENABLE
    console_task();
#endif
#ifdef VIRTSER_ENABLE
    virtser_task();
#endif
#ifdef RAW_HID_ENABLE
    raw_hid_task();
#endif
  }
}
Exemplo n.º 18
0
static void eeprom_init(void)
{
	EEPROM_init(&eeprom_interface);
	init_eeprom_count = 0;
}