##// END OF EJS Templates
Removed APBUartPlugin bug (when switching between debug and non debug link)....
jeandet -
r34:ccd56e93ef09 default
parent child
Show More
@@ -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 #include "APBUARTPLUGIN.h"
22 #include "APBUARTPLUGIN.h"
23 #include <socexplorerengine.h>
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 this->setBaseAddress(-1);
28 this->setBaseAddress(-1);
29 this->p_curentAPBUart = 0;
28 this->UI = new APBUART_Plugin_ui();
30 this->UI = new APBUART_Plugin_ui();
29 this->setWidget((QWidget*)this->UI);
31 this->setWidget((QWidget*)this->UI);
30 this->uartConnected = false;
32 this->uartConnected = false;
31 this->UartThread = new UARTPollingThread(this);
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 connect(this->UartThread,SIGNAL(apbUartTextReceived(QString)),this->UI,SIGNAL(apbUartTextReceived(QString)));
36 connect(this->UartThread,SIGNAL(apbUartTextReceived(QString)),this->UI,SIGNAL(apbUartTextReceived(QString)));
34 connect(this->UI,SIGNAL(connectPort()),this,SLOT(toggleUartState()));
37 connect(this->UI,SIGNAL(connectPort()),this,SLOT(toggleUartState()));
35 connect(this->UI,SIGNAL(sendChar(char)),this->UartThread,SLOT(sendChar(char)));
38 connect(this->UI,SIGNAL(sendChar(char)),this->UartThread,SLOT(sendChar(char)));
36 connect(this->UI,SIGNAL(PortNameChanged(QString)),this->UartThread,SLOT(setPortName(QString)));
39 connect(this->UI,SIGNAL(PortNameChanged(QString)),this->UartThread,SLOT(setPortName(QString)));
37 connect(this->UI,SIGNAL(UartSpeedChanged(QString)),this->UartThread,SLOT(setPortSpeedStr(QString)));
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 this->UartThread->start();
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 void ApbUartPlugin::closeMe()
63 void ApbUartPlugin::closeMe()
48 {
64 {
49 emit this->closePlugin(this);
65 emit this->closePlugin(this);
@@ -53,27 +69,86 void ApbUartPlugin::toggleUartState()
53 {
69 {
54 if(!uartConnected)
70 if(!uartConnected)
55 {
71 {
56 uartConnected = this->UartThread->openUart();
72 this->openUart();
57 }
73 }
58 else
74 else
59 {
75 {
60 this->UartThread->closeUart();
76 this->closeUart();
61 this->uartConnected = false;
77 }
78 }
79
80 void ApbUartPlugin::activate(bool flag)
81 {
82 socexplorerplugin::activate(flag);
83 this->updateAPBUartsList();
62 }
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 this->UI->setUartConnected(uartConnected);
109 this->UI->setUartConnected(uartConnected);
64 }
110 }
65
111
66 void ApbUartPlugin::loopbackChangeState(int state)
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 if(state==Qt::Checked)
145 if(state==Qt::Checked)
69 {
146 {
70 this->UI->setEnableForLoopBack(false);
147 this->setFifoDebugEnabled(true);
71 this->UartThread->setFifoDebugEable(true);
72 }
148 }
73 else
149 else
74 {
150 {
75 this->UI->setEnableForLoopBack(true);
151 this->setFifoDebugEnabled(false);
76 this->UartThread->setFifoDebugEable(false);
77 }
152 }
78 }
153 }
79
154
@@ -44,18 +44,29 public:
44 ~ApbUartPlugin();
44 ~ApbUartPlugin();
45 int VID(){return driver_VID;}
45 int VID(){return driver_VID;}
46 int PID(){return driver_PID;}
46 int PID(){return driver_PID;}
47 int curentAPBUart();
47
48
48 public slots:
49 public slots:
49 unsigned int Write(unsigned int *Value,unsigned int count, unsigned int address=0);
50 unsigned int Write(unsigned int *Value,unsigned int count, unsigned int address=0);
50 unsigned int Read(unsigned int *Value,unsigned int count, unsigned int address=0);
51 unsigned int Read(unsigned int *Value,unsigned int count, unsigned int address=0);
51 void loopbackChangeState(int state);
52 void fifoDebugChangeState(int state);
52 void closeMe();
53 void closeMe();
53 void toggleUartState();
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 signals:
64 signals:
55
65
56 private:
66 private:
57 APBUART_Plugin_ui* UI;
67 APBUART_Plugin_ui* UI;
58 bool uartConnected;
68 bool uartConnected;
69 int p_curentAPBUart;
59 UARTPollingThread* UartThread;
70 UARTPollingThread* UartThread;
60 int enableLoopback();
71 int enableLoopback();
61 int disableLoopback();
72 int disableLoopback();
@@ -4,6 +4,7
4 #-------------------------------------------------
4 #-------------------------------------------------
5
5
6 CONFIG += socexplorerplugin
6 CONFIG += socexplorerplugin
7
7 win32:CONFIG += dll
8 win32:CONFIG += dll
8 win32:CONFIG -= static
9 win32:CONFIG -= static
9
10
@@ -35,14 +36,16 HEADERS += \
35 APBUARTPLUGIN.h \
36 APBUARTPLUGIN.h \
36 apbuartterminal.h \
37 apbuartterminal.h \
37 apbuart_plugin_ui.h \
38 apbuart_plugin_ui.h \
38 uartpollingthread.h
39 uartpollingthread.h \
40 apbuartpywrapper.h
39
41
40
42
41 SOURCES += \
43 SOURCES += \
42 APBUARTPLUGIN.cpp \
44 APBUARTPLUGIN.cpp \
43 apbuartterminal.cpp \
45 apbuartterminal.cpp \
44 apbuart_plugin_ui.cpp \
46 apbuart_plugin_ui.cpp \
45 uartpollingthread.cpp
47 uartpollingthread.cpp \
48 apbuartpywrapper.cpp
46
49
47 FORMS += \
50 FORMS += \
48 apbuart_plugin_ui.ui
51 apbuart_plugin_ui.ui
@@ -22,6 +22,7
22 #include "apbuart_plugin_ui.h"
22 #include "apbuart_plugin_ui.h"
23 #include "ui_apbuart_plugin_ui.h"
23 #include "ui_apbuart_plugin_ui.h"
24 #include "apbuartterminal.h"
24 #include "apbuartterminal.h"
25 #include <QComboBox>
25
26
26 APBUART_Plugin_ui::APBUART_Plugin_ui(QWidget *parent) :
27 APBUART_Plugin_ui::APBUART_Plugin_ui(QWidget *parent) :
27 QWidget(parent),
28 QWidget(parent),
@@ -35,6 +36,8 APBUART_Plugin_ui::APBUART_Plugin_ui(QWi
35 connect(this->ui->PortNameLineEdit,SIGNAL(textChanged(QString)),this,SIGNAL(PortNameChanged(QString)));
36 connect(this->ui->PortNameLineEdit,SIGNAL(textChanged(QString)),this,SIGNAL(PortNameChanged(QString)));
36 connect(this->ui->UartSpeedLineEdit,SIGNAL(textChanged(QString)),this,SIGNAL(UartSpeedChanged(QString)));
37 connect(this->ui->UartSpeedLineEdit,SIGNAL(textChanged(QString)),this,SIGNAL(UartSpeedChanged(QString)));
37 connect(this->ui->rescanQpb,SIGNAL(clicked()),this,SLOT(updatePortList()));
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 this->portListcompleter = NULL;
41 this->portListcompleter = NULL;
39 this->updatePortList();
42 this->updatePortList();
40 }
43 }
@@ -44,11 +47,22 APBUART_Plugin_ui::~APBUART_Plugin_ui()
44 delete ui;
47 delete ui;
45 }
48 }
46
49
50 int APBUART_Plugin_ui::curentAPBUart()
51 {
52 return this->ui->UARTSelector->currentIndex();
53 }
54
47 void APBUART_Plugin_ui::setEnableForLoopBack(bool enable)
55 void APBUART_Plugin_ui::setEnableForLoopBack(bool enable)
48 {
56 {
49 this->ui->PortNameLineEdit->setEnabled(enable);
57 this->ui->PortNameLineEdit->setEnabled(enable);
50 this->ui->ConnectQpb->setEnabled(enable);
58 this->ui->ConnectQpb->setEnabled(enable);
51 this->ui->UartSpeedLineEdit->setEnabled(enable);
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 void APBUART_Plugin_ui::setUartConnected(bool enable)
68 void APBUART_Plugin_ui::setUartConnected(bool enable)
@@ -56,6 +70,9 void APBUART_Plugin_ui::setUartConnected
56 this->ui->PortNameLineEdit->setDisabled(enable);
70 this->ui->PortNameLineEdit->setDisabled(enable);
57 this->ui->UartSpeedLineEdit->setDisabled(enable);
71 this->ui->UartSpeedLineEdit->setDisabled(enable);
58 this->ui->FIFODebugChkBx->setDisabled(enable);
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 if(enable)
76 if(enable)
60 {
77 {
61 this->ui->ConnectQpb->setText("Close Port");
78 this->ui->ConnectQpb->setText("Close Port");
@@ -90,6 +107,32 void APBUART_Plugin_ui::updatePortList()
90 this->portListcompleterModel->setStringList(wordList);
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 public:
37 public:
38 explicit APBUART_Plugin_ui(QWidget *parent = 0);
38 explicit APBUART_Plugin_ui(QWidget *parent = 0);
39 ~APBUART_Plugin_ui();
39 ~APBUART_Plugin_ui();
40
40 int curentAPBUart();
41 public slots:
41 public slots:
42 void setEnableForLoopBack(bool enable);
42 void setEnableForLoopBack(bool enable);
43 void setUartConnected(bool enable);
43 void setUartConnected(bool enable);
44 void updatePortList();
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 signals:
51 signals:
52 void curentAPBUartChanged(int index);
46 void loopbackChkBxStateChanged( int state );
53 void loopbackChkBxStateChanged( int state );
47 void apbUartTextReceived(QString text);
54 void apbUartTextReceived(QString text);
48 void connectPort();
55 void connectPort();
49 void sendChar(char c);
56 void sendChar(char c);
50 void UartSpeedChanged(QString text);
57 void UartSpeedChanged(QString text);
51 void PortNameChanged(QString text);
58 void PortNameChanged(QString text);
59 void updateAPBUartsList();
52 private:
60 private:
53 Ui::APBUART_Plugin_ui *ui;
61 Ui::APBUART_Plugin_ui *ui;
54 QCompleter *portListcompleter;
62 QCompleter *portListcompleter;
@@ -6,8 +6,8
6 <rect>
6 <rect>
7 <x>0</x>
7 <x>0</x>
8 <y>0</y>
8 <y>0</y>
9 <width>400</width>
9 <width>608</width>
10 <height>300</height>
10 <height>319</height>
11 </rect>
11 </rect>
12 </property>
12 </property>
13 <property name="windowTitle">
13 <property name="windowTitle">
@@ -24,20 +24,13
24 <string>Configuration</string>
24 <string>Configuration</string>
25 </attribute>
25 </attribute>
26 <layout class="QGridLayout" name="gridLayout">
26 <layout class="QGridLayout" name="gridLayout">
27 <item row="1" column="1">
27 <item row="2" column="0" colspan="3">
28 <widget class="QLineEdit" name="PortNameLineEdit"/>
28 <widget class="QGroupBox" name="Uartconfig">
29 </item>
29 <property name="title">
30 <item row="0" column="0" colspan="2">
30 <string>APB UART Config</string>
31 <widget class="QCheckBox" name="FIFODebugChkBx">
32 <property name="text">
33 <string>Enable FIFO debug mode</string>
34 </property>
31 </property>
35 <property name="checked">
32 <layout class="QGridLayout" name="gridLayout_2">
36 <bool>false</bool>
33 <item row="2" column="0">
37 </property>
38 </widget>
39 </item>
40 <item row="1" column="0">
41 <widget class="QLabel" name="PortNameLbl">
34 <widget class="QLabel" name="PortNameLbl">
42 <property name="text">
35 <property name="text">
43 <string>Port Name</string>
36 <string>Port Name</string>
@@ -51,17 +44,53
51 </property>
44 </property>
52 </widget>
45 </widget>
53 </item>
46 </item>
54 <item row="1" column="2">
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">
55 <widget class="QPushButton" name="rescanQpb">
68 <widget class="QPushButton" name="rescanQpb">
56 <property name="text">
69 <property name="text">
57 <string>Rescan ports</string>
70 <string>Rescan ports</string>
58 </property>
71 </property>
59 </widget>
72 </widget>
60 </item>
73 </item>
61 <item row="3" column="1" colspan="2">
74 <item row="2" column="1" colspan="2">
62 <widget class="QLineEdit" name="UartSpeedLineEdit"/>
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>
63 </item>
83 </item>
64 <item row="4" column="1" colspan="2">
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">
65 <widget class="QPushButton" name="ConnectQpb">
94 <widget class="QPushButton" name="ConnectQpb">
66 <property name="text">
95 <property name="text">
67 <string>Open Port</string>
96 <string>Open Port</string>
@@ -70,6 +99,9
70 </item>
99 </item>
71 </layout>
100 </layout>
72 </widget>
101 </widget>
102 </item>
103 </layout>
104 </widget>
73 <widget class="QWidget" name="Terminal">
105 <widget class="QWidget" name="Terminal">
74 <attribute name="title">
106 <attribute name="title">
75 <string>Terminal</string>
107 <string>Terminal</string>
@@ -29,7 +29,7 UARTPollingThread::UARTPollingThread(soc
29 uartMutex = new QMutex();
29 uartMutex = new QMutex();
30 uartOpened = false;
30 uartOpened = false;
31 fifoDebugConfigured = false;
31 fifoDebugConfigured = false;
32 fifoDebugEnabled = false;
32 p_fifoDebugEnabled = false;
33 this->moveToThread(this);
33 this->moveToThread(this);
34 }
34 }
35
35
@@ -47,7 +47,7 void UARTPollingThread::run()
47 SocExplorerEngine::message(this->plugin,"Entering APB UART polling thread",3);
47 SocExplorerEngine::message(this->plugin,"Entering APB UART polling thread",3);
48 while (!this->isInterruptionRequested())
48 while (!this->isInterruptionRequested())
49 {
49 {
50 if(fifoDebugEnabled)
50 if(p_fifoDebugEnabled)
51 {
51 {
52 if(fifoDebugConfigured)
52 if(fifoDebugConfigured)
53 {
53 {
@@ -113,7 +113,7 void UARTPollingThread::run()
113
113
114 void UARTPollingThread::sendChar(char c)
114 void UARTPollingThread::sendChar(char c)
115 {
115 {
116 if(fifoDebugEnabled)
116 if(p_fifoDebugEnabled)
117 {
117 {
118 if(this->plugin->baseAddress()!=-1)
118 if(this->plugin->baseAddress()!=-1)
119 {
119 {
@@ -186,7 +186,12 void UARTPollingThread::setFifoDebugEabl
186 }
186 }
187 this->fifoDebugConfigured = false;
187 this->fifoDebugConfigured = false;
188 configFifoDebug(enable);
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 void UARTPollingThread::configFifoDebug(bool enable)
197 void UARTPollingThread::configFifoDebug(bool enable)
@@ -51,9 +51,10 public slots:
51 void setPortSpeedStr(QString speed);
51 void setPortSpeedStr(QString speed);
52 void setPortSpeed(int speed);
52 void setPortSpeed(int speed);
53 void setFifoDebugEable(bool enable);
53 void setFifoDebugEable(bool enable);
54 bool fifoDebugEnabled();
54 private:
55 private:
55 void configFifoDebug(bool enable);
56 void configFifoDebug(bool enable);
56 bool fifoDebugEnabled;
57 bool p_fifoDebugEnabled;
57 bool fifoDebugConfigured;
58 bool fifoDebugConfigured;
58 QString portName;
59 QString portName;
59 int uartSpeed;
60 int uartSpeed;
@@ -86,8 +86,6 int ahbuartplugin::registermenu(QMainWin
86 }
86 }
87
87
88
88
89
90
91 bool ahbuartplugin::checkConnection()
89 bool ahbuartplugin::checkConnection()
92 {
90 {
93 QTime timeout;
91 QTime timeout;
@@ -357,9 +355,9 unsigned int ahbuartplugin::Write(unsign
357 progress = SocExplorerEngine::getProgressBar("Writing on uart @0x"+QString::number(address,16)+" %v of "+QString::number(count)+" words ",count);
355 progress = SocExplorerEngine::getProgressBar("Writing on uart @0x"+QString::number(address,16)+" %v of "+QString::number(count)+" words ",count);
358 int offset = 0;
356 int offset = 0;
359 char* CMD= (char*)malloc((32*4)+5);
357 char* CMD= (char*)malloc((32*4)+5);
358 writen=0;
360 while(count>32)
359 while(count>32)
361 {
360 {
362 writen=0;
363 CMD[0] = 0xC0 | (32-1);
361 CMD[0] = 0xC0 | (32-1);
364 CMD[1] = (char)(((unsigned int)address>>24)&0xFF);
362 CMD[1] = (char)(((unsigned int)address>>24)&0xFF);
365 CMD[2] = (char)(((unsigned int)address>>16)&0xFF);
363 CMD[2] = (char)(((unsigned int)address>>16)&0xFF);
@@ -409,7 +407,7 unsigned int ahbuartplugin::Write(unsign
409 SocExplorerEngine::deleteProgressBar(progress);
407 SocExplorerEngine::deleteProgressBar(progress);
410 }
408 }
411 free(CMD);
409 free(CMD);
412 emit this->addWritenBytes(writen);
410 emit this->addWritenBytes(writen*4);
413 return writen;
411 return writen;
414 }
412 }
415 return 0;
413 return 0;
@@ -1,7 +1,9
1 #ifndef AHBUARTPYWRAPPER_H
1 #ifndef AHBUARTPYWRAPPER_H
2 #define AHBUARTPYWRAPPER_H
2 #define AHBUARTPYWRAPPER_H
3 #include <socexplorerplugin.h>
3 #include <genericPySysdriver.h>
4 #include <genericPySysdriver.h>
4 #include <QString>
5 #include <QString>
6 #include <qobject.h>
5
7
6 class ahbuartPywrapper : public genericPySysdriver
8 class ahbuartPywrapper : public genericPySysdriver
7 {
9 {
General Comments 0
You need to be logged in to leave comments. Login now