Software Library API naibrd 2.24.0
See all documentation at naii.docs.com
Buffer and Channel Status Functions

Functions

NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetTxFIFOCount (int32_t cardIndex, int32_t module, int32_t channel, int32_t *p_outcount)
 Get the number of words used in the Tx FIFO.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetRxFIFOCount (int32_t cardIndex, int32_t module, int32_t channel, int32_t *p_outcount)
 Get the number of words used in the Rx FIFO.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetTxFIFOFrameCount (int32_t cardIndex, int32_t module, int32_t channel, int32_t *p_outcount)
 Get the number of frames in the Tx FIFO.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetRxFIFOFrameCount (int32_t cardIndex, int32_t module, int32_t channel, int32_t *p_outcount)
 Get the number of frames in the Rx FIFO.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetTxFIFOMessageWaiting (int32_t cardIndex, int32_t module, int32_t channel, bool_t *p_outmsgWaiting)
 Determine whether or not a Tx message is waiting to be transmitted.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetRxFIFOMessageWaiting (int32_t cardIndex, int32_t module, int32_t channel, bool_t *p_outmsgWaiting)
 Determine whether or not a Rx message is waiting to be received.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetCoreStatus (int32_t cardIndex, int32_t module, int32_t channel, int32_t *p_outstatus)
 Get the core status of a channel. This is the status of actual CAN core. The meaning of bits having been set high (1) is listed here: BIT 0 = Configuration Mode Indicator (1 = CAN core is in configuration mode. 0 = CAN core is NOT in configuration mode) BIT 1 = Loopback Mode Indicator (1 = CAN core is in loopback mode. 0 = CAN core is NOT in loopback mode) BIT 2 = Sleep Mode Indicator (1 = CAN core is in sleep mode. 0 = CAN core is NOT in sleep mode) BIT 3 = Normal Mode Indicator (1 = CAN core is in normal mode. 0 = CAN core is NOT in normal mode) BIT 4 = Bus Idle Indicator (1 = No bus communication is taking place. 0 = CAN core is either in configuration mode or the bus is busy) BIT 5 = Bus Busy Indicator (1 = CAN core is either receiving a message or transmitting a message. 0 = CAN core is either in configuration mode or the bus is idle) BIT 6 = Error Warning Indicator (1 = Indicates either the Transmit Error counter or the Receive Error counter have count of 96 or greater. 0 indicates neither counter have reached a count of 96) BIT 7 and 8 = Error Status Indicator (00 = Indicates configuration mode and error state is undefined. 01 = Indicates Error Active State. 11 = Indicates Error Passive State. 10 = Indicates Bus Off State) BIT 9 - 31 = RESERVED.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetCommStatus (int32_t cardIndex, int32_t module, int32_t channel, naibrd_can_comm_status_type_t *p_outstatus)
 Get the communication status of a channel. For P6 and PA modules, the valid communication status flags are defined by the nai_can_comm_status_t type (see header file). For Gen_5 modules (CB1, CB2 and CB3), the communication status are 32 bit error codes (not bitmapped).
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetBusStatus (int32_t cardIndex, int32_t module, int32_t channel, int32_t *p_outstatus)
 Get the bus status of a channel. This indicates the type of error that has occurred on the bus. If more than one error occurs, all relevant error flag bits are set in this p_outstatus value. Bit meanings are as follows:
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetLastError (int32_t cardIndex, int32_t module, int32_t channel, int32_t *p_outlastError)
 Get the last error of a channel. For Gen 3 modules (P6 and PA), the valid error values are defined by the nai_can_error enumeration. For Gen 5 modules (CB1, CB2 and CB3), the valid error values will either be errors as defined in naibrd_CAN_GetBusStatus or naibrd_CAN_GetCommStatus.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetErrorCount (int32_t cardIndex, int32_t module, int32_t channel, bool_t *p_outisErrorPassive, int32_t *p_outrxErrorCount, int32_t *p_outtxErrorCount)
 Get the error statistics for a given channel.
 

Detailed Description

Function Documentation

◆ naibrd_CAN_GetBusStatus()

NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetBusStatus ( int32_t cardIndex,
int32_t module,
int32_t channel,
int32_t * p_outstatus )

Get the bus status of a channel. This indicates the type of error that has occurred on the bus. If more than one error occurs, all relevant error flag bits are set in this p_outstatus value. Bit meanings are as follows:

BIT 0 = CRC Error (1 = Indicates a CRC error has occurred. 0 = Indicates no CRC error) BIT 1 = Form Error (1 = Indicates a form error has occurred. 0 = Indicates no form error) BIT 2 = Stuff Error (1 = Indicates a stuff error has occurred. 0 = Indicates no stuff error) BIT 3 = Bit Error (1 = Indicates a bit error has occurred (received bit is not the same as the transmitted bit). 0 = Indicates no bit error) BIT 4 = Ack Error (1 = Indicates an acknowledgment error has occurred. 0 = Indicates no acknowledgment error) BIT 5 - 31 = RESERVED

enumeration.

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_outstatus: (Output) Core Status.
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_CAN_GetCommStatus()

NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetCommStatus ( int32_t cardIndex,
int32_t module,
int32_t channel,
naibrd_can_comm_status_type_t * p_outstatus )

Get the communication status of a channel. For P6 and PA modules, the valid communication status flags are defined by the nai_can_comm_status_t type (see header file). For Gen_5 modules (CB1, CB2 and CB3), the communication status are 32 bit error codes (not bitmapped).

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_outstatus: (Output) Communication Status.
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_CAN_GetCoreStatus()

NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetCoreStatus ( int32_t cardIndex,
int32_t module,
int32_t channel,
int32_t * p_outstatus )

Get the core status of a channel. This is the status of actual CAN core. The meaning of bits having been set high (1) is listed here: BIT 0 = Configuration Mode Indicator (1 = CAN core is in configuration mode. 0 = CAN core is NOT in configuration mode) BIT 1 = Loopback Mode Indicator (1 = CAN core is in loopback mode. 0 = CAN core is NOT in loopback mode) BIT 2 = Sleep Mode Indicator (1 = CAN core is in sleep mode. 0 = CAN core is NOT in sleep mode) BIT 3 = Normal Mode Indicator (1 = CAN core is in normal mode. 0 = CAN core is NOT in normal mode) BIT 4 = Bus Idle Indicator (1 = No bus communication is taking place. 0 = CAN core is either in configuration mode or the bus is busy) BIT 5 = Bus Busy Indicator (1 = CAN core is either receiving a message or transmitting a message. 0 = CAN core is either in configuration mode or the bus is idle) BIT 6 = Error Warning Indicator (1 = Indicates either the Transmit Error counter or the Receive Error counter have count of 96 or greater. 0 indicates neither counter have reached a count of 96) BIT 7 and 8 = Error Status Indicator (00 = Indicates configuration mode and error state is undefined. 01 = Indicates Error Active State. 11 = Indicates Error Passive State. 10 = Indicates Bus Off State) BIT 9 - 31 = RESERVED.

enumeration.

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_outstatus: (Output) Core Status.
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_CAN_GetErrorCount()

NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetErrorCount ( int32_t cardIndex,
int32_t module,
int32_t channel,
bool_t * p_outisErrorPassive,
int32_t * p_outrxErrorCount,
int32_t * p_outtxErrorCount )

Get the error statistics for a given channel.

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_outisErrorPassive: (Output) NAI_TRUE: if error is passive, NAI_FALSE: if not passive.
p_outrxErrorCount: (Output) Number of Rx errors.
p_outtxErrorCount: (Output) Number of Tx errors.
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_CAN_GetLastError()

NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetLastError ( int32_t cardIndex,
int32_t module,
int32_t channel,
int32_t * p_outlastError )

Get the last error of a channel. For Gen 3 modules (P6 and PA), the valid error values are defined by the nai_can_error enumeration. For Gen 5 modules (CB1, CB2 and CB3), the valid error values will either be errors as defined in naibrd_CAN_GetBusStatus or naibrd_CAN_GetCommStatus.

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_outlastError: (Output) The Last Error.
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_CAN_GetRxFIFOCount()

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

Get the number of words used in 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_outcount: (Output) Number of words currently in the Rx 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_INVALID_CHANNEL when invalid channel parameter is specified.
  • NAI_ERROR_NOT_SUPPORTED when function is not supported.

◆ naibrd_CAN_GetRxFIFOFrameCount()

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

Get the number of frames in 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_outcount: (Output) Number of frames in the Rx 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_INVALID_CHANNEL when invalid channel parameter is specified.
  • NAI_ERROR_NOT_SUPPORTED when function is not supported.

◆ naibrd_CAN_GetRxFIFOMessageWaiting()

NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetRxFIFOMessageWaiting ( int32_t cardIndex,
int32_t module,
int32_t channel,
bool_t * p_outmsgWaiting )

Determine whether or not a Rx message is waiting to be received.

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_outmsgWaiting: (Output) Message waiting (NAI_TRUE: message is waiting, NAI_FALSE: no message waiting).
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_CAN_GetTxFIFOCount()

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

Get the number of words used in 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_outcount: (Output) Number of words currently in the Tx 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_INVALID_CHANNEL when invalid channel parameter is specified.
  • NAI_ERROR_NOT_SUPPORTED when function is not supported.

◆ naibrd_CAN_GetTxFIFOFrameCount()

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

Get the number of frames in 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_outcount: (Output) Number of frames in the Tx 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_INVALID_CHANNEL when invalid channel parameter is specified.
  • NAI_ERROR_NOT_SUPPORTED when function is not supported.

◆ naibrd_CAN_GetTxFIFOMessageWaiting()

NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetTxFIFOMessageWaiting ( int32_t cardIndex,
int32_t module,
int32_t channel,
bool_t * p_outmsgWaiting )

Determine whether or not a Tx message is waiting to be transmitted.

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_outmsgWaiting: (Output) Message waiting (NAI_TRUE: message is waiting, NAI_FALSE: no message waiting).
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.