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_AR_CAN_SetRxMaxWorkTimeMS (int32_t cardIndex, int32_t module, int32_t channel, int32_t rxMaxWorkTimeMS)
 Sets the maximum allotted time in milliseconds that the CAN module is allowed to spend trying Rx messages into the Rx FIFO.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_AR_CAN_GetRxMaxWorkTimeMS (int32_t cardIndex, int32_t module, int32_t channel, int32_t *p_outrxMaxWorkTimeMS)
 Retrieves the maximum allotted time in milliseconds that the CAN module is allowed to spend trying Rx messages into the Rx FIFO.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_AR_CAN_SetTxMaxWorkTimeMS (int32_t cardIndex, int32_t module, int32_t channel, int32_t txMaxWorkTimeMS)
 Sets the maximum allotted time in milliseconds that the CAN module is allowed to spend trying Tx messages from the Tx FIFO.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_AR_CAN_GetTxMaxWorkTimeMS (int32_t cardIndex, int32_t module, int32_t channel, int32_t *p_outtxMaxWorkTimeMS)
 Retrieves the maximum allotted time in milliseconds that the CAN module is allowed to spend trying Tx messages from the Tx FIFO.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_AR_CAN_QueueTransmit (int32_t cardIndex, int32_t module, int32_t channel, naibrd_ar_can_protocol_type_t protocol, bool_t isModeA, uint32_t msgId, uint8_t *buffer, int32_t length)
 Queues a message to transmit on a CAN A/B channel's Tx 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_AR_CAN_Transmit (int32_t cardIndex, int32_t module, int32_t channel, naibrd_ar_can_protocol_type_t protocol, bool_t isModeA, uint32_t msgId, uint8_t *buffer, int32_t length)
 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_AR_CAN_Receive (int32_t cardIndex, int32_t module, int32_t channel, int32_t bufLen, uint32_t *p_outmsgId, uint32_t *p_outtimestamp, uint8_t *p_outbuffer, int32_t *p_outlength)
 Attempts to read a message off a CAN A/B channel's Rx FIFO. If there are no messages waiting, this function will return immediately with a value of NAI_ERROR_EMPTY. If the message exceeds the length of the buffer, the function will not attempt to retrieve the message until a full frame is detected.
 

Detailed Description

Function Documentation

◆ naibrd_AR_CAN_GetRxMaxWorkTimeMS()

NAIBRDFUNC nai_status_t NAIAPI naibrd_AR_CAN_GetRxMaxWorkTimeMS ( int32_t cardIndex,
int32_t module,
int32_t channel,
int32_t * p_outrxMaxWorkTimeMS )

Retrieves the maximum allotted time in milliseconds that the CAN module is allowed to spend trying Rx messages into the Rx FIFO.

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_outrxMaxWorkTimeMS: (Output) Returns the max work time in milliseconds allowed for Rx
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.

◆ naibrd_AR_CAN_GetTxMaxWorkTimeMS()

NAIBRDFUNC nai_status_t NAIAPI naibrd_AR_CAN_GetTxMaxWorkTimeMS ( int32_t cardIndex,
int32_t module,
int32_t channel,
int32_t * p_outtxMaxWorkTimeMS )

Retrieves the maximum allotted time in milliseconds that the CAN module is allowed to spend trying Tx messages from the Tx FIFO.

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_outtxMaxWorkTimeMS: (Output) Returns the max work time in milliseconds allowed for Tx
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.

◆ naibrd_AR_CAN_QueueTransmit()

NAIBRDFUNC nai_status_t NAIAPI naibrd_AR_CAN_QueueTransmit ( int32_t cardIndex,
int32_t module,
int32_t channel,
naibrd_ar_can_protocol_type_t protocol,
bool_t isModeA,
uint32_t msgId,
uint8_t * buffer,
int32_t length )

Queues a message to transmit on a CAN A/B channel's Tx 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.

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]).
protocol: (Input) Protocol (NAIBRD_AR_CAN_PROTOCOL_AB (CAN A/B) or NAIBRD_AR_CAN_PROTOCOL_FD (CAN FD)
isModeA: (Input) Mode (NAI_TRUE: CAN-A 11 Bit Identifier, NAI_FALSE: CAN-B 29Bit Identifier.)
msgId: (Input) Message ID (11-bits for CAN-A, 29 bits for CAN-B).
buffer: (Input) Pointer to the buffer containing the message.
length: (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_AR_CAN_Receive()

NAIBRDFUNC nai_status_t NAIAPI naibrd_AR_CAN_Receive ( int32_t cardIndex,
int32_t module,
int32_t channel,
int32_t bufLen,
uint32_t * p_outmsgId,
uint32_t * p_outtimestamp,
uint8_t * p_outbuffer,
int32_t * p_outlength )

Attempts to read a message off a CAN A/B channel's Rx FIFO. If there are no messages waiting, this function will return immediately with a value of NAI_ERROR_EMPTY. If the message exceeds the length of the buffer, the function will not attempt to retrieve the message until a full frame is detected.

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]).
bufLen: (Input) Number of bytes allocated to the buffer passed in - should be at least as large as the expected payload count.
p_outmsgId: (Output) Stores the message ID.
p_outtimestamp: (Output) Stores the message timestamp - when the message was received.
p_outbuffer: (Output) Buffer containing the received message.
p_outlength: (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_FRAMING when the message exceeds NAI_AB_MAX_DATA_LEN.
  • NAI_ERROR_MORE_DATA when more data than the length of the buffer passed in.

◆ naibrd_AR_CAN_SetRxMaxWorkTimeMS()

NAIBRDFUNC nai_status_t NAIAPI naibrd_AR_CAN_SetRxMaxWorkTimeMS ( int32_t cardIndex,
int32_t module,
int32_t channel,
int32_t rxMaxWorkTimeMS )

Sets the maximum allotted time in milliseconds that the CAN module is allowed to spend trying Rx messages into the Rx FIFO.

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]).
rxMaxWorkTimeMS: (Input) The max work time in milliseconds allowed for Rx
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.

◆ naibrd_AR_CAN_SetTxMaxWorkTimeMS()

NAIBRDFUNC nai_status_t NAIAPI naibrd_AR_CAN_SetTxMaxWorkTimeMS ( int32_t cardIndex,
int32_t module,
int32_t channel,
int32_t txMaxWorkTimeMS )

Sets the maximum allotted time in milliseconds that the CAN module is allowed to spend trying Tx messages from the Tx FIFO.

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]).
txMaxWorkTimeMS: (Input) The max work time in milliseconds allowed for Tx
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.

◆ naibrd_AR_CAN_Transmit()

NAIBRDFUNC nai_status_t NAIAPI naibrd_AR_CAN_Transmit ( int32_t cardIndex,
int32_t module,
int32_t channel,
naibrd_ar_can_protocol_type_t protocol,
bool_t isModeA,
uint32_t msgId,
uint8_t * buffer,
int32_t length )

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.

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]).
protocol: (Input) Protocol (NAIBRD_AR_CAN_PROTOCOL_AB (CAN A/B) or NAIBRD_AR_CAN_PROTOCOL_FD (CAN FD)
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).
buffer: (Input) Pointer to the buffer containing the message.
length: (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.