/*
 * File: BSPR_BattVoltDiag.h
 *
 * Code generated for Simulink model 'BSPR_BattVoltDiag'.
 *
 * Model version                  : 1.662
 * Simulink Coder version         : 8.13 (R2017b) 24-Jul-2017
 * C/C++ source code generated on : Fri Oct  9 11:29:17 2020
 *
 * Target selection: ert.tlc
 * Embedded hardware selection: Infineon->TriCore
 * Code generation objectives:
 *    1. MISRA C:2012 guidelines
 *    2. Execution efficiency
 * Validation result: Not run
 */

#ifndef RTW_HEADER_BSPR_BattVoltDiag_h_
#define RTW_HEADER_BSPR_BattVoltDiag_h_
#include <math.h>
#ifndef BSPR_BattVoltDiag_COMMON_INCLUDES_
# define BSPR_BattVoltDiag_COMMON_INCLUDES_
#include "rtwtypes.h"
#endif                                 /* BSPR_BattVoltDiag_COMMON_INCLUDES_ */

#include "BSPR_BattVoltDiag_types.h"

/* Includes for objects with custom storage classes. */
#include "BSPR_BattVoltDiag_parameters.h"

/* Macros for accessing real-time model data structure */

/* user code (top of header file) */
#include "ASW_Interface.h"

/* Block states (auto storage) for system '<Root>' */
typedef struct {
  real32_T Delay_DSTATE;               /* '<S83>/Delay' */
  real32_T Delay_DSTATE_e;             /* '<S82>/Delay' */
  real32_T Delay_DSTATE_i;             /* '<S74>/Delay' */
  real32_T Delay_DSTATE_k;             /* '<S73>/Delay' */
  real32_T Delay_DSTATE_ky;            /* '<S72>/Delay' */
  real32_T Delay_DSTATE_m;             /* '<S71>/Delay' */
  real32_T Delay_DSTATE_b;             /* '<S70>/Delay' */
  real32_T Delay_DSTATE_bk;            /* '<S69>/Delay' */
  real32_T Delay_DSTATE_ms;            /* '<S68>/Delay' */
  real32_T Delay_DSTATE_a;             /* '<S67>/Delay' */
  uint8_T Delay3_DSTATE;               /* '<S23>/Delay3' */
  uint8_T Delay3_DSTATE_a;             /* '<S22>/Delay3' */
  uint8_T Delay3_DSTATE_e;             /* '<S21>/Delay3' */
  uint8_T Delay3_DSTATE_k;             /* '<S20>/Delay3' */
  uint8_T Delay3_DSTATE_i;             /* '<S19>/Delay3' */
  boolean_T Delay2_DSTATE;             /* '<S23>/Delay2' */
  boolean_T Delay2_DSTATE_l;           /* '<S22>/Delay2' */
  boolean_T Delay2_DSTATE_k;           /* '<S21>/Delay2' */
  boolean_T Delay2_DSTATE_m;           /* '<S20>/Delay2' */
  boolean_T Delay2_DSTATE_n;           /* '<S19>/Delay2' */
  uint8_T is_active_c3_BSPR_BattVoltDiag;/* '<S5>/DiagModeCalc' */
  uint8_T is_c3_BSPR_BattVoltDiag;     /* '<S5>/DiagModeCalc' */
} DW_BSPR_BattVoltDiag_T;

/* Invariant block signals (auto storage) */
typedef struct {
  const uint8_T FixPtBitwiseOperator4; /* '<S47>/FixPt Bitwise Operator4' */
  const uint8_T FixPtBitwiseOperator3; /* '<S47>/FixPt Bitwise Operator3' */
  const uint8_T FixPtBitwiseOperator5; /* '<S47>/FixPt Bitwise Operator5' */
  const uint8_T FixPtBitwiseOperator1; /* '<S49>/FixPt Bitwise Operator1' */
  const uint8_T FixPtBitwiseOperator1_g;/* '<S50>/FixPt Bitwise Operator1' */
  const uint8_T FixPtBitwiseOperator1_gf;/* '<S51>/FixPt Bitwise Operator1' */
  const uint8_T FixPtBitwiseOperator4_k;/* '<S42>/FixPt Bitwise Operator4' */
  const uint8_T FixPtBitwiseOperator3_l;/* '<S42>/FixPt Bitwise Operator3' */
  const uint8_T FixPtBitwiseOperator5_e;/* '<S42>/FixPt Bitwise Operator5' */
  const uint8_T FixPtBitwiseOperator1_k;/* '<S44>/FixPt Bitwise Operator1' */
  const uint8_T FixPtBitwiseOperator1_p;/* '<S45>/FixPt Bitwise Operator1' */
  const uint8_T FixPtBitwiseOperator1_h;/* '<S46>/FixPt Bitwise Operator1' */
} ConstB_BSPR_BattVoltDiag_T;

/* Block states (auto storage) */
extern DW_BSPR_BattVoltDiag_T BSPR_BattVoltDiag_DW;
extern const ConstB_BSPR_BattVoltDiag_T BSPR_BattVoltDiag_ConstB;/* constant block i/o */

/* Model entry point functions */
extern void BSPR_BattVoltDiag_initialize(void);
extern void BSPR_BattVoltDiag_step(void);

/* Exported data declaration */

/* Volatile memory section */
#define ASW1_OEM_START_SEC_DEFAULT_RAM2_CLEARED_UNSPECIFIED
#include "Asw1_OEM_MemMap.h"

/* Declaration for custom storage class: Volatile */
extern volatile uint8_T DFC_BattUNpl_ASW;  /* Npl fault of battery voltage upstream the main contactor */
extern volatile uint8_T DFC_BattVoltHiMax_ASW;/* Valid fault for battery voltage upstream the main contactor */
extern volatile uint8_T DFC_BattVoltLoMin_ASW;/* Valid fault for battery downstream the main contactor */
extern volatile uint8_T DFC_DChrgUNpl_ASW; /* Npl fault of battery voltage downstream the DC charge contactor */
extern volatile uint8_T DFC_PackUNpl_ASW;  /* Npl fault of battery voltage downstream the main contactor */

#define ASW1_OEM_STOP_SEC_DEFAULT_RAM2_CLEARED_UNSPECIFIED
#include "Asw1_OEM_MemMap.h"
#define ASW1_OEM_START_SEC_DEFAULT_RAM2_CLEARED_UNSPECIFIED
#include "Asw1_OEM_MemMap.h"

/* Declaration for custom storage class: OutputSignal */
extern volatile boolean_T BSPR_bBattVoltErrDet;/* Error healing flag for battery voltage plausible diagnosis upstream the main contactor */
extern volatile boolean_T BSPR_bBattVoltErrHeal;/* Error detect flag for battery voltage plausible diagnosis upstream the main contactor */
extern volatile boolean_T BSPR_bBattVoltHiErrDet;/* Error healing flag for battery voltage plausible diagnosis upstream the main contactor */
extern volatile boolean_T BSPR_bBattVoltHiErrHeal;/* Error detect flag for battery voltage plausible diagnosis upstream the main contactor */
extern volatile boolean_T BSPR_bBattVoltLoErrDet;/* Error healing flag for battery voltage plausible diagnosis upstream the main contactor */
extern volatile boolean_T BSPR_bBattVoltLoErrHeal;/* Error detect flag for battery voltage plausible diagnosis upstream the main contactor */
extern volatile boolean_T BSPR_bDCHrgVoltNplErrDet;/* Error healing flag for DC charge  battery voltage plausible diagnosis */
extern volatile boolean_T BSPR_bDCHrgVoltNplErrHeal;/* Error detect flag for DC charge battery voltage plausible diagnosis */
extern volatile boolean_T BSPR_bPackVoltErrDet;/* Error healing flag for battery voltage plausible diagnosis  downstream  the main contactor */
extern volatile boolean_T BSPR_bPackVoltErrHeal;/* Error detect flag for battery voltage plausible diagnosis downstream the main contactor */
extern volatile uint8_T BSPR_cntSum;   /* Available number of voltage sample used for high voltage plausible diagnosis */
extern volatile boolean_T BSPR_flgMeanValCalcEn;/* Calculate mode for mean vlaue calculate */
extern volatile boolean_T BSPR_flgUBattDiagEn;/* Enalbe condition for battery voltage plausible diagnosis */
extern volatile boolean_T BSPR_flgUDChrgDiagEn;/* Enalbe condition for DC charge voltage plausible diagnosis */
extern volatile boolean_T BSPR_flgUPackDiagEn;/* Enalbe condition for pack voltage plausible diagnosis */
extern volatile uint8_T BSPR_stDiagMode;/* Diagnostic mode for battery high voltage */
extern volatile real32_T BSPR_uMaxCriteria;/* Maximum voltage among all  voltage sampling used for high voltage plausible diagnosis */
extern volatile real32_T BSPR_uMeanCoord;/* Model voltage for battery voltage plausible diagnosis */
extern volatile real32_T BSPR_uMinCriteria;/* Minimum voltage among all voltage sampling used for high voltage plausible diagnosis */
extern volatile real32_T BSPR_uSumCriteria;/* Sum voltage of all voltage sampling used for high voltage plausible diagnosis */

#define ASW1_OEM_STOP_SEC_DEFAULT_RAM2_CLEARED_UNSPECIFIED
#include "Asw1_OEM_MemMap.h"

/*-
 * The generated code includes comments that allow you to trace directly
 * back to the appropriate location in the model.  The basic format
 * is <system>/block_name, where system is the system number (uniquely
 * assigned by Simulink) and block_name is the name of the block.
 *
 * Use the MATLAB hilite_system command to trace the generated code back
 * to the model.  For example,
 *
 * hilite_system('<S3>')    - opens system 3
 * hilite_system('<S3>/Kp') - opens and selects block Kp which resides in S3
 *
 * Here is the system hierarchy for this model
 *
 * '<Root>' : 'BSPR_BattVoltDiag'
 * '<S1>'   : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag'
 * '<S2>'   : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/DSM_GetSFCErD'
 * '<S3>'   : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/DSM_GetSFCErD1'
 * '<S4>'   : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/DSM_GetSFCErD2'
 * '<S5>'   : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/DiagModeCalc'
 * '<S6>'   : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/DsmRpt'
 * '<S7>'   : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/MeanValueCalc'
 * '<S8>'   : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/NplDiagRsltCalc'
 * '<S9>'   : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/DSM_GetSFCErD/DFC_IsoChkLv1_1_compare'
 * '<S10>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/DSM_GetSFCErD1/DFC_IsoChkLv1_1_compare'
 * '<S11>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/DSM_GetSFCErD2/DFC_IsoChkLv1_1_compare'
 * '<S12>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/DiagModeCalc/Compare To Constant1'
 * '<S13>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/DiagModeCalc/Compare To Constant10'
 * '<S14>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/DiagModeCalc/Compare To Constant2'
 * '<S15>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/DiagModeCalc/Compare To Constant3'
 * '<S16>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/DiagModeCalc/Compare To Constant8'
 * '<S17>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/DiagModeCalc/Compare To Constant9'
 * '<S18>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/DiagModeCalc/DiagModeCalc'
 * '<S19>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/DsmRpt/DSM_ReportCheck'
 * '<S20>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/DsmRpt/DSM_ReportCheck1'
 * '<S21>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/DsmRpt/DSM_ReportCheck2'
 * '<S22>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/DsmRpt/DSM_ReportCheck3'
 * '<S23>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/DsmRpt/DSM_ReportCheck4'
 * '<S24>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/DsmRpt/DSM_ReportCheck/Bit Clear1'
 * '<S25>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/DsmRpt/DSM_ReportCheck/Bit Clear2'
 * '<S26>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/DsmRpt/DSM_ReportCheck/Bit Set'
 * '<S27>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/DsmRpt/DSM_ReportCheck/Bit Set1'
 * '<S28>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/DsmRpt/DSM_ReportCheck/Bit Set2'
 * '<S29>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/DsmRpt/DSM_ReportCheck/Bit Set4'
 * '<S30>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/DsmRpt/DSM_ReportCheck1/Bit Clear1'
 * '<S31>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/DsmRpt/DSM_ReportCheck1/Bit Clear2'
 * '<S32>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/DsmRpt/DSM_ReportCheck1/Bit Set'
 * '<S33>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/DsmRpt/DSM_ReportCheck1/Bit Set1'
 * '<S34>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/DsmRpt/DSM_ReportCheck1/Bit Set2'
 * '<S35>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/DsmRpt/DSM_ReportCheck1/Bit Set4'
 * '<S36>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/DsmRpt/DSM_ReportCheck2/Bit Clear1'
 * '<S37>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/DsmRpt/DSM_ReportCheck2/Bit Clear2'
 * '<S38>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/DsmRpt/DSM_ReportCheck2/Bit Set'
 * '<S39>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/DsmRpt/DSM_ReportCheck2/Bit Set1'
 * '<S40>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/DsmRpt/DSM_ReportCheck2/Bit Set2'
 * '<S41>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/DsmRpt/DSM_ReportCheck2/Bit Set4'
 * '<S42>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/DsmRpt/DSM_ReportCheck3/Bit Clear1'
 * '<S43>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/DsmRpt/DSM_ReportCheck3/Bit Clear2'
 * '<S44>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/DsmRpt/DSM_ReportCheck3/Bit Set'
 * '<S45>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/DsmRpt/DSM_ReportCheck3/Bit Set1'
 * '<S46>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/DsmRpt/DSM_ReportCheck3/Bit Set2'
 * '<S47>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/DsmRpt/DSM_ReportCheck4/Bit Clear1'
 * '<S48>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/DsmRpt/DSM_ReportCheck4/Bit Clear2'
 * '<S49>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/DsmRpt/DSM_ReportCheck4/Bit Set'
 * '<S50>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/DsmRpt/DSM_ReportCheck4/Bit Set1'
 * '<S51>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/DsmRpt/DSM_ReportCheck4/Bit Set2'
 * '<S52>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/MeanValueCalc/MeanValueCsdr'
 * '<S53>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/MeanValueCalc/MeanValueProc'
 * '<S54>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/MeanValueCalc/MeanValueCsdr/MeanValue_VoltBattCsdr'
 * '<S55>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/MeanValueCalc/MeanValueCsdr/MeanValue_VoltCellCsdr'
 * '<S56>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/MeanValueCalc/MeanValueCsdr/MeanValue_VoltDchrgCsdr'
 * '<S57>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/MeanValueCalc/MeanValueCsdr/MeanValue_VoltPackCsdr'
 * '<S58>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/MeanValueCalc/MeanValueCsdr/VoltDchrgCsdrEn'
 * '<S59>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/MeanValueCalc/MeanValueCsdr/VoltDchrgCsdrEn/Compare To Constant1'
 * '<S60>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/MeanValueCalc/MeanValueCsdr/VoltDchrgCsdrEn/Compare To Constant3'
 * '<S61>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/NplDiagRsltCalc/BattVoltDiagCalc'
 * '<S62>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/NplDiagRsltCalc/DChrgVoltNplDiagCalc'
 * '<S63>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/NplDiagRsltCalc/DiagCoord'
 * '<S64>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/NplDiagRsltCalc/PackVoltNplDiagCalc'
 * '<S65>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/NplDiagRsltCalc/BattVoltDiagCalc/Compare To Constant1'
 * '<S66>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/NplDiagRsltCalc/BattVoltDiagCalc/Compare To Constant3'
 * '<S67>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/NplDiagRsltCalc/BattVoltDiagCalc/TONV_10msTimeDebounce'
 * '<S68>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/NplDiagRsltCalc/BattVoltDiagCalc/TONV_10msTimeDebounce1'
 * '<S69>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/NplDiagRsltCalc/BattVoltDiagCalc/TONV_10msTimeDebounce2'
 * '<S70>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/NplDiagRsltCalc/BattVoltDiagCalc/TONV_10msTimeDebounce3'
 * '<S71>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/NplDiagRsltCalc/BattVoltDiagCalc/TONV_10msTimeDebounce4'
 * '<S72>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/NplDiagRsltCalc/BattVoltDiagCalc/TONV_10msTimeDebounce5'
 * '<S73>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/NplDiagRsltCalc/DChrgVoltNplDiagCalc/TONV_10msTimeDebounce1'
 * '<S74>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/NplDiagRsltCalc/DChrgVoltNplDiagCalc/TONV_10msTimeDebounce2'
 * '<S75>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/NplDiagRsltCalc/DiagCoord/Compare To Constant'
 * '<S76>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/NplDiagRsltCalc/DiagCoord/Compare To Constant1'
 * '<S77>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/NplDiagRsltCalc/DiagCoord/Compare To Constant2'
 * '<S78>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/NplDiagRsltCalc/DiagCoord/Compare To Constant3'
 * '<S79>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/NplDiagRsltCalc/DiagCoord/Compare To Constant4'
 * '<S80>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/NplDiagRsltCalc/DiagCoord/Compare To Constant5'
 * '<S81>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/NplDiagRsltCalc/DiagCoord/Compare To Constant6'
 * '<S82>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/NplDiagRsltCalc/PackVoltNplDiagCalc/TONV_10msTimeDebounce'
 * '<S83>'  : 'BSPR_BattVoltDiag/BSPR_BattVoltDiag/NplDiagRsltCalc/PackVoltNplDiagCalc/TONV_10msTimeDebounce1'
 */
#endif                                 /* RTW_HEADER_BSPR_BattVoltDiag_h_ */

/*
 * File trailer for generated code.
 *
 * [EOF]
 */
