Software Library API naibrd 2.24.0
See all documentation at naii.docs.com
Transmit and Receive Operation Functions

Functions

NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_AB_QueueTransmit32 (int32_t cardIndex, int32_t module, int32_t channel, bool_t isModeA, int32_t msgId, uint32_t *p_buffer, int32_t txCount)
 Queues a CAN AB message for transmit on the channels FIFO. The message will be sent once the TX_ENABLE bit is set in the channel's control register. If that bit is already set, the message will be transmitted immediately. If the Tx FIFO does not have enough space to hold the message, the function will return immediately with a value of NAI_ERROR_FULL. If the message is longer than NAI_AB_MAX_DATA_LEN, the function will return immediately with a value of NAI_ERROR_INVALID_RANGE.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_AB_Transmit32 (int32_t cardIndex, int32_t module, int32_t channel, bool_t isModeA, int32_t msgId, uint32_t *p_buffer, int32_t txCount)
 Queues a message to transmit on a CAN A/B channel's Tx FIFO, then enables the transmit bit in the channel's control word.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_AB_Receive32 (int32_t cardIndex, int32_t module, int32_t channel, bool_t *p_outisModeA, int32_t *p_outmsgId, uint32_t bufferLength, uint32_t *p_outbuffer, int32_t *p_outrxCount)
 Reads a CAN AB message off a channel. If there are no messages waiting, this function will return NAI_ERROR_EMPTY. If the format of the message on the fifo is invalid the function will return NAI_ERROR_MISMATCH. If the message exceeds buflen the function will fill as much as it can, discard the rest of the message, and return NAI_ERROR_MORE_DATA.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_J1939_QueueTransmit32 (int32_t cardIndex, int32_t module, int32_t channel, int32_t pgn, int32_t priority, int32_t destination, uint32_t *p_buffer, int32_t txCount)
 Queues a J1939 message, for transmit on the given channel. The message will be sent once the TX_ENABLE bit is set in the channel's control register. If that bit is already set, the message will be transmitted immediately. If the Tx FIFO does not have enough space to hold the message, the function will return immediately with a value of NAI_ERROR_FULL. If the message is longer than NAIBRD_CAN_J1939_MAX_DATA_LEN, the function will return immediately with a value of NAI_ERROR_INVALID_RANGE.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_J1939_Transmit32 (int32_t cardIndex, int32_t module, int32_t channel, int32_t pgn, int32_t priority, int32_t destination, uint32_t *p_buffer, int32_t txCount)
 Queues a message to transmit on a J1939 channel's Tx FIFO, then enables the transmit bit in the channel's control word.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_J1939_Receive32 (int32_t cardIndex, int32_t module, int32_t channel, int32_t *p_outpgn, int32_t *p_outsource, int32_t *p_outdestination, uint32_t bufferLength, uint32_t *p_outbuffer, int32_t *p_outrxCount)
 Reads a J1939 message off a channel on a gen5 module. If there are no messages waiting, this function will return NAI_ERROR_EMPTY. If the format of the message on the fifo is invalid the function will return NAI_ERROR_MISMATCH. If the message exceeds buflen the function will fill as much as it can, discard the rest of the message, and return NAI_ERROR_MORE_DATA.
 

Detailed Description

Function Documentation

◆ naibrd_CAN_AB_QueueTransmit32()

NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_AB_QueueTransmit32 ( int32_t cardIndex,
int32_t module,
int32_t channel,
bool_t isModeA,
int32_t msgId,
uint32_t * p_buffer,
int32_t txCount )

Queues a CAN AB message for transmit on the channels FIFO. The message will be sent once the TX_ENABLE bit is set in the channel's control register. If that bit is already set, the message will be transmitted immediately. If the Tx FIFO does not have enough space to hold the message, the function will return immediately with a value of NAI_ERROR_FULL. If the message is longer than NAI_AB_MAX_DATA_LEN, the function will return immediately with a value of NAI_ERROR_INVALID_RANGE.

This function provides optimized performance for 32 bit buffer writes.

Parameters
cardIndex: (Input) Logical Card Index assigned to connect 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]).
isModeA: (Input) Mode (NAI_TRUE: CAN-A, NAI_FALSE: CAN-B.)
msgId: (Input) Message ID (11-bits for CAN-A, 29 bits for CAN-B).
p_buffer: (Input) Pointer to the buffer containing the message.
txCount: (Input) Length of the message (in bytes).
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_INVALID_CHANNEL when invalid channel parameter is specified.
  • NAI_ERROR_INVALID_RANGE when length of the message is invalid.
  • NAI_ERROR_FULL when the FIFO is out of space.
  • NAI_ERROR_NOT_SUPPORTED when function is not supported.

◆ naibrd_CAN_AB_Receive32()

NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_AB_Receive32 ( int32_t cardIndex,
int32_t module,
int32_t channel,
bool_t * p_outisModeA,
int32_t * p_outmsgId,
uint32_t bufferLength,
uint32_t * p_outbuffer,
int32_t * p_outrxCount )

Reads a CAN AB message off a channel. If there are no messages waiting, this function will return NAI_ERROR_EMPTY. If the format of the message on the fifo is invalid the function will return NAI_ERROR_MISMATCH. If the message exceeds buflen the function will fill as much as it can, discard the rest of the message, and return NAI_ERROR_MORE_DATA.

This function provides optimized performance for 32 bit buffers.

Parameters
cardIndex: (Input) Logical Card Index assigned to connect 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_outisModeA: (Output) Pointer to a bool_t indicating CAN mode A or B (NAI_TRUE: CAN-A, NAI_FALSE: CAN-B).
p_outmsgId: (Output) Pointer to an integer to store the message ID.
bufferLength: (Input) Number of bytes allocated to the buffer passed in.

*

Parameters
p_outbuffer: (Output) Buffer containing the received message.
p_outrxCount: (Output) Pointer to an integer containing the received message size (in bytes).
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_INVALID_CHANNEL when invalid channel parameter is specified.
  • NAI_ERROR_NOT_SUPPORTED when function is not supported.
  • NAI_ERROR_EMPTY when there is no data on the fifo
  • NAI_ERROR_MESSAGE_MISMATCH when the can frame being read on the fifo is invalid.
  • NAI_ERROR_MORE_DATA when the amount of data in the can frame being read exceeds the buflen
  • NAI_ERROR_INVALID_VALUE when a param has an invalid value

◆ naibrd_CAN_AB_Transmit32()

NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_AB_Transmit32 ( int32_t cardIndex,
int32_t module,
int32_t channel,
bool_t isModeA,
int32_t msgId,
uint32_t * p_buffer,
int32_t txCount )

Queues a message to transmit on a CAN A/B channel's Tx FIFO, then enables the transmit bit in the channel's control word.

This function provides optimized performance for 32 bit buffer writes.

Parameters
cardIndex: (Input) Logical Card Index assigned to connect 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]).
isModeA: (Input) Mode (NAI_TRUE: CAN-A, NAI_FALSE: CAN-B.)
msgId: (Input) Message ID (11-bits for CAN-A, 29 bits for CAN-B).
p_buffer: (Input) Pointer to the buffer containing the message.
txCount: (Input) Length of the message (in bytes).
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_INVALID_CHANNEL when invalid channel parameter is specified.
  • NAI_ERROR_NOT_SUPPORTED when function is not supported.
  • NAI_ERROR_INVALID_VALUE when a param has an invalid value.

◆ naibrd_CAN_J1939_QueueTransmit32()

NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_J1939_QueueTransmit32 ( int32_t cardIndex,
int32_t module,
int32_t channel,
int32_t pgn,
int32_t priority,
int32_t destination,
uint32_t * p_buffer,
int32_t txCount )

Queues a J1939 message, for transmit on the given channel. The message will be sent once the TX_ENABLE bit is set in the channel's control register. If that bit is already set, the message will be transmitted immediately. If the Tx FIFO does not have enough space to hold the message, the function will return immediately with a value of NAI_ERROR_FULL. If the message is longer than NAIBRD_CAN_J1939_MAX_DATA_LEN, the function will return immediately with a value of NAI_ERROR_INVALID_RANGE.

This function provides optimized performance for 32 bit buffer writes.

Parameters
cardIndex: (Input) Logical Card Index assigned to connect 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]).
pgn: (Input) Parameter Group Number.
priority: (Input) Priority of the message (0 being highest and 7 being lowest).
destination: (Input) Destination of the message (0 to FE, or FF to broadcast).
p_buffer: (Input) Pointer to the buffer containing the message.
txCount: (Input) Length of the message (in bytes).
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_INVALID_CHANNEL when invalid channel parameter is specified.
  • NAI_ERROR_INVALID_RANGE when length of the message is invalid.
  • NAI_ERROR_FULL when the FIFO is out of space.
  • NAI_ERROR_NOT_SUPPORTED when function is not supported.
  • NAI_ERROR_INVALID_VALUE when a parameter is invalid

◆ naibrd_CAN_J1939_Receive32()

NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_J1939_Receive32 ( int32_t cardIndex,
int32_t module,
int32_t channel,
int32_t * p_outpgn,
int32_t * p_outsource,
int32_t * p_outdestination,
uint32_t bufferLength,
uint32_t * p_outbuffer,
int32_t * p_outrxCount )

Reads a J1939 message off a channel on a gen5 module. If there are no messages waiting, this function will return NAI_ERROR_EMPTY. If the format of the message on the fifo is invalid the function will return NAI_ERROR_MISMATCH. If the message exceeds buflen the function will fill as much as it can, discard the rest of the message, and return NAI_ERROR_MORE_DATA.

Parameters
cardIndex: (Input) Logical Card Index assigned to connect 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_outpgn: (Output) Pointer to a integer to store the Parameter Group Number.
p_outsource: (Output) Pointer to an integer to store the source of the message.
p_outdestination: (Output) Pointer to an integer to store the destination of the message (0 to FE, or FF to broadcast).
bufferLength: (Input) Number of bytes allocated to the buffer passed in.
p_outbuffer: (Output) Buffer containing the received message. Only the first byte of each word in the outbuffer contains the data.
p_outrxCount: (Output) Pointer to an integer containing the received message size (in bytes).
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_INVALID_CHANNEL when invalid channel parameter is specified.
  • NAI_ERROR_NOT_SUPPORTED when function is not supported.
  • NAI_ERROR_EMPTY when there is no data on the fifo
  • NAI_ERROR_MESSAGE_MISMATCH when the can frame being read on the fifo is invalid.
  • NAI_ERROR_MORE_DATA when the amount of data in the can frame being read exceeds the buflen
  • NAI_ERROR_INVALID_VALUE when a parameter is invalid

◆ naibrd_CAN_J1939_Transmit32()

NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_J1939_Transmit32 ( int32_t cardIndex,
int32_t module,
int32_t channel,
int32_t pgn,
int32_t priority,
int32_t destination,
uint32_t * p_buffer,
int32_t txCount )

Queues a message to transmit on a J1939 channel's Tx FIFO, then enables the transmit bit in the channel's control word.

Parameters
cardIndex: (Input) Logical Card Index assigned to connect 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]).
pgn: (Input) Parameter Group Number.
priority: (Input) Priority of the message (0 being highest and 7 being lowest).
destination: (Input) Destination of the message (0 to FE, or FF to broadcast).
p_buffer: (Input) Pointer to the buffer containing the message. Buffer should be of type uint16_t* or uint32_t*
txCount: (Input) Length of the message (in bytes).
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_INVALID_CHANNEL when invalid channel parameter is specified.
  • NAI_ERROR_NOT_SUPPORTED when function is not supported.