##// END OF EJS Templates
Removed lppserial from ahbuart now uses the one provided by socexplorercommon.
Removed lppserial from ahbuart now uses the one provided by socexplorercommon.

File last commit:

r27:8bc9664f2835 default
r27:8bc9664f2835 default
Show More
uartpollingthread.cpp
70 lines | 2.5 KiB | text/x-c | CppLexer
/*------------------------------------------------------------------------------
-- 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 <RS232.h>
#include <socexplorerengine.h>
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)
{
}