# HG changeset patch # User Alexis Jeandet # Date 2015-07-21 18:40:40 # Node ID c92c4a05386ad7c8a9e230d2f64ed59bf0048313 # Parent 7db793755e5c48c2188a085281fa1145ef28cecf Improved AHB plugn'play decoding. diff --git a/SocExplorer_Plugins.pro b/SocExplorer_Plugins.pro --- a/SocExplorer_Plugins.pro +++ b/SocExplorer_Plugins.pro @@ -10,6 +10,6 @@ SUBDIRS = \ genericrwplugin \ memctrlrplugin \ memcheckplugin +unix:SUBDIRS += spwplugin OTHER_FILES += SocExplorer-plugins.spec -#unix:SUBDIRS += spwplugin diff --git a/ambaplugin/AHB/ahbdevicelist.cpp b/ambaplugin/AHB/ahbdevicelist.cpp --- a/ambaplugin/AHB/ahbdevicelist.cpp +++ b/ambaplugin/AHB/ahbdevicelist.cpp @@ -20,7 +20,7 @@ -- Mail : alexis.jeandet@lpp.polytechnique.fr ----------------------------------------------------------------------------*/ #include "ahbdevicelist.h" - +#include "ahbpluginui.h" ahbdevicelist::ahbdevicelist(QWidget *parent):QTableWidget(parent) @@ -36,6 +36,24 @@ void ahbdevicelist::clearAHBdevicesList( this->setHorizontalHeaderLabels(QStringList() << tr("Device Name")<rowCount()==0) @@ -56,7 +74,10 @@ void ahbdevicelist::addAHBdevice(ahbdevi { 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)); + 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); } diff --git a/ambaplugin/AHB/ahbpluginui.cpp b/ambaplugin/AHB/ahbpluginui.cpp --- a/ambaplugin/AHB/ahbpluginui.cpp +++ b/ambaplugin/AHB/ahbpluginui.cpp @@ -39,7 +39,7 @@ ahbPluginUi::ahbPluginUi(socexplorerplug -ahbdeviceInfo* ahbPluginUi::extractInfos(int *pnpregs) +ahbdeviceInfo* ahbPluginUi::extractInfos(unsigned int *pnpregs) { AHBbarreg BAR[4]; @@ -47,13 +47,32 @@ ahbdeviceInfo* ahbPluginUi::extractInfos int PID; for(int i=0;i<4;i++) { - BAR[i].address = pnpregs[i+4] & 0xfff00000; - BAR[i].size = (pnpregs[i+4] & 0x0000fff0)<<16; + unsigned int addr=(pnpregs[i+4] & 0xfff00000)>>20; + unsigned int mask=(pnpregs[i+4] & 0x0FFF0)>>4; + BAR[i].type = (unsigned char)(pnpregs[i+4]&0x0f); + printf("%x\n",addr); + BAR[i].size = 0; + BAR[i].address = 0; + switch ((int)(BAR[i].type)) + { + case AHB_PLUGNPLAY_APB_IO_SPACE: + break; + case AHB_PLUGNPLAY_MEMORY_SPACE: + BAR[i].address = addr<<20; + BAR[i].size = (mask)<<20; + break; + case AHB_PLUGNPLAY_AHB_IO_SPACE: + BAR[i].address = 0xfff00000 + (addr<<8); + BAR[i].size = (mask)<<8; + break; + default: + break; + } + if(BAR[i].size!=0) BAR[i].size = (((-1^BAR[i].size)|BAR[i].address)-BAR[i].address)+1; BAR[i].cacheable = (bool)((pnpregs[i+4]&0x00010000)>>16); BAR[i].prefectchable = (bool)((pnpregs[i+4]&0x00020000)>>17); - BAR[i].type = (unsigned char)(pnpregs[i+4]&0xf); } VID = (pnpregs[0]>>24)&0xff; @@ -76,9 +95,11 @@ void ahbPluginUi::scanAHB() { if(pnpregs[j]!=0) { - ahbdeviceInfo* devinfo=this->extractInfos(pnpregs+j); + ahbdeviceInfo* devinfo=this->extractInfos((unsigned int*)(pnpregs+j)); if(!devinfo->deviceName->compare("DSU3")) SocExplorerEngine::addEnumDevice(this->_plugin,devinfo->VID,devinfo->PID,devinfo->BAR[0].address,*devinfo->deviceName); + if(!devinfo->deviceName->compare("SDCTRL")) + SocExplorerEngine::addEnumDevice(this->_plugin,devinfo->VID,devinfo->PID,devinfo->BAR[1].address,*devinfo->deviceName); emit this->addAHBdevice(devinfo); } i+=32; diff --git a/ambaplugin/AHB/ahbpluginui.h b/ambaplugin/AHB/ahbpluginui.h --- a/ambaplugin/AHB/ahbpluginui.h +++ b/ambaplugin/AHB/ahbpluginui.h @@ -31,14 +31,20 @@ #define AHB_PLUGNPLAY_MASTER_STOP ((unsigned int)(0xFFFFF800)) #define AHB_PLUGNPLAY_SLAVE_START ((unsigned int)(0xFFFFF800)) #define AHB_PLUGNPLAY_SLAVE_STOP ((unsigned int)(0xFFFFFFFC)) - +/*0001 = APB I/O space +0010 = AHB Memory space +0011 = AHB I/O space +*/ +#define AHB_PLUGNPLAY_APB_IO_SPACE 0x01 +#define AHB_PLUGNPLAY_MEMORY_SPACE 0x02 +#define AHB_PLUGNPLAY_AHB_IO_SPACE 0x03 class ahbPluginUi : public QWidget { Q_OBJECT public: explicit ahbPluginUi(socexplorerplugin* plugin,QWidget *parent = 0); - ahbdeviceInfo* extractInfos(int* pnpregs); + ahbdeviceInfo* extractInfos(unsigned int* pnpregs); public slots: void scanAHB(); signals: diff --git a/ambaplugin/APB/apbpluginui.cpp b/ambaplugin/APB/apbpluginui.cpp --- a/ambaplugin/APB/apbpluginui.cpp +++ b/ambaplugin/APB/apbpluginui.cpp @@ -79,6 +79,7 @@ void apbPluginUi::scanAPB() unsigned long long i = APB_PLUGNPLAY_START; int pnpregs[size]; emit this->clearAPBdevicesList(); + this->devList.clear(); if(this->_plugin->Read((unsigned int*)pnpregs,size,(unsigned int)APB_PLUGNPLAY_START)==size) { while(iextractInfos(pnpregs+j); SocExplorerEngine::addEnumDevice(this->_plugin,devinfos->VID,devinfos->PID,devinfos->BAR[0].address,devinfos->deviceName); - emit this->addAPBdevice(devinfos); + if(!this->devList.contains(devinfos->BAR[0].address)) + { + this->devList.append(devinfos->BAR[0].address); + emit this->addAPBdevice(devinfos); + } } i+=8; j+=2; - if(pnpregs[0]==pnpregs[j]&&pnpregs[1]==pnpregs[j+1])break; +// if(pnpregs[0]!=0&&pnpregs[0]==pnpregs[j]&&pnpregs[1]==pnpregs[j+1])break; } } this->unlockScanBp(); diff --git a/ambaplugin/APB/apbpluginui.h b/ambaplugin/APB/apbpluginui.h --- a/ambaplugin/APB/apbpluginui.h +++ b/ambaplugin/APB/apbpluginui.h @@ -54,6 +54,7 @@ private: QPushButton* scanBp; apbdevicelist* deviceslst; socexplorerplugin* _plugin; + QList devList; }; #endif // APBPLUGINUI_H diff --git a/ambaplugin/ambaplugin.pro b/ambaplugin/ambaplugin.pro --- a/ambaplugin/ambaplugin.pro +++ b/ambaplugin/ambaplugin.pro @@ -7,7 +7,7 @@ CONFIG += socexplorerplugin CONFIG += dll CONFIG -= static VERSION=0.2.0 -TARGET = ambaplugin #$${DEBUG_EXT} +TARGET = ambaplugin DEFINES += PLUGIN=ambaplugin DEFINES += PLUGINHEADER="\"\\\"ambaplugin.h"\\\"\" DEFINES += driver_Name="\"\\\"AMBA_PLUGIN"\\\"\"