72
M2i.30xx / M2i.30xx-exp Manual
Commands
Acquisition modes
Data Transfer
Data transfer consists of two parts: the buffer definition and the commands/status information that controls the transfer itself. Data transfer
shares the command and status register with the card control commands and status information. In general the following details on the data
transfer are valid for any data transfer in any direction:
• The memory size register (SPC_MEMSIZE) must be programmed before starting the data transfer.
• Before starting a data transfer the buffer must be defined using the spcm_dwDefTransfer function.
• Each defined buffer is only used once. After transfer has ended the buffer is automatically invalidated.
• If a buffer has to be deleted although the data transfer is in progress or the buffer has at least been defined it is necessary to call the
spcm_dwInvalidateBuf function.
Definition of the transfer buffer
Before any data transfer can start it is necessary to define the transfer buffer with all its details. The definition of the buffer is done with the
spcm_dwDefTransfer function as explained in an earlier chapter.
This function is used to define buffers for standard sample data transfer as well as for extra data transfer for additional ABA or timestamp
information. Therefore the dwBufType parameter can be one of the following:
The dwDirection parameter defines the direction of the following data transfer:
The direction information used here must match the currently used mode. While an acquisition mode is used
there’s no transfer from PC to card allowed and vice versa. It is possible to use a special memory test mode
to come beyond this limit. Set the SPC_MEMTEST register as defined further below.
The dwNotifySize parameter defines the amount of bytes after which an interrupt should be generated. If leaving this parameter zero, the
transfer will run until all data is transferred and then generate an interrupt. Filling in notify size > zero will allow you to use the amount of
data that has been transferred so far. The notify size is used on FIFO mode to implement a buffer handshake with the driver or when trans-
ferring large amount of data where it may be of interest to start data processing while data transfer is still running. Please see the chapter on
handling positions further below for details.
The Notify size sticks to the page size which is defined by the PC hardware and the operating system. There-
fore the notify size must be a multiple of 4 kByte. For data transfer it may also be a fraction of 4k in the
range of 16, 32, 64, 128, 256, 512, 1k or 2k. No other values are allowed. For ABA and timestamp the notify
size can be 2k as a minimum. If you need to work with ABA or timestamp data in smaller chunks please use the
polling mode as described later.
The pvDataBuffer must point to an allocated data buffer for the transfer. Please be sure to have at least the amount of memory allocated that
you program to be transferred. If the transfer is going from card to PC this data is overwritten with the current content of the card on-board
memory.
When not doing FIFO mode one can also use the qwBrdOffs parameter. This parameter defines the starting position for the data transfer as
byte value in relation to the beginning of the card memory. Using this parameter allows it to split up data transfer in smaller chunks if one
has acquired a very large on-board memory.
The qwTransferLen parameter defines the number of bytes that has to be transferred with this buffer. Please be sure that the allocated memory
has at least the size that is defined in this parameter. In standard mode this parameter cannot be larger than the amount of data defined with
memory size.
uint32 _stdcall spcm_dwDefTransfer_i64 (// Defines the transfer buffer by using 64 bit unsigned integer values
drv_handle hDevice, // handle to an already opened device
uint32 dwBufType, // type of the buffer to define as listed below under SPCM_BUF_XXXX
uint32 dwDirection, // the transfer direction as defined below
uint32 dwNotifySize, // number of bytes after which an event is sent (0=end of transfer)
void* pvDataBuffer, // pointer to the data buffer
uint64 qwBrdOffs, // offset for transfer in board memory
uint64 qwTransferLen); // buffer length
SPCM_BUF_DATA
1000
Buffer is used for transfer of standard sample data
SPCM_BUF_ABA
2000
Buffer is used to read out slow ABA data. Details on this mode are described in the chapter about the ABA mode
option
SPCM_BUF_TIMESTAMP
3000
Buffer is used to read out timestamp information. Details on this mode are described in the chapter about the
timestamp option.
SPCM_DIR_PCTOCARD
0
Transfer is done from PC memory to on-board memory of card
SPCM_DIR_CARDTOPC
1
Transfer is done from card on-board memory to PC memory.
SPCM_DIR_CARDTOGPU
2
RDMA transfer from card memory to GPU memory, SCAPP option needed, Linux only
SPCM_DIR_GPUTOCARD
3
RDMA transfer from GPU memory to card memory, SCAPP option needed, Linux only