@@ -65,10 +65,10 ahbdeviceInfo* ahbPluginUi::extractInfos | |||||
65 |
|
65 | |||
66 | void ahbPluginUi::scanAHB() |
|
66 | void ahbPluginUi::scanAHB() | |
67 | { |
|
67 | { | |
68 | unsigned int size = AHB_PLUGNPLAY_SLAVE_STOP- AHB_PLUGNPLAY_MASTER_START; |
|
68 | unsigned int size = (AHB_PLUGNPLAY_SLAVE_STOP - AHB_PLUGNPLAY_MASTER_START)/4; | |
69 | int j=0; |
|
69 | int j=0; | |
70 | unsigned long long i = AHB_PLUGNPLAY_MASTER_START; |
|
70 | unsigned long long i = AHB_PLUGNPLAY_MASTER_START; | |
71 | int pnpregs[AHB_PLUGNPLAY_SLAVE_STOP- AHB_PLUGNPLAY_MASTER_START]; |
|
71 | int pnpregs[size]; | |
72 | emit this->clearAHBdevicesList(); |
|
72 | emit this->clearAHBdevicesList(); | |
73 | if( this->_plugin->Read((unsigned int*)pnpregs,size,(unsigned int)AHB_PLUGNPLAY_MASTER_START)==size) |
|
73 | if( this->_plugin->Read((unsigned int*)pnpregs,size,(unsigned int)AHB_PLUGNPLAY_MASTER_START)==size) | |
74 | { |
|
74 | { |
@@ -30,7 +30,6 | |||||
30 | #define AHB_PLUGNPLAY_MASTER_START ((unsigned int)(0xFFFFF000)) |
|
30 | #define AHB_PLUGNPLAY_MASTER_START ((unsigned int)(0xFFFFF000)) | |
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 |
|
||||
34 | #define AHB_PLUGNPLAY_SLAVE_STOP ((unsigned int)(0xFFFFFFFC)) |
|
33 | #define AHB_PLUGNPLAY_SLAVE_STOP ((unsigned int)(0xFFFFFFFC)) | |
35 |
|
34 | |||
36 |
|
35 |
@@ -74,12 +74,12 apbdeviceInfo* apbPluginUi::extractInfos | |||||
74 | void apbPluginUi::scanAPB() |
|
74 | void apbPluginUi::scanAPB() | |
75 | { |
|
75 | { | |
76 | this->lockScanBp(); |
|
76 | this->lockScanBp(); | |
77 | unsigned int size = APB_PLUGNPLAY_STOP - APB_PLUGNPLAY_START; |
|
77 | unsigned int size = (APB_PLUGNPLAY_STOP - APB_PLUGNPLAY_START)/4; | |
78 | int j=0; |
|
78 | int j=0; | |
79 | unsigned long long i = APB_PLUGNPLAY_START; |
|
79 | unsigned long long i = APB_PLUGNPLAY_START; | |
80 | int pnpregs[APB_PLUGNPLAY_STOP - APB_PLUGNPLAY_START]; |
|
80 | int pnpregs[size]; | |
81 | emit this->clearAPBdevicesList(); |
|
81 | emit this->clearAPBdevicesList(); | |
82 |
if(this->_plugin->Read((unsigned int*)pnpregs,size |
|
82 | if(this->_plugin->Read((unsigned int*)pnpregs,size,(unsigned int)APB_PLUGNPLAY_START)==size) | |
83 | { |
|
83 | { | |
84 | while(i<APB_PLUGNPLAY_STOP) |
|
84 | while(i<APB_PLUGNPLAY_STOP) | |
85 | { |
|
85 | { |
@@ -30,8 +30,7 | |||||
30 |
|
30 | |||
31 | #define APB_BUS_START ((unsigned int)(0x80000000)) |
|
31 | #define APB_BUS_START ((unsigned int)(0x80000000)) | |
32 | #define APB_PLUGNPLAY_START ((unsigned int)(0x800FF000)) |
|
32 | #define APB_PLUGNPLAY_START ((unsigned int)(0x800FF000)) | |
33 |
|
33 | #define APB_PLUGNPLAY_STOP ((unsigned int)(0x800FFFFF)) | ||
34 | #define APB_PLUGNPLAY_STOP ((unsigned int)(0x800FF000+(512*8))) |
|
|||
35 |
|
34 | |||
36 |
|
35 | |||
37 | class apbPluginUi : public QWidget |
|
36 | class apbPluginUi : public QWidget |
@@ -105,12 +105,20 void GR_ESB_bridge::setVirtualLink(qint3 | |||||
105 |
|
105 | |||
106 | unsigned int GR_ESB_bridge::Write(unsigned int *Value, unsigned int count, unsigned int address) |
|
106 | unsigned int GR_ESB_bridge::Write(unsigned int *Value, unsigned int count, unsigned int address) | |
107 | { |
|
107 | { | |
108 |
|
108 | // TODO write ME! | ||
|
109 | Q_UNUSED(count) | |||
|
110 | Q_UNUSED(Value) | |||
|
111 | Q_UNUSED(address) | |||
|
112 | return 0; | |||
109 | } |
|
113 | } | |
110 |
|
114 | |||
111 | unsigned int GR_ESB_bridge::Read(unsigned int *Value, unsigned int count, unsigned int address) |
|
115 | unsigned int GR_ESB_bridge::Read(unsigned int *Value, unsigned int count, unsigned int address) | |
112 | { |
|
116 | { | |
113 |
|
117 | // TODO write ME! | ||
|
118 | Q_UNUSED(Value) | |||
|
119 | Q_UNUSED(count) | |||
|
120 | Q_UNUSED(address) | |||
|
121 | return 0; | |||
114 | } |
|
122 | } | |
115 |
|
123 | |||
116 | int GR_ESB_bridge::pushRMAPPacket(char *packet, int size) |
|
124 | int GR_ESB_bridge::pushRMAPPacket(char *packet, int size) | |
@@ -206,20 +214,29 bool GR_ESB_Manager::disconnectBridge() | |||||
206 |
|
214 | |||
207 | int GR_ESB_Manager::getRMAPtransactionID() |
|
215 | int GR_ESB_Manager::getRMAPtransactionID() | |
208 | { |
|
216 | { | |
209 |
|
217 | // TODO write ME! | ||
|
218 | return -1; | |||
210 | } |
|
219 | } | |
211 |
|
220 | |||
212 | int GR_ESB_Manager::getRMAPanswer(int transactionID, char **buffer) |
|
221 | int GR_ESB_Manager::getRMAPanswer(int transactionID, char **buffer) | |
213 | { |
|
222 | { | |
214 |
|
223 | // TODO write ME! | ||
|
224 | Q_UNUSED(transactionID) | |||
|
225 | Q_UNUSED(buffer) | |||
|
226 | return -1; | |||
215 | } |
|
227 | } | |
216 |
|
228 | |||
217 | bool GR_ESB_Manager::sendPacket(char *packet, int size) |
|
229 | bool GR_ESB_Manager::sendPacket(char *packet, int size) | |
218 | { |
|
230 | { | |
219 |
|
231 | // TODO write ME! | ||
|
232 | Q_UNUSED(packet) | |||
|
233 | Q_UNUSED(size) | |||
|
234 | return false; | |||
220 | } |
|
235 | } | |
221 |
|
236 | |||
222 | void GR_ESB_Manager::pushRmapPacket(char *packet, int len) |
|
237 | void GR_ESB_Manager::pushRmapPacket(char *packet, int len) | |
223 | { |
|
238 | { | |
224 |
|
239 | // TODO write ME! | ||
|
240 | Q_UNUSED(packet) | |||
|
241 | Q_UNUSED(len) | |||
225 | } |
|
242 | } |
@@ -155,7 +155,7 void SpwTcpPacketServer::parseIncomingTC | |||||
155 | void SpwTcpPacketServer::sendTCUsingSpaceWire(QByteArray data) |
|
155 | void SpwTcpPacketServer::sendTCUsingSpaceWire(QByteArray data) | |
156 | { |
|
156 | { | |
157 | onePacketReceived(); |
|
157 | onePacketReceived(); | |
158 | if(data[0]==0) // Protocole = 0 => Host to SpaceWire packet transmission |
|
158 | if(data[0]==(char)0) // Protocole = 0 => Host to SpaceWire packet transmission | |
159 | { |
|
159 | { | |
160 | int size = (data[1]*256*256) + (data[2]*256) + data[3]; |
|
160 | int size = (data[1]*256*256) + (data[2]*256) + data[3]; | |
161 | char* SPWpacket = (char*)malloc(size); |
|
161 | char* SPWpacket = (char*)malloc(size); | |
@@ -182,7 +182,7 void SpwTcpPacketServer::readReady() | |||||
182 | { |
|
182 | { | |
183 | QByteArray data = soc->readAll(); |
|
183 | QByteArray data = soc->readAll(); | |
184 | onePacketReceived(); |
|
184 | onePacketReceived(); | |
185 | if(data[0]==0) // Protocole = 0 => Host to SpaceWire packet transmission |
|
185 | if(data[0]==(char)0) // Protocole = 0 => Host to SpaceWire packet transmission | |
186 | { |
|
186 | { | |
187 | int size = (data[1]*256*256) + (data[2]*256) + data[3]; |
|
187 | int size = (data[1]*256*256) + (data[2]*256) + data[3]; | |
188 | char* SPWpacket = (char*)malloc(size); |
|
188 | char* SPWpacket = (char*)malloc(size); |
@@ -326,6 +326,7 void stardundeeSPW_USB::rmapTimeoutChang | |||||
326 |
|
326 | |||
327 | void stardundeeSPW_USB::makeGUI(socexplorerplugin *parent) |
|
327 | void stardundeeSPW_USB::makeGUI(socexplorerplugin *parent) | |
328 | { |
|
328 | { | |
|
329 | Q_UNUSED(parent) | |||
329 | this->p_GUI = new StarDundeeGUI(); |
|
330 | this->p_GUI = new StarDundeeGUI(); | |
330 | // this->mainLayout = new QGridLayout(this->p_GUI); |
|
331 | // this->mainLayout = new QGridLayout(this->p_GUI); | |
331 | connect(((StarDundeeGUI*)this->p_GUI),SIGNAL(connectClicked()),this,SLOT(toggleBridgeConnection())); |
|
332 | connect(((StarDundeeGUI*)this->p_GUI),SIGNAL(connectClicked()),this,SLOT(toggleBridgeConnection())); | |
@@ -402,12 +403,15 stardundeeSPW_USB_Manager::stardundeeSPW | |||||
402 | { |
|
403 | { | |
403 | this->RMAPtimeout = 2000; |
|
404 | this->RMAPtimeout = 2000; | |
404 | this->handleMutex = new QMutex(QMutex::NonRecursive); |
|
405 | this->handleMutex = new QMutex(QMutex::NonRecursive); | |
|
406 | // this->handleMutex = new QMutex(QMutex::Recursive); | |||
405 | this->RMAP_AnswersSem = new QSemaphore(0); |
|
407 | this->RMAP_AnswersSem = new QSemaphore(0); | |
406 | this->RMAP_AnswersMtx=new QMutex(QMutex::Recursive); |
|
408 | this->RMAP_AnswersMtx=new QMutex(QMutex::Recursive); | |
407 | this->RMAP_pending_transaction_IDsMtx=new QMutex(QMutex::Recursive); |
|
409 | this->RMAP_pending_transaction_IDsMtx=new QMutex(QMutex::Recursive); | |
408 | this->plugin = plugin; |
|
410 | this->plugin = plugin; | |
409 | connected = false; |
|
411 | connected = false; | |
410 | this->moveToThread(this); |
|
412 | // TODO remove this crap! | |
|
413 | this->initDialog(); | |||
|
414 | // this->moveToThread(this); | |||
411 | } |
|
415 | } | |
412 |
|
416 | |||
413 | stardundeeSPW_USB_Manager::~stardundeeSPW_USB_Manager() |
|
417 | stardundeeSPW_USB_Manager::~stardundeeSPW_USB_Manager() | |
@@ -429,7 +433,7 void stardundeeSPW_USB_Manager::run() | |||||
429 | { |
|
433 | { | |
430 | if(this->connected) |
|
434 | if(this->connected) | |
431 | { |
|
435 | { | |
432 | handleMutex->lock(); |
|
436 | this->handleMutex->lock(); | |
433 | SocExplorerEngine::message(this->plugin,"Looking for new RMAP packets",4); |
|
437 | SocExplorerEngine::message(this->plugin,"Looking for new RMAP packets",4); | |
434 | if(USBSpaceWire_WaitOnReadPacketAvailable(hDevice,0.01)) |
|
438 | if(USBSpaceWire_WaitOnReadPacketAvailable(hDevice,0.01)) | |
435 | { |
|
439 | { | |
@@ -453,7 +457,7 void stardundeeSPW_USB_Manager::run() | |||||
453 | memcpy(packetbuffer,buffer,properties.len); |
|
457 | memcpy(packetbuffer,buffer,properties.len); | |
454 | USBSpaceWire_FreeRead(hDevice, pIdentifier); |
|
458 | USBSpaceWire_FreeRead(hDevice, pIdentifier); | |
455 | pIdentifier = NULL; |
|
459 | pIdentifier = NULL; | |
456 | handleMutex->unlock(); |
|
460 | this->handleMutex->unlock(); | |
457 | if(properties.len==8) |
|
461 | if(properties.len==8) | |
458 | { |
|
462 | { | |
459 | packet=new RMAP_Answer(RMAP_get_transactionID(buffer),packetbuffer,properties.len); |
|
463 | packet=new RMAP_Answer(RMAP_get_transactionID(buffer),packetbuffer,properties.len); | |
@@ -473,13 +477,14 void stardundeeSPW_USB_Manager::run() | |||||
473 | memcpy(packetbuffer,buffer,properties.len); |
|
477 | memcpy(packetbuffer,buffer,properties.len); | |
474 | emit emitPacket(packetbuffer,properties.len); |
|
478 | emit emitPacket(packetbuffer,properties.len); | |
475 | USBSpaceWire_FreeRead(hDevice, pIdentifier); |
|
479 | USBSpaceWire_FreeRead(hDevice, pIdentifier); | |
476 | handleMutex->unlock(); |
|
480 | this->handleMutex->unlock(); | |
477 | SocExplorerEngine::message(this->plugin,"Got SPW packet",2); |
|
481 | SocExplorerEngine::message(this->plugin,"Got SPW packet",2); | |
478 | } |
|
482 | } | |
479 | } |
|
483 | } | |
480 | else |
|
484 | else | |
481 | { |
|
485 | { | |
482 | SocExplorerEngine::message(this->plugin,"No EOP received",2); |
|
486 | SocExplorerEngine::message(this->plugin,"No EOP received",2); | |
|
487 | this->handleMutex->unlock(); | |||
483 | } |
|
488 | } | |
484 | } |
|
489 | } | |
485 |
|
490 | |||
@@ -487,13 +492,13 void stardundeeSPW_USB_Manager::run() | |||||
487 | else |
|
492 | else | |
488 | { |
|
493 | { | |
489 | USBSpaceWire_FreeRead(hDevice, pIdentifier); |
|
494 | USBSpaceWire_FreeRead(hDevice, pIdentifier); | |
490 | handleMutex->unlock(); |
|
495 | this->handleMutex->unlock(); | |
491 | } |
|
496 | } | |
492 | } |
|
497 | } | |
493 | else |
|
498 | else | |
494 | { |
|
499 | { | |
495 | USBSpaceWire_FreeRead(hDevice, pIdentifier); |
|
500 | USBSpaceWire_FreeRead(hDevice, pIdentifier); | |
496 | handleMutex->unlock(); |
|
501 | this->handleMutex->unlock(); | |
497 | } |
|
502 | } | |
498 | } |
|
503 | } | |
499 | else |
|
504 | else | |
@@ -534,13 +539,15 bool stardundeeSPW_USB_Manager::connectB | |||||
534 |
|
539 | |||
535 | bool stardundeeSPW_USB_Manager::connectBridgeAsInterface() |
|
540 | bool stardundeeSPW_USB_Manager::connectBridgeAsInterface() | |
536 | { |
|
541 | { | |
537 | QMutexLocker mlock(this->handleMutex); |
|
542 | // QMutexLocker mlock(&this->handleMutex); | |
|
543 | this->handleMutex->lock(); | |||
538 | int status; |
|
544 | int status; | |
539 | U32 statusControl; |
|
545 | U32 statusControl; | |
540 | this->connected = false; |
|
546 | this->connected = false; | |
541 | if (!USBSpaceWire_Open(&hDevice, this->selectedBrick)) // Open the USB device |
|
547 | if (!USBSpaceWire_Open(&hDevice, this->selectedBrick)) // Open the USB device | |
542 | { |
|
548 | { | |
543 | SocExplorerEngine::message(this->plugin,"stardundee *** Open *** ERROR: USBSpaceWire_Open(&hDevice, 0))",0); |
|
549 | SocExplorerEngine::message(this->plugin,"stardundee *** Open *** ERROR: USBSpaceWire_Open(&hDevice, 0))",0); | |
|
550 | this->handleMutex->unlock(); | |||
544 | return false; |
|
551 | return false; | |
545 | } |
|
552 | } | |
546 | SocExplorerEngine::message(this->plugin,"stardundee *** Open *** USBSpaceWire_Open successful",0); |
|
553 | SocExplorerEngine::message(this->plugin,"stardundee *** Open *** USBSpaceWire_Open successful",0); | |
@@ -559,6 +566,7 bool stardundeeSPW_USB_Manager::connectB | |||||
559 | if (status != CFG_TRANSFER_SUCCESS) |
|
566 | if (status != CFG_TRANSFER_SUCCESS) | |
560 | { |
|
567 | { | |
561 | SocExplorerEngine::message(this->plugin,"ERROR CFGSpaceWire_SetBrickBaseTransmitRate",1); |
|
568 | SocExplorerEngine::message(this->plugin,"ERROR CFGSpaceWire_SetBrickBaseTransmitRate",1); | |
|
569 | this->handleMutex->unlock(); | |||
562 | return false; |
|
570 | return false; | |
563 | } |
|
571 | } | |
564 | else |
|
572 | else | |
@@ -570,6 +578,7 bool stardundeeSPW_USB_Manager::connectB | |||||
570 | if (CFGSpaceWire_GetLinkStatusControl(hDevice, this->linkNumber, &statusControl) != CFG_TRANSFER_SUCCESS) |
|
578 | if (CFGSpaceWire_GetLinkStatusControl(hDevice, this->linkNumber, &statusControl) != CFG_TRANSFER_SUCCESS) | |
571 | { |
|
579 | { | |
572 | SocExplorerEngine::message(this->plugin,"Could not read link status control for link " + QString::number(this->linkNumber),1); |
|
580 | SocExplorerEngine::message(this->plugin,"Could not read link status control for link " + QString::number(this->linkNumber),1); | |
|
581 | this->handleMutex->unlock(); | |||
573 | return false; |
|
582 | return false; | |
574 | } |
|
583 | } | |
575 | else |
|
584 | else | |
@@ -587,6 +596,7 bool stardundeeSPW_USB_Manager::connectB | |||||
587 | if (CFGSpaceWire_SetLinkStatusControl(hDevice, this->linkNumber, statusControl) != CFG_TRANSFER_SUCCESS) |
|
596 | if (CFGSpaceWire_SetLinkStatusControl(hDevice, this->linkNumber, statusControl) != CFG_TRANSFER_SUCCESS) | |
588 | { |
|
597 | { | |
589 | SocExplorerEngine::message(this->plugin,"Could not set the link status control for link " + QString::number(this->linkNumber),1); |
|
598 | SocExplorerEngine::message(this->plugin,"Could not set the link status control for link " + QString::number(this->linkNumber),1); | |
|
599 | this->handleMutex->unlock(); | |||
590 | return false; |
|
600 | return false; | |
591 | } |
|
601 | } | |
592 | else |
|
602 | else | |
@@ -598,6 +608,7 bool stardundeeSPW_USB_Manager::connectB | |||||
598 | if (CFGSpaceWire_SetAsInterface(hDevice, 1, 0) != CFG_TRANSFER_SUCCESS) |
|
608 | if (CFGSpaceWire_SetAsInterface(hDevice, 1, 0) != CFG_TRANSFER_SUCCESS) | |
599 | { |
|
609 | { | |
600 | SocExplorerEngine::message(this->plugin,"Could not set the device to be an interface",1); |
|
610 | SocExplorerEngine::message(this->plugin,"Could not set the device to be an interface",1); | |
|
611 | this->handleMutex->unlock(); | |||
601 | return false; |
|
612 | return false; | |
602 | } |
|
613 | } | |
603 | else |
|
614 | else | |
@@ -608,6 +619,7 bool stardundeeSPW_USB_Manager::connectB | |||||
608 | USBSpaceWire_RegisterReceiveOnAllPorts(hDevice); // Register to receive on all ports |
|
619 | USBSpaceWire_RegisterReceiveOnAllPorts(hDevice); // Register to receive on all ports | |
609 | USBSpaceWire_ClearEndpoints(hDevice); // clear the USB endpoints |
|
620 | USBSpaceWire_ClearEndpoints(hDevice); // clear the USB endpoints | |
610 | USBSpaceWire_SetTimeout(hDevice,1.0); |
|
621 | USBSpaceWire_SetTimeout(hDevice,1.0); | |
|
622 | this->handleMutex->unlock(); | |||
611 | SocExplorerEngine::message(this->plugin,"The driver's current send buffer size is " + QString::number(USBSpaceWire_GetDriverSendBufferSize(hDevice)) + " bytes",1); |
|
623 | SocExplorerEngine::message(this->plugin,"The driver's current send buffer size is " + QString::number(USBSpaceWire_GetDriverSendBufferSize(hDevice)) + " bytes",1); | |
612 | SocExplorerEngine::message(this->plugin,"The driver's current read buffer size is " + QString::number(USBSpaceWire_GetDriverReadBufferSize(hDevice)) + " bytes",1); |
|
624 | SocExplorerEngine::message(this->plugin,"The driver's current read buffer size is " + QString::number(USBSpaceWire_GetDriverReadBufferSize(hDevice)) + " bytes",1); | |
613 | SocExplorerEngine::message(this->plugin,"USBSpaceWire_IsReadThrottling is " + QString::number(USBSpaceWire_IsReadThrottling(hDevice)),1); |
|
625 | SocExplorerEngine::message(this->plugin,"USBSpaceWire_IsReadThrottling is " + QString::number(USBSpaceWire_IsReadThrottling(hDevice)),1); | |
@@ -617,7 +629,8 bool stardundeeSPW_USB_Manager::connectB | |||||
617 |
|
629 | |||
618 | bool stardundeeSPW_USB_Manager::connectBridgeAsRouter() |
|
630 | bool stardundeeSPW_USB_Manager::connectBridgeAsRouter() | |
619 | { |
|
631 | { | |
620 | QMutexLocker mlock(this->handleMutex); |
|
632 | // QMutexLocker mlock(&this->handleMutex); | |
|
633 | this->handleMutex->lock(); | |||
621 | int status; |
|
634 | int status; | |
622 | U32 statusControl; |
|
635 | U32 statusControl; | |
623 | unsigned int linkStatus1; |
|
636 | unsigned int linkStatus1; | |
@@ -628,6 +641,7 bool stardundeeSPW_USB_Manager::connectB | |||||
628 | if (!USBSpaceWire_Open(&hDevice, this->selectedBrick)) // Open the USB device |
|
641 | if (!USBSpaceWire_Open(&hDevice, this->selectedBrick)) // Open the USB device | |
629 | { |
|
642 | { | |
630 | SocExplorerEngine::message(this->plugin,"stardundee *** Open *** ERROR: USBSpaceWire_Open(&hDevice, 0))"); |
|
643 | SocExplorerEngine::message(this->plugin,"stardundee *** Open *** ERROR: USBSpaceWire_Open(&hDevice, 0))"); | |
|
644 | this->handleMutex->unlock(); | |||
631 | return false; |
|
645 | return false; | |
632 | } |
|
646 | } | |
633 | SocExplorerEngine::message(this->plugin,"stardundee *** Open *** USBSpaceWire_Open successful, device number: " |
|
647 | SocExplorerEngine::message(this->plugin,"stardundee *** Open *** USBSpaceWire_Open successful, device number: " | |
@@ -721,6 +735,7 bool stardundeeSPW_USB_Manager::connectB | |||||
721 | // test Link 1 and Link 2 |
|
735 | // test Link 1 and Link 2 | |
722 | linkStatus1 = getLinkStatus(0x01); |
|
736 | linkStatus1 = getLinkStatus(0x01); | |
723 | linkStatus2 = getLinkStatus(0x02); |
|
737 | linkStatus2 = getLinkStatus(0x02); | |
|
738 | this->handleMutex->unlock(); | |||
724 |
|
739 | |||
725 | if ((linkStatus1==1) || (linkStatus2==1)) |
|
740 | if ((linkStatus1==1) || (linkStatus2==1)) | |
726 | { |
|
741 | { | |
@@ -992,30 +1007,29 int stardundeeSPW_USB_Manager::getRMAPan | |||||
992 | bool stardundeeSPW_USB_Manager::sendPacket(char *packet, int size) |
|
1007 | bool stardundeeSPW_USB_Manager::sendPacket(char *packet, int size) | |
993 | { |
|
1008 | { | |
994 | char protocoleIdentifier; |
|
1009 | char protocoleIdentifier; | |
995 | USB_SPACEWIRE_STATUS result; |
|
1010 | USB_SPACEWIRE_STATUS result=TRANSFER_ERROR_NOT_FOUND; | |
996 | USB_SPACEWIRE_ID pIdentifier; |
|
1011 | USB_SPACEWIRE_ID pIdentifier; | |
997 | SocExplorerEngine::message(this->plugin,"Sending SPW packet",2); |
|
1012 | SocExplorerEngine::message(this->plugin,"Sending SPW packet",2); | |
998 | this->handleMutex->lock(); |
|
1013 | this->handleMutex->lock(); | |
999 | result = USBSpaceWire_SendPacket(hDevice,packet,size,1, &pIdentifier); |
|
1014 | result = USBSpaceWire_SendPacket(hDevice,packet,size,1, &pIdentifier); | |
|
1015 | USBSpaceWire_FreeSend(hDevice, pIdentifier); | |||
|
1016 | this->handleMutex->unlock(); | |||
1000 | if (result != TRANSFER_SUCCESS) |
|
1017 | if (result != TRANSFER_SUCCESS) | |
1001 | { |
|
1018 | { | |
1002 | SocExplorerEngine::message(this->plugin,"ERR sending the READ command ",2); |
|
1019 | SocExplorerEngine::message(this->plugin,"ERR sending the READ command ",2); | |
1003 | this->handleMutex->unlock(); |
|
|||
1004 | return false; |
|
1020 | return false; | |
1005 | } |
|
1021 | } | |
1006 | else |
|
1022 | else | |
1007 | { |
|
1023 | { | |
1008 | emit bytesTransmittedToSpw( size-1 ); // -1 is for removing the first bytes added to the packet to route to the right link |
|
1024 | emit bytesTransmittedToSpw( size-1 ); // -1 is for removing the first bytes added to the packet to route to the right link | |
1009 |
|
||||
1010 | // read the protocole identifier |
|
1025 | // read the protocole identifier | |
1011 | protocoleIdentifier = packet[2]; |
|
1026 | protocoleIdentifier = packet[2]; | |
1012 | if (protocoleIdentifier == SPW_PROTO_ID_CCSDS) |
|
1027 | if (protocoleIdentifier == SPW_PROTO_ID_CCSDS) | |
1013 | emit ccsdsPacketTransmittedToSpw(); |
|
1028 | emit ccsdsPacketTransmittedToSpw(); | |
1014 |
|
1029 | |||
1015 | SocExplorerEngine::message(this->plugin,"Packet sent",2); |
|
1030 | SocExplorerEngine::message(this->plugin,"Packet sent",2); | |
1016 | USBSpaceWire_FreeSend(hDevice, pIdentifier); |
|
|||
1017 | } |
|
1031 | } | |
1018 | this->handleMutex->unlock(); |
|
1032 | // this->handleMutex->unlock(); | |
1019 | return true; |
|
1033 | return true; | |
1020 | } |
|
1034 | } | |
1021 |
|
1035 | |||
@@ -1050,10 +1064,10 int stardundeeSPW_USB_Manager::getLinkNu | |||||
1050 |
|
1064 | |||
1051 | void stardundeeSPW_USB_Manager::setTimecodeFrequency(double requestedFrequency) |
|
1065 | void stardundeeSPW_USB_Manager::setTimecodeFrequency(double requestedFrequency) | |
1052 | { |
|
1066 | { | |
1053 | U32 rtr_clk_freq; |
|
1067 | U32 rtr_clk_freq=0; | |
1054 | U32 freqCount; |
|
1068 | U32 freqCount=0; | |
1055 | double freqCountInDouble; |
|
1069 | double freqCountInDouble=0.0; | |
1056 | double currentFrequency; |
|
1070 | double currentFrequency=0.0; | |
1057 |
|
1071 | |||
1058 | rtr_clk_freq = USBSpaceWire_TC_GetClockFrequency(hDevice); |
|
1072 | rtr_clk_freq = USBSpaceWire_TC_GetClockFrequency(hDevice); | |
1059 | freqCountInDouble = ((double) rtr_clk_freq) / requestedFrequency; |
|
1073 | freqCountInDouble = ((double) rtr_clk_freq) / requestedFrequency; |
@@ -73,7 +73,7 public slots: | |||||
73 | int getLinkNumber( void ); |
|
73 | int getLinkNumber( void ); | |
74 |
|
74 | |||
75 | private: |
|
75 | private: | |
76 |
QMutex* |
|
76 | QMutex *handleMutex,*RMAP_AnswersMtx,*RMAP_pending_transaction_IDsMtx; | |
77 | QSemaphore* RMAP_AnswersSem; |
|
77 | QSemaphore* RMAP_AnswersSem; | |
78 | void pushRmapPacket(char* packet,int len); |
|
78 | void pushRmapPacket(char* packet,int len); | |
79 | star_device_handle hDevice; |
|
79 | star_device_handle hDevice; |
@@ -30,7 +30,7 abstractSpwBridge::abstractSpwBridge(soc | |||||
30 |
|
30 | |||
31 | abstractSpwBridge::~abstractSpwBridge() |
|
31 | abstractSpwBridge::~abstractSpwBridge() | |
32 | { |
|
32 | { | |
33 | delete this->p_GUI; |
|
33 | // delete this->p_GUI; | |
34 | } |
|
34 | } | |
35 |
|
35 | |||
36 | QWidget *abstractSpwBridge::getGUI() |
|
36 | QWidget *abstractSpwBridge::getGUI() |
@@ -9,12 +9,7 greaterThan(QT_MAJOR_VERSION, 4): QT += | |||||
9 |
|
9 | |||
10 | win32:CONFIG += dll |
|
10 | win32:CONFIG += dll | |
11 | win32:CONFIG -= static |
|
11 | win32:CONFIG -= static | |
12 | CONFIG(debug, debug|release) { |
|
12 | TARGET = spwplugin | |
13 | DEBUG_EXT = _d |
|
|||
14 | } else { |
|
|||
15 | DEBUG_EXT = |
|
|||
16 | } |
|
|||
17 | TARGET = spwplugin$${DEBUG_EXT} |
|
|||
18 | DEFINES += PLUGIN=spwplugin |
|
13 | DEFINES += PLUGIN=spwplugin | |
19 | DEFINES += PLUGINHEADER="\"\\\"spwplugin.h"\\\"\" |
|
14 | DEFINES += PLUGINHEADER="\"\\\"spwplugin.h"\\\"\" | |
20 | DEFINES += driver_Name="\"\\\"SpwPlugin"\\\"\" |
|
15 | DEFINES += driver_Name="\"\\\"SpwPlugin"\\\"\" |
General Comments 0
You need to be logged in to leave comments.
Login now