foxBMS - Unit Tests  1.3.0
The foxBMS Unit Tests API Documentation
mxm_registry.c File Reference

Functions in order to have a registry of monitoring ICs. More...

#include "mxm_registry.h"
#include "foxmath.h"
Include dependency graph for mxm_registry.c:

Go to the source code of this file.

Macros

#define MXM_MON_REGISTRY_STATUS_FMEA_DEFAULT   (0xFFFFu)
 
#define MXM_REGISTRY_SHIFT_ONE_BYTE   (8u)
 

Functions

void MXM_MonRegistryInit (MXM_MONITORING_INSTANCE_s *pState)
 Initialize monitoring registry. More...
 
STD_RETURN_TYPE_e MXM_MonRegistryConnectDevices (MXM_MONITORING_INSTANCE_s *pState, uint8_t numberOfDevices)
 Mark devices as connected in the registry and set the address. More...
 
uint8_t MXM_MonRegistryGetHighestConnected5XDevice (const MXM_MONITORING_INSTANCE_s *const kpkState)
 Parse number of highest connected device from monitoring- register. More...
 
void MXM_MonRegistryParseIdIntoDevices (MXM_MONITORING_INSTANCE_s *pState, uint8_t rxBufferLength, MXM_REG_NAME_e type)
 Parse ID (1 or 2) into the registry. More...
 
void MXM_MonRegistryParseVersionIntoDevices (MXM_MONITORING_INSTANCE_s *pState, uint8_t rxBufferLength)
 Parse Version into the registry. More...
 
void MXM_MonRegistryParseStatusFmeaIntoDevices (MXM_MONITORING_INSTANCE_s *pState, uint8_t rxBufferLength)
 Parse STATUS or FMEA into the registry. More...
 
bool MXM_CheckIfADeviceHasBeenReset (const MXM_MONITORING_INSTANCE_s *const kpkState)
 check if one of the devices in the registry has the ALRTRST bit set More...
 
bool MXM_CheckIfADeviceIsConnected (const MXM_MONITORING_INSTANCE_s *const kpkState, uint8_t device)
 check if a device is connected More...
 

Detailed Description

Functions in order to have a registry of monitoring ICs.

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
2020-07-16 (date of creation)
Updated
2022-05-30 (date of last update)
Version
v1.3.0
Prefix
MXM

Monitoring registry stores information about the connected ICs.

Definition in file mxm_registry.c.

Macro Definition Documentation

◆ MXM_MON_REGISTRY_STATUS_FMEA_DEFAULT

#define MXM_MON_REGISTRY_STATUS_FMEA_DEFAULT   (0xFFFFu)

default value for status and fmea registers (for initialization)

Definition at line 65 of file mxm_registry.c.

◆ MXM_REGISTRY_SHIFT_ONE_BYTE

#define MXM_REGISTRY_SHIFT_ONE_BYTE   (8u)

shift distance for one byte

Definition at line 68 of file mxm_registry.c.

Function Documentation

◆ MXM_CheckIfADeviceHasBeenReset()

bool MXM_CheckIfADeviceHasBeenReset ( const MXM_MONITORING_INSTANCE_s *const  kpkState)

check if one of the devices in the registry has the ALRTRST bit set

If a monitoring device is reset, it will set the ALRTRST bit in MXM_REG_STATUS1. This should not happen during normal operation. If this happens, initialization of the devices is lost and has to be restored. This is done by reseting the state machine.

Parameters
[in,out]kpkStatestate-pointer
Returns
true if a device has been reset, false otherwise

Definition at line 239 of file mxm_registry.c.

Here is the call graph for this function:

◆ MXM_CheckIfADeviceIsConnected()

bool MXM_CheckIfADeviceIsConnected ( const MXM_MONITORING_INSTANCE_s *const  kpkState,
uint8_t  device 
)

check if a device is connected

Checks the connected state in the registry

Parameters
[in]kpkStatestate-pointer
[in]devicedevice number
Returns
true if a device is connected, false otherwise

Definition at line 262 of file mxm_registry.c.

◆ MXM_MonRegistryConnectDevices()

STD_RETURN_TYPE_e MXM_MonRegistryConnectDevices ( MXM_MONITORING_INSTANCE_s pState,
uint8_t  numberOfDevices 
)

Mark devices as connected in the registry and set the address.

Takes the number of connected (adjacent!) devices and marks them in the registry.

Parameters
[in,out]pStatestate-pointer
[in]numberOfDevicesnumber of normal satellites
Returns
STD_OK if the number of modules is OK, STD_NOT_OK otherwise

Definition at line 96 of file mxm_registry.c.

◆ MXM_MonRegistryGetHighestConnected5XDevice()

uint8_t MXM_MonRegistryGetHighestConnected5XDevice ( const MXM_MONITORING_INSTANCE_s *const  kpkState)

Parse number of highest connected device from monitoring- register.

Parameters
[in]kpkStatestate-pointer
Returns
MXM_MONITORING_INSTANCE_s::highest5xDevice

Definition at line 115 of file mxm_registry.c.

◆ MXM_MonRegistryInit()

void MXM_MonRegistryInit ( MXM_MONITORING_INSTANCE_s pState)

Initialize monitoring registry.

Sets the connected state of every entry of the registry of monitoring ICs to false.

Parameters
[in]pStatestate-pointer

Definition at line 79 of file mxm_registry.c.

◆ MXM_MonRegistryParseIdIntoDevices()

void MXM_MonRegistryParseIdIntoDevices ( MXM_MONITORING_INSTANCE_s pState,
uint8_t  rxBufferLength,
MXM_REG_NAME_e  type 
)

Parse ID (1 or 2) into the registry.

Parameters
[in,out]pStatestate-pointer
[in]rxBufferLengthlength of the rxBuffer
[in]typetype of register (has to be MXM_REG_ID1 or MXM_REG_ID2)

Definition at line 121 of file mxm_registry.c.

Here is the call graph for this function:

◆ MXM_MonRegistryParseStatusFmeaIntoDevices()

void MXM_MonRegistryParseStatusFmeaIntoDevices ( MXM_MONITORING_INSTANCE_s pState,
uint8_t  rxBufferLength 
)

Parse STATUS or FMEA into the registry.

Parameters
[in,out]pStatestate-pointer
[in]rxBufferLengthlength of the rxBuffer

Definition at line 192 of file mxm_registry.c.

Here is the call graph for this function:

◆ MXM_MonRegistryParseVersionIntoDevices()

void MXM_MonRegistryParseVersionIntoDevices ( MXM_MONITORING_INSTANCE_s pState,
uint8_t  rxBufferLength 
)

Parse Version into the registry.

Parameters
[in,out]pStatestate-pointer
[in]rxBufferLengthlength of the rxBuffer

Definition at line 152 of file mxm_registry.c.

Here is the call graph for this function: