##// END OF EJS Templates
Improved AHB plugn'play decoding.
jeandet -
r64:c92c4a05386a default
parent child
Show More
@@ -10,6 +10,6 SUBDIRS = \
10 genericrwplugin \
10 genericrwplugin \
11 memctrlrplugin \
11 memctrlrplugin \
12 memcheckplugin
12 memcheckplugin
13 unix:SUBDIRS += spwplugin
13
14
14 OTHER_FILES += SocExplorer-plugins.spec
15 OTHER_FILES += SocExplorer-plugins.spec
15 #unix:SUBDIRS += spwplugin
@@ -20,7 +20,7
20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
21 ----------------------------------------------------------------------------*/
21 ----------------------------------------------------------------------------*/
22 #include "ahbdevicelist.h"
22 #include "ahbdevicelist.h"
23
23 #include "ahbpluginui.h"
24
24
25
25
26 ahbdevicelist::ahbdevicelist(QWidget *parent):QTableWidget(parent)
26 ahbdevicelist::ahbdevicelist(QWidget *parent):QTableWidget(parent)
@@ -36,6 +36,24 void ahbdevicelist::clearAHBdevicesList(
36 this->setHorizontalHeaderLabels(QStringList() << tr("Device Name")<<tr("BAR0")<<tr("BAR1")<<tr("BAR2")<<tr("BAR3")<<tr("Vendor ID")<<tr("Product ID"));
36 this->setHorizontalHeaderLabels(QStringList() << tr("Device Name")<<tr("BAR0")<<tr("BAR1")<<tr("BAR2")<<tr("BAR3")<<tr("Vendor ID")<<tr("Product ID"));
37 }
37 }
38
38
39 QString decodeType(int type)
40 {
41 switch (type) {
42 case AHB_PLUGNPLAY_APB_IO_SPACE:
43 return "APB IO space";
44 break;
45 case AHB_PLUGNPLAY_MEMORY_SPACE:
46 return "Memory space";
47 break;
48 case AHB_PLUGNPLAY_AHB_IO_SPACE:
49 return "AHB IO space";
50 break;
51 default:
52 return "Unknown type";
53 break;
54 }
55 }
56
39 void ahbdevicelist::addAHBdevice(ahbdeviceInfo* device)
57 void ahbdevicelist::addAHBdevice(ahbdeviceInfo* device)
40 {
58 {
41 if(this->rowCount()==0)
59 if(this->rowCount()==0)
@@ -56,7 +74,10 void ahbdevicelist::addAHBdevice(ahbdevi
56 {
74 {
57 if(device->BAR[i].size!=0)
75 if(device->BAR[i].size!=0)
58 {
76 {
59 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));
77 newItem = new QTableWidgetItem("0x" + QString::number(device->BAR[i].address, 16)
78 +" -> 0x"+ QString::number(device->BAR[i].address + device->BAR[i].size-1, 16)
79 +" size = "+device->barAdressSize(i)
80 +" "+ decodeType(device->BAR[i].type));
60 newItem->setFlags(newItem->flags() &~ Qt::ItemIsEditable);
81 newItem->setFlags(newItem->flags() &~ Qt::ItemIsEditable);
61 this->setItem(this->rowCount()-1, i+1, newItem);
82 this->setItem(this->rowCount()-1, i+1, newItem);
62 }
83 }
@@ -39,7 +39,7 ahbPluginUi::ahbPluginUi(socexplorerplug
39
39
40
40
41
41
42 ahbdeviceInfo* ahbPluginUi::extractInfos(int *pnpregs)
42 ahbdeviceInfo* ahbPluginUi::extractInfos(unsigned int *pnpregs)
43 {
43 {
44 AHBbarreg BAR[4];
44 AHBbarreg BAR[4];
45
45
@@ -47,13 +47,32 ahbdeviceInfo* ahbPluginUi::extractInfos
47 int PID;
47 int PID;
48 for(int i=0;i<4;i++)
48 for(int i=0;i<4;i++)
49 {
49 {
50 BAR[i].address = pnpregs[i+4] & 0xfff00000;
50 unsigned int addr=(pnpregs[i+4] & 0xfff00000)>>20;
51 BAR[i].size = (pnpregs[i+4] & 0x0000fff0)<<16;
51 unsigned int mask=(pnpregs[i+4] & 0x0FFF0)>>4;
52 BAR[i].type = (unsigned char)(pnpregs[i+4]&0x0f);
53 printf("%x\n",addr);
54 BAR[i].size = 0;
55 BAR[i].address = 0;
56 switch ((int)(BAR[i].type))
57 {
58 case AHB_PLUGNPLAY_APB_IO_SPACE:
59 break;
60 case AHB_PLUGNPLAY_MEMORY_SPACE:
61 BAR[i].address = addr<<20;
62 BAR[i].size = (mask)<<20;
63 break;
64 case AHB_PLUGNPLAY_AHB_IO_SPACE:
65 BAR[i].address = 0xfff00000 + (addr<<8);
66 BAR[i].size = (mask)<<8;
67 break;
68 default:
69 break;
70 }
71
52 if(BAR[i].size!=0)
72 if(BAR[i].size!=0)
53 BAR[i].size = (((-1^BAR[i].size)|BAR[i].address)-BAR[i].address)+1;
73 BAR[i].size = (((-1^BAR[i].size)|BAR[i].address)-BAR[i].address)+1;
54 BAR[i].cacheable = (bool)((pnpregs[i+4]&0x00010000)>>16);
74 BAR[i].cacheable = (bool)((pnpregs[i+4]&0x00010000)>>16);
55 BAR[i].prefectchable = (bool)((pnpregs[i+4]&0x00020000)>>17);
75 BAR[i].prefectchable = (bool)((pnpregs[i+4]&0x00020000)>>17);
56 BAR[i].type = (unsigned char)(pnpregs[i+4]&0xf);
57 }
76 }
58
77
59 VID = (pnpregs[0]>>24)&0xff;
78 VID = (pnpregs[0]>>24)&0xff;
@@ -76,9 +95,11 void ahbPluginUi::scanAHB()
76 {
95 {
77 if(pnpregs[j]!=0)
96 if(pnpregs[j]!=0)
78 {
97 {
79 ahbdeviceInfo* devinfo=this->extractInfos(pnpregs+j);
98 ahbdeviceInfo* devinfo=this->extractInfos((unsigned int*)(pnpregs+j));
80 if(!devinfo->deviceName->compare("DSU3"))
99 if(!devinfo->deviceName->compare("DSU3"))
81 SocExplorerEngine::addEnumDevice(this->_plugin,devinfo->VID,devinfo->PID,devinfo->BAR[0].address,*devinfo->deviceName);
100 SocExplorerEngine::addEnumDevice(this->_plugin,devinfo->VID,devinfo->PID,devinfo->BAR[0].address,*devinfo->deviceName);
101 if(!devinfo->deviceName->compare("SDCTRL"))
102 SocExplorerEngine::addEnumDevice(this->_plugin,devinfo->VID,devinfo->PID,devinfo->BAR[1].address,*devinfo->deviceName);
82 emit this->addAHBdevice(devinfo);
103 emit this->addAHBdevice(devinfo);
83 }
104 }
84 i+=32;
105 i+=32;
@@ -31,14 +31,20
31 #define AHB_PLUGNPLAY_MASTER_STOP ((unsigned int)(0xFFFFF800))
31 #define AHB_PLUGNPLAY_MASTER_STOP ((unsigned int)(0xFFFFF800))
32 #define AHB_PLUGNPLAY_SLAVE_START ((unsigned int)(0xFFFFF800))
32 #define AHB_PLUGNPLAY_SLAVE_START ((unsigned int)(0xFFFFF800))
33 #define AHB_PLUGNPLAY_SLAVE_STOP ((unsigned int)(0xFFFFFFFC))
33 #define AHB_PLUGNPLAY_SLAVE_STOP ((unsigned int)(0xFFFFFFFC))
34
34 /*0001 = APB I/O space
35 0010 = AHB Memory space
36 0011 = AHB I/O space
37 */
38 #define AHB_PLUGNPLAY_APB_IO_SPACE 0x01
39 #define AHB_PLUGNPLAY_MEMORY_SPACE 0x02
40 #define AHB_PLUGNPLAY_AHB_IO_SPACE 0x03
35
41
36 class ahbPluginUi : public QWidget
42 class ahbPluginUi : public QWidget
37 {
43 {
38 Q_OBJECT
44 Q_OBJECT
39 public:
45 public:
40 explicit ahbPluginUi(socexplorerplugin* plugin,QWidget *parent = 0);
46 explicit ahbPluginUi(socexplorerplugin* plugin,QWidget *parent = 0);
41 ahbdeviceInfo* extractInfos(int* pnpregs);
47 ahbdeviceInfo* extractInfos(unsigned int* pnpregs);
42 public slots:
48 public slots:
43 void scanAHB();
49 void scanAHB();
44 signals:
50 signals:
@@ -79,6 +79,7 void apbPluginUi::scanAPB()
79 unsigned long long i = APB_PLUGNPLAY_START;
79 unsigned long long i = APB_PLUGNPLAY_START;
80 int pnpregs[size];
80 int pnpregs[size];
81 emit this->clearAPBdevicesList();
81 emit this->clearAPBdevicesList();
82 this->devList.clear();
82 if(this->_plugin->Read((unsigned int*)pnpregs,size,(unsigned int)APB_PLUGNPLAY_START)==size)
83 if(this->_plugin->Read((unsigned int*)pnpregs,size,(unsigned int)APB_PLUGNPLAY_START)==size)
83 {
84 {
84 while(i<APB_PLUGNPLAY_STOP)
85 while(i<APB_PLUGNPLAY_STOP)
@@ -87,11 +88,15 void apbPluginUi::scanAPB()
87 {
88 {
88 apbdeviceInfo* devinfos=this->extractInfos(pnpregs+j);
89 apbdeviceInfo* devinfos=this->extractInfos(pnpregs+j);
89 SocExplorerEngine::addEnumDevice(this->_plugin,devinfos->VID,devinfos->PID,devinfos->BAR[0].address,devinfos->deviceName);
90 SocExplorerEngine::addEnumDevice(this->_plugin,devinfos->VID,devinfos->PID,devinfos->BAR[0].address,devinfos->deviceName);
91 if(!this->devList.contains(devinfos->BAR[0].address))
92 {
93 this->devList.append(devinfos->BAR[0].address);
90 emit this->addAPBdevice(devinfos);
94 emit this->addAPBdevice(devinfos);
91 }
95 }
96 }
92 i+=8;
97 i+=8;
93 j+=2;
98 j+=2;
94 if(pnpregs[0]==pnpregs[j]&&pnpregs[1]==pnpregs[j+1])break;
99 // if(pnpregs[0]!=0&&pnpregs[0]==pnpregs[j]&&pnpregs[1]==pnpregs[j+1])break;
95 }
100 }
96 }
101 }
97 this->unlockScanBp();
102 this->unlockScanBp();
@@ -54,6 +54,7 private:
54 QPushButton* scanBp;
54 QPushButton* scanBp;
55 apbdevicelist* deviceslst;
55 apbdevicelist* deviceslst;
56 socexplorerplugin* _plugin;
56 socexplorerplugin* _plugin;
57 QList<int> devList;
57 };
58 };
58
59
59 #endif // APBPLUGINUI_H
60 #endif // APBPLUGINUI_H
@@ -7,7 +7,7 CONFIG += socexplorerplugin
7 CONFIG += dll
7 CONFIG += dll
8 CONFIG -= static
8 CONFIG -= static
9 VERSION=0.2.0
9 VERSION=0.2.0
10 TARGET = ambaplugin #$${DEBUG_EXT}
10 TARGET = ambaplugin
11 DEFINES += PLUGIN=ambaplugin
11 DEFINES += PLUGIN=ambaplugin
12 DEFINES += PLUGINHEADER="\"\\\"ambaplugin.h"\\\"\"
12 DEFINES += PLUGINHEADER="\"\\\"ambaplugin.h"\\\"\"
13 DEFINES += driver_Name="\"\\\"AMBA_PLUGIN"\\\"\"
13 DEFINES += driver_Name="\"\\\"AMBA_PLUGIN"\\\"\"
General Comments 0
You need to be logged in to leave comments. Login now