@@ -0,0 +1,44 | |||||
|
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 "apbuart_plugin_ui.h" | |||
|
23 | #include "ui_apbuart_plugin_ui.h" | |||
|
24 | ||||
|
25 | APBUART_Plugin_ui::APBUART_Plugin_ui(QWidget *parent) : | |||
|
26 | QWidget(parent), | |||
|
27 | ui(new Ui::APBUART_Plugin_ui) | |||
|
28 | { | |||
|
29 | ui->setupUi(this); | |||
|
30 | connect(this->ui->FIFODebugChkBx,SIGNAL(stateChanged(int)),this,SIGNAL(loopbackChkBxStateChanged(int))); | |||
|
31 | connect(this,SIGNAL(apbUartTextReceived(QString)),this->ui->UART_TERM,SLOT(append(QString))); | |||
|
32 | } | |||
|
33 | ||||
|
34 | APBUART_Plugin_ui::~APBUART_Plugin_ui() | |||
|
35 | { | |||
|
36 | delete ui; | |||
|
37 | } | |||
|
38 | ||||
|
39 | void APBUART_Plugin_ui::setEnableForLoopBack(bool enable) | |||
|
40 | { | |||
|
41 | this->ui->PortNameLineEdit->setEnabled(enable); | |||
|
42 | this->ui->ConnectQpb->setEnabled(enable); | |||
|
43 | this->ui->UartSpeedLineEdit->setEnabled(enable); | |||
|
44 | } |
@@ -0,0 +1,49 | |||||
|
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 APBUART_PLUGIN_UI_H | |||
|
23 | #define APBUART_PLUGIN_UI_H | |||
|
24 | ||||
|
25 | #include <QWidget> | |||
|
26 | ||||
|
27 | namespace Ui { | |||
|
28 | class APBUART_Plugin_ui; | |||
|
29 | } | |||
|
30 | ||||
|
31 | class APBUART_Plugin_ui : public QWidget | |||
|
32 | { | |||
|
33 | Q_OBJECT | |||
|
34 | ||||
|
35 | public: | |||
|
36 | explicit APBUART_Plugin_ui(QWidget *parent = 0); | |||
|
37 | ~APBUART_Plugin_ui(); | |||
|
38 | ||||
|
39 | public slots: | |||
|
40 | void setEnableForLoopBack(bool enable); | |||
|
41 | signals: | |||
|
42 | void loopbackChkBxStateChanged( int state ); | |||
|
43 | void apbUartTextReceived(QString text); | |||
|
44 | ||||
|
45 | private: | |||
|
46 | Ui::APBUART_Plugin_ui *ui; | |||
|
47 | }; | |||
|
48 | ||||
|
49 | #endif // APBUART_PLUGIN_UI_H |
@@ -0,0 +1,82 | |||||
|
1 | <?xml version="1.0" encoding="UTF-8"?> | |||
|
2 | <ui version="4.0"> | |||
|
3 | <class>APBUART_Plugin_ui</class> | |||
|
4 | <widget class="QWidget" name="APBUART_Plugin_ui"> | |||
|
5 | <property name="geometry"> | |||
|
6 | <rect> | |||
|
7 | <x>0</x> | |||
|
8 | <y>0</y> | |||
|
9 | <width>400</width> | |||
|
10 | <height>300</height> | |||
|
11 | </rect> | |||
|
12 | </property> | |||
|
13 | <property name="windowTitle"> | |||
|
14 | <string>Form</string> | |||
|
15 | </property> | |||
|
16 | <layout class="QVBoxLayout" name="verticalLayout"> | |||
|
17 | <item> | |||
|
18 | <widget class="QTabWidget" name="TabWidget"> | |||
|
19 | <property name="currentIndex"> | |||
|
20 | <number>0</number> | |||
|
21 | </property> | |||
|
22 | <widget class="QWidget" name="Config"> | |||
|
23 | <attribute name="title"> | |||
|
24 | <string>Configuration</string> | |||
|
25 | </attribute> | |||
|
26 | <layout class="QGridLayout" name="gridLayout"> | |||
|
27 | <item row="1" column="1"> | |||
|
28 | <widget class="QLineEdit" name="PortNameLineEdit"/> | |||
|
29 | </item> | |||
|
30 | <item row="0" column="0" colspan="2"> | |||
|
31 | <widget class="QCheckBox" name="FIFODebugChkBx"> | |||
|
32 | <property name="text"> | |||
|
33 | <string>Enable FIFO debug mode</string> | |||
|
34 | </property> | |||
|
35 | <property name="checked"> | |||
|
36 | <bool>true</bool> | |||
|
37 | </property> | |||
|
38 | </widget> | |||
|
39 | </item> | |||
|
40 | <item row="1" column="0"> | |||
|
41 | <widget class="QLabel" name="PortNameLbl"> | |||
|
42 | <property name="text"> | |||
|
43 | <string>Port Name</string> | |||
|
44 | </property> | |||
|
45 | </widget> | |||
|
46 | </item> | |||
|
47 | <item row="3" column="0"> | |||
|
48 | <widget class="QLabel" name="UartSpeedLbl"> | |||
|
49 | <property name="text"> | |||
|
50 | <string>Uart Speed</string> | |||
|
51 | </property> | |||
|
52 | </widget> | |||
|
53 | </item> | |||
|
54 | <item row="4" column="1"> | |||
|
55 | <widget class="QPushButton" name="ConnectQpb"> | |||
|
56 | <property name="text"> | |||
|
57 | <string>Open Port</string> | |||
|
58 | </property> | |||
|
59 | </widget> | |||
|
60 | </item> | |||
|
61 | <item row="3" column="1"> | |||
|
62 | <widget class="QLineEdit" name="UartSpeedLineEdit"/> | |||
|
63 | </item> | |||
|
64 | </layout> | |||
|
65 | </widget> | |||
|
66 | <widget class="QWidget" name="Terminal"> | |||
|
67 | <attribute name="title"> | |||
|
68 | <string>Terminal</string> | |||
|
69 | </attribute> | |||
|
70 | <layout class="QVBoxLayout" name="verticalLayout_2"> | |||
|
71 | <item> | |||
|
72 | <widget class="QTextEdit" name="UART_TERM"/> | |||
|
73 | </item> | |||
|
74 | </layout> | |||
|
75 | </widget> | |||
|
76 | </widget> | |||
|
77 | </item> | |||
|
78 | </layout> | |||
|
79 | </widget> | |||
|
80 | <resources/> | |||
|
81 | <connections/> | |||
|
82 | </ui> |
@@ -1,198 +1,199 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SocExplorer Software |
|
2 | -- This file is a part of the SocExplorer Software | |
3 | -- Copyright (C) 2013, Plasma Physics Laboratory - CNRS |
|
3 | -- Copyright (C) 2013, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
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 |
|
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 |
|
7 | -- the Free Software Foundation; either version 2 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
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 |
|
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 |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@member.fsf.org |
|
20 | -- Mail : alexis.jeandet@member.fsf.org | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #include "APBUARTPLUGIN.h" |
|
22 | #include "APBUARTPLUGIN.h" | |
23 | #include <socexplorerengine.h> |
|
23 | #include <socexplorerengine.h> | |
24 |
|
24 | |||
25 |
|
||||
26 | ApbUartPlugin::ApbUartPlugin(QWidget *parent):socexplorerplugin(parent) |
|
25 | ApbUartPlugin::ApbUartPlugin(QWidget *parent):socexplorerplugin(parent) | |
27 | { |
|
26 | { | |
28 |
this->UI = new A |
|
27 | this->UI = new APBUART_Plugin_ui(); | |
29 | this->setWidget((QWidget*)this->UI); |
|
28 | this->setWidget((QWidget*)this->UI); | |
30 | this->useLoopBack = false; |
|
29 | this->useLoopBack = false; | |
31 | connect(this->UI,SIGNAL(loopbackChkBxStateChanged(int)),this,SLOT(loopbackChangeState(int))); |
|
30 | connect(this->UI,SIGNAL(loopbackChkBxStateChanged(int)),this,SLOT(loopbackChangeState(int))); | |
32 | connect(this,SIGNAL(apbUartTextReceived(QString)),this->UI,SIGNAL(apbUartTextReceived(QString))); |
|
31 | connect(this,SIGNAL(apbUartTextReceived(QString)),this->UI,SIGNAL(apbUartTextReceived(QString))); | |
33 | connect(&this->loopBackTimer,SIGNAL(timeout()),this,SLOT(uartReadout())); |
|
32 | connect(&this->loopBackTimer,SIGNAL(timeout()),this,SLOT(uartReadout())); | |
34 | } |
|
33 | } | |
35 |
|
34 | |||
36 |
|
35 | |||
37 | ApbUartPlugin::~ApbUartPlugin() |
|
36 | ApbUartPlugin::~ApbUartPlugin() | |
38 | { |
|
37 | { | |
39 |
|
38 | |||
40 | } |
|
39 | } | |
41 |
|
40 | |||
42 | void ApbUartPlugin::closeMe() |
|
41 | void ApbUartPlugin::closeMe() | |
43 | { |
|
42 | { | |
44 | emit this->closePlugin(this); |
|
43 | emit this->closePlugin(this); | |
45 | } |
|
44 | } | |
46 |
|
45 | |||
47 | void ApbUartPlugin::postInstantiationTrigger() |
|
46 | void ApbUartPlugin::postInstantiationTrigger() | |
48 | { |
|
47 | { | |
49 | if(this->isEnabled()) |
|
48 | if(this->isEnabled()) | |
50 | { |
|
49 | { | |
51 | this->setBaseAddress(SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,this->VID(),this->PID(),0)); |
|
50 | this->setBaseAddress(SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,this->VID(),this->PID(),0)); | |
52 | loopbackChangeState(Qt::Checked); |
|
51 | loopbackChangeState(Qt::Checked); | |
53 | } |
|
52 | } | |
54 | } |
|
53 | } | |
55 |
|
54 | |||
56 | void ApbUartPlugin::loopbackChangeState(int state) |
|
55 | void ApbUartPlugin::loopbackChangeState(int state) | |
57 | { |
|
56 | { | |
58 | if(state==Qt::Checked) |
|
57 | if(state==Qt::Checked) | |
59 | { |
|
58 | { | |
60 | enableLoopback(); |
|
59 | enableLoopback(); | |
61 | } |
|
60 | } | |
62 | else |
|
61 | else | |
63 | { |
|
62 | { | |
64 | disableLoopback(); |
|
63 | disableLoopback(); | |
65 | } |
|
64 | } | |
66 | } |
|
65 | } | |
67 |
|
66 | |||
68 | void ApbUartPlugin::uartReadout() |
|
67 | void ApbUartPlugin::uartReadout() | |
69 | { |
|
68 | { | |
70 | #ifdef WIN32 |
|
69 | #ifdef WIN32 | |
71 | int readcnt=0; |
|
70 | int readcnt=0; | |
72 | #endif |
|
71 | #endif | |
73 | if(this->isEnabled() && parent!=NULL) |
|
72 | if(this->isEnabled() && parent!=NULL) | |
74 | { |
|
73 | { | |
75 | if(this->useLoopBack) |
|
74 | if(this->useLoopBack) | |
76 | { |
|
75 | { | |
77 | if(this->baseAddress()!=-1) |
|
76 | if(this->baseAddress()!=-1) | |
78 | { |
|
77 | { | |
79 | this->loopBackTimer.stop(); |
|
78 | this->loopBackTimer.stop(); | |
80 | unsigned int status_reg,data; |
|
79 | unsigned int status_reg,data; | |
81 | char ch; |
|
80 | char ch; | |
82 | QString printdata=""; |
|
81 | QString printdata=""; | |
83 | parent->Read(&status_reg,1,this->baseAddress()+APB_UART_STATUS_REG); |
|
82 | parent->Read(&status_reg,1,this->baseAddress()+APB_UART_STATUS_REG); | |
84 | while ((status_reg&4)==0) { |
|
83 | while ((status_reg&4)==0) { | |
85 | parent->Read(&data,1,this->baseAddress()+APB_UART_FIFO_DEBUG_REG); |
|
84 | parent->Read(&data,1,this->baseAddress()+APB_UART_FIFO_DEBUG_REG); | |
86 | ch = (char)(0xff & data); |
|
85 | ch = (char)(0xff & data); | |
87 | printdata+=ch; |
|
86 | printdata+=ch; | |
88 | #ifdef WIN32 |
|
87 | #ifdef WIN32 | |
89 | readcnt++; |
|
88 | readcnt++; | |
90 | if(readcnt>=32) |
|
89 | if(readcnt>=32) | |
91 | { |
|
90 | { | |
92 | qApp->processEvents(); |
|
91 | qApp->processEvents(); | |
93 | break; |
|
92 | break; | |
94 | } |
|
93 | } | |
95 | #endif |
|
94 | #endif | |
96 | parent->Read(&status_reg,1,this->baseAddress()+APB_UART_STATUS_REG); |
|
95 | parent->Read(&status_reg,1,this->baseAddress()+APB_UART_STATUS_REG); | |
97 | } |
|
96 | } | |
98 | if(printdata!="") |
|
97 | if(printdata!="") | |
99 | emit apbUartTextReceived(printdata); |
|
98 | emit apbUartTextReceived(printdata); | |
100 | this->loopBackTimer.start(200); |
|
99 | this->loopBackTimer.start(200); | |
101 | } |
|
100 | } | |
102 | else |
|
101 | else | |
103 | { |
|
102 | { | |
104 | this->setBaseAddress(SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,this->VID(),this->PID(),0)); |
|
103 | this->setBaseAddress(SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,this->VID(),this->PID(),0)); | |
105 | this->enableLoopback(); |
|
104 | this->enableLoopback(); | |
106 | } |
|
105 | } | |
107 | } |
|
106 | } | |
108 | } |
|
107 | } | |
109 | } |
|
108 | } | |
110 |
|
109 | |||
111 | void ApbUartPlugin::activate(bool flag) |
|
110 | void ApbUartPlugin::activate(bool flag) | |
112 | { |
|
111 | { | |
113 | this->setEnabled(flag); |
|
112 | this->setEnabled(flag); | |
114 | emit this->activateSig(flag); |
|
113 | emit this->activateSig(flag); | |
115 | if(this->isEnabled()) |
|
114 | if(this->isEnabled()) | |
116 | {this->setBaseAddress(SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,this->VID(),this->PID(),0)); |
|
115 | {this->setBaseAddress(SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,this->VID(),this->PID(),0)); | |
117 |
|
116 | |||
118 | loopbackChangeState(Qt::Checked); |
|
117 | loopbackChangeState(Qt::Checked); | |
119 | } |
|
118 | } | |
120 | } |
|
119 | } | |
121 |
|
120 | |||
122 | void ApbUartPlugin::activateScan(bool flag) |
|
121 | void ApbUartPlugin::activateScan(bool flag) | |
123 | { |
|
122 | { | |
124 | if(flag) |
|
123 | if(flag) | |
125 | this->loopBackTimer.start(200); |
|
124 | this->loopBackTimer.start(200); | |
126 | else |
|
125 | else | |
127 | this->loopBackTimer.stop(); |
|
126 | this->loopBackTimer.stop(); | |
128 | } |
|
127 | } | |
129 |
|
128 | |||
130 | int ApbUartPlugin::enableLoopback() |
|
129 | int ApbUartPlugin::enableLoopback() | |
131 | { |
|
130 | { | |
132 |
|
131 | |||
133 | this->useLoopBack = true; |
|
132 | this->useLoopBack = true; | |
134 | this->loopBackTimer.start(200); |
|
133 | this->loopBackTimer.start(200); | |
135 | SocExplorerEngine::message(this,"Set FiFo debug mode mode"); |
|
134 | SocExplorerEngine::message(this,"Set FiFo debug mode mode"); | |
136 | if(parent==NULL) |
|
135 | if(parent==NULL) | |
137 | { |
|
136 | { | |
138 | SocExplorerEngine::message(this,"Can't set FiFo debug mode no parent driver accessible"); |
|
137 | SocExplorerEngine::message(this,"Can't set FiFo debug mode no parent driver accessible"); | |
139 | return -1; |
|
138 | return -1; | |
140 | } |
|
139 | } | |
141 | if(this->baseAddress()==-1) |
|
140 | if(this->baseAddress()==-1) | |
142 | { |
|
141 | { | |
143 | this->setBaseAddress(SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,this->VID(),this->PID(),0)); |
|
142 | this->setBaseAddress(SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,this->VID(),this->PID(),0)); | |
144 | if(this->baseAddress()==-1) |
|
143 | if(this->baseAddress()==-1) | |
145 | return -1; |
|
144 | return -1; | |
146 | } |
|
145 | } | |
147 | unsigned int ctrl_reg= 0x843; |
|
146 | unsigned int ctrl_reg= 0x843; | |
148 | parent->Write(&ctrl_reg,1,this->baseAddress()+APB_UART_CONTROL_REG); |
|
147 | parent->Write(&ctrl_reg,1,this->baseAddress()+APB_UART_CONTROL_REG); | |
|
148 | this->UI->setEnableForLoopBack(false); | |||
149 | return 0; |
|
149 | return 0; | |
150 | } |
|
150 | } | |
151 |
|
151 | |||
152 | int ApbUartPlugin::disableLoopback() |
|
152 | int ApbUartPlugin::disableLoopback() | |
153 | { |
|
153 | { | |
154 | SocExplorerEngine::message(this,"Disable FiFo debug mode mode"); |
|
154 | SocExplorerEngine::message(this,"Disable FiFo debug mode mode"); | |
155 | if(parent==NULL) |
|
155 | if(parent==NULL) | |
156 | { |
|
156 | { | |
157 | SocExplorerEngine::message(this,"Can't disable FiFo debug mode no parent driver accessible"); |
|
157 | SocExplorerEngine::message(this,"Can't disable FiFo debug mode no parent driver accessible"); | |
158 | return -1; |
|
158 | return -1; | |
159 | } |
|
159 | } | |
160 | if(this->baseAddress()==-1) |
|
160 | if(this->baseAddress()==-1) | |
161 | { |
|
161 | { | |
162 | this->setBaseAddress(SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,this->VID(),this->PID(),0)); |
|
162 | this->setBaseAddress(SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,this->VID(),this->PID(),0)); | |
163 | if(this->baseAddress()==-1) |
|
163 | if(this->baseAddress()==-1) | |
164 | return -1; |
|
164 | return -1; | |
165 | } |
|
165 | } | |
166 | unsigned int ctrl_reg; |
|
166 | unsigned int ctrl_reg; | |
167 | this->loopBackTimer.stop(); |
|
167 | this->loopBackTimer.stop(); | |
168 | /* Firts get Control reg value*/ |
|
168 | /* Firts get Control reg value*/ | |
169 | parent->Read(&ctrl_reg,1,this->baseAddress()+APB_UART_CONTROL_REG); |
|
169 | parent->Read(&ctrl_reg,1,this->baseAddress()+APB_UART_CONTROL_REG); | |
170 | ctrl_reg = ctrl_reg & (~(1<<11)); |
|
170 | ctrl_reg = ctrl_reg & (~(1<<11)); | |
171 | parent->Write(&ctrl_reg,1,this->baseAddress()+APB_UART_CONTROL_REG); |
|
171 | parent->Write(&ctrl_reg,1,this->baseAddress()+APB_UART_CONTROL_REG); | |
172 | this->useLoopBack = false; |
|
172 | this->useLoopBack = false; | |
|
173 | this->UI->setEnableForLoopBack(true); | |||
173 | return 0; |
|
174 | return 0; | |
174 | } |
|
175 | } | |
175 |
|
176 | |||
176 |
|
177 | |||
177 | unsigned int ApbUartPlugin::Read(unsigned int *Value,unsigned int count,unsigned int address) |
|
178 | unsigned int ApbUartPlugin::Read(unsigned int *Value,unsigned int count,unsigned int address) | |
178 | { |
|
179 | { | |
179 | if(parent!=NULL) |
|
180 | if(parent!=NULL) | |
180 | return parent->Read(Value,count,address); |
|
181 | return parent->Read(Value,count,address); | |
181 | return 0; |
|
182 | return 0; | |
182 | } |
|
183 | } | |
183 |
|
184 | |||
184 |
|
185 | |||
185 | unsigned int ApbUartPlugin::Write(unsigned int *Value,unsigned int count, unsigned int address) |
|
186 | unsigned int ApbUartPlugin::Write(unsigned int *Value,unsigned int count, unsigned int address) | |
186 | { |
|
187 | { | |
187 | if(parent!=NULL) |
|
188 | if(parent!=NULL) | |
188 | return parent->Write(Value,count,address); |
|
189 | return parent->Write(Value,count,address); | |
189 | return 0; |
|
190 | return 0; | |
190 | } |
|
191 | } | |
191 |
|
192 | |||
192 |
|
193 | |||
193 |
|
194 | |||
194 |
|
195 | |||
195 |
|
196 | |||
196 |
|
197 | |||
197 |
|
198 | |||
198 |
|
199 |
@@ -1,69 +1,70 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SocExplorer Software |
|
2 | -- This file is a part of the SocExplorer Software | |
3 | -- Copyright (C) 2013, Plasma Physics Laboratory - CNRS |
|
3 | -- Copyright (C) 2013, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
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 |
|
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 |
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
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 |
|
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 |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@member.fsf.org |
|
20 | -- Mail : alexis.jeandet@member.fsf.org | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #ifndef APBUARTPLUGIN_H |
|
22 | #ifndef APBUARTPLUGIN_H | |
23 | #define APBUARTPLUGIN_H |
|
23 | #define APBUARTPLUGIN_H | |
24 | #include <QMenuBar> |
|
24 | #include <QMenuBar> | |
25 | #include <QMenu> |
|
25 | #include <QMenu> | |
26 | #include <QAction> |
|
26 | #include <QAction> | |
27 | #include <QLayout> |
|
27 | #include <QLayout> | |
28 |
|
28 | |||
29 | #include <socexplorerplugin.h> |
|
29 | #include <socexplorerplugin.h> | |
30 | #include <apbuartpluginui.h> |
|
30 | #include <apbuartpluginui.h> | |
31 | #include <QTimer> |
|
31 | #include <QTimer> | |
|
32 | #include "apbuart_plugin_ui.h" | |||
32 |
|
33 | |||
33 | #define APB_UART_DATA_REG 0x0 |
|
34 | #define APB_UART_DATA_REG 0x0 | |
34 | #define APB_UART_STATUS_REG 0x4 |
|
35 | #define APB_UART_STATUS_REG 0x4 | |
35 | #define APB_UART_CONTROL_REG 0x8 |
|
36 | #define APB_UART_CONTROL_REG 0x8 | |
36 | #define APB_UART_SCALE_REG 0xC |
|
37 | #define APB_UART_SCALE_REG 0xC | |
37 | #define APB_UART_FIFO_DEBUG_REG 0x10 |
|
38 | #define APB_UART_FIFO_DEBUG_REG 0x10 | |
38 |
|
39 | |||
39 |
|
40 | |||
40 | class ApbUartPlugin : public socexplorerplugin |
|
41 | class ApbUartPlugin : public socexplorerplugin | |
41 | { |
|
42 | { | |
42 | Q_OBJECT |
|
43 | Q_OBJECT | |
43 | public: |
|
44 | public: | |
44 | explicit ApbUartPlugin(QWidget *parent = 0); |
|
45 | explicit ApbUartPlugin(QWidget *parent = 0); | |
45 | ~ApbUartPlugin(); |
|
46 | ~ApbUartPlugin(); | |
46 | int VID(){return driver_VID;} |
|
47 | int VID(){return driver_VID;} | |
47 | int PID(){return driver_PID;} |
|
48 | int PID(){return driver_PID;} | |
48 |
|
49 | |||
49 | public slots: |
|
50 | public slots: | |
50 | unsigned int Write(unsigned int *Value,unsigned int count, unsigned int address=0); |
|
51 | unsigned int Write(unsigned int *Value,unsigned int count, unsigned int address=0); | |
51 | unsigned int Read(unsigned int *Value,unsigned int count, unsigned int address=0); |
|
52 | unsigned int Read(unsigned int *Value,unsigned int count, unsigned int address=0); | |
52 | void closeMe(); |
|
53 | void closeMe(); | |
53 | void postInstantiationTrigger(); |
|
54 | void postInstantiationTrigger(); | |
54 | void loopbackChangeState( int state ); |
|
55 | void loopbackChangeState( int state ); | |
55 | void uartReadout(); |
|
56 | void uartReadout(); | |
56 | void activateScan(bool flag); |
|
57 | void activateScan(bool flag); | |
57 | void activate(bool flag); |
|
58 | void activate(bool flag); | |
58 | signals: |
|
59 | signals: | |
59 | void apbUartTextReceived(QString text); |
|
60 | void apbUartTextReceived(QString text); | |
60 | private: |
|
61 | private: | |
61 |
A |
|
62 | APBUART_Plugin_ui* UI; | |
62 | bool useLoopBack; |
|
63 | bool useLoopBack; | |
63 | QTimer loopBackTimer; |
|
64 | QTimer loopBackTimer; | |
64 | int enableLoopback(); |
|
65 | int enableLoopback(); | |
65 | int disableLoopback(); |
|
66 | int disableLoopback(); | |
66 | }; |
|
67 | }; | |
67 |
|
68 | |||
68 | #endif // APBUARTPLUGIN_H |
|
69 | #endif // APBUARTPLUGIN_H | |
69 |
|
70 |
@@ -1,69 +1,74 | |||||
1 | # |
|
1 | # | |
2 | # Project created by QtCreator 2011-09-20T08:15:30 |
|
2 | # Project created by QtCreator 2011-09-20T08:15:30 | |
3 | # |
|
3 | # | |
4 | #------------------------------------------------- |
|
4 | #------------------------------------------------- | |
5 |
|
5 | |||
6 | CONFIG += socexplorerplugin |
|
6 | CONFIG += socexplorerplugin | |
7 | win32:CONFIG += dll |
|
7 | win32:CONFIG += dll | |
8 | win32:CONFIG -= static |
|
8 | win32:CONFIG -= static | |
9 |
|
9 | |||
10 | CONFIG(debug, debug|release) { |
|
10 | CONFIG(debug, debug|release) { | |
11 | DEBUG_EXT = _d |
|
11 | DEBUG_EXT = _d | |
12 | } else { |
|
12 | } else { | |
13 | DEBUG_EXT = |
|
13 | DEBUG_EXT = | |
14 | } |
|
14 | } | |
15 |
|
15 | |||
16 | TARGET = ApbUartPlugin$${DEBUG_EXT} |
|
16 | TARGET = ApbUartPlugin$${DEBUG_EXT} | |
17 |
|
17 | |||
18 | DEFINES += PLUGIN=ApbUartPlugin |
|
18 | DEFINES += PLUGIN=ApbUartPlugin | |
19 | DEFINES += PLUGINHEADER="\"\\\"APBUARTPLUGIN.h"\\\"\" |
|
19 | DEFINES += PLUGINHEADER="\"\\\"APBUARTPLUGIN.h"\\\"\" | |
20 | DEFINES += driver_Name="\"\\\"APB_UART_PLUGIN"\\\"\" |
|
20 | DEFINES += driver_Name="\"\\\"APB_UART_PLUGIN"\\\"\" | |
21 | DEFINES += driver_Author="\"\\\"Alexis Jeandet alexis.jeandet@member.fsf.org"\\\"\" |
|
21 | DEFINES += driver_Author="\"\\\"Alexis Jeandet alexis.jeandet@member.fsf.org"\\\"\" | |
22 | DEFINES += driver_Version="\"\\\"0.0.1"\\\"\" |
|
22 | DEFINES += driver_Version="\"\\\"0.0.1"\\\"\" | |
23 | DEFINES += driver_Description="\"\\\"This plugin provides a terminal widget connected to Gaisler\'s APBUART with or without loop-back mode."\\\"\" |
|
23 | DEFINES += driver_Description="\"\\\"This plugin provides a terminal widget connected to Gaisler\'s APBUART with or without loop-back mode."\\\"\" | |
24 | DEFINES += driver_can_be_root=0 |
|
24 | DEFINES += driver_can_be_root=0 | |
25 | DEFINES += driver_can_be_child=1 |
|
25 | DEFINES += driver_can_be_child=1 | |
26 | DEFINES += driver_VID=1 |
|
26 | DEFINES += driver_VID=1 | |
27 | DEFINES += driver_PID=0x0c |
|
27 | DEFINES += driver_PID=0x0c | |
28 |
|
28 | |||
29 |
|
29 | |||
30 |
|
30 | |||
31 | INCLUDEPATH += \ |
|
31 | INCLUDEPATH += \ | |
32 | $${PWD} |
|
32 | $${PWD} | |
33 |
|
33 | |||
34 | HEADERS += \ |
|
34 | HEADERS += \ | |
35 | APBUARTPLUGIN.h \ |
|
35 | APBUARTPLUGIN.h \ | |
36 | apbuartpluginui.h \ |
|
36 | apbuartpluginui.h \ | |
37 | apbuartcfg.h \ |
|
37 | apbuartcfg.h \ | |
38 | apbuartterminal.h |
|
38 | apbuartterminal.h \ | |
|
39 | apbuart_plugin_ui.h | |||
39 |
|
40 | |||
40 |
|
41 | |||
41 | SOURCES += \ |
|
42 | SOURCES += \ | |
42 | APBUARTPLUGIN.cpp \ |
|
43 | APBUARTPLUGIN.cpp \ | |
43 | apbuartpluginui.cpp \ |
|
44 | apbuartpluginui.cpp \ | |
44 | apbuartcfg.cpp \ |
|
45 | apbuartcfg.cpp \ | |
45 | apbuartterminal.cpp |
|
46 | apbuartterminal.cpp \ | |
|
47 | apbuart_plugin_ui.cpp | |||
|
48 | ||||
|
49 | FORMS += \ | |||
|
50 | apbuart_plugin_ui.ui | |||
46 |
|
51 | |||
47 |
|
52 | |||
48 |
|
53 | |||
49 |
|
54 | |||
50 |
|
55 | |||
51 |
|
56 | |||
52 |
|
57 | |||
53 |
|
58 | |||
54 |
|
59 | |||
55 |
|
60 | |||
56 |
|
61 | |||
57 |
|
62 | |||
58 |
|
63 | |||
59 |
|
64 | |||
60 |
|
65 | |||
61 |
|
66 | |||
62 |
|
67 | |||
63 |
|
68 | |||
64 |
|
69 | |||
65 |
|
70 | |||
66 |
|
71 | |||
67 |
|
72 | |||
68 |
|
73 | |||
69 |
|
74 |
General Comments 0
You need to be logged in to leave comments.
Login now