Пример #1
0
/*******************************************************************************
*
* copy_code - copy u-boot image from flash to RAM
*
* This routine is needed to solve flash problems on this board
*
*/
void copy_code (ulong dest_addr)
{
	extern long uboot_end_data;
	unsigned long start;
	unsigned long end;

	/* load copydwords into ram
	 */
	programLoad();

	/* copy u-boot code
	 */
	copyLongs((ulong *)CFG_MONITOR_BASE,
		  (ulong *)dest_addr,
		  ((ulong)&uboot_end_data - CFG_MONITOR_BASE + 3) / 4);


	/* flush caches
	 */

	start = CKSEG0;
	end = start + CFG_DCACHE_SIZE;
	while(start < end) {
		cache_unroll(start,Index_Writeback_Inv_D);
		start += CFG_CACHELINE_SIZE;
	}

	start = CKSEG0;
	end = start + CFG_ICACHE_SIZE;
	while(start < end) {
		cache_unroll(start,Index_Invalidate_I);
		start += CFG_CACHELINE_SIZE;
	}
}
Пример #2
0
void MainWindow::programOpen(const QString programPath)
{
	if (isOkToContinue())
	{
		programLoad(programPath);
	}
}
Пример #3
0
void MainWindow::on_actionOpen_triggered(void)
{
	if (isOkToContinue())
	{
		QString programPath = QFileDialog::getOpenFileName(this,
			tr("Open Program"), m_curDirectory, tr("Program files (*.*)"));
		if (!programPath.isEmpty())
		{
			programLoad(programPath);
			m_curDirectory = QFileInfo(programPath).path();
		}
	}
}
Пример #4
0
MainWindow::MainWindow(QWidget *parent) :
	QMainWindow(parent),
	ui(new Ui::MainWindow)
{
	m_commandLine = new CommandLine(qApp->arguments());
	if (m_commandLine->processed())
	{
		// don't start GUI and retrieve the return code
		m_guiActive = false;
		m_returnCode = m_commandLine->returnCode();
		return;
	}

	// start GUI here
	ui->setupUi(this);
	m_recentPrograms = new RecentFiles(ui->menuOpenRecent, this);
	connect(m_recentPrograms, SIGNAL(openFile(QString)),
		this, SLOT(programOpen(const QString)));
	settingsRestore();

	// TODO settings will eventually have info about edit boxes that were open
	// TODO that will need to be restored, for now there is a single edit box

	//==================
	//  SETUP EDIT BOX
	//==================

	// create the starting program edit box
	m_editBox = new EditBox(this);
	setCentralWidget(m_editBox);
	m_statusReady = false;

	connect(m_editBox->document(), SIGNAL(modificationChanged(bool)),
		this, SLOT(setWindowModified(bool)));
	connect(m_editBox->document(), SIGNAL(modificationChanged(bool)),
		ui->actionSave, SLOT(setEnabled(bool)));

	// connect available signals to the appropriate edit actions
	connect(m_editBox, SIGNAL(undoAvailable(bool)),
		ui->actionUndo, SLOT(setEnabled(bool)));
	connect(m_editBox, SIGNAL(redoAvailable(bool)),
		ui->actionRedo, SLOT(setEnabled(bool)));
	connect(m_editBox, SIGNAL(copyAvailable(bool)),
		ui->actionCut, SLOT(setEnabled(bool)));
	connect(m_editBox, SIGNAL(copyAvailable(bool)),
		ui->actionCopy, SLOT(setEnabled(bool)));
	connect(m_editBox, SIGNAL(copyAvailable(bool)),
		ui->actionDelete, SLOT(setEnabled(bool)));
	connect(m_editBox, SIGNAL(errorsAvailable(bool)),
		ui->actionGoNextError, SLOT(setEnabled(bool)));
	connect(m_editBox, SIGNAL(errorsAvailable(bool)),
		ui->actionGoPrevError, SLOT(setEnabled(bool)));

	// create actions for edit box context menu
	QList<QAction *> actions;
	actions.append(ui->actionUndo);
	actions.append(ui->actionRedo);
	actions.append(new QAction(m_editBox));
	actions.last()->setSeparator(true);
	actions.append(ui->actionCut);
	actions.append(ui->actionCopy);
	actions.append(ui->actionPaste);
	actions.append(ui->actionDelete);
	actions.append(new QAction(m_editBox));
	actions.last()->setSeparator(true);
	actions.append(ui->actionSelectAll);
	m_editBox->addActions(actions);
	m_editBox->setContextMenuPolicy(Qt::ActionsContextMenu);

	//==============================================
	// SETUP PROGRAM MODEL, LINE DELEGATE AND VIEW
	//==============================================

	// setup program model (connect to edit box changes)
	m_programModel = new ProgramModel(this);
	connect(m_editBox, SIGNAL(linesChanged(int, int, int, QStringList)),
		m_programModel, SLOT(update(int, int, int, QStringList)));
	connect(m_programModel, SIGNAL(errorListChanged(ErrorList)),
		m_editBox, SLOT(updateErrors(ErrorList)));

	// setup program line delegate (connect to model line count changes)
	m_programLineDelegate = new ProgramLineDelegate(EditBox::BaseLineNumber,
		ui->programView, this);
	connect(m_programModel, SIGNAL(lineCountChanged(int)),
		m_programLineDelegate, SLOT(lineNumberWidthUpdate(int)));

	// setup program view
	ui->programView->setItemDelegate(m_programLineDelegate);
	ui->programView->setModel(m_programModel);
	ui->programView->setFont(m_editBox->font());

	//=================
	//  SETUP PROGRAM
	//=================

	// if a file name was specified on the command line
	// then it overrides the restored program
	if (!m_commandLine->fileName().isEmpty())
	{
		setCurProgram(m_commandLine->fileName());
	}
	else
	{
		// make sure window title is set before continuing
		setCurProgram(m_curProgram);
	}

	// load program if one was saved or specified on command line
	if (!m_curProgram.isEmpty()						// load a program?
			&& (!QFile::exists(m_curProgram)		// program not found?
			|| !programLoad(m_curProgram))			// program not loaded?
			&& m_commandLine->fileName().isEmpty())	// no program argument
	{
		setCurProgram("");  // clear program path that was restored/set
		// TODO should an warning message be issued here?
	}
	statusBarCreate();

	m_guiActive = true;
	statusBarUpdate();
}