Line 1... |
Line 1... |
// $Id: RlinkPortFifo.cpp 607 2014-11-30 20:02:48Z mueller $
|
// $Id: RlinkPortFifo.cpp 666 2015-04-12 21:17:54Z mueller $
|
//
|
//
|
// Copyright 2011-2013 y Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
// Copyright 2011-2015 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
//
|
//
|
// This program is free software; you may redistribute and/or modify it under
|
// This program is free software; you may redistribute and/or modify it under
|
// the terms of the GNU General Public License as published by the Free
|
// the terms of the GNU General Public License as published by the Free
|
// Software Foundation, either version 2, or at your option any later version.
|
// Software Foundation, either version 2, or at your option any later version.
|
//
|
//
|
Line 11... |
Line 11... |
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
// for complete details.
|
// for complete details.
|
//
|
//
|
// Revision History:
|
// Revision History:
|
// Date Rev Version Comment
|
// Date Rev Version Comment
|
|
// 2015-04-12 666 1.2 add xon,noinit attributes
|
// 2013-02-23 492 1.1 use RparseUrl
|
// 2013-02-23 492 1.1 use RparseUrl
|
// 2011-03-27 374 1.0 Initial version
|
// 2011-03-27 374 1.0 Initial version
|
// 2011-01-15 356 0.1 First draft
|
// 2011-01-15 356 0.1 First draft
|
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
|
|
/*!
|
/*!
|
\file
|
\file
|
\version $Id: RlinkPortFifo.cpp 607 2014-11-30 20:02:48Z mueller $
|
\version $Id: RlinkPortFifo.cpp 666 2015-04-12 21:17:54Z mueller $
|
\brief Implemenation of RlinkPortFifo.
|
\brief Implemenation of RlinkPortFifo.
|
*/
|
*/
|
|
|
#include <sys/types.h>
|
#include <sys/types.h>
|
#include <sys/stat.h>
|
#include <sys/stat.h>
|
Line 62... |
Line 63... |
|
|
bool RlinkPortFifo::Open(const std::string& url, RerrMsg& emsg)
|
bool RlinkPortFifo::Open(const std::string& url, RerrMsg& emsg)
|
{
|
{
|
if (IsOpen()) Close();
|
if (IsOpen()) Close();
|
|
|
if (!fUrl.Set(url, "|keep|", emsg)) return false;
|
if (!fUrl.Set(url, "|keep|xon|noinit|", emsg)) return false;
|
|
|
// Note: _rx fifo must be opened before the _tx fifo, otherwise the test
|
// Note: _rx fifo must be opened before the _tx fifo, otherwise the test
|
// bench might close with EOF on read prematurely (is a race condition).
|
// bench might close with EOF on read prematurely (is a race condition).
|
|
|
fFdWrite = OpenFifo(fUrl.Path() + "_rx", true, emsg);
|
fFdWrite = OpenFifo(fUrl.Path() + "_rx", true, emsg);
|
Line 77... |
Line 78... |
close(fFdWrite);
|
close(fFdWrite);
|
fFdWrite = -1;
|
fFdWrite = -1;
|
return false;
|
return false;
|
}
|
}
|
|
|
|
fXon = fUrl.FindOpt("xon");
|
fIsOpen = true;
|
fIsOpen = true;
|
|
|
return true;
|
return true;
|
}
|
}
|
|
|