foxBMS - Unit Tests  1.6.0
The foxBMS Unit Tests API Documentation
can.c File Reference

Driver for the CAN module. More...

#include "general.h"
#include "can.h"
#include "HL_het.h"
#include "HL_reg_system.h"
#include "can_helper.h"
#include "database.h"
#include "diag.h"
#include "ftask.h"
#include "pex.h"
#include <stdbool.h>
#include <stdint.h>
Include dependency graph for can.c:

Go to the source code of this file.

Macros

#define CAN_TIMING_LOWER_LIMIT_COUNTS   (95u)
 
#define CAN_TIMING_UPPER_LIMIT_COUNTS   (105u)
 
#define CAN_HAL_RETVAL_NO_DATA_LOST   (1u)
 
#define CAN_IF2ARB_STANDARD_IDENTIFIER_SHIFT   (18u)
 
#define CAN_IF2ARB_EXTENDED_IDENTIFIER_SHIFT   (0u)
 
#define CAN_IF2ARB_SET_TX_DIRECTION   ((uint32)1u << 29u)
 
#define CAN_IF2ARB_USE_STANDARD_IDENTIFIER   ((uint32)0u << 30u)
 
#define CAN_IF2ARB_USE_EXTENDED_IDENTIFIER   ((uint32)1u << 30u)
 
#define CAN_LOWEST_MAILBOX_FOR_EXTENDED_IDENTIFIERS   (61u)
 
#define CAN_HIGHEST_MAILBOX_FOR_EXTENDED_IDENTIFIERS   (64u)
 

Functions

 FAS_STATIC_ASSERT ((CAN_LOWEST_MAILBOX_FOR_EXTENDED_IDENTIFIERS<=CAN_HIGHEST_MAILBOX_FOR_EXTENDED_IDENTIFIERS), "Lower mailbox number must not be greater than higher mailbox number")
 
 FAS_STATIC_ASSERT ((CAN_HIGHEST_MAILBOX_FOR_EXTENDED_IDENTIFIERS<=CAN_TOTAL_NUMBER_OF_MESSAGE_BOXES), "Highest mailbox number must not be larger than total number of mailboxes")
 
static void CAN_TxInterrupt (canBASE_t *pNode, uint32 messageBox)
 Called in case of CAN TX interrupt. More...
 
static void CAN_RxInterrupt (canBASE_t *pNode, uint32 messageBox)
 Called in case of CAN RX interrupt. More...
 
static STD_RETURN_TYPE_e CAN_PeriodicTransmit (void)
 Handles the processing of messages that are meant to be transmitted. More...
 
static bool CAN_IsMessagePeriodElapsed (uint32_t ticksSinceStart, uint16_t messageIndex)
 Checks if a configured period CAN message should be transmitted depending on the configured message period and message phase. More...
 
static void CAN_CheckCanTiming (void)
 Checks if the CAN messages come in the specified time window. More...
 
static void CAN_SetCurrentSensorPresent (bool command, uint8_t stringNumber)
 Sets flag to indicate current sensor is present. More...
 
static void CAN_SetCurrentSensorCcPresent (bool command, uint8_t stringNumber)
 Sets flag to indicate current sensor sends C-C values. More...
 
static void CAN_SetCurrentSensorEcPresent (bool command, uint8_t stringNumber)
 Sets flag to indicate current sensor sends C-C values. More...
 
static void CAN_CheckCanTimingOfCurrentSensor (void)
 
static void CAN_ConfigureRxMailboxesForExtendedIdentifiers (void)
 Initialize RX mailboxes for usage with extended identifiers. More...
 
static void CAN_InitializeTransceiver (void)
 
static uint32_t CAN_CalculateCounterResetValue (void)
 Calculate Reset Value for internal counter in CAN_PeriodicTransmit. More...
 
static void CAN_ValidateConfiguredTxMessagePeriod (void)
 
static void CAN_ValidateConfiguredTxMessagePhase (void)
 
static void CAN_CheckDatabaseNullPointer (CAN_SHIM_s canShim)
 
static CAN_NODE_sCAN_GetNodeConfigurationStructFromRegisterAddress (canBASE_t *pNodeRegister)
 get pointer CAN node configuration struct from register address More...
 
void CAN_Initialize (void)
 Enables the CAN transceiver.. This function sets th pins to enable the CAN transceiver. It must be called before using the CAN interface. More...
 
STD_RETURN_TYPE_e CAN_DataSend (CAN_NODE_s *pNode, uint32_t id, CAN_IDENTIFIER_TYPE_e idType, uint8 *pData)
 Sends over CAN the data passed in parameters. This function goes over the message boxes and marks the ones that should be sent. More...
 
void CAN_SendMessagesFromQueue (void)
 Reads messages from TX Queue and sends them via CAN. More...
 
void CAN_MainFunction (void)
 Calls the functions to drive the CAN interface. Makes the CAN timing checks and sends the periodic messages. More...
 
void CAN_ReadRxBuffer (void)
 Checks the data received per CAN. A receive buffer is used because CAN frames are received in an interrupt routine. The TMS570LC4357 does not allow nested interrupts, so interrupts are deactivated during receive. Calls to the database do not work when interrupts are disabled. Receive callbacks are made within this function: as it is not called during an interrupt routine, calls to the database can be made. More...
 
void CAN_EnablePeriodic (bool command)
 Enables periodic sending per CAN. This is used to prevent sending uninitialized data per CAN (e.g., before the first LTC measurement cycle was completed). More...
 
bool CAN_IsCurrentSensorPresent (uint8_t stringNumber)
 set flag for presence of current sensor. More...
 
bool CAN_IsCurrentSensorCcPresent (uint8_t stringNumber)
 get flag if CC message from current sensor is received. More...
 
bool CAN_IsCurrentSensorEcPresent (uint8_t stringNumber)
 get flag if EC message from current sensor is received More...
 
void UNIT_TEST_WEAK_IMPL canMessageNotification (canBASE_t *node, uint32 messageBox)
 
CAN_STATE_sTEST_CAN_GetCANState (void)
 
void TEST_CAN_ValidateConfiguredTxMessagePeriod (void)
 
void TEST_CAN_ValidateConfiguredTxMessagePhase (void)
 
void TEST_CAN_CheckDatabaseNullPointer (CAN_SHIM_s canShim)
 
void TEST_CAN_TxInterrupt (canBASE_t *pNode, uint32 messageBox)
 
void TEST_CAN_RxInterrupt (canBASE_t *pNode, uint32 messageBox)
 
STD_RETURN_TYPE_e TEST_CAN_PeriodicTransmit (void)
 
uint32_t TEST_CAN_CalculateCounterResetValue (void)
 
void TEST_CAN_CheckCanTiming (void)
 
bool TEST_CAN_IsMessagePeriodElapsed (uint32_t ticksSinceStart, uint16_t messageIndex)
 
void TEST_CAN_SetCurrentSensorPresent (bool command, uint8_t stringNumber)
 
void TEST_CAN_SetCurrentSensorCcPresent (bool command, uint8_t stringNumber)
 
void TEST_CAN_SetCurrentSensorEcPresent (bool command, uint8_t stringNumber)
 
void TEST_CAN_CheckCanTimingOfCurrentSensor (void)
 
void TEST_CAN_ConfigureRxMailboxesForExtendedIdentifiers (void)
 
void TEST_CAN_InitializeTransceiver (void)
 
CAN_NODE_sTEST_CAN_GetNodeConfigurationStructFromRegisterAddress (canBASE_t *pNodeRegister)
 

Variables

static CAN_STATE_s can_state
 
static uint32_t can_counterResetValue = 0u
 

Detailed Description

Driver for the CAN module.

SPDX-License-Identifier: BSD-3-Clause

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

We kindly request you to use one or more of the following phrases to refer to foxBMS in your hardware, software, documentation or advertising materials:

  • ″This product uses parts of foxBMS®″
  • ″This product includes parts of foxBMS®″
  • ″This product is derived from foxBMS®″
Author
foxBMS Team
Date
2019-12-04 (date of creation)
Updated
2023-10-12 (date of last update)
Version
v1.6.0
Prefix
CAN

Implementation of the CAN Interrupts, initialization, buffers, receive and transmit interfaces.

Definition in file can.c.

Macro Definition Documentation

◆ CAN_HAL_RETVAL_NO_DATA_LOST

#define CAN_HAL_RETVAL_NO_DATA_LOST   (1u)

return value of function canGetData if no data was lost during reception

Definition at line 82 of file can.c.

◆ CAN_HIGHEST_MAILBOX_FOR_EXTENDED_IDENTIFIERS

#define CAN_HIGHEST_MAILBOX_FOR_EXTENDED_IDENTIFIERS   (64u)

Range of mailboxes that are explicitly configured for the reception of messages with extended identifiers.

Definition at line 118 of file can.c.

◆ CAN_IF2ARB_EXTENDED_IDENTIFIER_SHIFT

#define CAN_IF2ARB_EXTENDED_IDENTIFIER_SHIFT   (0u)

ID shift for extended identifier

Definition at line 94 of file can.c.

◆ CAN_IF2ARB_SET_TX_DIRECTION

#define CAN_IF2ARB_SET_TX_DIRECTION   ((uint32)1u << 29u)

IF2ARB set TX direction

Definition at line 105 of file can.c.

◆ CAN_IF2ARB_STANDARD_IDENTIFIER_SHIFT

#define CAN_IF2ARB_STANDARD_IDENTIFIER_SHIFT   (18u)

IF2ARB register configuration

Bits 28-0 ID: Message identifier ID[28:0] 29-bit Identifier ("Extended Frame"). ID[28:18] 11-bit Identifier ("Standard Frame"). ID shift for standard identifier

Definition at line 92 of file can.c.

◆ CAN_IF2ARB_USE_EXTENDED_IDENTIFIER

#define CAN_IF2ARB_USE_EXTENDED_IDENTIFIER   ((uint32)1u << 30u)

IF2ARB use extended identifier

Definition at line 113 of file can.c.

◆ CAN_IF2ARB_USE_STANDARD_IDENTIFIER

#define CAN_IF2ARB_USE_STANDARD_IDENTIFIER   ((uint32)0u << 30u)

IF2ARB use standard identifier

Definition at line 111 of file can.c.

◆ CAN_LOWEST_MAILBOX_FOR_EXTENDED_IDENTIFIERS

#define CAN_LOWEST_MAILBOX_FOR_EXTENDED_IDENTIFIERS   (61u)

Range of mailboxes that are explicitly configured for the reception of messages with extended identifiers.

Definition at line 117 of file can.c.

◆ CAN_TIMING_LOWER_LIMIT_COUNTS

#define CAN_TIMING_LOWER_LIMIT_COUNTS   (95u)

lower limit of timestamp counts for a valid CAN timing

Definition at line 76 of file can.c.

◆ CAN_TIMING_UPPER_LIMIT_COUNTS

#define CAN_TIMING_UPPER_LIMIT_COUNTS   (105u)

upper limit of timestamp counts for a valid CAN timing

Definition at line 79 of file can.c.

Function Documentation

◆ CAN_CalculateCounterResetValue()

static uint32_t CAN_CalculateCounterResetValue ( void  )
static

Calculate Reset Value for internal counter in CAN_PeriodicTransmit.

Calculate the least common multiply of message periods in can_TxMessages array. All periods will elapse at this time, so the counter can safely be reset.

Returns
Reset Value for internal counter in CAN_PeriodicTransmit

Definition at line 734 of file can.c.

◆ CAN_CheckCanTiming()

static void CAN_CheckCanTiming ( void  )
static

Checks if the CAN messages come in the specified time window.

The time delta where a message is expected to be received needs to be between the configured limits CAN_TIMING_LOWER_LIMIT_COUNTS and CAN_TIMING_UPPER_LIMIT_COUNTS, If the message is received within the time frame the check is true, false otherwise. The result is then reported via flags in the DIAG module.

Definition at line 786 of file can.c.

Here is the call graph for this function:

◆ CAN_CheckCanTimingOfCurrentSensor()

static void CAN_CheckCanTimingOfCurrentSensor ( void  )
static

Definition at line 814 of file can.c.

Here is the call graph for this function:

◆ CAN_CheckDatabaseNullPointer()

static void CAN_CheckDatabaseNullPointer ( CAN_SHIM_s  canShim)
static

checks the struct block for storing and passing on the local database table handle for containing no null pointers

< pointer database table with cell voltages

< pointer database table with cell temperatures

< pointer database table with current sensor measurements

< pointer database table with error state variables

< pointer database table with insulation monitoring info

< pointer database table with min/max values

< pointer database table with MOL flags

< pointer database table with MSL flags

< pointer database table with open wire status

< pointer database table with pack values

< pointer database table with RSL flags

< pointer database table with SOC values

< pointer database table with SOE values

< pointer database table with SOF values

< pointer database table with SOH values

< pointer database table with state requests

Definition at line 596 of file can.c.

◆ CAN_ConfigureRxMailboxesForExtendedIdentifiers()

static void CAN_ConfigureRxMailboxesForExtendedIdentifiers ( void  )
static

Initialize RX mailboxes for usage with extended identifiers.

The first 32 mailboxes are configured via HALCoGen as RX mailboxes to be used with standard 11-bit identifiers. As the configuration if standard or extended identifiers should be used can only be configured for all mailboxes and not individually for each mailbox this configuration is done here.

The HALCoGen configuration for the mailboxes 61-64 is overwritten here and they are configured to received all CAN messages with an extended identifier.

This configuration is only done for CAN nodes canReg1 and canReg2!

  • Setup control register
    • Disable automatic wakeup on bus activity
    • Local power down mode disabled
    • Disable DMA request lines
    • Enable global Interrupt Line 0 and 1
    • Disable debug mode
    • Release from software reset
    • Enable/Disable parity or ECC
    • Enable/Disable auto bus on timer
    • Setup message completion before entering debug state
    • Setup normal operation mode
    • Request write access to the configuration registers
    • Setup automatic retransmission of messages
    • Disable error interrupts
    • Disable status interrupts
    • Enter initialization mode
  • Clear all pending error flags and reset current status
  • Setup auto bus on timer period
  • Initialize message 42
    • Wait until IF1 is ready for use
    • Set message mask
    • Set message control word
    • Set message arbitration
    • Set IF1 control byte
    • Set IF1 message number
  • Initialize message 61
    • Wait until IF1 is ready for use
    • Set message mask
    • Set message control word
    • Set message arbitration
    • Set IF1 control byte
    • Set IF1 message number
  • Initialize message 62
    • Wait until IF2 is ready for use
    • Set message mask
    • Set message control word
    • Set message arbitration
    • Set IF2 control byte
    • Set IF2 message number
  • Initialize message 63
    • Wait until IF1 is ready for use
    • Set message mask
    • Set message control word
    • Set message arbitration
    • Set IF1 control byte
    • Set IF1 message number
  • Initialize message 64
    • Wait until IF2 is ready for use
    • Set message mask
    • Set message control word
    • Set message arbitration
    • Set IF2 control byte
    • Set IF2 message number
  • Setup IF1 for data transmission
    • Wait until IF1 is ready for use
    • Set IF1 control byte
  • Setup IF2 for reading data
    • Wait until IF1 is ready for use
    • Set IF1 control byte
  • Leave configuration and initialization mode

Reconfigure CAN2 mailboxes 61 - 64

  • Setup control register
    • Disable automatic wakeup on bus activity
    • Local power down mode disabled
    • Disable DMA request lines
    • Enable global Interrupt Line 0 and 1
    • Disable debug mode
    • Release from software reset
    • Enable/Disable parity or ECC
    • Enable/Disable auto bus on timer
    • Setup message completion before entering debug state
    • Setup normal operation mode
    • Request write access to the configuration registers
    • Setup automatic retransmission of messages
    • Disable error interrupts
    • Disable status interrupts
    • Enter initialization mode
  • Clear all pending error flags and reset current status
  • Initialize message 61
    • Wait until IF1 is ready for use
    • Set message mask
    • Set message control word
    • Set message arbitration
    • Set IF1 control byte
    • Set IF1 message number
  • Initialize message 62
    • Wait until IF2 is ready for use
    • Set message mask
    • Set message control word
    • Set message arbitration
    • Set IF2 control byte
    • Set IF2 message number
  • Initialize message 63
    • Wait until IF1 is ready for use
    • Set message mask
    • Set message control word
    • Set message arbitration
    • Set IF1 control byte
    • Set IF1 message number
  • Initialize message 64
    • Wait until IF2 is ready for use
    • Set message mask
    • Set message control word
    • Set message arbitration
    • Set IF2 control byte
    • Set IF2 message number
  • Setup IF1 for data transmission
    • Wait until IF1 is ready for use
    • Set IF1 control byte
  • Setup IF2 for reading data
    • Wait until IF1 is ready for use
    • Set IF1 control byte
  • Leave configuration and initialization mode

Definition at line 270 of file can.c.

◆ CAN_DataSend()

STD_RETURN_TYPE_e CAN_DataSend ( CAN_NODE_s pNode,
uint32_t  id,
CAN_IDENTIFIER_TYPE_e  idType,
uint8 *  pData 
)

Sends over CAN the data passed in parameters. This function goes over the message boxes and marks the ones that should be sent.

Parameters
[in,out]pNodeCAN interface to use
idID of message to send
idTypestandard or extended identifier
[out]pDatadata to send (8 bytes)
Returns
STD_OK if a message box was free to send, STD_NOT_OK otherwise

Parse all TX message boxes until we find a free one, then use it to send the CAN message. In the HAL, message box numbers start from 1, not 0.

Definition at line 923 of file can.c.

◆ CAN_EnablePeriodic()

void CAN_EnablePeriodic ( bool  command)

Enables periodic sending per CAN. This is used to prevent sending uninitialized data per CAN (e.g., before the first LTC measurement cycle was completed).

Definition at line 1006 of file can.c.

◆ CAN_GetNodeConfigurationStructFromRegisterAddress()

static CAN_NODE_s * CAN_GetNodeConfigurationStructFromRegisterAddress ( canBASE_t *  pNodeRegister)
static

get pointer CAN node configuration struct from register address

Parameters
pNodeRegisterpointer to CAN node hardware register address
Returns
pointer to node configuration struct

Definition at line 616 of file can.c.

◆ CAN_Initialize()

void CAN_Initialize ( void  )

Enables the CAN transceiver.. This function sets th pins to enable the CAN transceiver. It must be called before using the CAN interface.

Definition at line 910 of file can.c.

Here is the call graph for this function:

◆ CAN_InitializeTransceiver()

static void CAN_InitializeTransceiver ( void  )
static

initialize the SPI interface to the CAN transceiver

Initialize transceiver for CAN1

Initialize transceiver for CAN2

Definition at line 565 of file can.c.

Here is the call graph for this function:

◆ CAN_IsCurrentSensorCcPresent()

bool CAN_IsCurrentSensorCcPresent ( uint8_t  stringNumber)

get flag if CC message from current sensor is received.

Parameters
stringNumberaddressed string
Returns
true if CC message is being received, false otherwise

Definition at line 1019 of file can.c.

◆ CAN_IsCurrentSensorEcPresent()

bool CAN_IsCurrentSensorEcPresent ( uint8_t  stringNumber)

get flag if EC message from current sensor is received

Parameters
stringNumberaddressed string
Returns
true if EC message is being received, false otherwise

Definition at line 1024 of file can.c.

◆ CAN_IsCurrentSensorPresent()

bool CAN_IsCurrentSensorPresent ( uint8_t  stringNumber)

set flag for presence of current sensor.

Returns
retval true if a current sensor is present, false otherwise

Definition at line 1014 of file can.c.

◆ CAN_IsMessagePeriodElapsed()

static bool CAN_IsMessagePeriodElapsed ( uint32_t  ticksSinceStart,
uint16_t  messageIndex 
)
static

Checks if a configured period CAN message should be transmitted depending on the configured message period and message phase.

Parameters
ticksSinceStartinternal counter of a periodically called function
messageIndexindex of the message to check in the tx message array
Returns
true if phase matches and message should be transmitted, false otherwise

Definition at line 771 of file can.c.

◆ CAN_MainFunction()

void CAN_MainFunction ( void  )

Calls the functions to drive the CAN interface. Makes the CAN timing checks and sends the periodic messages.

Definition at line 981 of file can.c.

Here is the call graph for this function:

◆ CAN_PeriodicTransmit()

static STD_RETURN_TYPE_e CAN_PeriodicTransmit ( void  )
static

Handles the processing of messages that are meant to be transmitted.

This function looks for the repetition times and the repetition phase of messages that are intended to be sent periodically. If a comparison with an internal counter (i.e., the counter how often this function has been called) states that a transmit is pending, the message is composed by call of CANS_ComposeMessage and transferred to the buffer of the CAN module. If a callback function is declared in configuration, this callback is called after successful transmission.

Returns
STD_OK if a CAN transfer was made, STD_NOT_OK otherwise

Definition at line 682 of file can.c.

Here is the call graph for this function:

◆ CAN_ReadRxBuffer()

void CAN_ReadRxBuffer ( void  )

Checks the data received per CAN. A receive buffer is used because CAN frames are received in an interrupt routine. The TMS570LC4357 does not allow nested interrupts, so interrupts are deactivated during receive. Calls to the database do not work when interrupts are disabled. Receive callbacks are made within this function: as it is not called during an interrupt routine, calls to the database can be made.

Definition at line 988 of file can.c.

Here is the call graph for this function:

◆ CAN_RxInterrupt()

static void CAN_RxInterrupt ( canBASE_t *  pNode,
uint32  messageBox 
)
static

Called in case of CAN RX interrupt.

Parameters
pNodeCAN interface on which message was received
messageBoxmessage box on which message was received

Read even if queues are not created, otherwise message boxes get full. Possible return values:

  • 0: no new data
  • 1: no data lost
  • 3: data lost

Definition at line 631 of file can.c.

Here is the call graph for this function:

◆ CAN_SendMessagesFromQueue()

void CAN_SendMessagesFromQueue ( void  )

Reads messages from TX Queue and sends them via CAN.

Definition at line 966 of file can.c.

Here is the call graph for this function:

◆ CAN_SetCurrentSensorCcPresent()

static void CAN_SetCurrentSensorCcPresent ( bool  command,
uint8_t  stringNumber 
)
static

Sets flag to indicate current sensor sends C-C values.

Parameters
commandtrue if coulomb counting message detected, otherwise false
stringNumberstring addressed

Definition at line 876 of file can.c.

Here is the call graph for this function:

◆ CAN_SetCurrentSensorEcPresent()

static void CAN_SetCurrentSensorEcPresent ( bool  command,
uint8_t  stringNumber 
)
static

Sets flag to indicate current sensor sends C-C values.

Parameters
commandtrue if energy counting message detected, otherwise false
stringNumberstring addressed

Definition at line 888 of file can.c.

Here is the call graph for this function:

◆ CAN_SetCurrentSensorPresent()

static void CAN_SetCurrentSensorPresent ( bool  command,
uint8_t  stringNumber 
)
static

Sets flag to indicate current sensor is present.

Parameters
commandtrue if current sensor present, otherwise false
stringNumberstring addressed

Definition at line 864 of file can.c.

Here is the call graph for this function:

◆ CAN_TxInterrupt()

static void CAN_TxInterrupt ( canBASE_t *  pNode,
uint32  messageBox 
)
static

Called in case of CAN TX interrupt.

Parameters
pNodeCAN interface on which message was sent
messageBoxmessage box on which message was sent

Definition at line 901 of file can.c.

◆ CAN_ValidateConfiguredTxMessagePeriod()

static void CAN_ValidateConfiguredTxMessagePeriod ( void  )
static

checks that the configured message period for Tx messages is valid

Definition at line 579 of file can.c.

◆ CAN_ValidateConfiguredTxMessagePhase()

static void CAN_ValidateConfiguredTxMessagePhase ( void  )
static

checks that the configured message phase for Tx messages is valid

Definition at line 587 of file can.c.

◆ canMessageNotification()

void UNIT_TEST_WEAK_IMPL canMessageNotification ( canBASE_t *  node,
uint32  messageBox 
)

called in case of CAN interrupt, defined as weak in HAL

Definition at line 1034 of file can.c.

Here is the call graph for this function:

◆ FAS_STATIC_ASSERT() [1/2]

FAS_STATIC_ASSERT ( (CAN_HIGHEST_MAILBOX_FOR_EXTENDED_IDENTIFIERS<=CAN_TOTAL_NUMBER_OF_MESSAGE_BOXES ,
"Highest mailbox number must not be larger than total number of mailboxes"   
)

◆ FAS_STATIC_ASSERT() [2/2]

FAS_STATIC_ASSERT ( (CAN_LOWEST_MAILBOX_FOR_EXTENDED_IDENTIFIERS<=CAN_HIGHEST_MAILBOX_FOR_EXTENDED_IDENTIFIERS ,
"Lower mailbox number must not be greater than higher mailbox number"   
)

◆ TEST_CAN_CalculateCounterResetValue()

uint32_t TEST_CAN_CalculateCounterResetValue ( void  )

Definition at line 1068 of file can.c.

Here is the call graph for this function:

◆ TEST_CAN_CheckCanTiming()

void TEST_CAN_CheckCanTiming ( void  )

Definition at line 1071 of file can.c.

Here is the call graph for this function:

◆ TEST_CAN_CheckCanTimingOfCurrentSensor()

void TEST_CAN_CheckCanTimingOfCurrentSensor ( void  )

Definition at line 1087 of file can.c.

Here is the call graph for this function:

◆ TEST_CAN_CheckDatabaseNullPointer()

void TEST_CAN_CheckDatabaseNullPointer ( CAN_SHIM_s  canShim)

Definition at line 1056 of file can.c.

Here is the call graph for this function:

◆ TEST_CAN_ConfigureRxMailboxesForExtendedIdentifiers()

void TEST_CAN_ConfigureRxMailboxesForExtendedIdentifiers ( void  )

Definition at line 1091 of file can.c.

Here is the call graph for this function:

◆ TEST_CAN_GetCANState()

CAN_STATE_s* TEST_CAN_GetCANState ( void  )

Definition at line 1047 of file can.c.

◆ TEST_CAN_GetNodeConfigurationStructFromRegisterAddress()

CAN_NODE_s* TEST_CAN_GetNodeConfigurationStructFromRegisterAddress ( canBASE_t *  pNodeRegister)

Definition at line 1097 of file can.c.

Here is the call graph for this function:

◆ TEST_CAN_InitializeTransceiver()

void TEST_CAN_InitializeTransceiver ( void  )

Definition at line 1094 of file can.c.

Here is the call graph for this function:

◆ TEST_CAN_IsMessagePeriodElapsed()

bool TEST_CAN_IsMessagePeriodElapsed ( uint32_t  ticksSinceStart,
uint16_t  messageIndex 
)

Definition at line 1074 of file can.c.

Here is the call graph for this function:

◆ TEST_CAN_PeriodicTransmit()

STD_RETURN_TYPE_e TEST_CAN_PeriodicTransmit ( void  )

Definition at line 1065 of file can.c.

Here is the call graph for this function:

◆ TEST_CAN_RxInterrupt()

void TEST_CAN_RxInterrupt ( canBASE_t *  pNode,
uint32  messageBox 
)

Definition at line 1062 of file can.c.

Here is the call graph for this function:

◆ TEST_CAN_SetCurrentSensorCcPresent()

void TEST_CAN_SetCurrentSensorCcPresent ( bool  command,
uint8_t  stringNumber 
)

Definition at line 1081 of file can.c.

Here is the call graph for this function:

◆ TEST_CAN_SetCurrentSensorEcPresent()

void TEST_CAN_SetCurrentSensorEcPresent ( bool  command,
uint8_t  stringNumber 
)

Definition at line 1084 of file can.c.

Here is the call graph for this function:

◆ TEST_CAN_SetCurrentSensorPresent()

void TEST_CAN_SetCurrentSensorPresent ( bool  command,
uint8_t  stringNumber 
)

Definition at line 1078 of file can.c.

Here is the call graph for this function:

◆ TEST_CAN_TxInterrupt()

void TEST_CAN_TxInterrupt ( canBASE_t *  pNode,
uint32  messageBox 
)

Definition at line 1059 of file can.c.

Here is the call graph for this function:

◆ TEST_CAN_ValidateConfiguredTxMessagePeriod()

void TEST_CAN_ValidateConfiguredTxMessagePeriod ( void  )

Definition at line 1050 of file can.c.

Here is the call graph for this function:

◆ TEST_CAN_ValidateConfiguredTxMessagePhase()

void TEST_CAN_ValidateConfiguredTxMessagePhase ( void  )

Definition at line 1053 of file can.c.

Here is the call graph for this function:

Variable Documentation

◆ can_counterResetValue

uint32_t can_counterResetValue = 0u
static

stores the number of CAN_periodicTransmit calls at which the internal counter will reset to prevent overflow in CAN_IsPeriodElapsed

Definition at line 140 of file can.c.

◆ can_state

CAN_STATE_s can_state
static
Initial value:
= {
.periodicEnable = false,
.currentSensorPresent = {GEN_REPEAT_U(false, GEN_STRIP(BS_NR_OF_STRINGS))},
.currentSensorCCPresent = {GEN_REPEAT_U(false, GEN_STRIP(BS_NR_OF_STRINGS))},
.currentSensorECPresent = {GEN_REPEAT_U(false, GEN_STRIP(BS_NR_OF_STRINGS))},
}
#define BS_NR_OF_STRINGS
Number of parallel strings in the battery pack.
#define GEN_REPEAT_U(x, n)
Macro that helps to generate a series of literals (for array initializers).
Definition: general.h:250
#define GEN_STRIP(x)
Definition: general.h:261

tracks the local state of the can module

Definition at line 131 of file can.c.