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

Functions

NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetTxBufferCount (int32_t cardIndex, int32_t module, int32_t channel, int32_t *outcount)
 Get the number of words used in the Tx FIFO.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetRxBufferCount (int32_t cardIndex, int32_t module, int32_t channel, int32_t *outcount)
 Get the number of words used in the Rx FIFO.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetTxFrameCount (int32_t cardIndex, int32_t module, int32_t channel, int32_t *outcount)
 Get the number of frames in the Tx FIFO.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetRxFrameCount (int32_t cardIndex, int32_t module, int32_t channel, int32_t *outcount)
 Get the number of frames in the Rx FIFO.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetTxMessageWaiting (int32_t cardIndex, int32_t module, int32_t channel, bool_t *outmsgwaiting)
 Determine whether or not a Tx message is waiting to be transmitted.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetRxMessageWaiting (int32_t cardIndex, int32_t module, int32_t channel, bool_t *outmsgwaiting)
 Determine whether or not a Rx message is waiting to be transmitted.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetCoreStatus (int32_t cardIndex, int32_t module, int32_t channel, int32_t *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, nai_can_comm_status_t *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 *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 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 *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_GetHardwareError (int32_t cardIndex, int32_t module, nai_can_hardware_error_t *outherror)
 Get the hardware error flags as defined by the P6_HARDWARE_ERROR enumeration.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetErrorCount (int32_t cardIndex, int32_t module, int32_t channel, bool_t *outiserrorpassive, int32_t *outrxerrors, int32_t *outtxerrors)
 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 * 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 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]).
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,
nai_can_comm_status_t * 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]).
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 * 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]).
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 * outiserrorpassive,
int32_t * outrxerrors,
int32_t * outtxerrors )

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]).
outiserrorpassive: (Output) TRUE: if error is passive, FALSE: if not passive.
outrxerrors: (Output) Number of Rx errors.
outtxerrors: (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_GetHardwareError()

NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetHardwareError ( int32_t cardIndex,
int32_t module,
nai_can_hardware_error_t * outherror )

Get the hardware error flags as defined by the P6_HARDWARE_ERROR 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]).
outherror: (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_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 * 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]).
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_GetRxBufferCount()

NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetRxBufferCount ( int32_t cardIndex,
int32_t module,
int32_t channel,
int32_t * 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]).
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_GetRxFrameCount()

NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetRxFrameCount ( int32_t cardIndex,
int32_t module,
int32_t channel,
int32_t * 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]).
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_GetRxMessageWaiting()

NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetRxMessageWaiting ( int32_t cardIndex,
int32_t module,
int32_t channel,
bool_t * outmsgwaiting )

Determine whether or not a Rx 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]).
outmsgwaiting: (Output) Message waiting (TRUE: message is waiting, 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_GetTxBufferCount()

NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetTxBufferCount ( int32_t cardIndex,
int32_t module,
int32_t channel,
int32_t * 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]).
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_GetTxFrameCount()

NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetTxFrameCount ( int32_t cardIndex,
int32_t module,
int32_t channel,
int32_t * 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]).
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_GetTxMessageWaiting()

NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetTxMessageWaiting ( int32_t cardIndex,
int32_t module,
int32_t channel,
bool_t * 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]).
outmsgwaiting: (Output) Message waiting (TRUE: message is waiting, 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.