/*------------------------------------------------------------------------------ -- 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 ----------------------------------------------------------------------------*/ #ifndef AHBDEVICELIST_H #define AHBDEVICELIST_H #include #include #include typedef struct { unsigned int address; unsigned int size; unsigned char type; bool prefectchable; bool cacheable; }AHBbarreg; class ahbdeviceInfo { public: ahbdeviceInfo() { } ahbdeviceInfo(const QString deviceName,AHBbarreg BAR0,AHBbarreg BAR1, AHBbarreg BAR2,AHBbarreg BAR3,int VID,int PID) { this->deviceName = new QString(deviceName); this->BAR[0]=BAR0; this->BAR[1]=BAR1; this->BAR[2]=BAR2; this->BAR[3]=BAR3; this->VID = VID; this->PID = PID; } QString barAdressSize(int barIndex) { int k=0; unsigned int size=this->BAR[barIndex].size; while(size>=1024){size=size>>10;k++;} switch(k) { case 0: return (QString::number(size, 10) + "B"); break; case 1: return (QString::number(size, 10) + "kB"); break; case 2: return (QString::number(size, 10) + "MB"); break; case 3: return (QString::number(size, 10) + "GB"); break; case 4: return (QString::number(size, 10) + "TB"); break; default: return (QString::number(this->BAR[barIndex].size, 10) + "B"); break; } } QString* deviceName; AHBbarreg BAR[4]; int VID; int PID; }; class ahbdevicelist: public QTableWidget { Q_OBJECT public: explicit ahbdevicelist(QWidget * parent = 0); public slots: void addAHBdevice(ahbdeviceInfo* device); void clearAHBdevicesList(); private: QList ahbdevices; }; #endif // AHBDEVICELIST_H