Software Library API naibrd 2.24.0
See all documentation at naii.docs.com
Generic Board Read/Write Functions

Functions

NAIBRDFUNC nai_status_t NAIAPI naibrd_ReadReg32 (int32_t cardIndex, int32_t module, uint32_t offset, uint32_t *p_outdata)
 Reads a 32-bit value from the register specified.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_WriteReg32 (int32_t cardIndex, int32_t module, uint32_t offset, uint32_t data)
 Writes a 32-bit value to register specified.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_Read32 (int32_t cardIndex, int32_t module, uint32_t offset, int32_t stride, int32_t count, uint32_t dataWidth, void *p_outdata)
 Reads 32-bit values from the registers specified.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_Write32 (int32_t cardIndex, int32_t module, uint32_t offset, int32_t stride, int32_t count, uint32_t dataWidth, const void *p_data)
 Writes the 32-bit values to the registers specified.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_WriteRegMask32 (int32_t cardIndex, int32_t module, uint32_t offset, uint32_t mask, uint32_t data)
 Writes a 32-bit value to the register specified, updating only the bit positions that are set in mask. The resulting value in the register will be (oldData & ~mask) | (data & mask). The mask and value may be truncated or padded with zeros depending on the register width.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_AckWriteRegMask32 (int32_t cardIndex, int32_t module, uint32_t reqOffset, uint32_t reqMask, uint32_t reqValue, uint32_t ackOffset, uint32_t ackMask, uint32_t ackValue, int32_t timeout_msec)
 Handles a "Request and Acknowledge' handshake. The reqValue is written to the regOffset register and the ackOffset register is read and compared to the ackValue to indicate that the HW request has been serviced within the timeout_msec period specified. The reqMask indicates which bits in the reqOffset register are updated. The ackMask indicates which bits in the ackOffset register are used in the comparison of the value retrieved from the ackOffset and the ackValue passed in. If ackValue is not detected within timeout_msec milliseconds, the function fails with NAI_ERROR_TIMEOUT. The mask and value may be truncated or padded with zeros depending on the register width.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_ReadFifo32 (int32_t cardIndex, int32_t module, uint32_t dataOffset, uint32_t countOffset, int32_t count, int32_t *p_outcountRemaining, int32_t timeout_msec, uint32_t dataWidth, void *p_outdata, int32_t *p_outcountRead)
 Reads the request amount of data from the FIFO. If 'timeout_msec' is set to NAIBRD_FIFO_TIMEOUT_NONE, 'count' will specify the maximum number of elements to read. The operation will not block and read up to 'count' words from the FIFO. Otherwise, 'count' will specify an absolute number of elements to read and the operation waits up to 'timeout_msec' milliseconds for the FIFO's count to be equal to or exceed 'count' before performing the read. If it times out, no data is read.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_WriteFifo32 (int32_t cardIndex, int32_t module, uint32_t dataOffset, uint32_t countOffset, int32_t count, int32_t fifoSize, int32_t timeout_msec, uint32_t dataWidth, const void *p_data, int32_t *p_outcountWrite)
 Writes the requested amount of data to the FIFO. If 'timeout_msec' is set to NAIBRD_FIFO_TIMEOUT_NONE, the amount of space available on the FIFO will be compared to the 'count'. If there is enough space, the data will be written to the FIFO, otherwise a NAI_ERROR_TIMEOUT is returned indicating that there is not enough space in the FIFO for the data. Otherwise the 'timeout_msec' specifies the maximum amount of time in milliseconds to wait until the FIFO has enough space for the data. If it times out, no data is written.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_ReadReg16 (int32_t cardIndex, int32_t module, uint32_t offset, uint16_t *p_outdata)
 Reads a 16-bit value from the register specified.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_Read16 (int32_t cardIndex, int32_t module, uint32_t offset, int32_t stride, int32_t count, uint32_t dataWidth, void *p_outdata)
 Reads 16-bit values from the registers specified.
 

Detailed Description

Function Documentation

◆ naibrd_AckWriteRegMask32()

NAIBRDFUNC nai_status_t NAIAPI naibrd_AckWriteRegMask32 ( int32_t cardIndex,
int32_t module,
uint32_t reqOffset,
uint32_t reqMask,
uint32_t reqValue,
uint32_t ackOffset,
uint32_t ackMask,
uint32_t ackValue,
int32_t timeout_msec )

Handles a "Request and Acknowledge' handshake. The reqValue is written to the regOffset register and the ackOffset register is read and compared to the ackValue to indicate that the HW request has been serviced within the timeout_msec period specified. The reqMask indicates which bits in the reqOffset register are updated. The ackMask indicates which bits in the ackOffset register are used in the comparison of the value retrieved from the ackOffset and the ackValue passed in. If ackValue is not detected within timeout_msec milliseconds, the function fails with NAI_ERROR_TIMEOUT. The mask and value may be truncated or padded with zeros depending on the register width.

Parameters
cardIndex: (Input) Logical Card Index assigned to connection with the NAI_BOARD (0 - NAI_MAX_CARDS-1).
module: (Input) NAIBRD_MOTHERBOARD for access to Motherboard registers, or Module Number of the module to access (1 - [max modules for board]).
reqOffset: (Input) Offset address on motherboard or module of the request register.
reqMask: (Input) Mask values of the request bit(s).
reqValue: (Input) Request value to write. Note that only the bit positions set in mask will be used.
ackOffset: (Input) Offset from the motherboard or module of the acknowledge register.
ackMask: (Input) Mask values of the acknowledge bit(s).
ackValue: (Input) Acknowledge value to read. Note that only the bit positions set in mask will be used.
timeout_msec: (Input) Value in milliseconds to wait for an acknowledgment.
Returns
  • NAI_SUCCESS
  • NAI_ERROR_INVALID_CARD when invalid card parameter is specified.
  • NAI_ERROR_INVALID_MODULE when the module number is invalid.
  • NAI_ERROR_TIMEOUT when an acknowledge is not read within timeout_msec.

◆ naibrd_Read16()

NAIBRDFUNC nai_status_t NAIAPI naibrd_Read16 ( int32_t cardIndex,
int32_t module,
uint32_t offset,
int32_t stride,
int32_t count,
uint32_t dataWidth,
void * p_outdata )

Reads 16-bit values from the registers specified.

Parameters
cardIndex: (Input) Logical Card Index assigned to connection with the NAI_BOARD (0 - NAI_MAX_CARDS-1).
module: (Input) NAIBRD_MOTHERBOARD for access to Motherboard registers, or Module Number of the module to access (1 - [max modules for board]).
offset: (Input) Offset address on the motherboard or the module to read.
stride: (Input) Amount, in bytes, to increment the address after each individual read.
count: (Input) Total number of elements to read.
dataWidth: (Input) Width, in bytes, of the elements in p_outdata.
p_outdata: (Output) Values read from the registers.
Returns
  • NAI_SUCCESS
  • NAI_ERROR_INVALID_CARD when invalid card parameter is specified.
  • NAI_ERROR_INVALID_MODULE when the module number is invalid.

◆ naibrd_Read32()

NAIBRDFUNC nai_status_t NAIAPI naibrd_Read32 ( int32_t cardIndex,
int32_t module,
uint32_t offset,
int32_t stride,
int32_t count,
uint32_t dataWidth,
void * p_outdata )

Reads 32-bit values from the registers specified.

Parameters
cardIndex: (Input) Logical Card Index assigned to connection with the NAI_BOARD (0 - NAI_MAX_CARDS-1).
module: (Input) NAIBRD_MOTHERBOARD for access to Motherboard registers, or Module Number of the module to access (1 - [max modules for board]).
offset: (Input) Offset address on the motherboard or the module to read.
stride: (Input) Amount, in bytes, to increment the address after each individual read.
count: (Input) Total number of elements to read.
dataWidth: (Input) Width, in bytes, of the elements in p_outdata.
p_outdata: (Output) Values read from the registers.
Returns
  • NAI_SUCCESS
  • NAI_ERROR_INVALID_CARD when invalid card parameter is specified.
  • NAI_ERROR_INVALID_MODULE when the module number is invalid.

◆ naibrd_ReadFifo32()

NAIBRDFUNC nai_status_t NAIAPI naibrd_ReadFifo32 ( int32_t cardIndex,
int32_t module,
uint32_t dataOffset,
uint32_t countOffset,
int32_t count,
int32_t * p_outcountRemaining,
int32_t timeout_msec,
uint32_t dataWidth,
void * p_outdata,
int32_t * p_outcountRead )

Reads the request amount of data from the FIFO. If 'timeout_msec' is set to NAIBRD_FIFO_TIMEOUT_NONE, 'count' will specify the maximum number of elements to read. The operation will not block and read up to 'count' words from the FIFO. Otherwise, 'count' will specify an absolute number of elements to read and the operation waits up to 'timeout_msec' milliseconds for the FIFO's count to be equal to or exceed 'count' before performing the read. If it times out, no data is read.

Parameters
cardIndex: (Input) Logical Card Index assigned to connection with the NAI_BOARD (0 - NAI_MAX_CARDS-1).
module: (Input) NAIBRD_MOTHERBOARD for access to Motherboard registers, or Module Number of the module to access (1 - [max modules for board]).
dataOffset: (Input) Offset address on motherboard or module of the FIFO's data register.
countOffset: (Input) Offset address on motherboard or module of the FIFO's count register.
count: (Input) Number of elements to read from the FIFO. This value can be a 'maximum' or an 'absolute' value depending on the 'timeout' parameter.
p_outcountRemaining: (Output) Number of elements remaining in the FIFO.
timeout_msec: (Input) NAIBRD_FIFO_TIMEOUT_NONE to read up to the amount specified by 'count' and return immediately. Otherwise, Otherwise, a wait for maximum of the timeout_msec will occur for the amount of data specified by 'count'.
dataWidth: (Input) Width, in bytes, of the elements in p_outdata.
p_outdata: (Output) Array to store the values read.
p_outcountRead: (Output) Number of elements read.
Returns
  • NAI_SUCCESS
  • NAI_ERROR_INVALID_CARD when invalid card parameter is specified.
  • NAI_ERROR_INVALID_MODULE when the module number is invalid.
  • NAI_ERROR_TIMEOUT when the number of elements in the FIFO does not equal 'count' in the time specified by 'timeout_msec'. This only applies when timeoutmsec is NAIBRD_FIFO_TIMEOUT_NONE.

◆ naibrd_ReadReg16()

NAIBRDFUNC nai_status_t NAIAPI naibrd_ReadReg16 ( int32_t cardIndex,
int32_t module,
uint32_t offset,
uint16_t * p_outdata )

Reads a 16-bit value from the register specified.

Parameters
cardIndex: (Input) Logical Card Index assigned to connection with the NAI_BOARD (0 - NAI_MAX_CARDS-1).
module: (Input) NAIBRD_MOTHERBOARD for access to Motherboard registers, or Module Number of the module to access (1 - [max modules for board]).
offset: (Input) Offset address on the motherboard or the module to read.
p_outdata: (Output) Value read from the register.
Returns
  • NAI_SUCCESS
  • NAI_ERROR_INVALID_CARD when invalid card parameter is specified.
  • NAI_ERROR_INVALID_MODULE when the module number is invalid.

◆ naibrd_ReadReg32()

NAIBRDFUNC nai_status_t NAIAPI naibrd_ReadReg32 ( int32_t cardIndex,
int32_t module,
uint32_t offset,
uint32_t * p_outdata )

Reads a 32-bit value from the register specified.

Parameters
cardIndex: (Input) Logical Card Index assigned to connection with the NAI_BOARD (0 - NAI_MAX_CARDS-1).
module: (Input) NAIBRD_MOTHERBOARD for access to Motherboard registers, or Module Number of the module to access (1 - [max modules for board]).
offset: (Input) Offset address on the motherboard or the module to read.
p_outdata: (Output) Value read from the register.
Returns
  • NAI_SUCCESS
  • NAI_ERROR_INVALID_CARD when invalid card parameter is specified.
  • NAI_ERROR_INVALID_MODULE when the module number is invalid.

◆ naibrd_Write32()

NAIBRDFUNC nai_status_t NAIAPI naibrd_Write32 ( int32_t cardIndex,
int32_t module,
uint32_t offset,
int32_t stride,
int32_t count,
uint32_t dataWidth,
const void * p_data )

Writes the 32-bit values to the registers specified.

Parameters
cardIndex: (Input) Logical Card Index assigned to connection with the NAI_BOARD (0 - NAI_MAX_CARDS-1).
module: (Input) NAIBRD_MOTHERBOARD for access to Motherboard registers, or Module Number of the module to access (1 - [max modules for board]).
offset: (Input) Offset address on the motherboard or the module to write.
stride: (Input) Amount, in bytes, to increment the address after each individual write.
count: (Input) Total number of elements to write.
dataWidth: (Input) Width, in bytes, of the elements in p_data.
p_data: (Output) Values to write to each registers.
Returns
  • NAI_SUCCESS
  • NAI_ERROR_INVALID_CARD when invalid card parameter is specified.
  • NAI_ERROR_INVALID_MODULE when the module number is invalid.

◆ naibrd_WriteFifo32()

NAIBRDFUNC nai_status_t NAIAPI naibrd_WriteFifo32 ( int32_t cardIndex,
int32_t module,
uint32_t dataOffset,
uint32_t countOffset,
int32_t count,
int32_t fifoSize,
int32_t timeout_msec,
uint32_t dataWidth,
const void * p_data,
int32_t * p_outcountWrite )

Writes the requested amount of data to the FIFO. If 'timeout_msec' is set to NAIBRD_FIFO_TIMEOUT_NONE, the amount of space available on the FIFO will be compared to the 'count'. If there is enough space, the data will be written to the FIFO, otherwise a NAI_ERROR_TIMEOUT is returned indicating that there is not enough space in the FIFO for the data. Otherwise the 'timeout_msec' specifies the maximum amount of time in milliseconds to wait until the FIFO has enough space for the data. If it times out, no data is written.

Parameters
cardIndex: (Input) Logical Card Index assigned to connection with the NAI_BOARD (0 - NAI_MAX_CARDS-1).
module: (Input) NAIBRD_MOTHERBOARD for access to Motherboard registers, or Module Number of the module to access (1 - [max modules for board]).
dataOffset: (Input) Offset address on motherboard or module of the FIFO's data register.
countOffset: (Input) Offset address on motherboard or module of the FIFO's count register.
count: (Input) Number of elements to read from the FIFO. This value can be a 'maximum' or an 'absolute' value depending on the 'timeout' parameter.
fifoSize: (Input) Maximum number of elements the FIFO can hold.
timeout_msec: (Input) NAIBRD_FIFO_TIMEOUT_NONE to indicate not to wait for the FIFO to free up enough space for the data. Otherwise, a wait for maximum of the timeout_msec will occur until the FIFO if freed up to hold the data specified.
dataWidth: (Input) Width, in bytes, of the elements in p_outdata.
p_data: (Output) Array to store the values to be written.
p_outcountWrite: (Output) Number of elements written.
Returns
  • NAI_SUCCESS
  • NAI_ERROR_INVALID_CARD when invalid card parameter is specified.
  • NAI_ERROR_INVALID_MODULE when the module number is invalid.
  • NAI_ERROR_TIMEOUT when the FIFO does not have enough space for the data.

◆ naibrd_WriteReg32()

NAIBRDFUNC nai_status_t NAIAPI naibrd_WriteReg32 ( int32_t cardIndex,
int32_t module,
uint32_t offset,
uint32_t data )

Writes a 32-bit value to register specified.

Parameters
cardIndex: (Input) Logical Card Index assigned to connection with the NAI_BOARD (0 - NAI_MAX_CARDS-1).
module: (Input) NAIBRD_MOTHERBOARD for access to Motherboard registers, or Module Number of the module to access (1 - [max modules for board]).
offset: (Input) Offset address on the motherboard or the module to write.
data: (Input) Value to write in the register.
Returns
  • NAI_SUCCESS
  • NAI_ERROR_INVALID_CARD when invalid card parameter is specified.
  • NAI_ERROR_INVALID_MODULE when the module number is invalid.

◆ naibrd_WriteRegMask32()

NAIBRDFUNC nai_status_t NAIAPI naibrd_WriteRegMask32 ( int32_t cardIndex,
int32_t module,
uint32_t offset,
uint32_t mask,
uint32_t data )

Writes a 32-bit value to the register specified, updating only the bit positions that are set in mask. The resulting value in the register will be (oldData & ~mask) | (data & mask). The mask and value may be truncated or padded with zeros depending on the register width.

Parameters
cardIndex: (Input) Logical Card Index assigned to connection with the NAI_BOARD (0 - NAI_MAX_CARDS-1).
module: (Input) NAIBRD_MOTHERBOARD for access to Motherboard registers, or Module Number of the module to access (1 - [max modules for board]).
offset: (Input) Offset address on the motherboard or the module to write.
mask: (Input) Bits to change in the register.
data: (Input) Value to write. Note that only the bit positions set in mask will be used.
Returns
  • NAI_SUCCESS
  • NAI_ERROR_INVALID_CARD when invalid card parameter is specified.
  • NAI_ERROR_INVALID_MODULE when the module number is invalid.