foxBMS - Unit Tests
1.1.0
The foxBMS Unit Tests API Documentation
|
Sys driver implementation. More...
#include "sys.h"
#include "algorithm.h"
#include "bal.h"
#include "bms.h"
#include "can.h"
#include "contactor.h"
#include "diag.h"
#include "fram.h"
#include "imd.h"
#include "interlock.h"
#include "meas.h"
#include "os.h"
#include "sbc.h"
#include "sof.h"
#include "state_estimation.h"
Go to the source code of this file.
Macros | |
#define | SYS_SAVELASTSTATES(x) |
#define | SYS_BIST_GENERAL_MAGIC_NUMBER (42u) |
Typedefs | |
typedef enum SYS_CHECK_MULTIPLE_CALLS | SYS_CHECK_MULTIPLE_CALLS_e |
Enumerations | |
enum | SYS_CHECK_MULTIPLE_CALLS { SYS_MULTIPLE_CALLS_NO , SYS_MULTIPLE_CALLS_YES } |
Functions | |
static SYS_CHECK_MULTIPLE_CALLS_e | SYS_CheckMultipleCalls (SYS_STATE_s *pSystemState) |
check for multiple calls of state machine trigger function More... | |
static void | SYS_SetState (SYS_STATE_s *pSystemState, SYS_FSM_STATES_e nextState, SYS_FSM_SUBSTATES_e nextSubstate, uint16_t idleTime) |
Sets the next state, the next substate and the timer value of the state variable. More... | |
static void | SYS_SetSubstate (SYS_STATE_s *pSystemState, SYS_FSM_SUBSTATES_e nextSubstate, uint16_t idleTime) |
Sets the next substate and the timer value of the state variable. More... | |
static STD_RETURN_TYPE_e | SYS_RunStateMachine (SYS_STATE_s *pSystemState) |
Defines the state transitions. More... | |
static SYS_RETURN_TYPE_e | SYS_CheckStateRequest (SYS_STATE_REQUEST_e stateRequest) |
checks the state requests that are made. More... | |
static SYS_STATE_REQUEST_e | SYS_TransferStateRequest (void) |
transfers the current state request to the state machine. More... | |
SYS_RETURN_TYPE_e | SYS_SetStateRequest (SYS_STATE_REQUEST_e stateRequest) |
sets the current state request of the state variable sys_state. More... | |
void | SYS_GeneralMacroBist (void) |
STD_RETURN_TYPE_e | SYS_Trigger (SYS_STATE_s *pSystemState) |
tick function, call this to advance the state machine More... | |
Variables | |
SYS_STATE_s | sys_state |
Sys driver implementation.
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:
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:
Definition in file sys.c.
#define SYS_BIST_GENERAL_MAGIC_NUMBER (42u) |
Magic number that is searched by the SYS_GeneralMacroBist().
#define SYS_SAVELASTSTATES | ( | x | ) |
typedef enum SYS_CHECK_MULTIPLE_CALLS SYS_CHECK_MULTIPLE_CALLS_e |
Symbolic names to check for multiple calls of SYS_Trigger()
Symbolic names to check for multiple calls of SYS_Trigger()
Enumerator | |
---|---|
SYS_MULTIPLE_CALLS_NO | no multiple calls, OK |
SYS_MULTIPLE_CALLS_YES | multiple calls, not OK |
|
static |
check for multiple calls of state machine trigger function
The trigger function is not reentrant, which means it cannot be called multiple times. This functions increments the triggerEntry counter once and must be called each time the trigger function is called. If triggerEntry is greater than one, there were multiple calls. For this function to work, triggerEntry must be decremented each time the trigger function is called, even if no processing do because the timer is non-zero.
pSystemState | state of the fake state machine |
Definition at line 159 of file sys.c.
|
static |
checks the state requests that are made.
This function checks the validity of the state requests. The results of the checked is returned immediately.
stateRequest | state request to be checked |
void SYS_GeneralMacroBist | ( | void | ) |
|
static |
Defines the state transitions.
This function contains the implementation of the state machine, i.e., the sequence of states and substates. It is called by the trigger function every time the state machine timer has a non-zero value.
pSystemState | state of the example state machine |
Definition at line 194 of file sys.c.
|
static |
SYS_RETURN_TYPE_e SYS_SetStateRequest | ( | SYS_STATE_REQUEST_e | stateRequest | ) |
sets the current state request of the state variable sys_state.
This function is used to make a state request to the state machine, e.g., start voltage measurement, read result of voltage measurement, re-initialization. It calls SYS_CheckStateRequest() to check if the request is valid. The state request is rejected if is not valid. The result of the check is returned immediately, so that the requester can act in case it made a non-valid state request.
stateRequest | state requested to set |
Definition at line 565 of file sys.c.
|
static |
|
static |
transfers the current state request to the state machine.
This function takes the current state request from sys_state and transfers it to the state machine. It resets the value from sys_state to SYS_STATE_NO_REQUEST
Definition at line 554 of file sys.c.
STD_RETURN_TYPE_e SYS_Trigger | ( | SYS_STATE_s * | pSystemState | ) |
SYS_STATE_s sys_state |
contains the state of the contactor state machine