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

Go to the source code of this file.

Data Structures

struct  FIFO
 
struct  CanDataFrame
 

Typedefs

typedef struct FIFO FIFO
 
typedef struct CanDataFrame CanDataFrame
 

Functions

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.
 
bool_t naiapp_IsCAN (uint32_t moduleID)
 Determines if is CAN module.
 
bool_t naiapp_IsCAN_AB (int32_t cardIdx, int32_t module, int32_t channel)
 Determines if channel is set to CAN AB protocol.
 
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_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.
 
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 baud)
 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_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 (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_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_setCANTiming (int32_t cardIndex, int32_t module, naibrd_can_baud_rate_type_t canTiming, int32_t channel)
 Set CAN timing for channel.
 
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_printFIFOChannelData (int32_t channel, CanDataFrame *frameData, bool_t bJ1939)
 Prints the data in the FIFO.
 
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_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.
 
void naiapp_claimAddresses (int32_t card, int32_t mod, int32_t channel)
 
bool_t naiapp_isInputValidChannel (int8_t inputBuffer[80], int32_t *channelOut)
 
bool_t naiapp_QueryUserForCANTiming (naibrd_can_baud_rate_type_t *baudRate, bool_t bJ1939)
 
bool_t naiapp_QueryUserForAddressClaiming (bool_t *naiapp_claimAddresses)
 
bool_t naiapp_QueryForNumOfFramesToTransmit (int32_t *frames, int32_t minFrame, int32_t maxFrame)
 
bool_t naiapp_QueryForPayload (int32_t *size, int32_t minPayload, int32_t maxPayload, bool_t isJ1939)
 
bool_t naiapp_QueryForChannelProtocol (uint32_t modId, bool_t *isJ1939)
 
bool_t naiapp_QueryForPGN (uint32_t *pgn)
 
bool_t naiapp_QueryChannelForRxEnable (bool_t *rxEnable)
 
bool_t naiapp_QueryChannelForTxEnable (bool_t *txEnable)
 
bool_t naiapp_QueryForChannels (int32_t *minChannel, int32_t *maxChannel)
 
bool_t naiapp_QueryForTransmissionSource (bool_t *generateInput)
 
void naiapp_generateData (int32_t channel, int32_t numOfFrames, int32_t payLoadSize, bool_t isJ1939, CanDataFrame *buffer)
 

Variables

CanDataFrame fifoData [NAIBRD_GEN5_CAN_MAX_CHANNEL_COUNT]
 

Typedef Documentation

◆ CanDataFrame

typedef struct CanDataFrame CanDataFrame

◆ FIFO

typedef struct FIFO FIFO

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_claimAddresses()

void naiapp_claimAddresses ( int32_t card,
int32_t mod,
int32_t channel )

◆ naiapp_generateData()

void naiapp_generateData ( int32_t channel,
int32_t numOfFrames,
int32_t payLoadSize,
bool_t isJ1939,
CanDataFrame * buffer )

◆ naiapp_getBaudRateString()

char * naiapp_getBaudRateString ( naibrd_can_baud_rate_type_t baud)

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 cardIdx,
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_isInputValidChannel()

bool_t naiapp_isInputValidChannel ( int8_t inputBuffer[80],
int32_t * channelOut )

◆ naiapp_printFIFOChannelData()

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

Prints the data in the FIFO.

◆ naiapp_QueryChannelForRxEnable()

bool_t naiapp_QueryChannelForRxEnable ( bool_t * rxEnable)

◆ naiapp_QueryChannelForTxEnable()

bool_t naiapp_QueryChannelForTxEnable ( bool_t * txEnable)

◆ naiapp_QueryForChannelProtocol()

bool_t naiapp_QueryForChannelProtocol ( uint32_t modId,
bool_t * isJ1939 )

◆ naiapp_QueryForChannels()

bool_t naiapp_QueryForChannels ( int32_t * minChannel,
int32_t * maxChannel )

◆ naiapp_QueryForNumOfFramesToTransmit()

bool_t naiapp_QueryForNumOfFramesToTransmit ( int32_t * frames,
int32_t minFrame,
int32_t maxFrame )

◆ naiapp_QueryForPayload()

bool_t naiapp_QueryForPayload ( int32_t * size,
int32_t minPayload,
int32_t maxPayload,
bool_t isJ1939 )

◆ naiapp_QueryForPGN()

bool_t naiapp_QueryForPGN ( uint32_t * pgn)

◆ naiapp_QueryForTransmissionSource()

bool_t naiapp_QueryForTransmissionSource ( bool_t * generateInput)

◆ naiapp_QueryUserForAddressClaiming()

bool_t naiapp_QueryUserForAddressClaiming ( bool_t * naiapp_claimAddresses)

◆ naiapp_QueryUserForCANTiming()

bool_t naiapp_QueryUserForCANTiming ( naibrd_can_baud_rate_type_t * baudRate,
bool_t bJ1939 )

◆ 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]
extern