|
static int32_t | GetChannelCount (uint32_t modId) |
| Returns the number of CAN channels for the specified Module ID.
|
|
static int32_t | GetMaxPayloadCountForProtocol (naibrd_ar_can_protocol_type_t protocol) |
| Returns the maximum payload count for specified protocol.
|
|
static int32_t | GetMaxFifoCount (uint32_t modId) |
| Returns the maximum size the CAN Fifo's can hold.
|
|
static int32_t | GetFrameMinByteCount (uint32_t modId) |
| Returns the Minimum CAN frame count for the specified Module ID.
|
|
static int32_t | GetMaxFilterCount (uint32_t modId) |
| Returns the maximum number of filters that can be configured for the given Module ID.
|
|
static nai_status_t | verify_channel (uint32_t modId, int32_t channel) |
| Returns whether the given channel (1-based) is valid for the specified Module ID.
|
|
static nai_status_t | naibrd_WaitForCanControlOptionToFinish (int32_t cardIndex, int32_t module, int32_t channel, bool_t checkConfigEdit, uint32_t controlBitsToWaitOn) |
| Performs wait logic for CAN control options. Each control option request bit is set to a one (1) requesting an action to take place. When the task is finished, the bits are set back to a zero (0).
|
|
static nai_status_t | GetCmdBufferAddress (int32_t cardIndex, int32_t module, int32_t channel, uint32_t *p_cmdBufferAddr) |
| Returns what address to use for the Cmd Fifo. Newer baremetal implementations have a separate Cmd Fifo while previous versions made use of the Tx Fifo.
|
|
static nai_status_t | GetCmdBufferCountAddress (int32_t cardIndex, int32_t module, int32_t channel, uint32_t *p_cmdBufferCountAddr) |
| Returns what address to use for the Cmd Fifo Count. Newer baremetal implementations have a separate Cmd Fifo while previous versions made use of the Tx Fifo.
|
|
static nai_status_t | ResetCmdFifoIfNotEmpty (int32_t cardIndex, int32_t module, int32_t channel) |
| Resets the cmd FIFO to make sure.
|
|
NAIBRDFUNC int32_t NAIAPI | naibrd_AR_CAN_GetChannelCount (uint32_t modId) |
| Returns the number of channels for the specified CAN Module ID.
|
|
NAIBRDFUNC int32_t NAIAPI | naibrd_AR_CAN_GetChannelCountForModule (uint32_t cardIndex, uint32_t module) |
| Returns the number of channels for the specified card and CAN Module Index.
|
|
NAIBRDFUNC int32_t NAIAPI | naibrd_AR_CAN_GetMaxFifoCount (uint32_t modId) |
| Returns the max Fifo count for the specified CAN Module ID.
|
|
NAIBRDFUNC int32_t NAIAPI | naibrd_AR_CAN_GetMinFrameByteCount (uint32_t modId) |
| Returns the minimum frame byte count for the specified CAN Module ID.
|
|
NAIBRDFUNC nai_status_t NAIAPI | naibrd_AR_CAN_SetRxMaxWorkTimeMS (int32_t cardIndex, int32_t module, int32_t channel, int32_t rxMaxWorkTimeMS) |
| Sets the maximum allotted time in milliseconds that the CAN module is allowed to spend trying Rx messages into the Rx FIFO.
|
|
NAIBRDFUNC nai_status_t NAIAPI | naibrd_AR_CAN_GetRxMaxWorkTimeMS (int32_t cardIndex, int32_t module, int32_t channel, int32_t *p_outrxMaxWorkTimeMS) |
| Retrieves the maximum allotted time in milliseconds that the CAN module is allowed to spend trying Rx messages into the Rx FIFO.
|
|
NAIBRDFUNC nai_status_t NAIAPI | naibrd_AR_CAN_SetTxMaxWorkTimeMS (int32_t cardIndex, int32_t module, int32_t channel, int32_t txMaxWorkTimeMS) |
| Sets the maximum allotted time in milliseconds that the CAN module is allowed to spend trying Tx messages from the Tx FIFO.
|
|
NAIBRDFUNC nai_status_t NAIAPI | naibrd_AR_CAN_GetTxMaxWorkTimeMS (int32_t cardIndex, int32_t module, int32_t channel, int32_t *p_outtxMaxWorkTimeMS) |
| Retrieves the maximum allotted time in milliseconds that the CAN module is allowed to spend trying Tx messages from the Tx FIFO.
|
|
NAIBRDFUNC nai_status_t NAIAPI | naibrd_AR_CAN_QueueTransmit (int32_t cardIndex, int32_t module, int32_t channel, naibrd_ar_can_protocol_type_t protocol, bool_t isModeA, uint32_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_AR_CAN_Transmit (int32_t cardIndex, int32_t module, int32_t channel, naibrd_ar_can_protocol_type_t protocol, bool_t isModeA, uint32_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_AR_CAN_Receive (int32_t cardIndex, int32_t module, int32_t channel, int32_t bufLen, uint32_t *p_outmsgId, uint32_t *p_outtimestamp, uint8_t *p_outbuffer, int32_t *p_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 not attempt to retrieve the message until a full frame is detected.
|
|
NAIBRDFUNC nai_status_t NAIAPI | naibrd_AR_CAN_ScheduleMsg (int32_t cardIndex, int32_t module, int32_t channel, int16_t entryIndex, int16_t rate, int16_t skew, naibrd_ar_can_protocol_type_t protocol, bool_t isModeA, uint32_t msgId, uint8_t *buffer, int32_t length) |
| This function configures a message to be scheduled once the scheduler is started. Multiple messages can be scheduled by calling this function multiple times each time with a different entryIndex. Rate and skew can be set for each scheduled message and will be taken into account from the moment the scheduler is started.
|
|
NAIBRDFUNC nai_status_t NAIAPI | naibrd_AR_CAN_StartScheduler (int32_t cardIndex, int32_t module, int32_t channel) |
| This function starts the internal scheduler. If accurate spacing of CAN messages is desired, the appropriate sequence of actions should be to stop the scheduler (if running), configure the scheduled can messages and then when all can messages have been configured and added to the scheduler, then this function should be called to start all jobs.
|
|
NAIBRDFUNC nai_status_t NAIAPI | naibrd_AR_CAN_StopScheduler (int32_t cardIndex, int32_t module, int32_t channel) |
| This function stops the internal scheduler. All scheduled can messages will stop if this function is called. See naibrd_AR_CAN_StartScheduler for more information regarding configuring the scheduler.
|
|
NAIBRDFUNC nai_status_t NAIAPI | naibrd_AR_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_AR_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_AR_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_AR_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_AR_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_AR_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_AR_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_AR_CAN_ResetLastError (int32_t cardIndex, int32_t module, int32_t channel) |
| Resets the last error of a channel.
|
|
NAIBRDFUNC nai_status_t NAIAPI | naibrd_AR_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_AR_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_AR_CAN_ChannelReset (int32_t cardIndex, int32_t module, int32_t channel) |
| Reset the channel specified.
|
|
NAIBRDFUNC nai_status_t NAIAPI | naibrd_AR_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_AR_CAN_GetTxEnable (int32_t cardIndex, int32_t module, int32_t channel, bool_t *p_outenable) |
| Get Transmit enable setting for the channel specified.
|
|
NAIBRDFUNC nai_status_t NAIAPI | naibrd_AR_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_AR_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_AR_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_AR_CAN_SetBaudRate (int32_t cardIndex, int32_t module, int32_t channel, naibrd_ar_can_low_rate_type_t baseBaudRate, naibrd_ar_can_high_rate_type_t dataBaudRate) |
| 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_AR_CAN_GetBaudRate (int32_t cardIndex, int32_t module, int32_t channel, naibrd_ar_can_low_rate_type_t *p_outbaseBaudRate, naibrd_ar_can_high_rate_type_t *p_outdataBaudRate) |
| 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_AR_CAN_SetSamplePoint (int32_t cardIndex, int32_t module, int32_t channel, naibrd_ar_can_sample_point_type_t samplePoint) |
| Sets the sample point to be used for the channel. Most devices work just fine with a sample point of 75% (0) but some need a sample rate of 80% (1).
|
|
NAIBRDFUNC nai_status_t NAIAPI | naibrd_AR_CAN_GetMaxAcceptFilterCount (int32_t cardIndex, int32_t module, int32_t channel, int32_t *p_outmaxFilterCount) |
| Retrieve the max filter count for the specified module.
|
|
NAIBRDFUNC nai_status_t NAIAPI | naibrd_AR_CAN_EnableAcceptFilters (int32_t cardIndex, int32_t module, int32_t channel, bool_t enableFilters) |
| This enables/disables the filtering capability for the specified channel.This is "channel granularity" not "filter granularity". - i.e. either all of the filters for the specified channel are enabled or they are all disabled.
|
|
NAIBRDFUNC nai_status_t NAIAPI | naibrd_AR_CAN_SetAcceptFilter (int32_t cardIndex, int32_t module, int32_t channel, int32_t filter, uint32_t msgId, bool_t isModeA, uint8_t *p_firstTwoBytes) |
| This assigns the filter criteria to be used (compared to) after incoming messages pass through the corresponding filter mask. If all bits found in the filter match bits still enabled after passing through the filter mask, the message is "accepted" else the message is "rejected".
|
|
NAIBRDFUNC nai_status_t NAIAPI | naibrd_AR_CAN_GetAcceptFilter (int32_t cardIndex, int32_t module, int32_t channel, int32_t filter, uint32_t *p_outmsgId, bool_t *p_outisModeA, uint8_t *p_outfirstTwoBytes) |
| This retrieve the current filter values for the specified filter index / position.
|
|
NAIBRDFUNC nai_status_t NAIAPI | naibrd_AR_CAN_SetAcceptMask (int32_t cardIndex, int32_t module, int32_t channel, int32_t mask, uint32_t msgId, bool_t isModeA, uint8_t *p_firstTwoBytes) |
| This assigns the mask criteria to be used - Incoming messages are passed through this mask and then compared to the corresponding filter after it is passed through this same mask. If all of the bits match, the message is accepted. If not the message is rejected.
|
|
NAIBRDFUNC nai_status_t NAIAPI | naibrd_AR_CAN_GetAcceptMask (int32_t cardIndex, int32_t module, int32_t channel, int32_t mask, uint32_t *p_outmsgId, bool_t *p_outisModeA, uint8_t *p_outfirstTwoBytes) |
| This retrieve the current mask values for the specified mask index / position.
|
|
NAIBRDFUNC nai_status_t NAIAPI | naibrd_AR_CAN_RemoveAcceptFilter (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_AR_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_AR_CAN_ResetDropCount (int32_t cardIndex, int32_t module, int32_t channel) |
| Resets the Drop Count for specified channel back to zero. (Messages will get "dropped" if the Rx FIFO is full)
|
|
NAIBRDFUNC nai_status_t NAIAPI | naibrd_AR_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_AR_CAN_SetTermination (int32_t cardIndex, int32_t module, int32_t channel, bool_t enable) |
| This function turns on termination for the desired channel.
|
|