μHAL (v2.6.5)
Part of the IPbus software repository
Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
uhal::PCIe Class Reference

Transport protocol to transfer an IPbus buffer via PCIe. More...

#include <uhal/ProtocolPCIe.hpp>

Inheritance diagram for uhal::PCIe:
[legend]
Collaboration diagram for uhal::PCIe:
[legend]

Classes

class  File
 
class  PacketFmt
 

Public Member Functions

 PCIe (const PCIe &aPCIe)
 
PCIeoperator= (const PCIe &aPCIe)
 
 PCIe (const std::string &aId, const URI &aUri)
 Constructor. More...
 
virtual ~PCIe ()
 Destructor. More...
 

Private Types

typedef IPbus< 2, 0 > InnerProtocol
 
typedef boost::chrono::steady_clock SteadyClock_t
 

Private Member Functions

void implementDispatch (boost::shared_ptr< Buffers > aBuffers)
 Send the IPbus buffer to the target, read back the response and call the packing-protocol's validate function. More...
 
virtual void Flush ()
 Concrete implementation of the synchronization function to block until all buffers have been sent, all replies received and all data validated. More...
 
virtual void dispatchExceptionHandler ()
 Function which tidies up this protocol layer in the event of an exception. More...
 
uint32_t getMaxSendSize ()
 Return the maximum size to be sent based on the buffer size in the target. More...
 
uint32_t getMaxReplySize ()
 Return the maximum size of reply packet based on the buffer size in the target. More...
 
void connect ()
 Set up the connection to the device. More...
 
void disconnect ()
 Close the connection to the device. More...
 
void write (const boost::shared_ptr< Buffers > &aBuffers)
 Write request packet to next page in host-to-FPGA device file. More...
 
void read ()
 Read next pending reply packet from appropriate page of FPGA-to-host device file, and validate contents. More...
 

Private Attributes

bool mConnected
 
File mDeviceFileHostToFPGA
 Host-to-FPGA device file. More...
 
File mDeviceFileFPGAToHost
 FPGA-to-host device file. More...
 
File mDeviceFileFPGAEvent
 FPGA-to-host interrupt (event) file. More...
 
bool mXdma7seriesWorkaround
 
bool mUseInterrupt
 
boost::chrono::microseconds mSleepDuration
 
uint32_t mNumberOfPages
 
uint32_t mMaxInFlight
 
uint32_t mPageSize
 
uint32_t mMaxPacketSize
 
uint32_t mIndexNextPage
 
uint32_t mPublishedReplyPageCount
 
uint32_t mReadReplyPageCount
 
std::deque< boost::shared_ptr< Buffers > > mReplyQueue
 The list of buffers still awaiting a reply. More...
 
uhal::exception::exceptionmAsynchronousException
 A pointer to an exception object for passing exceptions from the worker thread to the main thread. More...
 

Detailed Description

Transport protocol to transfer an IPbus buffer via PCIe.

Definition at line 81 of file ProtocolPCIe.hpp.

Member Typedef Documentation

◆ InnerProtocol

typedef IPbus< 2 , 0 > uhal::PCIe::InnerProtocol
private

Definition at line 157 of file ProtocolPCIe.hpp.

◆ SteadyClock_t

typedef boost::chrono::steady_clock uhal::PCIe::SteadyClock_t
private

Definition at line 159 of file ProtocolPCIe.hpp.

Constructor & Destructor Documentation

◆ PCIe() [1/2]

uhal::PCIe::PCIe ( const PCIe aPCIe)

◆ PCIe() [2/2]

uhal::PCIe::PCIe ( const std::string &  aId,
const URI aUri 
)

◆ ~PCIe()

uhal::PCIe::~PCIe ( )
virtual

Destructor.

Definition at line 69 of file ProtocolPCIe.hxx.

Referenced by PCIe().

Member Function Documentation

◆ connect()

void uhal::PCIe::connect ( )
private

◆ disconnect()

void uhal::PCIe::disconnect ( )
private

◆ dispatchExceptionHandler()

void uhal::PCIe::dispatchExceptionHandler ( )
privatevirtual

Function which tidies up this protocol layer in the event of an exception.

Definition at line 132 of file ProtocolPCIe.hxx.

Referenced by PCIe().

◆ Flush()

void uhal::PCIe::Flush ( )
privatevirtual

Concrete implementation of the synchronization function to block until all buffers have been sent, all replies received and all data validated.

Definition at line 127 of file ProtocolPCIe.hxx.

Referenced by PCIe().

◆ getMaxReplySize()

uint32_t uhal::PCIe::getMaxReplySize ( )
private

Return the maximum size of reply packet based on the buffer size in the target.

Returns
the maximum size of reply packet

Definition at line 413 of file ProtocolPCIe.cpp.

References connect(), mConnected, and mMaxPacketSize.

◆ getMaxSendSize()

uint32_t uhal::PCIe::getMaxSendSize ( )
private

Return the maximum size to be sent based on the buffer size in the target.

Returns
the maximum size to be sent

Definition at line 404 of file ProtocolPCIe.cpp.

References connect(), mConnected, and mMaxPacketSize.

◆ implementDispatch()

void uhal::PCIe::implementDispatch ( boost::shared_ptr< Buffers aBuffers)
private

Send the IPbus buffer to the target, read back the response and call the packing-protocol's validate function.

Parameters
aBuffersthe buffer object wrapping the send and recieve buffers that are to be transported If multithreaded, adds buffer to the dispatch queue and returns. If single-threaded, calls the dispatch-worker dispatch function directly and blocks until the response is validated.

Definition at line 75 of file ProtocolPCIe.hxx.

References uhal::Node::write().

Referenced by PCIe().

◆ operator=()

PCIe< InnerProtocol > & uhal::PCIe::operator= ( const PCIe aPCIe)

Definition at line 65 of file ProtocolPCIe.hxx.

◆ read()

void uhal::PCIe::read ( )
private

Read next pending reply packet from appropriate page of FPGA-to-host device file, and validate contents.

Definition at line 107 of file ProtocolPCIe.hxx.

References uhal::Error, and uhal::ClientInterface::validate().

Referenced by disconnect(), and PCIe().

◆ write()

void uhal::PCIe::write ( const boost::shared_ptr< Buffers > &  aBuffers)
private

Write request packet to next page in host-to-FPGA device file.

Definition at line 87 of file ProtocolPCIe.hxx.

References uhal::Error, and uhal::Node::read().

Referenced by disconnect(), and PCIe().

Member Data Documentation

◆ mAsynchronousException

uhal::exception::exception* uhal::PCIe::mAsynchronousException
private

A pointer to an exception object for passing exceptions from the worker thread to the main thread.

Exceptions must always be created on the heap (i.e. using new) and deletion will be handled in the main thread

Definition at line 209 of file ProtocolPCIe.hpp.

Referenced by disconnect().

◆ mConnected

bool uhal::PCIe::mConnected
private

Definition at line 185 of file ProtocolPCIe.hpp.

Referenced by connect(), disconnect(), getMaxReplySize(), getMaxSendSize(), and PCIe().

◆ mDeviceFileFPGAEvent

File uhal::PCIe::mDeviceFileFPGAEvent
private

FPGA-to-host interrupt (event) file.

Definition at line 192 of file ProtocolPCIe.hpp.

Referenced by connect(), disconnect(), and PCIe().

◆ mDeviceFileFPGAToHost

File uhal::PCIe::mDeviceFileFPGAToHost
private

FPGA-to-host device file.

Definition at line 190 of file ProtocolPCIe.hpp.

Referenced by connect(), and disconnect().

◆ mDeviceFileHostToFPGA

File uhal::PCIe::mDeviceFileHostToFPGA
private

Host-to-FPGA device file.

Definition at line 188 of file ProtocolPCIe.hpp.

Referenced by connect(), and disconnect().

◆ mIndexNextPage

uint32_t uhal::PCIe::mIndexNextPage
private

Definition at line 200 of file ProtocolPCIe.hpp.

Referenced by connect(), and disconnect().

◆ mMaxInFlight

uint32_t uhal::PCIe::mMaxInFlight
private

Definition at line 200 of file ProtocolPCIe.hpp.

Referenced by connect(), and PCIe().

◆ mMaxPacketSize

uint32_t uhal::PCIe::mMaxPacketSize
private

Definition at line 200 of file ProtocolPCIe.hpp.

Referenced by connect(), getMaxReplySize(), getMaxSendSize(), and PCIe().

◆ mNumberOfPages

uint32_t uhal::PCIe::mNumberOfPages
private

Definition at line 200 of file ProtocolPCIe.hpp.

Referenced by connect(), and disconnect().

◆ mPageSize

uint32_t uhal::PCIe::mPageSize
private

Definition at line 200 of file ProtocolPCIe.hpp.

Referenced by connect(), and disconnect().

◆ mPublishedReplyPageCount

uint32_t uhal::PCIe::mPublishedReplyPageCount
private

Definition at line 200 of file ProtocolPCIe.hpp.

Referenced by connect(), and disconnect().

◆ mReadReplyPageCount

uint32_t uhal::PCIe::mReadReplyPageCount
private

Definition at line 200 of file ProtocolPCIe.hpp.

Referenced by connect(), and disconnect().

◆ mReplyQueue

std::deque< boost::shared_ptr< Buffers > > uhal::PCIe::mReplyQueue
private

The list of buffers still awaiting a reply.

Definition at line 203 of file ProtocolPCIe.hpp.

Referenced by disconnect(), and PCIe().

◆ mSleepDuration

boost::chrono::microseconds uhal::PCIe::mSleepDuration
private

Definition at line 198 of file ProtocolPCIe.hpp.

Referenced by disconnect(), and PCIe().

◆ mUseInterrupt

bool uhal::PCIe::mUseInterrupt
private

Definition at line 196 of file ProtocolPCIe.hpp.

Referenced by connect(), disconnect(), and PCIe().

◆ mXdma7seriesWorkaround

bool uhal::PCIe::mXdma7seriesWorkaround
private

Definition at line 194 of file ProtocolPCIe.hpp.

Referenced by disconnect(), and PCIe().


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