regsexplorer.cpp
58 lines
| 2.0 KiB
| text/x-c
|
CppLexer
Jeandet Alexis
|
r0 | #include "regsexplorer.h" | ||
r79 | #include "ui_regsexplorernew.h" | |||
Jeandet Alexis
|
r0 | #include "socmodel.h" | ||
r79 | RegsExplorer::RegsExplorer(QWidget *parent) : | |||
QDockWidget(parent), | ||||
ui(new Ui::RegsExplorerNew) | ||||
Jeandet Alexis
|
r0 | { | ||
r79 | ui->setupUi(this); | |||
Jeandet Alexis
|
r0 | connect(SocExplorerEngine::self(),SIGNAL(enumDeviceAdded(socExplorerEnumDevice*)),this,SLOT(addDev(socExplorerEnumDevice*))); | ||
r79 | delegate.device=NULL; | |||
} | ||||
RegsExplorer::~RegsExplorer() | ||||
{ | ||||
delete ui; | ||||
Jeandet Alexis
|
r0 | } | ||
r79 | void RegsExplorer::addDev(socExplorerEnumDevice *device) | |||
Jeandet Alexis
|
r0 | { | ||
r79 | if((delegate.device->sameSoc(device))||(delegate.device==NULL)) | |||
Jeandet Alexis
|
r0 | { | ||
r79 | delegate.device = device; | |||
peripheralWidget* peripheral=new peripheralWidget(device->name(),device->baseAddress(),&delegate,this); | ||||
this->ui->regsViewer->addPeripheral(peripheral); | ||||
peripheralModel periphM=SocExplorerEngine::xmlModel()->getPeripheral(device->name()); | ||||
int startIndex,stopIndex; | ||||
QString desc; | ||||
QString name; | ||||
bool rw; | ||||
this->ui->regsViewer->setSocName(device->socName()); | ||||
for(int i=0;i<periphM.registers.count();i++) | ||||
Jeandet Alexis
|
r0 | { | ||
r79 | peripheral->addRegister(periphM.registers.at(i).name,device->baseAddress() + periphM.registers.at(i).offset); | |||
for(int j=0;j<periphM.registers.at(i).bitfields.count();j++) | ||||
{ | ||||
startIndex = periphM.registers.at(i).bitfields.at(j).offset; | ||||
stopIndex = periphM.registers.at(i).bitfields.at(j).offset+periphM.registers.at(i).bitfields.at(j).size-1; | ||||
desc = periphM.registers.at(i).bitfields.at(j).description; | ||||
rw = periphM.registers.at(i).bitfields.at(j).rw; | ||||
name = periphM.registers.at(i).bitfields.at(j).name; | ||||
peripheral->registerAt(i)->setBitFieldAttribute(startIndex,stopIndex,name,desc,rw); | ||||
} | ||||
Jeandet Alexis
|
r0 | } | ||
} | ||||
} | ||||
r79 | void RegsExplorer::changeEvent(QEvent *e) | |||
{ | ||||
QDockWidget::changeEvent(e); | ||||
switch (e->type()) { | ||||
case QEvent::LanguageChange: | ||||
ui->retranslateUi(this); | ||||
break; | ||||
default: | ||||
break; | ||||
} | ||||
} | ||||