##// END OF EJS Templates
Étiquette socexplorer-plugins-0.7-7 ajoutée à la révision b7137547140e
Étiquette socexplorer-plugins-0.7-7 ajoutée à la révision b7137547140e

File last commit:

r64:c92c4a05386a default
r102:21039a925364 tip default
Show More
ahbdevicelist.cpp
95 lines | 3.6 KiB | text/x-c | CppLexer
/*------------------------------------------------------------------------------
-- This file is a part of the SocExplorer Software
-- Copyright (C) 2011, Plasma Physics Laboratory - CNRS
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-------------------------------------------------------------------------------*/
/*-- Author : Alexis Jeandet
-- Mail : alexis.jeandet@lpp.polytechnique.fr
----------------------------------------------------------------------------*/
#include "ahbdevicelist.h"
#include "ahbpluginui.h"
ahbdevicelist::ahbdevicelist(QWidget *parent):QTableWidget(parent)
{
this->setColumnCount(7);
this->setHorizontalHeaderLabels(QStringList() << tr("Device Name")<<tr("BAR0")<<tr("BAR1")<<tr("BAR2")<<tr("BAR3")<<tr("Vendor ID")<<tr("Product ID"));
}
void ahbdevicelist::clearAHBdevicesList()
{
this->clear();
this->setRowCount(0);
this->setHorizontalHeaderLabels(QStringList() << tr("Device Name")<<tr("BAR0")<<tr("BAR1")<<tr("BAR2")<<tr("BAR3")<<tr("Vendor ID")<<tr("Product ID"));
}
QString decodeType(int type)
{
switch (type) {
case AHB_PLUGNPLAY_APB_IO_SPACE:
return "APB IO space";
break;
case AHB_PLUGNPLAY_MEMORY_SPACE:
return "Memory space";
break;
case AHB_PLUGNPLAY_AHB_IO_SPACE:
return "AHB IO space";
break;
default:
return "Unknown type";
break;
}
}
void ahbdevicelist::addAHBdevice(ahbdeviceInfo* device)
{
if(this->rowCount()==0)
{
this->setRowCount(1);
}
else
{
this->insertRow(this->rowCount());
}
this->ahbdevices.append(device);
QTableWidgetItem *newItem = new QTableWidgetItem(*device->deviceName);
newItem->setFlags(newItem->flags() &~ Qt::ItemIsEditable);
this->setItem(this->rowCount()-1, 0, newItem);
for(int i=0;i<4;i++)
{
if(device->BAR[i].size!=0)
{
newItem = new QTableWidgetItem("0x" + QString::number(device->BAR[i].address, 16)
+" -> 0x"+ QString::number(device->BAR[i].address + device->BAR[i].size-1, 16)
+" size = "+device->barAdressSize(i)
+" "+ decodeType(device->BAR[i].type));
newItem->setFlags(newItem->flags() &~ Qt::ItemIsEditable);
this->setItem(this->rowCount()-1, i+1, newItem);
}
}
newItem = new QTableWidgetItem("0x" + QString::number(device->VID , 16));
newItem->setFlags(newItem->flags() &~ Qt::ItemIsEditable);
this->setItem(this->rowCount()-1, 5, newItem);
newItem = new QTableWidgetItem("0x" + QString::number(device->PID , 16));
newItem->setFlags(newItem->flags() &~ Qt::ItemIsEditable);
this->setItem(this->rowCount()-1, 6, newItem);
this->resizeColumnsToContents();
}