##// END OF EJS Templates
SpwPlugin:...
Jeandet Alexis -
r97:c91564a4cc42 default draft
parent child
Show More
@@ -20,6 +20,7
20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
21 ----------------------------------------------------------------------------*/
21 ----------------------------------------------------------------------------*/
22 #include "memchecker.h"
22 #include "memchecker.h"
23 #include <socexplorerengine.h>
23
24
24 memchecker::memchecker(socexplorerplugin* plugin)
25 memchecker::memchecker(socexplorerplugin* plugin)
25 {
26 {
@@ -83,30 +84,7 unsigned int p_pow2(unsigned int v)
83
84
84 unsigned int memchecker::measureMemSize(unsigned int address, unsigned int maxSize)
85 unsigned int memchecker::measureMemSize(unsigned int address, unsigned int maxSize)
85 {
86 {
86 unsigned int curVal=1,testAddress=address;
87 return SocExplorerEngine::memMeasureSize(this->plugin,address,maxSize);
87 unsigned int size=0;
88 this->plugin->Write(&curVal,1,testAddress);
89 this->plugin->Read(&curVal,1,testAddress);
90 if(curVal!=1)
91 return size;
92 unsigned int max= p_pow2((0xFFFFFFFFFFFFFFFF - address))+1;
93 register unsigned int maxSizeLg=p_pow2(maxSize)-1;
94 if(max>maxSizeLg)
95 max=maxSizeLg;
96 if(max>32)max=32;
97 for(size=2;size<max;size++) //check each address bit
98 {
99 testAddress = (unsigned int)(address+(1<<size));
100 curVal = (unsigned int)(1<<size);
101 this->plugin->Write(&curVal,1,testAddress);
102 this->plugin->Read(&curVal,1,testAddress);
103 if((unsigned int)curVal!=(unsigned int)(1<<size))
104 return (1<<(size));
105 this->plugin->Read(&curVal,1,address);
106 if((curVal==(unsigned int)(1<<size)) && (size!=0))
107 return (1<<(size));
108 }
109 return (1<<(size+1));
110 }
88 }
111
89
112
90
@@ -533,6 +533,8 bool stardundeeSPW_USB_Manager::connectB
533
533
534 bool stardundeeSPW_USB_Manager::connectBridgeAsInterface()
534 bool stardundeeSPW_USB_Manager::connectBridgeAsInterface()
535 {
535 {
536 if(this->connected)
537 this->disconnectBridge();
536 this->handleMutex->lock();
538 this->handleMutex->lock();
537 int status;
539 int status;
538 U32 statusControl;
540 U32 statusControl;
@@ -622,7 +624,8 bool stardundeeSPW_USB_Manager::connectB
622
624
623 bool stardundeeSPW_USB_Manager::connectBridgeAsRouter()
625 bool stardundeeSPW_USB_Manager::connectBridgeAsRouter()
624 {
626 {
625 // QMutexLocker mlock(&this->handleMutex);
627 if(this->connected)
628 this->disconnectBridge();
626 this->handleMutex->lock();
629 this->handleMutex->lock();
627 int status;
630 int status;
628 U32 statusControl;
631 U32 statusControl;
@@ -904,6 +907,8 unsigned int stardundeeSPW_USB_Manager::
904
907
905 bool stardundeeSPW_USB_Manager::disconnectBridge()
908 bool stardundeeSPW_USB_Manager::disconnectBridge()
906 {
909 {
910 if (this->connected==true)
911 {
907 this->handleMutex->lock();
912 this->handleMutex->lock();
908 USBSpaceWire_UnregisterReceiveOnAllPorts(hDevice); // Stop receiving on all ports
913 USBSpaceWire_UnregisterReceiveOnAllPorts(hDevice); // Stop receiving on all ports
909 USBSpaceWire_Close(hDevice); // Close the device
914 USBSpaceWire_Close(hDevice); // Close the device
@@ -917,6 +922,7 bool stardundeeSPW_USB_Manager::disconne
917 this->RMAP_AnswersMtx->unlock();
922 this->RMAP_AnswersMtx->unlock();
918 this->RMAP_AnswersSem->acquire(this->RMAP_AnswersSem->available());
923 this->RMAP_AnswersSem->acquire(this->RMAP_AnswersSem->available());
919 this->connected=false;
924 this->connected=false;
925 }
920 return true;
926 return true;
921 }
927 }
922
928
General Comments 0
You need to be logged in to leave comments. Login now