@@ -0,0 +1,70 | |||||
|
1 | /*------------------------------------------------------------------------------ | |||
|
2 | -- This file is a part of the SocExplorer Software | |||
|
3 | -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS | |||
|
4 | -- | |||
|
5 | -- This program is free software; you can redistribute it and/or modify | |||
|
6 | -- it under the terms of the GNU General Public License as published by | |||
|
7 | -- the Free Software Foundation; either version 2 of the License, or | |||
|
8 | -- (at your option) any later version. | |||
|
9 | -- | |||
|
10 | -- This program is distributed in the hope that it will be useful, | |||
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
|
13 | -- GNU General Public License for more details. | |||
|
14 | -- | |||
|
15 | -- You should have received a copy of the GNU General Public License | |||
|
16 | -- along with this program; if not, write to the Free Software | |||
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |||
|
18 | -------------------------------------------------------------------------------*/ | |||
|
19 | /*-- Author : Alexis Jeandet | |||
|
20 | -- Mail : alexis.jeandet@member.fsf.org | |||
|
21 | ----------------------------------------------------------------------------*/ | |||
|
22 | #include "uartpollingthread.h" | |||
|
23 | #include <RS232.h> | |||
|
24 | #include <socexplorerengine.h> | |||
|
25 | ||||
|
26 | UARTPollingThread::UARTPollingThread(socexplorerplugin *parent) : | |||
|
27 | QThread((QObject*)parent) | |||
|
28 | { | |||
|
29 | this->plugin = parent; | |||
|
30 | rs232open("/dev/ttyUS0"); | |||
|
31 | } | |||
|
32 | ||||
|
33 | void UARTPollingThread::run() | |||
|
34 | { | |||
|
35 | while (!this->isInterruptionRequested()) | |||
|
36 | { | |||
|
37 | if(fifoDebugEnabled) | |||
|
38 | { | |||
|
39 | if(this->plugin->baseAddress()!=-1) | |||
|
40 | { | |||
|
41 | unsigned int status_reg,data; | |||
|
42 | char ch; | |||
|
43 | QString printdata=""; | |||
|
44 | plugin->parent->Read(&status_reg,1,this->plugin->baseAddress()+APB_UART_STATUS_REG); | |||
|
45 | while ((status_reg&4)==0) { | |||
|
46 | plugin->parent->Read(&data,1,this->plugin->baseAddress()+APB_UART_FIFO_DEBUG_REG); | |||
|
47 | ch = (char)(0xff & data); | |||
|
48 | printdata+=ch; | |||
|
49 | plugin->parent->Read(&status_reg,1,this->plugin->baseAddress()+APB_UART_STATUS_REG); | |||
|
50 | } | |||
|
51 | if(printdata!="") | |||
|
52 | emit apbUartTextReceived(printdata); | |||
|
53 | } | |||
|
54 | else | |||
|
55 | { | |||
|
56 | this->plugin->setBaseAddress(SocExplorerEngine::self()->getEnumDeviceBaseAddress(this->plugin,this->plugin->VID(),this->plugin->PID(),0)); | |||
|
57 | } | |||
|
58 | } | |||
|
59 | if(uartOpened) | |||
|
60 | { | |||
|
61 | ||||
|
62 | } | |||
|
63 | msleep(100); | |||
|
64 | } | |||
|
65 | } | |||
|
66 | ||||
|
67 | void UARTPollingThread::sendChar(char c) | |||
|
68 | { | |||
|
69 | ||||
|
70 | } |
@@ -0,0 +1,53 | |||||
|
1 | /*------------------------------------------------------------------------------ | |||
|
2 | -- This file is a part of the SocExplorer Software | |||
|
3 | -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS | |||
|
4 | -- | |||
|
5 | -- This program is free software; you can redistribute it and/or modify | |||
|
6 | -- it under the terms of the GNU General Public License as published by | |||
|
7 | -- the Free Software Foundation; either version 2 of the License, or | |||
|
8 | -- (at your option) any later version. | |||
|
9 | -- | |||
|
10 | -- This program is distributed in the hope that it will be useful, | |||
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
|
13 | -- GNU General Public License for more details. | |||
|
14 | -- | |||
|
15 | -- You should have received a copy of the GNU General Public License | |||
|
16 | -- along with this program; if not, write to the Free Software | |||
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |||
|
18 | -------------------------------------------------------------------------------*/ | |||
|
19 | /*-- Author : Alexis Jeandet | |||
|
20 | -- Mail : alexis.jeandet@member.fsf.org | |||
|
21 | ----------------------------------------------------------------------------*/ | |||
|
22 | #ifndef UARTPOLLINGTHREAD_H | |||
|
23 | #define UARTPOLLINGTHREAD_H | |||
|
24 | ||||
|
25 | #include <QObject> | |||
|
26 | #include <QThread> | |||
|
27 | #include <socexplorerplugin.h> | |||
|
28 | ||||
|
29 | #define APB_UART_DATA_REG 0x0 | |||
|
30 | #define APB_UART_STATUS_REG 0x4 | |||
|
31 | #define APB_UART_CONTROL_REG 0x8 | |||
|
32 | #define APB_UART_SCALE_REG 0xC | |||
|
33 | #define APB_UART_FIFO_DEBUG_REG 0x10 | |||
|
34 | ||||
|
35 | class UARTPollingThread : public QThread | |||
|
36 | { | |||
|
37 | Q_OBJECT | |||
|
38 | public: | |||
|
39 | explicit UARTPollingThread(socexplorerplugin *parent = 0); | |||
|
40 | void run(); | |||
|
41 | signals: | |||
|
42 | void apbUartTextReceived(QString text); | |||
|
43 | public slots: | |||
|
44 | void sendChar(char c); | |||
|
45 | private: | |||
|
46 | bool fifoDebugEnabled; | |||
|
47 | QString portName; | |||
|
48 | int uartSpeed; | |||
|
49 | bool uartOpened; | |||
|
50 | socexplorerplugin* plugin; | |||
|
51 | }; | |||
|
52 | ||||
|
53 | #endif // UARTPOLLINGTHREAD_H |
@@ -27,17 +27,15 | |||||
27 | #include <QLayout> |
|
27 | #include <QLayout> | |
28 |
|
28 | |||
29 | #include <socexplorerplugin.h> |
|
29 | #include <socexplorerplugin.h> | |
30 | #include <apbuartpluginui.h> |
|
|||
31 | #include <QTimer> |
|
30 | #include <QTimer> | |
32 | #include "apbuart_plugin_ui.h" |
|
31 | #include "apbuart_plugin_ui.h" | |
33 |
|
32 | #include "uartpollingthread.h" | ||
34 | #define APB_UART_DATA_REG 0x0 |
|
33 | #define APB_UART_DATA_REG 0x0 | |
35 | #define APB_UART_STATUS_REG 0x4 |
|
34 | #define APB_UART_STATUS_REG 0x4 | |
36 | #define APB_UART_CONTROL_REG 0x8 |
|
35 | #define APB_UART_CONTROL_REG 0x8 | |
37 | #define APB_UART_SCALE_REG 0xC |
|
36 | #define APB_UART_SCALE_REG 0xC | |
38 | #define APB_UART_FIFO_DEBUG_REG 0x10 |
|
37 | #define APB_UART_FIFO_DEBUG_REG 0x10 | |
39 |
|
38 | |||
40 |
|
||||
41 | class ApbUartPlugin : public socexplorerplugin |
|
39 | class ApbUartPlugin : public socexplorerplugin | |
42 | { |
|
40 | { | |
43 | Q_OBJECT |
|
41 | Q_OBJECT |
@@ -33,18 +33,16 INCLUDEPATH += \ | |||||
33 |
|
33 | |||
34 | HEADERS += \ |
|
34 | HEADERS += \ | |
35 | APBUARTPLUGIN.h \ |
|
35 | APBUARTPLUGIN.h \ | |
36 | apbuartpluginui.h \ |
|
|||
37 | apbuartcfg.h \ |
|
|||
38 | apbuartterminal.h \ |
|
36 | apbuartterminal.h \ | |
39 | apbuart_plugin_ui.h |
|
37 | apbuart_plugin_ui.h \ | |
|
38 | uartpollingthread.h | |||
40 |
|
39 | |||
41 |
|
40 | |||
42 | SOURCES += \ |
|
41 | SOURCES += \ | |
43 | APBUARTPLUGIN.cpp \ |
|
42 | APBUARTPLUGIN.cpp \ | |
44 | apbuartpluginui.cpp \ |
|
|||
45 | apbuartcfg.cpp \ |
|
|||
46 | apbuartterminal.cpp \ |
|
43 | apbuartterminal.cpp \ | |
47 | apbuart_plugin_ui.cpp |
|
44 | apbuart_plugin_ui.cpp \ | |
|
45 | uartpollingthread.cpp | |||
48 |
|
46 | |||
49 | FORMS += \ |
|
47 | FORMS += \ | |
50 | apbuart_plugin_ui.ui |
|
48 | apbuart_plugin_ui.ui |
@@ -31,13 +31,8 | |||||
31 | #include <QTime> |
|
31 | #include <QTime> | |
32 | #include <socexplorerplugin.h> |
|
32 | #include <socexplorerplugin.h> | |
33 | #include "ahbuartpluginui.h" |
|
33 | #include "ahbuartpluginui.h" | |
|
34 | #include <RS232.h> | |||
34 |
|
35 | |||
35 | #ifdef WinRs232 |
|
|||
36 | #include "librs232/RS232.h" |
|
|||
37 | #else |
|
|||
38 | #include <RS232.h> |
|
|||
39 | #undef debug |
|
|||
40 | #endif |
|
|||
41 |
|
36 | |||
42 |
|
37 | |||
43 |
|
38 |
@@ -26,9 +26,6 DEFINES += driver_PID=0 | |||||
26 |
|
26 | |||
27 |
|
27 | |||
28 |
|
28 | |||
29 | win32:LIBS += $${PWD}/librs232/bin/librs232-2.1.a |
|
|||
30 | unix:LIBS += -lrs232-2.1 |
|
|||
31 |
|
||||
32 |
|
29 | |||
33 | INCLUDEPATH += \ |
|
30 | INCLUDEPATH += \ | |
34 | $${PWD} |
|
31 | $${PWD} | |
@@ -42,18 +39,11 HEADERS += \ | |||||
42 |
|
39 | |||
43 |
|
40 | |||
44 |
|
41 | |||
45 | win32:HEADERS+=librs232/RS232.h |
|
|||
46 | win32:INCLUDEPATH+=librs232 |
|
|||
47 |
|
||||
48 | SOURCES += \ |
|
42 | SOURCES += \ | |
49 | ahbuartplugin.cpp \ |
|
43 | ahbuartplugin.cpp \ | |
50 | ahbuartpluginui.cpp \ |
|
44 | ahbuartpluginui.cpp \ | |
51 | ahbuartpywrapper.cpp |
|
45 | ahbuartpywrapper.cpp | |
52 |
|
46 | |||
53 |
|
||||
54 | OTHER_FILES += \ |
|
|||
55 | librs232/bin/librs232-1.0-1.dll |
|
|||
56 |
|
||||
57 | FORMS += \ |
|
47 | FORMS += \ | |
58 | ahbuartpluginui.ui |
|
48 | ahbuartpluginui.ui | |
59 |
|
49 |
@@ -1,3 +1,24 | |||||
|
1 | /*------------------------------------------------------------------------------ | |||
|
2 | -- This file is a part of the SocExplorer Software | |||
|
3 | -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS | |||
|
4 | -- | |||
|
5 | -- This program is free software; you can redistribute it and/or modify | |||
|
6 | -- it under the terms of the GNU General Public License as published by | |||
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |||
|
8 | -- (at your option) any later version. | |||
|
9 | -- | |||
|
10 | -- This program is distributed in the hope that it will be useful, | |||
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
|
13 | -- GNU General Public License for more details. | |||
|
14 | -- | |||
|
15 | -- You should have received a copy of the GNU General Public License | |||
|
16 | -- along with this program; if not, write to the Free Software | |||
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |||
|
18 | -------------------------------------------------------------------------------*/ | |||
|
19 | /*-- Author : Alexis Jeandet | |||
|
20 | -- Mail : alexis.jeandet@member.fsf.org | |||
|
21 | ----------------------------------------------------------------------------*/ | |||
1 | #include "gr_esb_bridge.h" |
|
22 | #include "gr_esb_bridge.h" | |
2 | #include "gr_esb_ui.h" |
|
23 | #include "gr_esb_ui.h" | |
3 | #include <unistd.h> |
|
24 | #include <unistd.h> |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now