Beispiel #1
0
void console_init()
{
	xsize = graphics_width()/8;
	ysize = graphics_height()/8;
	console_reset();
	console_putstring("\nconsole: initialized\n");
}
Beispiel #2
0
/**
 * Execute PXE image
 *
 * @v image		PXE image
 * @ret rc		Return status code
 */
static int pxe_exec ( struct image *image ) {
	userptr_t buffer = real_to_user ( 0, 0x7c00 );
	struct net_device *netdev;
	int rc;

	/* Verify and prepare segment */
	if ( ( rc = prep_segment ( buffer, image->len, image->len ) ) != 0 ) {
		DBGC ( image, "IMAGE %p could not prepare segment: %s\n",
		       image, strerror ( rc ) );
		return rc;
	}

	/* Copy image to segment */
	memcpy_user ( buffer, 0, image->data, 0, image->len );

	/* Arbitrarily pick the most recently opened network device */
	if ( ( netdev = last_opened_netdev() ) == NULL ) {
		DBGC ( image, "IMAGE %p could not locate PXE net device\n",
		       image );
		return -ENODEV;
	}
	netdev_get ( netdev );

	/* Activate PXE */
	pxe_activate ( netdev );

	/* Construct fake DHCP packets */
	pxe_fake_cached_info();

	/* Set PXE command line */
	pxe_cmdline = image->cmdline;

	/* Reset console since PXE NBP will probably use it */
	console_reset();

	/* Disable IRQ, if applicable */
	if ( netdev_irq_supported ( netdev ) && netdev->dev->desc.irq )
		disable_irq ( netdev->dev->desc.irq );

	/* Start PXE NBP */
	rc = pxe_start_nbp();

	/* Clear PXE command line */
	pxe_cmdline = NULL;

	/* Deactivate PXE */
	pxe_deactivate();

	/* Try to reopen network device.  Ignore errors, since the NBP
	 * may have called PXENV_STOP_UNDI.
	 */
	netdev_open ( netdev );
	netdev_put ( netdev );

	return rc;
}
Beispiel #3
0
void
genunimp ()
{
    console_reset();
#ifdef PCHIST
    ppc();
#endif /* PCHIST */
    suspend();
    console_init();

    return;
}
Beispiel #4
0
void console_putchar( char c )
{
	console_writechar(xpos,ypos,' ');

	switch(c) {
		case 13:
		case 10:
			xpos=0;
			ypos++;
			break;
		case '\f':
			console_reset();
			break;
		case '\b':
			xpos--;
			break;
		default:
			console_writechar(xpos,ypos,c);
			xpos++;
			break;
	}

	if(xpos<0) {
		xpos=xsize-1;
		ypos--;
	}

	if(xpos>=xsize) {
		xpos=0;
		ypos++;
	}

	if(ypos>=ysize) {
		console_reset();
	}

	console_writechar(xpos,ypos,'_');
}
Beispiel #5
0
void commands_run(char* cmd)
{
	if (strcmp(cmd, "disk") == 0)
	{
		iso_read_disc(2);
	}
	else if (strcmp(cmd, "memory") == 0)
	{
		console_printf("pages free: %d\npages total: %d\n", memory_pages_free(), memory_pages_total());
	}
	else if (strcmp(cmd, "clear") == 0)
	{
		console_reset();
	}
}
Beispiel #6
0
/**
 * Shut down iPXE
 *
 * @v flags		Shutdown behaviour flags
 *
 * This function reverses the actions of startup(), and leaves iPXE in
 * a state ready to be removed from memory.  You may call startup()
 * again after calling shutdown().
 *
 * Call this function only once, before either exiting main() or
 * starting up a non-returnable image.
 */
void shutdown ( int flags ) {
	struct startup_fn *startup_fn;

	if ( ! started )
		return;

	/* Call registered shutdown functions (in reverse order) */
	for_each_table_entry_reverse ( startup_fn, STARTUP_FNS ) {
		if ( startup_fn->shutdown )
			startup_fn->shutdown ( flags );
	}

	/* Reset console */
	console_reset();

	started = 0;
}
Beispiel #7
0
void
bsp_init()
{
    serial_init();
    console_bold();
    console_puts("Starting nubbin " VERSION);
    console_reset();

    kdata_init();

    memory_map_init_finish();

    acpi_init();

    smbios_init();

    cpu_bsp_init();

    hello_user();

    /* Bounces to cpu_trampoline() on return */
}
/**
 * Configure console
 *
 * @v config		Console configuration
 * @ret rc		Return status code
 *
 * The configuration is passed to all configurable consoles, including
 * those which are currently disabled.  Consoles may choose to enable
 * or disable themselves depending upon the configuration.
 *
 * If configuration fails, then all consoles will be reset.
 */
int console_configure ( struct console_configuration *config ) {
	struct console_driver *console;
	int rc;

	/* Reset console width and height */
	console_set_size ( CONSOLE_DEFAULT_WIDTH, CONSOLE_DEFAULT_HEIGHT );

	/* Try to configure each console */
	for_each_table_entry ( console, CONSOLES ) {
		if ( ( console->configure ) &&
		     ( ( rc = console->configure ( config ) ) != 0 ) )
				goto err;
	}

	return 0;

 err:
	/* Reset all consoles, avoiding a potential infinite loop */
	if ( config )
		console_reset();
	return rc;
}
Beispiel #9
0
static void parser_flexsea(int slave, int cmd, char rw, char *argv[])
{
	int numb = 0;
	int tmp0 = 0, tmp1 = 0, tmp2 = 0, tmp3 = 0, tmp4 = 0, tmp5 = 0;

    switch(cmd)	//ToDo support r/w
    {
    	case 0:		//'ping'
    		_USE_PRINTF("Command isn't programmed yet.\n");
    		break;

    	case 1:		//'status'
    		_USE_PRINTF("Command isn't programmed yet.\n");
    	    break;

    	case 2:		//'reset'
    		_USE_PRINTF("Reset: ");
    		console_reset(slave_id[slave]);
    		break;

    	case 3:		//'ack'
    		_USE_PRINTF("Command isn't programmed yet.\n");
    	    break;

		case 4: 	//'mem'
			tmp0 = atoi(argv[4]);
			tmp1 = atoi(argv[5]);
			_USE_PRINTF("[Memory]: Base addr. = %i, bytes = %i.\n", tmp0, tmp1);
			//Prepare and send data:
			//numb = tx_cmd_mem_read(slave_id[slave], 0, tmp0, tmp1);	//ToDo
			numb = comm_gen_str(payload_str, comm_str_spi, numb);
			break;

		case 5: 	//'acqui'
			tmp0 = atoi(argv[4]);
			_USE_PRINTF("[Acquisition mode]: %i.\n", tmp0);
			//Prepare and send data:
			numb = tx_cmd_data_acqui(slave_id[slave], CMD_WRITE, tmp_payload_xmit, PAYLOAD_BUF_LEN, tmp0);
			numb = comm_gen_str(tmp_payload_xmit, comm_str_spi, numb);
			break;

		case 6:		//'rs485_config'
			_USE_PRINTF("Command isn't programmed yet.\n");
		    break;

		case 7:		//'usb_config'
			_USE_PRINTF("Command isn't programmed yet.\n");
		    break;

		case 8:		//'usb_write'
			_USE_PRINTF("Command isn't programmed yet.\n");
		    break;

		case 9:		//'temp'
			_USE_PRINTF("Command isn't programmed yet.\n");
		    break;

		case 10: 	//'switch'
			_USE_PRINTF("[Switch]");
			//Prepare and send data:
			numb = tx_cmd_switch(slave_id[slave], CMD_READ, tmp_payload_xmit, PAYLOAD_BUF_LEN);
			numb = comm_gen_str(tmp_payload_xmit, comm_str_spi, numb);
			break;

		case 11: 	//'imu'
			tmp0 = atoi(argv[4]);
			tmp1 = atoi(argv[5]);
			_USE_PRINTF("[IMU]: %i & %i.\n", tmp0, tmp1);
			//Prepare and send data:
			//numb = tx_cmd_imu_read(slave_id[slave], tmp0, tmp1);	//ToDo
			numb = comm_gen_str(tmp_payload_xmit, comm_str_spi, numb);
			break;

		case 12: 	//'encoder'
			tmp0 = atoi(argv[4]);
			if(rw == 'r')
			{
				_USE_PRINTF("[Read Encoder]\n");
				//Prepare and send data:
				numb = tx_cmd_encoder(slave_id[slave], CMD_READ, tmp_payload_xmit, PAYLOAD_BUF_LEN, 0);
			}
			else
			{
				_USE_PRINTF("[Write Encoder]: %i.\n", tmp0);
				//Prepare and send data:
				numb = tx_cmd_encoder(slave_id[slave], CMD_WRITE, tmp_payload_xmit, PAYLOAD_BUF_LEN, tmp0);
			}

			numb = comm_gen_str(tmp_payload_xmit, comm_str_spi, numb);
			break;

		case 13: 	//'strain'
			_USE_PRINTF("[Strain]\n");
			//Prepare and send data:
			//numb = tx_cmd_strain_read(slave_id[slave]);			//ToDo
			numb = comm_gen_str(tmp_payload_xmit, comm_str_spi, numb);
			break;

		case 14: 	//'cmd_strain_config'
			tmp0 = atoi(argv[4]);
			tmp1 = atoi(argv[5]);
			tmp2 = atoi(argv[6]);
			_USE_PRINTF("[Config Strain]: Offset = %i, Gain = %i, Output ref. = %i.\n", tmp0, tmp1, tmp2);
			//Prepare and send data:
			//numb = tx_cmd_strain_config(slave_id[slave], tmp0, tmp1, tmp2);	//ToDo
			numb = comm_gen_str(tmp_payload_xmit, comm_str_spi, numb);
			break;

		case 15:	//'volt'
			_USE_PRINTF("Command isn't programmed yet.\n");
		    break;

		case 16:	//'batt'
			_USE_PRINTF("Command isn't programmed yet.\n");
		    break;

		case 17:	//'power_out'
			_USE_PRINTF("Command isn't programmed yet.\n");
		    break;

		case 18: 	//'clutch'
			tmp0 = atoi(argv[4]);
			_USE_PRINTF("[Clutch]: %i.\n", tmp0);
			//Prepare and send data:
			numb = tx_cmd_exp_clutch(slave_id[slave], CMD_WRITE, tmp_payload_xmit, PAYLOAD_BUF_LEN, tmp0);
			numb = comm_gen_str(tmp_payload_xmit, comm_str_spi, numb);
			break;

		case 19:	//'adv_ana_config'
			_USE_PRINTF("Command isn't programmed yet.\n");
			break;

		case 20: 	//'analog'
			tmp0 = atoi(argv[4]);
			tmp1 = atoi(argv[5]);
			_USE_PRINTF("[Analog]: Base addr. = %i, Values = %i.\n", tmp0, tmp1);
			//Prepare and send data:
			//numb = tx_cmd_analog_read(slave_id[slave], tmp0, tmp1);	//ToDo
			numb = comm_gen_str(tmp_payload_xmit, comm_str_spi, numb);
			break;

		case 21:	//'digital'
			_USE_PRINTF("Command isn't programmed yet.\n");
			break;

		case 22:	//'digital_config'
			_USE_PRINTF("Command isn't programmed yet.\n");
			break;

		case 23:	//'exp_periph_config'
			_USE_PRINTF("Command isn't programmed yet.\n");
			break;

		case 24: 	//'ctrl_mode'
			tmp0 = atoi(argv[4]);
			_USE_PRINTF("[Control Mode]: %i.\n", tmp0);
			//Prepare and send data:
			numb = tx_cmd_ctrl_mode(slave_id[slave], CMD_WRITE, tmp_payload_xmit, PAYLOAD_BUF_LEN, tmp0);
			numb = comm_gen_str(tmp_payload_xmit, comm_str_spi, numb);
			break;

		case 25: 	//'ctrl_i_g'
			tmp0 = atoi(argv[4]);
			tmp1 = atoi(argv[5]);
			tmp2 = atoi(argv[6]);
			_USE_PRINTF("[Current Controller Gains]: kp = %i, ki = %i, kd = %i.\n", tmp0, tmp1, tmp2);
			//Prepare and send data:
			numb = tx_cmd_ctrl_i_g(slave_id[slave], CMD_WRITE, tmp_payload_xmit, PAYLOAD_BUF_LEN, tmp0, tmp1, tmp2);
			numb = comm_gen_str(tmp_payload_xmit, comm_str_spi, numb);
			break;

		case 26: 	//'ctrl_p_g'
			tmp0 = atoi(argv[4]);
			tmp1 = atoi(argv[5]);
			tmp2 = atoi(argv[6]);
			_USE_PRINTF("[Position Controller Gains]: kp = %i, ki = %i, kd = %i.\n", tmp0, tmp1, tmp2);
			//Prepare and send data:
			numb = tx_cmd_ctrl_p_g(slave_id[slave], CMD_WRITE, tmp_payload_xmit, PAYLOAD_BUF_LEN, tmp0, tmp1, tmp2);
			numb = comm_gen_str(tmp_payload_xmit, comm_str_spi, numb);
			break;

		case 27: 	//'ctrl_z_g'
			tmp0 = atoi(argv[4]);
			tmp1 = atoi(argv[5]);
			tmp2 = atoi(argv[6]);
			_USE_PRINTF("[Impedance Controller Gains]: kp = %i, ki = %i, kd = %i.\n", tmp0, tmp1, tmp2);
			//Prepare and send data:
			numb = tx_cmd_ctrl_z_g(slave_id[slave], CMD_WRITE, tmp_payload_xmit, PAYLOAD_BUF_LEN, tmp0, tmp1, tmp2);
			numb = comm_gen_str(tmp_payload_xmit, comm_str_spi, numb);
			break;

		case 28: 	//'ctrl_o'
			tmp0 = atoi(argv[4]);
			_USE_PRINTF("[Open Loop Controller]: PWMDC = %i.\n", tmp0);
			//Prepare and send data:
			numb = tx_cmd_ctrl_o(slave_id[slave], CMD_WRITE, tmp_payload_xmit, PAYLOAD_BUF_LEN, tmp0);
			numb = comm_gen_str(tmp_payload_xmit, comm_str_spi, numb);
			break;

		case 29: 	//'ctrl_i'
			tmp0 = atoi(argv[4]);
			_USE_PRINTF("[Current Controller]: %i.\n", tmp0);
			//Prepare and send data:
			numb = tx_cmd_ctrl_i(slave_id[slave], CMD_WRITE, tmp_payload_xmit, PAYLOAD_BUF_LEN, tmp0, 0);
			numb = comm_gen_str(tmp_payload_xmit, comm_str_spi, numb);
			break;

		case 30:	//'ctrl_p'
			tmp0 = atoi(argv[4]);
			tmp1 = atoi(argv[5]);
			tmp2 = atoi(argv[6]);
			tmp3 = atoi(argv[7]);
			_USE_PRINTF("[Position Controller]: %i, %i, %i, %i.\n", tmp0, tmp1, tmp2, tmp3);
			//Prepare and send data:
			numb = tx_cmd_ctrl_p(slave_id[slave], CMD_WRITE, tmp_payload_xmit, PAYLOAD_BUF_LEN, 0, tmp0, tmp1, tmp2, tmp3);
			numb = comm_gen_str(tmp_payload_xmit, comm_str_spi, numb);
			break;

		case 31:	//'shorted_leads'
			_USE_PRINTF("Command isn't programmed yet.\n");
			break;

		case 32: 	//'spc1'
			tmp0 = atoi(argv[4]);
			tmp1 = atoi(argv[5]);
			tmp2 = atoi(argv[6]);
			tmp3 = atoi(argv[7]);
			tmp4 = atoi(argv[8]);
			tmp5 = atoi(argv[9]);
			_USE_PRINTF("[Special1]: %i, %i, %i, %i, %i, %i.\n", tmp0, tmp1, tmp2, tmp3, tmp4, tmp5);
			//Prepare and send data:
			numb = tx_cmd_ctrl_special_1(slave_id[slave], CMD_WRITE, tmp_payload_xmit, PAYLOAD_BUF_LEN, \
										tmp0, tmp1, tmp2, tmp3, tmp4, tmp5);
			numb = comm_gen_str(tmp_payload_xmit, comm_str_spi, numb);
			break;

		case 33:	//'spc2'
			_USE_PRINTF("Command isn't programmed yet.\n");
			break;

		default:
			_USE_PRINTF("Invalid command.\n");
			break;
    }

    //If a command was generated, send it
    if(numb)
    {
		#ifdef USE_SPI
    	flexsea_send_serial_slave(PORT_SPI, comm_str_spi, numb);
    	#endif

		#ifdef USE_USB
    	flexsea_send_serial_slave(PORT_USB, comm_str_spi, numb+1);
    	#endif
    }
}
Beispiel #10
0
void KatMenu::action(const gcn::ActionEvent &actionEvent)
{
	std::string tmp_string;
	t_config *p_config = config_get_ptr();

	mMenuListener.setGuiMain ( mGuiMain );

	if ( actionEvent.getId() == "mLoad" ) 
	{
		mGuiMain->getFileBrowser()->deleteActions();
		mGuiMain->getFileBrowser()->addActionListener(&mMenuListener);
		mGuiMain->getFileBrowser()->setActionEventId("LoadBrowser");
		mGuiMain->getFileBrowser()->show("Load ROM", p_config->rom_file, FileBrowser::LOAD);
	}
	else if ( actionEvent.getId() == "mSaveState" ) 
	{
		mGuiMain->getProfilePopup()->deleteActions();
		mGuiMain->getProfilePopup()->addActionListener(&mMenuListener);
		mGuiMain->getProfilePopup()->setActionEventId("SaveState");
		mGuiMain->getProfilePopup()->show( "Choose State or Create New", "SELECT Name FROM States", "", true );
	}
	else if ( actionEvent.getId() == "mLoadState" ) 
	{
		mGuiMain->getProfilePopup()->deleteActions();
		mGuiMain->getProfilePopup()->addActionListener(&mMenuListener);
		mGuiMain->getProfilePopup()->setActionEventId("LoadState");
		mGuiMain->getProfilePopup()->show( "Load State", "SELECT Name FROM States", "", false );
	}
	else if ( actionEvent.getId().find( "mQuickSaveState", 0 ) != std::string::npos ) 
	{
		save_quick_state ( atoi(actionEvent.getId().c_str()+15), console_get_ptr() );
		checkSaveStateExistance();
	}
	else if ( actionEvent.getId().find( "mQuickLoadState", 0 ) != std::string::npos ) 
	{
		if ( recall_quick_state ( atoi(actionEvent.getId().c_str()+15), console_get_ptr() ) )
		{
			mGuiMain->getInfoPopup()->deleteActions();
			mGuiMain->getInfoPopup()->show( "Error Loading State" );
			return;
		}
		mGuiMain->launch( 1, 0 );
	}
	else if ( actionEvent.getId() == "mLauncher" ) 
		mGuiMain->showLauncher();

	else if ( actionEvent.getId() == "mBack" ) 
		mGuiMain->launch( 0, 0 );

	else if ( actionEvent.getId() == "mExit" ) 
		mGuiMain->exit();

	else if ( actionEvent.getId().find( "mAtari", 0 ) != std::string::npos ) 
	{
		if ( actionEvent.getId().find( "5200", 0 ) != std::string::npos ) 
			setMachine ( MACHINE_TYPE_5200 );
		else if ( actionEvent.getId().find( "800", 0 ) != std::string::npos ) 
			setMachine ( MACHINE_TYPE_800 );
		else
			setMachine ( MACHINE_TYPE_XL );
		setRam ( p_config->machine_type, p_config->ram_size[p_config->machine_type] );
		config_save();
	}
	else if ( actionEvent.getId().find( "mRam", 0 ) != std::string::npos ) 
		setRam ( p_config->machine_type, atoi(actionEvent.getId().c_str()+4) );

	else if ( actionEvent.getId() == "mNTSC" ) 
	{
		setItemChecked ( "mNTSC", true );
		setItemChecked ( "mPAL", false );
		p_config->system_type = NTSC;
		config_save();
	}
	else if ( actionEvent.getId() == "mPAL" ) 
	{
		setItemChecked ( "mNTSC", false );
		setItemChecked ( "mPAL", true );
		p_config->system_type = PAL;
		config_save();
	}
	else if ( actionEvent.getId() == "mThrottle" ) 
		mGuiMain->showThrottle();

	else if ( actionEvent.getId() == "mBios" ) 
		mGuiMain->showBiosCfg();

	else if ( actionEvent.getId() == "mMedia" ) 
		mGuiMain->showMediaCfg();

	else if ( actionEvent.getId() == "mSioPatch" ) 
	{
		if ( p_config->sio_patch )
		{
			setItemChecked ( "mSioPatch", false );
			p_config->sio_patch = 0;
		}
		else
		{
			setItemChecked ( "mSioPatch", true );
			p_config->sio_patch = 1;
		}
		config_save();
	}
	else if ( actionEvent.getId() == "mBasicEnabled" ) 
	{
		if ( p_config->basic_enable )
		{
			setItemChecked ( "mBasicEnabled", false );
			p_config->basic_enable = 0;
		}
		else
		{
			setItemChecked ( "mBasicEnabled", true );
			p_config->basic_enable = 1;
		}
		config_save();
	}
	else if ( actionEvent.getId() == "mResetWarm" ) 
	{
		/* FIXME: What if no ROM loaded?  It will crash! */
		reset_6502();
	}
	else if ( actionEvent.getId() == "mResetCold" ) {
		console_reset ( p_config->machine_type, p_config->system_type, p_config->ram_size[p_config->machine_type], g_sound.freq  );
	}
	else if ( actionEvent.getId() == "m1x" ) 
	{
		setItemChecked ( "m1x", true );
		setItemChecked ( "m2x", false );
		setItemChecked ( "m3x", false );
		g_video.zoom = 0;
		video_save_profile ( g_video.name, &g_video );
	}
	else if ( actionEvent.getId() == "m2x" ) 
	{
		setItemChecked ( "m1x", false );
		setItemChecked ( "m2x", true );
		setItemChecked ( "m3x", false );
		g_video.zoom = 1;
		video_save_profile ( g_video.name, &g_video );
	}
	else if ( actionEvent.getId() == "m3x" ) 
	{
		setItemChecked ( "m1x", false );
		setItemChecked ( "m2x", false );
		setItemChecked ( "m3x", true );
		g_video.zoom = 2;
		video_save_profile ( g_video.name, &g_video );
	}
	else if ( actionEvent.getId() == "mFullscreen" ) 
	{
		if ( g_video.fullscreen )
		{
			g_video.fullscreen = 0;
			setItemChecked ( "mFullscreen", false );
		}
		else
		{
			g_video.fullscreen = 1;
			setItemChecked ( "mFullscreen", true );
		}
		video_save_profile ( g_video.name, &g_video );
	}
	else if ( actionEvent.getId() == "mVideo" ) 
		mGuiMain->showVideoCfg();

	else if ( actionEvent.getId() == "mSound" ) 
		mGuiMain->showSoundCfg();

	else if ( actionEvent.getId() == "mInput" ) 
		mGuiMain->showInputCfg();

	else if ( actionEvent.getId() == "mPalEdit" ) 
		mGuiMain->showPaletteCfg();

	else if ( actionEvent.getId() == "mUI" ) 
		mGuiMain->showUserInterfaceCfg();

	else if ( actionEvent.getId() == "mImport" ) 
		mGuiMain->showConvert ( Convert::CONVERT_A800 );

	else if ( actionEvent.getId() == "mExport" ) 
		mGuiMain->showConvert ( Convert::CONVERT_KAT5200 );

	else if ( actionEvent.getId() == "mWizard" ) 
	{
		tmp_string = " ";
		mGuiMain->showWizard( tmp_string );
	}

	else if ( actionEvent.getId() == "mMediaCreate" ) 
		mGuiMain->showMediaCreate();

	else if ( actionEvent.getId() == "mViewLog" ) 
		mGuiMain->showLog();
}