Software Library API naibrd 2.24.0
See all documentation at naii.docs.com

Functions

NAIBRDFUNC nai_status_t NAIAPI naibrd_SER_LoadBufferWithTimeOut32 (int32_t cardIndex, int32_t module, int32_t channel, uint32_t *p_buffer, int32_t txCount, int32_t bufferLength, int32_t timeout_msec, int32_t *p_outwritten)
 Writes multiple bytes of data to the transmit FIFO for the specified Serial channel. The actual number of bytes placed in the buffer may be less than the length desired if the FIFO becomes full.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_SER_ReceiveBufferWithTimeOut32 (int32_t cardIndex, int32_t module, int32_t channel, uint32_t outbuffer[], int32_t bufferLength, int32_t expectedCount, int32_t timeout_msec, int32_t *p_outreceived)
 Retrieves multiple bytes of data from the receive FIFO for the specified Serial channel. The number of data elements read may be less than the amount requested if the FIFO goes empty during the read.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_SER_ReceiveHDLCPacket (int32_t cardIndex, int32_t module, int32_t channel, uint32_t outbuffer[], int32_t expectedCount, int32_t *p_outreceived, int32_t timeout_msec)
 Retrieves the buffer data for the specified serial channel associated with one(1) HDLC packet. When an HDLC packet is received OR the maximum count is read, the function returns. Otherwise, it blocks, waiting for data to be read or for the timeout to be reached. NOTE: This function extracts data from the fifo one element at a time, as opposed to naibrd_SER_ReceiveBufferWithTimeOut32() which extracts all of the data at once. For this reason, this API does not perform as efficiently as naibrd_SER_ReceiveBufferWithTimeOut32().
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_SER_GetTxBufferCnt (int32_t cardIndex, int32_t module, int32_t channel, uint32_t *p_outcount)
 Retrieves the number of bytes in the Transmit FIFO for the specified Serial channel.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_SER_GetRxBufferCnt (int32_t cardIndex, int32_t module, int32_t channel, uint32_t *p_outcount)
 Retrieves the number of bytes in the Receive FIFO for specified Serial channel.
 

Detailed Description

Function Documentation

◆ naibrd_SER_GetRxBufferCnt()

NAIBRDFUNC nai_status_t NAIAPI naibrd_SER_GetRxBufferCnt ( int32_t cardIndex,
int32_t module,
int32_t channel,
uint32_t * p_outcount )

Retrieves the number of bytes in the Receive FIFO for specified Serial channel.

Parameters
cardIndex: (Input) Logical Card Index assigned to connection with the NAI_BOARD (0 - NAI_MAX_CARDS-1).
module: (Input) Module Number of the module to access (1 - [max modules for board]).
channel: (Input) Channel Number of the channel to access (1 - [max channels for module]).
p_outcount: (Output) Pointer where number of bytes in the receive FIFO is returned.
Returns
  • NAI_SUCCESS
  • NAI_ERROR_INVALID_CARD when invalid card parameter is specified.
  • NAI_ERROR_INVALID_MODULE when invalid module parameter is specified.
  • NAI_ERROR_NOT_OPEN when handle to board is invalid.
  • NAI_ERROR_INVALID_CHANNEL when invalid channel parameter is specified.
  • NAI_ERROR_NOT_SUPPORTED when function is not supported.

◆ naibrd_SER_GetTxBufferCnt()

NAIBRDFUNC nai_status_t NAIAPI naibrd_SER_GetTxBufferCnt ( int32_t cardIndex,
int32_t module,
int32_t channel,
uint32_t * p_outcount )

Retrieves the number of bytes in the Transmit FIFO for the specified Serial channel.

Parameters
cardIndex: (Input) Logical Card Index assigned to connection with the NAI_BOARD (0 - NAI_MAX_CARDS-1).
module: (Input) Module Number of the module to access (1 - [max modules for board]).
channel: (Input) Channel Number of the channel to access (1 - [max channels for module]).
p_outcount: (Output) Pointer where number of bytes in the transmit FIFO is returned.
Returns
  • NAI_SUCCESS
  • NAI_ERROR_INVALID_CARD when invalid card parameter is specified.
  • NAI_ERROR_INVALID_MODULE when invalid module parameter is specified.
  • NAI_ERROR_NOT_OPEN when handle to board is invalid.
  • NAI_ERROR_INVALID_CHANNEL when invalid channel parameter is specified.
  • NAI_ERROR_NOT_SUPPORTED when function is not supported.

◆ naibrd_SER_LoadBufferWithTimeOut32()

NAIBRDFUNC nai_status_t NAIAPI naibrd_SER_LoadBufferWithTimeOut32 ( int32_t cardIndex,
int32_t module,
int32_t channel,
uint32_t * p_buffer,
int32_t txCount,
int32_t bufferLength,
int32_t timeout_msec,
int32_t * p_outwritten )

Writes multiple bytes of data to the transmit FIFO for the specified Serial channel. The actual number of bytes placed in the buffer may be less than the length desired if the FIFO becomes full.

Parameters
cardIndex: (Input) Logical Card Index assigned to connection with the NAI_BOARD (0 - NAI_MAX_CARDS-1).
module: (Input) Module Number of the module to access (1 - [max modules for board]).
channel: (Input) Channel Number of the channel to access (1 - [max channels for module]).
p_buffer: (Input) Data buffer to write to the serial Tx buffer.
txCount: (Input) Amount of data to write (in bytes).
bufferLength: (Input) The size of the Tx buffer. (Should be the amount of elements in p_buffer).
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 Use NAIBRD_FIFO_TIMEOUT_NONE to write to the Tx FIFO without waiting.
p_outwritten: (Output) Amount of data successfully written.
Returns
  • NAI_SUCCESS
  • NAI_ERROR_INVALID_CARD when invalid card parameter is specified.
  • NAI_ERROR_INVALID_MODULE when invalid module parameter is specified.
  • NAI_ERROR_NOT_OPEN when handle to board is invalid.
  • NAI_ERROR_INVALID_CHANNEL when invalid channel parameter is specified.
  • NAI_ERROR_FULL when the FIFO is full and not all the data can be written to the FIFO.
  • NAI_ERROR_NOT_SUPPORTED when function is not supported.
  • NAI_ERROR_TIMEOUT when the number of elements in the FIFO does not equal 'count' in the time specified by 'timeout_msec'.

◆ naibrd_SER_ReceiveBufferWithTimeOut32()

NAIBRDFUNC nai_status_t NAIAPI naibrd_SER_ReceiveBufferWithTimeOut32 ( int32_t cardIndex,
int32_t module,
int32_t channel,
uint32_t outbuffer[],
int32_t bufferLength,
int32_t expectedCount,
int32_t timeout_msec,
int32_t * p_outreceived )

Retrieves multiple bytes of data from the receive FIFO for the specified Serial channel. The number of data elements read may be less than the amount requested if the FIFO goes empty during the read.

Parameters
cardIndex: (Input) Logical Card Index assigned to connection with the NAI_BOARD (0 - NAI_MAX_CARDS-1).
module: (Input) Module Number of the module to access (1 - [max modules for board]).
channel: (Input) Channel Number of the channel to access (1 - [max channels for module]).
outbuffer: (Output) Buffer to store Rx data.
bufferLength: (Input) The size of the Rx buffer (This should be the amount of elements in outbuffer).
expectedCount: (Input) Maximum amount of data expected.

BufferLength must be >= expectedCount.

Parameters
timeout_msec: (input) The maximum time allowed to perform the read operation irrespective of the amount of data in the FIFO. Use NAIBRD_FIFO_TIMEOUT_NONE to get whatever data is in the FIFO without waiting.
p_outreceived: (Output) Amount of data read from the fifo.
Returns
  • NAI_SUCCESS
  • NAI_ERROR_INVALID_CARD when invalid card parameter is specified.
  • NAI_ERROR_INVALID_MODULE when invalid module parameter is specified.
  • NAI_ERROR_NOT_OPEN when handle to board is invalid.
  • NAI_ERROR_INVALID_CHANNEL when invalid channel parameter is specified.
  • NAI_ERROR_EMPTY when the fifo is empty.
  • NAI_ERROR_NOT_SUPPORTED when function is not supported.
  • NAI_ERROR_MORE_DATA when there is data remaining in the FIFO after the read is complete.
  • NAI_ERROR_INVALID_SIZE when the bufferSize < length.
  • NAI_ERROR_TIMEOUT when the number of elements in the FIFO does not equal 'count' in the time specified by 'timeout_msec'.

◆ naibrd_SER_ReceiveHDLCPacket()

NAIBRDFUNC nai_status_t NAIAPI naibrd_SER_ReceiveHDLCPacket ( int32_t cardIndex,
int32_t module,
int32_t channel,
uint32_t outbuffer[],
int32_t expectedCount,
int32_t * p_outreceived,
int32_t timeout_msec )

Retrieves the buffer data for the specified serial channel associated with one(1) HDLC packet. When an HDLC packet is received OR the maximum count is read, the function returns. Otherwise, it blocks, waiting for data to be read or for the timeout to be reached. NOTE: This function extracts data from the fifo one element at a time, as opposed to naibrd_SER_ReceiveBufferWithTimeOut32() which extracts all of the data at once. For this reason, this API does not perform as efficiently as naibrd_SER_ReceiveBufferWithTimeOut32().

Parameters
cardIndex: (Input) Logical Card Index assigned to connection with the NAI_BOARD (0 - NAI_MAX_CARDS-1).
module: (Input) Module Number of the module to access (1 - [max modules for board]).
channel: (Input) Channel Number of the channel to access (1 - [max channels for module]).
outbuffer: (Output) buffer to store Rx data.
expectedCount: (Input) Maximum amount of data expected.
p_outreceived: (Output) Amount of data successfully copied into 'buffer'.
timeout_msec: (Input) maximum time to wait for packet in milliseconds.
Returns
  • NAI_SUCCESS
  • NAI_ERROR_INVALID_CARD when invalid card parameter is specified.
  • NAI_ERROR_INVALID_MODULE when invalid module parameter is specified.
  • NAI_ERROR_NOT_OPEN when handle to board is invalid.
  • NAI_ERROR_INVALID_CHANNEL when invalid channel parameter is specified.
  • NAI_ERROR_NOT_SUPPORTED when function is not supported.