w11 - cpp 0.794
Backend server for Rlink and w11
|
FIXME_docs. More...
#include <RlinkPortCuff.hpp>
Public Types | |
enum | stats { kStatNPollAddCB = RlinkPort::kDimStat , kStatNPollRemoveCB , kStatNUSBWrite , kStatNUSBRead , kDimStat } |
enum | loopState { kLoopStateStopped , kLoopStateRunning , kLoopStateStopping } |
Public Types inherited from Retro::RlinkPort | |
enum | stats { kStatNPortWrite = 0 , kStatNPortRead , kStatNPortTxByt , kStatNPortRxByt , kStatNPortRawWrite , kStatNPortRawRead , kDimStat } |
typedef std::unique_ptr< RlinkPort > | port_uptr_t |
Public Member Functions | |
RlinkPortCuff () | |
Default constructor. | |
virtual | ~RlinkPortCuff () |
Destructor. | |
virtual bool | Open (const std::string &url, RerrMsg &emsg) |
FIXME_docs. | |
virtual void | Close () |
FIXME_docs. | |
Public Member Functions inherited from Retro::RlinkPort | |
RlinkPort () | |
Default constructor. | |
virtual | ~RlinkPort () |
Destructor. | |
RlinkPort (const RlinkPort &)=delete | |
RlinkPort & | operator= (const RlinkPort &)=delete |
virtual bool | Open (const std::string &url, RerrMsg &emsg)=0 |
virtual void | Close () |
FIXME_docs. | |
virtual int | Read (uint8_t *buf, size_t size, const Rtime &timeout, RerrMsg &emsg) |
FIXME_docs. | |
virtual int | Write (const uint8_t *buf, size_t size, RerrMsg &emsg) |
FIXME_docs. | |
virtual bool | PollRead (const Rtime &timeout) |
FIXME_docs. | |
int | RawRead (uint8_t *buf, size_t size, bool exactsize, const Rtime &timeout, Rtime &tused, RerrMsg &emsg) |
FIXME_docs. | |
int | RawWrite (const uint8_t *buf, size_t size, RerrMsg &emsg) |
FIXME_docs. | |
bool | IsOpen () const |
FIXME_docs. | |
const RparseUrl & | Url () const |
FIXME_docs. | |
bool | XonEnable () const |
FIXME_docs. | |
int | FdRead () const |
FIXME_docs. | |
int | FdWrite () const |
FIXME_docs. | |
void | SetLogFile (const std::shared_ptr< RlogFile > &splog) |
FIXME_docs. | |
void | SetTraceLevel (uint32_t level) |
FIXME_docs. | |
uint32_t | TraceLevel () const |
FIXME_docs. | |
Rstats & | Stats () |
FIXME_docs. | |
virtual void | Dump (std::ostream &os, int ind=0, const char *text=0, int detail=0) const |
FIXME_docs. | |
Static Public Attributes | |
static const size_t | kUSBBufferSize = 4096 |
USB buffer size. | |
static const int | kUSBWriteEP = 4 |
USB write endpoint. | |
static const int | kUSBReadEP = 6 |
USB read endpoint. | |
static const size_t | kUSBReadQueue = 2 |
USB read queue length. | |
Static Public Attributes inherited from Retro::RlinkPort | |
static const int | kEof = 0 |
return code: end-of-file | |
static const int | kTout = -1 |
return code: time out | |
static const int | kErr = -2 |
return code: IO error | |
Protected Attributes | |
int | fFdReadDriver |
fd for read (driver end) | |
int | fFdWriteDriver |
fd for write (driver end) | |
std::thread | fDriverThread |
driver thread | |
libusb_context * | fpUsbContext |
libusb_device ** | fpUsbDevList |
ssize_t | fUsbDevCount |
libusb_device_handle * | fpUsbDevHdl |
loopState | fLoopState |
std::vector< pollfd > | fPollFds |
std::deque< libusb_transfer * > | fWriteQueueFree |
std::deque< libusb_transfer * > | fWriteQueuePending |
std::deque< libusb_transfer * > | fReadQueuePending |
Protected Attributes inherited from Retro::RlinkPort | |
bool | fIsOpen |
is open flag | |
RparseUrl | fUrl |
parsed url | |
bool | fXon |
xon attribute set | |
int | fFdRead |
fd for read | |
int | fFdWrite |
fd for write | |
std::shared_ptr< RlogFile > | fspLog |
log file ptr | |
uint32_t | fTraceLevel |
trace level | |
Rtime | fTsLastRead |
time stamp last write | |
Rtime | fTsLastWrite |
time stamp last write | |
Rstats | fStats |
statistics | |
Private Member Functions | |
void | Cleanup () |
FIXME_docs. | |
bool | OpenPipe (int &fdread, int &fdwrite, RerrMsg &emsg) |
FIXME_docs. | |
void | Driver () |
FIXME_docs. | |
void | DriverEventWritePipe () |
FIXME_docs. | |
void | DriverEventUSB () |
FIXME_docs. | |
libusb_transfer * | NewWriteTransfer () |
FIXME_docs. | |
bool | TraceOn () |
FIXME_docs. | |
void | BadSysCall (const char *meth, const char *text, int rc) |
FIXME_docs. | |
void | BadUSBCall (const char *meth, const char *text, int rc) |
FIXME_docs. | |
void | CheckUSBTransfer (const char *meth, libusb_transfer *t) |
FIXME_docs. | |
const char * | USBErrorName (int rc) |
FIXME_docs. | |
void | PollfdAdd (int fd, short events) |
FIXME_docs. | |
void | PollfdRemove (int fd) |
FIXME_docs. | |
void | USBWriteDone (libusb_transfer *t) |
FIXME_docs. | |
void | USBReadDone (libusb_transfer *t) |
FIXME_docs. | |
Static Private Member Functions | |
static void | ThunkPollfdAdd (int fd, short events, void *udata) |
FIXME_docs. | |
static void | ThunkPollfdRemove (int fd, void *udata) |
FIXME_docs. | |
static void | ThunkUSBWriteDone (libusb_transfer *t) |
FIXME_docs. | |
static void | ThunkUSBReadDone (libusb_transfer *t) |
FIXME_docs. | |
Additional Inherited Members | |
Protected Member Functions inherited from Retro::RlinkPort | |
void | CloseFd (int &fd) |
FIXME_docs. | |
FIXME_docs.
Definition at line 31 of file RlinkPortCuff.hpp.
Enumerator | |
---|---|
kStatNPollAddCB | |
kStatNPollRemoveCB | |
kStatNUSBWrite | |
kStatNUSBRead | |
kDimStat |
Definition at line 47 of file RlinkPortCuff.hpp.
Enumerator | |
---|---|
kLoopStateStopped | |
kLoopStateRunning | |
kLoopStateStopping |
Definition at line 56 of file RlinkPortCuff.hpp.
Retro::RlinkPortCuff::RlinkPortCuff | ( | ) |
Default constructor.
Definition at line 64 of file RlinkPortCuff.cpp.
References Retro::Rstats::Define(), Retro::RlinkPort::fStats, kStatNPollAddCB, kStatNPollRemoveCB, kStatNUSBRead, and kStatNUSBWrite.
|
virtual |
Destructor.
Definition at line 83 of file RlinkPortCuff.cpp.
References Retro::Rtools::Catch2Cerr(), Close(), and Retro::RlinkPort::IsOpen().
|
virtual |
FIXME_docs.
Implements Retro::RlinkPort.
Definition at line 92 of file RlinkPortCuff.cpp.
References Cleanup(), Close(), Driver(), fDriverThread, Retro::RlinkPort::fFdRead, fFdReadDriver, Retro::RlinkPort::fFdWrite, fFdWriteDriver, Retro::RlinkPort::fIsOpen, fPollFds, fpUsbContext, fpUsbDevHdl, fpUsbDevList, Retro::RlinkPort::fUrl, fUsbDevCount, Retro::RerrMsg::Init(), Retro::RlinkPort::IsOpen(), OpenPipe(), Retro::RparseUrl::Path(), PollfdAdd(), Retro::RparseUrl::Set(), Retro::RparseUrl::SetPath(), Retro::Rtools::String2Long(), ThunkPollfdAdd(), ThunkPollfdRemove(), TraceOn(), and USBErrorName().
|
virtual |
FIXME_docs.
Reimplemented from Retro::RlinkPort.
Definition at line 250 of file RlinkPortCuff.cpp.
References Cleanup(), Retro::RlinkPort::Close(), Retro::RlinkPort::IsOpen(), and TraceOn().
Referenced by Open(), and ~RlinkPortCuff().
|
private |
FIXME_docs.
Definition at line 265 of file RlinkPortCuff.cpp.
References Retro::RlinkPort::CloseFd(), fDriverThread, Retro::RlinkPort::fFdRead, fFdReadDriver, Retro::RlinkPort::fFdWrite, fFdWriteDriver, fPollFds, fpUsbContext, fpUsbDevHdl, and fpUsbDevList.
|
private |
FIXME_docs.
Definition at line 302 of file RlinkPortCuff.cpp.
References Retro::RerrMsg::InitErrno().
Referenced by Open().
|
private |
FIXME_docs.
Definition at line 323 of file RlinkPortCuff.cpp.
References BadSysCall(), BadUSBCall(), DriverEventUSB(), DriverEventWritePipe(), fFdReadDriver, fLoopState, fPollFds, fpUsbDevHdl, fReadQueuePending, fWriteQueuePending, kLoopStateRunning, kLoopStateStopped, kLoopStateStopping, kUSBBufferSize, kUSBReadEP, kUSBReadQueue, ThunkUSBReadDone(), and TraceOn().
Referenced by Open().
|
private |
FIXME_docs.
Definition at line 412 of file RlinkPortCuff.cpp.
References BadSysCall(), BadUSBCall(), fFdWriteDriver, fLoopState, fWriteQueuePending, kLoopStateStopping, kUSBBufferSize, NewWriteTransfer(), and TraceOn().
Referenced by Driver().
|
private |
FIXME_docs.
Definition at line 439 of file RlinkPortCuff.cpp.
References BadUSBCall(), and fpUsbContext.
Referenced by Driver().
|
private |
FIXME_docs.
Definition at line 455 of file RlinkPortCuff.cpp.
References fpUsbDevHdl, fWriteQueueFree, kUSBBufferSize, kUSBWriteEP, and ThunkUSBWriteDone().
Referenced by DriverEventWritePipe().
|
private |
FIXME_docs.
Definition at line 483 of file RlinkPortCuff.cpp.
References Retro::RparseUrl::FindOpt(), and Retro::RlinkPort::fUrl.
Referenced by Close(), Driver(), DriverEventWritePipe(), Open(), USBReadDone(), and USBWriteDone().
|
private |
FIXME_docs.
Definition at line 502 of file RlinkPortCuff.cpp.
Referenced by Driver(), DriverEventWritePipe(), and USBReadDone().
|
private |
FIXME_docs.
Definition at line 514 of file RlinkPortCuff.cpp.
References USBErrorName().
Referenced by Driver(), DriverEventUSB(), DriverEventWritePipe(), and USBReadDone().
|
private |
FIXME_docs.
Definition at line 525 of file RlinkPortCuff.cpp.
Referenced by USBReadDone(), and USBWriteDone().
|
private |
FIXME_docs.
Definition at line 545 of file RlinkPortCuff.cpp.
Referenced by BadUSBCall(), and Open().
|
private |
FIXME_docs.
Definition at line 587 of file RlinkPortCuff.cpp.
References fPollFds, Retro::RlinkPort::fStats, Retro::Rstats::Inc(), and kStatNPollAddCB.
Referenced by Open(), and ThunkPollfdAdd().
|
private |
FIXME_docs.
Definition at line 601 of file RlinkPortCuff.cpp.
References fPollFds, Retro::RlinkPort::fStats, Retro::Rstats::Inc(), and kStatNPollRemoveCB.
Referenced by ThunkPollfdRemove().
|
private |
FIXME_docs.
Definition at line 617 of file RlinkPortCuff.cpp.
References CheckUSBTransfer(), fLoopState, Retro::RlinkPort::fStats, fWriteQueueFree, fWriteQueuePending, Retro::Rstats::Inc(), kLoopStateRunning, kStatNUSBWrite, and TraceOn().
Referenced by ThunkUSBWriteDone().
|
private |
FIXME_docs.
Definition at line 641 of file RlinkPortCuff.cpp.
References BadSysCall(), BadUSBCall(), CheckUSBTransfer(), fFdReadDriver, fLoopState, fReadQueuePending, Retro::RlinkPort::fStats, Retro::Rstats::Inc(), kLoopStateRunning, kStatNUSBRead, and TraceOn().
Referenced by ThunkUSBReadDone().
|
staticprivate |
FIXME_docs.
Definition at line 678 of file RlinkPortCuff.cpp.
References PollfdAdd().
Referenced by Open().
|
staticprivate |
FIXME_docs.
Definition at line 688 of file RlinkPortCuff.cpp.
References PollfdRemove().
Referenced by Open().
|
staticprivate |
FIXME_docs.
Definition at line 698 of file RlinkPortCuff.cpp.
References USBWriteDone().
Referenced by NewWriteTransfer().
|
staticprivate |
FIXME_docs.
Definition at line 708 of file RlinkPortCuff.cpp.
References USBReadDone().
Referenced by Driver().
|
static |
USB buffer size.
Definition at line 41 of file RlinkPortCuff.hpp.
Referenced by Driver(), DriverEventWritePipe(), and NewWriteTransfer().
|
static |
USB write endpoint.
Definition at line 42 of file RlinkPortCuff.hpp.
Referenced by NewWriteTransfer().
|
static |
|
static |
|
protected |
fd for read (driver end)
Definition at line 63 of file RlinkPortCuff.hpp.
Referenced by Cleanup(), Driver(), Open(), and USBReadDone().
|
protected |
fd for write (driver end)
Definition at line 64 of file RlinkPortCuff.hpp.
Referenced by Cleanup(), DriverEventWritePipe(), and Open().
|
protected |
|
protected |
Definition at line 66 of file RlinkPortCuff.hpp.
Referenced by Cleanup(), DriverEventUSB(), and Open().
|
protected |
Definition at line 67 of file RlinkPortCuff.hpp.
|
protected |
Definition at line 68 of file RlinkPortCuff.hpp.
Referenced by Open().
|
protected |
Definition at line 69 of file RlinkPortCuff.hpp.
Referenced by Cleanup(), Driver(), NewWriteTransfer(), and Open().
|
protected |
Definition at line 70 of file RlinkPortCuff.hpp.
Referenced by Driver(), DriverEventWritePipe(), USBReadDone(), and USBWriteDone().
|
protected |
Definition at line 71 of file RlinkPortCuff.hpp.
Referenced by Cleanup(), Driver(), Open(), PollfdAdd(), and PollfdRemove().
|
protected |
Definition at line 72 of file RlinkPortCuff.hpp.
Referenced by NewWriteTransfer(), and USBWriteDone().
|
protected |
Definition at line 73 of file RlinkPortCuff.hpp.
Referenced by Driver(), DriverEventWritePipe(), and USBWriteDone().
|
protected |
Definition at line 74 of file RlinkPortCuff.hpp.
Referenced by Driver(), and USBReadDone().