@@ -0,0 +1,27 | |||
|
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 "apbuartpywrapper.h" | |
|
23 | ||
|
24 | APBUartPyWrapper::APBUartPyWrapper(socexplorerplugin *parent) : | |
|
25 | genericPySysdriver(parent) | |
|
26 | { | |
|
27 | } |
@@ -0,0 +1,46 | |||
|
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 APBUARTPYWRAPPER_H | |
|
23 | #define APBUARTPYWRAPPER_H | |
|
24 | #include <QString> | |
|
25 | #include <socexplorerplugin.h> | |
|
26 | #include <genericPySysdriver.h> | |
|
27 | ||
|
28 | class APBUartPyWrapper : public genericPySysdriver | |
|
29 | { | |
|
30 | Q_OBJECT | |
|
31 | public: | |
|
32 | explicit APBUartPyWrapper(socexplorerplugin *parent = 0); | |
|
33 | ||
|
34 | signals: | |
|
35 | void setFifoDebugEnabled(bool enable); | |
|
36 | void setAPBUartIndex(int index); | |
|
37 | void setUARTPortNane(QString name); | |
|
38 | void setUARTPortSpeed(int speed); | |
|
39 | void updateAPBUartsList(); | |
|
40 | void openUart(); | |
|
41 | void closeUart(); | |
|
42 | public slots: | |
|
43 | ||
|
44 | }; | |
|
45 | ||
|
46 | #endif // APBUARTPYWRAPPER_H |
@@ -21,20 +21,31 | |||
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #include "APBUARTPLUGIN.h" |
|
23 | 23 | #include <socexplorerengine.h> |
|
24 | #include <apbuartpywrapper.h> | |
|
24 | 25 | |
|
25 | ApbUartPlugin::ApbUartPlugin(QWidget *parent):socexplorerplugin(parent) | |
|
26 | ApbUartPlugin::ApbUartPlugin(QWidget *parent):socexplorerplugin(parent,false) | |
|
26 | 27 | { |
|
27 | 28 | this->setBaseAddress(-1); |
|
29 | this->p_curentAPBUart = 0; | |
|
28 | 30 | this->UI = new APBUART_Plugin_ui(); |
|
29 | 31 | this->setWidget((QWidget*)this->UI); |
|
30 | 32 | this->uartConnected = false; |
|
31 | 33 | this->UartThread = new UARTPollingThread(this); |
|
32 | connect(this->UI,SIGNAL(loopbackChkBxStateChanged(int)),this,SLOT(loopbackChangeState(int))); | |
|
34 | this->pyObject = new APBUartPyWrapper(this); | |
|
35 | connect(this->UI,SIGNAL(loopbackChkBxStateChanged(int)),this,SLOT(fifoDebugChangeState(int))); | |
|
33 | 36 | connect(this->UartThread,SIGNAL(apbUartTextReceived(QString)),this->UI,SIGNAL(apbUartTextReceived(QString))); |
|
34 | 37 | connect(this->UI,SIGNAL(connectPort()),this,SLOT(toggleUartState())); |
|
35 | 38 | connect(this->UI,SIGNAL(sendChar(char)),this->UartThread,SLOT(sendChar(char))); |
|
36 | 39 | connect(this->UI,SIGNAL(PortNameChanged(QString)),this->UartThread,SLOT(setPortName(QString))); |
|
37 | 40 | connect(this->UI,SIGNAL(UartSpeedChanged(QString)),this->UartThread,SLOT(setPortSpeedStr(QString))); |
|
41 | connect(this->UI,SIGNAL(updateAPBUartsList()),this,SLOT(updateAPBUartsList())); | |
|
42 | connect(this->UI,SIGNAL(curentAPBUartChanged(int)),this,SLOT(setCurentAPBUart(int))); | |
|
43 | connect(((APBUartPyWrapper*)this->pyObject),SIGNAL(openUart()),this,SLOT(openUart())); | |
|
44 | connect(((APBUartPyWrapper*)this->pyObject),SIGNAL(closeUart()),this,SLOT(closeUart())); | |
|
45 | connect(((APBUartPyWrapper*)this->pyObject),SIGNAL(setFifoDebugEnabled(bool)),this,SLOT(setFifoDebugEnabled(bool))); | |
|
46 | connect(((APBUartPyWrapper*)this->pyObject),SIGNAL(setUARTPortNane(QString)),this,SLOT(setUARTPortNane(QString))); | |
|
47 | connect(((APBUartPyWrapper*)this->pyObject),SIGNAL(setUARTPortSpeed(int)),this,SLOT(setUARTPortSpeed(int))); | |
|
48 | connect(((APBUartPyWrapper*)this->pyObject),SIGNAL(updateAPBUartsList()),this,SLOT(updateAPBUartsList())); | |
|
38 | 49 | this->UartThread->start(); |
|
39 | 50 | } |
|
40 | 51 | |
@@ -44,6 +55,11 ApbUartPlugin::~ApbUartPlugin() | |||
|
44 | 55 | |
|
45 | 56 | } |
|
46 | 57 | |
|
58 | int ApbUartPlugin::curentAPBUart() | |
|
59 | { | |
|
60 | return p_curentAPBUart; | |
|
61 | } | |
|
62 | ||
|
47 | 63 | void ApbUartPlugin::closeMe() |
|
48 | 64 | { |
|
49 | 65 | emit this->closePlugin(this); |
@@ -53,27 +69,86 void ApbUartPlugin::toggleUartState() | |||
|
53 | 69 | { |
|
54 | 70 | if(!uartConnected) |
|
55 | 71 | { |
|
56 |
|
|
|
72 | this->openUart(); | |
|
57 | 73 | } |
|
58 | 74 | else |
|
59 | 75 | { |
|
60 |
this |
|
|
61 | this->uartConnected = false; | |
|
76 | this->closeUart(); | |
|
62 | 77 | } |
|
78 | } | |
|
79 | ||
|
80 | void ApbUartPlugin::activate(bool flag) | |
|
81 | { | |
|
82 | socexplorerplugin::activate(flag); | |
|
83 | this->updateAPBUartsList(); | |
|
84 | } | |
|
85 | ||
|
86 | void ApbUartPlugin::updateAPBUartsList() | |
|
87 | { | |
|
88 | QList<unsigned int> addresses; | |
|
89 | int count = SocExplorerEngine::self()->getEnumDeviceCount(this,this->VID(),this->PID()); | |
|
90 | for(int i=0;i<count;i++) | |
|
91 | { | |
|
92 | addresses.append(SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,this->VID(),this->PID(),i)); | |
|
93 | } | |
|
94 | this->UI->updateAPBUartList(addresses); | |
|
95 | } | |
|
96 | ||
|
97 | void ApbUartPlugin::setCurentAPBUart(int index) | |
|
98 | { | |
|
99 | this->p_curentAPBUart = index; | |
|
100 | this->setBaseAddress(SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,this->VID(),this->PID(),index)); | |
|
101 | } | |
|
102 | ||
|
103 | void ApbUartPlugin::openUart() | |
|
104 | { | |
|
105 | if(this->UartThread->fifoDebugEnabled()) | |
|
106 | setFifoDebugEnabled(false); | |
|
107 | if(!uartConnected) | |
|
108 | uartConnected = this->UartThread->openUart(); | |
|
63 | 109 | this->UI->setUartConnected(uartConnected); |
|
64 | 110 | } |
|
65 | 111 | |
|
66 |
void ApbUartPlugin:: |
|
|
112 | void ApbUartPlugin::closeUart() | |
|
113 | { | |
|
114 | if(uartConnected) | |
|
115 | this->UartThread->closeUart(); | |
|
116 | this->uartConnected = false; | |
|
117 | this->UI->setUartConnected(uartConnected); | |
|
118 | } | |
|
119 | ||
|
120 | void ApbUartPlugin::setFifoDebugEnabled(bool enable) | |
|
121 | { | |
|
122 | if(uartConnected) | |
|
123 | closeUart(); | |
|
124 | this->UI->setEnableForLoopBack(!enable); | |
|
125 | this->UartThread->setFifoDebugEable(enable); | |
|
126 | } | |
|
127 | ||
|
128 | void ApbUartPlugin::setAPBUartIndex(int index) | |
|
129 | { | |
|
130 | this->UI->setAPBUartIndex(index); | |
|
131 | } | |
|
132 | ||
|
133 | void ApbUartPlugin::setUARTPortNane(QString name) | |
|
134 | { | |
|
135 | this->UI->setUartPortName(name); | |
|
136 | } | |
|
137 | ||
|
138 | void ApbUartPlugin::setUARTPortSpeed(int speed) | |
|
139 | { | |
|
140 | this->UI->setUartSpeed(speed); | |
|
141 | } | |
|
142 | ||
|
143 | void ApbUartPlugin::fifoDebugChangeState(int state) | |
|
67 | 144 | { |
|
68 | 145 | if(state==Qt::Checked) |
|
69 | 146 | { |
|
70 |
this-> |
|
|
71 | this->UartThread->setFifoDebugEable(true); | |
|
147 | this->setFifoDebugEnabled(true); | |
|
72 | 148 | } |
|
73 | 149 | else |
|
74 | 150 | { |
|
75 |
this-> |
|
|
76 | this->UartThread->setFifoDebugEable(false); | |
|
151 | this->setFifoDebugEnabled(false); | |
|
77 | 152 | } |
|
78 | 153 | } |
|
79 | 154 |
@@ -44,18 +44,29 public: | |||
|
44 | 44 | ~ApbUartPlugin(); |
|
45 | 45 | int VID(){return driver_VID;} |
|
46 | 46 | int PID(){return driver_PID;} |
|
47 | ||
|
47 | int curentAPBUart(); | |
|
48 | ||
|
48 | 49 | public slots: |
|
49 | 50 | unsigned int Write(unsigned int *Value,unsigned int count, unsigned int address=0); |
|
50 | 51 | unsigned int Read(unsigned int *Value,unsigned int count, unsigned int address=0); |
|
51 |
void |
|
|
52 | void fifoDebugChangeState(int state); | |
|
52 | 53 | void closeMe(); |
|
53 | 54 | void toggleUartState(); |
|
55 | void activate(bool flag); | |
|
56 | void updateAPBUartsList(); | |
|
57 | void setCurentAPBUart(int index); | |
|
58 | void openUart(); | |
|
59 | void closeUart(); | |
|
60 | void setFifoDebugEnabled(bool enable); | |
|
61 | void setAPBUartIndex(int index); | |
|
62 | void setUARTPortNane(QString name); | |
|
63 | void setUARTPortSpeed(int speed); | |
|
54 | 64 | signals: |
|
55 | 65 | |
|
56 | 66 | private: |
|
57 | 67 | APBUART_Plugin_ui* UI; |
|
58 | 68 | bool uartConnected; |
|
69 | int p_curentAPBUart; | |
|
59 | 70 | UARTPollingThread* UartThread; |
|
60 | 71 | int enableLoopback(); |
|
61 | 72 | int disableLoopback(); |
@@ -4,6 +4,7 | |||
|
4 | 4 | #------------------------------------------------- |
|
5 | 5 | |
|
6 | 6 | CONFIG += socexplorerplugin |
|
7 | ||
|
7 | 8 | win32:CONFIG += dll |
|
8 | 9 | win32:CONFIG -= static |
|
9 | 10 | |
@@ -35,14 +36,16 HEADERS += \ | |||
|
35 | 36 | APBUARTPLUGIN.h \ |
|
36 | 37 | apbuartterminal.h \ |
|
37 | 38 | apbuart_plugin_ui.h \ |
|
38 | uartpollingthread.h | |
|
39 | uartpollingthread.h \ | |
|
40 | apbuartpywrapper.h | |
|
39 | 41 | |
|
40 | 42 | |
|
41 | 43 | SOURCES += \ |
|
42 | 44 | APBUARTPLUGIN.cpp \ |
|
43 | 45 | apbuartterminal.cpp \ |
|
44 | 46 | apbuart_plugin_ui.cpp \ |
|
45 | uartpollingthread.cpp | |
|
47 | uartpollingthread.cpp \ | |
|
48 | apbuartpywrapper.cpp | |
|
46 | 49 | |
|
47 | 50 | FORMS += \ |
|
48 | 51 | apbuart_plugin_ui.ui |
@@ -22,6 +22,7 | |||
|
22 | 22 | #include "apbuart_plugin_ui.h" |
|
23 | 23 | #include "ui_apbuart_plugin_ui.h" |
|
24 | 24 | #include "apbuartterminal.h" |
|
25 | #include <QComboBox> | |
|
25 | 26 | |
|
26 | 27 | APBUART_Plugin_ui::APBUART_Plugin_ui(QWidget *parent) : |
|
27 | 28 | QWidget(parent), |
@@ -35,6 +36,8 APBUART_Plugin_ui::APBUART_Plugin_ui(QWi | |||
|
35 | 36 | connect(this->ui->PortNameLineEdit,SIGNAL(textChanged(QString)),this,SIGNAL(PortNameChanged(QString))); |
|
36 | 37 | connect(this->ui->UartSpeedLineEdit,SIGNAL(textChanged(QString)),this,SIGNAL(UartSpeedChanged(QString))); |
|
37 | 38 | connect(this->ui->rescanQpb,SIGNAL(clicked()),this,SLOT(updatePortList())); |
|
39 | connect(this->ui->APBUartsUpdateQpb,SIGNAL(clicked()),this,SIGNAL(updateAPBUartsList())); | |
|
40 | connect(this->ui->UARTSelector,SIGNAL(currentIndexChanged(int)),this,SIGNAL(curentAPBUartChanged(int))); | |
|
38 | 41 | this->portListcompleter = NULL; |
|
39 | 42 | this->updatePortList(); |
|
40 | 43 | } |
@@ -44,11 +47,22 APBUART_Plugin_ui::~APBUART_Plugin_ui() | |||
|
44 | 47 | delete ui; |
|
45 | 48 | } |
|
46 | 49 | |
|
50 | int APBUART_Plugin_ui::curentAPBUart() | |
|
51 | { | |
|
52 | return this->ui->UARTSelector->currentIndex(); | |
|
53 | } | |
|
54 | ||
|
47 | 55 | void APBUART_Plugin_ui::setEnableForLoopBack(bool enable) |
|
48 | 56 | { |
|
49 | 57 | this->ui->PortNameLineEdit->setEnabled(enable); |
|
50 | 58 | this->ui->ConnectQpb->setEnabled(enable); |
|
51 | 59 | this->ui->UartSpeedLineEdit->setEnabled(enable); |
|
60 | this->ui->APBUartsUpdateQpb->setEnabled(enable); | |
|
61 | this->ui->rescanQpb->setEnabled(enable); | |
|
62 | this->ui->UARTSelector->setEnabled(enable); | |
|
63 | if(this->ui->FIFODebugChkBx->isChecked()==enable) | |
|
64 | this->ui->FIFODebugChkBx->toggle(); | |
|
65 | ||
|
52 | 66 | } |
|
53 | 67 | |
|
54 | 68 | void APBUART_Plugin_ui::setUartConnected(bool enable) |
@@ -56,6 +70,9 void APBUART_Plugin_ui::setUartConnected | |||
|
56 | 70 | this->ui->PortNameLineEdit->setDisabled(enable); |
|
57 | 71 | this->ui->UartSpeedLineEdit->setDisabled(enable); |
|
58 | 72 | this->ui->FIFODebugChkBx->setDisabled(enable); |
|
73 | this->ui->APBUartsUpdateQpb->setDisabled(enable); | |
|
74 | this->ui->rescanQpb->setDisabled(enable); | |
|
75 | this->ui->UARTSelector->setDisabled(enable); | |
|
59 | 76 | if(enable) |
|
60 | 77 | { |
|
61 | 78 | this->ui->ConnectQpb->setText("Close Port"); |
@@ -90,6 +107,32 void APBUART_Plugin_ui::updatePortList() | |||
|
90 | 107 | this->portListcompleterModel->setStringList(wordList); |
|
91 | 108 | } |
|
92 | 109 | |
|
110 | void APBUART_Plugin_ui::updateAPBUartList(QList<unsigned int> addresses) | |
|
111 | { | |
|
112 | this->ui->UARTSelector->clear(); | |
|
113 | for(int i=0;i<addresses.count();i++) | |
|
114 | { | |
|
115 | this->ui->UARTSelector->addItem(QString("APBUart %1 @0x%2").arg(i).arg(addresses.at(i),8,16)); | |
|
116 | } | |
|
117 | if(addresses.count()==0) | |
|
118 | this->ui->UARTSelector->addItem("None"); | |
|
119 | } | |
|
120 | ||
|
121 | void APBUART_Plugin_ui::setUartSpeed(int speed) | |
|
122 | { | |
|
123 | this->ui->UartSpeedLineEdit->setText(QString::number(speed)); | |
|
124 | } | |
|
125 | ||
|
126 | void APBUART_Plugin_ui::setUartPortName(QString name) | |
|
127 | { | |
|
128 | this->ui->PortNameLineEdit->setText(name); | |
|
129 | } | |
|
130 | ||
|
131 | void APBUART_Plugin_ui::setAPBUartIndex(int index) | |
|
132 | { | |
|
133 | if((index<this->ui->UARTSelector->count()) && (index>0) ) | |
|
134 | this->ui->UARTSelector->setCurrentIndex(index); | |
|
135 | } | |
|
93 | 136 | |
|
94 | 137 | |
|
95 | 138 | |
@@ -98,3 +141,5 void APBUART_Plugin_ui::updatePortList() | |||
|
98 | 141 | |
|
99 | 142 | |
|
100 | 143 | |
|
144 | ||
|
145 |
@@ -37,18 +37,26 class APBUART_Plugin_ui : public QWidget | |||
|
37 | 37 | public: |
|
38 | 38 | explicit APBUART_Plugin_ui(QWidget *parent = 0); |
|
39 | 39 | ~APBUART_Plugin_ui(); |
|
40 | ||
|
40 | int curentAPBUart(); | |
|
41 | 41 | public slots: |
|
42 | 42 | void setEnableForLoopBack(bool enable); |
|
43 | 43 | void setUartConnected(bool enable); |
|
44 | 44 | void updatePortList(); |
|
45 | void updateAPBUartList(QList<unsigned int> addresses); | |
|
46 | void setUartSpeed(int speed); | |
|
47 | void setUartPortName(QString name); | |
|
48 | void setAPBUartIndex(int index); | |
|
49 | private slots: | |
|
50 | ||
|
45 | 51 | signals: |
|
52 | void curentAPBUartChanged(int index); | |
|
46 | 53 | void loopbackChkBxStateChanged( int state ); |
|
47 | 54 | void apbUartTextReceived(QString text); |
|
48 | 55 | void connectPort(); |
|
49 | 56 | void sendChar(char c); |
|
50 | 57 | void UartSpeedChanged(QString text); |
|
51 | 58 | void PortNameChanged(QString text); |
|
59 | void updateAPBUartsList(); | |
|
52 | 60 | private: |
|
53 | 61 | Ui::APBUART_Plugin_ui *ui; |
|
54 | 62 | QCompleter *portListcompleter; |
@@ -6,8 +6,8 | |||
|
6 | 6 | <rect> |
|
7 | 7 | <x>0</x> |
|
8 | 8 | <y>0</y> |
|
9 |
<width> |
|
|
10 |
<height>3 |
|
|
9 | <width>608</width> | |
|
10 | <height>319</height> | |
|
11 | 11 | </rect> |
|
12 | 12 | </property> |
|
13 | 13 | <property name="windowTitle"> |
@@ -24,48 +24,80 | |||
|
24 | 24 | <string>Configuration</string> |
|
25 | 25 | </attribute> |
|
26 | 26 | <layout class="QGridLayout" name="gridLayout"> |
|
27 |
<item row=" |
|
|
28 |
<widget class="Q |
|
|
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>false</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> | |
|
27 | <item row="2" column="0" colspan="3"> | |
|
28 | <widget class="QGroupBox" name="Uartconfig"> | |
|
29 | <property name="title"> | |
|
30 | <string>APB UART Config</string> | |
|
44 | 31 | </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 |
|
|
|
52 |
</ |
|
|
53 | </item> | |
|
54 | <item row="1" column="2"> | |
|
55 | <widget class="QPushButton" name="rescanQpb"> | |
|
56 | <property name="text"> | |
|
57 | <string>Rescan ports</string> | |
|
58 |
|
|
|
59 |
</ |
|
|
60 | </item> | |
|
61 | <item row="3" column="1" colspan="2"> | |
|
62 | <widget class="QLineEdit" name="UartSpeedLineEdit"/> | |
|
63 | </item> | |
|
64 | <item row="4" column="1" colspan="2"> | |
|
65 | <widget class="QPushButton" name="ConnectQpb"> | |
|
66 | <property name="text"> | |
|
67 | <string>Open Port</string> | |
|
68 |
|
|
|
32 | <layout class="QGridLayout" name="gridLayout_2"> | |
|
33 | <item row="2" column="0"> | |
|
34 | <widget class="QLabel" name="PortNameLbl"> | |
|
35 | <property name="text"> | |
|
36 | <string>Port Name</string> | |
|
37 | </property> | |
|
38 | </widget> | |
|
39 | </item> | |
|
40 | <item row="3" column="0"> | |
|
41 | <widget class="QLabel" name="UartSpeedLbl"> | |
|
42 | <property name="text"> | |
|
43 | <string>Uart Speed</string> | |
|
44 | </property> | |
|
45 | </widget> | |
|
46 | </item> | |
|
47 | <item row="0" column="0"> | |
|
48 | <widget class="QCheckBox" name="FIFODebugChkBx"> | |
|
49 | <property name="text"> | |
|
50 | <string>Enable FIFO debug mode</string> | |
|
51 | </property> | |
|
52 | <property name="checked"> | |
|
53 | <bool>false</bool> | |
|
54 | </property> | |
|
55 | </widget> | |
|
56 | </item> | |
|
57 | <item row="0" column="3"> | |
|
58 | <widget class="QPushButton" name="APBUartsUpdateQpb"> | |
|
59 | <property name="text"> | |
|
60 | <string>Update</string> | |
|
61 | </property> | |
|
62 | </widget> | |
|
63 | </item> | |
|
64 | <item row="3" column="1" colspan="3"> | |
|
65 | <widget class="QLineEdit" name="UartSpeedLineEdit"/> | |
|
66 | </item> | |
|
67 | <item row="2" column="3"> | |
|
68 | <widget class="QPushButton" name="rescanQpb"> | |
|
69 | <property name="text"> | |
|
70 | <string>Rescan ports</string> | |
|
71 | </property> | |
|
72 | </widget> | |
|
73 | </item> | |
|
74 | <item row="2" column="1" colspan="2"> | |
|
75 | <widget class="QLineEdit" name="PortNameLineEdit"/> | |
|
76 | </item> | |
|
77 | <item row="0" column="2"> | |
|
78 | <widget class="QComboBox" name="UARTSelector"> | |
|
79 | <item> | |
|
80 | <property name="text"> | |
|
81 | <string>None</string> | |
|
82 | </property> | |
|
83 | </item> | |
|
84 | </widget> | |
|
85 | </item> | |
|
86 | <item row="0" column="1"> | |
|
87 | <widget class="QLabel" name="label"> | |
|
88 | <property name="text"> | |
|
89 | <string>Chose UART</string> | |
|
90 | </property> | |
|
91 | </widget> | |
|
92 | </item> | |
|
93 | <item row="4" column="2" colspan="2"> | |
|
94 | <widget class="QPushButton" name="ConnectQpb"> | |
|
95 | <property name="text"> | |
|
96 | <string>Open Port</string> | |
|
97 | </property> | |
|
98 | </widget> | |
|
99 | </item> | |
|
100 | </layout> | |
|
69 | 101 | </widget> |
|
70 | 102 | </item> |
|
71 | 103 | </layout> |
@@ -29,7 +29,7 UARTPollingThread::UARTPollingThread(soc | |||
|
29 | 29 | uartMutex = new QMutex(); |
|
30 | 30 | uartOpened = false; |
|
31 | 31 | fifoDebugConfigured = false; |
|
32 | fifoDebugEnabled = false; | |
|
32 | p_fifoDebugEnabled = false; | |
|
33 | 33 | this->moveToThread(this); |
|
34 | 34 | } |
|
35 | 35 | |
@@ -47,7 +47,7 void UARTPollingThread::run() | |||
|
47 | 47 | SocExplorerEngine::message(this->plugin,"Entering APB UART polling thread",3); |
|
48 | 48 | while (!this->isInterruptionRequested()) |
|
49 | 49 | { |
|
50 | if(fifoDebugEnabled) | |
|
50 | if(p_fifoDebugEnabled) | |
|
51 | 51 | { |
|
52 | 52 | if(fifoDebugConfigured) |
|
53 | 53 | { |
@@ -57,7 +57,7 void UARTPollingThread::run() | |||
|
57 | 57 | char ch; |
|
58 | 58 | QString printdata=""; |
|
59 | 59 | plugin->parent->Read(&status_reg,1,this->plugin->baseAddress()+APB_UART_STATUS_REG); |
|
60 | while ((status_reg&4)==0) { | |
|
60 | while ((status_reg & 4)==0) { | |
|
61 | 61 | plugin->parent->Read(&data,1,this->plugin->baseAddress()+APB_UART_FIFO_DEBUG_REG); |
|
62 | 62 | ch = (char)(0xff & data); |
|
63 | 63 | printdata+=ch; |
@@ -113,7 +113,7 void UARTPollingThread::run() | |||
|
113 | 113 | |
|
114 | 114 | void UARTPollingThread::sendChar(char c) |
|
115 | 115 | { |
|
116 | if(fifoDebugEnabled) | |
|
116 | if(p_fifoDebugEnabled) | |
|
117 | 117 | { |
|
118 | 118 | if(this->plugin->baseAddress()!=-1) |
|
119 | 119 | { |
@@ -186,7 +186,12 void UARTPollingThread::setFifoDebugEabl | |||
|
186 | 186 | } |
|
187 | 187 | this->fifoDebugConfigured = false; |
|
188 | 188 | configFifoDebug(enable); |
|
189 | this->fifoDebugEnabled = enable; | |
|
189 | this->p_fifoDebugEnabled = enable; | |
|
190 | } | |
|
191 | ||
|
192 | bool UARTPollingThread::fifoDebugEnabled() | |
|
193 | { | |
|
194 | return p_fifoDebugEnabled; | |
|
190 | 195 | } |
|
191 | 196 | |
|
192 | 197 | void UARTPollingThread::configFifoDebug(bool enable) |
@@ -51,9 +51,10 public slots: | |||
|
51 | 51 | void setPortSpeedStr(QString speed); |
|
52 | 52 | void setPortSpeed(int speed); |
|
53 | 53 | void setFifoDebugEable(bool enable); |
|
54 | bool fifoDebugEnabled(); | |
|
54 | 55 | private: |
|
55 | 56 | void configFifoDebug(bool enable); |
|
56 | bool fifoDebugEnabled; | |
|
57 | bool p_fifoDebugEnabled; | |
|
57 | 58 | bool fifoDebugConfigured; |
|
58 | 59 | QString portName; |
|
59 | 60 | int uartSpeed; |
@@ -86,8 +86,6 int ahbuartplugin::registermenu(QMainWin | |||
|
86 | 86 | } |
|
87 | 87 | |
|
88 | 88 | |
|
89 | ||
|
90 | ||
|
91 | 89 | bool ahbuartplugin::checkConnection() |
|
92 | 90 | { |
|
93 | 91 | QTime timeout; |
@@ -357,9 +355,9 unsigned int ahbuartplugin::Write(unsign | |||
|
357 | 355 | progress = SocExplorerEngine::getProgressBar("Writing on uart @0x"+QString::number(address,16)+" %v of "+QString::number(count)+" words ",count); |
|
358 | 356 | int offset = 0; |
|
359 | 357 | char* CMD= (char*)malloc((32*4)+5); |
|
358 | writen=0; | |
|
360 | 359 | while(count>32) |
|
361 | 360 | { |
|
362 | writen=0; | |
|
363 | 361 | CMD[0] = 0xC0 | (32-1); |
|
364 | 362 | CMD[1] = (char)(((unsigned int)address>>24)&0xFF); |
|
365 | 363 | CMD[2] = (char)(((unsigned int)address>>16)&0xFF); |
@@ -409,7 +407,7 unsigned int ahbuartplugin::Write(unsign | |||
|
409 | 407 | SocExplorerEngine::deleteProgressBar(progress); |
|
410 | 408 | } |
|
411 | 409 | free(CMD); |
|
412 | emit this->addWritenBytes(writen); | |
|
410 | emit this->addWritenBytes(writen*4); | |
|
413 | 411 | return writen; |
|
414 | 412 | } |
|
415 | 413 | return 0; |
General Comments 0
You need to be logged in to leave comments.
Login now