Software Library API naibrd 2.24.0
See all documentation at naii.docs.com
can_common_utils.c File Reference

Functions

bool_t naiapp_IsCAN (uint32_t moduleID)
 Determines if is CAN module.
 
bool_t naiapp_IsCAN_J1939 (int32_t cardIndex, int32_t module, int32_t channel)
 Determines if channel is set to J1939 protocol.
 
bool_t naiapp_IsCAN_AB (int32_t cardIndex, int32_t module, int32_t channel)
 Determines if channel is set to CAN AB protocol.
 
bool_t naiapp_GetCANCfg (int32_t defCard, int32_t defMod, int32_t defChan, int32_t *cardIndex, int32_t *module, int32_t *canChan, bool_t *isCanAB)
 Gets CAN configuration.
 
bool_t naiapp_QueryUserForTiming (int32_t cardIndex, int32_t module, int32_t channel, int32_t *prescaler, int32_t *sjw, int32_t *tseg1, int32_t *tseg2)
 Gets CAN timing for channel and prints to console.
 
void naiapp_setCANTiming (int32_t cardIndex, int32_t module, naibrd_can_baud_rate_type_t canTiming, int32_t channel)
 Set CAN timing for channel.
 
void naiapp_getCANTimingParameters (naibrd_can_baud_rate_type_t canTiming, int32_t *prescaler, int32_t *sjw, int32_t *tseg1, int32_t *tseg2)
 
char * naiapp_getBaudRateString (naibrd_can_baud_rate_type_t baudRate)
 Converts baud rate passed in to a string.
 
char * naiapp_getProtocolString (naibrd_can_protocol_type_t protocol)
 Converts protocol passed in to a string.
 
char * naiapp_getFaultTypeString (naibrd_can_swt_fault_type_t faultType)
 
void naiapp_setChannelToCANJ1939 (int32_t cardIndex, int32_t module, int32_t modId, int32_t *channelList, int32_t channelListSize)
 Sets the channels' protocols in channelList to CAN J1939.
 
void naiapp_setChannelToCANAB (int32_t cardIndex, int32_t module, int32_t modId, int32_t *channelList, int32_t channelListSize)
 Sets the channels' protocols within channelList to CAN AB.
 
void naiapp_setChannelToCANJ1939_R (int32_t cardIndex, int32_t module, int32_t modId, int32_t channel)
 Sets the channel protocol to J1939 if supported by module.
 
void naiapp_setChannelToCANAB_R (int32_t cardIndex, int32_t module, int32_t modId, int32_t channel)
 Sets the channel protocol to CAN AB if supported by module.
 
void naiapp_setTxEnable (int32_t cardIndex, int32_t module, int32_t channel, bool_t enable)
 Sets the CAN channel to Tx or disables Tx depending on the "enable" parameter.
 
void naiapp_setRxEnable (int32_t cardIndex, int32_t module, int32_t channel, bool_t enable)
 Sets the CAN channel to Rx or disables Rx depending on the "enable" parameter.
 
void naiapp_Cfg_Rx_CAN (int32_t cardIndex, int32_t module, int32_t channel, naibrd_can_baud_rate_type_t baudRate)
 This function configures the baud rate of the CAN channel and enables the channel to Rx.
 
void naiapp_Cfg_Tx_CAN (int32_t cardIndex, int32_t module, int32_t channel, naibrd_can_baud_rate_type_t baudRate)
 This function configures the baud rate of the can channel and enables the channels to Tx.
 
void naiapp_setCANFIFOStatusConditions (int32_t cardIndex, int32_t module, int32_t channel)
 Sets the thresholds for the status register of the passed in channel.
 
void naiapp_printFIFOChannelData (int32_t channel, CanDataFrame *frameData, bool_t bJ1939)
 Prints the data in the FIFO.
 
void naiapp_getFIFOChannelData (int32_t cardIndex, int32_t module, int32_t channel, CanDataFrame *frameData)
 Reads all the frames off the FIFO of the passed in channel and stores them in a buffer. Sets FIFO length.
 
void naiapp_transmitFIFOChannelData_PGN (int32_t cardIndex, int32_t module, int32_t channel, int32_t pgn, CanDataFrame *frameData, int32_t numOfFramesOnFifo)
 Transmits the FIFO data found on a given channel.
 

Variables

CanDataFrame fifoData [NAIBRD_GEN5_CAN_MAX_CHANNEL_COUNT]
 

Function Documentation

◆ naiapp_Cfg_Rx_CAN()

void naiapp_Cfg_Rx_CAN ( int32_t cardIndex,
int32_t module,
int32_t channel,
naibrd_can_baud_rate_type_t baudRate )

This function configures the baud rate of the CAN channel and enables the channel to Rx.

◆ naiapp_Cfg_Tx_CAN()

void naiapp_Cfg_Tx_CAN ( int32_t cardIndex,
int32_t module,
int32_t channel,
naibrd_can_baud_rate_type_t baudRate )

This function configures the baud rate of the can channel and enables the channels to Tx.

◆ naiapp_getBaudRateString()

char * naiapp_getBaudRateString ( naibrd_can_baud_rate_type_t baudRate)

Converts baud rate passed in to a string.

◆ naiapp_GetCANCfg()

bool_t naiapp_GetCANCfg ( int32_t defCard,
int32_t defMod,
int32_t defChan,
int32_t * cardIndex,
int32_t * module,
int32_t * canChan,
bool_t * isCanAB )

Gets CAN configuration.

◆ naiapp_getCANTimingParameters()

void naiapp_getCANTimingParameters ( naibrd_can_baud_rate_type_t canTiming,
int32_t * prescaler,
int32_t * sjw,
int32_t * tseg1,
int32_t * tseg2 )

◆ naiapp_getFaultTypeString()

char * naiapp_getFaultTypeString ( naibrd_can_swt_fault_type_t faultType)

◆ naiapp_getFIFOChannelData()

void naiapp_getFIFOChannelData ( int32_t cardIndex,
int32_t module,
int32_t channel,
CanDataFrame * frameData )

Reads all the frames off the FIFO of the passed in channel and stores them in a buffer. Sets FIFO length.

◆ naiapp_getProtocolString()

char * naiapp_getProtocolString ( naibrd_can_protocol_type_t protocol)

Converts protocol passed in to a string.

◆ naiapp_IsCAN()

bool_t naiapp_IsCAN ( uint32_t moduleID)

Determines if is CAN module.

◆ naiapp_IsCAN_AB()

bool_t naiapp_IsCAN_AB ( int32_t cardIndex,
int32_t module,
int32_t channel )

Determines if channel is set to CAN AB protocol.

◆ naiapp_IsCAN_J1939()

bool_t naiapp_IsCAN_J1939 ( int32_t cardIndex,
int32_t module,
int32_t channel )

Determines if channel is set to J1939 protocol.

◆ naiapp_printFIFOChannelData()

void naiapp_printFIFOChannelData ( int32_t channel,
CanDataFrame * frameData,
bool_t bJ1939 )

Prints the data in the FIFO.

◆ naiapp_QueryUserForTiming()

bool_t naiapp_QueryUserForTiming ( int32_t cardIndex,
int32_t module,
int32_t channel,
int32_t * prescaler,
int32_t * sjw,
int32_t * tseg1,
int32_t * tseg2 )

Gets CAN timing for channel and prints to console.

◆ naiapp_setCANFIFOStatusConditions()

void naiapp_setCANFIFOStatusConditions ( int32_t cardIndex,
int32_t module,
int32_t channel )

Sets the thresholds for the status register of the passed in channel.

◆ naiapp_setCANTiming()

void naiapp_setCANTiming ( int32_t cardIndex,
int32_t module,
naibrd_can_baud_rate_type_t canTiming,
int32_t channel )

Set CAN timing for channel.

◆ naiapp_setChannelToCANAB()

void naiapp_setChannelToCANAB ( int32_t cardIndex,
int32_t module,
int32_t modId,
int32_t * channelList,
int32_t channelListSize )

Sets the channels' protocols within channelList to CAN AB.

◆ naiapp_setChannelToCANAB_R()

void naiapp_setChannelToCANAB_R ( int32_t cardIndex,
int32_t module,
int32_t modId,
int32_t channel )

Sets the channel protocol to CAN AB if supported by module.

◆ naiapp_setChannelToCANJ1939()

void naiapp_setChannelToCANJ1939 ( int32_t cardIndex,
int32_t module,
int32_t modId,
int32_t * channelList,
int32_t channelListSize )

Sets the channels' protocols in channelList to CAN J1939.

◆ naiapp_setChannelToCANJ1939_R()

void naiapp_setChannelToCANJ1939_R ( int32_t cardIndex,
int32_t module,
int32_t modId,
int32_t channel )

Sets the channel protocol to J1939 if supported by module.

◆ naiapp_setRxEnable()

void naiapp_setRxEnable ( int32_t cardIndex,
int32_t module,
int32_t channel,
bool_t enable )

Sets the CAN channel to Rx or disables Rx depending on the "enable" parameter.

◆ naiapp_setTxEnable()

void naiapp_setTxEnable ( int32_t cardIndex,
int32_t module,
int32_t channel,
bool_t enable )

Sets the CAN channel to Tx or disables Tx depending on the "enable" parameter.

◆ naiapp_transmitFIFOChannelData_PGN()

void naiapp_transmitFIFOChannelData_PGN ( int32_t cardIndex,
int32_t module,
int32_t channel,
int32_t pgn,
CanDataFrame * frameData,
int32_t numOfFramesOnFifo )

Transmits the FIFO data found on a given channel.

Enables transmit and Receive channel so the address claiming process can occur. Address claiming needs to happen in order For the CAN channel to transmit and receive messages.

Verifies if input character correlates to a valid channel, if invalid, the channelOut parameter will be set to -1

Querys the user for the size of the payload in a can frame.

Querys the user for the number of frames to send on a channel in a given transmission.

Querys the user for the protocol to use.

Querys the user for CAN timing.

Querys the user for address claiming

Querys the user for PGN

Querys the user for Tx enable.

Querys the user for Rx enable.

Querys the user for desired channel range and validates.

Querys the user for if generated data is desired.

Generates Random data and fills the buffer

Variable Documentation

◆ fifoData

CanDataFrame fifoData[NAIBRD_GEN5_CAN_MAX_CHANNEL_COUNT]