MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); this->ui->b_disconnect->setEnabled(false); this->ui->gb_top->setEnabled(false); this->ui->b_send->setEnabled(false); this->ui->b_verify->setEnabled(false); this->ui->b_repeat->setEnabled(false); this->ui->b_reset->setEnabled(false); this->btl = new Bootloader(); this->tfThread = new transferThread(); this->lastAction = ACTION_NONE; this->ui->gb_top->setEnabled(true); QObject::connect(this->ui->b_quit,SIGNAL(clicked()),this,SLOT(Quit())); QObject::connect(this->ui->b_qt,SIGNAL(clicked()),qApp,SLOT(aboutQt())); QObject::connect(this->ui->b_connect, SIGNAL(clicked()), this, SLOT(Connect())); QObject::connect(this->ui->b_disconnect, SIGNAL(clicked()), this, SLOT(Disconnect())); QObject::connect(this->ui->b_send, SIGNAL(clicked()), this, SLOT(Send())); QObject::connect(this->ui->b_verify, SIGNAL(clicked()), this, SLOT(Verify())); QObject::connect(this->ui->b_repeat, SIGNAL(clicked()), this, SLOT(Repeat())); QObject::connect(this->ui->b_reset, SIGNAL(clicked()), this, SLOT(ResetMCU())); // Thread QObject::connect(this->tfThread, SIGNAL(sendProgress(quint32)), this, SLOT(updateProgress(quint32))); QObject::connect(this->tfThread, SIGNAL(sendStatus(QString)), this, SLOT(updateStatus(QString))); QObject::connect(this->tfThread, SIGNAL(sendLock(bool)), this, SLOT(lockUI(bool))); QObject::connect(this->ui->b_stop, SIGNAL(clicked()), this->tfThread, SLOT(halt())); QObject::connect(this->tfThread, SIGNAL(sendLog(QString)), this, SLOT(log(QString))); }
int FDL_McuResetNormal (PACKET_T *packet, void *arg) { int i; //BOOT_ENTRY boot_entry = (BOOT_ENTRY) 0x40000000; /* Start of internal RAM */ #if 0 /* Copy NBL to internal RAM */ if (NAND_SUCCESS != nand_read_NBL ( (void *) boot_entry)) { send_ack_packet (BSL_REP_OPERATION_FAILED); return 0; } #endif FDL_SendAckPacket (BSL_REP_ACK); /* Wait until all characters are sent out. */ for (i=0; i<0x0A000; i++) { /* Do nothing */; } FDL_ResetMcuClock(); ResetMCU(); /* We should not go here */ return 0; }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); this->ui->b_disconnect->setEnabled(false); this->ui->b_send->setEnabled(false); this->ui->b_sendlast->setEnabled(false); this->ui->b_receive->setEnabled(false); this->ui->b_verify->setEnabled(false); this->stlink = new stlinkv2(); this->devices = new DeviceList(this); this->tfThread = new transferThread(); if (this->devices->IsLoaded()) { this->ui->gb_top->setEnabled(true); this->log(QString::number(this->devices->getDevicesCount())+" Device descriptions loaded."); QObject::connect(this->ui->b_quit,SIGNAL(clicked()),this,SLOT(Quit())); QObject::connect(this->ui->b_qt,SIGNAL(clicked()),qApp,SLOT(aboutQt())); QObject::connect(this->ui->b_connect, SIGNAL(clicked()), this, SLOT(Connect())); QObject::connect(this->ui->b_disconnect, SIGNAL(clicked()), this, SLOT(Disconnect())); QObject::connect(this->ui->b_send, SIGNAL(clicked()), this, SLOT(Send())); QObject::connect(this->ui->b_sendlast, SIGNAL(clicked()), this, SLOT(SendLast())); QObject::connect(this->ui->b_receive, SIGNAL(clicked()), this, SLOT(Receive())); QObject::connect(this->ui->b_verify, SIGNAL(clicked()), this, SLOT(Verify())); QObject::connect(this->ui->b_halt, SIGNAL(clicked()), this, SLOT(HaltMCU())); QObject::connect(this->ui->b_run, SIGNAL(clicked()), this, SLOT(RunMCU())); QObject::connect(this->ui->b_reset, SIGNAL(clicked()), this, SLOT(ResetMCU())); QObject::connect(this->ui->r_jtag, SIGNAL(clicked()), this, SLOT(setModeJTAG())); QObject::connect(this->ui->r_swd, SIGNAL(clicked()), this, SLOT(setModeSWD())); QObject::connect(this->ui->b_hardReset, SIGNAL(clicked()), this, SLOT(HardReset())); // Thread QObject::connect(this->tfThread, SIGNAL(sendProgress(quint32)), this, SLOT(updateProgress(quint32))); QObject::connect(this->tfThread, SIGNAL(sendStatus(QString)), this, SLOT(updateStatus(QString))); QObject::connect(this->tfThread, SIGNAL(sendLoaderStatus(QString)), this, SLOT(updateLoaderStatus(QString))); QObject::connect(this->stlink, SIGNAL(bufferPct(quint32)), this, SLOT(updateLoaderPct(quint32))); QObject::connect(this->tfThread, SIGNAL(sendLock(bool)), this, SLOT(lockUI(bool))); QObject::connect(this->ui->b_stop, SIGNAL(clicked()), this->tfThread, SLOT(halt())); QObject::connect(this->tfThread, SIGNAL(sendLog(QString)), this, SLOT(log(QString))); // Help QObject::connect(this->ui->b_help, SIGNAL(clicked()), this, SLOT(showHelp())); }