DuneNvme  1.0.0
This is a simple NVMe test environment that allows experimentation with the low level PCIe NVMe interfaces as available on a Xilinx FPGA environment.
Public Member Functions | Public Attributes | List of all members
Control Class Reference

Overal program control class. More...

Inheritance diagram for Control:
NvmeAccess

Public Member Functions

int init ()
 Initialise.
 
void setStartBlock (BUInt32 startBlock)
 Set the starting block number.
 
void setNumBlocks (BUInt32 numBlocks)
 Set the number of blocks to operate on.
 
void setReadStartBlock (BUInt32 startBlock)
 Set the starting block number for capture and read's read.
 
void setReadNumBlocks (BUInt32 numBlocks)
 Set the number of blocks to operate on for capture and read's read.
 
void setFilename (const char *filename)
 Set the file name for read data.
 
int nvmeInit ()
 Reset and configure Nvme's for operation.
 
int nvmeConfigure ()
 Configure single Nvme for operation. More...
 
void nvmeDataPacket (NvmeRequestPacket &packet)
 Called when read data packet receiver. More...
 
int nvmeCapture ()
 Capture FPGA datastream writing to Nvme.
 
int nvmeCaptureRepeat ()
 Capture FPGA datastream writing to Nvme multiple times.
 
int nvmeRead ()
 Read blocks from Nvme.
 
int nvmeCaptureAndRead ()
 Capture FPGA datastream writing to Nvme.
 
int nvmeWrite ()
 Write blocks to Nvme.
 
int nvmeTrim ()
 Trim blocks on Nvme.
 
int nvmeTrim1 ()
 Trim blocks on Nvme using Write0 command.
 
int nvmeRegs ()
 Print register contents.
 
int nvmeInfoDevice (int device)
 Print NVMe device info for a particular device.
 
int nvmeInfo ()
 Print NVMe device info.
 
int test1 ()
 Run test1.
 
int test2 ()
 Run test2.
 
int test3 ()
 Run test3.
 
int test4 ()
 Run test4.
 
int test5 ()
 Run test5.
 
int test6 ()
 Run test6.
 
int test7 ()
 Run test7.
 
int test8 ()
 Run test8.
 
int test9 ()
 Run test9.
 
int test10 ()
 Run test10.
 
int test_misc ()
 Collection of misc tests.
 
void uprintf (const char *fmt,...)
 User verbose printf.
 
int validateBlock (BUInt32 blockNum, void *data)
 Validate a data block.
 
void dumpDataBlock (void *data, Bool full)
 Print out a data blocks contents.
 
void dumpNvmeRegisters ()
 Dump the Nvme registers to stdout.
 
- Public Member Functions inherited from NvmeAccess
int init ()
 
void close ()
 
void setNvme (BUInt n)
 
BUInt getNvme ()
 
void reset ()
 
void start ()
 Start NVMe request processing thread.
 
int nvmeRequest (Bool wait, int queue, int opcode, BUInt nameSpace, BUInt32 address, BUInt32 arg10, BUInt32 arg11=0, BUInt32 arg12=0)
 
int nvmeProcess ()
 This function runs as a separate thread in order to receive both replies and requests from the Nvme.
 
BUInt32 readNvmeStorageReg (BUInt32 address)
 
void writeNvmeStorageReg (BUInt32 address, BUInt32 data)
 
int readNvmeReg32 (BUInt32 address, BUInt32 &data)
 
int writeNvmeReg32 (BUInt32 address, BUInt32 data)
 
int readNvmeReg64 (BUInt32 address, BUInt64 &data)
 
int writeNvmeReg64 (BUInt32 address, BUInt64 data)
 
int pcieWrite (BUInt8 request, BUInt32 address, BUInt32 num, BUInt32 *data)
 
int pcieRead (BUInt8 request, BUInt32 address, BUInt32 num, BUInt32 *data)
 
int packetSend (const NvmeRequestPacket &packet)
 
int packetSend (const NvmeReplyPacket &packet)
 
int readAvailable ()
 The number of bytes available on the receive stream.
 
void dumpRegs (int nvmeNum=-1)
 
void dumpDmaRegs (bool c2h, int chan)
 
void dumpStatus ()
 

Public Attributes

BUInt overbose
 Verbose operation.
 
Bool oreset
 Perform reset/config.
 
Bool ovalidate
 Validate data.
 
Bool omachine
 Return machine readable data only.
 
BUInt32 ostartBlock
 The starting block number.
 
BUInt32 onumBlocks
 The number of blocks.
 
BUInt32 oreadStartBlock
 The read starting block number.
 
BUInt32 oreadNumBlocks
 The read number of blocks.
 
const char * ofilename
 Output file name.
 
BFifoBytes ofifo0
 Fifo for Nvme0 read data.
 
BFifoBytes ofifo1
 Fifo for Nvme1 read data.
 
BUInt32 oblockNum
 The output block number.
 
BUInt8 odataBlock [BlockSize]
 Data block's from NVme's.
 
BSemaphore oreadComplete
 The read process is complete.
 
FILE * ofile
 The output file.
 

Additional Inherited Members

- Protected Attributes inherited from NvmeAccess
int oregsFd
 Device drive fd for register access.
 
int ohostSendFd
 Device driver fd for DMA send channel.
 
int ohostRecvFd
 Device driver fd for DMA receive channel.
 
BFpgaInfo oinfo
 Device driver information.
 
volatile BUInt32 * oregs
 FPGA design's registers memory mapped.
 
volatile BUInt32 * odmaRegs
 FPGA's PCIe XDMA modules DMA control registers memory mapped.
 
BUInt32 * obufTx
 
BUInt32 * obufRx
 
BUInt8 otag
 
BSemaphore opacketReplySem
 Semaphore when a reply packet has been received.
 
NvmeReplyPacket opacketReply
 Reply to request.
 
BSemaphore oqueueReplySem
 Semaphore when a queue reply packet has been received.
 
pthread_t othread
 
BUInt32 onvmeNum
 The nvme to communicate with, 0 is both.
 
BUInt32 onvmeRegbase
 The register base address.
 
BUInt32 oqueueNum
 
BUInt32 oqueueAdminMem [4096]
 
BUInt32 oqueueAdminRx
 
BUInt32 oqueueAdminTx
 
BUInt32 oqueueAdminId
 
BUInt32 oqueueDataMem [4096]
 
BUInt32 oqueueDataRx
 
BUInt32 oqueueDataTx
 
BUInt32 odataBlockMem [8192]
 

Detailed Description

Overal program control class.

Member Function Documentation

◆ nvmeConfigure()

int Control::nvmeConfigure ( )

Configure single Nvme for operation.

< Set PCIe config command for memory accesses

◆ nvmeDataPacket()

void Control::nvmeDataPacket ( NvmeRequestPacket packet)
virtual

Called when read data packet receiver.

This function is called from the Nvme request processing thread when PciWrite to memory requests arrive.

Reimplemented from NvmeAccess.


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