diff --git a/APBUARTPLUGIN/APBUARTPLUGIN.h b/APBUARTPLUGIN/APBUARTPLUGIN.h --- a/APBUARTPLUGIN/APBUARTPLUGIN.h +++ b/APBUARTPLUGIN/APBUARTPLUGIN.h @@ -27,17 +27,15 @@ #include #include -#include #include #include "apbuart_plugin_ui.h" - +#include "uartpollingthread.h" #define APB_UART_DATA_REG 0x0 #define APB_UART_STATUS_REG 0x4 #define APB_UART_CONTROL_REG 0x8 #define APB_UART_SCALE_REG 0xC #define APB_UART_FIFO_DEBUG_REG 0x10 - class ApbUartPlugin : public socexplorerplugin { Q_OBJECT diff --git a/APBUARTPLUGIN/APBUARTPLUGIN.pro b/APBUARTPLUGIN/APBUARTPLUGIN.pro --- a/APBUARTPLUGIN/APBUARTPLUGIN.pro +++ b/APBUARTPLUGIN/APBUARTPLUGIN.pro @@ -33,18 +33,16 @@ INCLUDEPATH += \ HEADERS += \ APBUARTPLUGIN.h \ - apbuartpluginui.h \ - apbuartcfg.h \ apbuartterminal.h \ - apbuart_plugin_ui.h + apbuart_plugin_ui.h \ + uartpollingthread.h SOURCES += \ APBUARTPLUGIN.cpp \ - apbuartpluginui.cpp \ - apbuartcfg.cpp \ apbuartterminal.cpp \ - apbuart_plugin_ui.cpp + apbuart_plugin_ui.cpp \ + uartpollingthread.cpp FORMS += \ apbuart_plugin_ui.ui diff --git a/APBUARTPLUGIN/apbuartcfg.cpp b/APBUARTPLUGIN/apbuartcfg.cpp deleted file mode 100644 --- a/APBUARTPLUGIN/apbuartcfg.cpp +++ /dev/null @@ -1,33 +0,0 @@ -/*------------------------------------------------------------------------------ --- This file is a part of the SocExplorer Software --- Copyright (C) 2013, Plasma Physics Laboratory - CNRS --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 3 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --------------------------------------------------------------------------------*/ -/*-- Author : Alexis Jeandet --- Mail : alexis.jeandet@member.fsf.org -----------------------------------------------------------------------------*/ -#include "apbuartcfg.h" - -ApbUartCfg::ApbUartCfg(QWidget *parent) : - QWidget(parent) -{ - this->mainLayout = new QGridLayout(this); - this->loopbackChkBx = new QCheckBox(tr("Enable loopback"),this); - this->loopbackChkBx->setChecked(true); - this->mainLayout->addWidget(this->loopbackChkBx); - this->setLayout(this->mainLayout); - connect(this->loopbackChkBx,SIGNAL(stateChanged(int)),this,SIGNAL(loopbackChkBxStateChanged(int))); -} diff --git a/APBUARTPLUGIN/apbuartcfg.h b/APBUARTPLUGIN/apbuartcfg.h deleted file mode 100644 --- a/APBUARTPLUGIN/apbuartcfg.h +++ /dev/null @@ -1,46 +0,0 @@ -/*------------------------------------------------------------------------------ --- This file is a part of the SocExplorer Software --- Copyright (C) 2013, Plasma Physics Laboratory - CNRS --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 3 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --------------------------------------------------------------------------------*/ -/*-- Author : Alexis Jeandet --- Mail : alexis.jeandet@member.fsf.org -----------------------------------------------------------------------------*/ -#ifndef APBUARTCFG_H -#define APBUARTCFG_H - -#include -#include -#include -#include - -class ApbUartCfg : public QWidget -{ - Q_OBJECT -public: - explicit ApbUartCfg(QWidget *parent = 0); - -signals: - void loopbackChkBxStateChanged( int state ); -public slots: - -private: - QCheckBox* loopbackChkBx; - QGridLayout* mainLayout; - -}; - -#endif // APBUARTCFG_H diff --git a/APBUARTPLUGIN/apbuartpluginui.cpp b/APBUARTPLUGIN/apbuartpluginui.cpp deleted file mode 100644 --- a/APBUARTPLUGIN/apbuartpluginui.cpp +++ /dev/null @@ -1,34 +0,0 @@ -/*------------------------------------------------------------------------------ --- This file is a part of the SocExplorer Software --- Copyright (C) 2013, Plasma Physics Laboratory - CNRS --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 3 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --------------------------------------------------------------------------------*/ -/*-- Author : Alexis Jeandet --- Mail : alexis.jeandet@member.fsf.org -----------------------------------------------------------------------------*/ -#include "apbuartpluginui.h" - -ApbUartPluginUi::ApbUartPluginUi(QWidget *parent) : - QTabWidget(parent) -{ - this->terminal = new ApbUartTerminal(this); - this->cfg = new ApbUartCfg(this); - - this->addTab(this->cfg,"Config"); - this->addTab(this->terminal,"terminal"); - connect(this->cfg,SIGNAL(loopbackChkBxStateChanged(int)),this,SIGNAL(loopbackChkBxStateChanged(int))); - connect(this,SIGNAL(apbUartTextReceived(QString)),this->terminal,SIGNAL(apbUartTextReceived(QString))); -} diff --git a/APBUARTPLUGIN/apbuartpluginui.h b/APBUARTPLUGIN/apbuartpluginui.h deleted file mode 100644 --- a/APBUARTPLUGIN/apbuartpluginui.h +++ /dev/null @@ -1,51 +0,0 @@ -/*------------------------------------------------------------------------------ --- This file is a part of the SocExplorer Software --- Copyright (C) 2013, Plasma Physics Laboratory - CNRS --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 3 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --------------------------------------------------------------------------------*/ -/*-- Author : Alexis Jeandet --- Mail : alexis.jeandet@member.fsf.org -----------------------------------------------------------------------------*/ -#ifndef APBUARTPLUGINUI_H -#define APBUARTPLUGINUI_H - -#include "apbuartcfg.h" -#include -#include -#include -#include -#include -#include -#include -#include "apbuartterminal.h" - -class ApbUartPluginUi : public QTabWidget -{ - Q_OBJECT -public: - explicit ApbUartPluginUi(QWidget *parent = 0); - -signals: - void loopbackChkBxStateChanged( int state ); - void apbUartTextReceived(QString text); -public slots: - -private: - ApbUartCfg* cfg; - ApbUartTerminal* terminal; -}; - -#endif // APBUARTPLUGINUI_H diff --git a/APBUARTPLUGIN/uartpollingthread.cpp b/APBUARTPLUGIN/uartpollingthread.cpp new file mode 100644 --- /dev/null +++ b/APBUARTPLUGIN/uartpollingthread.cpp @@ -0,0 +1,70 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the SocExplorer Software +-- Copyright (C) 2014, Plasma Physics Laboratory - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +----------------------------------------------------------------------------*/ +#include "uartpollingthread.h" +#include +#include + +UARTPollingThread::UARTPollingThread(socexplorerplugin *parent) : + QThread((QObject*)parent) +{ + this->plugin = parent; + rs232open("/dev/ttyUS0"); +} + +void UARTPollingThread::run() +{ + while (!this->isInterruptionRequested()) + { + if(fifoDebugEnabled) + { + if(this->plugin->baseAddress()!=-1) + { + unsigned int status_reg,data; + char ch; + QString printdata=""; + plugin->parent->Read(&status_reg,1,this->plugin->baseAddress()+APB_UART_STATUS_REG); + while ((status_reg&4)==0) { + plugin->parent->Read(&data,1,this->plugin->baseAddress()+APB_UART_FIFO_DEBUG_REG); + ch = (char)(0xff & data); + printdata+=ch; + plugin->parent->Read(&status_reg,1,this->plugin->baseAddress()+APB_UART_STATUS_REG); + } + if(printdata!="") + emit apbUartTextReceived(printdata); + } + else + { + this->plugin->setBaseAddress(SocExplorerEngine::self()->getEnumDeviceBaseAddress(this->plugin,this->plugin->VID(),this->plugin->PID(),0)); + } + } + if(uartOpened) + { + + } + msleep(100); + } +} + +void UARTPollingThread::sendChar(char c) +{ + +} diff --git a/APBUARTPLUGIN/uartpollingthread.h b/APBUARTPLUGIN/uartpollingthread.h new file mode 100644 --- /dev/null +++ b/APBUARTPLUGIN/uartpollingthread.h @@ -0,0 +1,53 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the SocExplorer Software +-- Copyright (C) 2014, Plasma Physics Laboratory - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +----------------------------------------------------------------------------*/ +#ifndef UARTPOLLINGTHREAD_H +#define UARTPOLLINGTHREAD_H + +#include +#include +#include + +#define APB_UART_DATA_REG 0x0 +#define APB_UART_STATUS_REG 0x4 +#define APB_UART_CONTROL_REG 0x8 +#define APB_UART_SCALE_REG 0xC +#define APB_UART_FIFO_DEBUG_REG 0x10 + +class UARTPollingThread : public QThread +{ + Q_OBJECT +public: + explicit UARTPollingThread(socexplorerplugin *parent = 0); + void run(); +signals: + void apbUartTextReceived(QString text); +public slots: + void sendChar(char c); +private: + bool fifoDebugEnabled; + QString portName; + int uartSpeed; + bool uartOpened; + socexplorerplugin* plugin; +}; + +#endif // UARTPOLLINGTHREAD_H diff --git a/ahbuartplugin/ahbuartplugin.h b/ahbuartplugin/ahbuartplugin.h --- a/ahbuartplugin/ahbuartplugin.h +++ b/ahbuartplugin/ahbuartplugin.h @@ -31,13 +31,8 @@ #include #include #include "ahbuartpluginui.h" +#include -#ifdef WinRs232 - #include "librs232/RS232.h" -#else - #include - #undef debug -#endif diff --git a/ahbuartplugin/ahbuartplugin.pro b/ahbuartplugin/ahbuartplugin.pro --- a/ahbuartplugin/ahbuartplugin.pro +++ b/ahbuartplugin/ahbuartplugin.pro @@ -26,9 +26,6 @@ DEFINES += driver_PID=0 -win32:LIBS += $${PWD}/librs232/bin/librs232-2.1.a -unix:LIBS += -lrs232-2.1 - INCLUDEPATH += \ $${PWD} @@ -42,18 +39,11 @@ HEADERS += \ -win32:HEADERS+=librs232/RS232.h -win32:INCLUDEPATH+=librs232 - SOURCES += \ ahbuartplugin.cpp \ ahbuartpluginui.cpp \ ahbuartpywrapper.cpp - -OTHER_FILES += \ - librs232/bin/librs232-1.0-1.dll - FORMS += \ ahbuartpluginui.ui diff --git a/ahbuartplugin/librs232/RS232.h b/ahbuartplugin/librs232/RS232.h deleted file mode 100644 --- a/ahbuartplugin/librs232/RS232.h +++ /dev/null @@ -1,52 +0,0 @@ -// SOPSUYSI_RS232.h -#ifndef RS232_H -#define RS232_H -//#define debug - -#define badPortValue -1 -#define rs232noerr 0 -typedef int rs232port_t; -typedef int rs232speed_t; -typedef enum {rs232OneStop,rs232One5Stop,rs232TwoStop}rs232stop; -typedef enum {rs232parityNo,rs232parityOdd,rs232parityEven}rs232parity; - -#ifdef __cplusplus -extern "C" { -#endif -typedef struct rs232portslist_t -{ - char* name; - struct rs232portslist_t* next; -}rs232portslist_t; -#ifdef __cplusplus -} -#endif - - -#ifdef __cplusplus - #define rs232extern extern "C" -#else - #define rs232extern extern -#endif -rs232extern rs232port_t rs232open(char* psPortName); -rs232extern rs232portslist_t* rs232getportlist(); -rs232extern void rs232deleteportlist(rs232portslist_t* list); -rs232extern int rs232close(rs232port_t fd); -rs232extern int rs232setup(rs232port_t fd, int ChSize, int BaudeRate, rs232parity Parity, rs232stop NbStop); -rs232extern int rs232write(rs232port_t fd,char *psWrite, int WriteBufferSize); -rs232extern int rs232read(rs232port_t fd,char *psRead, int ReadBufferSize); -rs232extern int rs232setparity(rs232port_t fd, rs232parity Parity); -rs232extern int rs232setnbstop(rs232port_t fd, rs232stop NbStop); -rs232extern int rs232setcsize(rs232port_t fd, int ChSize); -rs232extern int rs232setbaudrate(rs232port_t fd, int baudrate); -rs232extern int rs232setRTS(rs232port_t fd); -rs232extern int rs232clearRTS(rs232port_t fd); -rs232extern int rs232setDTR(rs232port_t fd); -rs232extern int rs232clearDTR(rs232port_t fd); -rs232extern int rs232saferead(rs232port_t fd,char* data,int count ); -rs232extern int rs232safewrite(rs232port_t fd,char* data,int count); - -#endif - - - diff --git a/ahbuartplugin/librs232/bin/librs232-2.1.a b/ahbuartplugin/librs232/bin/librs232-2.1.a deleted file mode 100644 index 0e82aeec19aa8d53ad83642f99d91f60ac7614ae..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 GIT binary patch literal 0 Hc$@ header file. */ -#define HAVE_DIRENT_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_DLFCN_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_ERRNO_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_FCNTL_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MEMORY_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDIO_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_TERMIOS_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_TERMIO_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_WINDOWS_H 1 - -/* Define to the sub-directory in which libtool stores uninstalled libraries. - */ -#define LT_OBJDIR ".libs/" - -/* Name of package */ -#define PACKAGE "rs232" - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "alexis.jeandet@lpp.polytechnique.fr" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "librs232" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "librs232 2.1.0" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "rs232" - -/* Define to the home page for this package. */ -#define PACKAGE_URL "http://www.lpp.fr" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "2.1.0" - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Version number of package */ -#define VERSION "2.1.0" - -/* Define to empty if `const' does not conform to ANSI C. */ -/* #undef const */ diff --git a/spwplugin/GR-ESB/gr_esb_bridge.cpp b/spwplugin/GR-ESB/gr_esb_bridge.cpp --- a/spwplugin/GR-ESB/gr_esb_bridge.cpp +++ b/spwplugin/GR-ESB/gr_esb_bridge.cpp @@ -1,3 +1,24 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the SocExplorer Software +-- Copyright (C) 2014, Plasma Physics Laboratory - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +----------------------------------------------------------------------------*/ #include "gr_esb_bridge.h" #include "gr_esb_ui.h" #include