Software Library API naibrd 1.62
See all documentation at naii.docs.com
naibrd_can.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include "functions/naibrd_can.h"
#include "maps/nai_map_can.h"
#include "advanced/naibrd_adv.h"
#include "naibrd_config.h"
#include "boards/naibrd_gen5.h"

Macros

#define NAI_CAN_GEN5_PF_SHIFT   (0x00000010u)
 
#define NAI_CAN_GEN5_MAX_PF_FOR_DEST   (0x000000F0u)
 

Functions

NAIBRDFUNC int32_t NAIAPI naibrd_CAN_GetChannelCount (uint32_t modid)
 Returns the number of channels for the specified CAN Module ID.
 
NAIBRDFUNC int32_t NAIAPI naibrd_CAN_GetChannelCountByModIndex (uint32_t cardIndex, uint32_t module)
 Returns the number of channels for the specified card and CAN Module Index.
 
NAIBRDFUNC int32_t NAIAPI naibrd_CAN_GetMaxFifoCount (uint32_t modid)
 Returns the max Fifo count for the specified CAN Module ID.
 
NAIBRDFUNC int32_t NAIAPI naibrd_CAN_GetFrameSize (uint32_t modid)
 Returns the frame size for the specified CAN Module ID.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_QueueTransmit (int32_t cardIndex, int32_t module, int32_t channel, bool_t ismodeA, int32_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_CAN_QueueTransmit_Ex (int32_t cardIndex, int32_t module, int32_t channel, bool_t ismodeA, int32_t msgid, uint32_t width, void *buffer, uint32_t length)
 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_Transmit (int32_t cardIndex, int32_t module, int32_t channel, bool_t ismodeA, int32_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_CAN_Transmit_Ex (int32_t cardIndex, int32_t module, int32_t channel, bool_t ismodeA, int32_t msgid, uint32_t width, void *buffer, uint32_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_CAN_Receive (int32_t cardIndex, int32_t module, int32_t channel, int32_t buflen, bool_t *outismodeA, int32_t *outmsgid, uint8_t *outbuffer, int32_t *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 fill as much as it can, discard the rest of the message, and return NAI_ERROR_MORE_DATA. You can avoid this by passing a buffer of length NAI_AB_MAX_DATA_LEN.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_Receive_Ex (int32_t cardIndex, int32_t module, int32_t channel, uint32_t buflen, bool_t *outismodeA, int32_t *outmsgid, uint32_t width, void *outbuffer, uint32_t *outlength)
 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_QueueTransmit_J1939 (int32_t cardIndex, int32_t module, int32_t channel, int32_t PGN, int32_t priority, int32_t destination, uint8_t *buffer, int32_t length)
 Queues a message to transmit on a J1939 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_J1939_MAX_DATA_LEN, the function will return immediately with a value of NAI_ERROR_INVALID_RANGE.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_QueueTransmit_J1939_Ex (int32_t cardIndex, int32_t module, int32_t channel, int32_t PGN, int32_t priority, int32_t destination, uint32_t width, void *buffer, uint32_t length)
 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 NAI_J1939_MAX_DATA_LEN, the function will return immediately with a value of NAI_ERROR_INVALID_RANGE.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_Transmit_J1939 (int32_t cardIndex, int32_t module, int32_t channel, int32_t PGN, int32_t priority, int32_t destination, uint8_t *buffer, int32_t length)
 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_Transmit_J1939_Ex (int32_t cardIndex, int32_t module, int32_t channel, int32_t PGN, int32_t priority, int32_t destination, uint32_t width, void *buffer, uint32_t length)
 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_Receive_J1939 (int32_t cardIndex, int32_t module, int32_t channel, int32_t buflen, int32_t *outPGN, int32_t *outsource, int32_t *outdestination, uint8_t *outbuffer, int32_t *outlength)
 Attempts to read a message off a J1939 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 fill as much as it can, discard the rest of the message, and return NAI_ERROR_MORE_DATA. You can avoid this by passing a buffer of length NAI_J1939_MAX_DATA_LEN.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_Receive_J1939_Ex (int32_t cardIndex, int32_t module, int32_t channel, uint32_t buflen, int32_t *outPGN, int32_t *outsource, int32_t *outdestination, uint32_t width, void *outbuffer, uint32_t *outlength)
 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.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_SetAddress (int32_t cardIndex, int32_t module, int32_t channel, int32_t address)
 Set the CAN channel's SAE J1939 address. NOTE: In order for address assignment to work, all channels on the the bus need to be enabled for TX and RX so each channel can communicate with the channel requesting the address.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetAddress (int32_t cardIndex, int32_t module, int32_t channel, int32_t *outaddress, int32_t *outstatus)
 Get the CAN channel's SAE J1939 address.
 
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.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_SetTxBufferAlmostEmpty (int32_t cardIndex, int32_t module, int32_t channel, int32_t almostEmptyValue)
 Set the Tx Buffer Almost Empty value for a given channel.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetTxBufferAlmostEmpty (int32_t cardIndex, int32_t module, int32_t channel, int32_t *outAlmostEmptyValue)
 Get the Tx Buffer Almost Empty value for a given channel.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_SetRxBufferAlmostFull (int32_t cardIndex, int32_t module, int32_t channel, int32_t almostFullValue)
 Set the Rx Buffer Almost Full value for a given channel.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetRxBufferAlmostFull (int32_t cardIndex, int32_t module, int32_t channel, int32_t *outAlmostFullValue)
 Get the Rx Buffer Almost Full value for a given channel.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_SetRxBufferHighWatermark (int32_t cardIndex, int32_t module, int32_t channel, int32_t highWatermarkValue)
 Set the Rx Buffer High Watermark value for a given channel.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetRxBufferHighWatermark (int32_t cardIndex, int32_t module, int32_t channel, int32_t *outHighWatermarkValue)
 Get the Rx Buffer High Watermark value for a given channel.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_SetRxBufferLowWatermark (int32_t cardIndex, int32_t module, int32_t channel, int32_t lowWatermarkValue)
 Set the Rx Buffer Low Watermark value for a given channel.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetRxBufferLowWatermark (int32_t cardIndex, int32_t module, int32_t channel, int32_t *outLowWatermarkValue)
 Get the Rx Buffer Low Watermark value for a given channel.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_StartConfigChanges (int32_t cardIndex, int32_t module, int32_t channel)
 Sets a bit in the control register indicating the user is making configuration changes. Calling this function will force the CAN module to ignore any configuration changes made until such time that the naibrd_CAN_ApplyConfigChanges is called.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_ApplyConfigChanges (int32_t cardIndex, int32_t module, int32_t channel)
 Clears a bit in the control register indicating the user is finished making configuration changes. Calling this function will force the CAN module to once again check and apply any detected changes to the CAN configuration.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_ChannelReset (int32_t cardIndex, int32_t module, int32_t channel)
 Reset the channel specified.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_SetRxEnable (int32_t cardIndex, int32_t module, int32_t channel, bool_t enable)
 Enables or disables Receive for the channel specified.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetRxEnable (int32_t cardIndex, int32_t module, int32_t channel, bool_t *outenable)
 Get Receive enable setting for the channel specified.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_SetTxEnable (int32_t cardIndex, int32_t module, int32_t channel, bool_t enable)
 Enables or disables Transmit for the channel specified.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetTxEnable (int32_t cardIndex, int32_t module, int32_t channel, bool_t *outenable)
 Get Transmit enable setting for the channel specified.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_SetProtocol (int32_t cardIndex, int32_t module, int32_t channel, nai_can_protocol_type_t protocol)
 naibrd_CAN_SetProtocol sets the CAN protocol to be used for the specified channel. This function is only supported for modules that allow a per channel protocol to be configured (such as the CB3).
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetProtocol (int32_t cardIndex, int32_t module, int32_t channel, nai_can_protocol_type_t *protocol)
 naibrd_CAN_GetProtocol gets the CAN protocol being used for the specified channel. Modules such as CB1 will always report a protocol of CAN AB, CB2 will always report a protocol of J1939 and CB3 could potentially be either CAN AB or J1939 depending on how each channel was configured.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_ResetTxFifo (int32_t cardIndex, int32_t module, int32_t channel)
 naibrd_CAN_ResetTxFifo forces the TX FIFO to be emptied without the need to force transmission to empty the FIFO.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_ResetRxFifo (int32_t cardIndex, int32_t module, int32_t channel)
 naibrd_CAN_ResetRxFifo forces the RX FIFO to be emptied without the need to force receiving to empty the FIFO.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_ResetTxAndRxFifos (int32_t cardIndex, int32_t module, int32_t channel)
 naibrd_CAN_ResetTxAndRxFifos forces the TX FIFO and RX FIFO to be emptied without the need to force transmitting and receiving to empty the FIFOs.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_SetBitTiming (int32_t cardIndex, int32_t module, int32_t channel, int32_t prescaler, int32_t SJW, int32_t tseg1, int32_t tseg2)
 Change the bit timing for a particular CAN module channel.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetBitTiming (int32_t cardIndex, int32_t module, int32_t channel, int32_t *outprescaler, int32_t *outSJW, int32_t *outtseg1, int32_t *outtseg2)
 Retrieve the bit timing for a particular CAN module channel.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_SetBaudRate (int32_t cardIndex, int32_t module, int32_t channel, nai_can_baud_rate_type_t baudRate)
 Change the baud rate for a particular CAN module channel. - This function can be used in place of naibrd_CAN_SetBitTiming if you know what baud rate you want but you do not want to specify the specific bit timing parameters to achieve the desired baud rate. We will take care of determining bit timing parameters to achieve the desired baud rate.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetBaudRate (int32_t cardIndex, int32_t module, int32_t channel, nai_can_baud_rate_type_t *outbaudRate)
 Retrieve the baud rate for a particular CAN module channel. NOTE: This function retrieves the value of what was last assigned using the "naibrd_CAN_SetBaudRate" function call. If baud rate was set using the naibrd_CAN_SetBitTiming, a call to naibrd_CAN_GetBaudRate will return 0 since no attempt is made to reverse calculate what the baud rate is based upon the bit timing parameters.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetMaxFilterCount (int32_t cardIndex, int32_t module, int32_t channel, int32_t *outMaxFilterCount)
 Retrieve the max filter count for the specified module.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_StartFilterChanges (int32_t cardIndex, int32_t module, int32_t channel)
 Sets a bit in the filter control register indicating the user is making filter changes. Calling this function will force the CAN module to ignore any changes made until such time that the naibrd_CAN_ApplyFilterChanges is called.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_ApplyFilterChanges (int32_t cardIndex, int32_t module, int32_t channel)
 Clears a bit in the filter control register indicating the user is finished making filter changes. Call this function will force the CAN module to once again check and apply any detected changes to the CAN filtering.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_SetEnFilterCount (int32_t cardIndex, int32_t module, int32_t channel, int32_t enableFilterCount)
 Specifies the number of CAN filters to be enabled for the specified Card, Module and Channel. NOTE: Configuring of filters should be performed between calls to naibrd_CAN_StartFilterChanges and naibrd_CAN_ApplyFilterChanges.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetEnFilterCount (int32_t cardIndex, int32_t module, int32_t channel, int32_t *outEnabledFilterCount)
 Returns the number of CAN acceptance filters enabled for the specified Card, Module and Channel.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_ClearFilter (int32_t cardIndex, int32_t module, int32_t channel, int32_t filter)
 Clears all filter settings for the specified Card, Module, Channel and Filter.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_SetPrioFilterEn (int32_t cardIndex, int32_t module, int32_t channel, int32_t filter, bool_t enable)
 Enables or disables Priority filtering for the channel specified (J1939 only). NOTE: Configuring of filters should be performed between calls to naibrd_CAN_StartFilterChanges and naibrd_CAN_ApplyFilterChanges.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetPrioFilterEn (int32_t cardIndex, int32_t module, int32_t channel, int32_t filter, bool_t *outenable)
 Get Priority filter enable setting for the channel specified (J1939 only).
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_SetSrcFilterEn (int32_t cardIndex, int32_t module, int32_t channel, int32_t filter, bool_t enable)
 Enables or disables Source filtering for the channel specified (J1939 only). NOTE: Configuring of filters should be performed between calls to naibrd_CAN_StartFilterChanges and naibrd_CAN_ApplyFilterChanges.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetSrcFilterEn (int32_t cardIndex, int32_t module, int32_t channel, int32_t filter, bool_t *outenable)
 Get Source filter enable setting for the channel specified (J1939 only).
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_SetDestFilterEn (int32_t cardIndex, int32_t module, int32_t channel, int32_t filter, bool_t enable)
 Enables or disables Destination filtering for the channel specified (J1939 only). NOTE: Configuring of filters should be performed between calls to naibrd_CAN_StartFilterChanges and naibrd_CAN_ApplyFilterChanges.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetDestFilterEn (int32_t cardIndex, int32_t module, int32_t channel, int32_t filter, bool_t *outenable)
 Get Destination filter enable setting for the channel specified (J1939 only).
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_SetPGNFilterEn (int32_t cardIndex, int32_t module, int32_t channel, int32_t filter, bool_t enable)
 Enables or disables PGN filtering for the channel specified (J1939 only). NOTE: Configuring of filters should be performed between calls to naibrd_CAN_StartFilterChanges and naibrd_CAN_ApplyFilterChanges.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetPGNFilterEn (int32_t cardIndex, int32_t module, int32_t channel, int32_t filter, bool_t *outenable)
 Get PGN filter enable setting for the channel specified (J1939 only).
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_SetPrioFilter (int32_t cardIndex, int32_t module, int32_t channel, int32_t filter, int32_t priofilter)
 Set the CAN channel's priority filter value. When the priority filter is enabled, only messages with a priority matching the filter value are accepted (J1939 only). NOTE: Configuring of filters should be performed between calls to naibrd_CAN_StartFilterChanges and naibrd_CAN_ApplyFilterChanges.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetPrioFilter (int32_t cardIndex, int32_t module, int32_t channel, int32_t filter, int32_t *outpriofilter)
 Get the CAN channel's priority filter value. When the priority filter is enabled, only messages with a priority matching the filter value are accepted (J1939 only).
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_SetSrcFilter (int32_t cardIndex, int32_t module, int32_t channel, int32_t filter, int32_t srcfilter)
 Set the CAN channel's source filter value. When the source filter is enabled, only messages with a source address matching the filter value are accepted (J1939 only). NOTE: Configuring of filters should be performed between calls to naibrd_CAN_StartFilterChanges and naibrd_CAN_ApplyFilterChanges.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetSrcFilter (int32_t cardIndex, int32_t module, int32_t channel, int32_t filter, int32_t *outsrcfilter)
 Get the CAN channel's source filter value. When the source filter is enabled, only messages with a source address matching the filter value are accepted (J1939 only).
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_SetDestFilter (int32_t cardIndex, int32_t module, int32_t channel, int32_t filter, int32_t destfilter)
 Set the CAN channel's destination filter value. When the destination filter is enabled, only messages with a destination address matching the filter value are accepted (J1939 only). NOTE: Configuring of filters should be performed between calls to naibrd_CAN_StartFilterChanges and naibrd_CAN_ApplyFilterChanges.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetDestFilter (int32_t cardIndex, int32_t module, int32_t channel, int32_t filter, int32_t *outdestfilter)
 Get the CAN channel's destination filter value. When the destination filter is enabled, only messages with a destination address matching the filter value are accepted (J1939 only).
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_SetPGNFilter (int32_t cardIndex, int32_t module, int32_t channel, int32_t filter, int32_t pgnfilter)
 Set the CAN channel's PGN filter value. When the PGN filter is enabled, only messages with a PGN matching the filter value are accepted (J1939 only). NOTE: Configuring of filters should be performed between calls to naibrd_CAN_StartFilterChanges and naibrd_CAN_ApplyFilterChanges.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetPGNFilter (int32_t cardIndex, int32_t module, int32_t channel, int32_t filter, int32_t *outpgnfilter)
 Get the CAN channel's PGN filter value. When the PGN filter is enabled, only messages with a PGN matching the filter value are accepted (J1939 only).
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_SetAcceptCodeEn (int32_t cardIndex, int32_t module, int32_t channel, int32_t filter, bool_t enable)
 Enables or disables Acceptance Code / Mask filtering for the channel specified (CAN A/B only). NOTE: Configuring of filters should be performed between calls to naibrd_CAN_StartFilterChanges and naibrd_CAN_ApplyFilterChanges.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetAcceptCodeEn (int32_t cardIndex, int32_t module, int32_t channel, int32_t filter, bool_t *outenable)
 Get Acceptance Code / Mask filter enable setting for the channel specified (CAN A/B only).
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_SetABFilterEn (int32_t cardIndex, int32_t module, int32_t channel, int32_t filter, bool_t enable)
 Enables or disables CAN-A / CAN-B filtering for the channel specified (CAN A/B only). NOTE: Configuring of filters should be performed between calls to naibrd_CAN_StartFilterChanges and naibrd_CAN_ApplyFilterChanges.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetABFilterEn (int32_t cardIndex, int32_t module, int32_t channel, int32_t filter, bool_t *outenable)
 Get CAN-A / CAN-B filter enable setting for the channel specified (CAN A/B only).
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_SetStdExtFilter (int32_t cardIndex, int32_t module, int32_t channel, int32_t filter, bool_t enableStdMsgs)
 Specifies whether to allow Standard / Extended CAN frames to pass through for the channel specified. NOTE: Configuring of filters should be performed between calls to naibrd_CAN_StartFilterChanges and naibrd_CAN_ApplyFilterChanges.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetStdExtFilter (int32_t cardIndex, int32_t module, int32_t channel, int32_t filter, bool_t *outEnableStdMsgs)
 Get Standard / Extended Mode filter enable setting for the channel specified.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_SetSubRTRFilter (int32_t cardIndex, int32_t module, int32_t channel, int32_t filter, bool_t enableSubRTRMsgs)
 Specifies whether to allow CAN frames that have Substitute RTR bit set to pass through for the channel specified. NOTE: Configuring of filters should be performed between calls to naibrd_CAN_StartFilterChanges and naibrd_CAN_ApplyFilterChanges.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetSubRTRFilter (int32_t cardIndex, int32_t module, int32_t channel, int32_t filter, bool_t *outEnableSubRTRMsgs)
 Get Sub RTR (Substitute Remote Transmission Request) filter enable setting for the channel specified.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_SetRTRFilter (int32_t cardIndex, int32_t module, int32_t channel, int32_t filter, bool_t enableRTRMsgs)
 Specifies whether to allow CAN frames that have RTR bit set to pass through for the channel specified. NOTE: Configuring of filters should be performed between calls to naibrd_CAN_StartFilterChanges and naibrd_CAN_ApplyFilterChanges.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetRTRFilter (int32_t cardIndex, int32_t module, int32_t channel, int32_t filter, bool_t *outEnableRTRMsgs)
 Get RTR (Remote Transmission Request) filter setting for the channel specified.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_SetSubRTRFilterEn (int32_t cardIndex, int32_t module, int32_t channel, int32_t filter, bool_t enable)
 Enables or disables substitute remote transmission request filtering for the channel specified (standard frame). NOTE: Configuring of filters should be performed between calls to naibrd_CAN_StartFilterChanges and naibrd_CAN_ApplyFilterChanges.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetSubRTRFilterEn (int32_t cardIndex, int32_t module, int32_t channel, int32_t filter, bool_t *outenable)
 Get substitute remote transmission request filter enable setting for the channel specified.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_SetRTRFilterEn (int32_t cardIndex, int32_t module, int32_t channel, int32_t filter, bool_t enable)
 Enables or disables remote transmission request filtering for the channel specified (extended frame). NOTE: Configuring of filters should be performed between calls to naibrd_CAN_StartFilterChanges and naibrd_CAN_ApplyFilterChanges.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetRTRFilterEn (int32_t cardIndex, int32_t module, int32_t channel, int32_t filter, bool_t *outenable)
 Get remote transmission request filter enable setting for the channel specified.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_SetAcceptMask (int32_t cardIndex, int32_t module, int32_t channel, int32_t filter, int32_t acceptmask)
 Set the CAN channel's Acceptance Mask value. When the Acceptance Code filter is enabled, only messages with an Acceptance Code / Mask matching the filter value are accepted. NOTE: Configuring of filters should be performed between calls to naibrd_CAN_StartFilterChanges and naibrd_CAN_ApplyFilterChanges.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetAcceptMask (int32_t cardIndex, int32_t module, int32_t channel, int32_t filter, int32_t *outacceptmask)
 Get the CAN channel's Acceptance Mask filter value (CAN A/B only). When the Acceptance Code filter is enabled, only messages with an Acceptance Code / Mask matching the filter value are accepted.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_SetAcceptCode (int32_t cardIndex, int32_t module, int32_t channel, int32_t filter, int32_t acceptcode)
 Set the CAN channel's Acceptance Code filter value. When the Acceptance Code filter is enabled, only messages with an Acceptance Code / Mask matching the filter value are accepted. NOTE: Configuring of filters should be performed between calls to naibrd_CAN_StartFilterChanges and naibrd_CAN_ApplyFilterChanges.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetAcceptCode (int32_t cardIndex, int32_t module, int32_t channel, int32_t filter, int32_t *outacceptcode)
 Get the CAN channel's Acceptance Code filter value (CAN A/B only). When the Acceptance Code filter is enabled, only messages with an Acceptance Code / Mask matching the filter value are accepted.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_SetInterruptEdgeLevel (int32_t cardIndex, int32_t module, nai_can_status_type_t type, uint32_t edgeLevel)
 Sets the Interrupt Edge/Level register value for the specified CAN channel.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetInterruptEdgeLevel (int32_t cardIndex, int32_t module, nai_can_status_type_t type, uint32_t *outEdgeLevel)
 Retrieves the Interrupt Edge/Level register value for the specified CAN channel.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_SetInterruptSteering (int32_t cardIndex, int32_t module, nai_can_status_type_t type, naibrd_int_steering_t steering)
 Sets the Interrupt Steering which indicates the interrupt direction for the specified channel.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetInterruptSteering (int32_t cardIndex, int32_t module, nai_can_status_type_t type, naibrd_int_steering_t *outsteering)
 Retrieves the Interrupt Steering which indicates the interrupt direction for the specified channel.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetStatus (int32_t cardIndex, int32_t module, int32_t channel, nai_can_status_type_t type, nai_status_bit_t *outstatusVal)
 Get the interrupt status for the specified channel. Valid interrupt status flags are defined by the nai_can_status_type enumeration.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetSWTData (int32_t cardIndex, int32_t module, int32_t channel, bool_t *updateOccured, bool_t *interruptOccured, nai_can_swt_fault_type_t *faultType, uint32_t *faultValue)
 Gets the information associated with the SWT (Short Wire Test) status for a specific channel.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_ClearStatus (int32_t cardIndex, int32_t module, int32_t channel, nai_can_status_type_t type)
 Set the interrupt enable bit for the specified channel.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_SetIntEnable (int32_t cardIndex, int32_t module, int32_t channel, bool_t enable)
 Set the interrupt enable bit for the specified channel. This call is specific to the RECV Status.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetIntEnable (int32_t cardIndex, int32_t module, int32_t channel, bool_t *outenable)
 Get the interrupt enable for the specified channel. This call is specific to the RECV Status.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_SetSWTIntEnable (int32_t cardIndex, int32_t module, int32_t channel, bool_t enable)
 Set the interrupt enable bit for the specified channel. This is specific to the SWT Status.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetSWTIntEnable (int32_t cardIndex, int32_t module, int32_t channel, bool_t *enable)
 Gets the interrupt enable for the specified channel. This is specific to the SWT Status.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_SetIntVector (int32_t cardIndex, int32_t module, int32_t channel, nai_can_status_type_t type, int32_t intvector)
 Set the interrupt vector for the specified channel.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetIntVector (int32_t cardIndex, int32_t module, int32_t channel, nai_can_status_type_t type, int32_t *outintvector)
 Get the interrupt vector for the specified channel.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_SetControlRaw (int32_t cardIndex, int32_t module, int32_t channel, nai_can_ctrl_t controlraw)
 Set the control register value for a given channel. The valid control flags are defined by the NAI_CAN_CTRL enumeration. NOTE: CAN Configuration calls should be performed between calls to naibrd_CAN_StartConfigChanges and naibrd_CAN_ApplyConfigChanges.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetControlRaw (int32_t cardIndex, int32_t module, int32_t channel, nai_can_ctrl_t *outcontrolraw)
 Get the control register value for a given channel. The valid control flags are defined by the NAI_CAN_CTRL enumeration.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_SetFilterControlRaw (int32_t cardIndex, int32_t module, int32_t channel, nai_can_filt_ctrl_t filterControlRaw)
 Set the filter control register value for a given channel. The valid control flags are defined by the NAI_CAN_FILT_CTRL enumeration. Gen5 Only NOTE: Configuring of filters should be performed between calls to naibrd_CAN_StartFilterChanges and naibrd_CAN_ApplyFilterChanges.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetFilterControlRaw (int32_t cardIndex, int32_t module, int32_t channel, nai_can_filt_ctrl_t *outFilterControlRaw)
 Get the filter control register value for a given channel. The valid control flags are defined by the NAI_CAN_FILT_CTRL enumeration. Gen5 Only.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_SetIntEnableRaw (int32_t cardIndex, int32_t module, int32_t enableraw)
 Set the value of the Interrupt enable register.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetIntEnableRaw (int32_t cardIndex, int32_t module, int32_t *outenableraw)
 Get the value of the Interrupt enable register.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_ClearStatusRaw (int32_t cardIndex, int32_t module, nai_can_status_type_t type, uint32_t rawdata)
 clear the interrupt status bits specified in the rawdata. Valid interrupt status flags are defined by the nai_can_status_type enumeration.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetStatusRaw (int32_t cardIndex, int32_t module, nai_can_status_type_t type, nai_status_bit_t *outstatusraw)
 Get the interrupt status for all channel. Valid interrupt status flags are defined by the nai_can_status_type enumeration.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetFifoStatusRaw (int32_t cardIndex, int32_t module, int32_t channel, uint32_t *outFifoStatus)
 Get the FIFO status for specified channel.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetDropCount (int32_t cardIndex, int32_t module, int32_t channel, int32_t *outDropCountVal)
 Get the Drop Count for specified channel. (How many CAN msgs known to have been dropped)
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_SetLevelControl (int32_t cardIndex, int32_t module, int32_t channel, bool_t enable)
 This function is for diagnostic use only. When enabled, it will force the channel to output a constant dominant level for 300-700 microseconds, then force the level recessive until disabled.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_InitiateBIT (int32_t cardIndex, int32_t module, int32_t channel, bool_t waitForResult)
 Executes the CAN Built-in Test and returns the results. BIT takes the channel off line, executes the tests and then reconnects the channel. The results of the test are returned in the status if waitForResult = 1, otherwise the return value will be any of the statuses listed below with the exception of NAI_ERROR_TIMEOUT and NAI_ERROR_BIT_FAILED.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_CheckBITComplete (int32_t cardIndex, int32_t module, int32_t channel, bool_t *outBitComplete)
 Retrieves the BIT status (complete or incomplete) of the channel specified.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetBITStatus (int32_t cardIndex, int32_t module, int32_t channel, nai_can_status_access_type_t type, bool_t *outBitStatus)
 Retrieves the BIT status of the channel specified.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_ClearBITStatus (int32_t cardIndex, int32_t module, int32_t channel)
 Clears the latched BIT status of the channel specified.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_SetBITInterruptEnable (int32_t cardIndex, int32_t module, int32_t channel, bool_t intEnable)
 Sets the BIT Interrupt Enable register value for the specified CAN channel. Setting the bits to 1 enabled interrupts. Status is reported in the BIT Interrupt Status register.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetBITInterruptEnable (int32_t cardIndex, int32_t module, int32_t channel, bool_t *outIntEnable)
 Retrieves the BIT Interrupt Enable register value for the specified CAN channel. Setting the bits to 1 enabled interrupts. Status is reported in the BIT Interrupt Status register.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_SetBITInterruptEdgeLevel (int32_t cardIndex, int32_t module, int32_t channel, bool_t edgeLevel)
 Sets the BIT Interrupt Edge/Level register value for the specified CAN channel.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetBITInterruptEdgeLevel (int32_t cardIndex, int32_t module, int32_t channel, bool_t *outEdgeLevel)
 Retrieves the BIT Interrupt Edge/Level register value for the specified CAN channel.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_SetBITInterruptVector (int32_t cardIndex, int32_t module, uint32_t vector)
 Sets the BIT interrupt vector for the specified CAN module.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetBITInterruptVector (int32_t cardIndex, int32_t module, uint32_t *outvector)
 Retrieves the BIT interrupt vector for the specified CAN module.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_SetBITInterruptSteering (int32_t cardIndex, int32_t module, naibrd_int_steering_t steering)
 Sets the BIT Interrupt Steering which indicates the interrupt direction for the specified channel.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_CAN_GetBITInterruptSteering (int32_t cardIndex, int32_t module, naibrd_int_steering_t *outsteering)
 Retrieves the BIT Interrupt Steering which indicates the interrupt direction for the specified channel.
 

Macro Definition Documentation

◆ NAI_CAN_GEN5_MAX_PF_FOR_DEST

#define NAI_CAN_GEN5_MAX_PF_FOR_DEST   (0x000000F0u)

◆ NAI_CAN_GEN5_PF_SHIFT

#define NAI_CAN_GEN5_PF_SHIFT   (0x00000010u)