w11 - cpp 0.794
Backend server for Rlink and w11
Loading...
Searching...
No Matches
Retro::RlinkPortCuff Class Reference

FIXME_docs. More...

#include <RlinkPortCuff.hpp>

Inheritance diagram for Retro::RlinkPortCuff:
[legend]
Collaboration diagram for Retro::RlinkPortCuff:
[legend]

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< RlinkPortport_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
 
RlinkPortoperator= (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 RparseUrlUrl () 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.
 
RstatsStats ()
 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< RlogFilefspLog
 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.
 

Detailed Description

FIXME_docs.

Definition at line 31 of file RlinkPortCuff.hpp.

Member Enumeration Documentation

◆ stats

Enumerator
kStatNPollAddCB 
kStatNPollRemoveCB 
kStatNUSBWrite 
kStatNUSBRead 
kDimStat 

Definition at line 47 of file RlinkPortCuff.hpp.

◆ loopState

Enumerator
kLoopStateStopped 
kLoopStateRunning 
kLoopStateStopping 

Definition at line 56 of file RlinkPortCuff.hpp.

Constructor & Destructor Documentation

◆ RlinkPortCuff()

Retro::RlinkPortCuff::RlinkPortCuff ( )

◆ ~RlinkPortCuff()

Retro::RlinkPortCuff::~RlinkPortCuff ( )
virtual

Destructor.

Definition at line 83 of file RlinkPortCuff.cpp.

References Retro::Rtools::Catch2Cerr(), Close(), and Retro::RlinkPort::IsOpen().

Member Function Documentation

◆ Open()

◆ Close()

void Retro::RlinkPortCuff::Close ( )
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().

◆ Cleanup()

void Retro::RlinkPortCuff::Cleanup ( )
private

◆ OpenPipe()

bool Retro::RlinkPortCuff::OpenPipe ( int &  fdread,
int &  fdwrite,
RerrMsg emsg 
)
private

FIXME_docs.

Definition at line 302 of file RlinkPortCuff.cpp.

References Retro::RerrMsg::InitErrno().

Referenced by Open().

◆ Driver()

◆ DriverEventWritePipe()

void Retro::RlinkPortCuff::DriverEventWritePipe ( )
private

◆ DriverEventUSB()

void Retro::RlinkPortCuff::DriverEventUSB ( )
private

FIXME_docs.

Definition at line 439 of file RlinkPortCuff.cpp.

References BadUSBCall(), and fpUsbContext.

Referenced by Driver().

◆ NewWriteTransfer()

libusb_transfer * Retro::RlinkPortCuff::NewWriteTransfer ( )
private

FIXME_docs.

Definition at line 455 of file RlinkPortCuff.cpp.

References fpUsbDevHdl, fWriteQueueFree, kUSBBufferSize, kUSBWriteEP, and ThunkUSBWriteDone().

Referenced by DriverEventWritePipe().

◆ TraceOn()

bool Retro::RlinkPortCuff::TraceOn ( )
private

◆ BadSysCall()

void Retro::RlinkPortCuff::BadSysCall ( const char *  meth,
const char *  text,
int  rc 
)
private

FIXME_docs.

Definition at line 502 of file RlinkPortCuff.cpp.

Referenced by Driver(), DriverEventWritePipe(), and USBReadDone().

◆ BadUSBCall()

void Retro::RlinkPortCuff::BadUSBCall ( const char *  meth,
const char *  text,
int  rc 
)
private

FIXME_docs.

Definition at line 514 of file RlinkPortCuff.cpp.

References USBErrorName().

Referenced by Driver(), DriverEventUSB(), DriverEventWritePipe(), and USBReadDone().

◆ CheckUSBTransfer()

void Retro::RlinkPortCuff::CheckUSBTransfer ( const char *  meth,
libusb_transfer *  t 
)
private

FIXME_docs.

Definition at line 525 of file RlinkPortCuff.cpp.

Referenced by USBReadDone(), and USBWriteDone().

◆ USBErrorName()

const char * Retro::RlinkPortCuff::USBErrorName ( int  rc)
private

FIXME_docs.

Definition at line 545 of file RlinkPortCuff.cpp.

Referenced by BadUSBCall(), and Open().

◆ PollfdAdd()

void Retro::RlinkPortCuff::PollfdAdd ( int  fd,
short  events 
)
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().

◆ PollfdRemove()

void Retro::RlinkPortCuff::PollfdRemove ( int  fd)
private

FIXME_docs.

Definition at line 601 of file RlinkPortCuff.cpp.

References fPollFds, Retro::RlinkPort::fStats, Retro::Rstats::Inc(), and kStatNPollRemoveCB.

Referenced by ThunkPollfdRemove().

◆ USBWriteDone()

void Retro::RlinkPortCuff::USBWriteDone ( libusb_transfer *  t)
private

◆ USBReadDone()

void Retro::RlinkPortCuff::USBReadDone ( libusb_transfer *  t)
private

◆ ThunkPollfdAdd()

void Retro::RlinkPortCuff::ThunkPollfdAdd ( int  fd,
short  events,
void *  udata 
)
staticprivate

FIXME_docs.

Definition at line 678 of file RlinkPortCuff.cpp.

References PollfdAdd().

Referenced by Open().

◆ ThunkPollfdRemove()

void Retro::RlinkPortCuff::ThunkPollfdRemove ( int  fd,
void *  udata 
)
staticprivate

FIXME_docs.

Definition at line 688 of file RlinkPortCuff.cpp.

References PollfdRemove().

Referenced by Open().

◆ ThunkUSBWriteDone()

void Retro::RlinkPortCuff::ThunkUSBWriteDone ( libusb_transfer *  t)
staticprivate

FIXME_docs.

Definition at line 698 of file RlinkPortCuff.cpp.

References USBWriteDone().

Referenced by NewWriteTransfer().

◆ ThunkUSBReadDone()

void Retro::RlinkPortCuff::ThunkUSBReadDone ( libusb_transfer *  t)
staticprivate

FIXME_docs.

Definition at line 708 of file RlinkPortCuff.cpp.

References USBReadDone().

Referenced by Driver().

Member Data Documentation

◆ kUSBBufferSize

const size_t Retro::RlinkPortCuff::kUSBBufferSize = 4096
static

USB buffer size.

Definition at line 41 of file RlinkPortCuff.hpp.

Referenced by Driver(), DriverEventWritePipe(), and NewWriteTransfer().

◆ kUSBWriteEP

const int Retro::RlinkPortCuff::kUSBWriteEP = 4
static

USB write endpoint.

Definition at line 42 of file RlinkPortCuff.hpp.

Referenced by NewWriteTransfer().

◆ kUSBReadEP

const int Retro::RlinkPortCuff::kUSBReadEP = 6
static

USB read endpoint.

Definition at line 43 of file RlinkPortCuff.hpp.

Referenced by Driver().

◆ kUSBReadQueue

const size_t Retro::RlinkPortCuff::kUSBReadQueue = 2
static

USB read queue length.

Definition at line 44 of file RlinkPortCuff.hpp.

Referenced by Driver().

◆ fFdReadDriver

int Retro::RlinkPortCuff::fFdReadDriver
protected

fd for read (driver end)

Definition at line 63 of file RlinkPortCuff.hpp.

Referenced by Cleanup(), Driver(), Open(), and USBReadDone().

◆ fFdWriteDriver

int Retro::RlinkPortCuff::fFdWriteDriver
protected

fd for write (driver end)

Definition at line 64 of file RlinkPortCuff.hpp.

Referenced by Cleanup(), DriverEventWritePipe(), and Open().

◆ fDriverThread

std::thread Retro::RlinkPortCuff::fDriverThread
protected

driver thread

Definition at line 65 of file RlinkPortCuff.hpp.

Referenced by Cleanup(), and Open().

◆ fpUsbContext

libusb_context* Retro::RlinkPortCuff::fpUsbContext
protected

Definition at line 66 of file RlinkPortCuff.hpp.

Referenced by Cleanup(), DriverEventUSB(), and Open().

◆ fpUsbDevList

libusb_device** Retro::RlinkPortCuff::fpUsbDevList
protected

Definition at line 67 of file RlinkPortCuff.hpp.

Referenced by Cleanup(), and Open().

◆ fUsbDevCount

ssize_t Retro::RlinkPortCuff::fUsbDevCount
protected

Definition at line 68 of file RlinkPortCuff.hpp.

Referenced by Open().

◆ fpUsbDevHdl

libusb_device_handle* Retro::RlinkPortCuff::fpUsbDevHdl
protected

Definition at line 69 of file RlinkPortCuff.hpp.

Referenced by Cleanup(), Driver(), NewWriteTransfer(), and Open().

◆ fLoopState

loopState Retro::RlinkPortCuff::fLoopState
protected

Definition at line 70 of file RlinkPortCuff.hpp.

Referenced by Driver(), DriverEventWritePipe(), USBReadDone(), and USBWriteDone().

◆ fPollFds

std::vector<pollfd> Retro::RlinkPortCuff::fPollFds
protected

Definition at line 71 of file RlinkPortCuff.hpp.

Referenced by Cleanup(), Driver(), Open(), PollfdAdd(), and PollfdRemove().

◆ fWriteQueueFree

std::deque<libusb_transfer*> Retro::RlinkPortCuff::fWriteQueueFree
protected

Definition at line 72 of file RlinkPortCuff.hpp.

Referenced by NewWriteTransfer(), and USBWriteDone().

◆ fWriteQueuePending

std::deque<libusb_transfer*> Retro::RlinkPortCuff::fWriteQueuePending
protected

Definition at line 73 of file RlinkPortCuff.hpp.

Referenced by Driver(), DriverEventWritePipe(), and USBWriteDone().

◆ fReadQueuePending

std::deque<libusb_transfer*> Retro::RlinkPortCuff::fReadQueuePending
protected

Definition at line 74 of file RlinkPortCuff.hpp.

Referenced by Driver(), and USBReadDone().


The documentation for this class was generated from the following files: