diff --git a/.clang-format b/.clang-format index 74af22b7..ae7fad80 100644 --- a/.clang-format +++ b/.clang-format @@ -4,7 +4,7 @@ AlignAfterOpenBracket: AlwaysBreak AlignArrayOfStructures: None # clang-bug AlignConsecutiveMacros: Consecutive AlignConsecutiveAssignments: true -AlignConsecutiveBitFields: None # TODO: !573 +AlignConsecutiveBitFields: Consecutive AlignConsecutiveDeclarations: false AlignEscapedNewlines: Left AlignOperands: Align diff --git a/CITATION.cff b/CITATION.cff index b3ba1510..853ab666 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -46,5 +46,5 @@ keywords: - "BMS" message: "If the foxBMS project contributes to a project that leads to a scientific publication, please acknowledge this fact by citing." title: "foxBMS - The Most Advanced Open Source BMS Platform: foxBMS 2" -version: "1.3.0" -date-released: 2022-05-30 +version: "1.4.0" +date-released: 2022-07-29 diff --git a/README.md b/README.md index 0028041f..54c4513e 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,12 @@ Basically, the software is covered by the and the hardware and documentation by the [**Creative Commons Attribution 4.0 International License (SPDX short identifier: CC-BY-4.0)**](https://creativecommons.org/licenses/by/4.0/legalcode). +## Open Source Hardware Certification + +foxBMS 2 has been certified as open source hardware by the +Open Source Hardware Association under the OSHWA UID +[DE000128](https://certification.oshwa.org/de000128.html). + ## Acknowledgment For funding acknowledgements and instructions on how to acknowledge foxBMS 2 diff --git a/conf/bms/bms.json b/conf/bms/bms.json index f8d8a73d..30690c28 100644 --- a/conf/bms/bms.json +++ b/conf/bms/bms.json @@ -2,9 +2,8 @@ "slave-unit": { "analog-front-end": { "manufacturer": "ltc", - "chip": "6813-1" + "ic": "6813-1" }, - "balancing-strategy": "none", "temperature-sensor": { "manufacturer": "epcos", "model": "b57251v5103j060", @@ -16,15 +15,17 @@ "state-estimation": { "soc": "counting", "soe": "counting", + "sof": "trapezoid", "soh": "none" } }, + "balancing-strategy": "none", "insulation-monitoring-device": { "manufacturer": "bender", "model": "iso165c" } }, - "operating-system": { + "rtos": { "name": "freertos" } } diff --git a/conf/bms/schema/application.schema.json b/conf/bms/schema/application.schema.json index 0c98397f..59dae3a5 100644 --- a/conf/bms/schema/application.schema.json +++ b/conf/bms/schema/application.schema.json @@ -3,6 +3,7 @@ "title": "Configuration of the application", "required": [ "algorithm", + "balancing-strategy", "insulation-monitoring-device" ], "additionalProperties": false, @@ -20,6 +21,7 @@ "required": [ "soc", "soe", + "sof", "soh" ], "properties": { @@ -43,6 +45,14 @@ "none" ] }, + "sof": { + "$id": "/properties/application/algorithm/state-estimation/sof", + "title": "State-of-Function algorithm (must correspond to the directory name)", + "type": "string", + "enum": [ + "trapezoid" + ] + }, "soh": { "$id": "/properties/application/algorithm/state-estimation/soh", "title": "State-of-Health algorithm (must correspond to the directory name)", @@ -56,6 +66,16 @@ } } }, + "balancing-strategy": { + "$id": "/properties/application/balancing-strategy", + "title": "Balancing strategy", + "type": "string", + "enum": [ + "voltage", + "history", + "none" + ] + }, "insulation-monitoring-device": { "$id": "/properties/application/insulation-monitoring-device", "title": "Configuration of the used insulation measurement device", diff --git a/conf/bms/schema/bms.schema.json b/conf/bms/schema/bms.schema.json index 7bfa1cb6..8c46c78a 100644 --- a/conf/bms/schema/bms.schema.json +++ b/conf/bms/schema/bms.schema.json @@ -2,7 +2,7 @@ "required": [ "application", "slave-unit", - "operating-system" + "rtos" ], "additionalProperties": false, "properties": { @@ -12,8 +12,8 @@ "slave-unit": { "$ref": "slave.schema.json#" }, - "operating-system": { - "$ref": "os.schema.json#" + "rtos": { + "$ref": "rtos.schema.json#" } } } diff --git a/conf/bms/schema/os.schema.json b/conf/bms/schema/rtos.schema.json similarity index 61% rename from conf/bms/schema/os.schema.json rename to conf/bms/schema/rtos.schema.json index f9bf2dd6..e8230111 100644 --- a/conf/bms/schema/os.schema.json +++ b/conf/bms/schema/rtos.schema.json @@ -1,5 +1,5 @@ { - "$id": "/properties/operating-system", + "$id": "/properties/rtos", "title": "Configuration of the Operating System", "required": [ "name" @@ -7,8 +7,8 @@ "additionalProperties": false, "properties": { "name": { - "$id": "/properties/operating-system/name", - "title": "Name of the Operating System (must correspond to the directory name)", + "$id": "/properties/rtos/name", + "title": "Name of the Real Time Operating System (must correspond to the directory name)", "type": "string", "enum": [ "freertos", diff --git a/conf/bms/schema/slave.schema.json b/conf/bms/schema/slave.schema.json index 313502d2..fb5faa8a 100644 --- a/conf/bms/schema/slave.schema.json +++ b/conf/bms/schema/slave.schema.json @@ -3,7 +3,6 @@ "title": "Configuration of Slave Unit", "required": [ "analog-front-end", - "balancing-strategy", "temperature-sensor" ], "additionalProperties": false, @@ -13,7 +12,7 @@ "title": "Configuration of the Analog Front-End", "required": [ "manufacturer", - "chip" + "ic" ], "additionalProperties": false, "properties": { @@ -28,7 +27,7 @@ "debug" ] }, - "chip": { + "ic": { "$id": "/properties/slave-unit/analog-front-end/chip", "title": "Name of the Analog Front-End (must correspond to the directory name)", "type": "string" @@ -45,7 +44,7 @@ }, "then": { "properties": { - "chip": { + "ic": { "enum": [ "6804-1", "6806", @@ -68,9 +67,9 @@ }, "then": { "properties": { - "chip": { + "ic": { "enum": [ - "common" + "mc33775a" ] } } @@ -87,7 +86,7 @@ }, "then": { "properties": { - "chip": { + "ic": { "enum": [ "max17852" ] @@ -106,7 +105,7 @@ }, "then": { "properties": { - "chip": { + "ic": { "enum": [ "default" ] @@ -117,16 +116,6 @@ } } }, - "balancing-strategy": { - "$id": "/properties/slave-unit/balancing-strategy", - "title": "Balancing strategy", - "type": "string", - "enum": [ - "voltage", - "history", - "none" - ] - }, "temperature-sensor": { "$id": "/properties/slave-unit/temperature-sensor", "title": "Configuration of the temperature sensor", diff --git a/conf/guidelines/rules.json b/conf/guidelines/rules.json index abcfd10a..69f79c51 100644 --- a/conf/guidelines/rules.json +++ b/conf/guidelines/rules.json @@ -33,6 +33,7 @@ "docs/_ext/**", "foxbms/**", "libbuild/**", + "src/app/driver/afe/nxp/mc33775a/vendor/**", "src/app/driver/sbc/fs8x_driver/**", "src/os/freertos/**/*.asm", "src/os/freertos/**/*.c", @@ -75,8 +76,7 @@ "conf/hcg/**/*.c", "conf/hcg/**/*.cmd", "conf/hcg/**/*.h", - "LICENSE.md", - "src/app/driver/afe/nxp/common/MC33775A.h", + "**/LICENSE.md", "src/os/freertos/README.ti-halcogen.md" ] }, @@ -88,7 +88,11 @@ "**/.gitignore", "**/__init__.py", "**/README.md", - "**/wscript" + "**/wscript", + "tests/axivion/addon-test/**/ok.c", + "tests/axivion/addon-test/test_unique_filename/**", + "tests/axivion/addon-test/test_*/**", + "tools/gui/LICENSE.md" ] }, "encoding": { @@ -109,6 +113,12 @@ }, { "src/**/*.cmd": "ascii" + }, + { + "tests/axivion/addon-test/test_file_encoding/windows-1252.cpp": "windows-1252" + }, + { + "tests/axivion/addon-test/test_file_encoding/latin1.cpp": "latin1" } ] }, @@ -139,7 +149,11 @@ }, "languages": { "C": { - "exclude": [], + "exclude": [ + "tests/axivion/addon-test/test_*/**", + "tests/axivion/config-test/**/*.c", + "tests/axivion/config-test/**/*.h" + ], "files": [ "**/*.c", "**/*.h", @@ -149,8 +163,8 @@ "name": "C:002", "exclude": [ "src/app/driver/afe/ltc/common/ltc_pec.*", - "src/app/driver/afe/nxp/common/MC33775A.h", - "src/app/driver/sbc/fs8x_driver/**" + "src/app/driver/sbc/fs8x_driver/**", + "src/app/driver/afe/nxp/mc33775a/nxp_mc33775a-ll.*" ], "text": [ "/**", @@ -202,7 +216,7 @@ "docs/developer-manual/style-guide/examples/*.c", "docs/developer-manual/style-guide/examples/*.h", "src/app/driver/afe/ltc/common/ltc_pec.*", - "src/app/driver/afe/nxp/common/MC33775A.h", + "src/app/driver/afe/nxp/mc33775a/nxp_mc33775a-ll.*", "src/app/driver/sbc/fs8x_driver/sbc_fs8x*.*", "src/app/main/linker_script_elf.cmd", "src/os/**" @@ -229,7 +243,7 @@ ], "exclude": [ "src/app/driver/afe/ltc/common/ltc_pec.*", - "src/app/driver/afe/nxp/common/MC33775A.h", + "src/app/driver/afe/nxp/mc33775a/nxp_mc33775a-ll.h", "src/app/driver/sbc/fs8x_driver/**", "src/os/**" ], @@ -245,7 +259,6 @@ "sections": { "exclude": [ "src/app/driver/afe/ltc/common/ltc_pec.*", - "src/app/driver/afe/nxp/common/MC33775A.h", "src/app/driver/sbc/fs8x_driver/**", "src/app/main/linker_script_elf.cmd" ], @@ -378,7 +391,11 @@ "comment-style": { "name": "C:029", "forbidden": "C99", - "exclude": [] + "exclude": [ + "tests/axivion/addon-test/**", + "tests/axivion/config-test/**/*.c", + "tests/axivion/config-test/**/*.h" + ] }, "formatting": { "name": "C:031", @@ -400,7 +417,9 @@ ], "header": { "name": "PYTHON:002", - "exclude": [], + "exclude": [ + "tests/axivion/addon/**" + ], "text": [ "#!/usr/bin/env python3", "# -*- coding: utf-8 -*-", @@ -461,6 +480,7 @@ "**/*waf3-**.*-*/**", "**/c4che/**", ".vscode/**", + "tests/axivion/addon/**", "tools/waf-tools/why.py" ] } diff --git a/conf/hcg/hcg.dil b/conf/hcg/hcg.dil index 5d4bdebe..8b4c4a74 100644 --- a/conf/hcg/hcg.dil +++ b/conf/hcg/hcg.dil @@ -1,4 +1,4 @@ -# TMS570LC4357ZWT 02/22/22 12:03:10 +# TMS570LC4357ZWT 07/21/22 10:56:36 # ARCH=TMS570LC4357ZWT # @@ -3323,7 +3323,7 @@ DRIVER.MIBSPI.VAR.MIBSPI3_CHARLEN3.VALUE=16 DRIVER.MIBSPI.VAR.MIBSPI1_TG1_TRGSRC.VALUE=TRG_DISABLED DRIVER.SPI.VAR.SPI5_PORT_BIT26_DIR.VALUE=0 DRIVER.SPI.VAR.SPI5_PORT_BIT18_DIR.VALUE=1 -DRIVER.SPI.VAR.SPI4_PORT_BIT4_PULL.VALUE=0 +DRIVER.SPI.VAR.SPI4_PORT_BIT4_PULL.VALUE=2 DRIVER.SPI.VAR.SPI3_PHASE2.VALUE=0 DRIVER.SPI.VAR.SPI2_TIMEOUTLVL.VALUE=0 DRIVER.SPI.VAR.SPI1_PORT_BIT1_PULL.VALUE=0 @@ -3396,11 +3396,11 @@ DRIVER.SPI.VAR.SPI4_WAITENA2.VALUE=0 DRIVER.SPI.VAR.SPI3_PORT_BIT3_FUN.VALUE=0 DRIVER.SPI.VAR.SPI2_PORT_BIT9_PULL.VALUE=0 DRIVER.SPI.VAR.SPI1_PORT_BIT9_DIR.VALUE=1 -DRIVER.SPI.VAR.SPI4_PORT_BIT5_PULDIS.VALUE=1 +DRIVER.SPI.VAR.SPI4_PORT_BIT5_PULDIS.VALUE=0 DRIVER.SPI.VAR.SPI4_WAITENA3.VALUE=0 DRIVER.SPI.VAR.SPI1_PORT_BIT2_PULDIS.VALUE=1 DRIVER.SPI.VAR.SPI3_PORT_BIT1_PSL.VALUE=1 -DRIVER.SPI.VAR.SPI1_T2CDELAY.VALUE=0 +DRIVER.SPI.VAR.SPI1_T2CDELAY.VALUE=99 DRIVER.SPI.VAR.SPI5_PORT_BIT26_FUN.VALUE=1 DRIVER.SPI.VAR.SPI5_PORT_BIT18_FUN.VALUE=1 DRIVER.SPI.VAR.SPI3_PORT_BIT5_DIR.VALUE=1 @@ -3408,14 +3408,14 @@ DRIVER.SPI.VAR.SPI3_TXINTENA.VALUE=0 DRIVER.SPI.VAR.SPI2_PORT_BIT10_PSL.VALUE=1 DRIVER.SPI.VAR.SPI1_BASE_RAM.VALUE=0xFF0E0000 DRIVER.SPI.VAR.SPI5_PORT_BIT1_DIR.VALUE=1 -DRIVER.SPI.VAR.SPI4_PORT_BIT5_PULL.VALUE=0 +DRIVER.SPI.VAR.SPI4_PORT_BIT5_PULL.VALUE=2 DRIVER.SPI.VAR.SPI1_PORT_BIT2_PULL.VALUE=0 DRIVER.SPI.VAR.SPI1_CHARLEN0.VALUE=8 DRIVER.SPI.VAR.SPI1_CHARLEN1.VALUE=8 DRIVER.SPI.VAR.SPI4_PORT_BIT8_DOUT.VALUE=1 DRIVER.SPI.VAR.SPI3_PORT_BIT3_PDR.VALUE=0 DRIVER.SPI.VAR.SPI1_PORT_BIT5_DOUT.VALUE=1 -DRIVER.SPI.VAR.SPI1_CHARLEN2.VALUE=8 +DRIVER.SPI.VAR.SPI1_CHARLEN2.VALUE=16 DRIVER.SPI.VAR.SPI1_CHARLEN3.VALUE=8 DRIVER.SPI.VAR.SPI5_PORT_BIT3_PULL.VALUE=0 DRIVER.SPI.VAR.SPI3_PORT_BIT10_DIR.VALUE=1 @@ -3449,7 +3449,7 @@ DRIVER.SPI.VAR.SPI1_PHASE1.VALUE=1 DRIVER.SPI.VAR.SPI5_PORT_BIT27_FUN.VALUE=1 DRIVER.SPI.VAR.SPI5_PORT_BIT19_FUN.VALUE=1 DRIVER.SPI.VAR.SPI5_PORT_BIT0_FUN.VALUE=1 -DRIVER.SPI.VAR.SPI1_PHASE2.VALUE=1 +DRIVER.SPI.VAR.SPI1_PHASE2.VALUE=0 DRIVER.SPI.VAR.SPI1_PHASE3.VALUE=1 DRIVER.SPI.VAR.SPI5_PORT_BIT25_PSL.VALUE=1 DRIVER.SPI.VAR.SPI5_PORT_BIT17_PSL.VALUE=1 @@ -3465,7 +3465,7 @@ DRIVER.SPI.VAR.SPI3_PORT_BIT4_PDR.VALUE=0 DRIVER.SPI.VAR.SPI2_PORT_BIT10_DOUT.VALUE=0 DRIVER.SPI.VAR.SPI1_PORT_BIT25_PDR.VALUE=1 DRIVER.SPI.VAR.SPI1_PORT_BIT17_PDR.VALUE=0 -DRIVER.SPI.VAR.SPI1_C2TDELAYACTUAL.VALUE=20.000 +DRIVER.SPI.VAR.SPI1_C2TDELAYACTUAL.VALUE=1750.000 DRIVER.SPI.VAR.SPI1_ENABLEHIGHZ.VALUE=1 DRIVER.SPI.VAR.SPI5_WDELAY1.VALUE=0 DRIVER.SPI.VAR.SPI4_C2EDELAY.VALUE=0 @@ -3492,7 +3492,7 @@ DRIVER.SPI.VAR.SPI3_PORT_BIT3_PSL.VALUE=1 DRIVER.SPI.VAR.SPI5_PORT_BIT1_FUN.VALUE=1 DRIVER.SPI.VAR.SPI5_DEYSNCLVL.VALUE=0 DRIVER.SPI.VAR.SPI3_PORT_BIT8_PULL.VALUE=2 -DRIVER.SPI.VAR.SPI4_PORT_BIT10_PULDIS.VALUE=0 +DRIVER.SPI.VAR.SPI4_PORT_BIT10_PULDIS.VALUE=1 DRIVER.SPI.VAR.SPI5_PORT_BIT26_PSL.VALUE=1 DRIVER.SPI.VAR.SPI5_PORT_BIT18_PSL.VALUE=1 DRIVER.SPI.VAR.SPI2_T2EDELAYACTUAL.VALUE=0.000 @@ -3511,14 +3511,14 @@ DRIVER.SPI.VAR.SPI1_PRESCALE1.VALUE=24 DRIVER.SPI.VAR.SPI5_PORT_BIT4_PULL.VALUE=0 DRIVER.SPI.VAR.SPI4_CHARLEN0.VALUE=8 DRIVER.SPI.VAR.SPI2_PORT_BIT1_PULL.VALUE=0 -DRIVER.SPI.VAR.SPI1_PRESCALE2.VALUE=99 -DRIVER.SPI.VAR.SPI4_PORT_BIT3_PULDIS.VALUE=1 +DRIVER.SPI.VAR.SPI1_PRESCALE2.VALUE=49 +DRIVER.SPI.VAR.SPI4_PORT_BIT3_PULDIS.VALUE=0 DRIVER.SPI.VAR.SPI4_CHARLEN1.VALUE=8 DRIVER.SPI.VAR.SPI1_PORT_BIT0_PULDIS.VALUE=1 DRIVER.SPI.VAR.SPI1_PRESCALE3.VALUE=32 DRIVER.SPI.VAR.SPI5_PORT_BIT1_PDR.VALUE=0 DRIVER.SPI.VAR.SPI5_T2CDELAYACTUAL.VALUE=10.000 -DRIVER.SPI.VAR.SPI4_CHARLEN2.VALUE=8 +DRIVER.SPI.VAR.SPI4_CHARLEN2.VALUE=16 DRIVER.SPI.VAR.SPI1_PORT_BIT8_PSL.VALUE=1 DRIVER.SPI.VAR.SPI4_CHARLEN3.VALUE=8 DRIVER.SPI.VAR.SPI1_BASE.VALUE=0xFFF7F400 @@ -3583,13 +3583,13 @@ DRIVER.SPI.VAR.SPI4_WDELAY1.VALUE=0 DRIVER.SPI.VAR.SPI5_PORT_BIT5_DIR.VALUE=1 DRIVER.SPI.VAR.SPI4_WDELAY2.VALUE=0 DRIVER.SPI.VAR.SPI2_PORT_BIT2_DIR.VALUE=1 -DRIVER.SPI.VAR.SPI1_PORT_BIT4_PULL.VALUE=2 +DRIVER.SPI.VAR.SPI1_PORT_BIT4_PULL.VALUE=0 DRIVER.SPI.VAR.SPI4_WDELAY3.VALUE=0 DRIVER.SPI.VAR.SPI3_PORT_BIT3_PULDIS.VALUE=1 DRIVER.SPI.VAR.SPI3_PORT_BIT10_PSL.VALUE=1 -DRIVER.SPI.VAR.SPI1_T2CDELAYACTUAL.VALUE=10.000 +DRIVER.SPI.VAR.SPI1_T2CDELAYACTUAL.VALUE=1000.000 DRIVER.SPI.VAR.SPI5_PORT_BIT5_PULL.VALUE=0 -DRIVER.SPI.VAR.SPI4_MASTER.VALUE=1 +DRIVER.SPI.VAR.SPI4_MASTER.VALUE=0 DRIVER.SPI.VAR.SPI2_PORT_BIT2_PULL.VALUE=2 DRIVER.SPI.VAR.SPI5_PORT_BIT8_DOUT.VALUE=1 DRIVER.SPI.VAR.SPI5_PORT_BIT3_PDR.VALUE=0 @@ -3597,7 +3597,7 @@ DRIVER.SPI.VAR.SPI3_ACTUALBAUDRATE0.VALUE=4000.000 DRIVER.SPI.VAR.SPI2_PORT_BIT0_PDR.VALUE=0 DRIVER.SPI.VAR.SPI3_ACTUALBAUDRATE1.VALUE=33333.333 DRIVER.SPI.VAR.SPI2_BASE.VALUE=0xFFF7F600 -DRIVER.SPI.VAR.SPI4_PORT_BIT10_DIR.VALUE=1 +DRIVER.SPI.VAR.SPI4_PORT_BIT10_DIR.VALUE=0 DRIVER.SPI.VAR.SPI3_PORT_BIT8_FUN.VALUE=1 DRIVER.SPI.VAR.SPI3_PORT_BIT0_PULL.VALUE=0 DRIVER.SPI.VAR.SPI3_ACTUALBAUDRATE2.VALUE=25000.000 @@ -3618,13 +3618,13 @@ DRIVER.SPI.VAR.SPI3_WAITENA1.VALUE=0 DRIVER.SPI.VAR.SPI3_WAITENA2.VALUE=0 DRIVER.SPI.VAR.SPI3_DEYSNCLVL.VALUE=0 DRIVER.SPI.VAR.SPI2_PORT_BIT3_DIR.VALUE=1 -DRIVER.SPI.VAR.SPI4_PORT_BIT1_PULDIS.VALUE=1 +DRIVER.SPI.VAR.SPI4_PORT_BIT1_PULDIS.VALUE=0 DRIVER.SPI.VAR.SPI3_WAITENA3.VALUE=0 DRIVER.SPI.VAR.SPI5_PORT_BIT26_DOUT.VALUE=1 DRIVER.SPI.VAR.SPI5_PORT_BIT18_DOUT.VALUE=1 DRIVER.SPI.VAR.SPI3_PORT_BIT11_PSL.VALUE=1 DRIVER.SPI.VAR.SPI3_PORT_BIT8_PDR.VALUE=1 -DRIVER.SPI.VAR.SPI4_PORT_BIT10_PULL.VALUE=2 +DRIVER.SPI.VAR.SPI4_PORT_BIT10_PULL.VALUE=0 DRIVER.SPI.VAR.SPI3_PORT_BIT10_PULDIS.VALUE=1 DRIVER.SPI.VAR.SPI2_TXINTENA.VALUE=0 DRIVER.SPI.VAR.SPI5_PORT_BIT4_PDR.VALUE=0 @@ -3633,7 +3633,7 @@ DRIVER.SPI.VAR.SPI2_PORT_BIT1_PDR.VALUE=0 DRIVER.SPI.VAR.SPI2_C2TDELAYACTUAL.VALUE=20.000 DRIVER.SPI.VAR.SPI5_BAUDRATE1.VALUE=1000.000 DRIVER.SPI.VAR.SPI5_BAUDRATE2.VALUE=1000.000 -DRIVER.SPI.VAR.SPI4_PORT_BIT11_DIR.VALUE=0 +DRIVER.SPI.VAR.SPI4_PORT_BIT11_DIR.VALUE=1 DRIVER.SPI.VAR.SPI4_PARPOL0.VALUE=0 DRIVER.SPI.VAR.SPI3_PORT_BIT9_FUN.VALUE=1 DRIVER.SPI.VAR.SPI5_BAUDRATE3.VALUE=1000.000 @@ -3655,7 +3655,7 @@ DRIVER.SPI.VAR.SPI4_T2EDELAY.VALUE=0 DRIVER.SPI.VAR.SPI4_PHASE1.VALUE=1 DRIVER.SPI.VAR.SPI5_POLARITY2.VALUE=0 DRIVER.SPI.VAR.SPI4_PORT_BIT8_PULL.VALUE=2 -DRIVER.SPI.VAR.SPI4_PHASE2.VALUE=1 +DRIVER.SPI.VAR.SPI4_PHASE2.VALUE=0 DRIVER.SPI.VAR.SPI3_BITERRLVL.VALUE=0 DRIVER.SPI.VAR.SPI3_OVRNINTLVL.VALUE=0 DRIVER.SPI.VAR.SPI3_RXINTLVL.VALUE=0 @@ -3674,9 +3674,9 @@ DRIVER.SPI.VAR.SPI1_ACTUALBAUDRATE0.VALUE=1000.000 DRIVER.SPI.VAR.SPI2_SHIFTDIR3.VALUE=0 DRIVER.SPI.VAR.SPI1_ACTUALBAUDRATE1.VALUE=4000.000 DRIVER.SPI.VAR.SPI4_PORT_BIT10_FUN.VALUE=1 -DRIVER.SPI.VAR.SPI4_PORT_BIT0_DIR.VALUE=1 +DRIVER.SPI.VAR.SPI4_PORT_BIT0_DIR.VALUE=0 DRIVER.SPI.VAR.SPI2_PORT_BIT3_PULL.VALUE=2 -DRIVER.SPI.VAR.SPI1_ACTUALBAUDRATE2.VALUE=1000.000 +DRIVER.SPI.VAR.SPI1_ACTUALBAUDRATE2.VALUE=2000.000 DRIVER.SPI.VAR.SPI5_PORT_BIT11_PULDIS.VALUE=0 DRIVER.SPI.VAR.SPI1_ACTUALBAUDRATE3.VALUE=3030.303 DRIVER.SPI.VAR.SPI5_PORT_BIT9_DOUT.VALUE=1 @@ -3695,7 +3695,7 @@ DRIVER.SPI.VAR.SPI1_PORT_BIT17_DOUT.VALUE=0 DRIVER.SPI.VAR.SPI4_PRESCALE1.VALUE=24 DRIVER.SPI.VAR.SPI3_C2EDELAY.VALUE=0 DRIVER.SPI.VAR.SPI3_WDELAY1.VALUE=0 -DRIVER.SPI.VAR.SPI4_PRESCALE2.VALUE=99 +DRIVER.SPI.VAR.SPI4_PRESCALE2.VALUE=49 DRIVER.SPI.VAR.SPI3_WDELAY2.VALUE=0 DRIVER.SPI.VAR.SPI2_PORT_BIT3_FUN.VALUE=1 DRIVER.SPI.VAR.SPI4_PRESCALE3.VALUE=32 @@ -3723,8 +3723,8 @@ DRIVER.SPI.VAR.SPI5_PORT_BIT27_DOUT.VALUE=1 DRIVER.SPI.VAR.SPI5_PORT_BIT19_DOUT.VALUE=1 DRIVER.SPI.VAR.SPI5_PORT_BIT0_DOUT.VALUE=1 DRIVER.SPI.VAR.SPI4_PORT_BIT11_FUN.VALUE=1 -DRIVER.SPI.VAR.SPI4_PORT_BIT11_PULL.VALUE=2 -DRIVER.SPI.VAR.SPI4_PORT_BIT1_DIR.VALUE=1 +DRIVER.SPI.VAR.SPI4_PORT_BIT11_PULL.VALUE=0 +DRIVER.SPI.VAR.SPI4_PORT_BIT1_DIR.VALUE=0 DRIVER.SPI.VAR.SPI1_RAM_PARITY_ENA.VALUE=0 DRIVER.SPI.VAR.SPI2_PORT_BIT3_PDR.VALUE=0 DRIVER.SPI.VAR.SPI3_T2CDELAY.VALUE=0 @@ -3737,7 +3737,7 @@ DRIVER.SPI.VAR.SPI3_CHARLEN1.VALUE=8 DRIVER.SPI.VAR.SPI1_PARERRENA.VALUE=1 DRIVER.SPI.VAR.SPI5_PORT_BIT10_DOUT.VALUE=1 DRIVER.SPI.VAR.SPI5_PORT_BIT5_PSL.VALUE=1 -DRIVER.SPI.VAR.SPI4_PORT_BIT11_PDR.VALUE=1 +DRIVER.SPI.VAR.SPI4_PORT_BIT11_PDR.VALUE=0 DRIVER.SPI.VAR.SPI3_CHARLEN2.VALUE=16 DRIVER.SPI.VAR.SPI2_PORT_BIT2_PSL.VALUE=1 DRIVER.SPI.VAR.SPI3_CHARLEN3.VALUE=16 @@ -3747,7 +3747,7 @@ DRIVER.SPI.VAR.SPI4_PORT_BIT0_FUN.VALUE=0 DRIVER.SPI.VAR.SPI3_PARERRLVL.VALUE=0 DRIVER.SPI.VAR.SPI2_RXINTENA.VALUE=1 DRIVER.SPI.VAR.SPI1_PORT_BIT9_DOUT.VALUE=0 -DRIVER.SPI.VAR.SPI4_PORT_BIT2_DIR.VALUE=1 +DRIVER.SPI.VAR.SPI4_PORT_BIT2_DIR.VALUE=0 DRIVER.SPI.VAR.SPI3_PARPOL0.VALUE=0 DRIVER.SPI.VAR.SPI1_DEYSNCLVL.VALUE=0 DRIVER.SPI.VAR.SPI3_PARPOL1.VALUE=0 @@ -3761,7 +3761,7 @@ DRIVER.SPI.VAR.SPI3_PORT_BIT2_PULL.VALUE=0 DRIVER.SPI.VAR.SPI5_PORT_BIT4_PULDIS.VALUE=1 DRIVER.SPI.VAR.SPI2_PORT_BIT1_PULDIS.VALUE=1 DRIVER.SPI.VAR.SPI4_PORT_BIT0_PDR.VALUE=0 -DRIVER.SPI.VAR.SPI4_CLKMOD.VALUE=1 +DRIVER.SPI.VAR.SPI4_CLKMOD.VALUE=0 DRIVER.SPI.VAR.SPI3_PORT_BIT5_DOUT.VALUE=1 DRIVER.SPI.VAR.SPI3_BAUDRATE0.VALUE=4000.000 DRIVER.SPI.VAR.SPI2_PHASE0.VALUE=0 @@ -3769,7 +3769,7 @@ DRIVER.SPI.VAR.SPI3_BAUDRATE1.VALUE=33333.000 DRIVER.SPI.VAR.SPI2_PHASE1.VALUE=0 DRIVER.SPI.VAR.SPI5_PORT_BIT10_DIR.VALUE=1 DRIVER.SPI.VAR.SPI5_PORT_BIT8_FUN.VALUE=1 -DRIVER.SPI.VAR.SPI4_PORT_BIT0_PULL.VALUE=0 +DRIVER.SPI.VAR.SPI4_PORT_BIT0_PULL.VALUE=2 DRIVER.SPI.VAR.SPI3_BAUDRATE2.VALUE=25000.000 DRIVER.SPI.VAR.SPI2_PHASE2.VALUE=0 DRIVER.SPI.VAR.SPI2_TXINTLVL.VALUE=0 @@ -3787,7 +3787,7 @@ DRIVER.SPI.VAR.SPI1_OVRNINTENA.VALUE=1 DRIVER.SPI.VAR.SPI5_PORT_BIT1_DOUT.VALUE=1 DRIVER.SPI.VAR.SPI3_POLARITY0.VALUE=0 DRIVER.SPI.VAR.SPI3_POLARITY1.VALUE=0 -DRIVER.SPI.VAR.SPI4_PORT_BIT3_DIR.VALUE=1 +DRIVER.SPI.VAR.SPI4_PORT_BIT3_DIR.VALUE=0 DRIVER.SPI.VAR.SPI3_POLARITY2.VALUE=0 DRIVER.SPI.VAR.SPI2_OVRNINTLVL.VALUE=0 DRIVER.SPI.VAR.SPI1_PORT_BIT0_DIR.VALUE=1 @@ -3805,7 +3805,7 @@ DRIVER.SPI.VAR.SPI3_PORT_BIT10_DOUT.VALUE=1 DRIVER.SPI.VAR.SPI3_C2TDELAYACTUAL.VALUE=20.000 DRIVER.SPI.VAR.SPI5_PORT_BIT11_DIR.VALUE=0 DRIVER.SPI.VAR.SPI5_PORT_BIT9_FUN.VALUE=1 -DRIVER.SPI.VAR.SPI4_PORT_BIT11_PULDIS.VALUE=0 +DRIVER.SPI.VAR.SPI4_PORT_BIT11_PULDIS.VALUE=1 DRIVER.SPI.VAR.SPI5_PORT_BIT11_DOUT.VALUE=1 DRIVER.SPI.VAR.SPI2_PRESCALE0.VALUE=9 DRIVER.SPI.VAR.SPI2_PRESCALE1.VALUE=99 @@ -3817,17 +3817,17 @@ DRIVER.SPI.VAR.SPI2_PRESCALE3.VALUE=99 DRIVER.SPI.VAR.SPI1_PORT_BIT8_PULDIS.VALUE=0 DRIVER.SPI.VAR.SPI4_PORT_BIT0_PSL.VALUE=1 DRIVER.SPI.VAR.SPI1_PARITYENA0.VALUE=0 -DRIVER.SPI.VAR.SPI1_C2TDELAY.VALUE=0 +DRIVER.SPI.VAR.SPI1_C2TDELAY.VALUE=173 DRIVER.SPI.VAR.SPI1_PARITYENA1.VALUE=0 DRIVER.SPI.VAR.SPI5_PORT_BIT8_PULL.VALUE=2 -DRIVER.SPI.VAR.SPI4_PORT_BIT4_DIR.VALUE=1 +DRIVER.SPI.VAR.SPI4_PORT_BIT4_DIR.VALUE=0 DRIVER.SPI.VAR.SPI4_TIMEOUTLVL.VALUE=0 DRIVER.SPI.VAR.SPI1_PORT_BIT1_DIR.VALUE=1 DRIVER.SPI.VAR.SPI1_PARITYENA2.VALUE=0 DRIVER.SPI.VAR.SPI1_DLENERRLVL.VALUE=0 DRIVER.SPI.VAR.SPI1_BASE_PORT.VALUE=0xFFF7F418 DRIVER.SPI.VAR.SPI5_RXINTENA.VALUE=1 -DRIVER.SPI.VAR.SPI4_PORT_BIT4_PULDIS.VALUE=1 +DRIVER.SPI.VAR.SPI4_PORT_BIT4_PULDIS.VALUE=0 DRIVER.SPI.VAR.SPI4_BITERRENA.VALUE=1 DRIVER.SPI.VAR.SPI1_PORT_BIT1_PULDIS.VALUE=1 DRIVER.SPI.VAR.SPI1_PARITYENA3.VALUE=0 @@ -3848,7 +3848,7 @@ DRIVER.SPI.VAR.SPI5_C2EDELAYACTUAL.VALUE=0.000 DRIVER.SPI.VAR.SPI5_SHIFTDIR2.VALUE=0 DRIVER.SPI.VAR.SPI4_PORT_BIT2_PDR.VALUE=0 DRIVER.SPI.VAR.SPI5_SHIFTDIR3.VALUE=0 -DRIVER.SPI.VAR.SPI4_PORT_BIT1_PULL.VALUE=0 +DRIVER.SPI.VAR.SPI4_PORT_BIT1_PULL.VALUE=2 DRIVER.SPI.VAR.SPI1_TXINTENA.VALUE=0 DRIVER.SPI.VAR.SPI5_PORT_BIT8_PSL.VALUE=1 DRIVER.SPI.VAR.SPI4_PORT_BIT4_DOUT.VALUE=1 @@ -3856,7 +3856,7 @@ DRIVER.SPI.VAR.SPI1_PORT_BIT1_DOUT.VALUE=1 DRIVER.SPI.VAR.SPI5_PORT_BIT26_PULL.VALUE=2 DRIVER.SPI.VAR.SPI5_PORT_BIT18_PULL.VALUE=0 DRIVER.SPI.VAR.SPI5_TXINTLVL.VALUE=0 -DRIVER.SPI.VAR.SPI4_PORT_BIT3_FUN.VALUE=1 +DRIVER.SPI.VAR.SPI4_PORT_BIT3_FUN.VALUE=0 DRIVER.SPI.VAR.SPI2_PORT_BIT9_DIR.VALUE=1 DRIVER.SPI.VAR.SPI2_PARPOL0.VALUE=0 DRIVER.SPI.VAR.SPI1_PORT_BIT0_FUN.VALUE=0 @@ -3867,7 +3867,7 @@ DRIVER.SPI.VAR.SPI5_PORT_BIT2_DOUT.VALUE=1 DRIVER.SPI.VAR.SPI4_PORT_BIT1_PSL.VALUE=1 DRIVER.SPI.VAR.SPI2_PARPOL2.VALUE=0 DRIVER.SPI.VAR.SPI2_PARPOL3.VALUE=0 -DRIVER.SPI.VAR.SPI4_PORT_BIT5_DIR.VALUE=1 +DRIVER.SPI.VAR.SPI4_PORT_BIT5_DIR.VALUE=0 DRIVER.SPI.VAR.SPI1_PORT_BIT2_DIR.VALUE=1 DRIVER.SPI.VAR.SPI1_PARERRLVL.VALUE=0 DRIVER.SPI.VAR.SPI5_PORT_BIT2_PULDIS.VALUE=1 @@ -3888,7 +3888,7 @@ DRIVER.SPI.VAR.SPI1_BAUDRATE1.VALUE=4000.000 DRIVER.SPI.VAR.SPI4_PORT_BIT4_FUN.VALUE=0 DRIVER.SPI.VAR.SPI1_PORT_BIT8_PULL.VALUE=2 DRIVER.SPI.VAR.SPI1_PORT_BIT1_FUN.VALUE=0 -DRIVER.SPI.VAR.SPI1_BAUDRATE2.VALUE=1000.000 +DRIVER.SPI.VAR.SPI1_BAUDRATE2.VALUE=2000.000 DRIVER.SPI.VAR.SPI3_PORT_BIT4_PULDIS.VALUE=1 DRIVER.SPI.VAR.SPI1_PORT_BIT25_PULDIS.VALUE=0 DRIVER.SPI.VAR.SPI1_PORT_BIT17_PULDIS.VALUE=1 @@ -3908,7 +3908,7 @@ DRIVER.SPI.VAR.SPI1_PORT_BIT10_PULDIS.VALUE=1 DRIVER.SPI.VAR.SPI1_WDELAY3.VALUE=0 DRIVER.SPI.VAR.SPI2_PORT_BIT9_DOUT.VALUE=0 DRIVER.SPI.VAR.SPI2_PORT_BIT8_PDR.VALUE=1 -DRIVER.SPI.VAR.SPI1_C2EDELAYACTUAL.VALUE=0.000 +DRIVER.SPI.VAR.SPI1_C2EDELAYACTUAL.VALUE=0.173 DRIVER.SPI.VAR.SPI1_POLARITY0.VALUE=0 DRIVER.SPI.VAR.SPI4_C2TDELAY.VALUE=0 DRIVER.SPI.VAR.SPI1_POLARITY1.VALUE=0 @@ -3928,7 +3928,7 @@ DRIVER.SPI.VAR.SPI3_T2CDELAYACTUAL.VALUE=10.000 DRIVER.SPI.VAR.SPI1_PORT_BIT1_PDR.VALUE=0 DRIVER.SPI.VAR.SPI5_WAITENA1.VALUE=0 DRIVER.SPI.VAR.SPI5_WAITENA2.VALUE=0 -DRIVER.SPI.VAR.SPI4_PORT_BIT2_PULL.VALUE=0 +DRIVER.SPI.VAR.SPI4_PORT_BIT2_PULL.VALUE=2 DRIVER.SPI.VAR.SPI4_DEYSNCLVL.VALUE=0 DRIVER.SPI.VAR.SPI2_PORT_BIT9_FUN.VALUE=1 DRIVER.SPI.VAR.SPI5_WAITENA3.VALUE=0 @@ -3943,9 +3943,9 @@ DRIVER.SPI.VAR.SPI5_PORT_BIT27_PULL.VALUE=2 DRIVER.SPI.VAR.SPI5_PORT_BIT19_PULL.VALUE=0 DRIVER.SPI.VAR.SPI5_PORT_BIT0_PULL.VALUE=0 DRIVER.SPI.VAR.SPI4_PORT_BIT5_FUN.VALUE=0 -DRIVER.SPI.VAR.SPI4_ACTUALBAUDRATE2.VALUE=1000.000 +DRIVER.SPI.VAR.SPI4_ACTUALBAUDRATE2.VALUE=2000.000 DRIVER.SPI.VAR.SPI1_PORT_BIT2_FUN.VALUE=0 -DRIVER.SPI.VAR.SPI4_PORT_BIT2_PULDIS.VALUE=1 +DRIVER.SPI.VAR.SPI4_PORT_BIT2_PULDIS.VALUE=0 DRIVER.SPI.VAR.SPI4_ACTUALBAUDRATE3.VALUE=3030.303 DRIVER.SPI.VAR.SPI4_TXINTENA.VALUE=0 DRIVER.SPI.VAR.SPI5_PORT_BIT3_DOUT.VALUE=1 @@ -3989,7 +3989,7 @@ DRIVER.SPI.VAR.SPI3_SHIFTDIR3.VALUE=0 DRIVER.SPI.VAR.SPI1_PARPOL3.VALUE=0 DRIVER.SPI.VAR.SPI5_PHASE2.VALUE=0 DRIVER.SPI.VAR.SPI1_PORT_BIT9_PULL.VALUE=0 -DRIVER.SPI.VAR.SPI1_PORT_BIT3_FUN.VALUE=1 +DRIVER.SPI.VAR.SPI1_PORT_BIT3_FUN.VALUE=0 DRIVER.SPI.VAR.SPI5_PORT_BIT27_PULDIS.VALUE=0 DRIVER.SPI.VAR.SPI5_PORT_BIT19_PULDIS.VALUE=1 DRIVER.SPI.VAR.SPI5_PORT_BIT0_PULDIS.VALUE=1 @@ -4013,7 +4013,7 @@ DRIVER.SPI.VAR.SPI3_PORT_BIT8_DOUT.VALUE=1 DRIVER.SPI.VAR.SPI2_ACTUALBAUDRATE0.VALUE=10000.000 DRIVER.SPI.VAR.SPI1_PORT_BIT3_PDR.VALUE=0 DRIVER.SPI.VAR.SPI2_ACTUALBAUDRATE1.VALUE=1000.000 -DRIVER.SPI.VAR.SPI4_PORT_BIT3_PULL.VALUE=0 +DRIVER.SPI.VAR.SPI4_PORT_BIT3_PULL.VALUE=2 DRIVER.SPI.VAR.SPI4_BASE_PORT.VALUE=0xFFF7FA18 DRIVER.SPI.VAR.SPI2_PORT_BIT10_DIR.VALUE=1 DRIVER.SPI.VAR.SPI2_ACTUALBAUDRATE2.VALUE=1000.000 @@ -4031,7 +4031,7 @@ DRIVER.SPI.VAR.SPI4_PORT_BIT5_PSL.VALUE=1 DRIVER.SPI.VAR.SPI2_PORT_BIT1_DOUT.VALUE=1 DRIVER.SPI.VAR.SPI1_PORT_BIT2_PSL.VALUE=1 DRIVER.SPI.VAR.SPI5_T2CDELAY.VALUE=0 -DRIVER.SPI.VAR.SPI4_PORT_BIT9_DIR.VALUE=1 +DRIVER.SPI.VAR.SPI4_PORT_BIT9_DIR.VALUE=0 DRIVER.SPI.VAR.SPI3_PORT_BIT0_FUN.VALUE=0 DRIVER.SPI.VAR.SPI1_PORT_BIT11_PSL.VALUE=1 DRIVER.SPI.VAR.SPI5_BASE_RAM.VALUE=0xFF0A0000 @@ -4040,7 +4040,7 @@ DRIVER.SPI.VAR.SPI3_PORT_BIT10_PULL.VALUE=0 DRIVER.SPI.VAR.SPI3_PORT_BIT2_DIR.VALUE=1 DRIVER.SPI.VAR.SPI5_CHARLEN1.VALUE=16 DRIVER.SPI.VAR.SPI2_PARERRENA.VALUE=1 -DRIVER.SPI.VAR.SPI1_PORT_BIT4_PULDIS.VALUE=0 +DRIVER.SPI.VAR.SPI1_PORT_BIT4_PULDIS.VALUE=1 DRIVER.SPI.VAR.SPI5_CHARLEN2.VALUE=16 DRIVER.SPI.VAR.SPI1_PORT_BIT4_PDR.VALUE=0 DRIVER.SPI.VAR.SPI5_CHARLEN3.VALUE=16 @@ -4049,7 +4049,7 @@ DRIVER.SPI.VAR.SPI5_PORT_BIT17_DIR.VALUE=1 DRIVER.SPI.VAR.SPI5_PORT_BIT11_PULL.VALUE=2 DRIVER.SPI.VAR.SPI4_PARERRLVL.VALUE=0 DRIVER.SPI.VAR.SPI2_PORT_BIT11_DIR.VALUE=0 -DRIVER.SPI.VAR.SPI4_PORT_BIT0_PULDIS.VALUE=1 +DRIVER.SPI.VAR.SPI4_PORT_BIT0_PULDIS.VALUE=0 DRIVER.SPI.VAR.SPI4_DLENERRENA.VALUE=1 DRIVER.SPI.VAR.SPI4_RXINTENA.VALUE=1 DRIVER.SPI.VAR.SPI3_RAM_PARITY_ENA.VALUE=0 @@ -4071,9 +4071,9 @@ DRIVER.SPI.VAR.SPI3_PORT_BIT1_FUN.VALUE=0 DRIVER.SPI.VAR.SPI2_PORT_BIT8_PULL.VALUE=2 DRIVER.SPI.VAR.SPI2_PORT_BIT9_PULDIS.VALUE=1 DRIVER.SPI.VAR.SPI4_BAUDRATE0.VALUE=1000.000 -DRIVER.SPI.VAR.SPI1_T2EDELAYACTUAL.VALUE=0.000 +DRIVER.SPI.VAR.SPI1_T2EDELAYACTUAL.VALUE=0.099 DRIVER.SPI.VAR.SPI4_BAUDRATE1.VALUE=4000.000 -DRIVER.SPI.VAR.SPI4_BAUDRATE2.VALUE=1000.000 +DRIVER.SPI.VAR.SPI4_BAUDRATE2.VALUE=2000.000 DRIVER.SPI.VAR.SPI4_TXINTLVL.VALUE=0 DRIVER.SPI.VAR.SPI3_PORT_BIT3_DIR.VALUE=1 DRIVER.SPI.VAR.SPI2_PORT_BIT10_FUN.VALUE=1 @@ -4112,7 +4112,7 @@ DRIVER.CAN.VAR.CAN_4_MESSAGE_9_INT_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_3_MESSAGE_30_INT_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_3_MESSAGE_22_INT_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_3_MESSAGE_14_INT_ENA.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_4_ENA.VALUE=0x00000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_4_ENA.VALUE=0x80000000 DRIVER.CAN.VAR.CAN_1_MESSAGE_61_BOOL_ENA.VALUE=1 DRIVER.CAN.VAR.CAN_1_MESSAGE_53_BOOL_ENA.VALUE=1 DRIVER.CAN.VAR.CAN_1_MESSAGE_45_BOOL_ENA.VALUE=1 @@ -4142,9 +4142,9 @@ DRIVER.CAN.VAR.CAN_4_MESSAGE_49_INT_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_64_MASK.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_56_MASK.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_48_MASK.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_31_BOOL_ENA.VALUE=0 -DRIVER.CAN.VAR.CAN_2_MESSAGE_23_BOOL_ENA.VALUE=0 -DRIVER.CAN.VAR.CAN_2_MESSAGE_15_BOOL_ENA.VALUE=0 +DRIVER.CAN.VAR.CAN_2_MESSAGE_31_BOOL_ENA.VALUE=1 +DRIVER.CAN.VAR.CAN_2_MESSAGE_23_BOOL_ENA.VALUE=1 +DRIVER.CAN.VAR.CAN_2_MESSAGE_15_BOOL_ENA.VALUE=1 DRIVER.CAN.VAR.CAN_1_MESSAGE_51_INT_ENA.VALUE=0x00000400 DRIVER.CAN.VAR.CAN_1_MESSAGE_43_INT_ENA.VALUE=0x00000400 DRIVER.CAN.VAR.CAN_1_MESSAGE_35_INT_ENA.VALUE=0x00000400 @@ -4286,8 +4286,8 @@ DRIVER.CAN.VAR.CAN_2_MESSAGE_39_INT_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_31_MASK.VALUE=0x000007FF DRIVER.CAN.VAR.CAN_2_MESSAGE_23_MASK.VALUE=0x000007FF DRIVER.CAN.VAR.CAN_2_MESSAGE_15_MASK.VALUE=0x000007FF -DRIVER.CAN.VAR.CAN_2_MESSAGE_10_ENA.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_5_ENA.VALUE=0x00000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_10_ENA.VALUE=0x80000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_5_ENA.VALUE=0x80000000 DRIVER.CAN.VAR.CAN_1_PORT_TX_PULDIS.VALUE=0 DRIVER.CAN.VAR.CAN_1_MESSAGE_30_BOOL_ENA.VALUE=1 DRIVER.CAN.VAR.CAN_1_MESSAGE_22_BOOL_ENA.VALUE=1 @@ -4321,7 +4321,7 @@ DRIVER.CAN.VAR.CAN_4_MESSAGE_11_INT_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_4_MESSAGE_1_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_3_MESSAGE_8_MASK.VALUE=0x000007FF DRIVER.CAN.VAR.CAN_3_MESSAGE_3_INT_ENA.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_3_BOOL_ENA.VALUE=0 +DRIVER.CAN.VAR.CAN_2_MESSAGE_3_BOOL_ENA.VALUE=1 DRIVER.CAN.VAR.CAN_1_MESSAGE_10_MASK.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_4_MESSAGE_4_INT_LEVEL.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_3_MESSAGE_21_INT_LEVEL.VALUE=0x00000000 @@ -4352,8 +4352,8 @@ DRIVER.CAN.VAR.CAN_4_IDENTIFIER_MODE.VALUE=0x40000000 DRIVER.CAN.VAR.CAN_3_MESSAGE_57_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_3_MESSAGE_49_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_3_MESSAGE_11_MASK.VALUE=0x000007FF -DRIVER.CAN.VAR.CAN_2_MESSAGE_57_BOOL_ENA.VALUE=0 -DRIVER.CAN.VAR.CAN_2_MESSAGE_49_BOOL_ENA.VALUE=0 +DRIVER.CAN.VAR.CAN_2_MESSAGE_57_BOOL_ENA.VALUE=1 +DRIVER.CAN.VAR.CAN_2_MESSAGE_49_BOOL_ENA.VALUE=1 DRIVER.CAN.VAR.CAN_2_MESSAGE_40_INT_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_32_INT_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_24_INT_ENA.VALUE=0x00000000 @@ -4430,8 +4430,8 @@ DRIVER.CAN.VAR.CAN_1_MESSAGE_3_INT_ENA_REF.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_4_MESSAGE_21_BOOL_ENA.VALUE=0 DRIVER.CAN.VAR.CAN_4_MESSAGE_13_BOOL_ENA.VALUE=0 DRIVER.CAN.VAR.CAN_3_MESSAGE_5_BOOL_ENA.VALUE=0 -DRIVER.CAN.VAR.CAN_2_MESSAGE_11_ENA.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_6_ENA.VALUE=0x00000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_11_ENA.VALUE=0x80000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_6_ENA.VALUE=0x80000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_4_INT_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_1_PROP_SEG.VALUE=1 DRIVER.CAN.VAR.CAN_3_MESSAGE_1_ID.VALUE=1 @@ -4491,11 +4491,11 @@ DRIVER.CAN.VAR.CAN_3_MESSAGE_3_INT_ENA_REF.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_4_MESSAGE_58_MASK.VALUE=0x000007FF DRIVER.CAN.VAR.CAN_4_BAUDRATE.VALUE=1000 DRIVER.CAN.VAR.CAN_3_MESSAGE_58_ENA.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_50_BOOL_ENA.VALUE=0 +DRIVER.CAN.VAR.CAN_2_MESSAGE_50_BOOL_ENA.VALUE=1 DRIVER.CAN.VAR.CAN_2_MESSAGE_42_BOOL_ENA.VALUE=1 -DRIVER.CAN.VAR.CAN_2_MESSAGE_34_BOOL_ENA.VALUE=0 -DRIVER.CAN.VAR.CAN_2_MESSAGE_26_BOOL_ENA.VALUE=0 -DRIVER.CAN.VAR.CAN_2_MESSAGE_18_BOOL_ENA.VALUE=0 +DRIVER.CAN.VAR.CAN_2_MESSAGE_34_BOOL_ENA.VALUE=1 +DRIVER.CAN.VAR.CAN_2_MESSAGE_26_BOOL_ENA.VALUE=1 +DRIVER.CAN.VAR.CAN_2_MESSAGE_18_BOOL_ENA.VALUE=1 DRIVER.CAN.VAR.CAN_1_MESSAGE_60_MASK.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_1_MESSAGE_57_INT_ENA.VALUE=0x00000400 DRIVER.CAN.VAR.CAN_1_MESSAGE_52_MASK.VALUE=0x00000000 @@ -4584,10 +4584,10 @@ DRIVER.CAN.VAR.CAN_4_MESSAGE_48_INT_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_40_MASK.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_32_MASK.VALUE=0x000007FF DRIVER.CAN.VAR.CAN_2_MESSAGE_24_MASK.VALUE=0x000007FF -DRIVER.CAN.VAR.CAN_2_MESSAGE_20_ENA.VALUE=0x00000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_20_ENA.VALUE=0x80000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_16_MASK.VALUE=0x000007FF -DRIVER.CAN.VAR.CAN_2_MESSAGE_12_ENA.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_7_ENA.VALUE=0x00000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_12_ENA.VALUE=0x80000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_7_ENA.VALUE=0x80000000 DRIVER.CAN.VAR.CAN_1_MESSAGE_50_INT_ENA.VALUE=0x00000400 DRIVER.CAN.VAR.CAN_1_MESSAGE_42_INT_ENA.VALUE=0x00000800 DRIVER.CAN.VAR.CAN_1_MESSAGE_34_INT_ENA.VALUE=0x00000400 @@ -4653,8 +4653,8 @@ DRIVER.CAN.VAR.CAN_3_MESSAGE_59_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_3_MESSAGE_20_MASK.VALUE=0x000007FF DRIVER.CAN.VAR.CAN_3_MESSAGE_12_MASK.VALUE=0x000007FF DRIVER.CAN.VAR.CAN_3_MESSAGE_9_INT_ENA.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_11_BOOL_ENA.VALUE=0 -DRIVER.CAN.VAR.CAN_2_MESSAGE_6_BOOL_ENA.VALUE=0 +DRIVER.CAN.VAR.CAN_2_MESSAGE_11_BOOL_ENA.VALUE=1 +DRIVER.CAN.VAR.CAN_2_MESSAGE_6_BOOL_ENA.VALUE=1 DRIVER.CAN.VAR.CAN_1_MESSAGE_11_INT_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_1_MESSAGE_4_MASK.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_4_MESSAGE_20_ID.VALUE=20 @@ -4733,9 +4733,9 @@ DRIVER.CAN.VAR.CAN_3_MESSAGE_54_BOOL_ENA.VALUE=0 DRIVER.CAN.VAR.CAN_3_MESSAGE_46_BOOL_ENA.VALUE=0 DRIVER.CAN.VAR.CAN_3_MESSAGE_38_BOOL_ENA.VALUE=0 DRIVER.CAN.VAR.CAN_3_MESSAGE_2_INT_ENA.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_21_ENA.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_13_ENA.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_8_ENA.VALUE=0x00000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_21_ENA.VALUE=0x80000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_13_ENA.VALUE=0x80000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_8_ENA.VALUE=0x80000000 DRIVER.CAN.VAR.CAN_1_NOMINAL_BIT_RATE.VALUE=500.000 DRIVER.CAN.VAR.CAN_4_MESSAGE_21_ID.VALUE=21 DRIVER.CAN.VAR.CAN_4_MESSAGE_13_ID.VALUE=13 @@ -4829,11 +4829,11 @@ DRIVER.CAN.VAR.CAN_3_MESSAGE_62_MASK.VALUE=0x000007FF DRIVER.CAN.VAR.CAN_3_MESSAGE_54_MASK.VALUE=0x000007FF DRIVER.CAN.VAR.CAN_3_MESSAGE_46_MASK.VALUE=0x000007FF DRIVER.CAN.VAR.CAN_3_MESSAGE_38_MASK.VALUE=0x000007FF -DRIVER.CAN.VAR.CAN_2_MESSAGE_61_BOOL_ENA.VALUE=0 -DRIVER.CAN.VAR.CAN_2_MESSAGE_53_BOOL_ENA.VALUE=0 -DRIVER.CAN.VAR.CAN_2_MESSAGE_45_BOOL_ENA.VALUE=0 -DRIVER.CAN.VAR.CAN_2_MESSAGE_37_BOOL_ENA.VALUE=0 -DRIVER.CAN.VAR.CAN_2_MESSAGE_29_BOOL_ENA.VALUE=0 +DRIVER.CAN.VAR.CAN_2_MESSAGE_61_BOOL_ENA.VALUE=1 +DRIVER.CAN.VAR.CAN_2_MESSAGE_53_BOOL_ENA.VALUE=1 +DRIVER.CAN.VAR.CAN_2_MESSAGE_45_BOOL_ENA.VALUE=1 +DRIVER.CAN.VAR.CAN_2_MESSAGE_37_BOOL_ENA.VALUE=1 +DRIVER.CAN.VAR.CAN_2_MESSAGE_29_BOOL_ENA.VALUE=1 DRIVER.CAN.VAR.CAN_2_MESSAGE_3_INT_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_1_MESSAGE_50_ENA.VALUE=0x80000000 DRIVER.CAN.VAR.CAN_1_MESSAGE_42_ENA.VALUE=0x00000000 @@ -4883,12 +4883,12 @@ DRIVER.CAN.VAR.CAN_3_MESSAGE_19_INT_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_3_MESSAGE_15_BOOL_ENA.VALUE=0 DRIVER.CAN.VAR.CAN_2_MESSAGE_41_MASK.VALUE=0x000007FF DRIVER.CAN.VAR.CAN_2_MESSAGE_33_MASK.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_30_ENA.VALUE=0x00000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_30_ENA.VALUE=0x80000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_25_MASK.VALUE=0x000007FF -DRIVER.CAN.VAR.CAN_2_MESSAGE_22_ENA.VALUE=0x00000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_22_ENA.VALUE=0x80000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_17_MASK.VALUE=0x000007FF -DRIVER.CAN.VAR.CAN_2_MESSAGE_14_ENA.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_9_ENA.VALUE=0x00000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_14_ENA.VALUE=0x80000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_9_ENA.VALUE=0x80000000 DRIVER.CAN.VAR.CAN_2_TQ.VALUE=250.000 DRIVER.CAN.VAR.CAN_1_MESSAGE_7_BOOL_ENA.VALUE=1 DRIVER.CAN.VAR.CAN_1_BRPE.VALUE=0 @@ -4998,10 +4998,10 @@ DRIVER.CAN.VAR.CAN_4_MESSAGE_55_INT_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_4_MESSAGE_49_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_4_MESSAGE_47_INT_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_4_MESSAGE_39_INT_ENA.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_30_BOOL_ENA.VALUE=0 -DRIVER.CAN.VAR.CAN_2_MESSAGE_22_BOOL_ENA.VALUE=0 -DRIVER.CAN.VAR.CAN_2_MESSAGE_14_BOOL_ENA.VALUE=0 -DRIVER.CAN.VAR.CAN_2_MESSAGE_9_BOOL_ENA.VALUE=0 +DRIVER.CAN.VAR.CAN_2_MESSAGE_30_BOOL_ENA.VALUE=1 +DRIVER.CAN.VAR.CAN_2_MESSAGE_22_BOOL_ENA.VALUE=1 +DRIVER.CAN.VAR.CAN_2_MESSAGE_14_BOOL_ENA.VALUE=1 +DRIVER.CAN.VAR.CAN_2_MESSAGE_9_BOOL_ENA.VALUE=1 DRIVER.CAN.VAR.CAN_2_MESSAGE_3_MASK.VALUE=0x000007FF DRIVER.CAN.VAR.CAN_1_MESSAGE_51_ENA.VALUE=0x80000000 DRIVER.CAN.VAR.CAN_1_MESSAGE_43_ENA.VALUE=0x80000000 @@ -5059,9 +5059,9 @@ DRIVER.CAN.VAR.CAN_1_MESSAGE_18_INT_ENA_REF.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_4_MESSAGE_3_BOOL_ENA.VALUE=0 DRIVER.CAN.VAR.CAN_4_TQ.VALUE=100.000 DRIVER.CAN.VAR.CAN_3_MESSAGE_1_MASK.VALUE=0x000007FF -DRIVER.CAN.VAR.CAN_2_MESSAGE_31_ENA.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_23_ENA.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_15_ENA.VALUE=0x00000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_31_ENA.VALUE=0x80000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_23_ENA.VALUE=0x80000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_15_ENA.VALUE=0x80000000 DRIVER.CAN.VAR.CAN_4_PORT_RX_PDR.VALUE=1 DRIVER.CAN.VAR.CAN_4_MESSAGE_41_ID.VALUE=41 DRIVER.CAN.VAR.CAN_4_MESSAGE_33_ID.VALUE=33 @@ -5167,7 +5167,7 @@ DRIVER.CAN.VAR.CAN_3_MESSAGE_55_MASK.VALUE=0x000007FF DRIVER.CAN.VAR.CAN_3_MESSAGE_47_MASK.VALUE=0x000007FF DRIVER.CAN.VAR.CAN_3_MESSAGE_39_MASK.VALUE=0x000007FF DRIVER.CAN.VAR.CAN_3_MESSAGE_1_INT_ENA.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_2_BOOL_ENA.VALUE=0 +DRIVER.CAN.VAR.CAN_2_MESSAGE_2_BOOL_ENA.VALUE=1 DRIVER.CAN.VAR.CAN_1_MESSAGE_60_ENA.VALUE=0x80000000 DRIVER.CAN.VAR.CAN_1_MESSAGE_52_ENA.VALUE=0x80000000 DRIVER.CAN.VAR.CAN_1_MESSAGE_44_ENA.VALUE=0x80000000 @@ -5213,20 +5213,20 @@ DRIVER.CAN.VAR.CAN_1_MESSAGE_28_EOB.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_1_MESSAGE_28_DIR.VALUE=0x20000000 DRIVER.CAN.VAR.CAN_1_MESSAGE_8_INT_ENA_REF.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_1_SHIFT.VALUE=18 -DRIVER.CAN.VAR.CAN_2_MESSAGE_64_BOOL_ENA.VALUE=0 -DRIVER.CAN.VAR.CAN_2_MESSAGE_56_BOOL_ENA.VALUE=0 +DRIVER.CAN.VAR.CAN_2_MESSAGE_64_BOOL_ENA.VALUE=1 +DRIVER.CAN.VAR.CAN_2_MESSAGE_56_BOOL_ENA.VALUE=1 DRIVER.CAN.VAR.CAN_2_MESSAGE_50_MASK.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_48_BOOL_ENA.VALUE=0 +DRIVER.CAN.VAR.CAN_2_MESSAGE_48_BOOL_ENA.VALUE=1 DRIVER.CAN.VAR.CAN_2_MESSAGE_42_MASK.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_40_ENA.VALUE=0x00000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_40_ENA.VALUE=0x80000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_34_MASK.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_32_ENA.VALUE=0x00000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_32_ENA.VALUE=0x80000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_30_INT_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_26_MASK.VALUE=0x000007FF -DRIVER.CAN.VAR.CAN_2_MESSAGE_24_ENA.VALUE=0x00000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_24_ENA.VALUE=0x80000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_22_INT_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_18_MASK.VALUE=0x000007FF -DRIVER.CAN.VAR.CAN_2_MESSAGE_16_ENA.VALUE=0x00000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_16_ENA.VALUE=0x80000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_14_INT_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_9_INT_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_2_BRPE.VALUE=0 @@ -5388,14 +5388,14 @@ DRIVER.CAN.VAR.CAN_1_MESSAGE_29_DIR.VALUE=0x20000000 DRIVER.CAN.VAR.CAN_4_MESSAGE_10_MASK.VALUE=0x000007FF DRIVER.CAN.VAR.CAN_3_MESSAGE_2_MASK.VALUE=0x000007FF DRIVER.CAN.VAR.CAN_3_BAUDRATE.VALUE=1000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_41_BOOL_ENA.VALUE=0 -DRIVER.CAN.VAR.CAN_2_MESSAGE_41_ENA.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_33_BOOL_ENA.VALUE=0 -DRIVER.CAN.VAR.CAN_2_MESSAGE_33_ENA.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_25_BOOL_ENA.VALUE=0 -DRIVER.CAN.VAR.CAN_2_MESSAGE_25_ENA.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_17_BOOL_ENA.VALUE=0 -DRIVER.CAN.VAR.CAN_2_MESSAGE_17_ENA.VALUE=0x00000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_41_BOOL_ENA.VALUE=1 +DRIVER.CAN.VAR.CAN_2_MESSAGE_41_ENA.VALUE=0x80000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_33_BOOL_ENA.VALUE=1 +DRIVER.CAN.VAR.CAN_2_MESSAGE_33_ENA.VALUE=0x80000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_25_BOOL_ENA.VALUE=1 +DRIVER.CAN.VAR.CAN_2_MESSAGE_25_ENA.VALUE=0x80000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_17_BOOL_ENA.VALUE=1 +DRIVER.CAN.VAR.CAN_2_MESSAGE_17_ENA.VALUE=0x80000000 DRIVER.CAN.VAR.CAN_1_MESSAGE_63_INT_ENA.VALUE=0x00000400 DRIVER.CAN.VAR.CAN_1_MESSAGE_55_INT_ENA.VALUE=0x00000400 DRIVER.CAN.VAR.CAN_1_MESSAGE_47_INT_ENA.VALUE=0x00000400 @@ -5556,17 +5556,17 @@ DRIVER.CAN.VAR.CAN_4_MESSAGE_15_INT_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_3_MESSAGE_7_INT_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_3_BRPE.VALUE=0 DRIVER.CAN.VAR.CAN_2_MESSAGE_51_MASK.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_50_ENA.VALUE=0x00000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_50_ENA.VALUE=0x80000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_43_MASK.VALUE=0x000007FF DRIVER.CAN.VAR.CAN_2_MESSAGE_42_ENA.VALUE=0x80000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_35_MASK.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_34_ENA.VALUE=0x00000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_34_ENA.VALUE=0x80000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_27_MASK.VALUE=0x000007FF -DRIVER.CAN.VAR.CAN_2_MESSAGE_26_ENA.VALUE=0x00000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_26_ENA.VALUE=0x80000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_19_MASK.VALUE=0x000007FF -DRIVER.CAN.VAR.CAN_2_MESSAGE_18_ENA.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_10_BOOL_ENA.VALUE=0 -DRIVER.CAN.VAR.CAN_2_MESSAGE_5_BOOL_ENA.VALUE=0 +DRIVER.CAN.VAR.CAN_2_MESSAGE_18_ENA.VALUE=0x80000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_10_BOOL_ENA.VALUE=1 +DRIVER.CAN.VAR.CAN_2_MESSAGE_5_BOOL_ENA.VALUE=1 DRIVER.CAN.VAR.CAN_2_MASK.VALUE=0x000007FF DRIVER.CAN.VAR.CAN_4_MESSAGE_63_ID.VALUE=63 DRIVER.CAN.VAR.CAN_4_MESSAGE_55_ID.VALUE=55 @@ -5607,7 +5607,7 @@ DRIVER.CAN.VAR.CAN_3_MESSAGE_30_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_3_MESSAGE_22_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_3_MESSAGE_14_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_60_INT_ENA.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_59_BOOL_ENA.VALUE=0 +DRIVER.CAN.VAR.CAN_2_MESSAGE_59_BOOL_ENA.VALUE=1 DRIVER.CAN.VAR.CAN_2_MESSAGE_52_INT_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_44_INT_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_36_INT_ENA.VALUE=0x00000000 @@ -5713,11 +5713,11 @@ DRIVER.CAN.VAR.CAN_3_MESSAGE_64_INT_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_3_MESSAGE_56_INT_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_3_MESSAGE_48_INT_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_3_MESSAGE_3_MASK.VALUE=0x000007FF -DRIVER.CAN.VAR.CAN_2_MESSAGE_51_ENA.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_43_ENA.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_35_ENA.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_27_ENA.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_19_ENA.VALUE=0x00000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_51_ENA.VALUE=0x80000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_43_ENA.VALUE=0x80000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_35_ENA.VALUE=0x80000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_27_ENA.VALUE=0x80000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_19_ENA.VALUE=0x80000000 DRIVER.CAN.VAR.CAN_1_MESSAGE_58_BOOL_ENA.VALUE=1 DRIVER.CAN.VAR.CAN_4_PORT_TX_PDR.VALUE=1 DRIVER.CAN.VAR.CAN_4_MESSAGE_57_INT_LEVEL.VALUE=0x00000000 @@ -5758,11 +5758,11 @@ DRIVER.CAN.VAR.CAN_4_MESSAGE_1_MASK.VALUE=0x000007FF DRIVER.CAN.VAR.CAN_3_MESSAGE_31_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_3_MESSAGE_23_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_3_MESSAGE_15_ENA.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_60_BOOL_ENA.VALUE=0 -DRIVER.CAN.VAR.CAN_2_MESSAGE_52_BOOL_ENA.VALUE=0 -DRIVER.CAN.VAR.CAN_2_MESSAGE_44_BOOL_ENA.VALUE=0 -DRIVER.CAN.VAR.CAN_2_MESSAGE_36_BOOL_ENA.VALUE=0 -DRIVER.CAN.VAR.CAN_2_MESSAGE_28_BOOL_ENA.VALUE=0 +DRIVER.CAN.VAR.CAN_2_MESSAGE_60_BOOL_ENA.VALUE=1 +DRIVER.CAN.VAR.CAN_2_MESSAGE_52_BOOL_ENA.VALUE=1 +DRIVER.CAN.VAR.CAN_2_MESSAGE_44_BOOL_ENA.VALUE=1 +DRIVER.CAN.VAR.CAN_2_MESSAGE_36_BOOL_ENA.VALUE=1 +DRIVER.CAN.VAR.CAN_2_MESSAGE_28_BOOL_ENA.VALUE=1 DRIVER.CAN.VAR.CAN_2_MESSAGE_1_INT_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_1_MESSAGE_7_ENA.VALUE=0x80000000 DRIVER.CAN.VAR.CAN_4_MESSAGE_6_ID.VALUE=6 @@ -5871,15 +5871,15 @@ DRIVER.CAN.VAR.CAN_4_MESSAGE_5_INT_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_4_BRPE.VALUE=0 DRIVER.CAN.VAR.CAN_3_MESSAGE_10_INT_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_3_MASK.VALUE=0x1FFFFFFF -DRIVER.CAN.VAR.CAN_2_MESSAGE_60_ENA.VALUE=0x00000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_60_ENA.VALUE=0x80000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_60_MASK.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_52_ENA.VALUE=0x00000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_52_ENA.VALUE=0x80000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_52_MASK.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_44_ENA.VALUE=0x00000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_44_ENA.VALUE=0x80000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_44_MASK.VALUE=0x000007FF -DRIVER.CAN.VAR.CAN_2_MESSAGE_36_ENA.VALUE=0x00000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_36_ENA.VALUE=0x80000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_36_MASK.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_28_ENA.VALUE=0x00000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_28_ENA.VALUE=0x80000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_28_MASK.VALUE=0x000007FF DRIVER.CAN.VAR.CAN_1_MESSAGE_51_BOOL_ENA.VALUE=1 DRIVER.CAN.VAR.CAN_1_MESSAGE_43_BOOL_ENA.VALUE=1 @@ -5926,9 +5926,9 @@ DRIVER.CAN.VAR.CAN_3_MESSAGE_40_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_3_MESSAGE_32_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_3_MESSAGE_24_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_3_MESSAGE_16_ENA.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_21_BOOL_ENA.VALUE=0 -DRIVER.CAN.VAR.CAN_2_MESSAGE_13_BOOL_ENA.VALUE=0 -DRIVER.CAN.VAR.CAN_2_MESSAGE_8_BOOL_ENA.VALUE=0 +DRIVER.CAN.VAR.CAN_2_MESSAGE_21_BOOL_ENA.VALUE=1 +DRIVER.CAN.VAR.CAN_2_MESSAGE_13_BOOL_ENA.VALUE=1 +DRIVER.CAN.VAR.CAN_2_MESSAGE_8_BOOL_ENA.VALUE=1 DRIVER.CAN.VAR.CAN_1_MESSAGE_31_INT_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_1_MESSAGE_31_MASK.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_1_MESSAGE_23_INT_ENA.VALUE=0x00000000 @@ -6052,14 +6052,14 @@ DRIVER.CAN.VAR.CAN_4_MESSAGE_20_MASK.VALUE=0x000007FF DRIVER.CAN.VAR.CAN_4_MESSAGE_18_BOOL_ENA.VALUE=0 DRIVER.CAN.VAR.CAN_4_MESSAGE_12_MASK.VALUE=0x000007FF DRIVER.CAN.VAR.CAN_3_MESSAGE_4_MASK.VALUE=0x000007FF -DRIVER.CAN.VAR.CAN_2_MESSAGE_61_ENA.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_53_ENA.VALUE=0x00000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_61_ENA.VALUE=0x80000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_53_ENA.VALUE=0x80000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_51_INT_ENA.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_45_ENA.VALUE=0x00000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_45_ENA.VALUE=0x80000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_43_INT_ENA.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_37_ENA.VALUE=0x00000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_37_ENA.VALUE=0x80000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_35_INT_ENA.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_29_ENA.VALUE=0x00000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_29_ENA.VALUE=0x80000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_27_INT_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_19_INT_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_1_MESSAGE_20_BOOL_ENA.VALUE=1 @@ -6103,7 +6103,7 @@ DRIVER.CAN.VAR.CAN_3_MESSAGE_41_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_3_MESSAGE_33_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_3_MESSAGE_25_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_3_MESSAGE_17_ENA.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_1_BOOL_ENA.VALUE=0 +DRIVER.CAN.VAR.CAN_2_MESSAGE_1_BOOL_ENA.VALUE=1 DRIVER.CAN.VAR.CAN_1_MESSAGE_9_ENA.VALUE=0x80000000 DRIVER.CAN.VAR.CAN_4_MESSAGE_7_RTR.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_4_MESSAGE_3_INT_LEVEL.VALUE=0x00000000 @@ -6139,10 +6139,10 @@ DRIVER.CAN.VAR.CAN_1_MESSAGE_9_DIR.VALUE=0x20000000 DRIVER.CAN.VAR.CAN_4_MESSAGE_21_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_4_MESSAGE_13_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_3_MESSAGE_5_ENA.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_63_BOOL_ENA.VALUE=0 -DRIVER.CAN.VAR.CAN_2_MESSAGE_55_BOOL_ENA.VALUE=0 -DRIVER.CAN.VAR.CAN_2_MESSAGE_47_BOOL_ENA.VALUE=0 -DRIVER.CAN.VAR.CAN_2_MESSAGE_39_BOOL_ENA.VALUE=0 +DRIVER.CAN.VAR.CAN_2_MESSAGE_63_BOOL_ENA.VALUE=1 +DRIVER.CAN.VAR.CAN_2_MESSAGE_55_BOOL_ENA.VALUE=1 +DRIVER.CAN.VAR.CAN_2_MESSAGE_47_BOOL_ENA.VALUE=1 +DRIVER.CAN.VAR.CAN_2_MESSAGE_39_BOOL_ENA.VALUE=1 DRIVER.CAN.VAR.CAN_2_MESSAGE_20_INT_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_12_INT_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_7_INT_ENA.VALUE=0x00000000 @@ -6207,13 +6207,13 @@ DRIVER.CAN.VAR.CAN_1_AUTO_RETRANSMISSION.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_4_MESSAGE_11_BOOL_ENA.VALUE=0 DRIVER.CAN.VAR.CAN_4_MASK.VALUE=0x1FFFFFFF DRIVER.CAN.VAR.CAN_3_MESSAGE_3_BOOL_ENA.VALUE=0 -DRIVER.CAN.VAR.CAN_2_MESSAGE_62_ENA.VALUE=0x00000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_62_ENA.VALUE=0x80000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_61_MASK.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_54_ENA.VALUE=0x00000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_54_ENA.VALUE=0x80000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_53_MASK.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_46_ENA.VALUE=0x00000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_46_ENA.VALUE=0x80000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_45_MASK.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_38_ENA.VALUE=0x00000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_38_ENA.VALUE=0x80000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_37_MASK.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_29_MASK.VALUE=0x000007FF DRIVER.CAN.VAR.CAN_2_MESSAGE_63_INT_LEVEL.VALUE=0x00000000 @@ -6312,10 +6312,10 @@ DRIVER.CAN.VAR.CAN_3_MESSAGE_33_MASK.VALUE=0x000007FF DRIVER.CAN.VAR.CAN_3_MESSAGE_25_MASK.VALUE=0x000007FF DRIVER.CAN.VAR.CAN_3_MESSAGE_17_MASK.VALUE=0x000007FF DRIVER.CAN.VAR.CAN_3_MESSAGE_6_ENA.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_40_BOOL_ENA.VALUE=0 -DRIVER.CAN.VAR.CAN_2_MESSAGE_32_BOOL_ENA.VALUE=0 -DRIVER.CAN.VAR.CAN_2_MESSAGE_24_BOOL_ENA.VALUE=0 -DRIVER.CAN.VAR.CAN_2_MESSAGE_16_BOOL_ENA.VALUE=0 +DRIVER.CAN.VAR.CAN_2_MESSAGE_40_BOOL_ENA.VALUE=1 +DRIVER.CAN.VAR.CAN_2_MESSAGE_32_BOOL_ENA.VALUE=1 +DRIVER.CAN.VAR.CAN_2_MESSAGE_24_BOOL_ENA.VALUE=1 +DRIVER.CAN.VAR.CAN_2_MESSAGE_16_BOOL_ENA.VALUE=1 DRIVER.CAN.VAR.CAN_2_BAUDRATE.VALUE=500 DRIVER.CAN.VAR.CAN_1_MESSAGE_61_INT_ENA.VALUE=0x00000400 DRIVER.CAN.VAR.CAN_1_MESSAGE_53_INT_ENA.VALUE=0x00000400 @@ -6395,10 +6395,10 @@ DRIVER.CAN.VAR.CAN_4_MESSAGE_13_MASK.VALUE=0x000007FF DRIVER.CAN.VAR.CAN_3_MESSAGE_59_BOOL_ENA.VALUE=0 DRIVER.CAN.VAR.CAN_3_MESSAGE_5_MASK.VALUE=0x000007FF DRIVER.CAN.VAR.CAN_3_PIN_MODE.VALUE=1 -DRIVER.CAN.VAR.CAN_2_MESSAGE_63_ENA.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_55_ENA.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_47_ENA.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_39_ENA.VALUE=0x00000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_63_ENA.VALUE=0x80000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_55_ENA.VALUE=0x80000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_47_ENA.VALUE=0x80000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_39_ENA.VALUE=0x80000000 DRIVER.CAN.VAR.CAN_1_MESSAGE_30_INT_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_1_MESSAGE_22_INT_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_1_MESSAGE_14_INT_ENA.VALUE=0x00000000 @@ -6478,7 +6478,7 @@ DRIVER.CAN.VAR.CAN_4_MESSAGE_15_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_4_MESSAGE_13_INT_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_3_MESSAGE_7_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_3_MESSAGE_5_INT_ENA.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_4_BOOL_ENA.VALUE=0 +DRIVER.CAN.VAR.CAN_2_MESSAGE_4_BOOL_ENA.VALUE=1 DRIVER.CAN.VAR.CAN_1_MESSAGE_58_MASK.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_4_PORT_RX_DOUT.VALUE=0 DRIVER.CAN.VAR.CAN_4_MESSAGE_10_RTR.VALUE=0x00000000 @@ -6504,7 +6504,7 @@ DRIVER.CAN.VAR.CAN_3_MESSAGE_7_EOB.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_3_MESSAGE_7_DIR.VALUE=0x20000000 DRIVER.CAN.VAR.CAN_3_MESSAGE_4_INT_ENA_REF.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_3_MESSAGE_59_MASK.VALUE=0x000007FF -DRIVER.CAN.VAR.CAN_2_MESSAGE_58_BOOL_ENA.VALUE=0 +DRIVER.CAN.VAR.CAN_2_MESSAGE_58_BOOL_ENA.VALUE=1 DRIVER.CAN.VAR.CAN_2_MESSAGE_50_INT_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_42_INT_ENA.VALUE=0x00000400 DRIVER.CAN.VAR.CAN_2_MESSAGE_34_INT_ENA.VALUE=0x00000000 @@ -6540,11 +6540,11 @@ DRIVER.CAN.VAR.CAN_3_MESSAGE_52_BOOL_ENA.VALUE=0 DRIVER.CAN.VAR.CAN_3_MESSAGE_44_BOOL_ENA.VALUE=0 DRIVER.CAN.VAR.CAN_3_MESSAGE_36_BOOL_ENA.VALUE=0 DRIVER.CAN.VAR.CAN_3_MESSAGE_28_BOOL_ENA.VALUE=0 -DRIVER.CAN.VAR.CAN_2_MESSAGE_64_ENA.VALUE=0x00000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_64_ENA.VALUE=0x80000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_62_MASK.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_56_ENA.VALUE=0x00000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_56_ENA.VALUE=0x80000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_54_MASK.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_48_ENA.VALUE=0x00000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_48_ENA.VALUE=0x80000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_46_MASK.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_38_MASK.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_51_RTR.VALUE=0x00000000 @@ -6660,15 +6660,15 @@ DRIVER.CAN.VAR.CAN_3_MESSAGE_8_DIR.VALUE=0x20000000 DRIVER.CAN.VAR.CAN_1_MESSAGE_10_EOB.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_1_MESSAGE_10_DIR.VALUE=0x20000000 DRIVER.CAN.VAR.CAN_1_SAMPLE_POINT.VALUE=62.500 -DRIVER.CAN.VAR.CAN_2_MESSAGE_51_BOOL_ENA.VALUE=0 -DRIVER.CAN.VAR.CAN_2_MESSAGE_43_BOOL_ENA.VALUE=0 -DRIVER.CAN.VAR.CAN_2_MESSAGE_35_BOOL_ENA.VALUE=0 -DRIVER.CAN.VAR.CAN_2_MESSAGE_27_BOOL_ENA.VALUE=0 +DRIVER.CAN.VAR.CAN_2_MESSAGE_51_BOOL_ENA.VALUE=1 +DRIVER.CAN.VAR.CAN_2_MESSAGE_43_BOOL_ENA.VALUE=1 +DRIVER.CAN.VAR.CAN_2_MESSAGE_35_BOOL_ENA.VALUE=1 +DRIVER.CAN.VAR.CAN_2_MESSAGE_27_BOOL_ENA.VALUE=1 DRIVER.CAN.VAR.CAN_2_MESSAGE_21_MASK.VALUE=0x000007FF -DRIVER.CAN.VAR.CAN_2_MESSAGE_19_BOOL_ENA.VALUE=0 +DRIVER.CAN.VAR.CAN_2_MESSAGE_19_BOOL_ENA.VALUE=1 DRIVER.CAN.VAR.CAN_2_MESSAGE_13_MASK.VALUE=0x000007FF DRIVER.CAN.VAR.CAN_2_MESSAGE_8_MASK.VALUE=0x000007FF -DRIVER.CAN.VAR.CAN_2_MESSAGE_1_ENA.VALUE=0x00000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_1_ENA.VALUE=0x80000000 DRIVER.CAN.VAR.CAN_1_MESSAGE_59_INT_ENA.VALUE=0x00000400 DRIVER.CAN.VAR.CAN_3_MESSAGE_62_ID.VALUE=62 DRIVER.CAN.VAR.CAN_3_MESSAGE_54_ID.VALUE=54 @@ -6696,8 +6696,8 @@ DRIVER.CAN.VAR.CAN_3_MESSAGE_21_BOOL_ENA.VALUE=0 DRIVER.CAN.VAR.CAN_3_MESSAGE_15_INT_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_3_MESSAGE_13_BOOL_ENA.VALUE=0 DRIVER.CAN.VAR.CAN_3_MESSAGE_6_MASK.VALUE=0x000007FF -DRIVER.CAN.VAR.CAN_2_MESSAGE_57_ENA.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_49_ENA.VALUE=0x00000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_57_ENA.VALUE=0x80000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_49_ENA.VALUE=0x80000000 DRIVER.CAN.VAR.CAN_1_MESSAGE_7_INT_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_1_MESSAGE_5_BOOL_ENA.VALUE=1 DRIVER.CAN.VAR.CAN_3_MESSAGE_59_INT_LEVEL.VALUE=0x00000000 @@ -6811,10 +6811,10 @@ DRIVER.CAN.VAR.CAN_4_MESSAGE_43_INT_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_4_MESSAGE_35_INT_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_4_MESSAGE_27_INT_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_4_MESSAGE_19_INT_ENA.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_20_BOOL_ENA.VALUE=0 -DRIVER.CAN.VAR.CAN_2_MESSAGE_12_BOOL_ENA.VALUE=0 -DRIVER.CAN.VAR.CAN_2_MESSAGE_7_BOOL_ENA.VALUE=0 -DRIVER.CAN.VAR.CAN_2_MESSAGE_2_ENA.VALUE=0x00000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_20_BOOL_ENA.VALUE=1 +DRIVER.CAN.VAR.CAN_2_MESSAGE_12_BOOL_ENA.VALUE=1 +DRIVER.CAN.VAR.CAN_2_MESSAGE_7_BOOL_ENA.VALUE=1 +DRIVER.CAN.VAR.CAN_2_MESSAGE_2_ENA.VALUE=0x80000000 DRIVER.CAN.VAR.CAN_1_MESSAGE_21_INT_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_1_MESSAGE_13_INT_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_4_MESSAGE_6_INT_LEVEL.VALUE=0x00000000 @@ -6840,7 +6840,7 @@ DRIVER.CAN.VAR.CAN_2_MESSAGE_2_DIR.VALUE=0x20000000 DRIVER.CAN.VAR.CAN_4_MESSAGE_1_BOOL_ENA.VALUE=0 DRIVER.CAN.VAR.CAN_2_MESSAGE_64_INT_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_63_MASK.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_58_ENA.VALUE=0x00000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_58_ENA.VALUE=0x80000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_56_INT_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_55_MASK.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_48_INT_ENA.VALUE=0x00000000 @@ -6955,7 +6955,7 @@ DRIVER.CAN.VAR.CAN_2_MESSAGE_30_MASK.VALUE=0x000007FF DRIVER.CAN.VAR.CAN_2_MESSAGE_22_MASK.VALUE=0x000007FF DRIVER.CAN.VAR.CAN_2_MESSAGE_14_MASK.VALUE=0x000007FF DRIVER.CAN.VAR.CAN_2_MESSAGE_9_MASK.VALUE=0x000007FF -DRIVER.CAN.VAR.CAN_2_MESSAGE_3_ENA.VALUE=0x00000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_3_ENA.VALUE=0x80000000 DRIVER.CAN.VAR.CAN_4_MESSAGE_58_INT_LEVEL.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_3_MESSAGE_58_ID.VALUE=58 DRIVER.CAN.VAR.CAN_1_MESSAGE_60_INT_LEVEL.VALUE=0x00000000 @@ -6978,11 +6978,11 @@ DRIVER.CAN.VAR.CAN_4_MESSAGE_31_MASK.VALUE=0x000007FF DRIVER.CAN.VAR.CAN_4_MESSAGE_23_MASK.VALUE=0x000007FF DRIVER.CAN.VAR.CAN_4_MESSAGE_15_MASK.VALUE=0x000007FF DRIVER.CAN.VAR.CAN_3_MESSAGE_7_MASK.VALUE=0x000007FF -DRIVER.CAN.VAR.CAN_2_MESSAGE_62_BOOL_ENA.VALUE=0 -DRIVER.CAN.VAR.CAN_2_MESSAGE_59_ENA.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_2_MESSAGE_54_BOOL_ENA.VALUE=0 -DRIVER.CAN.VAR.CAN_2_MESSAGE_46_BOOL_ENA.VALUE=0 -DRIVER.CAN.VAR.CAN_2_MESSAGE_38_BOOL_ENA.VALUE=0 +DRIVER.CAN.VAR.CAN_2_MESSAGE_62_BOOL_ENA.VALUE=1 +DRIVER.CAN.VAR.CAN_2_MESSAGE_59_ENA.VALUE=0x80000000 +DRIVER.CAN.VAR.CAN_2_MESSAGE_54_BOOL_ENA.VALUE=1 +DRIVER.CAN.VAR.CAN_2_MESSAGE_46_BOOL_ENA.VALUE=1 +DRIVER.CAN.VAR.CAN_2_MESSAGE_38_BOOL_ENA.VALUE=1 DRIVER.CAN.VAR.CAN_2_MESSAGE_10_INT_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_5_INT_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_3_PORT_TX_PSL.VALUE=1 diff --git a/conf/tpl/c.c b/conf/tpl/c.c index 6e091f15..9fec40f7 100644 --- a/conf/tpl/c.c +++ b/conf/tpl/c.c @@ -43,8 +43,8 @@ * @file c.c * @author foxBMS Team * @date 2019-08-27 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup SOME_GROUP * @prefix ABC * diff --git a/conf/tpl/c.h b/conf/tpl/c.h index 64d7e9e5..3e82c49f 100644 --- a/conf/tpl/c.h +++ b/conf/tpl/c.h @@ -43,8 +43,8 @@ * @file c.h * @author foxBMS Team * @date 2019-08-27 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup SOME_GROUP * @prefix ABC * diff --git a/conf/tpl/test_c.c b/conf/tpl/test_c.c index 49e11c80..76c0a48c 100644 --- a/conf/tpl/test_c.c +++ b/conf/tpl/test_c.c @@ -43,8 +43,8 @@ * @file test_c.c * @author foxBMS Team * @date 2020-08-10 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/conf/tpl/test_c.h b/conf/tpl/test_c.h index b0b10447..a46ce62d 100644 --- a/conf/tpl/test_c.h +++ b/conf/tpl/test_c.h @@ -43,8 +43,8 @@ * @file test_c.h * @author foxBMS Team * @date 2020-08-10 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/conf/unit/project.yml b/conf/unit/project.yml index f1f25ecc..be998dd8 100644 --- a/conf/unit/project.yml +++ b/conf/unit/project.yml @@ -76,7 +76,7 @@ :defines: :common: &common_defines - UNITY_UNIT_TEST - - ASSERT_LEVEL=2 + - FAS_ASSERT_LEVEL=2 - UNITY_INCLUDE_EXEC_TIME - FOXBMS_USES_FREERTOS=1 :test: @@ -147,6 +147,7 @@ :uncovered_ignore_list: - "../../src/app/driver/imd/bender/ir155/bender_ir155.c" - "../../src/app/driver/imd/bender/iso165c/bender_iso165c.c" + - "../../src/app/driver/afe/nxp/mc33775a/vendor/uc_msg_t.c" - "../../src/app/driver/sbc/fs8x_driver/sbc_fs8x.c" - "../../src/app/driver/sbc/fs8x_driver/sbc_fs8x_communication.c" - "../../src/app/main/main.c" diff --git a/docs/_static/css/theme_overrides.css b/docs/_static/css/theme_overrides.css index e064c279..0f2bdf5c 100644 --- a/docs/_static/css/theme_overrides.css +++ b/docs/_static/css/theme_overrides.css @@ -9,3 +9,7 @@ max-width: 100%; overflow: visible; } + +.wy-nav-content { + max-width: 1200px; +} diff --git a/docs/developer-manual/style-guide/examples/c-004.c b/docs/developer-manual/style-guide/examples/c-004.c index a6a99ea1..5839d27e 100644 --- a/docs/developer-manual/style-guide/examples/c-004.c +++ b/docs/developer-manual/style-guide/examples/c-004.c @@ -43,8 +43,8 @@ * @file c-004.c * @author foxBMS Team * @date 2021-04-06 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup SOME_GROUP * @prefix ABC * diff --git a/docs/developer-manual/style-guide/guidelines_rst.rst b/docs/developer-manual/style-guide/guidelines_rst.rst index 5f432252..d1c194d7 100644 --- a/docs/developer-manual/style-guide/guidelines_rst.rst +++ b/docs/developer-manual/style-guide/guidelines_rst.rst @@ -97,8 +97,8 @@ Headings (``RST:005``) ---------------------- We follow the convention of the Python Developer's Guide for -`Documenting Python `_. Use -the following rules to create headings: +`reStructuredText Markup `_. +Use the following rules to create headings: - # with overline, for parts - \* with overline, for chapters diff --git a/docs/developer-manual/style-guide/state-machine-example/state-machine.c b/docs/developer-manual/style-guide/state-machine-example/state-machine.c index b2ae41f3..056f7c1a 100644 --- a/docs/developer-manual/style-guide/state-machine-example/state-machine.c +++ b/docs/developer-manual/style-guide/state-machine-example/state-machine.c @@ -43,8 +43,8 @@ * @file state-machine.c * @author foxBMS Team * @date 2020-10-29 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup STATE_MACHINE * @prefix EG * @@ -57,19 +57,19 @@ /*========== Macros and Definitions =========================================*/ /** - * statemachine short time definition in #EG_Trigger calls until next state is + * state machine short time definition in #EG_Trigger calls until next state is * processed */ #define EG_FSM_SHORT_TIME (1u) /** - * statemachine medium time definition in #EG_Trigger calls until next + * state machine medium time definition in #EG_Trigger calls until next * state/substate is processed */ #define EG_FSM_MEDIUM_TIME (5u) /** - * statemachine long time definition in #EG_Trigger calls until next + * state machine long time definition in #EG_Trigger calls until next * state/substate is processed */ #define EG_FSM_LONG_TIME (10u) diff --git a/docs/developer-manual/style-guide/state-machine-example/state-machine.h b/docs/developer-manual/style-guide/state-machine-example/state-machine.h index e0e7efef..ce600ace 100644 --- a/docs/developer-manual/style-guide/state-machine-example/state-machine.h +++ b/docs/developer-manual/style-guide/state-machine-example/state-machine.h @@ -43,8 +43,8 @@ * @file state-machine.h * @author foxBMS Team * @date 2020-10-29 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup STATE_MACHINE * @prefix EG * diff --git a/docs/general/changelog.rst b/docs/general/changelog.rst index ab923977..de6ac588 100644 --- a/docs/general/changelog.rst +++ b/docs/general/changelog.rst @@ -41,6 +41,88 @@ Versioning follows then these rules: - increasing ``MINOR`` adds functionality in a backwards compatible manner - increasing ``PATCH`` fixes bugs in a backwards compatible manner +******************** +[1.4.0] - 2022-07-29 +******************** + +Added +===== + +- |foxbms| has been certified as open source hardware by the + Open Source Hardware Association under the + OSHWA UID `DE000128 `_. + This information has been added to the README and license documentation + (see :ref:`OPEN_SOURCE_HARDWARE_CERTIFICATION`). +- Added Axivion configuration (see ``tests/axivion/addon``) to check for + + - source files to be decodable with a specific encoding + - POSIX 3.206 + - filename uniqueness in the build process + - file level doxygen comment + - doxygen comments for extern and static variables, and typedefs + - the |foxbms| license header + - literal suffixes for numerical assignments +- Added test cases for the Axivion rules (see ``tests/axivion/addon-test``) +- The foxBMS GUI wrapper is now implemented as a module. +- Added a driver for the NXP MC33775A monitoring IC. The driver measures + cell voltages, cell temperatures via an I2C multiplexer and controls + cell balancing. + +Changed +======= + +- Updated the hardware design files (e.g., schematics, layout, BOM and STEP + file etc.) of the |bms-master| to ``v1.1.3`` (see + :ref:`CHANGELOG_FOR_MASTER_TMS570_V1_1_3`). +- Function names are now checked by Axivion to conform to the guidelines. +- Use correct prefix in the + + - ``version`` module (:ref:`VERSION_MODULE`) + - ``assert`` module (:ref:`FASSERT_MODULE`) +- The behavior of the ``build_bin`` command, which creates the binary, has been + improved. + If the BMS configuration file (``conf/bms/bms.json``) has been changed, the + project needs to be reconfigured (by running ``waf configure``, see + :ref:`BUILDING_THE_APPLICATION`). +- The following settings in BMS configuration file (``conf/bms/bms.json``) have + been changed: + + - The AFE key for the IC has been renamed from ``chip`` to ``ic`` in the + ``slave-unit/analog-front-end`` section. + - The balancing strategy has been moved into the ``application`` section. + - The operating system key has been renamed from ``operating-system`` to + ``rtos``. + - The SOF needs to be configured in the + ``application/algorithm/state-estimation`` section. + Currently ``"sof": "trapezoid"`` is the only valid option. + +- Several variables and functions have been renamed to conform to the |foxbms| + style guide (:ref:`STYLE_GUIDE`). + There will be additional changes in future releases as the task of having + a fully style guide conforming repository is an iterative and timely process. + +Deprecated +========== + +Removed +======= + +Fixed +===== + +- The macro ``SOC_STRING_CAPACITY_As`` was incorrectly braced, as it had less + closing than opening braces + (``src/app/application/algorithm/state_estimation/soc/counting/soc_counting_cfg.h``). + This however did not reveal as bug, as the calling function fixed the + incorrect bracing by adding the missing brace correctly + (``src/app/application/algorithm/state_estimation/soc/counting/soc_counting.c``). +- The delay between chip select activation and start of SPI transmission and the + delay between end of SPI transmission and chip select deactivation have been + increased to avoid SPI transmission errors for AFEs. +- The CAN2 message boxes were not activated within the HALCoGen configuration. +- Fix several unit testing warnings due to a misconfiguration with respect to + ``BS_NR_OF_STRINGS``. + ******************** [1.3.0] - 2022-05-30 ******************** @@ -311,7 +393,7 @@ Changed - Sort the SPI formats so that there are no conflicts between the configuration on SPI1 and SPI4 (Both are connected to the interface connector). - Control the pins of the interface for LTC AFEs with the port expander on the - foxBMS 2 master board. + |foxbms| master board. - The documentation build defaults now only to ``html`` and ``spelling``, .i.e., ``linkcheck`` has been removed. - Increased stack size of 10ms task to 5120 bytes (from 4096). @@ -610,7 +692,7 @@ Added - Added testing for different versions of TI CSS (versions 10.0.0 and 10.1.1). - Added a readme to the hardware directory. - Added support for LTC 6804-1 (basically an older version of the LTC 6811-1). -- Added the updated design files of the foxBMS 2 master v1.0.1. +- Added the updated design files of the |foxbms| master v1.0.1. Changed ======= @@ -842,9 +924,9 @@ Added - Added more files to the unit test coverage analysis in order to have a more complete image of the project and its unit test coverage. - The conda environment configuration that is distributed within the - has now an option to validate that it is working as intended. The conda - environment can be tested by running - ``tools\utils\cmd\run-python-script.bat tests\env\packages_test.py -f tests\env\conda_env_win32.json`` + has now an option to validate that it is working as intended. + The conda environment can be tested by running + ``tools/utils/cmd/run-python-script.bat tests/env/packages_test.py -f tests/env/conda_env_win32.json`` from the repository root. Changed diff --git a/docs/general/license.rst b/docs/general/license.rst index 9bb6373c..82f11127 100644 --- a/docs/general/license.rst +++ b/docs/general/license.rst @@ -42,7 +42,7 @@ The license texts are included verbatim in this documentation. |foxbms| Software License ========================= -- foxBMS 2 software is licensed under the BSD 3-Clause License. +- |foxbms| software is licensed under the BSD 3-Clause License. - The SPDX short identifier is `BSD-3-Clause `_. @@ -52,7 +52,7 @@ The license text is included in this documentation at |foxbms| Hardware and Documentation License =========================================== -- foxBMS 2 hardware and documentation is licensed under the +- |foxbms| documentation is licensed under the Creative Commons Attribution 4.0 International License. The license can be obtained from https://creativecommons.org/licenses/by/4.0/. @@ -62,6 +62,15 @@ The license text is included in this documentation at The license text is included in this documentation at :ref:`CREATIVE_COMMONS_ATTRIBUTION_4_0_INTERNATIONAL_LICENSE`. +.. _OPEN_SOURCE_HARDWARE_CERTIFICATION: + +Open Source Hardware Certification +================================== + +|foxbms| has been certified as open source hardware by the +Open Source Hardware Association under the OSHWA UID +`DE000128 `_. + Further Information =================== diff --git a/docs/general/releases.csv b/docs/general/releases.csv index c4fc8cb4..83fc290f 100644 --- a/docs/general/releases.csv +++ b/docs/general/releases.csv @@ -1,4 +1,5 @@ foxBMS 2; Release Date; Permanent link to documentation +v1.4.0; 2022-07-29; https://iisb-foxbms.iisb.fraunhofer.de/foxbms/gen2/docs/html/v1.4.0/ v1.3.0; 2022-05-30; https://iisb-foxbms.iisb.fraunhofer.de/foxbms/gen2/docs/html/v1.3.0/ v1.2.1; 2021-12-08; https://iisb-foxbms.iisb.fraunhofer.de/foxbms/gen2/docs/html/v1.2.1/ v1.2.0; 2021-10-21; https://iisb-foxbms.iisb.fraunhofer.de/foxbms/gen2/docs/html/v1.2.0/ diff --git a/docs/getting-started/repository-structure.rst b/docs/getting-started/repository-structure.rst index 5fdf892a..ac2c861d 100644 --- a/docs/getting-started/repository-structure.rst +++ b/docs/getting-started/repository-structure.rst @@ -119,10 +119,10 @@ The ``src`` directory is structured into the following parts (see | | Layer | | +-----------------+-----------------------------+--------------------------------------+ | ``src/opt`` | Optional | optional source files (e.g., | - | | | specific cell parameters | + | | | specific cell parameters) | +-----------------+-----------------------------+--------------------------------------+ - | ``src/os`` | Operating System | source files of the Operating | - | | | System | + | ``src/os`` | Operating System | source files of the real time | + | | | operating system | +-----------------+-----------------------------+--------------------------------------+ Tests directory ``tests`` diff --git a/docs/getting-started/software-installation.rst b/docs/getting-started/software-installation.rst index 92e22251..b26e383b 100644 --- a/docs/getting-started/software-installation.rst +++ b/docs/getting-started/software-installation.rst @@ -57,7 +57,7 @@ later steps of this manual. If your user name contains whitespace (e.g., ``vulpes vulpes``, you **MUST** clone or download the repository to another path, that does not contain - whitespace, e.g., ``C:\foxbms-2``. + whitespace, e.g., ``C:\foxbms-2``). .. code-block:: console :caption: Cloning the |foxbms| repository @@ -70,9 +70,9 @@ later steps of this manual. :caption: Downloading a release :name: download-foxbms-2 - C:\Users\vulpes\Documents>curl -Ss -L -o foxbms-2-v1.3.0.zip https://github.com/foxBMS/foxbms-2/archive/v1.3.0.zip - C:\Users\vulpes\Documents>tar -x -f foxbms-2-v1.3.0.zip - C:\Users\vulpes\Documents>ren foxbms-2-1.3.0 foxbms-2 + C:\Users\vulpes\Documents>curl -Ss -L -o foxbms-2-v1.4.0.zip https://github.com/foxBMS/foxbms-2/archive/v1.4.0.zip + C:\Users\vulpes\Documents>tar -x -f foxbms-2-v1.4.0.zip + C:\Users\vulpes\Documents>ren foxbms-2-1.4.0 foxbms-2 C:\Users\vulpes\Documents>cd foxbms-2 .. note:: diff --git a/docs/hardware/master.rst b/docs/hardware/master.rst index d418b039..41621598 100644 --- a/docs/hardware/master.rst +++ b/docs/hardware/master.rst @@ -8,7 +8,17 @@ Master Overview **TMS570LC4357-based Master** +The changelog for the TMS570LC4357-based Master is can be found at + +.. toctree:: + :maxdepth: 1 + + ./master/ti-tms570lc4357-vx.x.x/ti-tms570lc4357-changelog.rst + +The documentation for the different versions can be found at. + .. toctree:: :maxdepth: 1 ./master/ti-tms570lc4357-vx.x.x/ti-tms570lc4357-v1.1.1.rst + ./master/ti-tms570lc4357-vx.x.x/ti-tms570lc4357-v1.1.3.rst diff --git a/docs/hardware/master/ti-tms570lc4357-vx.x.x/ti-tms570lc4357-changelog.rst b/docs/hardware/master/ti-tms570lc4357-vx.x.x/ti-tms570lc4357-changelog.rst new file mode 100644 index 00000000..fe608b52 --- /dev/null +++ b/docs/hardware/master/ti-tms570lc4357-vx.x.x/ti-tms570lc4357-changelog.rst @@ -0,0 +1,102 @@ +.. include:: ./../../../macros.txt +.. include:: ./../../../units.txt + +.. _CHANGELOG_FOR_MASTER_TMS570: + +Changelog for Master TMS570 +=========================== + +.. _CHANGELOG_FOR_MASTER_TMS570_V1_1_3: + +v1.1.3 +------ + +- fixed swapped INTA/INTB pinout of U6400 (PCF2131TF) +- added OSHWA logo on PCB +- modified power MOSFET and according control circuitry (Q4400-Q4402) for + switching external insulation monitor (current rating of previous design was + too weak) + +.. _CHANGELOG_FOR_MASTER_TMS570_V1_1_2: + +v1.1.2 +------ + +- fixed assignment of memory devices (MRAM, FRAM, FLASH) to SPI3 chip select + pins (net labels were swapped) +- split oscillator (Y6100) into two different part numbers and BOM items (one + part for 20 MHz and 25 MHz) +- added voltage limiting Zener diodes to gates of Q6401 and Q6404 +- added 100 |nF| capacitor to "ON" pin of U7300 in order to improve transient + immunity +- fixed faulty solder paste layer on component U7100 +- replaced Ethernet socket J2001 due to availability issues (old part number: + Wuerth 615008185121, new part number: Wuerth 615008137421) + + +.. _CHANGELOG_FOR_MASTER_TMS570_V1_1_1: + +v1.1.1 +------ + +- added clamping diodes for contactor feedback resistor dividers in order to + protect inputs of port expander +- added clamping diodes to insulation monitor PWM and OK inputs +- adjusted contactor connectors pinout to match foxBMS 1 Master pinout +- replaced R8014 and R8017 10k resistors with 10R resistors due to amplifier + gain error +- added placement option to use ADUM6401 as a digital isolator for the CAN2 + interface +- fixed a typo in EMIF connector silk screen +- improved free space around debug connector (debug connector was moved towards + upper edge of board) +- changed global polygon connect style to relief connect in order to improve + solderabilty of through-hole connectors +- fixed solder paste areas for Mictor debug connector +- modified all mounting holes to fit Wuerth SMT spacers (outer diameter = 6mm) +- removed interlock high-side switch from default component variant due to + availability issues +- added HW board version coding using IO1_0 to IO1_7 of port-expander1 + +.. _CHANGELOG_FOR_MASTER_TMS570_V1_1_0: + +v1.1.0 +------ + +- replaced CAN transceiver with TCAN1043HDQ1 (SOIC-14 package) due to + availability issues +- added battery holder for CR1225 RTC battery (BR2470 battery is now optional) +- changed value of all I2C pull-up resistors from 5.1 |kOhm| to 2.49 |kOhm| +- removed buck-boost converter IC from "default" component variant due to + availability issues +- removed Ethernet phy IC from "default" component variant due to availability + issues +- finalized PCB layout +- added mechanical dimensions to draftman document + +.. _CHANGELOG_FOR_MASTER_TMS570_V1_0_2: + +v1.0.2 +------ + +- added digital isolator with integrated power for CAN2 interface +- added connectors for interface and extension boards +- added bypass for buck-boost converter +- split board supply into clamp 30 and clamp 30C +- added additional protection circuit for clamp 30C supply input +- removed isolated USB interface +- added test points for interlock circuit + +.. _CHANGELOG_FOR_MASTER_TMS570_V1_0_1: + +v1.0.1 +------ + +- corrected the supply of Vdd of the smart power switch (from 12V to 5V) + +.. _CHANGELOG_FOR_MASTER_TMS570_V1_0_0: + +v1.0.0 +------ + +- initial version diff --git a/docs/hardware/master/ti-tms570lc4357-vx.x.x/ti-tms570lc4357-v1.1.1.rst b/docs/hardware/master/ti-tms570lc4357-vx.x.x/ti-tms570lc4357-v1.1.1.rst index 26152aa3..2db6ae33 100644 --- a/docs/hardware/master/ti-tms570lc4357-vx.x.x/ti-tms570lc4357-v1.1.1.rst +++ b/docs/hardware/master/ti-tms570lc4357-vx.x.x/ti-tms570lc4357-v1.1.1.rst @@ -6,6 +6,11 @@ Master TMS570 ``v1.1.1`` ======================== +.. note:: + + The changelog for this release is found at + :ref:`CHANGELOG_FOR_MASTER_TMS570_V1_1_1`. + The following specifications must be met to ensure a safe and optimal work with the |bms-master| hardware. diff --git a/docs/hardware/master/ti-tms570lc4357-vx.x.x/ti-tms570lc4357-v1.1.3.rst b/docs/hardware/master/ti-tms570lc4357-vx.x.x/ti-tms570lc4357-v1.1.3.rst new file mode 100644 index 00000000..72c12c8b --- /dev/null +++ b/docs/hardware/master/ti-tms570lc4357-vx.x.x/ti-tms570lc4357-v1.1.3.rst @@ -0,0 +1,15 @@ +.. include:: ./../../../macros.txt +.. include:: ./../../../units.txt + +.. _MASTER_TMS570___V1_1_3__: + +Master TMS570 ``v1.1.3`` +======================== + +.. note:: + + The changelog for this release is found at + :ref:`CHANGELOG_FOR_MASTER_TMS570_V1_1_3`. + +There are no changes that need a new documentation compared to v1.1.1, +therefore see :ref:`MASTER_TMS570___V1_1_1__`. diff --git a/docs/macros.txt b/docs/macros.txt index bba669fc..5a3c8494 100644 --- a/docs/macros.txt +++ b/docs/macros.txt @@ -3,7 +3,7 @@ .. |timestamp| date:: %Y-%m-%d %H:%M:%S .. |foxbms| replace:: foxBMS 2 -.. |version_foxbms| replace:: ``1.3.0`` +.. |version_foxbms| replace:: ``1.4.0`` .. |github_foxbms| replace:: https://github.com/foxBMS/ .. |foxbms_repository| replace:: https://github.com/foxBMS/foxbms-2 .. _Fraunhofer IISB: https://www.iisb.fraunhofer.de diff --git a/docs/software/build-process/misc/libproject-example.c b/docs/software/build-process/misc/libproject-example.c index 74aab1ad..f40d197d 100644 --- a/docs/software/build-process/misc/libproject-example.c +++ b/docs/software/build-process/misc/libproject-example.c @@ -43,8 +43,8 @@ * @file libproject-example.c * @author foxBMS Team * @date 2020-10-06 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup USER_LIB * @prefix SUPER * diff --git a/docs/software/build-process/misc/libproject-example.h b/docs/software/build-process/misc/libproject-example.h index 2c44d5a6..fbe81644 100644 --- a/docs/software/build-process/misc/libproject-example.h +++ b/docs/software/build-process/misc/libproject-example.h @@ -43,8 +43,8 @@ * @file libproject-example.h * @author foxBMS Team * @date 2020-10-06 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup USER_LIB * @prefix SUPER * diff --git a/docs/software/configuration/configuration.rst b/docs/software/configuration/configuration.rst index 0ac193c9..8c49b869 100644 --- a/docs/software/configuration/configuration.rst +++ b/docs/software/configuration/configuration.rst @@ -104,8 +104,8 @@ The project provides two basic configuration options: Source Options ^^^^^^^^^^^^^^ -Some BMS configurations require compiling different sources. That applies to -the Operating System and the measurement +Some BMS configurations require compiling different sources. +That applies to the Operating System and the measurement IC. .. note:: diff --git a/docs/software/configuration/without-halcogen/without-halcogen_diff-includes.diff b/docs/software/configuration/without-halcogen/without-halcogen_diff-includes.diff index 8bcc82cf..57a25f57 100644 --- a/docs/software/configuration/without-halcogen/without-halcogen_diff-includes.diff +++ b/docs/software/configuration/without-halcogen/without-halcogen_diff-includes.diff @@ -8,7 +8,7 @@ index c4d837c4..2d1580fa 100644 os.path.join("..", "..", "task", "os"), + os.path.join("..", "..", "..", "hal", "include"), ] - includes.extend(bld.env.INCLUDES_OPERATING_SYSTEM) + includes.extend(bld.env.INCLUDES_RTOS) cflags = bld.env.CFLAGS_FOXBMS diff --git a/src/app/application/wscript b/src/app/application/wscript index a9462e21..1fdb5850 100644 @@ -20,7 +20,7 @@ index a9462e21..1fdb5850 100644 os.path.join("..", "task", "os"), + os.path.join("..", "..", "hal", "include"), ] - includes.extend(bld.env.INCLUDES_OPERATING_SYSTEM + bld.env.INCLUDES_AFE) + includes.extend(bld.env.INCLUDES_RTOS + bld.env.INCLUDES_AFE) cflags = bld.env.CFLAGS_FOXBMS diff --git a/src/app/driver/afe/ltc/6806/wscript b/src/app/driver/afe/ltc/6806/wscript index d7ca3af9..0cc6c777 100644 @@ -32,7 +32,7 @@ index d7ca3af9..0cc6c777 100644 os.path.join("..", "..", "..", "..", "task", "os"), + os.path.join("..", "..", "..", "..", "..", "hal", "include"), ] - includes.extend(bld.env.INCLUDES_OPERATING_SYSTEM) + includes.extend(bld.env.INCLUDES_RTOS) cflags = bld.env.CFLAGS_FOXBMS diff --git a/src/app/driver/wscript b/src/app/driver/wscript index c6b42f89..26369502 100644 @@ -44,7 +44,7 @@ index c6b42f89..26369502 100644 os.path.join("..", "task", "os"), + os.path.join("..", "..", "hal", "include"), ] - includes.extend(bld.env.INCLUDES_OPERATING_SYSTEM + bld.env.INCLUDES_AFE) + includes.extend(bld.env.INCLUDES_RTOS + bld.env.INCLUDES_AFE) cflags = bld.env.CFLAGS_FOXBMS diff --git a/src/app/engine/wscript b/src/app/engine/wscript index 03873567..118c66b6 100644 @@ -56,7 +56,7 @@ index 03873567..118c66b6 100644 os.path.join("..", "task", "config"), + os.path.join("..", "..", "hal", "include"), ] - includes.extend(bld.env.INCLUDES_OPERATING_SYSTEM + bld.env.INCLUDES_AFE) + includes.extend(bld.env.INCLUDES_RTOS + bld.env.INCLUDES_AFE) target = f"{bld.env.APPNAME.lower()}-engine" diff --git a/src/app/main/wscript b/src/app/main/wscript index 1945b079..a47c3e20 100644 @@ -68,7 +68,7 @@ index 1945b079..a47c3e20 100644 os.path.join("..", "task", "config"), + os.path.join("..", "..", "hal", "include"), ] - includes.extend(bld.env.INCLUDES_OPERATING_SYSTEM + bld.env.INCLUDES_AFE) + includes.extend(bld.env.INCLUDES_RTOS + bld.env.INCLUDES_AFE) cflags = bld.env.CFLAGS_FOXBMS diff --git a/src/app/task/wscript b/src/app/task/wscript index d2479891..1b584c01 100644 @@ -80,7 +80,7 @@ index d2479891..1b584c01 100644 os.path.join("..", "main", "include"), + os.path.join("..", "..", "hal", "include"), ] - includes.extend(bld.env.INCLUDES_OPERATING_SYSTEM + bld.env.INCLUDES_AFE) + includes.extend(bld.env.INCLUDES_RTOS + bld.env.INCLUDES_AFE) cflags = bld.env.CFLAGS_FOXBMS diff --git a/src/os/freertos/wscript b/src/os/freertos/wscript index 2d91582e..c32227aa 100644 diff --git a/docs/software/linker-script/linker-script.rst b/docs/software/linker-script/linker-script.rst index fdae6711..c3e349a9 100644 --- a/docs/software/linker-script/linker-script.rst +++ b/docs/software/linker-script/linker-script.rst @@ -13,18 +13,21 @@ The relevant parts of the memory map of the TMS 570LC4375 for configuring the linker script are:: ┌────────────────────────────────────────┬────────────┐ - │ ... │ 0xFFFFFFFF │ - │ │ 0xFB000000 │ - ├────────────────────────────────────────┤────────────┤ + │ ... │ │ + │ │ │ + ├────────────────────────────────────────┼────────────┤ │ Flash │ 0xF047FFFF │ │ (Flash ECC, OTP and EEPROM accesses) │ 0xF0000000 │ - ├────────────────────────────────────────┤────────────┤ - │ ... │ 0x0807FFFF │ - │ │ 0x08400000 │ - ├────────────────────────────────────────┤────────────┤ + ├────────────────────────────────────────┼────────────┤ + │ ... │ │ + │ │ │ + ├────────────────────────────────────────┼────────────┤ │ RAM (512KB) │ 0x0807FFFF │ │ │ 0x08000000 │ - ├────────────────────────────────────────┤────────────┤ + ├────────────────────────────────────────┼────────────┤ + │ ... │ │ + │ │ │ + ├────────────────────────────────────────┼────────────┤ │ Flash (4MB) │ 0x003FFFFF │ │ │ 0x00000000 │ └────────────────────────────────────────┴────────────┘ @@ -52,7 +55,7 @@ The ``ECC`` directive can be used to configure the Error-correcting code of the memory. The ``MEMORY`` directive tells the linker the location and the size of memory -blocks. You can then assign . +blocks. The task of the ``SECTIONS`` directive is to tell the linker how to map input sections into output sections, and how to place the output sections in memory, i.e., specific sections can be placed in particular memory regions. @@ -65,14 +68,14 @@ Flash:: ┌────────────────────────────────────────┬────────────┐ │ VECTORS_TABLE │ 0x00000000 │ │ (0x20) │ 0x0000001F │ - ├────────────────────────────────────────┤────────────┤ + ├────────────────────────────────────────┼────────────┤ │ KERNEL_FUNCTIONS │ 0x00000020 │ │ (0x8000) │ 0x0000801F │ - ├────────────────────────────────────────┤────────────┤ + ├────────────────────────────────────────┼────────────┤ │ FLASH │ 0x00008020 │ │ (0x3F7F20) │ 0x003FFF3F │ - ├────────────────────────────────────────┤────────────┤ - │ VERSION_INFORMATION │ 0x003FFF40 │ + ├────────────────────────────────────────┼────────────┤ + │ VER_VERSION_INFORMATION │ 0x003FFF40 │ │ (0xC0) │ 0x003FFFFF │ └────────────────────────────────────────┴────────────┘ @@ -81,13 +84,13 @@ RAM:: ┌────────────────────────────────────────┬────────────┐ │ STACKS │ 0x08000000 │ │ (0x800) │ 0x080007FF │ - ├────────────────────────────────────────┤────────────┤ + ├────────────────────────────────────────┼────────────┤ │ KERNEL_DATA │ 0x08000800 │ │ (0x800) │ 0x08000FFF │ - ├────────────────────────────────────────┤────────────┤ + ├────────────────────────────────────────┼────────────┤ │ RAM │ 0x08001000 │ │ (0x7E000) │ 0x0807EFFF │ - ├────────────────────────────────────────┤────────────┤ + ├────────────────────────────────────────┼────────────┤ │ SHARED_RAM │ 0x0807F000 │ │ (0x1000) │ 0x0807FFFF │ └────────────────────────────────────────┴────────────┘ @@ -97,13 +100,13 @@ Flash ECC:: ┌────────────────────────────────────────┬────────────┐ │ ECC_VECTORS_TABLE │ 0xF0400000 │ │ (0x4) │ 0xF0400003 │ - ├────────────────────────────────────────┤────────────┤ + ├────────────────────────────────────────┼────────────┤ │ ECC_KERNEL_FUNCTIONS │ 0xF0400004 │ │ (0x1000) │ 0xF0401003 │ - ├────────────────────────────────────────┤────────────┤ + ├────────────────────────────────────────┼────────────┤ │ ECC_FLASH │ 0xF0401004 │ │ (0x7EFE4) │ 0xF047FFE7 │ - ├────────────────────────────────────────┤────────────┤ + ├────────────────────────────────────────┼────────────┤ │ ECC_VERSION_INFORMATION │ 0xF047FFE8 │ │ (0x18) │ 0xF047FFFF │ └────────────────────────────────────────┴────────────┘ diff --git a/docs/software/modules/application/algorithm/state-estimation/sof/trapezoid.rst b/docs/software/modules/application/algorithm/state-estimation/sof/trapezoid.rst index 51a5143a..e377851e 100644 --- a/docs/software/modules/application/algorithm/state-estimation/sof/trapezoid.rst +++ b/docs/software/modules/application/algorithm/state-estimation/sof/trapezoid.rst @@ -12,20 +12,20 @@ Module Files Driver ^^^^^^ -- ``src/app/application/algorithm/state_estimation/sof/trapezoid/sof.c`` (`API <./../../../../../../_static/doxygen/src/html/sof_8c.html>`__, `source <./../../../../../../_static/doxygen/src/html/sof_8c_source.html>`__) -- ``src/app/application/algorithm/state_estimation/sof/trapezoid/sof.h`` (`API <./../../../../../../_static/doxygen/src/html/sof_8h.html>`__, `source <./../../../../../../_static/doxygen/src/html/sof_8h_source.html>`__) +- ``src/app/application/algorithm/state_estimation/sof/trapezoid/sof_trapezoid.c`` (`API <./../../../../../../_static/doxygen/src/html/sof_8c.html>`__, `source <./../../../../../../_static/doxygen/src/html/sof__trapezoid_8c_source.html>`__) +- ``src/app/application/algorithm/state_estimation/sof/trapezoid/sof_trapezoid.h`` (`API <./../../../../../../_static/doxygen/src/html/sof_8h.html>`__, `source <./../../../../../../_static/doxygen/src/html/sof__trapezoid_8h_source.html>`__) Configuration ^^^^^^^^^^^^^ -- ``src/app/application/algorithm/state_estimation/sof/trapezoid/sof_cfg.c`` (`API <./../../../../../../_static/doxygen/src/html/sof__cfg_8c.html>`__, `source <./../../../../../../_static/doxygen/src/html/sof__cfg_8c_source.html>`__) -- ``src/app/application/algorithm/state_estimation/sof/trapezoid/sof_cfg.h`` (`API <./../../../../../../_static/doxygen/src/html/sof__cfg_8h.html>`__, `source <./../../../../../../_static/doxygen/src/html/sof__cfg_8h_source.html>`__) +- ``src/app/application/algorithm/state_estimation/sof/trapezoid/sof_trapezoid_cfg.c`` (`API <./../../../../../../_static/doxygen/src/html/sof__cfg_8c.html>`__, `source <./../../../../../../_static/doxygen/src/html/sof__trapezoid__cfg_8c_source.html>`__) +- ``src/app/application/algorithm/state_estimation/sof/trapezoid/sof_trapezoid_cfg.h`` (`API <./../../../../../../_static/doxygen/src/html/sof__cfg_8h.html>`__, `source <./../../../../../../_static/doxygen/src/html/sof__trapezoid__cfg_8h_source.html>`__) Unit Test ^^^^^^^^^ -- ``tests/unit/app/application/algorithm/state_estimation/sof/trapezoid/test_sof.c`` (`API <./../../../../../../_static/doxygen/tests/html/test__sof_8c.html>`__, `source <./../../../../../../_static/doxygen/tests/html/test__sof_8c_source.html>`__) -- ``tests/unit/app/application/algorithm/state_estimation/sof/trapezoid/test_sof_cfg.c`` (`API <./../../../../../../_static/doxygen/tests/html/test__sof__cfg_8c.html>`__, `source <./../../../../../../_static/doxygen/tests/html/test__sof__cfg_8c_source.html>`__) +- ``tests/unit/app/application/algorithm/state_estimation/sof/trapezoid/test_sof_trapezoid.c`` (`API <./../../../../../../_static/doxygen/tests/html/test__sof_8c.html>`__, `source <./../../../../../../_static/doxygen/tests/html/test__sof__trapezoid_8c_source.html>`__) +- ``tests/unit/app/application/algorithm/state_estimation/sof/trapezoid/test_sof_trapezoid_cfg.c`` (`API <./../../../../../../_static/doxygen/tests/html/test__sof__cfg_8c.html>`__, `source <./../../../../../../_static/doxygen/tests/html/test__sof__trapezoid__cfg_8c_source.html>`__) Detailed Description -------------------- diff --git a/docs/software/modules/application/bal/bal.rst b/docs/software/modules/application/bal/bal.rst index 97cd346b..d99de068 100644 --- a/docs/software/modules/application/bal/bal.rst +++ b/docs/software/modules/application/bal/bal.rst @@ -88,7 +88,7 @@ each specific cell only if its cell voltage is above the minimum cell voltage of threshold is set in this case to ``BAL_GetBalancingThreshold_mV()`` + ``BAL_HYSTERESIS_mV``. The correspondence between cell voltage and SOC must be defined by the user depending on the specific battery cells -used. Currently, it is done in the function ``SOC_GetFromVoltage()`` in ``sox.c``. This function gets a voltage in V +used. Currently, it is done in the function ``SE_GetStateOfChargeFromVoltage()`` in ``sox.c``. This function gets a voltage in V and return an SOC between 0.0 and 1.0. .. _BALANCING_MODULE_NO_BALANCING: diff --git a/docs/software/modules/engine/database/database_how-to.c b/docs/software/modules/engine/database/database_how-to.c index cd5bd41c..f281d65c 100644 --- a/docs/software/modules/engine/database/database_how-to.c +++ b/docs/software/modules/engine/database/database_how-to.c @@ -43,8 +43,8 @@ * @file database_how-to.c * @author foxBMS Team * @date 2021-04-12 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup SOME_GROUP * @prefix DATA * diff --git a/docs/software/modules/engine/diag/diag.rst b/docs/software/modules/engine/diag/diag.rst index fc30e7b3..ef711714 100644 --- a/docs/software/modules/engine/diag/diag.rst +++ b/docs/software/modules/engine/diag/diag.rst @@ -61,8 +61,9 @@ Detailed Description A detailed description on how to use the diagnosis module can be found in :ref:`HOW_TO_USE_THE_DIAGNOSIS_MODULE`. -The diagnosis module is implemented as a central table ``DIAG_ID_cfg`` that -maps ``DIAG_ID``\ s to callbacks. +The diagnosis module is implemented as a central table +``diag_diagnosisIdConfiguration`` that maps the entries of ``DIAG_ID_e`` to +callbacks. Whenever the diagnosis handler is called in the application code the diagnosis module selects based on this table the appropriate callback. It is in the responsibility of the callback to handle the reported issue. diff --git a/docs/software/modules/engine/sys_mon/sys_mon.rst b/docs/software/modules/engine/sys_mon/sys_mon.rst index 60e2fa73..2429820c 100644 --- a/docs/software/modules/engine/sys_mon/sys_mon.rst +++ b/docs/software/modules/engine/sys_mon/sys_mon.rst @@ -73,7 +73,7 @@ Diagnosis entries ^^^^^^^^^^^^^^^^^ When monitoring is enabled for a task and when the task violates its timings, -a diagnosis entry of type ``DIAG_ID_SYSTEMMONITORING`` is created in the +a diagnosis entry of type ``DIAG_ID_SYSTEM_MONITORING`` is created in the :ref:`DIAGNOSIS_MODULE`. The diagnosis handler for this ID sets the appropriate error flags in the ``DATA_BLOCK_ERRORSTATE_s`` database table. diff --git a/docs/software/modules/main/fassert.rst b/docs/software/modules/main/fassert.rst new file mode 100644 index 00000000..4ea11e03 --- /dev/null +++ b/docs/software/modules/main/fassert.rst @@ -0,0 +1,35 @@ +.. include:: ../../../macros.txt +.. include:: ../../../units.txt + +.. _FASSERT_MODULE: + +FASSERT Module +============== + +Module Files +------------ + +Driver +^^^^^^ + +- ``src/app/main/include/fassert.h`` (`API <./../../../_static/doxygen/src/html/fassert_8h.html>`__, `source <./../../../_static/doxygen/src/html/fassert_8h_source.html>`__) + +Configuration +^^^^^^^^^^^^^ + +*none* + +Unit Test +^^^^^^^^^ + +- ``tests/unit/app/main/test_fassert.c`` + +Detailed Description +-------------------- + +|tbc| + +Further Reading +--------------- + +A How-to is found in :ref:`HOW_TO_USE_THE_FTASK_MODULE`. diff --git a/docs/software/modules/main/fassert_how-to.rst b/docs/software/modules/main/fassert_how-to.rst index d0241b7e..82f72580 100644 --- a/docs/software/modules/main/fassert_how-to.rst +++ b/docs/software/modules/main/fassert_how-to.rst @@ -7,15 +7,17 @@ How to Use assertions ===================== When developing it is sensible and good practice to use assertions in order to -verify conditions that should be true. The following guide summarizes the -different styles of assertions that are available in this codebase. +verify conditions that should be true. +The following guide summarizes the different styles of assertions that are +available in this codebase. #error directive ---------------- -The C preprocessor allows to fail directly in the parsing of the C-files. This -is useful for cases such as when a certain configuration through defines is not -supported. Generally, defines should be used as less as possible. +The C preprocessor allows to fail directly in the parsing of the C-files. +This is useful for cases such as when a certain configuration through defines +is not supported. +Generally, defines should be used as less as possible. .. code-block:: c :linenos: @@ -29,17 +31,17 @@ supported. Generally, defines should be used as less as possible. The downside of using the error-directive is that the C-preprocessor runs -before any compilation is done. Therefore it is impossible to e.g., check size -requirements of variables. +before any compilation is done. +Therefore it is impossible to e.g., check size requirements of variables. static assertions ----------------- -Newer C-standards such as C11 have an assert that is able to do assertions -during compilation. It is called ``static_assert``. We have emulated this -function with a construction that will fail during compilation if the condition -is false. This allows to check for example the alignment of variables or that -the size of a variable is not zero. +Newer C-standards such as C11 (current default in the |foxbms| project) have +an assert that is able to do assertions during compilation. +(function ``_Static_assert`` or the accompanying macro ``static_assert``). +This allows to check for example the alignment of variables or that the size of +a variable is not zero. .. code-block:: c :linenos: @@ -47,7 +49,7 @@ the size of a variable is not zero. :name: static-assert /* db_variable is defined in your code and should contain something */ - f_static_assert((db_variable != 0), "database may not be zero"); + FAS_STATIC_ASSERT((db_variable != 0), "database may not be zero"); /* This assertion will not compile if db_variable has size zero. */ @@ -55,34 +57,41 @@ assertions ---------- Whenever it is impossible to determine a condition at compile time, normal -assertions can be used. In this project a macro called ``FAS_ASSERT(condition)`` -exists. It supports bringing the BMS to a full-stop in case of a failing -assertion. Please refer to the module on implementation and usage details. +assertions can be used. +In this project a macro called ``FAS_ASSERT(condition)`` exists. +It supports bringing the BMS to a full-stop in case of a failing assertion. +Please refer to the module on implementation and usage details. Assertions should be used generously in your code in order to assert conditions -that should always be true. Examples for this are: - -* The variable passed to a function is explicitly documented as being not - null and your code expects this. Make sure with an assertion that no - programming error has occurred. -* The default case of a switch-case-statement is not expected to be reached in - the program flow ever. You can add a ``FAS_ASSERT(FAS_TRAP)`` into the default - case in order to trip when this defect occurs. - -However, there also exist cases where an assertion is definitely not the right -tool. Examples are: - -* A sensor value is expected to be in a certain range, but a hardware defect - might lead to larger values. This should be handled by error-handling code. -* The communication to a slave-board fails or returns an invalid CRC. This is - also an error that is plausible to occur and not necessarily connected - to a programming fault. +that should always be true. +Examples for this are: + +- The variable passed to a function is explicitly documented as being not + null and your code expects this. + Make sure with an assertion that no programming error has occurred. +- The default case of a switch-case-statement is not expected to be reached in + the program flow ever. + You can add a ``FAS_ASSERT(FAS_TRAP)`` into the default case in order to trip + when this defect occurs. + +However, there also exist cases where an assertion is definitely **not** the +right tool. +Examples are: + +- A sensor value is expected to be in a certain range, but a hardware defect + might lead to larger values. + This should be handled by error-handling code. +- The communication to a slave-board fails or returns an invalid CRC. + This is also an error that is plausible to occur and not necessarily + connected to a programming fault. To sum it up, assertions should only be used for defects that are introduced by -incorrect parts of the program. They should not be used for "normal" failures -that might occur and just have to be handled gracefully. +incorrect parts of the program. +They should not be used for "normal" failures that might occur and just have to +be handled gracefully. Finally, care should be taken as code with assertions should be tested thoroughly in order to make sure, that no reboot loops or similar problems -occur. Apart from that having assertions enabled in production code is OK, as +occur. +Apart from that having assertions enabled in production code is OK, as they often catch errors that might lead to completely unexpected behavior. diff --git a/docs/software/modules/main/version.rst b/docs/software/modules/main/version.rst index 2d79cedb..6dd8c32b 100644 --- a/docs/software/modules/main/version.rst +++ b/docs/software/modules/main/version.rst @@ -8,8 +8,9 @@ Version Module The ``wscript`` of this project retrieves the current version (if available) from version control and generates during compilation of the project a -``version_cfg.c/h`` containing information about the current version. +``version_cfg.c/h`` file containing information about the current version. -In order to be able to find this struct in unknown binaries, the linker script -places this information always at the same location in memory. It uses the -linker section ``VERSIONINFO`` that starts at address ``0x003FFF40``. +In order to be able to find the version easily in any foxBMS binary, the linker script +places this information always at the same location in memory. +It uses the linker section ``VER_VERSION_INFORMATION`` (for details see +:ref:`LINKER_SCRIPT`). diff --git a/docs/software/modules/modules.rst b/docs/software/modules/modules.rst index 870a78e3..638705fb 100644 --- a/docs/software/modules/modules.rst +++ b/docs/software/modules/modules.rst @@ -69,3 +69,9 @@ Software Modules ./main/startup.rst ./main/version.rst + +.. toctree:: + :maxdepth: 2 + :caption: Miscellaneous + + ./main/fassert.rst diff --git a/docs/software/modules/task/ftask/ftask_how-to.c b/docs/software/modules/task/ftask/ftask_how-to.c index 8d461b99..18d4c37d 100644 --- a/docs/software/modules/task/ftask/ftask_how-to.c +++ b/docs/software/modules/task/ftask/ftask_how-to.c @@ -43,8 +43,8 @@ * @file ftask_how-to.c * @author foxBMS Team * @date 2019-08-27 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup SOME_GROUP * @prefix FTSK * diff --git a/docs/software/modules/task/ftask/wscript b/docs/software/modules/task/ftask/wscript index 6748ee14..06eb2f98 100644 --- a/docs/software/modules/task/ftask/wscript +++ b/docs/software/modules/task/ftask/wscript @@ -77,7 +77,7 @@ def build(bld): "uint32 PULDIS;\n" "uint32 PSL;\n" "} gioPORT_t;\n" - "#define gioPORTB ((gioPORT_t *)0xFFF7BC54U)\n" + "#define gioPORTB ((gioPORT_t *)0xFFF7BC54u)\n" "void gioSetBit(gioPORT_t *port, uint32 bit, uint32 value);\n" "uint32 gioGetBit(gioPORT_t *port, uint32 bit);\n" ) diff --git a/docs/software/unit-tests/unit-tests_how-to.rst b/docs/software/unit-tests/unit-tests_how-to.rst index b43aa68a..fc51cae7 100644 --- a/docs/software/unit-tests/unit-tests_how-to.rst +++ b/docs/software/unit-tests/unit-tests_how-to.rst @@ -31,7 +31,7 @@ Otherwise, ceedling will report uncovered files. Additionally, the main wscript contains a mechanism that checks that every file has a corresponding test file in the proper location. -Untested files have to be added to ``excl`` in ``check_testfiles(ctx)``. +Untested files have to be added to ``excl`` in ``check_test_files(ctx)``. Using ceedling directly ======================= diff --git a/docs/spelling_wordlist.txt b/docs/spelling_wordlist.txt index 13d13b71..86030d66 100644 --- a/docs/spelling_wordlist.txt +++ b/docs/spelling_wordlist.txt @@ -35,6 +35,7 @@ CRC dask dbc deci +decodable devel Devkit diffs @@ -42,6 +43,7 @@ distcheck dlc Doxygen doxygen +draftman electrochemical endian endianness @@ -58,16 +60,17 @@ formatters foxbms foxBMS foxmath -functionalities fram freertos freeRTOS +functionalities galvanically getter GitLab goto graphviz gravis +GUI halcogen HALCoGen hotfix @@ -82,13 +85,14 @@ initializers intrinsics inverter iso +isolator isoSPI isospi jpeg json kiwisolver -Lauterbach kOhm +Lauterbach libs linelength Linkerscript @@ -107,6 +111,7 @@ milliampere milliamperes Miniconda miniconda +misconfiguration MISRA misra Molex @@ -115,14 +120,16 @@ multi mutex mV namings +nF ok overcurrent overline overvoltage pandoc +phosphane +phy pinout pinouts -phosphane posix postprocess postprocessed @@ -141,9 +148,9 @@ readme readmes recalibrated recalibrating +receptable redox refactored -receptable reStructuredText roadmap rst @@ -158,6 +165,7 @@ seh Sensirion SOE SOH +solderabilty SPI sqlite startup @@ -165,8 +173,8 @@ stderr strippable struct structs -subdirectory subdirectories +subdirectory subfunction subfunctions substate @@ -194,14 +202,15 @@ UART uint undervoltage unenumerated -untestable unique unrestrictedly Unselect unstage unstaged +untestable utf utils +Vdd vendored versioned versioning @@ -213,7 +222,8 @@ whitespace workflow workflows workspace -Wuerth wscript +Wuerth xEFxBBxBF xml +Zener diff --git a/docs/stylesheetfile.css b/docs/style-sheet-file.css similarity index 100% rename from docs/stylesheetfile.css rename to docs/style-sheet-file.css diff --git a/docs/system/colors-in-system-block-diagram.csv b/docs/system/colors-in-system-block-diagram.csv new file mode 100644 index 00000000..dfa22fe8 --- /dev/null +++ b/docs/system/colors-in-system-block-diagram.csv @@ -0,0 +1,7 @@ +Symbol; Meaning +|red|; Power path +|dotted-red|; Second power path (optional) +|purple|; CAN +|dark-yellow|; Contactor control and feedback +|dark-blue|; Insulation measurement line +|blue|; Daisy-chain diff --git a/docs/system/symbols-in-system-block-diagram.csv b/docs/system/symbols-in-system-block-diagram.csv new file mode 100644 index 00000000..ca2a6f00 --- /dev/null +++ b/docs/system/symbols-in-system-block-diagram.csv @@ -0,0 +1,8 @@ +Symbol ; Meaning +|contactor|; Contactor +|current-sensor|; Current +|fuse|; Fuse +|imd|; Insulation +|inverter|; Inverter +|msd|; Manual service disconnect +|resistor|; Resistor diff --git a/docs/system/system-voltage-and-current-monitoring.rst b/docs/system/system-voltage-and-current-monitoring.rst index c6be30c6..9b78c89c 100644 --- a/docs/system/system-voltage-and-current-monitoring.rst +++ b/docs/system/system-voltage-and-current-monitoring.rst @@ -7,6 +7,21 @@ System Voltage And Current Monitoring ##################################### +.. |contactor| image:: img/contactor.png +.. |current-sensor| image:: img/current-sensor.png +.. |fuse| image:: img/fuse.png +.. |imd| image:: img/imd.png +.. |inverter| image:: img/inverter.png +.. |msd| image:: img/msd.png +.. |resistor| image:: img/resistor.png + +.. |red| image:: img/red.png +.. |dotted-red| image:: img/dotted-red.png +.. |purple| image:: img/purple.png +.. |dark-yellow| image:: img/dark-yellow.png +.. |dark-blue| image:: img/dark-blue.png +.. |blue| image:: img/blue.png + Several different voltages inside a battery system need to be measured. The exact number of voltages is dependent on the system topology and the configuration of the battery system. @@ -28,65 +43,17 @@ indicated connected application shown on the right side the of the picture. Voltages of interest in a multi-string system (click to enlarge) - -.. |contactor| image:: img/contactor.png -.. |current-sensor| image:: img/current-sensor.png -.. |fuse| image:: img/fuse.png -.. |imd| image:: img/imd.png -.. |inverter| image:: img/inverter.png -.. |msd| image:: img/msd.png -.. |resistor| image:: img/resistor.png - - -.. table:: Symbol description +.. csv-table:: Symbol description :name: symbols-in-system-block-diagram - :widths: grid - - +-------------------+-------------------------------+ - | Symbol | Meaning | - +===================+===============================+ - | |contactor| | Contactor | - +-------------------+-------------------------------+ - | |current-sensor| | Current sensor | - +-------------------+-------------------------------+ - | |fuse| | Fuse | - +-------------------+-------------------------------+ - | |imd| | Insulation Measurement Device | - +-------------------+-------------------------------+ - | |inverter| | Inverter | - +-------------------+-------------------------------+ - | |msd| | Manual Service Disconnect | - +-------------------+-------------------------------+ - | |resistor| | Resistor | - +-------------------+-------------------------------+ - - -.. |red| image:: img/red.png -.. |dotted-red| image:: img/dotted-red.png -.. |purple| image:: img/purple.png -.. |dark-yellow| image:: img/dark-yellow.png -.. |dark-blue| image:: img/dark-blue.png -.. |blue| image:: img/blue.png + :header-rows: 1 + :delim: ; + :file: ./symbols-in-system-block-diagram.csv -.. table:: Color description +.. csv-table:: Color description :name: colors-in-system-block-diagram - :widths: grid - - +-------------------+-----------------------------------+ - | Symbol | Meaning | - +===================+===================================+ - | |red| | Power path | - +-------------------+-----------------------------------+ - | |dotted-red| | Second power path (optional) | - +-------------------+-----------------------------------+ - | |purple| | CAN | - +-------------------+-----------------------------------+ - | |dark-yellow| | Contactor control and feedback | - +-------------------+-----------------------------------+ - | |dark-blue| | Insulation measurement line | - +-------------------+-----------------------------------+ - | |blue| | Daisy-chain | - +-------------------+-----------------------------------+ + :header-rows: 1 + :delim: ; + :file: ./colors-in-system-block-diagram.csv ******************* Multi-String System diff --git a/docs/tools/debugger/debug-application.rst b/docs/tools/debugger/debug-application.rst index c1eef717..54133898 100644 --- a/docs/tools/debugger/debug-application.rst +++ b/docs/tools/debugger/debug-application.rst @@ -89,8 +89,9 @@ Version struct ^^^^^^^^^^^^^^ Each binary is automatically marked with the software version from which it -has been built. The current version is stored in the global variable -``foxbmsVersionInfo`` and can be inspected with the debugger. +has been built. +The current version is stored in the global variable +``ver_foxbmsVersionInformation`` and can be inspected with the debugger. Choice of debugger ------------------ @@ -104,18 +105,18 @@ debugger, as we cannot support debugger toolchains that we do not know or cannot recommend. Feel free to contact us, if you need more information. * The first one is the - `Segger J-Link PLUS `_. A cheaper - debugger solution is the - `Segger J-Link BASE `_. Please note - that the debug software - `Ozone `_ + `Segger J-Link PLUS `_. + A cheaper debugger solution is the + `Segger J-Link BASE `_. + Please note that the debug software + `Ozone `_ is not licensed with the base version of J-Link. * The second type of debugger are the debugger by - `Lauterbach `_. The Lauterbach - debugger performs under certain conditions better, but is also more expensive - than the J-Link. Tracing has been tested and set up only with trace-probes - by Lauterbach. + `Lauterbach `_. + The Lauterbach debugger performs under certain conditions better, but is also + more expensive than the J-Link. + Tracing has been tested and set up only with trace-probes by Lauterbach. The following sections describe configuration and usage of the debuggers Segger Ozone and Lauterbach Trace32. diff --git a/docs/tools/log-parser.rst b/docs/tools/log-parser.rst index ee5d2569..594d6bab 100644 --- a/docs/tools/log-parser.rst +++ b/docs/tools/log-parser.rst @@ -1,17 +1,17 @@ .. include:: ./../macros.txt .. include:: ./../units.txt -.. _CAN_LOG_PARSER_TOOL: +.. _FOXBMS_2_GUI: -CAN Log Parser Tool -=================== +foxBMS 2 GUI +============ This tool helps to parse CAN logs generated by |foxbms|. Module Implementation Documentation ----------------------------------- -.. automodule:: log_parser +.. automodule:: fgui :members: .. toctree:: diff --git a/docs/units.txt b/docs/units.txt index 85094cdd..3b0baca2 100644 --- a/docs/units.txt +++ b/docs/units.txt @@ -17,3 +17,5 @@ .. |kW| replace:: kW .. |Wh| replace:: Wh .. |kWh| replace:: kWh + +.. |nF| replace:: nF diff --git a/hardware/README.md b/hardware/README.md index 391f527d..f67aeb73 100644 --- a/hardware/README.md +++ b/hardware/README.md @@ -11,7 +11,7 @@ The hardware design files belonging to this release are: | Item | Version | File | |--------|---------|------------------------------------------------------------------------------------------------------------------------| -| Master | 1.1.1 | [TI TMS570LC4357 Master v1.1.1](https://iisb-foxbms.iisb.fraunhofer.de/foxbms/gen2/hardware/release/master-v1.1.1.zip) | +| Master | 1.1.3 | [TI TMS570LC4357 Master v1.1.3](https://iisb-foxbms.iisb.fraunhofer.de/foxbms/gen2/hardware/release/master-v1.1.3.zip) | ## Interfaces diff --git a/src/app/application/algorithm/algorithm.c b/src/app/application/algorithm/algorithm.c index 0f67e37e..dc47ee30 100644 --- a/src/app/application/algorithm/algorithm.c +++ b/src/app/application/algorithm/algorithm.c @@ -43,8 +43,8 @@ * @file algorithm.c * @author foxBMS Team * @date 2017-12-18 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup ALGORITHMS * @prefix ALGO * @@ -81,7 +81,7 @@ static void ALGO_Initialization(void) { /* iterate over all algorithms */ for (uint16_t i = 0u; i < algo_length; i++) { /* check if the cycle time is valid */ - FAS_ASSERT((algo_algorithms[i].cycleTime_ms % ALGO_TICK_MS) == 0u); + FAS_ASSERT((algo_algorithms[i].cycleTime_ms % ALGO_TICK_ms) == 0u); /* check only uninitialized algorithms */ if (algo_algorithms[i].state == ALGO_UNINITIALIZED) { @@ -145,7 +145,7 @@ extern void ALGO_MainFunction(void) { } } - counter_ticks += ALGO_TICK_MS; + counter_ticks += ALGO_TICK_ms; } extern void ALGO_MonitorExecutionTime(void) { diff --git a/src/app/application/algorithm/algorithm.h b/src/app/application/algorithm/algorithm.h index 548badd0..e39771ca 100644 --- a/src/app/application/algorithm/algorithm.h +++ b/src/app/application/algorithm/algorithm.h @@ -43,8 +43,8 @@ * @file algorithm.h * @author foxBMS Team * @date 2017-12-18 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup ALGORITHMS * @prefix ALGO * diff --git a/src/app/application/algorithm/config/algorithm_cfg.c b/src/app/application/algorithm/config/algorithm_cfg.c index 56b5b2de..7df3470e 100644 --- a/src/app/application/algorithm/config/algorithm_cfg.c +++ b/src/app/application/algorithm/config/algorithm_cfg.c @@ -43,8 +43,8 @@ * @file algorithm_cfg.c * @author foxBMS Team * @date 2017-12-18 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup ALGORITHMS_CONFIGURATION * @prefix ALGO * diff --git a/src/app/application/algorithm/config/algorithm_cfg.h b/src/app/application/algorithm/config/algorithm_cfg.h index 41d4189b..b5f541fc 100644 --- a/src/app/application/algorithm/config/algorithm_cfg.h +++ b/src/app/application/algorithm/config/algorithm_cfg.h @@ -43,8 +43,8 @@ * @file algorithm_cfg.h * @author foxBMS Team * @date 2017-12-18 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup ALGORITHMS_CONFIGURATION * @prefix ALGO * @@ -64,7 +64,7 @@ * @details task timeslot where the ALGO main function is called. Repetition * time of algorithm cycle time must be multiple of this */ -#define ALGO_TICK_MS (100u) +#define ALGO_TICK_ms (100u) /** * function type for the initialization function of an algorithm diff --git a/src/app/application/algorithm/moving_average/moving_average.c b/src/app/application/algorithm/moving_average/moving_average.c index 52acacfe..fcc144d9 100644 --- a/src/app/application/algorithm/moving_average/moving_average.c +++ b/src/app/application/algorithm/moving_average/moving_average.c @@ -43,8 +43,8 @@ * @file moving_average.c * @author foxBMS Team * @date 2017-12-18 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup ALGORITHMS * @prefix ALGO * @@ -63,36 +63,36 @@ /** TODO */ #define MEM_EXT_SDRAM -#if ALGO_TICK_MS > ISA_CURRENT_CYCLE_TIME_MS -#define ALGO_NUMBER_AVERAGE_VALUES_CUR_1s ((1000u) / ALGO_TICK_MS) -#define ALGO_NUMBER_AVERAGE_VALUES_CUR_5s ((5000u) / ALGO_TICK_MS) -#define ALGO_NUMBER_AVERAGE_VALUES_CUR_10s ((10000u) / ALGO_TICK_MS) -#define ALGO_NUMBER_AVERAGE_VALUES_CUR_30s ((30000u) / ALGO_TICK_MS) -#define ALGO_NUMBER_AVERAGE_VALUES_CUR_60s ((60000u) / ALGO_TICK_MS) -#define ALGO_NUMBER_AVERAGE_VALUES_CUR_CFG (MOVING_AVERAGE_DURATION_CURRENT_CONFIG_MS / ALGO_TICK_MS) +#if ALGO_TICK_ms > ISA_CURRENT_CYCLE_TIME_ms +#define ALGO_NUMBER_AVERAGE_VALUES_CUR_1s ((1000u) / ALGO_TICK_ms) +#define ALGO_NUMBER_AVERAGE_VALUES_CUR_5s ((5000u) / ALGO_TICK_ms) +#define ALGO_NUMBER_AVERAGE_VALUES_CUR_10s ((10000u) / ALGO_TICK_ms) +#define ALGO_NUMBER_AVERAGE_VALUES_CUR_30s ((30000u) / ALGO_TICK_ms) +#define ALGO_NUMBER_AVERAGE_VALUES_CUR_60s ((60000u) / ALGO_TICK_ms) +#define ALGO_NUMBER_AVERAGE_VALUES_CUR_CFG (MOVING_AVERAGE_DURATION_CURRENT_CONFIG_ms / ALGO_TICK_ms) #else -#define ALGO_NUMBER_AVERAGE_VALUES_CUR_1s ((1000u) / ISA_CURRENT_CYCLE_TIME_MS) -#define ALGO_NUMBER_AVERAGE_VALUES_CUR_5s ((5000u) / ISA_CURRENT_CYCLE_TIME_MS) -#define ALGO_NUMBER_AVERAGE_VALUES_CUR_10s ((10000u) / ISA_CURRENT_CYCLE_TIME_MS) -#define ALGO_NUMBER_AVERAGE_VALUES_CUR_30s ((30000u) / ISA_CURRENT_CYCLE_TIME_MS) -#define ALGO_NUMBER_AVERAGE_VALUES_CUR_60s ((60000u) / ISA_CURRENT_CYCLE_TIME_MS) -#define ALGO_NUMBER_AVERAGE_VALUES_CUR_CFG (MOVING_AVERAGE_DURATION_CURRENT_CONFIG_MS / ISA_CURRENT_CYCLE_TIME_MS) +#define ALGO_NUMBER_AVERAGE_VALUES_CUR_1s ((1000u) / ISA_CURRENT_CYCLE_TIME_ms) +#define ALGO_NUMBER_AVERAGE_VALUES_CUR_5s ((5000u) / ISA_CURRENT_CYCLE_TIME_ms) +#define ALGO_NUMBER_AVERAGE_VALUES_CUR_10s ((10000u) / ISA_CURRENT_CYCLE_TIME_ms) +#define ALGO_NUMBER_AVERAGE_VALUES_CUR_30s ((30000u) / ISA_CURRENT_CYCLE_TIME_ms) +#define ALGO_NUMBER_AVERAGE_VALUES_CUR_60s ((60000u) / ISA_CURRENT_CYCLE_TIME_ms) +#define ALGO_NUMBER_AVERAGE_VALUES_CUR_CFG (MOVING_AVERAGE_DURATION_CURRENT_CONFIG_ms / ISA_CURRENT_CYCLE_TIME_ms) #endif -#if ALGO_TICK_MS > ISA_POWER_CYCLE_TIME_MS -#define ALGO_NUMBER_AVERAGE_VALUES_POW_1s ((1000u) / ALGO_TICK_MS) -#define ALGO_NUMBER_AVERAGE_VALUES_POW_5s ((5000u) / ALGO_TICK_MS) -#define ALGO_NUMBER_AVERAGE_VALUES_POW_10s ((10000u) / ALGO_TICK_MS) -#define ALGO_NUMBER_AVERAGE_VALUES_POW_30s ((30000u) / ALGO_TICK_MS) -#define ALGO_NUMBER_AVERAGE_VALUES_POW_60s ((60000u) / ALGO_TICK_MS) -#define ALGO_NUMBER_AVERAGE_VALUES_POW_CFG (MOVING_AVERAGE_DURATION_POWER_CONFIG_MS / ALGO_TICK_MS) +#if ALGO_TICK_ms > ISA_POWER_CYCLE_TIME_ms +#define ALGO_NUMBER_AVERAGE_VALUES_POW_1s ((1000u) / ALGO_TICK_ms) +#define ALGO_NUMBER_AVERAGE_VALUES_POW_5s ((5000u) / ALGO_TICK_ms) +#define ALGO_NUMBER_AVERAGE_VALUES_POW_10s ((10000u) / ALGO_TICK_ms) +#define ALGO_NUMBER_AVERAGE_VALUES_POW_30s ((30000u) / ALGO_TICK_ms) +#define ALGO_NUMBER_AVERAGE_VALUES_POW_60s ((60000u) / ALGO_TICK_ms) +#define ALGO_NUMBER_AVERAGE_VALUES_POW_CFG (MOVING_AVERAGE_DURATION_POWER_CONFIG_ms / ALGO_TICK_ms) #else -#define ALGO_NUMBER_AVERAGE_VALUES_POW_1s ((1000u) / ISA_POWER_CYCLE_TIME_MS) -#define ALGO_NUMBER_AVERAGE_VALUES_POW_5s ((5000u) / ISA_POWER_CYCLE_TIME_MS) -#define ALGO_NUMBER_AVERAGE_VALUES_POW_10s ((10000u) / ISA_POWER_CYCLE_TIME_MS) -#define ALGO_NUMBER_AVERAGE_VALUES_POW_30s ((30000u) / ISA_POWER_CYCLE_TIME_MS) -#define ALGO_NUMBER_AVERAGE_VALUES_POW_60s ((60000u) / ISA_POWER_CYCLE_TIME_MS) -#define ALGO_NUMBER_AVERAGE_VALUES_POW_CFG (MOVING_AVERAGE_DURATION_POWER_CONFIG_MS / ISA_POWER_CYCLE_TIME_MS) +#define ALGO_NUMBER_AVERAGE_VALUES_POW_1s ((1000u) / ISA_POWER_CYCLE_TIME_ms) +#define ALGO_NUMBER_AVERAGE_VALUES_POW_5s ((5000u) / ISA_POWER_CYCLE_TIME_ms) +#define ALGO_NUMBER_AVERAGE_VALUES_POW_10s ((10000u) / ISA_POWER_CYCLE_TIME_ms) +#define ALGO_NUMBER_AVERAGE_VALUES_POW_30s ((30000u) / ISA_POWER_CYCLE_TIME_ms) +#define ALGO_NUMBER_AVERAGE_VALUES_POW_60s ((60000u) / ISA_POWER_CYCLE_TIME_ms) +#define ALGO_NUMBER_AVERAGE_VALUES_POW_CFG (MOVING_AVERAGE_DURATION_POWER_CONFIG_ms / ISA_POWER_CYCLE_TIME_ms) #endif /*========== Static Constant and Variable Definitions =======================*/ @@ -100,49 +100,49 @@ /* Arrays in extern SDRAM to calculate moving average current and power */ /* Check if minimum algo cycle time > current sensor sample time */ -#if ALGO_TICK_MS > ISA_CURRENT_CYCLE_TIME_MS -#if MOVING_AVERAGE_DURATION_CURRENT_CONFIG_MS / ALGO_TICK_MS > 60000u / ALGO_TICK_MS +#if ALGO_TICK_ms > ISA_CURRENT_CYCLE_TIME_ms +#if MOVING_AVERAGE_DURATION_CURRENT_CONFIG_ms / ALGO_TICK_ms > 60000u / ALGO_TICK_ms /* If array length of configured time > 60s array take this array size */ -static float MEM_EXT_SDRAM curValues[(MOVING_AVERAGE_DURATION_CURRENT_CONFIG_MS / ALGO_TICK_MS) + 1u] = {}; -static uint32_t movingAverageCurrentLength = (MOVING_AVERAGE_DURATION_CURRENT_CONFIG_MS / ALGO_TICK_MS) + 1u; +static float MEM_EXT_SDRAM curValues[(MOVING_AVERAGE_DURATION_CURRENT_CONFIG_ms / ALGO_TICK_ms) + 1u] = {}; +static uint32_t movingAverageCurrentLength = (MOVING_AVERAGE_DURATION_CURRENT_CONFIG_ms / ALGO_TICK_ms) + 1u; #else /* Take array size of 60s moving average */ -static float MEM_EXT_SDRAM curValues[(60000u / ALGO_TICK_MS) + 1u] = {}; -static uint32_t movingAverageCurrentLength = (60000u / ALGO_TICK_MS) + 1; +static float MEM_EXT_SDRAM curValues[(60000u / ALGO_TICK_ms) + 1u] = {}; +static uint32_t movingAverageCurrentLength = (60000u / ALGO_TICK_ms) + 1; #endif #else /* If array length of configured time > 60s array take this array size */ -#if (MOVING_AVERAGE_DURATION_CURRENT_CONFIG_MS / ISA_CURRENT_CYCLE_TIME_MS) > (60000u / ISA_CURRENT_CYCLE_TIME_MS) -static float MEM_EXT_SDRAM curValues[(MOVING_AVERAGE_DURATION_CURRENT_CONFIG_MS / ISA_CURRENT_CYCLE_TIME_MS) + 1u] = {}; -static uint32_t movingAverageCurrentLength = (MOVING_AVERAGE_DURATION_CURRENT_CONFIG_MS / ISA_CURRENT_CYCLE_TIME_MS) + +#if (MOVING_AVERAGE_DURATION_CURRENT_CONFIG_ms / ISA_CURRENT_CYCLE_TIME_ms) > (60000u / ISA_CURRENT_CYCLE_TIME_ms) +static float MEM_EXT_SDRAM curValues[(MOVING_AVERAGE_DURATION_CURRENT_CONFIG_ms / ISA_CURRENT_CYCLE_TIME_ms) + 1u] = {}; +static uint32_t movingAverageCurrentLength = (MOVING_AVERAGE_DURATION_CURRENT_CONFIG_ms / ISA_CURRENT_CYCLE_TIME_ms) + 1u; #else /* Take array size of 60s moving average */ -static float MEM_EXT_SDRAM curValues[(60000u / ISA_CURRENT_CYCLE_TIME_MS) + 1u] = {0.0f}; -static uint32_t movingAverageCurrentLength = (60000u / ISA_CURRENT_CYCLE_TIME_MS) + 1u; +static float MEM_EXT_SDRAM curValues[(60000u / ISA_CURRENT_CYCLE_TIME_ms) + 1u] = {0.0f}; +static uint32_t movingAverageCurrentLength = (60000u / ISA_CURRENT_CYCLE_TIME_ms) + 1u; #endif #endif /* Check if minimum algo cycle time > current sensor sample time */ -#if ALGO_TICK_MS > ISA_POWER_CYCLE_TIME_MS -#if (MOVING_AVERAGE_DURATION_POWER_CONFIG_MS / ALGO_TICK_MS) > (60000u / ALGO_TICK_MS) +#if ALGO_TICK_ms > ISA_POWER_CYCLE_TIME_ms +#if (MOVING_AVERAGE_DURATION_POWER_CONFIG_ms / ALGO_TICK_ms) > (60000u / ALGO_TICK_ms) /* If array length of configured time > 60s array take this array size */ -static float MEM_EXT_SDRAM powValues[(MOVING_AVERAGE_DURATION_POWER_CONFIG_MS / ALGO_TICK_MS) + 1u] = {}; -static uint32_t movingAveragePowerLength = (MOVING_AVERAGE_DURATION_POWER_CONFIG_MS / ALGO_TICK_MS) + 1u; +static float MEM_EXT_SDRAM powValues[(MOVING_AVERAGE_DURATION_POWER_CONFIG_ms / ALGO_TICK_ms) + 1u] = {}; +static uint32_t movingAveragePowerLength = (MOVING_AVERAGE_DURATION_POWER_CONFIG_ms / ALGO_TICK_ms) + 1u; #else /* Take array size of 60s moving average */ -static float MEM_EXT_SDRAM powValues[(60000u / ALGO_TICK_MS) + 1] = {}; -static uint32_t movingAveragePowerLength = (60000u / ALGO_TICK_MS) + 1u; +static float MEM_EXT_SDRAM powValues[(60000u / ALGO_TICK_ms) + 1] = {}; +static uint32_t movingAveragePowerLength = (60000u / ALGO_TICK_ms) + 1u; #endif #else -#if (MOVING_AVERAGE_DURATION_POWER_CONFIG_MS / ISA_POWER_CYCLE_TIME_MS) > (60000u / ISA_POWER_CYCLE_TIME_MS) +#if (MOVING_AVERAGE_DURATION_POWER_CONFIG_ms / ISA_POWER_CYCLE_TIME_ms) > (60000u / ISA_POWER_CYCLE_TIME_ms) /* If array length of configured time > 60s array take this array size */ -static float MEM_EXT_SDRAM powValues[(MOVING_AVERAGE_DURATION_POWER_CONFIG_MS / ISA_POWER_CYCLE_TIME_MS) + 1u] = {}; -static uint32_t movingAveragePowerLength = (MOVING_AVERAGE_DURATION_POWER_CONFIG_MS / ISA_POWER_CYCLE_TIME_MS) + 1u; +static float MEM_EXT_SDRAM powValues[(MOVING_AVERAGE_DURATION_POWER_CONFIG_ms / ISA_POWER_CYCLE_TIME_ms) + 1u] = {}; +static uint32_t movingAveragePowerLength = (MOVING_AVERAGE_DURATION_POWER_CONFIG_ms / ISA_POWER_CYCLE_TIME_ms) + 1u; #else /* Take array size of 60s moving average */ -static float MEM_EXT_SDRAM powValues[(60000u / ISA_POWER_CYCLE_TIME_MS) + 1u] = {0.0f}; -static uint32_t movingAveragePowerLength = (60000u / ISA_POWER_CYCLE_TIME_MS) + 1u; +static float MEM_EXT_SDRAM powValues[(60000u / ISA_POWER_CYCLE_TIME_ms) + 1u] = {0.0f}; +static uint32_t movingAveragePowerLength = (60000u / ISA_POWER_CYCLE_TIME_ms) + 1u; #endif #endif @@ -224,7 +224,7 @@ extern void ALGO_MovAverage(void) { divider = ALGO_NUMBER_AVERAGE_VALUES_CUR_CFG; movingAverage_tab.movingAverageCurrentConfigurableInterval_mA += (*pMovingAverageCurrentNew) / divider; - /* Then, increment pointer and substract oldest value when respective window is filled with data */ + /* Then, increment pointer and subtract oldest value when respective window is filled with data */ pMovingAverageCurrentNew++; if ((curInit & 0x01u) == 0x01u) { divider = ALGO_NUMBER_AVERAGE_VALUES_CUR_1s; @@ -343,7 +343,7 @@ extern void ALGO_MovAverage(void) { divider = ALGO_NUMBER_AVERAGE_VALUES_POW_CFG; movingAverage_tab.movingAveragePowerConfigurableInterval_mA += (*pMovingAveragePowerNew) / divider; - /* Then, increment pointer and substract oldest value when respective window is filled with data */ + /* Then, increment pointer and subtract oldest value when respective window is filled with data */ pMovingAveragePowerNew++; if ((powInit & 0x01u) == 0x01u) { divider = ALGO_NUMBER_AVERAGE_VALUES_POW_1s; diff --git a/src/app/application/algorithm/moving_average/moving_average.h b/src/app/application/algorithm/moving_average/moving_average.h index 068a043f..3fd8c3b3 100644 --- a/src/app/application/algorithm/moving_average/moving_average.h +++ b/src/app/application/algorithm/moving_average/moving_average.h @@ -43,8 +43,8 @@ * @file moving_average.h * @author foxBMS Team * @date 2017-12-18 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup ALGORITHMS * @prefix ALGO * @@ -60,11 +60,11 @@ /*========== Macros and Definitions =========================================*/ -#define MOVING_AVERAGE_DURATION_CURRENT_CONFIG_MS (3000u) -#define MOVING_AVERAGE_DURATION_POWER_CONFIG_MS (3000u) +#define MOVING_AVERAGE_DURATION_CURRENT_CONFIG_ms (3000u) +#define MOVING_AVERAGE_DURATION_POWER_CONFIG_ms (3000u) -#define ISA_CURRENT_CYCLE_TIME_MS (200u) -#define ISA_POWER_CYCLE_TIME_MS (200u) +#define ISA_CURRENT_CYCLE_TIME_ms (200u) +#define ISA_POWER_CYCLE_TIME_ms (200u) /*========== Extern Constant and Variable Declarations ======================*/ diff --git a/src/app/application/algorithm/state_estimation/soc/counting/soc_counting.c b/src/app/application/algorithm/state_estimation/soc/counting/soc_counting.c index 759cf444..c0a87dd5 100644 --- a/src/app/application/algorithm/state_estimation/soc/counting/soc_counting.c +++ b/src/app/application/algorithm/state_estimation/soc/counting/soc_counting.c @@ -43,8 +43,8 @@ * @file soc_counting.c * @author foxBMS Team * @date 2020-10-07 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup APPLICATION * @prefix SOC * @@ -71,19 +71,20 @@ typedef struct { uint32_t previousTimestamp[BS_NR_OF_STRINGS]; /*!< timestamp buffer to check if current/CC data has been updated */ } SOC_STATE_s; -/** defines for maximum and minimum SOC */ -#define MAXIMUM_SOC_PERC (100.0f) -#define MINIMUM_SOC_PERC (0.0f) +/** Maximum SOC in percentage */ +#define SOC_MAXIMUM_SOC_perc (100.0f) +/** Minimum SOC in percentage */ +#define SOC_MINIMUM_SOC_perc (0.0f) /*========== Static Constant and Variable Definitions =======================*/ /** state variable for SOC module */ static SOC_STATE_s soc_state = { .socInitialized = false, - .sensorCcUsed = {REPEAT_U(false, STRIP(BS_NR_OF_STRINGS))}, - .ccScalingAverage = {REPEAT_U(0.0f, STRIP(BS_NR_OF_STRINGS))}, - .ccScalingMinimum = {REPEAT_U(0.0f, STRIP(BS_NR_OF_STRINGS))}, - .ccScalingMaximum = {REPEAT_U(0.0f, STRIP(BS_NR_OF_STRINGS))}, - .previousTimestamp = {REPEAT_U(0u, STRIP(BS_NR_OF_STRINGS))}, + .sensorCcUsed = {GEN_REPEAT_U(false, GEN_STRIP(BS_NR_OF_STRINGS))}, + .ccScalingAverage = {GEN_REPEAT_U(0.0f, GEN_STRIP(BS_NR_OF_STRINGS))}, + .ccScalingMinimum = {GEN_REPEAT_U(0.0f, GEN_STRIP(BS_NR_OF_STRINGS))}, + .ccScalingMaximum = {GEN_REPEAT_U(0.0f, GEN_STRIP(BS_NR_OF_STRINGS))}, + .previousTimestamp = {GEN_REPEAT_U(0u, GEN_STRIP(BS_NR_OF_STRINGS))}, }; /** local copies of database tables */ @@ -156,9 +157,9 @@ static void SOC_RecalibrateViaLookupTable(DATA_BLOCK_SOX_s *pTableSoc) { for (uint8_t s = 0u; s < BS_NR_OF_STRINGS; s++) { SOC_SetValue( pTableSoc, - SOC_GetFromVoltage(tableMinMaxCellVoltages.minimumCellVoltage_mV[s]), - SOC_GetFromVoltage(tableMinMaxCellVoltages.maximumCellVoltage_mV[s]), - SOC_GetFromVoltage(tableMinMaxCellVoltages.averageCellVoltage_mV[s]), + SE_GetStateOfChargeFromVoltage(tableMinMaxCellVoltages.minimumCellVoltage_mV[s]), + SE_GetStateOfChargeFromVoltage(tableMinMaxCellVoltages.maximumCellVoltage_mV[s]), + SE_GetStateOfChargeFromVoltage(tableMinMaxCellVoltages.averageCellVoltage_mV[s]), s); } FRAM_WriteData(FRAM_BLOCK_ID_SOC); @@ -204,23 +205,23 @@ static void SOC_CheckDatabaseSocPercentageLimits(DATA_BLOCK_SOX_s *pTableSoc, ui FAS_ASSERT(pTableSoc != NULL_PTR); FAS_ASSERT(stringNumber < BS_NR_OF_STRINGS); - if (pTableSoc->averageSoc_perc[stringNumber] > MAXIMUM_SOC_PERC) { - pTableSoc->averageSoc_perc[stringNumber] = MAXIMUM_SOC_PERC; + if (pTableSoc->averageSoc_perc[stringNumber] > SOC_MAXIMUM_SOC_perc) { + pTableSoc->averageSoc_perc[stringNumber] = SOC_MAXIMUM_SOC_perc; } - if (pTableSoc->averageSoc_perc[stringNumber] < MINIMUM_SOC_PERC) { - pTableSoc->averageSoc_perc[stringNumber] = MINIMUM_SOC_PERC; + if (pTableSoc->averageSoc_perc[stringNumber] < SOC_MINIMUM_SOC_perc) { + pTableSoc->averageSoc_perc[stringNumber] = SOC_MINIMUM_SOC_perc; } - if (pTableSoc->minimumSoc_perc[stringNumber] > MAXIMUM_SOC_PERC) { - pTableSoc->minimumSoc_perc[stringNumber] = MAXIMUM_SOC_PERC; + if (pTableSoc->minimumSoc_perc[stringNumber] > SOC_MAXIMUM_SOC_perc) { + pTableSoc->minimumSoc_perc[stringNumber] = SOC_MAXIMUM_SOC_perc; } - if (pTableSoc->minimumSoc_perc[stringNumber] < MINIMUM_SOC_PERC) { - pTableSoc->minimumSoc_perc[stringNumber] = MINIMUM_SOC_PERC; + if (pTableSoc->minimumSoc_perc[stringNumber] < SOC_MINIMUM_SOC_perc) { + pTableSoc->minimumSoc_perc[stringNumber] = SOC_MINIMUM_SOC_perc; } - if (pTableSoc->maximumSoc_perc[stringNumber] > MAXIMUM_SOC_PERC) { - pTableSoc->maximumSoc_perc[stringNumber] = MAXIMUM_SOC_PERC; + if (pTableSoc->maximumSoc_perc[stringNumber] > SOC_MAXIMUM_SOC_perc) { + pTableSoc->maximumSoc_perc[stringNumber] = SOC_MAXIMUM_SOC_perc; } - if (pTableSoc->maximumSoc_perc[stringNumber] < MINIMUM_SOC_PERC) { - pTableSoc->maximumSoc_perc[stringNumber] = MINIMUM_SOC_PERC; + if (pTableSoc->maximumSoc_perc[stringNumber] < SOC_MINIMUM_SOC_perc) { + pTableSoc->maximumSoc_perc[stringNumber] = SOC_MINIMUM_SOC_perc; } } @@ -234,7 +235,7 @@ static void SOC_UpdateNvmValues(DATA_BLOCK_SOX_s *pTableSoc, uint8_t stringNumbe /*========== Extern Function Implementations ================================*/ -void SOC_Init(DATA_BLOCK_SOX_s *pSocValues, bool ccPresent, uint8_t stringNumber) { +void SE_InitializeStateOfCharge(DATA_BLOCK_SOX_s *pSocValues, bool ccPresent, uint8_t stringNumber) { FAS_ASSERT(pSocValues != NULL_PTR); FAS_ASSERT(stringNumber < BS_NR_OF_STRINGS); DATA_READ_DATA(&soc_tableCurrentSensor); @@ -258,7 +259,6 @@ void SOC_Init(DATA_BLOCK_SOX_s *pSocValues, bool ccPresent, uint8_t stringNumber soc_state.ccScalingAverage[stringNumber] = fram_soc.averageSoc_perc[stringNumber] + scalingOffset_perc; soc_state.ccScalingMinimum[stringNumber] = fram_soc.minimumSoc_perc[stringNumber] + scalingOffset_perc; soc_state.ccScalingMaximum[stringNumber] = fram_soc.maximumSoc_perc[stringNumber] + scalingOffset_perc; - } else { soc_state.previousTimestamp[stringNumber] = soc_tableCurrentSensor.timestampCurrent[stringNumber]; soc_state.sensorCcUsed[stringNumber] = false; @@ -277,7 +277,7 @@ void SOC_Init(DATA_BLOCK_SOX_s *pSocValues, bool ccPresent, uint8_t stringNumber } /* INCLUDE MARKER FOR THE DOCUMENTATION; DO NOT MOVE cc-documentation-start-include */ -void SOC_Calculation(DATA_BLOCK_SOX_s *pSocValues) { +void SE_CalculateStateOfCharge(DATA_BLOCK_SOX_s *pSocValues) { /* INCLUDE MARKER FOR THE DOCUMENTATION; DO NOT MOVE cc-documentation-stop-include */ FAS_ASSERT(pSocValues != NULL_PTR); bool continueFunction = true; @@ -298,15 +298,15 @@ void SOC_Calculation(DATA_BLOCK_SOX_s *pSocValues) { if (soc_state.sensorCcUsed[s] == false) { /* check if current measurement has been updated */ if (soc_state.previousTimestamp[s] != soc_tableCurrentSensor.timestampCurrent[s]) { - float timestep_s = + float timeStep_s = ((float)(soc_tableCurrentSensor.timestampCurrent[s] - soc_state.previousTimestamp[s])) / 1000.0f; - if (timestep_s > 0.0f) { + if (timeStep_s > 0.0f) { /* Current in charge direction negative means SOC increasing --> BAT naming, not ROB */ float deltaSOC_perc = - (((float)soc_tableCurrentSensor.current_mA[s] * timestep_s) / SOC_STRING_CAPACITY_mAs) * + (((float)soc_tableCurrentSensor.current_mA[s] * timeStep_s) / SOC_STRING_CAPACITY_mAs) * 100.0f / 1000.0f; /* ((mA) * 1s) / 1As) * 100% */ #if POSITIVE_DISCHARGE_CURRENT == false @@ -330,8 +330,7 @@ void SOC_Calculation(DATA_BLOCK_SOX_s *pSocValues) { /* check if cc measurement has been updated */ if (soc_state.previousTimestamp[s] != soc_tableCurrentSensor.timestampCurrentCounting[s]) { float deltaSoc_perc = - (((float)soc_tableCurrentSensor.currentCounter_As[s] / SOC_STRING_CAPACITY_As) * - 100.0f)); + ((float)soc_tableCurrentSensor.currentCounter_As[s] / SOC_STRING_CAPACITY_As) * 100.0f; #if POSITIVE_DISCHARGE_CURRENT == false deltaSoc_perc *= (-1.0f); @@ -357,7 +356,7 @@ void SOC_Calculation(DATA_BLOCK_SOX_s *pSocValues) { } } -float SOC_GetFromVoltage(int16_t voltage_mV) { +extern float SE_GetStateOfChargeFromVoltage(int16_t voltage_mV) { float soc_perc = 0.50f; /* Variables for interpolating LUT value */ @@ -383,7 +382,7 @@ float SOC_GetFromVoltage(int16_t voltage_mV) { (float)voltage_mV); } else if ((between_low >= bc_stateOfChargeLookupTableLength)) { /* LUT SOE values are in descending order: cell voltage < minimum LUT voltage */ - soc_perc = MINIMUM_SOC_PERC; + soc_perc = SOC_MINIMUM_SOC_perc; } else { /* cell voltage > maximum LUT voltage */ soc_perc = 100.0f; diff --git a/src/app/application/algorithm/state_estimation/soc/counting/soc_counting.h b/src/app/application/algorithm/state_estimation/soc/counting/soc_counting.h index eabff223..83618424 100644 --- a/src/app/application/algorithm/state_estimation/soc/counting/soc_counting.h +++ b/src/app/application/algorithm/state_estimation/soc/counting/soc_counting.h @@ -43,8 +43,8 @@ * @file soc_counting.h * @author foxBMS Team * @date 2020-10-07 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup APPLICATION * @prefix SOC * diff --git a/src/app/application/algorithm/state_estimation/soc/counting/soc_counting_cfg.c b/src/app/application/algorithm/state_estimation/soc/counting/soc_counting_cfg.c index 9bd3f359..6321c6c8 100644 --- a/src/app/application/algorithm/state_estimation/soc/counting/soc_counting_cfg.c +++ b/src/app/application/algorithm/state_estimation/soc/counting/soc_counting_cfg.c @@ -43,8 +43,8 @@ * @file soc_counting_cfg.c * @author foxBMS Team * @date 2020-10-07 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup APPLICATION * @prefix SOC * diff --git a/src/app/application/algorithm/state_estimation/soc/counting/soc_counting_cfg.h b/src/app/application/algorithm/state_estimation/soc/counting/soc_counting_cfg.h index 08921163..d038fbc6 100644 --- a/src/app/application/algorithm/state_estimation/soc/counting/soc_counting_cfg.h +++ b/src/app/application/algorithm/state_estimation/soc/counting/soc_counting_cfg.h @@ -43,8 +43,8 @@ * @file soc_counting_cfg.h * @author foxBMS Team * @date 2020-10-07 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup APPLICATION * @prefix SOC * @@ -69,9 +69,10 @@ */ #define SOC_STRING_CAPACITY_mAh ((float)(BS_NR_OF_PARALLEL_CELLS_PER_MODULE * BC_CAPACITY_mAh)) -/** #SOC_STRING_CAPACITY_mAh in As */ +/** #SOC_STRING_CAPACITY_mAh in mAs */ #define SOC_STRING_CAPACITY_mAs ((float)(SOC_STRING_CAPACITY_mAh * 3600.0f)) -#define SOC_STRING_CAPACITY_As ((float)(SOC_STRING_CAPACITY_mAs / 1000.0f) +/** #SOC_STRING_CAPACITY_mAs in As */ +#define SOC_STRING_CAPACITY_As ((float)(SOC_STRING_CAPACITY_mAs / 1000.0f)) /*========== Extern Constant and Variable Declarations ======================*/ diff --git a/src/app/application/algorithm/state_estimation/soc/debug/soc_debug.c b/src/app/application/algorithm/state_estimation/soc/debug/soc_debug.c index c336e931..cf689191 100644 --- a/src/app/application/algorithm/state_estimation/soc/debug/soc_debug.c +++ b/src/app/application/algorithm/state_estimation/soc/debug/soc_debug.c @@ -43,8 +43,8 @@ * @file soc_debug.c * @author foxBMS Team * @date 2020-10-14 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup APPLICATION * @prefix SOC * @@ -66,16 +66,16 @@ /*========== Static Function Implementations ================================*/ /*========== Extern Function Implementations ================================*/ -extern void SOC_Init(DATA_BLOCK_SOX_s *pSocValues, bool ccPresent, uint8_t stringNumber) { +extern void SE_InitializeStateOfCharge(DATA_BLOCK_SOX_s *pSocValues, bool ccPresent, uint8_t stringNumber) { FAS_ASSERT(pSocValues != NULL_PTR); FAS_ASSERT(stringNumber < BS_NR_OF_STRINGS); } -extern void SOC_Calculation(DATA_BLOCK_SOX_s *pSocValues) { +extern void SE_CalculateStateOfCharge(DATA_BLOCK_SOX_s *pSocValues) { FAS_ASSERT(pSocValues != NULL_PTR); } -extern float SOC_GetFromVoltage(int16_t voltage_mV) { +extern float SE_GetStateOfChargeFromVoltage(int16_t voltage_mV) { return 0.50f; } diff --git a/src/app/application/algorithm/state_estimation/soc/debug/soc_debug.h b/src/app/application/algorithm/state_estimation/soc/debug/soc_debug.h index 5fdf7a69..e85a86f5 100644 --- a/src/app/application/algorithm/state_estimation/soc/debug/soc_debug.h +++ b/src/app/application/algorithm/state_estimation/soc/debug/soc_debug.h @@ -43,8 +43,8 @@ * @file soc_debug.h * @author foxBMS Team * @date 2020-10-14 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup APPLICATION * @prefix SOC * diff --git a/src/app/application/algorithm/state_estimation/soc/debug/soc_debug_cfg.c b/src/app/application/algorithm/state_estimation/soc/debug/soc_debug_cfg.c index 6805c728..61196196 100644 --- a/src/app/application/algorithm/state_estimation/soc/debug/soc_debug_cfg.c +++ b/src/app/application/algorithm/state_estimation/soc/debug/soc_debug_cfg.c @@ -43,8 +43,8 @@ * @file soc_debug_cfg.c * @author foxBMS Team * @date 2020-10-07 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup APPLICATION * @prefix SOC * diff --git a/src/app/application/algorithm/state_estimation/soc/debug/soc_debug_cfg.h b/src/app/application/algorithm/state_estimation/soc/debug/soc_debug_cfg.h index 5ae8c78b..f1ee3920 100644 --- a/src/app/application/algorithm/state_estimation/soc/debug/soc_debug_cfg.h +++ b/src/app/application/algorithm/state_estimation/soc/debug/soc_debug_cfg.h @@ -43,8 +43,8 @@ * @file soc_debug_cfg.h * @author foxBMS Team * @date 2020-10-07 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup APPLICATION * @prefix SOC * diff --git a/src/app/application/algorithm/state_estimation/soc/none/soc_none.c b/src/app/application/algorithm/state_estimation/soc/none/soc_none.c index 911de357..c60a18fa 100644 --- a/src/app/application/algorithm/state_estimation/soc/none/soc_none.c +++ b/src/app/application/algorithm/state_estimation/soc/none/soc_none.c @@ -43,8 +43,8 @@ * @file soc_none.c * @author foxBMS Team * @date 2020-10-14 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup APPLICATION * @prefix SOC * @@ -66,16 +66,16 @@ /*========== Static Function Implementations ================================*/ /*========== Extern Function Implementations ================================*/ -extern void SOC_Init(DATA_BLOCK_SOX_s *pSocValues, bool ccPresent, uint8_t stringNumber) { +extern void SE_InitializeStateOfCharge(DATA_BLOCK_SOX_s *pSocValues, bool ccPresent, uint8_t stringNumber) { FAS_ASSERT(pSocValues != NULL_PTR); FAS_ASSERT(stringNumber < BS_NR_OF_STRINGS); } -extern void SOC_Calculation(DATA_BLOCK_SOX_s *pSocValues) { +extern void SE_CalculateStateOfCharge(DATA_BLOCK_SOX_s *pSocValues) { FAS_ASSERT(pSocValues != NULL_PTR); } -extern float SOC_GetFromVoltage(int16_t voltage_mV) { +extern float SE_GetStateOfChargeFromVoltage(int16_t voltage_mV) { return 0.0f; } diff --git a/src/app/application/algorithm/state_estimation/soc/none/soc_none.h b/src/app/application/algorithm/state_estimation/soc/none/soc_none.h index 4aa43ab9..803736c4 100644 --- a/src/app/application/algorithm/state_estimation/soc/none/soc_none.h +++ b/src/app/application/algorithm/state_estimation/soc/none/soc_none.h @@ -43,8 +43,8 @@ * @file soc_none.h * @author foxBMS Team * @date 2020-10-14 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup APPLICATION * @prefix SOC * diff --git a/src/app/application/algorithm/state_estimation/soc/none/soc_none_cfg.c b/src/app/application/algorithm/state_estimation/soc/none/soc_none_cfg.c index 81e95ba7..aa450060 100644 --- a/src/app/application/algorithm/state_estimation/soc/none/soc_none_cfg.c +++ b/src/app/application/algorithm/state_estimation/soc/none/soc_none_cfg.c @@ -43,8 +43,8 @@ * @file soc_none_cfg.c * @author foxBMS Team * @date 2020-10-07 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup APPLICATION * @prefix SOC * diff --git a/src/app/application/algorithm/state_estimation/soc/none/soc_none_cfg.h b/src/app/application/algorithm/state_estimation/soc/none/soc_none_cfg.h index 160f14b2..f503be01 100644 --- a/src/app/application/algorithm/state_estimation/soc/none/soc_none_cfg.h +++ b/src/app/application/algorithm/state_estimation/soc/none/soc_none_cfg.h @@ -43,8 +43,8 @@ * @file soc_none_cfg.h * @author foxBMS Team * @date 2020-10-07 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup APPLICATION * @prefix SOC * diff --git a/src/app/application/algorithm/state_estimation/soe/counting/soe_counting.c b/src/app/application/algorithm/state_estimation/soe/counting/soe_counting.c index 37b3cc85..72d3a12f 100644 --- a/src/app/application/algorithm/state_estimation/soe/counting/soe_counting.c +++ b/src/app/application/algorithm/state_estimation/soe/counting/soe_counting.c @@ -43,8 +43,8 @@ * @file soe_counting.c * @author foxBMS Team * @date 2020-10-07 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup APPLICATION * @prefix SOE * @@ -89,11 +89,11 @@ typedef struct { */ static SOE_STATE_s soe_state = { .soeInitialized = false, - .sensorEcUsed = {REPEAT_U(false, STRIP(BS_NR_OF_STRINGS))}, - .ecScalingAverage = {REPEAT_U(0.0f, STRIP(BS_NR_OF_STRINGS))}, - .ecScalingMinimum = {REPEAT_U(0.0f, STRIP(BS_NR_OF_STRINGS))}, - .ecScalingMaximum = {REPEAT_U(0.0f, STRIP(BS_NR_OF_STRINGS))}, - .previousTimestamp = {REPEAT_U(0u, STRIP(BS_NR_OF_STRINGS))}, + .sensorEcUsed = {GEN_REPEAT_U(false, GEN_STRIP(BS_NR_OF_STRINGS))}, + .ecScalingAverage = {GEN_REPEAT_U(0.0f, GEN_STRIP(BS_NR_OF_STRINGS))}, + .ecScalingMinimum = {GEN_REPEAT_U(0.0f, GEN_STRIP(BS_NR_OF_STRINGS))}, + .ecScalingMaximum = {GEN_REPEAT_U(0.0f, GEN_STRIP(BS_NR_OF_STRINGS))}, + .previousTimestamp = {GEN_REPEAT_U(0u, GEN_STRIP(BS_NR_OF_STRINGS))}, }; /** local copies of database tables */ @@ -309,7 +309,7 @@ static void SOE_CheckDatabaseSoePercentageLimits(DATA_BLOCK_SOX_s *pTableSoe, ui /*========== Extern Function Implementations ================================*/ -extern void SOE_Init(DATA_BLOCK_SOX_s *pSoeValues, bool ec_present, uint8_t stringNumber) { +extern void SE_InitializeStateOfEnergy(DATA_BLOCK_SOX_s *pSoeValues, bool ec_present, uint8_t stringNumber) { FAS_ASSERT(pSoeValues != NULL_PTR); FAS_ASSERT(stringNumber < BS_NR_OF_STRINGS); FRAM_ReadData(FRAM_BLOCK_ID_SOE); @@ -353,7 +353,7 @@ extern void SOE_Init(DATA_BLOCK_SOX_s *pSoeValues, bool ec_present, uint8_t stri soe_state.soeInitialized = true; } -void SOE_Calculation(DATA_BLOCK_SOX_s *pSoeValues) { +void SE_CalculateStateOfEnergy(DATA_BLOCK_SOX_s *pSoeValues) { FAS_ASSERT(pSoeValues != NULL_PTR); bool continueFunction = true; if (soe_state.soeInitialized == false) { diff --git a/src/app/application/algorithm/state_estimation/soe/counting/soe_counting.h b/src/app/application/algorithm/state_estimation/soe/counting/soe_counting.h index e21f4c94..f74196e0 100644 --- a/src/app/application/algorithm/state_estimation/soe/counting/soe_counting.h +++ b/src/app/application/algorithm/state_estimation/soe/counting/soe_counting.h @@ -43,8 +43,8 @@ * @file soe_counting.h * @author foxBMS Team * @date 2020-10-07 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup APPLICATION * @prefix SOE * diff --git a/src/app/application/algorithm/state_estimation/soe/counting/soe_counting_cfg.c b/src/app/application/algorithm/state_estimation/soe/counting/soe_counting_cfg.c index 2e509d5c..f9ff5e9b 100644 --- a/src/app/application/algorithm/state_estimation/soe/counting/soe_counting_cfg.c +++ b/src/app/application/algorithm/state_estimation/soe/counting/soe_counting_cfg.c @@ -43,8 +43,8 @@ * @file soe_counting_cfg.c * @author foxBMS Team * @date 2020-10-07 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup APPLICATION * @prefix SOE * diff --git a/src/app/application/algorithm/state_estimation/soe/counting/soe_counting_cfg.h b/src/app/application/algorithm/state_estimation/soe/counting/soe_counting_cfg.h index ddf133a4..0cdf27f0 100644 --- a/src/app/application/algorithm/state_estimation/soe/counting/soe_counting_cfg.h +++ b/src/app/application/algorithm/state_estimation/soe/counting/soe_counting_cfg.h @@ -43,8 +43,8 @@ * @file soe_counting_cfg.h * @author foxBMS Team * @date 2020-10-07 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup APPLICATION * @prefix SOE * diff --git a/src/app/application/algorithm/state_estimation/soe/debug/soe_debug.c b/src/app/application/algorithm/state_estimation/soe/debug/soe_debug.c index 31958080..eb2ddc8c 100644 --- a/src/app/application/algorithm/state_estimation/soe/debug/soe_debug.c +++ b/src/app/application/algorithm/state_estimation/soe/debug/soe_debug.c @@ -43,8 +43,8 @@ * @file soe_debug.c * @author foxBMS Team * @date 2020-10-14 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup APPLICATION * @prefix SOE * @@ -66,12 +66,12 @@ /*========== Static Function Implementations ================================*/ /*========== Extern Function Implementations ================================*/ -extern void SOE_Init(DATA_BLOCK_SOX_s *pSoeValues, bool ec_present, uint8_t stringNumber) { +extern void SE_InitializeStateOfEnergy(DATA_BLOCK_SOX_s *pSoeValues, bool ec_present, uint8_t stringNumber) { FAS_ASSERT(pSoeValues != NULL_PTR); FAS_ASSERT(stringNumber < BS_NR_OF_STRINGS); } -extern void SOE_Calculation(DATA_BLOCK_SOX_s *pSoeValues) { +extern void SE_CalculateStateOfEnergy(DATA_BLOCK_SOX_s *pSoeValues) { FAS_ASSERT(pSoeValues != NULL_PTR); } diff --git a/src/app/application/algorithm/state_estimation/soe/debug/soe_debug.h b/src/app/application/algorithm/state_estimation/soe/debug/soe_debug.h index 607e7aed..5e04adfe 100644 --- a/src/app/application/algorithm/state_estimation/soe/debug/soe_debug.h +++ b/src/app/application/algorithm/state_estimation/soe/debug/soe_debug.h @@ -43,8 +43,8 @@ * @file soe_debug.h * @author foxBMS Team * @date 2020-10-14 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup APPLICATION * @prefix SOE * diff --git a/src/app/application/algorithm/state_estimation/soe/debug/soe_debug_cfg.c b/src/app/application/algorithm/state_estimation/soe/debug/soe_debug_cfg.c index 75f69031..31149fe2 100644 --- a/src/app/application/algorithm/state_estimation/soe/debug/soe_debug_cfg.c +++ b/src/app/application/algorithm/state_estimation/soe/debug/soe_debug_cfg.c @@ -43,8 +43,8 @@ * @file soe_debug_cfg.c * @author foxBMS Team * @date 2020-10-07 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup APPLICATION * @prefix SOE * diff --git a/src/app/application/algorithm/state_estimation/soe/debug/soe_debug_cfg.h b/src/app/application/algorithm/state_estimation/soe/debug/soe_debug_cfg.h index 21555441..3cbf546f 100644 --- a/src/app/application/algorithm/state_estimation/soe/debug/soe_debug_cfg.h +++ b/src/app/application/algorithm/state_estimation/soe/debug/soe_debug_cfg.h @@ -43,8 +43,8 @@ * @file soe_debug_cfg.h * @author foxBMS Team * @date 2020-10-07 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup APPLICATION * @prefix SOE * diff --git a/src/app/application/algorithm/state_estimation/soe/none/soe_none.c b/src/app/application/algorithm/state_estimation/soe/none/soe_none.c index 2292311a..d063e9a9 100644 --- a/src/app/application/algorithm/state_estimation/soe/none/soe_none.c +++ b/src/app/application/algorithm/state_estimation/soe/none/soe_none.c @@ -43,8 +43,8 @@ * @file soe_none.c * @author foxBMS Team * @date 2020-10-14 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup APPLICATION * @prefix SOE * @@ -66,12 +66,12 @@ /*========== Static Function Implementations ================================*/ /*========== Extern Function Implementations ================================*/ -extern void SOE_Init(DATA_BLOCK_SOX_s *pSoeValues, bool ec_present, uint8_t stringNumber) { +extern void SE_InitializeStateOfEnergy(DATA_BLOCK_SOX_s *pSoeValues, bool ec_present, uint8_t stringNumber) { FAS_ASSERT(pSoeValues != NULL_PTR); FAS_ASSERT(stringNumber < BS_NR_OF_STRINGS); } -extern void SOE_Calculation(DATA_BLOCK_SOX_s *pSoeValues) { +extern void SE_CalculateStateOfEnergy(DATA_BLOCK_SOX_s *pSoeValues) { FAS_ASSERT(pSoeValues != NULL_PTR); } diff --git a/src/app/application/algorithm/state_estimation/soe/none/soe_none.h b/src/app/application/algorithm/state_estimation/soe/none/soe_none.h index fe41c2d8..67a841d8 100644 --- a/src/app/application/algorithm/state_estimation/soe/none/soe_none.h +++ b/src/app/application/algorithm/state_estimation/soe/none/soe_none.h @@ -43,8 +43,8 @@ * @file soe_none.h * @author foxBMS Team * @date 2020-10-14 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup APPLICATION * @prefix SOE * diff --git a/src/app/application/algorithm/state_estimation/soe/none/soe_none_cfg.c b/src/app/application/algorithm/state_estimation/soe/none/soe_none_cfg.c index 7bdb5c2b..8e651e03 100644 --- a/src/app/application/algorithm/state_estimation/soe/none/soe_none_cfg.c +++ b/src/app/application/algorithm/state_estimation/soe/none/soe_none_cfg.c @@ -43,8 +43,8 @@ * @file soe_none_cfg.c * @author foxBMS Team * @date 2020-10-07 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup APPLICATION * @prefix SOE * diff --git a/src/app/application/algorithm/state_estimation/soe/none/soe_none_cfg.h b/src/app/application/algorithm/state_estimation/soe/none/soe_none_cfg.h index 0f981bf6..9f08deaf 100644 --- a/src/app/application/algorithm/state_estimation/soe/none/soe_none_cfg.h +++ b/src/app/application/algorithm/state_estimation/soe/none/soe_none_cfg.h @@ -43,8 +43,8 @@ * @file soe_none_cfg.h * @author foxBMS Team * @date 2020-10-07 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup APPLICATION * @prefix SOE * diff --git a/src/app/application/algorithm/state_estimation/sof/trapezoid/sof.c b/src/app/application/algorithm/state_estimation/sof/trapezoid/sof_trapezoid.c similarity index 99% rename from src/app/application/algorithm/state_estimation/sof/trapezoid/sof.c rename to src/app/application/algorithm/state_estimation/sof/trapezoid/sof_trapezoid.c index 4bec59d2..3e35b306 100644 --- a/src/app/application/algorithm/state_estimation/sof/trapezoid/sof.c +++ b/src/app/application/algorithm/state_estimation/sof/trapezoid/sof_trapezoid.c @@ -40,11 +40,11 @@ */ /** - * @file sof.c + * @file sof_trapezoid.c * @author foxBMS Team * @date 2020-10-07 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup APPLICATION_CONFIGURATION * @prefix SOF * @@ -53,7 +53,7 @@ */ /*========== Includes =======================================================*/ -#include "sof.h" +#include "sof_trapezoid.h" #include "battery_cell_cfg.h" #include "battery_system_cfg.h" @@ -61,6 +61,7 @@ #include "bms.h" #include "database.h" #include "foxmath.h" +#include "state_estimation.h" #include diff --git a/src/app/application/algorithm/state_estimation/sof/trapezoid/sof.h b/src/app/application/algorithm/state_estimation/sof/trapezoid/sof_trapezoid.h similarity index 96% rename from src/app/application/algorithm/state_estimation/sof/trapezoid/sof.h rename to src/app/application/algorithm/state_estimation/sof/trapezoid/sof_trapezoid.h index c9b805da..4ced08c9 100644 --- a/src/app/application/algorithm/state_estimation/sof/trapezoid/sof.h +++ b/src/app/application/algorithm/state_estimation/sof/trapezoid/sof_trapezoid.h @@ -40,11 +40,11 @@ */ /** - * @file sof.h + * @file sof_trapezoid.h * @author foxBMS Team * @date 2020-10-07 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup APPLICATION * @prefix SOF * @@ -52,11 +52,11 @@ * */ -#ifndef FOXBMS__SOF_H_ -#define FOXBMS__SOF_H_ +#ifndef FOXBMS__SOF_TRAPEZOID_H_ +#define FOXBMS__SOF_TRAPEZOID_H_ /*========== Includes =======================================================*/ -#include "sof_cfg.h" +#include "sof_trapezoid_cfg.h" /*========== Macros and Definitions =========================================*/ /** @@ -128,4 +128,4 @@ extern SOF_CURRENT_LIMITS_s TEST_SOF_MinimumOfTwoSofValues( SOF_CURRENT_LIMITS_s voltageBasedLimits, SOF_CURRENT_LIMITS_s temperatureBasedLimits); #endif /* UNITY_UNIT_TEST */ -#endif /* FOXBMS__SOF_H_ */ +#endif /* FOXBMS__SOF_TRAPEZOID_H_ */ diff --git a/src/app/application/algorithm/state_estimation/sof/trapezoid/sof_cfg.c b/src/app/application/algorithm/state_estimation/sof/trapezoid/sof_trapezoid_cfg.c similarity index 98% rename from src/app/application/algorithm/state_estimation/sof/trapezoid/sof_cfg.c rename to src/app/application/algorithm/state_estimation/sof/trapezoid/sof_trapezoid_cfg.c index 74bf704a..8f36e86e 100644 --- a/src/app/application/algorithm/state_estimation/sof/trapezoid/sof_cfg.c +++ b/src/app/application/algorithm/state_estimation/sof/trapezoid/sof_trapezoid_cfg.c @@ -40,11 +40,11 @@ */ /** - * @file sof_cfg.c + * @file sof_trapezoid_cfg.c * @author foxBMS Team * @date 2020-10-07 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup APPLICATION * @prefix SOF * @@ -53,7 +53,7 @@ */ /*========== Includes =======================================================*/ -#include "sof_cfg.h" +#include "sof_trapezoid_cfg.h" /*========== Macros and Definitions =========================================*/ diff --git a/src/app/application/algorithm/state_estimation/sof/trapezoid/sof_cfg.h b/src/app/application/algorithm/state_estimation/sof/trapezoid/sof_trapezoid_cfg.h similarity index 98% rename from src/app/application/algorithm/state_estimation/sof/trapezoid/sof_cfg.h rename to src/app/application/algorithm/state_estimation/sof/trapezoid/sof_trapezoid_cfg.h index a5c8e21b..35313f8d 100644 --- a/src/app/application/algorithm/state_estimation/sof/trapezoid/sof_cfg.h +++ b/src/app/application/algorithm/state_estimation/sof/trapezoid/sof_trapezoid_cfg.h @@ -40,11 +40,11 @@ */ /** - * @file sof_cfg.h + * @file sof_trapezoid_cfg.h * @author foxBMS Team * @date 2020-10-07 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup APPLICATION_CONFIGURATION * @prefix SOF * @@ -52,8 +52,8 @@ * */ -#ifndef FOXBMS__SOF_CFG_H_ -#define FOXBMS__SOF_CFG_H_ +#ifndef FOXBMS__SOF_TRAPEZOID_CFG_H_ +#define FOXBMS__SOF_TRAPEZOID_CFG_H_ /*========== Includes =======================================================*/ #include "general.h" @@ -369,4 +369,4 @@ extern const SOF_CONFIG_s sof_configMaximumSafetyLimit; /*========== Externalized Static Functions Prototypes (Unit Test) ===========*/ -#endif /* FOXBMS__SOF_CFG_H_ */ +#endif /* FOXBMS__SOF_TRAPEZOID_CFG_H_ */ diff --git a/src/app/application/algorithm/state_estimation/soh/debug/soh_debug.c b/src/app/application/algorithm/state_estimation/soh/debug/soh_debug.c index 6ec4254e..9516320b 100644 --- a/src/app/application/algorithm/state_estimation/soh/debug/soh_debug.c +++ b/src/app/application/algorithm/state_estimation/soh/debug/soh_debug.c @@ -43,8 +43,8 @@ * @file soh_debug.c * @author foxBMS Team * @date 2020-10-14 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup APPLICATION * @prefix SOH * @@ -66,7 +66,7 @@ /*========== Static Function Implementations ================================*/ /*========== Extern Function Implementations ================================*/ -extern void SOH_Init(DATA_BLOCK_SOX_s *pSohValues, uint8_t stringNumber) { +extern void SE_InitializeStateOfHealth(DATA_BLOCK_SOX_s *pSohValues, uint8_t stringNumber) { FAS_ASSERT(pSohValues != NULL_PTR); FAS_ASSERT(stringNumber < BS_NR_OF_STRINGS); if (stringNumber < BS_NR_OF_STRINGS) { @@ -76,7 +76,7 @@ extern void SOH_Init(DATA_BLOCK_SOX_s *pSohValues, uint8_t stringNumber) { } } -extern void SOH_Calculation(DATA_BLOCK_SOX_s *pSohValues) { +extern void SE_CalculateStateOfHealth(DATA_BLOCK_SOX_s *pSohValues) { FAS_ASSERT(pSohValues != NULL_PTR); pSohValues->averageSoh_perc[0u] = 50.0f; diff --git a/src/app/application/algorithm/state_estimation/soh/debug/soh_debug.h b/src/app/application/algorithm/state_estimation/soh/debug/soh_debug.h index 0fb750ce..2e797bea 100644 --- a/src/app/application/algorithm/state_estimation/soh/debug/soh_debug.h +++ b/src/app/application/algorithm/state_estimation/soh/debug/soh_debug.h @@ -43,8 +43,8 @@ * @file soh_debug.h * @author foxBMS Team * @date 2020-10-14 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup APPLICATION * @prefix SOH * diff --git a/src/app/application/algorithm/state_estimation/soh/debug/soh_debug_cfg.c b/src/app/application/algorithm/state_estimation/soh/debug/soh_debug_cfg.c index 6b26f193..1876d59e 100644 --- a/src/app/application/algorithm/state_estimation/soh/debug/soh_debug_cfg.c +++ b/src/app/application/algorithm/state_estimation/soh/debug/soh_debug_cfg.c @@ -43,8 +43,8 @@ * @file soh_debug_cfg.c * @author foxBMS Team * @date 2021-12-14 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup APPLICATION * @prefix SOH * diff --git a/src/app/application/algorithm/state_estimation/soh/debug/soh_debug_cfg.h b/src/app/application/algorithm/state_estimation/soh/debug/soh_debug_cfg.h index bfeaab52..16ebbdf6 100644 --- a/src/app/application/algorithm/state_estimation/soh/debug/soh_debug_cfg.h +++ b/src/app/application/algorithm/state_estimation/soh/debug/soh_debug_cfg.h @@ -43,8 +43,8 @@ * @file soh_debug_cfg.h * @author foxBMS Team * @date 2021-12-14 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup APPLICATION * @prefix SOH * diff --git a/src/app/application/algorithm/state_estimation/soh/none/soh_none.c b/src/app/application/algorithm/state_estimation/soh/none/soh_none.c index a484d15b..1157bd41 100644 --- a/src/app/application/algorithm/state_estimation/soh/none/soh_none.c +++ b/src/app/application/algorithm/state_estimation/soh/none/soh_none.c @@ -43,8 +43,8 @@ * @file soh_none.c * @author foxBMS Team * @date 2020-10-14 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup APPLICATION * @prefix SOH * @@ -66,12 +66,12 @@ /*========== Static Function Implementations ================================*/ /*========== Extern Function Implementations ================================*/ -extern void SOH_Init(DATA_BLOCK_SOX_s *pSohValues, uint8_t stringNumber) { +extern void SE_InitializeStateOfHealth(DATA_BLOCK_SOX_s *pSohValues, uint8_t stringNumber) { FAS_ASSERT(pSohValues != NULL_PTR); FAS_ASSERT(stringNumber < BS_NR_OF_STRINGS); } -extern void SOH_Calculation(DATA_BLOCK_SOX_s *pSohValues) { +extern void SE_CalculateStateOfHealth(DATA_BLOCK_SOX_s *pSohValues) { FAS_ASSERT(pSohValues != NULL_PTR); } diff --git a/src/app/application/algorithm/state_estimation/soh/none/soh_none.h b/src/app/application/algorithm/state_estimation/soh/none/soh_none.h index a26c091a..d55e92f7 100644 --- a/src/app/application/algorithm/state_estimation/soh/none/soh_none.h +++ b/src/app/application/algorithm/state_estimation/soh/none/soh_none.h @@ -43,8 +43,8 @@ * @file soh_none.h * @author foxBMS Team * @date 2020-10-14 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup APPLICATION * @prefix SOH * diff --git a/src/app/application/algorithm/state_estimation/soh/none/soh_none_cfg.c b/src/app/application/algorithm/state_estimation/soh/none/soh_none_cfg.c index 3acb2e2a..12bbc66e 100644 --- a/src/app/application/algorithm/state_estimation/soh/none/soh_none_cfg.c +++ b/src/app/application/algorithm/state_estimation/soh/none/soh_none_cfg.c @@ -43,8 +43,8 @@ * @file soh_none_cfg.c * @author foxBMS Team * @date 2021-12-14 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup APPLICATION * @prefix SOH * diff --git a/src/app/application/algorithm/state_estimation/soh/none/soh_none_cfg.h b/src/app/application/algorithm/state_estimation/soh/none/soh_none_cfg.h index d976b913..5f772f47 100644 --- a/src/app/application/algorithm/state_estimation/soh/none/soh_none_cfg.h +++ b/src/app/application/algorithm/state_estimation/soh/none/soh_none_cfg.h @@ -43,8 +43,8 @@ * @file soh_none_cfg.h * @author foxBMS Team * @date 2021-12-14 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup APPLICATION * @prefix SOH * diff --git a/src/app/application/algorithm/state_estimation/state_estimation.c b/src/app/application/algorithm/state_estimation/state_estimation.c index 10b763bb..ba8845d2 100644 --- a/src/app/application/algorithm/state_estimation/state_estimation.c +++ b/src/app/application/algorithm/state_estimation/state_estimation.c @@ -43,8 +43,8 @@ * @file state_estimation.c * @author foxBMS Team * @date 2020-10-07 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup APPLICATION * @prefix SE * @@ -72,26 +72,26 @@ static DATA_BLOCK_SOX_s se_tableSocAndSoeEstimation = {.header.uniqueId = DATA_B /*========== Extern Function Implementations ================================*/ extern void SE_InitializeSoc(bool ccPresent, uint8_t stringNumber) { FAS_ASSERT(stringNumber < BS_NR_OF_STRINGS); - SOC_Init(&se_tableSocAndSoeEstimation, ccPresent, stringNumber); + SE_InitializeStateOfCharge(&se_tableSocAndSoeEstimation, ccPresent, stringNumber); DATA_WRITE_DATA(&se_tableSocAndSoeEstimation); } extern void SE_InitializeSoe(bool ec_present, uint8_t stringNumber) { FAS_ASSERT(stringNumber < BS_NR_OF_STRINGS); - SOE_Init(&se_tableSocAndSoeEstimation, ec_present, stringNumber); + SE_InitializeStateOfEnergy(&se_tableSocAndSoeEstimation, ec_present, stringNumber); DATA_WRITE_DATA(&se_tableSocAndSoeEstimation); } extern void SE_InitializeSoh(uint8_t stringNumber) { FAS_ASSERT(stringNumber < BS_NR_OF_STRINGS); - SOH_Init(&se_tableSocAndSoeEstimation, stringNumber); + SE_InitializeStateOfHealth(&se_tableSocAndSoeEstimation, stringNumber); DATA_WRITE_DATA(&se_tableSocAndSoeEstimation); } extern void SE_RunStateEstimations(void) { - SOC_Calculation(&se_tableSocAndSoeEstimation); - SOE_Calculation(&se_tableSocAndSoeEstimation); - SOH_Calculation(&se_tableSocAndSoeEstimation); + SE_CalculateStateOfCharge(&se_tableSocAndSoeEstimation); + SE_CalculateStateOfEnergy(&se_tableSocAndSoeEstimation); + SE_CalculateStateOfHealth(&se_tableSocAndSoeEstimation); DATA_WRITE_DATA(&se_tableSocAndSoeEstimation); } diff --git a/src/app/application/algorithm/state_estimation/state_estimation.h b/src/app/application/algorithm/state_estimation/state_estimation.h index ee7a844e..edff32e4 100644 --- a/src/app/application/algorithm/state_estimation/state_estimation.h +++ b/src/app/application/algorithm/state_estimation/state_estimation.h @@ -43,8 +43,8 @@ * @file state_estimation.h * @author foxBMS Team * @date 2020-10-14 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup APPLICATION * @prefix SE * @@ -105,20 +105,20 @@ extern void SE_RunStateEstimations(void); * @param[in] ccPresent true if current sensor present, false otherwise * @param[in] stringNumber string addressed */ -extern void SOC_Init(DATA_BLOCK_SOX_s *pSocValues, bool ccPresent, uint8_t stringNumber); +extern void SE_InitializeStateOfCharge(DATA_BLOCK_SOX_s *pSocValues, bool ccPresent, uint8_t stringNumber); /** * @brief periodically called algorithm to calculate state-of-charge (SOC) * @param[out] pSocValues pointer to SOC values */ -extern void SOC_Calculation(DATA_BLOCK_SOX_s *pSocValues); +extern void SE_CalculateStateOfCharge(DATA_BLOCK_SOX_s *pSocValues); /** * @brief look-up table for SOC initialization * @param[in] voltage_mV voltage in mV of battery cell * @return returns SOC value in percentage from 0.0% to 100.0% */ -extern float SOC_GetFromVoltage(int16_t voltage_mV); +extern float SE_GetStateOfChargeFromVoltage(int16_t voltage_mV); /** * @brief initializes startup state-of-energy (SOE) related values @@ -126,26 +126,26 @@ extern float SOC_GetFromVoltage(int16_t voltage_mV); * @param[in] ec_present true if current sensor EC message received, false otherwise * @param[in] stringNumber string addressed */ -extern void SOE_Init(DATA_BLOCK_SOX_s *pSoeValues, bool ec_present, uint8_t stringNumber); +extern void SE_InitializeStateOfEnergy(DATA_BLOCK_SOX_s *pSoeValues, bool ec_present, uint8_t stringNumber); /** * @brief periodically called algorithm to calculate state-of-energy (SOE) * @param[out] pSoeValues pointer to SOE database entry */ -extern void SOE_Calculation(DATA_BLOCK_SOX_s *pSoeValues); +extern void SE_CalculateStateOfEnergy(DATA_BLOCK_SOX_s *pSoeValues); /** * @brief initializes startup state-of-health related values * @param[out] pSohValues pointer to SOH database entry * @param[in] stringNumber string addressed */ -extern void SOH_Init(DATA_BLOCK_SOX_s *pSohValues, uint8_t stringNumber); +extern void SE_InitializeStateOfHealth(DATA_BLOCK_SOX_s *pSohValues, uint8_t stringNumber); /** * @brief calculates state-of-health (SOH) * @param[out] pSohValues pointer to SOH database entry */ -extern void SOH_Calculation(DATA_BLOCK_SOX_s *pSohValues); +extern void SE_CalculateStateOfHealth(DATA_BLOCK_SOX_s *pSohValues); /** INCLUDE MARKER FOR THE DOCUMENTATION; DO NOT MOVE se-state-estimation-api-stop-include * @} diff --git a/src/app/application/algorithm/wscript b/src/app/application/algorithm/wscript index a3c523dd..ebed4fb4 100644 --- a/src/app/application/algorithm/wscript +++ b/src/app/application/algorithm/wscript @@ -45,9 +45,10 @@ import os def build(bld): """builds the algorithm library""" - soc = bld.env.ALGORITHM_SOC - soe = bld.env.ALGORITHM_SOE - soh = bld.env.ALGORITHM_SOH + soc = bld.env.state_estimator_soc + soe = bld.env.state_estimator_soe + sof = bld.env.state_estimator_sof + soh = bld.env.state_estimator_soh source = [ os.path.join("algorithm.c"), os.path.join("config", "algorithm_cfg.c"), @@ -56,11 +57,11 @@ def build(bld): os.path.join("state_estimation", "soc", soc, f"soc_{soc}.c"), os.path.join("state_estimation", "soe", soe, f"soe_{soe}_cfg.c"), os.path.join("state_estimation", "soe", soe, f"soe_{soe}.c"), + os.path.join("state_estimation", "sof", sof, f"sof_{sof}.c"), + os.path.join("state_estimation", "sof", sof, f"sof_{sof}_cfg.c"), os.path.join("state_estimation", "soh", soh, f"soh_{soh}.c"), os.path.join("state_estimation", "soh", soh, f"soh_{soh}_cfg.c"), os.path.join(".", "state_estimation", "state_estimation.c"), - os.path.join(".", "state_estimation", "sof", "trapezoid", "sof.c"), - os.path.join(".", "state_estimation", "sof", "trapezoid", "sof_cfg.c"), ] includes = [ ".", @@ -69,8 +70,8 @@ def build(bld): "state_estimation", os.path.join("state_estimation", "soc", soc), os.path.join("state_estimation", "soe", soe), + os.path.join("state_estimation", "sof", sof), os.path.join("state_estimation", "soh", soh), - os.path.join("state_estimation", "sof", "trapezoid"), os.path.join("..", "config"), os.path.join("..", "..", "application", "bms"), os.path.join("..", "..", "driver", "config"), @@ -86,7 +87,7 @@ def build(bld): os.path.join("..", "..", "task", "config"), os.path.join("..", "..", "task", "os"), ] - includes.extend(bld.env.INCLUDES_OPERATING_SYSTEM) + includes.extend(bld.env.INCLUDES_RTOS) cflags = bld.env.CFLAGS_FOXBMS target = f"{bld.env.APPNAME.lower()}-algorithms" bld.stlib( diff --git a/src/app/application/bal/bal.c b/src/app/application/bal/bal.c index de72bc92..11cdc97f 100644 --- a/src/app/application/bal/bal.c +++ b/src/app/application/bal/bal.c @@ -43,8 +43,8 @@ * @file bal.c * @author foxBMS Team * @date 2020-02-24 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup APPLICATION * @prefix BAL * diff --git a/src/app/application/bal/bal.h b/src/app/application/bal/bal.h index b7027073..3fd03a57 100644 --- a/src/app/application/bal/bal.h +++ b/src/app/application/bal/bal.h @@ -43,8 +43,8 @@ * @file bal.h * @author foxBMS Team * @date 2020-02-24 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup APPLICATION * @prefix BAL * diff --git a/src/app/application/bal/history/bal_strategy_history.c b/src/app/application/bal/history/bal_strategy_history.c index fee1de9e..124fb8ee 100644 --- a/src/app/application/bal/history/bal_strategy_history.c +++ b/src/app/application/bal/history/bal_strategy_history.c @@ -43,8 +43,8 @@ * @file bal_strategy_history.c * @author foxBMS Team * @date 2020-05-29 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup APPLICATION * @prefix BAL * @@ -68,7 +68,7 @@ /** local storage of the #DATA_BLOCK_BALANCING_CONTROL_s table */ static DATA_BLOCK_BALANCING_CONTROL_s bal_balancing = {.header.uniqueId = DATA_BLOCK_ID_BALANCING_CONTROL}; /** local storage of the #DATA_BLOCK_CELL_VOLTAGE_s table */ -static DATA_BLOCK_CELL_VOLTAGE_s bal_cellvoltage = {.header.uniqueId = DATA_BLOCK_ID_CELL_VOLTAGE}; +static DATA_BLOCK_CELL_VOLTAGE_s bal_cellVoltage = {.header.uniqueId = DATA_BLOCK_ID_CELL_VOLTAGE}; /** contains the state of the contactor state machine */ static BAL_STATE_s bal_state = { @@ -123,7 +123,7 @@ static void BAL_ActivateBalancing(void) { float cellBalancingCurrent = 0.0f; uint32_t difference = 0; - DATA_READ_DATA(&bal_balancing, &bal_cellvoltage); + DATA_READ_DATA(&bal_balancing, &bal_cellVoltage); for (uint8_t s = 0u; s < BS_NR_OF_STRINGS; s++) { uint16_t nrBalancedCells = 0u; @@ -134,7 +134,7 @@ static void BAL_ActivateBalancing(void) { if (bal_balancing.deltaCharge_mAs[s][c] > 0) { bal_balancing.balancingState[s][c] = 1; nrBalancedCells++; - cellBalancingCurrent = ((float)(bal_cellvoltage.cellVoltage_mV[s][c])) / + cellBalancingCurrent = ((float)(bal_cellVoltage.cellVoltage_mV[s][c])) / BS_BALANCING_RESISTANCE_ohm; difference = (BAL_STATEMACH_BALANCINGTIME_100ms / 10) * (uint32_t)(cellBalancingCurrent); bal_state.active = true; @@ -270,21 +270,21 @@ static void BAL_ComputeImbalances(void) { uint32_t DOD = 0; uint32_t maxDOD = 0; - DATA_READ_DATA(&bal_balancing, &bal_cellvoltage); + DATA_READ_DATA(&bal_balancing, &bal_cellVoltage); for (uint8_t s = 0u; s < BS_NR_OF_STRINGS; s++) { - voltageMin = bal_cellvoltage.cellVoltage_mV[s][0]; + voltageMin = bal_cellVoltage.cellVoltage_mV[s][0]; minVoltageIndex = 0; for (uint16_t c = 0u; c < BS_NR_OF_CELL_BLOCKS_PER_STRING; c++) { - if (bal_cellvoltage.cellVoltage_mV[s][c] <= voltageMin) { - voltageMin = bal_cellvoltage.cellVoltage_mV[s][c]; + if (bal_cellVoltage.cellVoltage_mV[s][c] <= voltageMin) { + voltageMin = bal_cellVoltage.cellVoltage_mV[s][c]; minVoltageIndex = c; } } - SOC = SOC_GetFromVoltage(((float)(bal_cellvoltage.cellVoltage_mV[s][minVoltageIndex])) / 1000.0f); - maxDOD = BC_CAPACITY_mAh * (uint32_t)((1.0f - SOC) * 3600.0f); + SOC = SE_GetStateOfChargeFromVoltage(((float)(bal_cellVoltage.cellVoltage_mV[s][minVoltageIndex])) / 1000.0f); + maxDOD = BC_CAPACITY_mAh * (uint32_t)((1.0f - SOC) * 3600.0f); bal_balancing.deltaCharge_mAs[s][minVoltageIndex] = 0; /* update balancing threshold */ @@ -292,8 +292,8 @@ static void BAL_ComputeImbalances(void) { for (uint16_t c = 0u; c < BS_NR_OF_CELL_BLOCKS_PER_STRING; c++) { if (c != minVoltageIndex) { - if (bal_cellvoltage.cellVoltage_mV[s][c] >= (voltageMin + bal_state.balancingThreshold)) { - SOC = SOC_GetFromVoltage(((float)(bal_cellvoltage.cellVoltage_mV[s][c])) / 1000.0f); + if (bal_cellVoltage.cellVoltage_mV[s][c] >= (voltageMin + bal_state.balancingThreshold)) { + SOC = SE_GetStateOfChargeFromVoltage(((float)(bal_cellVoltage.cellVoltage_mV[s][c])) / 1000.0f); DOD = BC_CAPACITY_mAh * (uint32_t)((1.0f - SOC) * 3600.0f); bal_balancing.deltaCharge_mAs[s][c] = (maxDOD - DOD); } diff --git a/src/app/application/bal/history/bal_strategy_history.h b/src/app/application/bal/history/bal_strategy_history.h index 947ae810..3a496005 100644 --- a/src/app/application/bal/history/bal_strategy_history.h +++ b/src/app/application/bal/history/bal_strategy_history.h @@ -43,8 +43,8 @@ * @file bal_strategy_history.h * @author foxBMS Team * @date 2020-05-29 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup APPLICATION * @prefix BALS * diff --git a/src/app/application/bal/none/bal_strategy_none.c b/src/app/application/bal/none/bal_strategy_none.c index 64fed584..62f927c7 100644 --- a/src/app/application/bal/none/bal_strategy_none.c +++ b/src/app/application/bal/none/bal_strategy_none.c @@ -43,8 +43,8 @@ * @file bal_strategy_none.c * @author foxBMS Team * @date 2020-07-02 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup APPLICATION * @prefix BAL * diff --git a/src/app/application/bal/none/bal_strategy_none.h b/src/app/application/bal/none/bal_strategy_none.h index e040660d..f1fea3f1 100644 --- a/src/app/application/bal/none/bal_strategy_none.h +++ b/src/app/application/bal/none/bal_strategy_none.h @@ -43,8 +43,8 @@ * @file bal_strategy_none.h * @author foxBMS Team * @date 2020-08-03 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup APPLICATION * @prefix BALS * diff --git a/src/app/application/bal/voltage/bal_strategy_voltage.c b/src/app/application/bal/voltage/bal_strategy_voltage.c index e71fc473..5b2ed2dc 100644 --- a/src/app/application/bal/voltage/bal_strategy_voltage.c +++ b/src/app/application/bal/voltage/bal_strategy_voltage.c @@ -43,8 +43,8 @@ * @file bal_strategy_voltage.c * @author foxBMS Team * @date 2020-05-29 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup APPLICATION * @prefix BAL * @@ -121,15 +121,15 @@ static bool BAL_ActivateBalancing(void) { bool finished = true; DATA_BLOCK_MIN_MAX_s minMax = {.header.uniqueId = DATA_BLOCK_ID_MIN_MAX}; /* Database entry is declared static, to place it in the data segment and not on the stack */ - static DATA_BLOCK_CELL_VOLTAGE_s cellvoltage = {.header.uniqueId = DATA_BLOCK_ID_CELL_VOLTAGE}; + static DATA_BLOCK_CELL_VOLTAGE_s cellVoltage = {.header.uniqueId = DATA_BLOCK_ID_CELL_VOLTAGE}; - DATA_READ_DATA(&cellvoltage, &minMax); + DATA_READ_DATA(&cellVoltage, &minMax); for (uint8_t s = 0u; s < BS_NR_OF_STRINGS; s++) { int16_t min = minMax.minimumCellVoltage_mV[s]; uint16_t nrBalancedCells = 0u; for (uint8_t c = 0u; c < BS_NR_OF_CELL_BLOCKS_PER_STRING; c++) { - if (cellvoltage.cellVoltage_mV[s][c] > (min + bal_state.balancingThreshold)) { + if (cellVoltage.cellVoltage_mV[s][c] > (min + bal_state.balancingThreshold)) { bal_balancing.balancingState[s][c] = 1; finished = false; /* set without hysteresis so that we now balance all cells that are below the initial threshold */ diff --git a/src/app/application/bal/voltage/bal_strategy_voltage.h b/src/app/application/bal/voltage/bal_strategy_voltage.h index 20062d92..1516eb54 100644 --- a/src/app/application/bal/voltage/bal_strategy_voltage.h +++ b/src/app/application/bal/voltage/bal_strategy_voltage.h @@ -43,8 +43,8 @@ * @file bal_strategy_voltage.h * @author foxBMS Team * @date 2020-05-29 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup APPLICATION * @prefix BALS * diff --git a/src/app/application/bms/bms.c b/src/app/application/bms/bms.c index 6f3e77ff..7cbb4db6 100644 --- a/src/app/application/bms/bms.c +++ b/src/app/application/bms/bms.c @@ -43,8 +43,8 @@ * @file bms.c * @author foxBMS Team * @date 2020-02-24 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup ENGINE * @prefix BMS * @@ -329,6 +329,8 @@ static uint8_t BMS_CheckCanRequests(void) { retVal = BMS_REQ_ID_NORMAL; } else if (request.stateRequestViaCan == BMS_REQ_ID_CHARGE) { retVal = BMS_REQ_ID_CHARGE; + } else if (request.stateRequestViaCan == BMS_REQ_ID_NOREQ) { + retVal = BMS_REQ_ID_NOREQ; } else { /* invalid or no request, default to BMS_REQ_ID_NOREQ (already set) */ } @@ -713,10 +715,10 @@ void BMS_Trigger(void) { /****************************INITIALIZATION***************************/ case BMS_STATEMACH_INITIALIZATION: BMS_SAVELASTSTATES(); - - bms_state.timer = BMS_STATEMACH_LONGTIME; - bms_state.state = BMS_STATEMACH_INITIALIZED; - bms_state.substate = BMS_ENTRY; + bms_state.initFinished = STD_OK; + bms_state.timer = BMS_STATEMACH_LONGTIME; + bms_state.state = BMS_STATEMACH_INITIALIZED; + bms_state.substate = BMS_ENTRY; break; /****************************INITIALIZED******************************/ @@ -726,10 +728,9 @@ void BMS_Trigger(void) { /* Initialization of IMD device not finished yet -> wait until this is finished before moving on */ bms_state.timer = BMS_STATEMACH_LONGTIME; } else { - bms_state.initFinished = STD_OK; - bms_state.timer = BMS_STATEMACH_SHORTTIME; - bms_state.state = BMS_STATEMACH_IDLE; - bms_state.substate = BMS_ENTRY; + bms_state.timer = BMS_STATEMACH_SHORTTIME; + bms_state.state = BMS_STATEMACH_IDLE; + bms_state.substate = BMS_ENTRY; } break; diff --git a/src/app/application/bms/bms.h b/src/app/application/bms/bms.h index 7c60274e..e28d61fb 100644 --- a/src/app/application/bms/bms.h +++ b/src/app/application/bms/bms.h @@ -43,8 +43,8 @@ * @file bms.h * @author foxBMS Team * @date 2020-02-24 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup ENGINE * @prefix BMS * diff --git a/src/app/application/config/bal_cfg.c b/src/app/application/config/bal_cfg.c index 6a858212..cdaacfe8 100644 --- a/src/app/application/config/bal_cfg.c +++ b/src/app/application/config/bal_cfg.c @@ -43,8 +43,8 @@ * @file bal_cfg.c * @author foxBMS Team * @date 2022-02-26 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS_CONFIGURATION * @prefix BAL * diff --git a/src/app/application/config/bal_cfg.h b/src/app/application/config/bal_cfg.h index 0f6c9e4d..77da6401 100644 --- a/src/app/application/config/bal_cfg.h +++ b/src/app/application/config/bal_cfg.h @@ -43,8 +43,8 @@ * @file bal_cfg.h * @author foxBMS Team * @date 2020-02-24 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS_CONFIGURATION * @prefix BAL * @@ -61,14 +61,14 @@ /*========== Macros and Definitions =========================================*/ /** BAL statemachine short time definition in 100*ms */ -#define BAL_STATEMACH_SHORTTIME_100ms (1U) +#define BAL_STATEMACH_SHORTTIME_100ms (1u) /** BAL statemachine long time definition in 100*ms */ -#define BAL_STATEMACH_LONGTIME_100ms (50U) +#define BAL_STATEMACH_LONGTIME_100ms (50u) /** BAL statemachine balancing time in 100*ms */ -#define BAL_STATEMACH_BALANCINGTIME_100ms (10U) +#define BAL_STATEMACH_BALANCINGTIME_100ms (10u) /** default value for the BAL voltage threshold */ #define BAL_DEFAULT_THRESHOLD_mV (200) diff --git a/src/app/application/config/battery_cell_cfg.c b/src/app/application/config/battery_cell_cfg.c index 29986f6c..05c1afbd 100644 --- a/src/app/application/config/battery_cell_cfg.c +++ b/src/app/application/config/battery_cell_cfg.c @@ -43,8 +43,8 @@ * @file battery_cell_cfg.c * @author foxBMS Team * @date 2020-10-08 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup BATTERY_CELL_CONFIGURATION * @prefix BC * diff --git a/src/app/application/config/battery_cell_cfg.h b/src/app/application/config/battery_cell_cfg.h index 49757ae2..d6c5690f 100644 --- a/src/app/application/config/battery_cell_cfg.h +++ b/src/app/application/config/battery_cell_cfg.h @@ -43,8 +43,8 @@ * @file battery_cell_cfg.h * @author foxBMS Team * @date 2017-03-14 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup BATTERY_CELL_CONFIGURATION * @prefix BC * diff --git a/src/app/application/config/battery_system_cfg.c b/src/app/application/config/battery_system_cfg.c index 3627b271..c7aaef43 100644 --- a/src/app/application/config/battery_system_cfg.c +++ b/src/app/application/config/battery_system_cfg.c @@ -43,8 +43,8 @@ * @file battery_system_cfg.c * @author foxBMS Team * @date 2019-12-10 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup BATTERY_SYSTEM_CONFIGURATION * @prefix BS * diff --git a/src/app/application/config/battery_system_cfg.h b/src/app/application/config/battery_system_cfg.h index d9113ce0..c78a649b 100644 --- a/src/app/application/config/battery_system_cfg.h +++ b/src/app/application/config/battery_system_cfg.h @@ -43,8 +43,8 @@ * @file battery_system_cfg.h * @author foxBMS Team * @date 2019-12-10 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup BATTERY_SYSTEM_CONFIGURATION * @prefix BS * @@ -93,15 +93,15 @@ typedef enum { * @details For details see * Naming Conventions. * Implementation detail: The number of parallel strings cannot exceed - * #REPEAT_MAXIMUM_REPETITIONS unless the implementation of the + * #GEN_REPEAT_MAXIMUM_REPETITIONS unless the implementation of the * repetition macro is adapted. * @ptype uint */ #define BS_NR_OF_STRINGS (1u) -/* safety check: due to implementation BS_NR_OF_STRINGS may not be larger than REPEAT_MAXIMUM_REPETITIONS */ -#if (BS_NR_OF_STRINGS > REPEAT_MAXIMUM_REPETITIONS) -#error "Too large number of strings, please check implementation of REPEAT_U()." +/* safety check: due to implementation BS_NR_OF_STRINGS may not be larger than GEN_REPEAT_MAXIMUM_REPETITIONS */ +#if (BS_NR_OF_STRINGS > GEN_REPEAT_MAXIMUM_REPETITIONS) +#error "Too large number of strings, please check implementation of GEN_REPEAT_U()." #endif /** @@ -122,7 +122,7 @@ typedef enum { * Naming Conventions. * @ptype uint */ -#define BS_NR_OF_CELL_BLOCKS_PER_MODULE (18u) +#define BS_NR_OF_CELL_BLOCKS_PER_MODULE (14u) /** * @ingroup CONFIG_BATTERYSYSTEM @@ -136,6 +136,8 @@ typedef enum { #if BS_NR_OF_CELL_BLOCKS_PER_MODULE <= 12u #define BS_MAX_SUPPORTED_CELLS (12u) +#elif BS_NR_OF_CELL_BLOCKS_PER_MODULE <= 14u +#define BS_MAX_SUPPORTED_CELLS (14u) #elif BS_NR_OF_CELL_BLOCKS_PER_MODULE <= 15u #define BS_MAX_SUPPORTED_CELLS (15u) #elif BS_NR_OF_CELL_BLOCKS_PER_MODULE <= 16u @@ -164,6 +166,8 @@ typedef enum { */ #if BS_MAX_SUPPORTED_CELLS == 12u #define BS_NR_OF_GPIOS_PER_MODULE (5u) +#elif BS_MAX_SUPPORTED_CELLS == 14u +#define BS_NR_OF_GPIOS_PER_MODULE (8u) #else #define BS_NR_OF_GPIOS_PER_MODULE (9u) #endif @@ -293,10 +297,10 @@ typedef enum { #define BS_NR_OF_VOLTAGES_FROM_MCU_ADC (2) /** Number of contactors in addition to string contactors (e.g., PRECHARGE).*/ -#define BS_NR_OF_CONTACTORS_OUTSIDE_STRINGS (1U) +#define BS_NR_OF_CONTACTORS_OUTSIDE_STRINGS (1u) /** Number of contactors. One per string + main and precharge */ -#define BS_NR_OF_CONTACTORS ((2U * BS_NR_OF_STRINGS) + BS_NR_OF_CONTACTORS_OUTSIDE_STRINGS) +#define BS_NR_OF_CONTACTORS ((2u * BS_NR_OF_STRINGS) + BS_NR_OF_CONTACTORS_OUTSIDE_STRINGS) /** * @brief current threshold for determing rest state of battery. If absolute diff --git a/src/app/application/config/bms_cfg.h b/src/app/application/config/bms_cfg.h index 0903f9d2..72a1413c 100644 --- a/src/app/application/config/bms_cfg.h +++ b/src/app/application/config/bms_cfg.h @@ -43,8 +43,8 @@ * @file bms_cfg.h * @author foxBMS Team * @date 2020-02-24 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup ENGINE_CONFIGURATION * @prefix BMS * @@ -146,7 +146,7 @@ * @brief Time to wait in #BMS_Trigger() calls after precharge opened because * precharge failed */ -#define BMS_TIME_WAIT_AFTERPRECHARGEFAIL (300U) +#define BMS_TIME_WAIT_AFTERPRECHARGEFAIL (300u) /** * @brief Timeout in 1*10ms to wait before re-entering to precharge diff --git a/src/app/application/config/plausibility_cfg.h b/src/app/application/config/plausibility_cfg.h index 0c89a459..75879545 100644 --- a/src/app/application/config/plausibility_cfg.h +++ b/src/app/application/config/plausibility_cfg.h @@ -43,8 +43,8 @@ * @file plausibility_cfg.h * @author foxBMS Team * @date 2020-02-24 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup APPLICATION_CONFIGURATION * @prefix PL * diff --git a/src/app/application/config/soa_cfg.c b/src/app/application/config/soa_cfg.c index 65e12a45..e0d6e595 100644 --- a/src/app/application/config/soa_cfg.c +++ b/src/app/application/config/soa_cfg.c @@ -43,8 +43,8 @@ * @file soa_cfg.c * @author foxBMS Team * @date 2020-10-14 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup APPLICATION_CONFIGURATION * @prefix SOA * diff --git a/src/app/application/config/soa_cfg.h b/src/app/application/config/soa_cfg.h index ddd6da33..19de6d77 100644 --- a/src/app/application/config/soa_cfg.h +++ b/src/app/application/config/soa_cfg.h @@ -43,8 +43,8 @@ * @file soa_cfg.h * @author foxBMS Team * @date 2020-10-14 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup APPLICATION_CONFIGURATION * @prefix SOA * diff --git a/src/app/application/plausibility/plausibility.c b/src/app/application/plausibility/plausibility.c index afb6387d..a44c0077 100644 --- a/src/app/application/plausibility/plausibility.c +++ b/src/app/application/plausibility/plausibility.c @@ -43,8 +43,8 @@ * @file plausibility.c * @author foxBMS Team * @date 2020-02-24 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup APPLICATION * @prefix PL * @@ -83,7 +83,7 @@ extern STD_RETURN_TYPE_e PL_CheckStringVoltage(int32_t voltageAfe_mV, int32_t vo return result; } -extern STD_RETURN_TYPE_e PL_CheckCellvoltage( +extern STD_RETURN_TYPE_e PL_CheckCellVoltage( int16_t baseCellVoltage, int16_t redundancy0CellVoltage, int16_t *pCellVoltage) { @@ -121,10 +121,10 @@ extern STD_RETURN_TYPE_e PL_CheckCelltemperature( } extern STD_RETURN_TYPE_e PL_CheckVoltageSpread( - DATA_BLOCK_CELL_VOLTAGE_s *pCellvoltages, + DATA_BLOCK_CELL_VOLTAGE_s *pCellVoltages, DATA_BLOCK_MIN_MAX_s *pMinMaxAverageValues) { /* Pointer validity check */ - FAS_ASSERT(pCellvoltages != NULL_PTR); + FAS_ASSERT(pCellVoltages != NULL_PTR); FAS_ASSERT(pMinMaxAverageValues != NULL_PTR); STD_RETURN_TYPE_e retval = STD_OK; @@ -135,14 +135,14 @@ extern STD_RETURN_TYPE_e PL_CheckVoltageSpread( for (uint8_t m = 0u; m < BS_NR_OF_MODULES_PER_STRING; m++) { for (uint8_t c = 0u; c < BS_NR_OF_CELL_BLOCKS_PER_MODULE; c++) { /* Only do check for valid voltages */ - if ((pCellvoltages->invalidCellVoltage[s][m] & (0x01u << c)) == 0) { - if (abs(pCellvoltages->cellVoltage_mV[s][(m * BS_NR_OF_CELL_BLOCKS_PER_MODULE) + c] - + if ((pCellVoltages->invalidCellVoltage[s][m] & (0x01u << c)) == 0) { + if (abs(pCellVoltages->cellVoltage_mV[s][(m * BS_NR_OF_CELL_BLOCKS_PER_MODULE) + c] - pMinMaxAverageValues->averageCellVoltage_mV[s]) > PL_CELL_VOLTAGE_SPREAD_TOLERANCE_mV) { /* Voltage difference too large */ plausibilityIssueDetected = STD_NOT_OK; retval = STD_NOT_OK; /* Set this cell voltage invalid */ - pCellvoltages->invalidCellVoltage[s][m] |= (0x01u << c); + pCellVoltages->invalidCellVoltage[s][m] |= (0x01u << c); } } } diff --git a/src/app/application/plausibility/plausibility.h b/src/app/application/plausibility/plausibility.h index 33355542..fc7970aa 100644 --- a/src/app/application/plausibility/plausibility.h +++ b/src/app/application/plausibility/plausibility.h @@ -43,8 +43,8 @@ * @file plausibility.h * @author foxBMS Team * @date 2020-02-24 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup APPLICATION * @prefix PL * @@ -86,7 +86,7 @@ extern STD_RETURN_TYPE_e PL_CheckStringVoltage(int32_t voltageAfe_mV, int32_t vo * * @return #STD_OK if cell voltage valid, otherwise #STD_NOT_OK */ -extern STD_RETURN_TYPE_e PL_CheckCellvoltage( +extern STD_RETURN_TYPE_e PL_CheckCellVoltage( int16_t baseCellVoltage, int16_t redundancy0CellVoltage, int16_t *pCellVoltage); @@ -108,13 +108,13 @@ extern STD_RETURN_TYPE_e PL_CheckCelltemperature( /** * @brief Cell voltage spread plausibility check * - * @param[in,out] pCellvoltages pointer to cell voltage database entry + * @param[in,out] pCellVoltages pointer to cell voltage database entry * @param[in] pMinMaxAverageValues pointer to minimum/maximum/average database entry * * @return #STD_OK if no issue detected, otherwise #STD_NOT_OK */ extern STD_RETURN_TYPE_e PL_CheckVoltageSpread( - DATA_BLOCK_CELL_VOLTAGE_s *pCellvoltages, + DATA_BLOCK_CELL_VOLTAGE_s *pCellVoltages, DATA_BLOCK_MIN_MAX_s *pMinMaxAverageValues); /** diff --git a/src/app/application/redundancy/redundancy.c b/src/app/application/redundancy/redundancy.c index c40ab2ad..35602221 100644 --- a/src/app/application/redundancy/redundancy.c +++ b/src/app/application/redundancy/redundancy.c @@ -43,8 +43,8 @@ * @file redundancy.c * @author foxBMS Team * @date 2020-07-31 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup APPLICATION * @prefix MRC * @@ -76,8 +76,8 @@ static DATA_BLOCK_PACK_VALUES_s mrc_tablePackValues = {.header.unique /** state of the redundancy module */ static MRC_STATE_s mrc_state = { - .lastBaseCellvoltageTimestamp = 0u, - .lastRedundancy0CellvoltageTimestamp = 0u, + .lastBaseCellVoltageTimestamp = 0u, + .lastRedundancy0CellVoltageTimestamp = 0u, .lastBaseCelltemperatureTimestamp = 0u, .lastRedundancy0CelltemperatureTimestamp = 0u, .lastStringCurrentTimestamp = {0u}, @@ -186,15 +186,15 @@ static STD_RETURN_TYPE_e MRC_CalculateCellTemperatureMinMaxAverage( /** * @brief Function compares cell voltage measurements from base measurement with * one redundant measurement and writes result in pValidatedVoltages. - * @param[in] pCellvoltageBase base cell voltage measurement - * @param[in] pCellvoltageRedundancy0 redundant cell voltage measurement + * @param[in] pCellVoltageBase base cell voltage measurement + * @param[in] pCellVoltageRedundancy0 redundant cell voltage measurement * @param[out] pValidatedVoltages validated voltages from redundant measurement values * @return #STD_NOT_OK if not all cell voltages could be validated, otherwise * #STD_OK */ static STD_RETURN_TYPE_e MRC_ValidateCellVoltage( - DATA_BLOCK_CELL_VOLTAGE_s *pCellvoltageBase, - DATA_BLOCK_CELL_VOLTAGE_s *pCellvoltageRedundancy0, + DATA_BLOCK_CELL_VOLTAGE_s *pCellVoltageBase, + DATA_BLOCK_CELL_VOLTAGE_s *pCellVoltageRedundancy0, DATA_BLOCK_CELL_VOLTAGE_s *pValidatedVoltages); /** @@ -202,13 +202,13 @@ static STD_RETURN_TYPE_e MRC_ValidateCellVoltage( * single measurement source. This can be the case if no redundancy is * used at all or if one or more of the redundant measurements are not * working properly. - * @param[in] pCellvoltage cell voltage measurement + * @param[in] pCellVoltage cell voltage measurement * @param[out] pValidatedVoltages validated voltage values * @return #STD_NOT_OK if not all cell voltages could be validated, otherwise * #STD_OK */ static STD_RETURN_TYPE_e MRC_UpdateCellVoltageValidation( - DATA_BLOCK_CELL_VOLTAGE_s *pCellvoltage, + DATA_BLOCK_CELL_VOLTAGE_s *pCellVoltage, DATA_BLOCK_CELL_VOLTAGE_s *pValidatedVoltages); /** @@ -258,7 +258,7 @@ static STD_RETURN_TYPE_e MRC_MeasurementUpdatedRecently( STD_RETURN_TYPE_e retval = STD_NOT_OK; uint32_t currentTimestamp = OS_GetTickCount(); - /* Unsigned integer arithmetic also works correctly if currentTimestap is + /* Unsigned integer arithmetic also works correctly if currentTimestamp is larger than pHeader->timestamp (timer overflow), thus no need to use abs() */ if (((currentTimestamp - timestamp) <= timeInterval) && (MRC_MeasurementUpdatedAtLeastOnce(timestamp, previousTimestamp) == true)) { @@ -277,11 +277,11 @@ static bool MRC_ValidateCellVoltageMeasurement( bool updatedValidatedVoltageDatbaseEntry = false; - bool baseCellvoltageUpdated = false; + bool baseCellVoltageUpdated = false; - bool useCellvoltageRedundancy = false; - bool baseCellvoltageMeasurementTimeoutReached = true; - bool redundancy0CellvoltageMeasurementTimeoutReached = true; + bool useCellVoltageRedundancy = false; + bool baseCellVoltageMeasurementTimeoutReached = true; + bool redundancy0CellVoltageMeasurementTimeoutReached = true; /* Following decision will be undertaken: * @@ -294,70 +294,69 @@ static bool MRC_ValidateCellVoltageMeasurement( /* -------------- Check if cell voltage redundant measurement is used -- */ /* Use redundant cell voltage measurements if measurement values have been acquired once */ - useCellvoltageRedundancy = DATA_DatabaseEntryUpdatedAtLeastOnce(pCellVoltageRedundancy0->header); + useCellVoltageRedundancy = DATA_DatabaseEntryUpdatedAtLeastOnce(pCellVoltageRedundancy0->header); /* ----------------- Check timestamp of base measurements--------------- */ if (DATA_EntryUpdatedWithinInterval(pCellVoltageBase->header, MRC_AFE_MEASUREMENT_PERIOD_TIMEOUT_ms) == true) { - baseCellvoltageMeasurementTimeoutReached = false; - (void)DIAG_Handler(DIAG_ID_BASE_CELL_VOLTAGE_MESUREMENT_TIMEOUT, DIAG_EVENT_OK, DIAG_SYSTEM, 0u); + baseCellVoltageMeasurementTimeoutReached = false; + (void)DIAG_Handler(DIAG_ID_BASE_CELL_VOLTAGE_MEASUREMENT_TIMEOUT, DIAG_EVENT_OK, DIAG_SYSTEM, 0u); } else { - baseCellvoltageMeasurementTimeoutReached = true; + baseCellVoltageMeasurementTimeoutReached = true; /* Set error flag */ - (void)DIAG_Handler(DIAG_ID_BASE_CELL_VOLTAGE_MESUREMENT_TIMEOUT, DIAG_EVENT_NOT_OK, DIAG_SYSTEM, 0u); + (void)DIAG_Handler(DIAG_ID_BASE_CELL_VOLTAGE_MEASUREMENT_TIMEOUT, DIAG_EVENT_NOT_OK, DIAG_SYSTEM, 0u); } /* Check if base measurement values have been updated since last MRC */ - if (mrc_state.lastBaseCellvoltageTimestamp != pCellVoltageBase->header.timestamp) { - baseCellvoltageUpdated = true; + if (mrc_state.lastBaseCellVoltageTimestamp != pCellVoltageBase->header.timestamp) { + baseCellVoltageUpdated = true; } else { - baseCellvoltageUpdated = false; + baseCellVoltageUpdated = false; } /* ----------------- Check timestamp of redundant measurements --------- */ if ((DATA_EntryUpdatedWithinInterval(pCellVoltageRedundancy0->header, MRC_AFE_MEASUREMENT_PERIOD_TIMEOUT_ms) == false) && - (useCellvoltageRedundancy == true)) { - redundancy0CellvoltageMeasurementTimeoutReached = true; + (useCellVoltageRedundancy == true)) { + redundancy0CellVoltageMeasurementTimeoutReached = true; /* Set error flag */ - (void)DIAG_Handler(DIAG_ID_REDUNDANCY0_CELL_VOLTAGE_MESUREMENT_TIMEOUT, DIAG_EVENT_NOT_OK, DIAG_SYSTEM, 0u); + (void)DIAG_Handler(DIAG_ID_REDUNDANCY0_CELL_VOLTAGE_MEASUREMENT_TIMEOUT, DIAG_EVENT_NOT_OK, DIAG_SYSTEM, 0u); } else { - redundancy0CellvoltageMeasurementTimeoutReached = false; - (void)DIAG_Handler(DIAG_ID_REDUNDANCY0_CELL_VOLTAGE_MESUREMENT_TIMEOUT, DIAG_EVENT_OK, DIAG_SYSTEM, 0u); + redundancy0CellVoltageMeasurementTimeoutReached = false; + (void)DIAG_Handler(DIAG_ID_REDUNDANCY0_CELL_VOLTAGE_MEASUREMENT_TIMEOUT, DIAG_EVENT_OK, DIAG_SYSTEM, 0u); } /* ----------------- Validate cell voltages ---------------------------- */ - if (useCellvoltageRedundancy == true) { - bool redundany0CellvoltageUpdated = false; + if (useCellVoltageRedundancy == true) { + bool redundany0CellVoltageUpdated = false; /* Check if redundant measurement values have been updated since last MRC */ - if (mrc_state.lastRedundancy0CellvoltageTimestamp != pCellVoltageRedundancy0->header.timestamp) { - redundany0CellvoltageUpdated = true; + if (mrc_state.lastRedundancy0CellVoltageTimestamp != pCellVoltageRedundancy0->header.timestamp) { + redundany0CellVoltageUpdated = true; } else { - redundany0CellvoltageUpdated = false; + redundany0CellVoltageUpdated = false; } /* Make sure cell voltage timestamps have been updated since last call */ - if ((baseCellvoltageUpdated == true) && (redundany0CellvoltageUpdated == true)) { + if ((baseCellVoltageUpdated == true) && (redundany0CellVoltageUpdated == true)) { /* Update timestamp */ - mrc_state.lastBaseCellvoltageTimestamp = pCellVoltageBase->header.timestamp; - mrc_state.lastRedundancy0CellvoltageTimestamp = pCellVoltageRedundancy0->header.timestamp; + mrc_state.lastBaseCellVoltageTimestamp = pCellVoltageBase->header.timestamp; + mrc_state.lastRedundancy0CellVoltageTimestamp = pCellVoltageRedundancy0->header.timestamp; /* Validate cell voltages */ MRC_ValidateCellVoltage(pCellVoltageBase, pCellVoltageRedundancy0, &mrc_tableCellVoltages); /* Set to true for following minimum, maximum and average calculation */ updatedValidatedVoltageDatbaseEntry = true; - - } else if ((baseCellvoltageUpdated == true) || (redundany0CellvoltageUpdated == true)) { + } else if ((baseCellVoltageUpdated == true) || (redundany0CellVoltageUpdated == true)) { /* At least one measurement has been updated */ - if (baseCellvoltageUpdated == true) { + if (baseCellVoltageUpdated == true) { /* Has redundant measurement timeout been reached? If yes, update. */ - if (redundancy0CellvoltageMeasurementTimeoutReached == true) { + if (redundancy0CellVoltageMeasurementTimeoutReached == true) { /* Copy cell voltage base measurement values into validated database struct */ MRC_UpdateCellVoltageValidation(pCellVoltageBase, &mrc_tableCellVoltages); /* Set to true for following minimum, maximum and average calculation */ updatedValidatedVoltageDatbaseEntry = true; } - } else if (redundany0CellvoltageUpdated == true) { + } else if (redundany0CellVoltageUpdated == true) { /* Has base measurement timeout been reached? If yes, update. */ - if (baseCellvoltageMeasurementTimeoutReached == true) { + if (baseCellVoltageMeasurementTimeoutReached == true) { /* Copy cell voltage base measurement values into validated database struct */ MRC_UpdateCellVoltageValidation(pCellVoltageRedundancy0, &mrc_tableCellVoltages); /* Set to true for following minimum, maximum and average calculation */ @@ -370,10 +369,10 @@ static bool MRC_ValidateCellVoltageMeasurement( /* No cell voltage measurement has been updated -> do nothing */ } } else { - if (baseCellvoltageUpdated == true) { + if (baseCellVoltageUpdated == true) { /* Only update database entries if new raw data has been acquired */ /* Update timestamp */ - mrc_state.lastBaseCellvoltageTimestamp = pCellVoltageBase->header.timestamp; + mrc_state.lastBaseCellVoltageTimestamp = pCellVoltageBase->header.timestamp; /* Copy cell voltage base measurement values into validated database struct */ MRC_UpdateCellVoltageValidation(pCellVoltageBase, &mrc_tableCellVoltages); @@ -426,11 +425,11 @@ static bool MRC_ValidateCellTemperatureMeasurement( /* ----------------- Check timestamp of base measurements--------------- */ if (DATA_EntryUpdatedWithinInterval(pCellTemperatureBase->header, MRC_AFE_MEASUREMENT_PERIOD_TIMEOUT_ms) == true) { baseCellTemperatureMeasurementTimeoutReached = false; - (void)DIAG_Handler(DIAG_ID_BASE_CELL_TEMPERATURE_MESUREMENT_TIMEOUT, DIAG_EVENT_OK, DIAG_SYSTEM, 0u); + (void)DIAG_Handler(DIAG_ID_BASE_CELL_TEMPERATURE_MEASUREMENT_TIMEOUT, DIAG_EVENT_OK, DIAG_SYSTEM, 0u); } else { baseCellTemperatureMeasurementTimeoutReached = true; /* Set error flag */ - (void)DIAG_Handler(DIAG_ID_BASE_CELL_TEMPERATURE_MESUREMENT_TIMEOUT, DIAG_EVENT_NOT_OK, DIAG_SYSTEM, 0u); + (void)DIAG_Handler(DIAG_ID_BASE_CELL_TEMPERATURE_MEASUREMENT_TIMEOUT, DIAG_EVENT_NOT_OK, DIAG_SYSTEM, 0u); } /* Check if base measurement values have been updated since last MRC */ if (mrc_state.lastBaseCelltemperatureTimestamp != pCellTemperatureBase->header.timestamp) { @@ -445,10 +444,11 @@ static bool MRC_ValidateCellTemperatureMeasurement( (useCelltemperatureRedundancy == true)) { redundancy0CellTemperatureMeasurementTimeoutReached = true; /* Set error flag */ - (void)DIAG_Handler(DIAG_ID_REDUNDANCY0_CELL_TEMPERATURE_MESUREMENT_TIMEOUT, DIAG_EVENT_NOT_OK, DIAG_SYSTEM, 0u); + (void)DIAG_Handler( + DIAG_ID_REDUNDANCY0_CELL_TEMPERATURE_MEASUREMENT_TIMEOUT, DIAG_EVENT_NOT_OK, DIAG_SYSTEM, 0u); } else { redundancy0CellTemperatureMeasurementTimeoutReached = false; - (void)DIAG_Handler(DIAG_ID_REDUNDANCY0_CELL_TEMPERATURE_MESUREMENT_TIMEOUT, DIAG_EVENT_OK, DIAG_SYSTEM, 0u); + (void)DIAG_Handler(DIAG_ID_REDUNDANCY0_CELL_TEMPERATURE_MEASUREMENT_TIMEOUT, DIAG_EVENT_OK, DIAG_SYSTEM, 0u); } /* ----------------- Validate cell temperatures ------------------------ */ @@ -470,7 +470,6 @@ static bool MRC_ValidateCellTemperatureMeasurement( MRC_ValidateCellTemperature(pCellTemperatureBase, pCellTemperatureRedundancy0, &mrc_tableCellTemperatures); /* Set to true for following minimum, maximum and average calculation */ updatedValidatedTemperatureDatbaseEntry = true; - } else if ((baseCelltemperatureUpdated == true) || (redundancy0CelltemperatureUpdated == true)) { /* At least one measurement has been updated */ if (baseCelltemperatureUpdated == true) { @@ -667,9 +666,9 @@ static void MRC_ValidateBatteryVoltageMeasurement(void) { /* Only calculate average if at least one string voltage is valid */ if (0 != numberOfValidStringVoltages) { - /* AXIVION Disable Style MisraC2012Directive-4.1: truncation impossible; we sum INT32 values x times and divide by x, resulting in INT32 */ + /* AXIVION Next Codeline Style MisraC2012Directive-4.1: truncation impossible; + we sum INT32 values x times and divide by x, resulting in INT32 */ mrc_tablePackValues.batteryVoltage_mV = (int32_t)(sumOfStringValues_mV / numberOfValidStringVoltages); - /* AXIVION Enable Style MisraC2012Directive-4.1: */ } else { mrc_tablePackValues.batteryVoltage_mV = INT32_MAX; } @@ -779,7 +778,7 @@ static STD_RETURN_TYPE_e MRC_CalculateCellVoltageMinMaxAverage( STD_RETURN_TYPE_e retval = STD_OK; for (uint8_t s = 0u; s < BS_NR_OF_STRINGS; s++) { - uint16_t nrValidCellvoltages = 0u; + uint16_t nrValidCellVoltages = 0u; int16_t min = INT16_MAX; int16_t max = INT16_MIN; int32_t sum = 0; @@ -792,7 +791,7 @@ static STD_RETURN_TYPE_e MRC_CalculateCellVoltageMinMaxAverage( for (uint8_t c = 0u; c < BS_NR_OF_CELL_BLOCKS_PER_MODULE; c++) { if ((pValidatedVoltages->invalidCellVoltage[s][m] & (0x01u << c)) == 0u) { /* Cell voltage is valid -> use this voltage for subsequent calculations */ - nrValidCellvoltages++; + nrValidCellVoltages++; sum += pValidatedVoltages->cellVoltage_mV[s][(m * BS_NR_OF_CELL_BLOCKS_PER_MODULE) + c]; if (pValidatedVoltages->cellVoltage_mV[s][(m * BS_NR_OF_CELL_BLOCKS_PER_MODULE) + c] < min) { @@ -814,11 +813,11 @@ static STD_RETURN_TYPE_e MRC_CalculateCellVoltageMinMaxAverage( pMinMaxAverageValues->maximumCellVoltage_mV[s] = max; pMinMaxAverageValues->nrCellMaximumCellVoltage[s] = cellNumberMaximum; pMinMaxAverageValues->nrModuleMaximumCellVoltage[s] = moduleNumberMaximum; - pMinMaxAverageValues->validMeasuredCellVoltages[s] = nrValidCellvoltages; + pMinMaxAverageValues->validMeasuredCellVoltages[s] = nrValidCellVoltages; /* Prevent division by 0, if all cell voltages are invalid */ - if (nrValidCellvoltages > 0u) { - pMinMaxAverageValues->averageCellVoltage_mV[s] = (int16_t)(sum / (int32_t)nrValidCellvoltages); + if (nrValidCellVoltages > 0u) { + pMinMaxAverageValues->averageCellVoltage_mV[s] = (int16_t)(sum / (int32_t)nrValidCellVoltages); } else { pMinMaxAverageValues->averageCellVoltage_mV[s] = 0; retval = STD_NOT_OK; @@ -891,16 +890,16 @@ static STD_RETURN_TYPE_e MRC_CalculateCellTemperatureMinMaxAverage( } static STD_RETURN_TYPE_e MRC_ValidateCellVoltage( - DATA_BLOCK_CELL_VOLTAGE_s *pCellvoltageBase, - DATA_BLOCK_CELL_VOLTAGE_s *pCellvoltageRedundancy0, + DATA_BLOCK_CELL_VOLTAGE_s *pCellVoltageBase, + DATA_BLOCK_CELL_VOLTAGE_s *pCellVoltageRedundancy0, DATA_BLOCK_CELL_VOLTAGE_s *pValidatedVoltages) { /* Pointer validity check */ - FAS_ASSERT(pCellvoltageBase != NULL_PTR); - FAS_ASSERT(pCellvoltageRedundancy0 != NULL_PTR); + FAS_ASSERT(pCellVoltageBase != NULL_PTR); + FAS_ASSERT(pCellVoltageRedundancy0 != NULL_PTR); FAS_ASSERT(pValidatedVoltages != NULL_PTR); uint16_t numberValidMeasurements = 0u; - STD_RETURN_TYPE_e noPlausibilityIssueDetected = STD_OK; /* Flag if implausable value detected */ + STD_RETURN_TYPE_e noPlausibilityIssueDetected = STD_OK; /* Flag if implausible value detected */ STD_RETURN_TYPE_e retval = STD_OK; /* Iterate over all cell measurements */ @@ -908,13 +907,13 @@ static STD_RETURN_TYPE_e MRC_ValidateCellVoltage( int32_t sum = 0; for (uint8_t m = 0; m < BS_NR_OF_MODULES_PER_STRING; m++) { for (uint8_t c = 0; c < BS_NR_OF_CELL_BLOCKS_PER_MODULE; c++) { - if (((pCellvoltageBase->invalidCellVoltage[s][m] & (1u << c)) == 0u) && - ((pCellvoltageRedundancy0->invalidCellVoltage[s][m] & (1u << c)) == 0u)) { + if (((pCellVoltageBase->invalidCellVoltage[s][m] & (1u << c)) == 0u) && + ((pCellVoltageRedundancy0->invalidCellVoltage[s][m] & (1u << c)) == 0u)) { /* Check if cell voltage of base AND redundant measurement is valid -> do plausibility check */ if (STD_OK == - PL_CheckCellvoltage( - pCellvoltageBase->cellVoltage_mV[s][(m * BS_NR_OF_CELL_BLOCKS_PER_MODULE) + c], - pCellvoltageRedundancy0->cellVoltage_mV[s][(m * BS_NR_OF_CELL_BLOCKS_PER_MODULE) + c], + PL_CheckCellVoltage( + pCellVoltageBase->cellVoltage_mV[s][(m * BS_NR_OF_CELL_BLOCKS_PER_MODULE) + c], + pCellVoltageRedundancy0->cellVoltage_mV[s][(m * BS_NR_OF_CELL_BLOCKS_PER_MODULE) + c], &pValidatedVoltages->cellVoltage_mV[s][(m * BS_NR_OF_CELL_BLOCKS_PER_MODULE) + c])) { /* Clear valid flag */ pValidatedVoltages->invalidCellVoltage[s][m] = pValidatedVoltages->invalidCellVoltage[s][m] & @@ -928,19 +927,19 @@ static STD_RETURN_TYPE_e MRC_ValidateCellVoltage( /* Set return value to #STD_NOT_OK as not all cell voltages have a valid measurement value */ retval = STD_NOT_OK; } - } else if ((pCellvoltageBase->invalidCellVoltage[s][m] & (1u << c)) == 0u) { + } else if ((pCellVoltageBase->invalidCellVoltage[s][m] & (1u << c)) == 0u) { /* Only base measurement value is valid -> use this voltage without further plausibility checks */ pValidatedVoltages->cellVoltage_mV[s][(m * BS_NR_OF_CELL_BLOCKS_PER_MODULE) + c] = - pCellvoltageBase->cellVoltage_mV[s][(m * BS_NR_OF_CELL_BLOCKS_PER_MODULE) + c]; + pCellVoltageBase->cellVoltage_mV[s][(m * BS_NR_OF_CELL_BLOCKS_PER_MODULE) + c]; /* Reset valid flag */ pValidatedVoltages->invalidCellVoltage[s][m] = pValidatedVoltages->invalidCellVoltage[s][m] & (~(1u << c)); numberValidMeasurements++; sum += pValidatedVoltages->cellVoltage_mV[s][(m * BS_NR_OF_CELL_BLOCKS_PER_MODULE) + c]; - } else if ((pCellvoltageRedundancy0->invalidCellVoltage[s][m] & (1u << c)) == 0u) { + } else if ((pCellVoltageRedundancy0->invalidCellVoltage[s][m] & (1u << c)) == 0u) { /* Only redundant measurement value is valid -> use this voltage without further plausibility checks */ pValidatedVoltages->cellVoltage_mV[s][(m * BS_NR_OF_CELL_BLOCKS_PER_MODULE) + c] = - pCellvoltageRedundancy0->cellVoltage_mV[s][(m * BS_NR_OF_CELL_BLOCKS_PER_MODULE) + c]; + pCellVoltageRedundancy0->cellVoltage_mV[s][(m * BS_NR_OF_CELL_BLOCKS_PER_MODULE) + c]; /* Reset valid flag */ pValidatedVoltages->invalidCellVoltage[s][m] = pValidatedVoltages->invalidCellVoltage[s][m] & (~(1u << c)); @@ -950,8 +949,8 @@ static STD_RETURN_TYPE_e MRC_ValidateCellVoltage( /* Both, base and redundant measurement value are invalid */ /* Save average cell voltage value of base and redundant */ pValidatedVoltages->cellVoltage_mV[s][(m * BS_NR_OF_CELL_BLOCKS_PER_MODULE) + c] = - (pCellvoltageBase->cellVoltage_mV[s][(m * BS_NR_OF_CELL_BLOCKS_PER_MODULE) + c] + - pCellvoltageRedundancy0->cellVoltage_mV[s][(m * BS_NR_OF_CELL_BLOCKS_PER_MODULE) + c]) / + (pCellVoltageBase->cellVoltage_mV[s][(m * BS_NR_OF_CELL_BLOCKS_PER_MODULE) + c] + + pCellVoltageRedundancy0->cellVoltage_mV[s][(m * BS_NR_OF_CELL_BLOCKS_PER_MODULE) + c]) / 2u; /* Set invalid flag */ pValidatedVoltages->invalidCellVoltage[s][m] |= (1u << c); @@ -971,16 +970,16 @@ static STD_RETURN_TYPE_e MRC_ValidateCellVoltage( } static STD_RETURN_TYPE_e MRC_UpdateCellVoltageValidation( - DATA_BLOCK_CELL_VOLTAGE_s *pCellvoltage, + DATA_BLOCK_CELL_VOLTAGE_s *pCellVoltage, DATA_BLOCK_CELL_VOLTAGE_s *pValidatedVoltages) { /* Pointer validity check */ - FAS_ASSERT(pCellvoltage != NULL_PTR); + FAS_ASSERT(pCellVoltage != NULL_PTR); FAS_ASSERT(pValidatedVoltages != NULL_PTR); /* Save header struct to copy to correct database entry */ DATA_BLOCK_HEADER_s tmpHeader = pValidatedVoltages->header; /* Copy whole database entry */ - *pValidatedVoltages = *pCellvoltage; + *pValidatedVoltages = *pCellVoltage; /* Restore previous header */ pValidatedVoltages->header = tmpHeader; @@ -997,7 +996,7 @@ static STD_RETURN_TYPE_e MRC_ValidateCellTemperature( FAS_ASSERT(pValidatedTemperatures != NULL_PTR); uint16_t numberValidMeasurements = 0u; - STD_RETURN_TYPE_e noPlausibilityIssueDetected = STD_OK; /* Flag if implausable value detected */ + STD_RETURN_TYPE_e noPlausibilityIssueDetected = STD_OK; /* Flag if implausible value detected */ STD_RETURN_TYPE_e retval = STD_OK; /* Iterate over all cell measurements */ @@ -1113,8 +1112,8 @@ extern STD_RETURN_TYPE_e MRC_ValidateAfeMeasurement(void) { STD_RETURN_TYPE_e retval = STD_OK; /* Database entries are declared static, so that they are placed in the data segment and not on the stack */ - static DATA_BLOCK_CELL_VOLTAGE_s mrc_tableCellvoltageBase = {.header.uniqueId = DATA_BLOCK_ID_CELL_VOLTAGE_BASE}; - static DATA_BLOCK_CELL_VOLTAGE_s mrc_tableCellvoltageRedundancy0 = { + static DATA_BLOCK_CELL_VOLTAGE_s mrc_tableCellVoltageBase = {.header.uniqueId = DATA_BLOCK_ID_CELL_VOLTAGE_BASE}; + static DATA_BLOCK_CELL_VOLTAGE_s mrc_tableCellVoltageRedundancy0 = { .header.uniqueId = DATA_BLOCK_ID_CELL_VOLTAGE_REDUNDANCY0}; static DATA_BLOCK_CELL_TEMPERATURE_s mrc_tableCelltemperatureBase = { @@ -1124,14 +1123,14 @@ extern STD_RETURN_TYPE_e MRC_ValidateAfeMeasurement(void) { /* Get measurement values */ DATA_READ_DATA( - &mrc_tableCellvoltageBase, - &mrc_tableCellvoltageRedundancy0, + &mrc_tableCellVoltageBase, + &mrc_tableCellVoltageRedundancy0, &mrc_tableCelltemperatureBase, &mrc_tableCelltemperatureRedundancy0); /* Perform validation of cell voltage measurement */ bool updateCellVoltages = - MRC_ValidateCellVoltageMeasurement(&mrc_tableCellvoltageBase, &mrc_tableCellvoltageRedundancy0); + MRC_ValidateCellVoltageMeasurement(&mrc_tableCellVoltageBase, &mrc_tableCellVoltageRedundancy0); /* Perform validation of cell temperature measurement */ bool updateCellTemperatures = @@ -1218,15 +1217,15 @@ extern STD_RETURN_TYPE_e TEST_MRC_CalculateCellTemperatureMinMaxAverage( return MRC_CalculateCellTemperatureMinMaxAverage(pValidatedTemperatures, pMinMaxAverageValues); } extern STD_RETURN_TYPE_e TEST_MRC_ValidateCellVoltage( - DATA_BLOCK_CELL_VOLTAGE_s *pCellvoltageBase, - DATA_BLOCK_CELL_VOLTAGE_s *pCellvoltageRedundancy0, + DATA_BLOCK_CELL_VOLTAGE_s *pCellVoltageBase, + DATA_BLOCK_CELL_VOLTAGE_s *pCellVoltageRedundancy0, DATA_BLOCK_CELL_VOLTAGE_s *pValidatedVoltages) { - return MRC_ValidateCellVoltage(pCellvoltageBase, pCellvoltageRedundancy0, pValidatedVoltages); + return MRC_ValidateCellVoltage(pCellVoltageBase, pCellVoltageRedundancy0, pValidatedVoltages); } extern STD_RETURN_TYPE_e TEST_MRC_UpdateCellVoltageValidation( - DATA_BLOCK_CELL_VOLTAGE_s *pCellvoltage, + DATA_BLOCK_CELL_VOLTAGE_s *pCellVoltage, DATA_BLOCK_CELL_VOLTAGE_s *pValidatedVoltages) { - return MRC_UpdateCellVoltageValidation(pCellvoltage, pValidatedVoltages); + return MRC_UpdateCellVoltageValidation(pCellVoltage, pValidatedVoltages); } extern STD_RETURN_TYPE_e TEST_MRC_ValidateCellTemperature( DATA_BLOCK_CELL_TEMPERATURE_s *pCelltemperatureBase, diff --git a/src/app/application/redundancy/redundancy.h b/src/app/application/redundancy/redundancy.h index f1b3e7bc..787798ba 100644 --- a/src/app/application/redundancy/redundancy.h +++ b/src/app/application/redundancy/redundancy.h @@ -43,8 +43,8 @@ * @file redundancy.h * @author foxBMS Team * @date 2020-07-31 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup APPLICATION * @prefix MRC * @@ -115,8 +115,8 @@ * This structure contains all the variables relevant for the redundancy state machine. */ typedef struct { - uint32_t lastBaseCellvoltageTimestamp; - uint32_t lastRedundancy0CellvoltageTimestamp; + uint32_t lastBaseCellVoltageTimestamp; + uint32_t lastRedundancy0CellVoltageTimestamp; uint32_t lastBaseCelltemperatureTimestamp; uint32_t lastRedundancy0CelltemperatureTimestamp; uint32_t lastStringCurrentTimestamp[BS_NR_OF_STRINGS]; @@ -176,11 +176,11 @@ extern STD_RETURN_TYPE_e TEST_MRC_CalculateCellTemperatureMinMaxAverage( DATA_BLOCK_CELL_TEMPERATURE_s *pValidatedTemperatures, DATA_BLOCK_MIN_MAX_s *pMinMaxAverageValues); extern STD_RETURN_TYPE_e TEST_MRC_ValidateCellVoltage( - DATA_BLOCK_CELL_VOLTAGE_s *pCellvoltageBase, - DATA_BLOCK_CELL_VOLTAGE_s *pCellvoltageRedundancy0, + DATA_BLOCK_CELL_VOLTAGE_s *pCellVoltageBase, + DATA_BLOCK_CELL_VOLTAGE_s *pCellVoltageRedundancy0, DATA_BLOCK_CELL_VOLTAGE_s *pValidatedVoltages); extern STD_RETURN_TYPE_e TEST_MRC_UpdateCellVoltageValidation( - DATA_BLOCK_CELL_VOLTAGE_s *pCellvoltage, + DATA_BLOCK_CELL_VOLTAGE_s *pCellVoltage, DATA_BLOCK_CELL_VOLTAGE_s *pValidatedVoltages); extern STD_RETURN_TYPE_e TEST_MRC_ValidateCellTemperature( DATA_BLOCK_CELL_TEMPERATURE_s *pCelltemperatureBase, diff --git a/src/app/application/soa/soa.c b/src/app/application/soa/soa.c index 4d8c43bc..aa3870e6 100644 --- a/src/app/application/soa/soa.c +++ b/src/app/application/soa/soa.c @@ -43,8 +43,8 @@ * @file soa.c * @author foxBMS Team * @date 2020-10-14 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup APPLICATION * @prefix SOA * @@ -85,39 +85,39 @@ extern void SOA_CheckVoltages(DATA_BLOCK_MIN_MAX_s *pMinimumMaximumCellVoltages) if (voltageMax_mV >= BC_VOLTAGE_MAX_MOL_mV) { /* Over voltage maximum operating limit violated */ - DIAG_Handler(DIAG_ID_CELLVOLTAGE_OVERVOLTAGE_MOL, DIAG_EVENT_NOT_OK, DIAG_STRING, s); + DIAG_Handler(DIAG_ID_CELL_VOLTAGE_OVERVOLTAGE_MOL, DIAG_EVENT_NOT_OK, DIAG_STRING, s); if (voltageMax_mV >= BC_VOLTAGE_MAX_RSL_mV) { /* Over voltage recommended safety limit violated */ - DIAG_Handler(DIAG_ID_CELLVOLTAGE_OVERVOLTAGE_RSL, DIAG_EVENT_NOT_OK, DIAG_STRING, s); + DIAG_Handler(DIAG_ID_CELL_VOLTAGE_OVERVOLTAGE_RSL, DIAG_EVENT_NOT_OK, DIAG_STRING, s); if (voltageMax_mV >= BC_VOLTAGE_MAX_MSL_mV) { /* Over voltage maximum safety limit violated */ - DIAG_Handler(DIAG_ID_CELLVOLTAGE_OVERVOLTAGE_MSL, DIAG_EVENT_NOT_OK, DIAG_STRING, s); + DIAG_Handler(DIAG_ID_CELL_VOLTAGE_OVERVOLTAGE_MSL, DIAG_EVENT_NOT_OK, DIAG_STRING, s); } } } if (voltageMax_mV < BC_VOLTAGE_MAX_MSL_mV) { /* over voltage maximum safety limit NOT violated */ - DIAG_Handler(DIAG_ID_CELLVOLTAGE_OVERVOLTAGE_MSL, DIAG_EVENT_OK, DIAG_STRING, s); + DIAG_Handler(DIAG_ID_CELL_VOLTAGE_OVERVOLTAGE_MSL, DIAG_EVENT_OK, DIAG_STRING, s); if (voltageMax_mV < BC_VOLTAGE_MAX_RSL_mV) { /* over voltage recommended safety limit NOT violated */ - DIAG_Handler(DIAG_ID_CELLVOLTAGE_OVERVOLTAGE_RSL, DIAG_EVENT_OK, DIAG_STRING, s); + DIAG_Handler(DIAG_ID_CELL_VOLTAGE_OVERVOLTAGE_RSL, DIAG_EVENT_OK, DIAG_STRING, s); if (voltageMax_mV < BC_VOLTAGE_MAX_MOL_mV) { /* over voltage maximum operating limit NOT violated */ - DIAG_Handler(DIAG_ID_CELLVOLTAGE_OVERVOLTAGE_MOL, DIAG_EVENT_OK, DIAG_STRING, s); + DIAG_Handler(DIAG_ID_CELL_VOLTAGE_OVERVOLTAGE_MOL, DIAG_EVENT_OK, DIAG_STRING, s); } } } if (voltageMin_mV <= BC_VOLTAGE_MIN_MOL_mV) { /* Under voltage maximum operating limit violated */ - DIAG_Handler(DIAG_ID_CELLVOLTAGE_UNDERVOLTAGE_MOL, DIAG_EVENT_NOT_OK, DIAG_STRING, s); + DIAG_Handler(DIAG_ID_CELL_VOLTAGE_UNDERVOLTAGE_MOL, DIAG_EVENT_NOT_OK, DIAG_STRING, s); if (voltageMin_mV <= BC_VOLTAGE_MIN_RSL_mV) { /* Under voltage recommended safety limit violated */ - DIAG_Handler(DIAG_ID_CELLVOLTAGE_UNDERVOLTAGE_RSL, DIAG_EVENT_NOT_OK, DIAG_STRING, s); + DIAG_Handler(DIAG_ID_CELL_VOLTAGE_UNDERVOLTAGE_RSL, DIAG_EVENT_NOT_OK, DIAG_STRING, s); if (voltageMin_mV <= BC_VOLTAGE_MIN_MSL_mV) { /* Under voltage maximum safety limit violated */ retvalUndervoltMSL = - DIAG_Handler(DIAG_ID_CELLVOLTAGE_UNDERVOLTAGE_MSL, DIAG_EVENT_NOT_OK, DIAG_STRING, s); + DIAG_Handler(DIAG_ID_CELL_VOLTAGE_UNDERVOLTAGE_MSL, DIAG_EVENT_NOT_OK, DIAG_STRING, s); /* If under voltage flag is set and deep-discharge voltage is violated */ if ((retvalUndervoltMSL == DIAG_HANDLER_RETURN_ERR_OCCURRED) && @@ -129,13 +129,13 @@ extern void SOA_CheckVoltages(DATA_BLOCK_MIN_MAX_s *pMinimumMaximumCellVoltages) } if (voltageMin_mV > BC_VOLTAGE_MIN_MSL_mV) { /* under voltage maximum safety limit NOT violated */ - DIAG_Handler(DIAG_ID_CELLVOLTAGE_UNDERVOLTAGE_MSL, DIAG_EVENT_OK, DIAG_STRING, s); + DIAG_Handler(DIAG_ID_CELL_VOLTAGE_UNDERVOLTAGE_MSL, DIAG_EVENT_OK, DIAG_STRING, s); if (voltageMin_mV > BC_VOLTAGE_MIN_RSL_mV) { /* under voltage recommended safety limit NOT violated */ - DIAG_Handler(DIAG_ID_CELLVOLTAGE_UNDERVOLTAGE_RSL, DIAG_EVENT_OK, DIAG_STRING, s); + DIAG_Handler(DIAG_ID_CELL_VOLTAGE_UNDERVOLTAGE_RSL, DIAG_EVENT_OK, DIAG_STRING, s); if (voltageMin_mV > BC_VOLTAGE_MIN_MOL_mV) { /* under voltage maximum operating limit NOT violated */ - DIAG_Handler(DIAG_ID_CELLVOLTAGE_UNDERVOLTAGE_MOL, DIAG_EVENT_OK, DIAG_STRING, s); + DIAG_Handler(DIAG_ID_CELL_VOLTAGE_UNDERVOLTAGE_MOL, DIAG_EVENT_OK, DIAG_STRING, s); } } } @@ -180,7 +180,6 @@ extern void SOA_CheckTemperatures( } } } - } else { /* Charge */ if (temperatureMax_ddegC >= BC_TEMPERATURE_MAX_CHARGE_MOL_ddegC) { diff --git a/src/app/application/soa/soa.h b/src/app/application/soa/soa.h index f859c585..bb4b9469 100644 --- a/src/app/application/soa/soa.h +++ b/src/app/application/soa/soa.h @@ -43,8 +43,8 @@ * @file soa.h * @author foxBMS Team * @date 2020-10-14 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup APPLICATION * @prefix SOA * diff --git a/src/app/application/wscript b/src/app/application/wscript index c0a91eac..11f7c6f0 100644 --- a/src/app/application/wscript +++ b/src/app/application/wscript @@ -96,7 +96,7 @@ def build(bld): os.path.join("..", "task", "config"), os.path.join("..", "task", "os"), ] - includes.extend(bld.env.INCLUDES_OPERATING_SYSTEM + bld.env.INCLUDES_AFE) + includes.extend(bld.env.INCLUDES_RTOS + bld.env.INCLUDES_AFE) cflags = bld.env.CFLAGS_FOXBMS target = f"{bld.env.APPNAME.lower()}-application" diff --git a/src/app/driver/adc/adc.c b/src/app/driver/adc/adc.c index c14e831a..7c94af6a 100644 --- a/src/app/driver/adc/adc.c +++ b/src/app/driver/adc/adc.c @@ -43,8 +43,8 @@ * @file adc.c * @author foxBMS Team * @date 2019-01-07 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix ADC * @@ -68,9 +68,9 @@ */ static ADC_STATE_e adc_conversionState = ADC_START_CONVERSION; -static adcData_t adc1RawVoltages[ADC_ADC1_MAX_NR_CHANNELS] = {0}; +static adcData_t adc_adc1RawVoltages[MCU_ADC1_MAX_NR_CHANNELS] = {0}; -static DATA_BLOCK_ADC_VOLTAGE_s adc1Voltages = {.header.uniqueId = DATA_BLOCK_ID_ADC_VOLTAGE}; +static DATA_BLOCK_ADC_VOLTAGE_s adc_adc1Voltages = {.header.uniqueId = DATA_BLOCK_ID_ADC_VOLTAGE}; /*========== Extern Constant and Variable Definitions =======================*/ @@ -118,11 +118,12 @@ extern void ADC_Control(void) { /* Start initialization procedure, data sheet figure 106 page 79 */ case ADC_CONVERSION_FINISHED: - adcGetData(adcREG1, adcGROUP1, &adc1RawVoltages[0]); - for (uint8_t i = 0U; i < ADC_ADC1_MAX_NR_CHANNELS; i++) { - adc1Voltages.adc1ConvertedVoltages_mV[i] = ADC_ConvertVoltage((float)(adc1RawVoltages[i].value)); + adcGetData(adcREG1, adcGROUP1, &adc_adc1RawVoltages[0]); + for (uint8_t i = 0u; i < MCU_ADC1_MAX_NR_CHANNELS; i++) { + adc_adc1Voltages.adc1ConvertedVoltages_mV[i] = + ADC_ConvertVoltage((float)(adc_adc1RawVoltages[i].value)); } - DATA_WRITE_DATA(&adc1Voltages); + DATA_WRITE_DATA(&adc_adc1Voltages); adc_conversionState = ADC_START_CONVERSION; break; diff --git a/src/app/driver/adc/adc.h b/src/app/driver/adc/adc.h index 66fe337a..efb95c9e 100644 --- a/src/app/driver/adc/adc.h +++ b/src/app/driver/adc/adc.h @@ -43,8 +43,8 @@ * @file adc.h * @author foxBMS Team * @date 2019-01-07 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix ADC * @@ -74,7 +74,7 @@ #define ADC_CONV_FACTOR_10BIT (1024.0f) /** End bit position in ADC Groupx Interrupt Flag Register */ -#define ADC_CONVERSION_ENDDBIT (8U) +#define ADC_CONVERSION_ENDDBIT (8u) /** * State for the ADC conversion diff --git a/src/app/driver/afe/api/afe.h b/src/app/driver/afe/api/afe.h index 3eed40a9..90606ea0 100644 --- a/src/app/driver/afe/api/afe.h +++ b/src/app/driver/afe/api/afe.h @@ -43,8 +43,8 @@ * @file afe.h * @author foxBMS Team * @date 2020-05-08 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVER * @prefix AFE * diff --git a/src/app/driver/afe/api/afe_dma.h b/src/app/driver/afe/api/afe_dma.h index 3ecc6401..64ee38f8 100644 --- a/src/app/driver/afe/api/afe_dma.h +++ b/src/app/driver/afe/api/afe_dma.h @@ -43,8 +43,8 @@ * @file afe_dma.h * @author foxBMS Team * @date 2020-06-18 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix AFE * diff --git a/src/app/driver/afe/api/afe_plausibility.c b/src/app/driver/afe/api/afe_plausibility.c index 95a1aff2..cd2fbc57 100644 --- a/src/app/driver/afe/api/afe_plausibility.c +++ b/src/app/driver/afe/api/afe_plausibility.c @@ -43,8 +43,8 @@ * @file afe_plausibility.c * @author foxBMS Team * @date 2019-01-24 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup MODULES * @prefix AFE * @@ -69,15 +69,15 @@ /*========== Extern Function Implementations ================================*/ extern STD_RETURN_TYPE_e AFE_PlausibilityCheckVoltageMeasurementRange( - const int16_t cellvoltage_mV, + const int16_t cellVoltage_mV, const AFE_PLAUSIBILITY_VALUES_s plausibleValues) { STD_RETURN_TYPE_e retval = STD_OK; /* sanity-check: limits have to be ascending and not equal */ FAS_ASSERT(plausibleValues.maximumPlausibleVoltage_mV > plausibleValues.minimumPlausibleVoltage_mV); - if ((cellvoltage_mV > plausibleValues.maximumPlausibleVoltage_mV) || - (cellvoltage_mV < plausibleValues.minimumPlausibleVoltage_mV)) { + if ((cellVoltage_mV > plausibleValues.maximumPlausibleVoltage_mV) || + (cellVoltage_mV < plausibleValues.minimumPlausibleVoltage_mV)) { /* Cell voltage measurement value out of measurement range */ retval = STD_NOT_OK; } diff --git a/src/app/driver/afe/api/afe_plausibility.h b/src/app/driver/afe/api/afe_plausibility.h index 8ea020fc..168743e0 100644 --- a/src/app/driver/afe/api/afe_plausibility.h +++ b/src/app/driver/afe/api/afe_plausibility.h @@ -43,8 +43,8 @@ * @file afe_plausibility.h * @author foxBMS Team * @date 2019-01-24 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup MODULES * @prefix AFE * @@ -84,14 +84,14 @@ typedef struct { /** * @brief Cell voltage measurement range plausibility check * - * @param cellvoltage_mV cell voltage that is checked in mV + * @param cellVoltage_mV cell voltage that is checked in mV * @param plausibleValues struct of type #AFE_PLAUSIBILITY_VALUES_s with the * plausible limits of cell voltages * * @return #STD_OK if no plausibility issue detected, otherwise #STD_NOT_OK */ extern STD_RETURN_TYPE_e AFE_PlausibilityCheckVoltageMeasurementRange( - const int16_t cellvoltage_mV, + const int16_t cellVoltage_mV, const AFE_PLAUSIBILITY_VALUES_s plausibleValues); /** diff --git a/src/app/driver/afe/debug/default/api/debug_default_afe.c b/src/app/driver/afe/debug/default/api/debug_default_afe.c index 4424390f..f2e5edc9 100644 --- a/src/app/driver/afe/debug/default/api/debug_default_afe.c +++ b/src/app/driver/afe/debug/default/api/debug_default_afe.c @@ -43,8 +43,8 @@ * @file debug_default_afe.c * @author foxBMS Team * @date 2020-09-17 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVER * @prefix FAKE * diff --git a/src/app/driver/afe/debug/default/api/debug_default_afe.h b/src/app/driver/afe/debug/default/api/debug_default_afe.h index 9058878a..e27d2c19 100644 --- a/src/app/driver/afe/debug/default/api/debug_default_afe.h +++ b/src/app/driver/afe/debug/default/api/debug_default_afe.h @@ -43,8 +43,8 @@ * @file debug_default_afe.h * @author foxBMS Team * @date 2020-09-17 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix FAKE * diff --git a/src/app/driver/afe/debug/default/api/debug_default_afe_dma.c b/src/app/driver/afe/debug/default/api/debug_default_afe_dma.c index ffb000d4..a304c14c 100644 --- a/src/app/driver/afe/debug/default/api/debug_default_afe_dma.c +++ b/src/app/driver/afe/debug/default/api/debug_default_afe_dma.c @@ -43,8 +43,8 @@ * @file debug_default_afe_dma.c * @author foxBMS Team * @date 2020-09-17 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix FAKE * diff --git a/src/app/driver/afe/debug/default/api/debug_default_afe_dma.h b/src/app/driver/afe/debug/default/api/debug_default_afe_dma.h index c84ac46c..3b0c9f0f 100644 --- a/src/app/driver/afe/debug/default/api/debug_default_afe_dma.h +++ b/src/app/driver/afe/debug/default/api/debug_default_afe_dma.h @@ -43,8 +43,8 @@ * @file debug_default_afe_dma.h * @author foxBMS Team * @date 2020-09-17 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix FAKE * diff --git a/src/app/driver/afe/debug/default/config/debug_default_cfg.c b/src/app/driver/afe/debug/default/config/debug_default_cfg.c index 6e714e78..0e0f4c70 100644 --- a/src/app/driver/afe/debug/default/config/debug_default_cfg.c +++ b/src/app/driver/afe/debug/default/config/debug_default_cfg.c @@ -43,8 +43,8 @@ * @file debug_default_cfg.c * @author foxBMS Team * @date 2020-09-17 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS_CONFIGURATION * @prefix FAKE * diff --git a/src/app/driver/afe/debug/default/config/debug_default_cfg.h b/src/app/driver/afe/debug/default/config/debug_default_cfg.h index 1b490bac..d28de25e 100644 --- a/src/app/driver/afe/debug/default/config/debug_default_cfg.h +++ b/src/app/driver/afe/debug/default/config/debug_default_cfg.h @@ -43,8 +43,8 @@ * @file debug_default_cfg.h * @author foxBMS Team * @date 2020-09-17 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS_CONFIGURATION * @prefix FAKE * diff --git a/src/app/driver/afe/debug/default/debug_default.c b/src/app/driver/afe/debug/default/debug_default.c index 5751ba15..f589e645 100644 --- a/src/app/driver/afe/debug/default/debug_default.c +++ b/src/app/driver/afe/debug/default/debug_default.c @@ -43,8 +43,8 @@ * @file debug_default.c * @author foxBMS Team * @date 2020-09-17 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVER * @prefix FAKE * diff --git a/src/app/driver/afe/debug/default/debug_default.h b/src/app/driver/afe/debug/default/debug_default.h index 9fee96c7..8b3b0522 100644 --- a/src/app/driver/afe/debug/default/debug_default.h +++ b/src/app/driver/afe/debug/default/debug_default.h @@ -43,8 +43,8 @@ * @file debug_default.h * @author foxBMS Team * @date 2020-09-17 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix FAKE * diff --git a/src/app/driver/afe/debug/default/wscript b/src/app/driver/afe/debug/default/wscript index 40f0b286..3444ad0b 100644 --- a/src/app/driver/afe/debug/default/wscript +++ b/src/app/driver/afe/debug/default/wscript @@ -71,7 +71,7 @@ def build(bld): os.path.join("..", "..", "..", "..", "engine", "diag"), os.path.join("..", "..", "..", "..", "task", "os"), ] - includes.extend(bld.env.INCLUDES_OPERATING_SYSTEM) + includes.extend(bld.env.INCLUDES_RTOS) cflags = bld.env.CFLAGS_FOXBMS target = f"{bld.env.APPNAME.lower()}-afe-driver" bld.stlib( diff --git a/src/app/driver/afe/debug/wscript b/src/app/driver/afe/debug/wscript index 790f660d..7c1c47c7 100644 --- a/src/app/driver/afe/debug/wscript +++ b/src/app/driver/afe/debug/wscript @@ -45,4 +45,4 @@ Helper script to recursively build the variant of the debug AFE""" def build(bld): """selects the driver library to be build""" - bld.recurse(bld.env.afe_chip) + bld.recurse(bld.env.afe_ic) diff --git a/src/app/driver/afe/ltc/6806/config/ltc_6806_cfg.c b/src/app/driver/afe/ltc/6806/config/ltc_6806_cfg.c index f95a1a51..148e661b 100644 --- a/src/app/driver/afe/ltc/6806/config/ltc_6806_cfg.c +++ b/src/app/driver/afe/ltc/6806/config/ltc_6806_cfg.c @@ -43,8 +43,8 @@ * @file ltc_6806_cfg.c * @author foxBMS Team * @date 2015-02-18 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS_CONFIGURATION * @prefix LTC * @@ -62,19 +62,22 @@ /*========== Extern Constant and Variable Definitions =======================*/ const uint8_t ltc_voltage_input_used[BS_MAX_SUPPORTED_CELLS] = { -#if BS_MAX_SUPPORTED_CELLS == 12 || BS_MAX_SUPPORTED_CELLS == 15 || BS_MAX_SUPPORTED_CELLS == 18 || \ - BS_MAX_SUPPORTED_CELLS == 36 +#if (BS_MAX_SUPPORTED_CELLS == 12) || (BS_MAX_SUPPORTED_CELLS == 14) || (BS_MAX_SUPPORTED_CELLS == 15) || \ + (BS_MAX_SUPPORTED_CELLS == 18) || (BS_MAX_SUPPORTED_CELLS == 36) 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, #endif -#if BS_MAX_SUPPORTED_CELLS == 15 || BS_MAX_SUPPORTED_CELLS == 18 || BS_MAX_SUPPORTED_CELLS == 36 - 1, 1, 1, +#if (BS_MAX_SUPPORTED_CELLS == 14) || (BS_MAX_SUPPORTED_CELLS == 15) || (BS_MAX_SUPPORTED_CELLS == 18) || \ + (BS_MAX_SUPPORTED_CELLS == 36) + 1, 1, +#endif +#if (BS_MAX_SUPPORTED_CELLS == 15) || (BS_MAX_SUPPORTED_CELLS == 18) || (BS_MAX_SUPPORTED_CELLS == 36) + 1, #endif -#if BS_MAX_SUPPORTED_CELLS == 18 || BS_MAX_SUPPORTED_CELLS == 36 +#if (BS_MAX_SUPPORTED_CELLS == 18) || (BS_MAX_SUPPORTED_CELLS == 36) 1, 1, 1, #endif -#if BS_MAX_SUPPORTED_CELLS == 36 +#if (BS_MAX_SUPPORTED_CELLS == 36) 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - #endif }; diff --git a/src/app/driver/afe/ltc/6806/config/ltc_6806_cfg.h b/src/app/driver/afe/ltc/6806/config/ltc_6806_cfg.h index b7ba8212..11255af0 100644 --- a/src/app/driver/afe/ltc/6806/config/ltc_6806_cfg.h +++ b/src/app/driver/afe/ltc/6806/config/ltc_6806_cfg.h @@ -43,8 +43,8 @@ * @file ltc_6806_cfg.h * @author foxBMS Team * @date 2015-02-18 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS_CONFIGURATION * @prefix LTC * @@ -111,7 +111,7 @@ #define LTC_HIRNG (0u) /** Open-wire voltage measurement time for fuel cells */ -#define LTC_FUEL_CELL_ADOW_TIME_MS (100U + 1U) +#define LTC_FUEL_CELL_ADOW_TIME_MS (100u + 1u) /** Open-wire detection threshold */ #define LTC_ADOW_THRESHOLD (-200) @@ -162,7 +162,7 @@ #define LTC_TIDLE_US (6700) /** LTC SPI wakeup time */ -#define LTC_SPI_WAKEUP_WAIT_TIME_US (30U) +#define LTC_SPI_WAKEUP_WAIT_TIME_US (30u) /** Time to measure all fuel cells in normal mode 10280 µs */ #define LTC_FUELCELL_NORMAL_ALL_CELLS_MS (11) @@ -265,14 +265,14 @@ * Transmit functions * @{ */ -#define LTC_TransmitWakeUp(spi_ltcInterface) SPI_TransmitDummyByte(spi_ltcInterface, LTC_SPI_WAKEUP_WAIT_TIME_US) -#define LTC_TransmitI2cCommand(spi_ltcInterface, txbuf) \ +#define LTC_TRANSMIT_WAKE_UP(spi_ltcInterface) SPI_TransmitDummyByte(spi_ltcInterface, LTC_SPI_WAKEUP_WAIT_TIME_US) +#define LTC_TRANSMIT_I2C_COMMAND(spi_ltcInterface, txbuf) \ SPI_TransmitDummyByte(spi_ltcInterface, LTC_SPI_WAKEUP_WAIT_TIME_US); \ SPI_TransmitData(spi_ltcInterface, txbuf, 4 + 9) -#define LTC_TransmitCommand(spi_ltcInterface, command) \ +#define LTC_TRANSMIT_COMMAND(spi_ltcInterface, command) \ SPI_TransmitDummyByte(spi_ltcInterface, LTC_SPI_WAKEUP_WAIT_TIME_US); \ SPI_TransmitData(spi_ltcInterface, command, 4) -#define LTC_TransmitReceiveData(spi_ltcInterface, txbuf, rxbuf, length) \ +#define LTC_TRANSMIT_RECEIVE_DATA(spi_ltcInterface, txbuf, rxbuf, length) \ SPI_TransmitDummyByte(spi_ltcInterface, LTC_SPI_WAKEUP_WAIT_TIME_US); \ SPI_TransmitReceiveDataDma(spi_ltcInterface, txbuf, rxbuf, length) /**@}*/ diff --git a/src/app/driver/afe/ltc/6806/ltc_6806.c b/src/app/driver/afe/ltc/6806/ltc_6806.c index d60427f0..29fdfcb2 100644 --- a/src/app/driver/afe/ltc/6806/ltc_6806.c +++ b/src/app/driver/afe/ltc/6806/ltc_6806.c @@ -43,8 +43,8 @@ * @file ltc_6806.c * @author foxBMS Team * @date 2019-09-01 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix LTC * @@ -117,7 +117,7 @@ uint16_t ltc_TxPecBuffer[LTC_N_BYTES_FOR_DATA_TRANSMISSION] = {0}; static uint16_t ltc_used_cells_index[BS_NR_OF_STRINGS] = {0}; /** local copies of database tables */ /**@{*/ -static DATA_BLOCK_CELL_VOLTAGE_s ltc_cellvoltage = {.header.uniqueId = DATA_BLOCK_ID_CELL_VOLTAGE_BASE}; +static DATA_BLOCK_CELL_VOLTAGE_s ltc_cellVoltage = {.header.uniqueId = DATA_BLOCK_ID_CELL_VOLTAGE_BASE}; static DATA_BLOCK_CELL_TEMPERATURE_s ltc_celltemperature = {.header.uniqueId = DATA_BLOCK_ID_CELL_TEMPERATURE_BASE}; static DATA_BLOCK_ALL_GPIO_VOLTAGES_s ltc_allgpiovoltage = {.header.uniqueId = DATA_BLOCK_ID_ALL_GPIO_VOLTAGES_BASE}; static DATA_BLOCK_OPEN_WIRE_s ltc_openwire = {.header.uniqueId = DATA_BLOCK_ID_OPEN_WIRE_BASE}; @@ -167,7 +167,7 @@ LTC_STATE_s ltc_stateBase = { .ltcData.txBuffer = ltc_TxPecBuffer, .ltcData.rxBuffer = ltc_RxPecBuffer, .ltcData.frameLength = LTC_N_BYTES_FOR_DATA_TRANSMISSION, - .ltcData.cellVoltage = <c_cellvoltage, + .ltcData.cellVoltage = <c_cellVoltage, .ltcData.cellTemperature = <c_celltemperature, .ltcData.balancingFeedback = NULL_PTR, .ltcData.balancingControl = NULL_PTR, @@ -359,15 +359,20 @@ static void LTC_StateTransition(LTC_STATE_s *ltc_state, LTC_STATEMACH_e state, u * statemachine will transition to state_nok and substate_nok. Depending on * value of retVal the corresponding diagnosis entry will be called. * - * @param ltc_state: state of the ltc state machine - * @param retVal: condition to determine if statemachine will transition into ok or nok states - * @param diagCode: symbolic IDs for diagnosis entry, called with #DIAG_EVENT_OK if retVal is #STD_OK, #DIAG_EVENT_NOT_OK otherwise - * @param state_ok state to transition into if retVal is #STD_OK - * @param substate_ok: substate to transition into if retVal is #STD_OK - * @param timer_ms_ok: transition into state_ok, substate_ok after timer_ms_ok elapsed - * @param state_nok: state to transition into if retVal is #STD_NOT_OK - * @param substate_nok: substate to transition into if retVal is #STD_NOT_OK - * @param timer_ms_nok: transition into state_nok, substate_nok after timer_ms_nok elapsed + * @param ltc_state state of the ltc state machine + * @param retVal condition to determine if state machine will transition + * into ok or nok states + * @param diagCode symbolic IDs for diagnosis entry, called with + * #DIAG_EVENT_OK if retVal is #STD_OK, #DIAG_EVENT_NOT_OK + * otherwise + * @param state_ok state to transition into if retVal is #STD_OK + * @param substate_ok substate to transition into if retVal is #STD_OK + * @param timer_ms_ok transition into state_ok, substate_ok after timer_ms_ok + * elapsed + * @param state_nok state to transition into if retVal is #STD_NOT_OK + * @param substate_nok substate to transition into if retVal is #STD_NOT_OK + * @param timer_ms_nok transition into state_nok, substate_nok after + * timer_ms_nok elapsed */ static void LTC_CondBasedStateTransition( LTC_STATE_s *ltc_state, @@ -678,7 +683,8 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { ltc_state, LTC_STATEMACH_INITIALIZATION, LTC_ENTRY_INITIALIZATION, LTC_STATEMACH_SHORTTIME); } else if (ltc_state->substate == LTC_ENTRY_INITIALIZATION) { LTC_SaveLastStates(ltc_state); - retVal = LTC_TransmitWakeUp(ltc_state->spiSeqPtr); /* Send dummy byte to wake up the daisy chain */ + retVal = + LTC_TRANSMIT_WAKE_UP(ltc_state->spiSeqPtr); /* Send dummy byte to wake up the daisy chain */ LTC_CondBasedStateTransition( ltc_state, retVal, @@ -689,11 +695,10 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_STATEMACH_INITIALIZATION, LTC_ENTRY_INITIALIZATION, LTC_STATEMACH_SHORTTIME); - } else if (ltc_state->substate == LTC_RE_ENTRY_INITIALIZATION) { LTC_SaveLastStates(ltc_state); - retVal = - LTC_TransmitWakeUp(ltc_state->spiSeqPtr); /* Send dummy byte again to wake up the daisy chain */ + retVal = LTC_TRANSMIT_WAKE_UP( + ltc_state->spiSeqPtr); /* Send dummy byte again to wake up the daisy chain */ LTC_CondBasedStateTransition( ltc_state, retVal, @@ -704,7 +709,6 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_STATEMACH_INITIALIZATION, LTC_RE_ENTRY_INITIALIZATION, LTC_STATEMACH_SHORTTIME); - } else if (ltc_state->substate == LTC_START_INIT_INITIALIZATION) { LTC_SaveLastStates(ltc_state); ltc_state->check_spi_flag = STD_OK; @@ -721,7 +725,6 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_STATEMACH_INITIALIZATION, LTC_CHECK_INITIALIZATION, ltc_state->commandDataTransferTime + LTC_TRANSMISSION_TIMEOUT); - } else if (ltc_state->substate == LTC_CHECK_INITIALIZATION) { /* Read values written in config register, currently unused */ LTC_SaveLastStates(ltc_state); @@ -737,7 +740,6 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_STATEMACH_INITIALIZATION, LTC_EXIT_INITIALIZATION, ltc_state->commandDataTransferTime + LTC_TRANSMISSION_TIMEOUT); - } else if (ltc_state->substate == LTC_EXIT_INITIALIZATION) { LTC_SaveLastStates(ltc_state); ++ltc_state->spiSeqPtr; @@ -831,7 +833,6 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_READ_VOLTAGE_REGISTER_B_RDCVB_READVOLTAGE, LTC_STATEMACH_SHORTTIME); break; - } else if (ltc_state->substate == LTC_READ_VOLTAGE_REGISTER_B_RDCVB_READVOLTAGE) { retVal = LTC_CheckPec(ltc_state, ltc_state->ltcData.rxBuffer, ltc_state->currentString); DIAG_CheckEvent(retVal, DIAG_ID_AFE_COM_INTEGRITY, DIAG_STRING, ltc_state->currentString); @@ -856,7 +857,6 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_READ_VOLTAGE_REGISTER_C_RDCVC_READVOLTAGE, LTC_STATEMACH_SHORTTIME); break; - } else if (ltc_state->substate == LTC_READ_VOLTAGE_REGISTER_C_RDCVC_READVOLTAGE) { retVal = LTC_CheckPec(ltc_state, ltc_state->ltcData.rxBuffer, ltc_state->currentString); DIAG_CheckEvent(retVal, DIAG_ID_AFE_COM_INTEGRITY, DIAG_STRING, ltc_state->currentString); @@ -881,7 +881,6 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_READ_VOLTAGE_REGISTER_D_RDCVD_READVOLTAGE, LTC_STATEMACH_SHORTTIME); break; - } else if (ltc_state->substate == LTC_READ_VOLTAGE_REGISTER_D_RDCVD_READVOLTAGE) { retVal = LTC_CheckPec(ltc_state, ltc_state->ltcData.rxBuffer, ltc_state->currentString); DIAG_CheckEvent(retVal, DIAG_ID_AFE_COM_INTEGRITY, DIAG_STRING, ltc_state->currentString); @@ -906,7 +905,6 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_READ_VOLTAGE_REGISTER_E_RDCVE_READVOLTAGE, LTC_STATEMACH_SHORTTIME); break; - } else if (ltc_state->substate == LTC_READ_VOLTAGE_REGISTER_E_RDCVE_READVOLTAGE) { retVal = LTC_CheckPec(ltc_state, ltc_state->ltcData.rxBuffer, ltc_state->currentString); DIAG_CheckEvent(retVal, DIAG_ID_AFE_COM_INTEGRITY, DIAG_STRING, ltc_state->currentString); @@ -931,7 +929,6 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_READ_VOLTAGE_REGISTER_F_RDCVF_READVOLTAGE, LTC_STATEMACH_SHORTTIME); break; - } else if (ltc_state->substate == LTC_READ_VOLTAGE_REGISTER_F_RDCVF_READVOLTAGE) { retVal = LTC_CheckPec(ltc_state, ltc_state->ltcData.rxBuffer, ltc_state->currentString); DIAG_CheckEvent(retVal, DIAG_ID_AFE_COM_INTEGRITY, DIAG_STRING, ltc_state->currentString); @@ -956,7 +953,6 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_READ_VOLTAGE_REGISTER_G_RDCVG_READVOLTAGE, LTC_STATEMACH_SHORTTIME); break; - } else if (ltc_state->substate == LTC_READ_VOLTAGE_REGISTER_G_RDCVG_READVOLTAGE) { retVal = LTC_CheckPec(ltc_state, ltc_state->ltcData.rxBuffer, ltc_state->currentString); DIAG_CheckEvent(retVal, DIAG_ID_AFE_COM_INTEGRITY, DIAG_STRING, ltc_state->currentString); @@ -981,7 +977,6 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_READ_VOLTAGE_REGISTER_H_RDCVH_READVOLTAGE, LTC_STATEMACH_SHORTTIME); break; - } else if (ltc_state->substate == LTC_READ_VOLTAGE_REGISTER_H_RDCVH_READVOLTAGE) { retVal = LTC_CheckPec(ltc_state, ltc_state->ltcData.rxBuffer, ltc_state->currentString); DIAG_CheckEvent(retVal, DIAG_ID_AFE_COM_INTEGRITY, DIAG_STRING, ltc_state->currentString); @@ -1006,7 +1001,6 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_READ_VOLTAGE_REGISTER_I_RDCVI_READVOLTAGE, LTC_STATEMACH_SHORTTIME); break; - } else if (ltc_state->substate == LTC_READ_VOLTAGE_REGISTER_I_RDCVI_READVOLTAGE) { retVal = LTC_CheckPec(ltc_state, ltc_state->ltcData.rxBuffer, ltc_state->currentString); DIAG_CheckEvent(retVal, DIAG_ID_AFE_COM_INTEGRITY, DIAG_STRING, ltc_state->currentString); @@ -1031,7 +1025,6 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_EXIT_READVOLTAGE, LTC_STATEMACH_SHORTTIME); break; - } else if (ltc_state->substate == LTC_EXIT_READVOLTAGE) { retVal = LTC_CheckPec(ltc_state, ltc_state->ltcData.rxBuffer, ltc_state->currentString); DIAG_CheckEvent(retVal, DIAG_ID_AFE_COM_INTEGRITY, DIAG_STRING, ltc_state->currentString); @@ -1143,7 +1136,6 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_STATEMACH_OPENWIRE_CHECK, LTC_REQUEST_PULLDOWN_CURRENT_OPENWIRE_CHECK, LTC_STATEMACH_SHORTTIME); - } else if (ltc_state->substate == LTC_REQUEST_PULLDOWN_CURRENT_OPENWIRE_CHECK) { /* Run ADOW command with PUP = 0 */ ltc_state->adcMode = LTC_OW_MEASUREMENT_MODE; @@ -1191,7 +1183,6 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_StateTransition( ltc_state, LTC_STATEMACH_OPENWIRE_CHECK, LTC_PERFORM_OPENWIRE_CHECK, LTC_STATEMACH_SHORTTIME); - } else if (ltc_state->substate == LTC_PERFORM_OPENWIRE_CHECK) { /* Perform actual open-wire check */ @@ -1434,7 +1425,7 @@ static STD_RETURN_TYPE_e LTC_Init( pTxBuff[11u + (i * 8u)] = PEC_result & 0xFFu; } /* end for */ - retVal = LTC_TransmitReceiveData(pSpiInterface, pTxBuff, pRxBuff, frameLength); + retVal = LTC_TRANSMIT_RECEIVE_DATA(pSpiInterface, pTxBuff, pRxBuff, frameLength); return retVal; } @@ -1479,7 +1470,7 @@ static STD_RETURN_TYPE_e LTC_StartVoltageMeasurement( LTC_ADCMEAS_CHAN_e adcMeasCh) { STD_RETURN_TYPE_e retVal = STD_OK; - retVal = LTC_TransmitCommand(pSpiInterface, ltc_cmdADCV_normal_Fuelcell); + retVal = LTC_TRANSMIT_COMMAND(pSpiInterface, ltc_cmdADCV_normal_Fuelcell); return retVal; } @@ -1504,10 +1495,10 @@ static STD_RETURN_TYPE_e LTC_StartOpenWireMeasurement( if (PUP == 0u) { /* pull-down current */ - retval = LTC_TransmitCommand(pSpiInterface, ltc_BC_cmdADOW_PDOWN_100ms_fuelcell); + retval = LTC_TRANSMIT_COMMAND(pSpiInterface, ltc_BC_cmdADOW_PDOWN_100ms_fuelcell); } else if (PUP == 1u) { /* pull-up current */ - retval = LTC_TransmitCommand(pSpiInterface, ltc_BC_cmdADOW_PUP_100ms_fuelcell); + retval = LTC_TRANSMIT_COMMAND(pSpiInterface, ltc_BC_cmdADOW_PUP_100ms_fuelcell); } return retval; @@ -1570,26 +1561,33 @@ static STD_RETURN_TYPE_e LTC_CheckPec( } /** - * @brief send command to the LTC daisy-chain and receives data from the LTC daisy-chain. - * - * This is the core function to receive data from the LTC6804 daisy-chain. - * A 2 byte command is sent with the corresponding PEC. Example: read configuration register (RDCFG). - * Only command has to be set, the function calculates the PEC automatically. - * The data send is: - * 2 bytes (COMMAND) 2 bytes (PEC) - * The data received is: - * 6 bytes (LTC1) 2 bytes (PEC) + 6 bytes (LTC2) 2 bytes (PEC) + 6 bytes (LTC3) 2 bytes (PEC) + ... + 6 bytes (LTC{LTC_N_LTC}) 2 bytes (PEC) - * - * The function does not check the PECs. This has to be done elsewhere. - * - * @param Command command sent to the daisy-chain - * @param pSpiInterface pointer to SPI configuration - * @param pTxBuff transmit buffer - * @param pRxBuff receive buffer - * @param frameLength number of words to transmit - * - * @return statusSPI #STD_OK if SPI transmission is OK, #STD_NOT_OK otherwise - * + * @brief send command to the LTC daisy-chain and receives data from the LTC + * daisy-chain. + * @details This is the core function to receive data from the LTC6806 + * daisy-chain. + * A 2 byte command is sent with the corresponding PEC. + * *Example*: read configuration register (RDCFG). + * Only command has to be set, the function calculates the PEC + * automatically. + * - The data sent is: + * - 2 bytes (COMMAND) 2 bytes (PEC) + * - The data received is: + * - 6 bytes (LTC1) 2 bytes (PEC) + + * - 6 bytes (LTC2) 2 bytes (PEC) + + * - 6 bytes (LTC3) 2 bytes (PEC) + + * - ... + + * - 6 bytes (LTC{LTC_N_LTC}) 2 bytes (PEC) + * + * The function does not check the PECs. This has to be done + * elsewhere. + * + * @param Command command sent to the daisy-chain + * @param pSpiInterface pointer to SPI configuration + * @param pTxBuff transmit buffer + * @param pRxBuff receive buffer + * @param frameLength number of words to transmit + * + * @return #STD_OK if SPI transmission is OK, #STD_NOT_OK otherwise */ static STD_RETURN_TYPE_e LTC_ReadRegister( uint16_t *Command, @@ -1613,7 +1611,7 @@ static STD_RETURN_TYPE_e LTC_ReadRegister( pTxBuff[2] = Command[2]; pTxBuff[3] = Command[3]; - statusSPI = LTC_TransmitReceiveData(pSpiInterface, pTxBuff, pRxBuff, frameLength); + statusSPI = LTC_TRANSMIT_RECEIVE_DATA(pSpiInterface, pTxBuff, pRxBuff, frameLength); return statusSPI; } diff --git a/src/app/driver/afe/ltc/6806/ltc_6806.json b/src/app/driver/afe/ltc/6806/ltc_6806.json index e5106bf9..ab69d8bb 100644 --- a/src/app/driver/afe/ltc/6806/ltc_6806.json +++ b/src/app/driver/afe/ltc/6806/ltc_6806.json @@ -2,8 +2,6 @@ "include": [ ".", "config", - "../../api", - "common", - "common/config" + "../../api" ] } diff --git a/src/app/driver/afe/ltc/6806/wscript b/src/app/driver/afe/ltc/6806/wscript index 127c8d25..52adaa05 100644 --- a/src/app/driver/afe/ltc/6806/wscript +++ b/src/app/driver/afe/ltc/6806/wscript @@ -76,7 +76,7 @@ def build(bld): os.path.join("..", "..", "..", "..", "main", "include"), os.path.join("..", "..", "..", "..", "task", "os"), ] - includes.extend(bld.env.INCLUDES_OPERATING_SYSTEM) + includes.extend(bld.env.INCLUDES_RTOS) cflags = bld.env.CFLAGS_FOXBMS target = f"{bld.env.APPNAME.lower()}-afe-driver" bld.stlib( diff --git a/src/app/driver/afe/ltc/6813-1/config/ltc_6813-1_cfg.c b/src/app/driver/afe/ltc/6813-1/config/ltc_6813-1_cfg.c index 9b9e251d..801ba694 100644 --- a/src/app/driver/afe/ltc/6813-1/config/ltc_6813-1_cfg.c +++ b/src/app/driver/afe/ltc/6813-1/config/ltc_6813-1_cfg.c @@ -43,8 +43,8 @@ * @file ltc_6813-1_cfg.c * @author foxBMS Team * @date 2015-02-18 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS_CONFIGURATION * @prefix LTC * @@ -201,19 +201,22 @@ const uint8_t ltc_muxsensortemperatur_cfg[BS_NR_OF_TEMP_SENSORS_PER_MODULE] = { }; const uint8_t ltc_voltage_input_used[BS_MAX_SUPPORTED_CELLS] = { -#if (BS_MAX_SUPPORTED_CELLS == 12) || (BS_MAX_SUPPORTED_CELLS == 15) || (BS_MAX_SUPPORTED_CELLS == 18) || \ - (BS_MAX_SUPPORTED_CELLS == 36) +#if (BS_MAX_SUPPORTED_CELLS == 12) || (BS_MAX_SUPPORTED_CELLS == 14) || (BS_MAX_SUPPORTED_CELLS == 15) || \ + (BS_MAX_SUPPORTED_CELLS == 18) || (BS_MAX_SUPPORTED_CELLS == 36) 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, #endif +#if (BS_MAX_SUPPORTED_CELLS == 14) || (BS_MAX_SUPPORTED_CELLS == 15) || (BS_MAX_SUPPORTED_CELLS == 18) || \ + (BS_MAX_SUPPORTED_CELLS == 36) + 1, 1, +#endif #if (BS_MAX_SUPPORTED_CELLS == 15) || (BS_MAX_SUPPORTED_CELLS == 18) || (BS_MAX_SUPPORTED_CELLS == 36) - 1, 1, 1, + 1, #endif #if (BS_MAX_SUPPORTED_CELLS == 18) || (BS_MAX_SUPPORTED_CELLS == 36) 1, 1, 1, #endif #if (BS_MAX_SUPPORTED_CELLS == 36) 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - #endif }; diff --git a/src/app/driver/afe/ltc/6813-1/config/ltc_6813-1_cfg.h b/src/app/driver/afe/ltc/6813-1/config/ltc_6813-1_cfg.h index 62e1769d..2b93f363 100644 --- a/src/app/driver/afe/ltc/6813-1/config/ltc_6813-1_cfg.h +++ b/src/app/driver/afe/ltc/6813-1/config/ltc_6813-1_cfg.h @@ -43,8 +43,8 @@ * @file ltc_6813-1_cfg.h * @author foxBMS Team * @date 2015-02-18 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS_CONFIGURATION * @prefix LTC * @@ -163,7 +163,7 @@ #define LTC_TIDLE_US (6700) /** LTC SPI wakeup time */ -#define LTC_SPI_WAKEUP_WAIT_TIME_US (30U) +#define LTC_SPI_WAKEUP_WAIT_TIME_US (30u) /** LTC statemachine short time definition in ms */ #define LTC_STATEMACH_SHORTTIME (1) @@ -299,14 +299,14 @@ * Transmit functions * @{ */ -#define LTC_TransmitWakeUp(spi_ltcInterface) SPI_TransmitDummyByte(spi_ltcInterface, LTC_SPI_WAKEUP_WAIT_TIME_US) -#define LTC_TransmitI2cCommand(spi_ltcInterface, txbuf) \ +#define LTC_TRANSMIT_WAKE_UP(spi_ltcInterface) SPI_TransmitDummyByte(spi_ltcInterface, LTC_SPI_WAKEUP_WAIT_TIME_US) +#define LTC_TRANSMIT_I2C_COMMAND(spi_ltcInterface, txbuf) \ SPI_TransmitDummyByte(spi_ltcInterface, LTC_SPI_WAKEUP_WAIT_TIME_US); \ SPI_TransmitData(spi_ltcInterface, txbuf, 4 + 9) -#define LTC_TransmitCommand(spi_ltcInterface, command) \ +#define LTC_TRANSMIT_COMMAND(spi_ltcInterface, command) \ SPI_TransmitDummyByte(spi_ltcInterface, LTC_SPI_WAKEUP_WAIT_TIME_US); \ SPI_TransmitData(spi_ltcInterface, command, 4) -#define LTC_TransmitReceiveData(spi_ltcInterface, txbuf, rxbuf, length) \ +#define LTC_TRANSMIT_RECEIVE_DATA(spi_ltcInterface, txbuf, rxbuf, length) \ SPI_TransmitDummyByte(spi_ltcInterface, LTC_SPI_WAKEUP_WAIT_TIME_US); \ SPI_TransmitReceiveDataDma(spi_ltcInterface, txbuf, rxbuf, length) /**@}*/ diff --git a/src/app/driver/afe/ltc/6813-1/ltc_6813-1.c b/src/app/driver/afe/ltc/6813-1/ltc_6813-1.c index b0a59c82..d2f95c56 100644 --- a/src/app/driver/afe/ltc/6813-1/ltc_6813-1.c +++ b/src/app/driver/afe/ltc/6813-1/ltc_6813-1.c @@ -43,8 +43,8 @@ * @file ltc_6813-1.c * @author foxBMS Team * @date 2019-09-01 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix LTC * @@ -113,7 +113,7 @@ uint16_t ltc_TxPecBuffer[LTC_N_BYTES_FOR_DATA_TRANSMISSION] = {0}; static uint16_t ltc_used_cells_index[BS_NR_OF_STRINGS] = {0}; /** local copies of database tables */ /**@{*/ -static DATA_BLOCK_CELL_VOLTAGE_s ltc_cellvoltage = {.header.uniqueId = DATA_BLOCK_ID_CELL_VOLTAGE_BASE}; +static DATA_BLOCK_CELL_VOLTAGE_s ltc_cellVoltage = {.header.uniqueId = DATA_BLOCK_ID_CELL_VOLTAGE_BASE}; static DATA_BLOCK_CELL_TEMPERATURE_s ltc_celltemperature = {.header.uniqueId = DATA_BLOCK_ID_CELL_TEMPERATURE_BASE}; static DATA_BLOCK_BALANCING_FEEDBACK_s ltc_balancing_feedback = { .header.uniqueId = DATA_BLOCK_ID_BALANCING_FEEDBACK_BASE}; @@ -172,7 +172,7 @@ LTC_STATE_s ltc_stateBase = { .ltcData.txBuffer = ltc_TxPecBuffer, .ltcData.rxBuffer = ltc_RxPecBuffer, .ltcData.frameLength = LTC_N_BYTES_FOR_DATA_TRANSMISSION, - .ltcData.cellVoltage = <c_cellvoltage, + .ltcData.cellVoltage = <c_cellVoltage, .ltcData.cellTemperature = <c_celltemperature, .ltcData.balancingFeedback = <c_balancing_feedback, .ltcData.balancingControl = <c_balancing_control, @@ -237,7 +237,7 @@ static uint16_t ltc_cmdADCV_fast_DCP0[4] = static uint16_t ltc_cmdADCV_fast_DCP1[4] = {0x02, 0xF0, 0x63, 0x28}; /*!< All cells, fast mode, discharge permitted (DCP=1) */ static uint16_t ltc_cmdADCV_fast_DCP0_twocells[4] = - {0x02, 0xE1, 0xb3, 0x34}; /*!< Two cells (1 and 7), fast mode, discharge not permitted (DCP=0) */ + {0x02, 0xE1, 0xB3, 0x34}; /*!< Two cells (1 and 7), fast mode, discharge not permitted (DCP=0) */ /* GPIOs */ static uint16_t ltc_cmdADAX_normal_GPIO1[4] = {0x05, 0x61, 0x58, 0x92}; /*!< Single channel, GPIO 1, normal mode */ @@ -532,15 +532,20 @@ static void LTC_StateTransition(LTC_STATE_s *ltc_state, LTC_STATEMACH_e state, u * statemachine will transition to state_nok and substate_nok. Depending on * value of retVal the corresponding diagnosis entry will be called. * - * @param ltc_state: state of the ltc state machine - * @param retVal: condition to determine if statemachine will transition into ok or nok states - * @param diagCode: symbolic IDs for diagnosis entry, called with #DIAG_EVENT_OK if retVal is #STD_OK, #DIAG_EVENT_NOT_OK otherwise - * @param state_ok state to transition into if retVal is #STD_OK - * @param substate_ok: substate to transition into if retVal is #STD_OK - * @param timer_ms_ok: transition into state_ok, substate_ok after timer_ms_ok elapsed - * @param state_nok: state to transition into if retVal is #STD_NOT_OK - * @param substate_nok: substate to transition into if retVal is #STD_NOT_OK - * @param timer_ms_nok: transition into state_nok, substate_nok after timer_ms_nok elapsed + * @param ltc_state state of the ltc state machine + * @param retVal condition to determine if state machine will transition + * into ok or nok states + * @param diagCode symbolic IDs for diagnosis entry, called with + * #DIAG_EVENT_OK if retVal is #STD_OK, #DIAG_EVENT_NOT_OK + * otherwise + * @param state_ok state to transition into if retVal is #STD_OK + * @param substate_ok substate to transition into if retVal is #STD_OK + * @param timer_ms_ok transition into state_ok, substate_ok after timer_ms_ok + * elapsed + * @param state_nok state to transition into if retVal is #STD_NOT_OK + * @param substate_nok substate to transition into if retVal is #STD_NOT_OK + * @param timer_ms_nok transition into state_nok, substate_nok after + * timer_ms_nok elapsed */ static void LTC_CondBasedStateTransition( LTC_STATE_s *ltc_state, @@ -624,6 +629,7 @@ extern void LTC_SaveVoltages(LTC_STATE_s *ltc_state, uint8_t stringNumber) { /*========== Extern Function Implementations ================================*/ extern void LTC_SaveTemperatures(LTC_STATE_s *ltc_state, uint8_t stringNumber) { + FAS_ASSERT(ltc_state != NULL_PTR); STD_RETURN_TYPE_e cellTemperatureMeasurementValid = STD_OK; uint16_t numberValidMeasurements = 0; @@ -662,6 +668,7 @@ extern void LTC_SaveTemperatures(LTC_STATE_s *ltc_state, uint8_t stringNumber) { } extern void LTC_SaveAllGpioMeasurement(LTC_STATE_s *ltc_state) { + FAS_ASSERT(ltc_state != NULL_PTR); ltc_state->ltcData.allGpioVoltages->state++; DATA_WRITE_DATA(ltc_state->ltcData.allGpioVoltages); } @@ -715,6 +722,7 @@ static void LTC_GetBalancingControlValues(LTC_STATE_s *ltc_state) { * */ uint8_t LTC_CheckReEntrance(LTC_STATE_s *ltc_state) { + FAS_ASSERT(ltc_state != NULL_PTR); uint8_t retval = 0; OS_EnterTaskCritical(); @@ -729,6 +737,7 @@ uint8_t LTC_CheckReEntrance(LTC_STATE_s *ltc_state) { } extern LTC_REQUEST_s LTC_GetStateRequest(LTC_STATE_s *ltc_state) { + FAS_ASSERT(ltc_state != NULL_PTR); LTC_REQUEST_s retval = {.request = LTC_STATE_NO_REQUEST, .string = 0x0u}; OS_EnterTaskCritical(); @@ -740,6 +749,7 @@ extern LTC_REQUEST_s LTC_GetStateRequest(LTC_STATE_s *ltc_state) { } extern LTC_STATEMACH_e LTC_GetState(LTC_STATE_s *ltc_state) { + FAS_ASSERT(ltc_state != NULL_PTR); return ltc_state->state; } @@ -762,6 +772,10 @@ LTC_REQUEST_s LTC_TransferStateRequest( uint8_t *pBusIDptr, LTC_ADCMODE_e *pAdcModeptr, LTC_ADCMEAS_CHAN_e *pAdcMeasChptr) { + FAS_ASSERT(ltc_state != NULL_PTR); + FAS_ASSERT(pBusIDptr != NULL_PTR); + FAS_ASSERT(pAdcModeptr != NULL_PTR); + FAS_ASSERT(pAdcMeasChptr != NULL_PTR); LTC_REQUEST_s retval = {.request = LTC_STATE_NO_REQUEST, .string = 0x0u}; OS_EnterTaskCritical(); @@ -778,6 +792,7 @@ LTC_REQUEST_s LTC_TransferStateRequest( } LTC_RETURN_TYPE_e LTC_SetStateRequest(LTC_STATE_s *ltc_state, LTC_REQUEST_s statereq) { + FAS_ASSERT(ltc_state != NULL_PTR); LTC_RETURN_TYPE_e retVal = LTC_ERROR; OS_EnterTaskCritical(); @@ -792,6 +807,7 @@ LTC_RETURN_TYPE_e LTC_SetStateRequest(LTC_STATE_s *ltc_state, LTC_REQUEST_s stat } void LTC_Trigger(LTC_STATE_s *ltc_state) { + FAS_ASSERT(ltc_state != NULL_PTR); STD_RETURN_TYPE_e retVal = STD_OK; LTC_REQUEST_s statereq = {.request = LTC_STATE_NO_REQUEST, .string = 0x0u}; uint8_t tmpbusID = 0; @@ -867,7 +883,8 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { ltc_state->muxmeas_seqendptr[ltc_state->currentString] = ((LTC_MUX_CH_CFG_s *)ltc_mux_seq.seqptr) + ltc_mux_seq.nr_of_steps; /* last sequence + 1 */ - retVal = LTC_TransmitWakeUp(ltc_state->spiSeqPtr); /* Send dummy byte to wake up the daisy chain */ + retVal = + LTC_TRANSMIT_WAKE_UP(ltc_state->spiSeqPtr); /* Send dummy byte to wake up the daisy chain */ LTC_CondBasedStateTransition( ltc_state, retVal, @@ -878,11 +895,10 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_STATEMACH_INITIALIZATION, LTC_ENTRY_INITIALIZATION, LTC_STATEMACH_SHORTTIME); - } else if (ltc_state->substate == LTC_RE_ENTRY_INITIALIZATION) { LTC_SaveLastStates(ltc_state); - retVal = - LTC_TransmitWakeUp(ltc_state->spiSeqPtr); /* Send dummy byte again to wake up the daisy chain */ + retVal = LTC_TRANSMIT_WAKE_UP( + ltc_state->spiSeqPtr); /* Send dummy byte again to wake up the daisy chain */ LTC_CondBasedStateTransition( ltc_state, retVal, @@ -893,7 +909,6 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_STATEMACH_INITIALIZATION, LTC_RE_ENTRY_INITIALIZATION, LTC_STATEMACH_SHORTTIME); - } else if (ltc_state->substate == LTC_START_INIT_INITIALIZATION) { LTC_SaveLastStates(ltc_state); ltc_state->check_spi_flag = STD_OK; @@ -910,7 +925,6 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_STATEMACH_INITIALIZATION, LTC_CHECK_INITIALIZATION, ltc_state->commandDataTransferTime + LTC_TRANSMISSION_TIMEOUT); - } else if (ltc_state->substate == LTC_CHECK_INITIALIZATION) { /* Read values written in config register, currently unused */ LTC_SaveLastStates(ltc_state); @@ -926,7 +940,6 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_STATEMACH_INITIALIZATION, LTC_EXIT_INITIALIZATION, ltc_state->commandDataTransferTime + LTC_TRANSMISSION_TIMEOUT); - } else if (ltc_state->substate == LTC_EXIT_INITIALIZATION) { LTC_SaveLastStates(ltc_state); ++ltc_state->spiSeqPtr; @@ -1022,7 +1035,6 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_READ_VOLTAGE_REGISTER_B_RDCVB_READVOLTAGE, LTC_STATEMACH_SHORTTIME); break; - } else if (ltc_state->substate == LTC_READ_VOLTAGE_REGISTER_B_RDCVB_READVOLTAGE) { retVal = LTC_CheckPec(ltc_state, ltc_state->ltcData.rxBuffer, ltc_state->currentString); DIAG_CheckEvent(retVal, ltc_state->pecDiagErrorEntry, DIAG_STRING, ltc_state->currentString); @@ -1046,7 +1058,6 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_READ_VOLTAGE_REGISTER_C_RDCVC_READVOLTAGE, LTC_STATEMACH_SHORTTIME); break; - } else if (ltc_state->substate == LTC_READ_VOLTAGE_REGISTER_C_RDCVC_READVOLTAGE) { retVal = LTC_CheckPec(ltc_state, ltc_state->ltcData.rxBuffer, ltc_state->currentString); DIAG_CheckEvent(retVal, ltc_state->pecDiagErrorEntry, DIAG_STRING, ltc_state->currentString); @@ -1070,7 +1081,6 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_READ_VOLTAGE_REGISTER_D_RDCVD_READVOLTAGE, LTC_STATEMACH_SHORTTIME); break; - } else if (ltc_state->substate == LTC_READ_VOLTAGE_REGISTER_D_RDCVD_READVOLTAGE) { retVal = LTC_CheckPec(ltc_state, ltc_state->ltcData.rxBuffer, ltc_state->currentString); DIAG_CheckEvent(retVal, ltc_state->pecDiagErrorEntry, DIAG_STRING, ltc_state->currentString); @@ -1107,7 +1117,6 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_STATEMACH_SHORTTIME); } break; - } else if (ltc_state->substate == LTC_READ_VOLTAGE_REGISTER_E_RDCVE_READVOLTAGE) { retVal = LTC_CheckPec(ltc_state, ltc_state->ltcData.rxBuffer, ltc_state->currentString); DIAG_CheckEvent(retVal, ltc_state->pecDiagErrorEntry, DIAG_STRING, ltc_state->currentString); @@ -1144,7 +1153,6 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_STATEMACH_SHORTTIME); } break; - } else if (ltc_state->substate == LTC_READ_VOLTAGE_REGISTER_F_RDCVF_READVOLTAGE) { retVal = LTC_CheckPec(ltc_state, ltc_state->ltcData.rxBuffer, ltc_state->currentString); DIAG_CheckEvent(retVal, ltc_state->pecDiagErrorEntry, DIAG_STRING, ltc_state->currentString); @@ -1168,7 +1176,6 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_EXIT_READVOLTAGE, LTC_STATEMACH_SHORTTIME); break; - } else if (ltc_state->substate == LTC_EXIT_READVOLTAGE) { retVal = LTC_CheckPec(ltc_state, ltc_state->ltcData.rxBuffer, ltc_state->currentString); DIAG_CheckEvent(retVal, ltc_state->pecDiagErrorEntry, DIAG_STRING, ltc_state->currentString); @@ -1256,9 +1263,9 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { (ltc_state->commandDataTransferTime + LTC_TRANSMISSION_TIMEOUT)); } break; - } else if (ltc_state->substate == LTC_SEND_CLOCK_STCOMM_MUXMEASUREMENT_CONFIG) { - if ((ltc_state->timer == 0) && (AFE_IsTransmitOngoing(ltc_state) == true)) { + bool transmitOngoing = AFE_IsTransmitOngoing(ltc_state); + if ((ltc_state->timer == 0) && (transmitOngoing == true)) { DIAG_Handler( ltc_state->spiDiagErrorEntry, DIAG_EVENT_NOT_OK, DIAG_STRING, ltc_state->currentString); } else { @@ -1293,9 +1300,9 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_STATEMACH_SHORTTIME); } break; - } else if (ltc_state->substate == LTC_READ_I2C_TRANSMISSION_RESULT_RDCOMM_MUXMEASUREMENT_CONFIG) { - if ((ltc_state->timer == 0) && (AFE_IsTransmitOngoing(ltc_state) == true)) { + bool transmitOngoing = AFE_IsTransmitOngoing(ltc_state); + if ((ltc_state->timer == 0) && (transmitOngoing == true)) { DIAG_Handler( ltc_state->spiDiagErrorEntry, DIAG_EVENT_NOT_OK, DIAG_STRING, ltc_state->currentString); } else { @@ -1321,9 +1328,9 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_READ_I2C_TRANSMISSION_CHECK_MUXMEASUREMENT_CONFIG, LTC_STATEMACH_SHORTTIME); break; - } else if (ltc_state->substate == LTC_READ_I2C_TRANSMISSION_CHECK_MUXMEASUREMENT_CONFIG) { - if ((ltc_state->timer == 0) && (AFE_IsTransmitOngoing(ltc_state) == true)) { + bool transmitOngoing = AFE_IsTransmitOngoing(ltc_state); + if ((ltc_state->timer == 0) && (transmitOngoing == true)) { DIAG_Handler( ltc_state->spiDiagErrorEntry, DIAG_EVENT_NOT_OK, DIAG_STRING, ltc_state->currentString); } else { @@ -1344,7 +1351,6 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_StateTransition( ltc_state, LTC_STATEMACH_MUXMEASUREMENT, LTC_STATEMACH_MUXMEASUREMENT, LTC_STATEMACH_SHORTTIME); break; - } else if (ltc_state->substate == LTC_STATEMACH_MUXMEASUREMENT) { if (ltc_state->muxmeas_seqptr[ltc_state->currentString]->muxCh == 0xFF) { /* actual multiplexer is switched off, so do not make a measurement and follow up with next step (mux configuration) */ @@ -1355,7 +1361,8 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { break; } else { if (LTC_GOTO_MUX_CHECK == false) { - if ((ltc_state->timer == 0) && (AFE_IsTransmitOngoing(ltc_state) == true)) { + bool transmitOngoing = AFE_IsTransmitOngoing(ltc_state); + if ((ltc_state->timer == 0) && (transmitOngoing == true)) { DIAG_Handler( ltc_state->spiDiagErrorEntry, DIAG_EVENT_NOT_OK, @@ -1391,7 +1398,6 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_STATEMACH_READMUXMEASUREMENT, LTC_STATEMACH_SHORTTIME); break; - } else if (ltc_state->substate == LTC_STATEMACH_READMUXMEASUREMENT) { ltc_state->check_spi_flag = STD_OK; @@ -1413,9 +1419,9 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_STATEMACH_STOREMUXMEASUREMENT, LTC_STATEMACH_SHORTTIME); break; - } else if (ltc_state->substate == LTC_STATEMACH_STOREMUXMEASUREMENT) { - if ((ltc_state->timer == 0) && (AFE_IsTransmitOngoing(ltc_state) == true)) { + bool transmitOngoing = AFE_IsTransmitOngoing(ltc_state); + if ((ltc_state->timer == 0) && (transmitOngoing == true)) { DIAG_Handler( ltc_state->spiDiagErrorEntry, DIAG_EVENT_NOT_OK, DIAG_STRING, ltc_state->currentString); } else { @@ -1540,9 +1546,9 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_CONFIG2_BALANCECONTROL, LTC_STATEMACH_SHORTTIME); break; - } else if (ltc_state->substate == LTC_CONFIG2_BALANCECONTROL) { - if ((ltc_state->timer == 0) && (AFE_IsTransmitOngoing(ltc_state) == true)) { + bool transmitOngoing = AFE_IsTransmitOngoing(ltc_state); + if ((ltc_state->timer == 0) && (transmitOngoing == true)) { DIAG_Handler( ltc_state->spiDiagErrorEntry, DIAG_EVENT_NOT_OK, DIAG_STRING, ltc_state->currentString); } else { @@ -1585,9 +1591,9 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { } break; - } else if (ltc_state->substate == LTC_CONFIG2_BALANCECONTROL_END) { - if ((ltc_state->timer == 0) && (AFE_IsTransmitOngoing(ltc_state) == true)) { + bool transmitOngoing = AFE_IsTransmitOngoing(ltc_state); + if ((ltc_state->timer == 0) && (transmitOngoing == true)) { DIAG_Handler( ltc_state->spiDiagErrorEntry, DIAG_EVENT_NOT_OK, DIAG_STRING, ltc_state->currentString); } else { @@ -1654,7 +1660,6 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_READ_AUXILIARY_REGISTER_B_RDAUXB, LTC_STATEMACH_SHORTTIME); break; - } else if (ltc_state->substate == LTC_READ_AUXILIARY_REGISTER_B_RDAUXB) { retVal = LTC_CheckPec(ltc_state, ltc_state->ltcData.rxBuffer, ltc_state->currentString); DIAG_CheckEvent(retVal, ltc_state->pecDiagErrorEntry, DIAG_STRING, ltc_state->currentString); @@ -1692,7 +1697,6 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_STATEMACH_SHORTTIME); } break; - } else if (ltc_state->substate == LTC_READ_AUXILIARY_REGISTER_C_RDAUXC) { retVal = LTC_CheckPec(ltc_state, ltc_state->ltcData.rxBuffer, ltc_state->currentString); DIAG_CheckEvent(retVal, ltc_state->pecDiagErrorEntry, DIAG_STRING, ltc_state->currentString); @@ -1716,7 +1720,6 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_READ_AUXILIARY_REGISTER_D_RDAUXD, LTC_STATEMACH_SHORTTIME); break; - } else if (ltc_state->substate == LTC_READ_AUXILIARY_REGISTER_D_RDAUXD) { retVal = LTC_CheckPec(ltc_state, ltc_state->ltcData.rxBuffer, ltc_state->currentString); DIAG_CheckEvent(retVal, ltc_state->pecDiagErrorEntry, DIAG_STRING, ltc_state->currentString); @@ -1740,7 +1743,6 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_EXIT_READAUXILIARY_ALLGPIOS, LTC_STATEMACH_SHORTTIME); break; - } else if (ltc_state->substate == LTC_EXIT_READAUXILIARY_ALLGPIOS) { retVal = LTC_CheckPec(ltc_state, ltc_state->ltcData.rxBuffer, ltc_state->currentString); DIAG_CheckEvent(retVal, ltc_state->pecDiagErrorEntry, DIAG_STRING, ltc_state->currentString); @@ -1784,7 +1786,6 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_READ_FEEDBACK_BALANCECONTROL, LTC_STATEMACH_SHORTTIME); break; - } else if (ltc_state->substate == LTC_READ_FEEDBACK_BALANCECONTROL) { ltc_state->check_spi_flag = STD_OK; AFE_SetTransmitOngoing(ltc_state); @@ -1804,9 +1805,9 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_STATEMACH_BALANCEFEEDBACK, LTC_SAVE_FEEDBACK_BALANCECONTROL, LTC_STATEMACH_SHORTTIME); - } else if (ltc_state->substate == LTC_SAVE_FEEDBACK_BALANCECONTROL) { - if ((ltc_state->timer == 0) && (AFE_IsTransmitOngoing(ltc_state) == true)) { + bool transmitOngoing = AFE_IsTransmitOngoing(ltc_state); + if ((ltc_state->timer == 0) && (transmitOngoing == true)) { DIAG_Handler( ltc_state->spiDiagErrorEntry, DIAG_EVENT_NOT_OK, DIAG_STRING, ltc_state->currentString); LTC_StateTransition(ltc_state, LTC_STATEMACH_STARTMEAS, LTC_ENTRY, LTC_STATEMACH_SHORTTIME); @@ -1859,9 +1860,9 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { } break; - } else if (ltc_state->substate == LTC_TEMP_SENS_SEND_CLOCK_STCOMM1) { - if ((ltc_state->timer == 0) && (AFE_IsTransmitOngoing(ltc_state) == true)) { + bool transmitOngoing = AFE_IsTransmitOngoing(ltc_state); + if ((ltc_state->timer == 0) && (transmitOngoing == true)) { DIAG_Handler( ltc_state->spiDiagErrorEntry, DIAG_EVENT_NOT_OK, DIAG_STRING, ltc_state->currentString); LTC_StateTransition(ltc_state, LTC_STATEMACH_STARTMEAS, LTC_ENTRY, LTC_STATEMACH_SHORTTIME); @@ -1884,9 +1885,9 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_TEMP_SENS_READ_DATA1, LTC_STATEMACH_SHORTTIME); break; - } else if (ltc_state->substate == LTC_TEMP_SENS_READ_DATA1) { - if ((ltc_state->timer == 0) && (AFE_IsTransmitOngoing(ltc_state) == true)) { + bool transmitOngoing = AFE_IsTransmitOngoing(ltc_state); + if ((ltc_state->timer == 0) && (transmitOngoing == true)) { DIAG_Handler( ltc_state->spiDiagErrorEntry, DIAG_EVENT_NOT_OK, DIAG_STRING, ltc_state->currentString); LTC_StateTransition(ltc_state, LTC_STATEMACH_STARTMEAS, LTC_ENTRY, LTC_STATEMACH_SHORTTIME); @@ -1920,9 +1921,9 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { } break; - } else if (ltc_state->substate == LTC_TEMP_SENS_SEND_CLOCK_STCOMM2) { - if ((ltc_state->timer == 0) && (AFE_IsTransmitOngoing(ltc_state) == true)) { + bool transmitOngoing = AFE_IsTransmitOngoing(ltc_state); + if ((ltc_state->timer == 0) && (transmitOngoing == true)) { DIAG_Handler( ltc_state->spiDiagErrorEntry, DIAG_EVENT_NOT_OK, DIAG_STRING, ltc_state->currentString); LTC_StateTransition(ltc_state, LTC_STATEMACH_STARTMEAS, LTC_ENTRY, LTC_STATEMACH_SHORTTIME); @@ -1946,7 +1947,8 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_STATEMACH_SHORTTIME); break; } else if (ltc_state->substate == LTC_TEMP_SENS_READ_I2C_TRANSMISSION_RESULT_RDCOMM) { - if ((ltc_state->timer == 0) && (AFE_IsTransmitOngoing(ltc_state) == true)) { + bool transmitOngoing = AFE_IsTransmitOngoing(ltc_state); + if ((ltc_state->timer == 0) && (transmitOngoing == true)) { DIAG_Handler( ltc_state->spiDiagErrorEntry, DIAG_EVENT_NOT_OK, DIAG_STRING, ltc_state->currentString); LTC_StateTransition(ltc_state, LTC_STATEMACH_STARTMEAS, LTC_ENTRY, LTC_STATEMACH_SHORTTIME); @@ -1974,9 +1976,9 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_TEMP_SENS_SAVE_TEMP, LTC_STATEMACH_SHORTTIME); break; - } else if (ltc_state->substate == LTC_TEMP_SENS_SAVE_TEMP) { - if ((ltc_state->timer == 0) && (AFE_IsTransmitOngoing(ltc_state) == true)) { + bool transmitOngoing = AFE_IsTransmitOngoing(ltc_state); + if ((ltc_state->timer == 0) && (transmitOngoing == true)) { DIAG_Handler( ltc_state->spiDiagErrorEntry, DIAG_EVENT_NOT_OK, DIAG_STRING, ltc_state->currentString); LTC_StateTransition(ltc_state, LTC_STATEMACH_STARTMEAS, LTC_ENTRY, LTC_STATEMACH_SHORTTIME); @@ -2029,9 +2031,9 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { (ltc_state->commandDataTransferTime + LTC_TRANSMISSION_TIMEOUT)); } break; - } else if (ltc_state->substate == LTC_SEND_CLOCK_STCOMM_MUXMEASUREMENT_CONFIG) { - if ((ltc_state->timer == 0) && (AFE_IsTransmitOngoing(ltc_state) == true)) { + bool transmitOngoing = AFE_IsTransmitOngoing(ltc_state); + if ((ltc_state->timer == 0) && (transmitOngoing == true)) { DIAG_Handler( ltc_state->spiDiagErrorEntry, DIAG_EVENT_NOT_OK, DIAG_STRING, ltc_state->currentString); LTC_StateTransition(ltc_state, LTC_STATEMACH_STARTMEAS, LTC_ENTRY, LTC_STATEMACH_SHORTTIME); @@ -2087,9 +2089,9 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { } break; - } else if (ltc_state->substate == LTC_USER_IO_SEND_CLOCK_STCOMM) { - if ((ltc_state->timer == 0) && (AFE_IsTransmitOngoing(ltc_state) == true)) { + bool transmitOngoing = AFE_IsTransmitOngoing(ltc_state); + if ((ltc_state->timer == 0) && (transmitOngoing == true)) { DIAG_Handler( ltc_state->spiDiagErrorEntry, DIAG_EVENT_NOT_OK, DIAG_STRING, ltc_state->currentString); LTC_StateTransition(ltc_state, LTC_STATEMACH_STARTMEAS, LTC_ENTRY, LTC_STATEMACH_SHORTTIME); @@ -2112,9 +2114,9 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_USER_IO_READ_I2C_TRANSMISSION_RESULT_RDCOMM, LTC_STATEMACH_SHORTTIME); break; - } else if (ltc_state->substate == LTC_USER_IO_READ_I2C_TRANSMISSION_RESULT_RDCOMM) { - if ((ltc_state->timer == 0) && (AFE_IsTransmitOngoing(ltc_state) == true)) { + bool transmitOngoing = AFE_IsTransmitOngoing(ltc_state); + if ((ltc_state->timer == 0) && (transmitOngoing == true)) { DIAG_Handler( ltc_state->spiDiagErrorEntry, DIAG_EVENT_NOT_OK, DIAG_STRING, ltc_state->currentString); LTC_StateTransition(ltc_state, LTC_STATEMACH_STARTMEAS, LTC_ENTRY, LTC_STATEMACH_SHORTTIME); @@ -2142,9 +2144,9 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_USER_IO_SAVE_DATA, LTC_STATEMACH_SHORTTIME); break; - } else if (ltc_state->substate == LTC_USER_IO_SAVE_DATA) { - if ((ltc_state->timer == 0) && (AFE_IsTransmitOngoing(ltc_state) == true)) { + bool transmitOngoing = AFE_IsTransmitOngoing(ltc_state); + if ((ltc_state->timer == 0) && (transmitOngoing == true)) { DIAG_Handler( ltc_state->spiDiagErrorEntry, DIAG_EVENT_NOT_OK, DIAG_STRING, ltc_state->currentString); LTC_StateTransition(ltc_state, LTC_STATEMACH_STARTMEAS, LTC_ENTRY, LTC_STATEMACH_SHORTTIME); @@ -2194,14 +2196,13 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_ENTRY, LTC_STATEMACH_SHORTTIME); break; - } else if (ltc_state->substate == LTC_USER_IO_SEND_CLOCK_STCOMM_TI) { - if ((ltc_state->timer == 0) && (AFE_IsTransmitOngoing(ltc_state) == true)) { + bool transmitOngoing = AFE_IsTransmitOngoing(ltc_state); + if ((ltc_state->timer == 0) && (transmitOngoing == true)) { DIAG_Handler( ltc_state->spiDiagErrorEntry, DIAG_EVENT_NOT_OK, DIAG_STRING, ltc_state->currentString); LTC_StateTransition(ltc_state, LTC_STATEMACH_STARTMEAS, LTC_ENTRY, LTC_STATEMACH_SHORTTIME); break; - } else { DIAG_Handler( ltc_state->spiDiagErrorEntry, DIAG_EVENT_OK, DIAG_STRING, ltc_state->currentString); @@ -2220,7 +2221,6 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_ENTRY, LTC_STATEMACH_SHORTTIME); break; - } else if (ltc_state->substate == LTC_USER_IO_SET_OUTPUT_REGISTER_TI) { ltc_state->check_spi_flag = STD_OK; AFE_SetTransmitOngoing(ltc_state); @@ -2241,9 +2241,9 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_ENTRY, LTC_STATEMACH_SHORTTIME); break; - } else if (ltc_state->substate == LTC_USER_IO_READ_I2C_TRANSMISSION_RESULT_RDCOMM_TI_SECOND) { - if ((ltc_state->timer == 0) && (AFE_IsTransmitOngoing(ltc_state) == true)) { + bool transmitOngoing = AFE_IsTransmitOngoing(ltc_state); + if ((ltc_state->timer == 0) && (transmitOngoing == true)) { DIAG_Handler( ltc_state->spiDiagErrorEntry, DIAG_EVENT_NOT_OK, DIAG_STRING, ltc_state->currentString); LTC_StateTransition(ltc_state, LTC_STATEMACH_STARTMEAS, LTC_ENTRY, LTC_STATEMACH_SHORTTIME); @@ -2294,14 +2294,13 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_ENTRY, LTC_STATEMACH_SHORTTIME); break; - } else if (ltc_state->substate == LTC_USER_IO_SEND_CLOCK_STCOMM_TI) { - if ((ltc_state->timer == 0) && (AFE_IsTransmitOngoing(ltc_state) == true)) { + bool transmitOngoing = AFE_IsTransmitOngoing(ltc_state); + if ((ltc_state->timer == 0) && (transmitOngoing == true)) { DIAG_Handler( ltc_state->spiDiagErrorEntry, DIAG_EVENT_NOT_OK, DIAG_STRING, ltc_state->currentString); LTC_StateTransition(ltc_state, LTC_STATEMACH_STARTMEAS, LTC_ENTRY, LTC_STATEMACH_SHORTTIME); break; - } else { DIAG_Handler( ltc_state->spiDiagErrorEntry, DIAG_EVENT_OK, DIAG_STRING, ltc_state->currentString); @@ -2320,7 +2319,6 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_ENTRY, LTC_STATEMACH_SHORTTIME); break; - } else if (ltc_state->substate == LTC_USER_IO_READ_INPUT_REGISTER_TI_FIRST) { ltc_state->check_spi_flag = STD_OK; AFE_SetTransmitOngoing(ltc_state); @@ -2342,9 +2340,9 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_ENTRY, LTC_STATEMACH_SHORTTIME); break; - } else if (ltc_state->substate == LTC_USER_IO_READ_I2C_TRANSMISSION_RESULT_RDCOMM_TI_SECOND) { - if ((ltc_state->timer == 0) && (AFE_IsTransmitOngoing(ltc_state) == true)) { + bool transmitOngoing = AFE_IsTransmitOngoing(ltc_state); + if ((ltc_state->timer == 0) && (transmitOngoing == true)) { DIAG_Handler( ltc_state->spiDiagErrorEntry, DIAG_EVENT_NOT_OK, DIAG_STRING, ltc_state->currentString); LTC_StateTransition(ltc_state, LTC_STATEMACH_STARTMEAS, LTC_ENTRY, LTC_STATEMACH_SHORTTIME); @@ -2388,9 +2386,9 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_ENTRY, LTC_STATEMACH_SHORTTIME); break; - } else if (ltc_state->substate == LTC_USER_IO_READ_I2C_TRANSMISSION_RESULT_RDCOMM_TI_THIRD) { - if ((ltc_state->timer == 0) && (AFE_IsTransmitOngoing(ltc_state) == true)) { + bool transmitOngoing = AFE_IsTransmitOngoing(ltc_state); + if ((ltc_state->timer == 0) && (transmitOngoing == true)) { DIAG_Handler( ltc_state->spiDiagErrorEntry, DIAG_EVENT_NOT_OK, DIAG_STRING, ltc_state->currentString); LTC_StateTransition(ltc_state, LTC_STATEMACH_STARTMEAS, LTC_ENTRY, LTC_STATEMACH_SHORTTIME); @@ -2414,7 +2412,8 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_STATEMACH_SHORTTIME); break; } else if (ltc_state->substate == LTC_USER_IO_READ_I2C_TRANSMISSION_RESULT_RDCOMM_TI_FOURTH) { - if ((ltc_state->timer == 0) && (AFE_IsTransmitOngoing(ltc_state) == true)) { + bool transmitOngoing = AFE_IsTransmitOngoing(ltc_state); + if ((ltc_state->timer == 0) && (transmitOngoing == true)) { DIAG_Handler( ltc_state->spiDiagErrorEntry, DIAG_EVENT_NOT_OK, DIAG_STRING, ltc_state->currentString); LTC_StateTransition(ltc_state, LTC_STATEMACH_STARTMEAS, LTC_ENTRY, LTC_STATEMACH_SHORTTIME); @@ -2442,9 +2441,9 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_USER_IO_SAVE_DATA_TI, LTC_STATEMACH_SHORTTIME); break; - } else if (ltc_state->substate == LTC_USER_IO_SAVE_DATA_TI) { - if ((ltc_state->timer == 0) && (AFE_IsTransmitOngoing(ltc_state) == true)) { + bool transmitOngoing = AFE_IsTransmitOngoing(ltc_state); + if ((ltc_state->timer == 0) && (transmitOngoing == true)) { DIAG_Handler( ltc_state->spiDiagErrorEntry, DIAG_EVENT_NOT_OK, DIAG_STRING, ltc_state->currentString); LTC_StateTransition(ltc_state, LTC_STATEMACH_STARTMEAS, LTC_ENTRY, LTC_STATEMACH_SHORTTIME); @@ -2500,9 +2499,9 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { } break; - } else if (ltc_state->substate == LTC_EEPROM_SEND_CLOCK_STCOMM1) { - if ((ltc_state->timer == 0) && (AFE_IsTransmitOngoing(ltc_state) == true)) { + bool transmitOngoing = AFE_IsTransmitOngoing(ltc_state); + if ((ltc_state->timer == 0) && (transmitOngoing == true)) { DIAG_Handler( ltc_state->spiDiagErrorEntry, DIAG_EVENT_NOT_OK, DIAG_STRING, ltc_state->currentString); LTC_StateTransition(ltc_state, LTC_STATEMACH_STARTMEAS, LTC_ENTRY, LTC_STATEMACH_SHORTTIME); @@ -2525,9 +2524,9 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_EEPROM_READ_DATA2, LTC_STATEMACH_SHORTTIME); break; - } else if (ltc_state->substate == LTC_EEPROM_READ_DATA2) { - if ((ltc_state->timer == 0) && (AFE_IsTransmitOngoing(ltc_state) == true)) { + bool transmitOngoing = AFE_IsTransmitOngoing(ltc_state); + if ((ltc_state->timer == 0) && (transmitOngoing == true)) { DIAG_Handler( ltc_state->spiDiagErrorEntry, DIAG_EVENT_NOT_OK, DIAG_STRING, ltc_state->currentString); LTC_StateTransition(ltc_state, LTC_STATEMACH_STARTMEAS, LTC_ENTRY, LTC_STATEMACH_SHORTTIME); @@ -2556,9 +2555,9 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_EEPROM_SEND_CLOCK_STCOMM2, LTC_STATEMACH_SHORTTIME); break; - } else if (ltc_state->substate == LTC_EEPROM_SEND_CLOCK_STCOMM2) { - if ((ltc_state->timer == 0) && (AFE_IsTransmitOngoing(ltc_state) == true)) { + bool transmitOngoing = AFE_IsTransmitOngoing(ltc_state); + if ((ltc_state->timer == 0) && (transmitOngoing == true)) { DIAG_Handler( ltc_state->spiDiagErrorEntry, DIAG_EVENT_NOT_OK, DIAG_STRING, ltc_state->currentString); LTC_StateTransition(ltc_state, LTC_STATEMACH_STARTMEAS, LTC_ENTRY, LTC_STATEMACH_SHORTTIME); @@ -2582,7 +2581,8 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_STATEMACH_SHORTTIME); break; } else if (ltc_state->substate == LTC_EEPROM_READ_I2C_TRANSMISSION_RESULT_RDCOMM) { - if ((ltc_state->timer == 0) && (AFE_IsTransmitOngoing(ltc_state) == true)) { + bool transmitOngoing = AFE_IsTransmitOngoing(ltc_state); + if ((ltc_state->timer == 0) && (transmitOngoing == true)) { DIAG_Handler( ltc_state->spiDiagErrorEntry, DIAG_EVENT_NOT_OK, DIAG_STRING, ltc_state->currentString); LTC_StateTransition(ltc_state, LTC_STATEMACH_STARTMEAS, LTC_ENTRY, LTC_STATEMACH_SHORTTIME); @@ -2610,9 +2610,9 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_EEPROM_SAVE_READ, LTC_STATEMACH_SHORTTIME); break; - } else if (ltc_state->substate == LTC_EEPROM_SAVE_READ) { - if ((ltc_state->timer == 0) && (AFE_IsTransmitOngoing(ltc_state) == true)) { + bool transmitOngoing = AFE_IsTransmitOngoing(ltc_state); + if ((ltc_state->timer == 0) && (transmitOngoing == true)) { DIAG_Handler( ltc_state->spiDiagErrorEntry, DIAG_EVENT_NOT_OK, DIAG_STRING, ltc_state->currentString); LTC_StateTransition(ltc_state, LTC_STATEMACH_STARTMEAS, LTC_ENTRY, LTC_STATEMACH_SHORTTIME); @@ -2667,9 +2667,9 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { } break; - } else if (ltc_state->substate == LTC_EEPROM_SEND_CLOCK_STCOMM3) { - if ((ltc_state->timer == 0) && (AFE_IsTransmitOngoing(ltc_state) == true)) { + bool transmitOngoing = AFE_IsTransmitOngoing(ltc_state); + if ((ltc_state->timer == 0) && (transmitOngoing == true)) { DIAG_Handler( ltc_state->spiDiagErrorEntry, DIAG_EVENT_NOT_OK, DIAG_STRING, ltc_state->currentString); LTC_StateTransition(ltc_state, LTC_STATEMACH_STARTMEAS, LTC_ENTRY, LTC_STATEMACH_SHORTTIME); @@ -2692,9 +2692,9 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_EEPROM_WRITE_DATA2, LTC_STATEMACH_SHORTTIME); break; - } else if (ltc_state->substate == LTC_EEPROM_WRITE_DATA2) { - if ((ltc_state->timer == 0) && (AFE_IsTransmitOngoing(ltc_state) == true)) { + bool transmitOngoing = AFE_IsTransmitOngoing(ltc_state); + if ((ltc_state->timer == 0) && (transmitOngoing == true)) { DIAG_Handler( ltc_state->spiDiagErrorEntry, DIAG_EVENT_NOT_OK, DIAG_STRING, ltc_state->currentString); LTC_StateTransition(ltc_state, LTC_STATEMACH_STARTMEAS, LTC_ENTRY, LTC_STATEMACH_SHORTTIME); @@ -2723,9 +2723,9 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_EEPROM_SEND_CLOCK_STCOMM4, LTC_STATEMACH_SHORTTIME); break; - } else if (ltc_state->substate == LTC_EEPROM_SEND_CLOCK_STCOMM4) { - if ((ltc_state->timer == 0) && (AFE_IsTransmitOngoing(ltc_state) == true)) { + bool transmitOngoing = AFE_IsTransmitOngoing(ltc_state); + if ((ltc_state->timer == 0) && (transmitOngoing == true)) { DIAG_Handler( ltc_state->spiDiagErrorEntry, DIAG_EVENT_NOT_OK, DIAG_STRING, ltc_state->currentString); LTC_StateTransition(ltc_state, LTC_STATEMACH_STARTMEAS, LTC_ENTRY, LTC_STATEMACH_SHORTTIME); @@ -2749,7 +2749,8 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_STATEMACH_SHORTTIME); break; } else if (ltc_state->substate == LTC_EEPROM_FINISHED) { - if ((ltc_state->timer == 0) && (AFE_IsTransmitOngoing(ltc_state) == true)) { + bool transmitOngoing = AFE_IsTransmitOngoing(ltc_state); + if ((ltc_state->timer == 0) && (transmitOngoing == true)) { DIAG_Handler( ltc_state->spiDiagErrorEntry, DIAG_EVENT_NOT_OK, DIAG_STRING, ltc_state->currentString); LTC_StateTransition(ltc_state, LTC_STATEMACH_STARTMEAS, LTC_ENTRY, LTC_STATEMACH_SHORTTIME); @@ -2821,7 +2822,6 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { LTC_STATEMACH_OPENWIRE_CHECK, LTC_REQUEST_PULLDOWN_CURRENT_OPENWIRE_CHECK, LTC_STATEMACH_SHORTTIME); - } else if (ltc_state->substate == LTC_REQUEST_PULLDOWN_CURRENT_OPENWIRE_CHECK) { /* Run ADOW command with PUP = 0 */ ltc_state->adcMode = LTC_OW_MEASUREMENT_MODE; @@ -2868,7 +2868,6 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { } LTC_StateTransition( ltc_state, LTC_STATEMACH_OPENWIRE_CHECK, LTC_PERFORM_OPENWIRE_CHECK, LTC_STATEMACH_SHORTTIME); - } else if (ltc_state->substate == LTC_PERFORM_OPENWIRE_CHECK) { /* Perform actual open-wire check */ for (uint8_t m = 0; m < BS_NR_OF_MODULES_PER_STRING; m++) { @@ -2929,21 +2928,27 @@ void LTC_Trigger(LTC_STATE_s *ltc_state) { /** * @brief saves the multiplexer values read from the LTC daisy-chain. * - * After a voltage measurement was initiated on GPIO 1 to read the currently selected - * multiplexer voltage, the results is read via SPI from the daisy-chain. - * This function is called to store the result from the transmission in a buffer. - * - * @param ltc_state state of the ltc state machine - * @param pRxBuff receive buffer - * @param muxseqptr pointer to the multiplexer sequence, which configures the currently selected multiplexer ID and channel - * @param stringNumber string addressed - * + * After a voltage measurement was initiated on GPIO 1 to read the currently + * selected multiplexer voltage, the results is read via SPI from the + * daisy-chain. + * This function is called to store the result from the transmission in a + * buffer. + * + * @param ltc_state state of the ltc state machine + * @param pRxBuff receive buffer + * @param muxseqptr pointer to the multiplexer sequence, which + * configures the currently selected multiplexer ID and + * channel + * @param stringNumber string addressed */ static void LTC_SaveMuxMeasurement( LTC_STATE_s *ltc_state, uint16_t *pRxBuff, LTC_MUX_CH_CFG_s *muxseqptr, uint8_t stringNumber) { + FAS_ASSERT(ltc_state != NULL_PTR); + FAS_ASSERT(pRxBuff != NULL_PTR); + FAS_ASSERT(muxseqptr != NULL_PTR); uint16_t val_ui = 0; int16_t temperature_ddegC = 0; uint8_t sensor_idx = 0; @@ -3023,6 +3028,8 @@ static void LTC_SaveRxToVoltageBuffer( uint16_t *pRxBuff, uint8_t registerSet, uint8_t stringNumber) { + FAS_ASSERT(ltc_state != NULL_PTR); + FAS_ASSERT(pRxBuff != NULL_PTR); uint16_t cellOffset = 0; uint16_t voltage_index = 0; uint16_t val_ui = 0; @@ -3133,6 +3140,8 @@ static void LTC_SaveRxToGpioBuffer( uint16_t *pRxBuff, uint8_t registerSet, uint8_t stringNumber) { + FAS_ASSERT(ltc_state != NULL_PTR); + FAS_ASSERT(pRxBuff != NULL_PTR); uint8_t i_offset = 0; uint32_t bitmask = 0; uint16_t buffer_LSB = 0; @@ -3272,6 +3281,8 @@ static void LTC_SaveRxToGpioBuffer( * @return muxError STD_OK is there was no error, STD_NOT_OK if there was errors */ static STD_RETURN_TYPE_e LTC_I2cCheckAck(LTC_STATE_s *ltc_state, uint16_t *pRxBuff, uint8_t mux, uint8_t stringNumber) { + FAS_ASSERT(ltc_state != NULL_PTR); + FAS_ASSERT(pRxBuff != NULL_PTR); STD_RETURN_TYPE_e muxError = STD_OK; for (uint16_t i = 0; i < BS_NR_OF_MODULES_PER_STRING; i++) { @@ -3331,6 +3342,9 @@ static STD_RETURN_TYPE_e LTC_Init( uint16_t *pTxBuff, uint16_t *pRxBuff, uint32_t frameLength) { + FAS_ASSERT(pSpiInterface != NULL_PTR); + FAS_ASSERT(pTxBuff != NULL_PTR); + FAS_ASSERT(pRxBuff != NULL_PTR); STD_RETURN_TYPE_e retVal = STD_NOT_OK; uint8_t PEC_Check[6]; @@ -3365,7 +3379,7 @@ static STD_RETURN_TYPE_e LTC_Init( pTxBuff[11u + (i * 8u)] = PEC_result & 0xFFu; } /* end for */ - retVal = LTC_TransmitReceiveData(pSpiInterface, pTxBuff, pRxBuff, frameLength); + retVal = LTC_TRANSMIT_RECEIVE_DATA(pSpiInterface, pTxBuff, pRxBuff, frameLength); return retVal; } @@ -3395,6 +3409,10 @@ static STD_RETURN_TYPE_e LTC_BalanceControl( uint32_t frameLength, uint8_t registerSet, uint8_t stringNumber) { + FAS_ASSERT(ltc_state != NULL_PTR); + FAS_ASSERT(pSpiInterface != NULL_PTR); + FAS_ASSERT(pTxBuff != NULL_PTR); + FAS_ASSERT(pRxBuff != NULL_PTR); STD_RETURN_TYPE_e retVal = STD_OK; uint8_t PEC_Check[6]; @@ -3481,7 +3499,7 @@ static STD_RETURN_TYPE_e LTC_BalanceControl( pTxBuff[10u + (reverseModuleNumber * 8u)] = (PEC_result >> 8u) & 0xFFu; pTxBuff[11u + (reverseModuleNumber * 8u)] = PEC_result & 0xFFu; } - retVal = LTC_TransmitReceiveData(pSpiInterface, pTxBuff, pRxBuff, frameLength); + retVal = LTC_TRANSMIT_RECEIVE_DATA(pSpiInterface, pTxBuff, pRxBuff, frameLength); } else if (registerSet == 1u) { /* cells 13 to 15/18 WRCFG2 */ pTxBuff[0] = ltc_cmdWRCFG2[0]; pTxBuff[1] = ltc_cmdWRCFG2[1]; @@ -3539,7 +3557,7 @@ static STD_RETURN_TYPE_e LTC_BalanceControl( pTxBuff[10u + (reverseModuleNumber * 8u)] = (PEC_result >> 8u) & 0xFFu; pTxBuff[11u + (reverseModuleNumber * 8u)] = PEC_result & 0xFFu; } - retVal = LTC_TransmitReceiveData(pSpiInterface, pTxBuff, pRxBuff, frameLength); + retVal = LTC_TRANSMIT_RECEIVE_DATA(pSpiInterface, pTxBuff, pRxBuff, frameLength); } else { retVal = STD_NOT_OK; } @@ -3555,6 +3573,7 @@ static STD_RETURN_TYPE_e LTC_BalanceControl( * */ static void LTC_ResetErrorTable(LTC_STATE_s *ltc_state) { + FAS_ASSERT(ltc_state != NULL_PTR); for (uint8_t s = 0u; s < BS_NR_OF_STRINGS; s++) { for (uint16_t i = 0; i < LTC_N_LTC; i++) { ltc_state->ltcData.errorTable->PEC_valid[s][i] = false; @@ -3641,27 +3660,28 @@ static STD_RETURN_TYPE_e LTC_StartVoltageMeasurement( SPI_INTERFACE_CONFIG_s *pSpiInterface, LTC_ADCMODE_e adcMode, LTC_ADCMEAS_CHAN_e adcMeasCh) { + FAS_ASSERT(pSpiInterface != NULL_PTR); STD_RETURN_TYPE_e retVal = STD_OK; if (adcMeasCh == LTC_ADCMEAS_ALLCHANNEL_CELLS) { if (adcMode == LTC_ADCMODE_FAST_DCP0) { - retVal = LTC_TransmitCommand(pSpiInterface, ltc_cmdADCV_fast_DCP0); + retVal = LTC_TRANSMIT_COMMAND(pSpiInterface, ltc_cmdADCV_fast_DCP0); } else if (adcMode == LTC_ADCMODE_NORMAL_DCP0) { - retVal = LTC_TransmitCommand(pSpiInterface, ltc_cmdADCV_normal_DCP0); + retVal = LTC_TRANSMIT_COMMAND(pSpiInterface, ltc_cmdADCV_normal_DCP0); } else if (adcMode == LTC_ADCMODE_FILTERED_DCP0) { - retVal = LTC_TransmitCommand(pSpiInterface, ltc_cmdADCV_filtered_DCP0); + retVal = LTC_TRANSMIT_COMMAND(pSpiInterface, ltc_cmdADCV_filtered_DCP0); } else if (adcMode == LTC_ADCMODE_FAST_DCP1) { - retVal = LTC_TransmitCommand(pSpiInterface, ltc_cmdADCV_fast_DCP1); + retVal = LTC_TRANSMIT_COMMAND(pSpiInterface, ltc_cmdADCV_fast_DCP1); } else if (adcMode == LTC_ADCMODE_NORMAL_DCP1) { - retVal = LTC_TransmitCommand(pSpiInterface, ltc_cmdADCV_normal_DCP1); + retVal = LTC_TRANSMIT_COMMAND(pSpiInterface, ltc_cmdADCV_normal_DCP1); } else if (adcMode == LTC_ADCMODE_FILTERED_DCP1) { - retVal = LTC_TransmitCommand(pSpiInterface, ltc_cmdADCV_filtered_DCP1); + retVal = LTC_TRANSMIT_COMMAND(pSpiInterface, ltc_cmdADCV_filtered_DCP1); } else { retVal = STD_NOT_OK; } } else if (adcMeasCh == LTC_ADCMEAS_SINGLECHANNEL_TWOCELLS) { if (adcMode == LTC_ADCMODE_FAST_DCP0) { - retVal = LTC_TransmitCommand(pSpiInterface, ltc_cmdADCV_fast_DCP0_twocells); + retVal = LTC_TRANSMIT_COMMAND(pSpiInterface, ltc_cmdADCV_fast_DCP0_twocells); } else { retVal = STD_NOT_OK; } @@ -3673,63 +3693,66 @@ static STD_RETURN_TYPE_e LTC_StartVoltageMeasurement( /** * @brief tells LTC daisy-chain to start measuring the voltage on GPIOS. + * @details This function sends an instruction to the daisy-chain via SPI to + * start the measurement. * - * This function sends an instruction to the daisy-chain via SPI to start the measurement. - * - * @param pSpiInterface pointer to SPI configuration - * @param adcMode LTC ADCmeasurement mode (fast, normal or filtered) - * @param adcMeasCh number of channels measured for GPIOS (one at a time, typically when multiplexers are used, or all five GPIOs) - * - * @return retVal #STD_OK if dummy byte was sent correctly by SPI, #STD_NOT_OK otherwise + * @param pSpiInterface pointer to SPI configuration + * @param adcMode LTC ADCmeasurement mode (fast, normal or filtered) + * @param adcMeasCh number of channels measured for GPIOS (one at a + * time, typically when multiplexers are used, or all + * five GPIOs) * + * @return #STD_OK if dummy byte was sent correctly by SPI, #STD_NOT_OK + * otherwise */ static STD_RETURN_TYPE_e LTC_StartGpioMeasurement( SPI_INTERFACE_CONFIG_s *pSpiInterface, LTC_ADCMODE_e adcMode, LTC_ADCMEAS_CHAN_e adcMeasCh) { + FAS_ASSERT(pSpiInterface != NULL_PTR); STD_RETURN_TYPE_e retVal; if (adcMeasCh == LTC_ADCMEAS_ALLCHANNEL_GPIOS) { if ((adcMode == LTC_ADCMODE_FAST_DCP0) || (adcMode == LTC_ADCMODE_FAST_DCP1)) { - retVal = LTC_TransmitCommand(pSpiInterface, ltc_cmdADAX_fast_ALLGPIOS); + retVal = LTC_TRANSMIT_COMMAND(pSpiInterface, ltc_cmdADAX_fast_ALLGPIOS); } else if ((adcMode == LTC_ADCMODE_FILTERED_DCP0) || (adcMode == LTC_ADCMODE_FILTERED_DCP1)) { - retVal = LTC_TransmitCommand(pSpiInterface, ltc_cmdADAX_filtered_ALLGPIOS); + retVal = LTC_TRANSMIT_COMMAND(pSpiInterface, ltc_cmdADAX_filtered_ALLGPIOS); } else { /*if (adcMode == LTC_ADCMODE_NORMAL_DCP0 || adcMode == LTC_ADCMODE_NORMAL_DCP1)*/ - retVal = LTC_TransmitCommand(pSpiInterface, ltc_cmdADAX_normal_ALLGPIOS); + retVal = LTC_TRANSMIT_COMMAND(pSpiInterface, ltc_cmdADAX_normal_ALLGPIOS); } } else if (adcMeasCh == LTC_ADCMEAS_SINGLECHANNEL_GPIO1) { /* Single Channel */ if ((adcMode == LTC_ADCMODE_FAST_DCP0) || (adcMode == LTC_ADCMODE_FAST_DCP1)) { - retVal = LTC_TransmitCommand(pSpiInterface, ltc_cmdADAX_fast_GPIO1); + retVal = LTC_TRANSMIT_COMMAND(pSpiInterface, ltc_cmdADAX_fast_GPIO1); } else if ((adcMode == LTC_ADCMODE_FILTERED_DCP0) || (adcMode == LTC_ADCMODE_FILTERED_DCP1)) { - retVal = LTC_TransmitCommand(pSpiInterface, ltc_cmdADAX_filtered_GPIO1); + retVal = LTC_TRANSMIT_COMMAND(pSpiInterface, ltc_cmdADAX_filtered_GPIO1); } else { /*if (adcMode == LTC_ADCMODE_NORMAL_DCP0 || adcMode == LTC_ADCMODE_NORMAL_DCP1)*/ - retVal = LTC_TransmitCommand(pSpiInterface, ltc_cmdADAX_normal_GPIO1); + retVal = LTC_TRANSMIT_COMMAND(pSpiInterface, ltc_cmdADAX_normal_GPIO1); } } else if (adcMeasCh == LTC_ADCMEAS_SINGLECHANNEL_GPIO2) { /* Single Channel */ if ((adcMode == LTC_ADCMODE_FAST_DCP0) || (adcMode == LTC_ADCMODE_FAST_DCP1)) { - retVal = LTC_TransmitCommand(pSpiInterface, ltc_cmdADAX_fast_GPIO2); + retVal = LTC_TRANSMIT_COMMAND(pSpiInterface, ltc_cmdADAX_fast_GPIO2); } else if ((adcMode == LTC_ADCMODE_FILTERED_DCP0) || (adcMode == LTC_ADCMODE_FILTERED_DCP1)) { - retVal = LTC_TransmitCommand(pSpiInterface, ltc_cmdADAX_filtered_GPIO2); + retVal = LTC_TRANSMIT_COMMAND(pSpiInterface, ltc_cmdADAX_filtered_GPIO2); } else { /*if (adcMode == LTC_ADCMODE_NORMAL_DCP0 || adcMode == LTC_ADCMODE_NORMAL_DCP1)*/ - retVal = LTC_TransmitCommand(pSpiInterface, ltc_cmdADAX_normal_GPIO2); + retVal = LTC_TRANSMIT_COMMAND(pSpiInterface, ltc_cmdADAX_normal_GPIO2); } } else if (adcMeasCh == LTC_ADCMEAS_SINGLECHANNEL_GPIO3) { /* Single Channel */ if ((adcMode == LTC_ADCMODE_FAST_DCP0) || (adcMode == LTC_ADCMODE_FAST_DCP1)) { - retVal = LTC_TransmitCommand(pSpiInterface, ltc_cmdADAX_fast_GPIO3); + retVal = LTC_TRANSMIT_COMMAND(pSpiInterface, ltc_cmdADAX_fast_GPIO3); } else if ((adcMode == LTC_ADCMODE_FILTERED_DCP0) || (adcMode == LTC_ADCMODE_FILTERED_DCP1)) { - retVal = LTC_TransmitCommand(pSpiInterface, ltc_cmdADAX_filtered_GPIO3); + retVal = LTC_TRANSMIT_COMMAND(pSpiInterface, ltc_cmdADAX_filtered_GPIO3); } else { /*if (adcMode == LTC_ADCMODE_NORMAL_DCP0 || adcMode == LTC_ADCMODE_NORMAL_DCP1)*/ - retVal = LTC_TransmitCommand(pSpiInterface, ltc_cmdADAX_normal_GPIO3); + retVal = LTC_TRANSMIT_COMMAND(pSpiInterface, ltc_cmdADAX_normal_GPIO3); } } else { retVal = STD_NOT_OK; @@ -3754,22 +3777,23 @@ static STD_RETURN_TYPE_e LTC_StartOpenWireMeasurement( SPI_INTERFACE_CONFIG_s *pSpiInterface, LTC_ADCMODE_e adcMode, uint8_t PUP) { + FAS_ASSERT(pSpiInterface != NULL_PTR); STD_RETURN_TYPE_e retval = STD_NOT_OK; if (PUP == 0u) { /* pull-down current */ if (adcMode == LTC_ADCMODE_NORMAL_DCP0) { - retval = LTC_TransmitCommand(pSpiInterface, ltc_BC_cmdADOW_PDOWN_normal_DCP0); + retval = LTC_TRANSMIT_COMMAND(pSpiInterface, ltc_BC_cmdADOW_PDOWN_normal_DCP0); } else if (adcMode == LTC_ADCMODE_FILTERED_DCP0) { - retval = LTC_TransmitCommand(pSpiInterface, ltc_BC_cmdADOW_PDOWN_filtered_DCP0); + retval = LTC_TRANSMIT_COMMAND(pSpiInterface, ltc_BC_cmdADOW_PDOWN_filtered_DCP0); } else { retval = STD_NOT_OK; } } else if (PUP == 1u) { /* pull-up current */ if (adcMode == LTC_ADCMODE_NORMAL_DCP0) { - retval = LTC_TransmitCommand(pSpiInterface, ltc_BC_cmdADOW_PUP_normal_DCP0); + retval = LTC_TRANSMIT_COMMAND(pSpiInterface, ltc_BC_cmdADOW_PUP_normal_DCP0); } else if (adcMode == LTC_ADCMODE_FILTERED_DCP0) { - retval = LTC_TransmitCommand(pSpiInterface, ltc_BC_cmdADOW_PUP_filtered_DCP0); + retval = LTC_TRANSMIT_COMMAND(pSpiInterface, ltc_BC_cmdADOW_PUP_filtered_DCP0); } else { retval = STD_NOT_OK; } @@ -3796,6 +3820,8 @@ static STD_RETURN_TYPE_e LTC_CheckPec( LTC_STATE_s *ltc_state, uint16_t *DataBufferSPI_RX_with_PEC, uint8_t stringNumber) { + FAS_ASSERT(ltc_state != NULL_PTR); + FAS_ASSERT(DataBufferSPI_RX_with_PEC != NULL_PTR); STD_RETURN_TYPE_e retVal = STD_OK; uint8_t PEC_TX[2]; uint16_t PEC_result = 0; @@ -3833,26 +3859,33 @@ static STD_RETURN_TYPE_e LTC_CheckPec( } /** - * @brief send command to the LTC daisy-chain and receives data from the LTC daisy-chain. - * - * This is the core function to receive data from the LTC6804 daisy-chain. - * A 2 byte command is sent with the corresponding PEC. Example: read configuration register (RDCFG). - * Only command has to be set, the function calculates the PEC automatically. - * The data send is: - * 2 bytes (COMMAND) 2 bytes (PEC) - * The data received is: - * 6 bytes (LTC1) 2 bytes (PEC) + 6 bytes (LTC2) 2 bytes (PEC) + 6 bytes (LTC3) 2 bytes (PEC) + ... + 6 bytes (LTC{LTC_N_LTC}) 2 bytes (PEC) - * - * The function does not check the PECs. This has to be done elsewhere. - * - * @param Command command sent to the daisy-chain - * @param pSpiInterface pointer to SPI configuration - * @param pTxBuff transmit buffer - * @param pRxBuff receive buffer - * @param frameLength number of words to transmit - * - * @return statusSPI #STD_OK if SPI transmission is OK, #STD_NOT_OK otherwise - * + * @brief send command to the LTC daisy-chain and receives data from the LTC + * daisy-chain. + * @details This is the core function to receive data from the LTC6813-1 + * daisy-chain. + * A 2 byte command is sent with the corresponding PEC. + * *Example*: read configuration register (RDCFG). + * Only command has to be set, the function calculates the PEC + * automatically. + * - The data sent is: + * - 2 bytes (COMMAND) 2 bytes (PEC) + * - The data received is: + * - 6 bytes (LTC1) 2 bytes (PEC) + + * - 6 bytes (LTC2) 2 bytes (PEC) + + * - 6 bytes (LTC3) 2 bytes (PEC) + + * - ... + + * - 6 bytes (LTC{LTC_N_LTC}) 2 bytes (PEC) + * + * The function does not check the PECs. This has to be done + * elsewhere. + * + * @param Command command sent to the daisy-chain + * @param pSpiInterface pointer to SPI configuration + * @param pTxBuff transmit buffer + * @param pRxBuff receive buffer + * @param frameLength number of words to transmit + * + * @return #STD_OK if SPI transmission is OK, #STD_NOT_OK otherwise */ static STD_RETURN_TYPE_e LTC_ReadRegister( uint16_t *Command, @@ -3860,6 +3893,10 @@ static STD_RETURN_TYPE_e LTC_ReadRegister( uint16_t *pTxBuff, uint16_t *pRxBuff, uint32_t frameLength) { + FAS_ASSERT(Command != NULL_PTR); + FAS_ASSERT(pSpiInterface != NULL_PTR); + FAS_ASSERT(pTxBuff != NULL_PTR); + FAS_ASSERT(pRxBuff != NULL_PTR); STD_RETURN_TYPE_e retVal = STD_NOT_OK; /* DataBufferSPI_RX_with_PEC contains the data to receive. @@ -3875,33 +3912,48 @@ static STD_RETURN_TYPE_e LTC_ReadRegister( pTxBuff[2] = Command[2]; pTxBuff[3] = Command[3]; - retVal = LTC_TransmitReceiveData(pSpiInterface, pTxBuff, pRxBuff, frameLength); + retVal = LTC_TRANSMIT_RECEIVE_DATA(pSpiInterface, pTxBuff, pRxBuff, frameLength); return retVal; } /** * @brief sends command and data to the LTC daisy-chain. - * - * This is the core function to transmit data to the LTC6804 daisy-chain. - * The data sent is: - * COMMAND + 6 bytes (LTC1) + 6 bytes (LTC2) + 6 bytes (LTC3) + ... + 6 bytes (LTC{LTC_N_LTC}) - * A 2 byte command is sent with the corresponding PEC. Example: write configuration register (WRCFG). - * THe command has to be set and then the function calculates the PEC automatically. - * The function calculates the needed PEC to send the data to the daisy-chain. The sent data has the format: - * 2 byte-COMMAND (2 bytes PEC) + 6 bytes (LTC1) (2 bytes PEC) + 6 bytes (LTC2) (2 bytes PEC) + 6 bytes (LTC3) (2 bytes PEC) + ... + 6 bytes (LTC{LTC_N_LTC}) (2 bytes PEC) - * - * The function returns 0. The only way to check if the transmission was successful is to read the results of the write operation. - * (example: read configuration register after writing to it) - * - * @param Command command sent to the daisy-chain - * @param pSpiInterface pointer to SPI configuration - * @param pTxBuff transmit buffer - * @param pRxBuff receive buffer - * @param frameLength number of words to transmit - * - * @return STD_OK if SPI transmission is OK, STD_NOT_OK otherwise - * + * @details This is the core function to transmit data to the LTC6813-1 + * daisy-chain. + * The data sent is: + * - COMMAND + + * - 6 bytes (LTC1) + + * - 6 bytes (LTC2) + + * - 6 bytes (LTC3) + + * - ... + + * - 6 bytes (LTC{LTC_N_LTC}) + * + * A 2 byte command is sent with the corresponding PEC. + * *Example*: write configuration register (WRCFG). + * The command has to be set and then the function calculates the PEC + * automatically. + * The function calculates the needed PEC to send the data to the + * daisy-chain. + * The sent data has the format: + * - 2 byte-COMMAND (2 bytes PEC) + + * - 6 bytes (LTC1) (2 bytes PEC) + + * - 6 bytes (LTC2) (2 bytes PEC) + + * - 6 bytes (LTC3) (2 bytes PEC) + + * - ... + + * - 6 bytes (LTC{LTC_N_LTC}) (2 bytes PEC) + * + * The function returns 0. The only way to check if the transmission + * was successful is to read the results of the write operation. + * (example: read configuration register after writing to it) + * + * @param Command command sent to the daisy-chain + * @param pSpiInterface pointer to SPI configuration + * @param pTxBuff transmit buffer + * @param pRxBuff receive buffer + * @param frameLength number of words to transmit + * + * @return STD_OK if SPI transmission is OK, STD_NOT_OK otherwise */ static STD_RETURN_TYPE_e LTC_WriteRegister( uint16_t *Command, @@ -3909,6 +3961,10 @@ static STD_RETURN_TYPE_e LTC_WriteRegister( uint16_t *pTxBuff, uint16_t *pRxBuff, uint32_t frameLength) { + FAS_ASSERT(Command != NULL_PTR); + FAS_ASSERT(pSpiInterface != NULL_PTR); + FAS_ASSERT(pTxBuff != NULL_PTR); + FAS_ASSERT(pRxBuff != NULL_PTR); STD_RETURN_TYPE_e retVal = STD_NOT_OK; uint16_t PEC_result = 0; @@ -3933,7 +3989,7 @@ static STD_RETURN_TYPE_e LTC_WriteRegister( pTxBuff[11u + (i * 8u)] = PEC_result & 0xFFu; } - retVal = LTC_TransmitReceiveData(pSpiInterface, pTxBuff, pRxBuff, frameLength); + retVal = LTC_TRANSMIT_RECEIVE_DATA(pSpiInterface, pTxBuff, pRxBuff, frameLength); return retVal; } @@ -3950,6 +4006,7 @@ static STD_RETURN_TYPE_e LTC_WriteRegister( * */ static void LTC_SetMuxChCommand(uint16_t *pTxBuff, uint8_t mux, uint8_t channel) { + FAS_ASSERT(pTxBuff != NULL_PTR); for (uint16_t i = 0; i < LTC_N_LTC; i++) { #if SLAVE_BOARD_VERSION == 2u @@ -4000,6 +4057,10 @@ static STD_RETURN_TYPE_e LTC_SendEepromReadCommand( uint16_t *pRxBuff, uint32_t frameLength, uint8_t step) { + FAS_ASSERT(ltc_state != NULL_PTR); + FAS_ASSERT(pSpiInterface != NULL_PTR); + FAS_ASSERT(pTxBuff != NULL_PTR); + FAS_ASSERT(pRxBuff != NULL_PTR); STD_RETURN_TYPE_e statusSPI = STD_NOT_OK; /* send WRCOMM to send I2C message to choose channel */ @@ -4018,6 +4079,8 @@ static STD_RETURN_TYPE_e LTC_SendEepromReadCommand( * */ static void LTC_SetEepromReadCommand(LTC_STATE_s *ltc_state, uint16_t *pTxBuff, uint8_t step) { + FAS_ASSERT(ltc_state != NULL_PTR); + FAS_ASSERT(pTxBuff != NULL_PTR); DATA_READ_DATA(ltc_state->ltcData.slaveControl); uint32_t address = ltc_state->ltcData.slaveControl->eepromReadAddressToUse; @@ -4036,7 +4099,6 @@ static void LTC_SetEepromReadCommand(LTC_STATE_s *ltc_state, uint16_t *pTxBuff, pTxBuff[8u + (i * 8u)] = LTC_ICOM_BLANK | (address2 >> 4u); pTxBuff[9u + (i * 8u)] = LTC_FCOM_MASTER_NACK | (address2 << 4u); } - } else { /* step == 1 */ for (uint16_t i = 0; i < LTC_N_LTC; i++) { pTxBuff[4u + (i * 8u)] = LTC_ICOM_START | (0x0Au); /* 0x6 : LTC6804: ICOM START from Master */ @@ -4057,6 +4119,8 @@ static void LTC_SetEepromReadCommand(LTC_STATE_s *ltc_state, uint16_t *pTxBuff, * */ static void LTC_EepromSaveReadValue(LTC_STATE_s *ltc_state, uint16_t *pRxBuff) { + FAS_ASSERT(ltc_state != NULL_PTR); + FAS_ASSERT(pRxBuff != NULL_PTR); DATA_READ_DATA(ltc_state->ltcData.slaveControl); for (uint16_t i = 0; i < LTC_N_LTC; i++) { @@ -4090,6 +4154,10 @@ static STD_RETURN_TYPE_e LTC_SendEepromWriteCommand( uint16_t *pRxBuff, uint32_t frameLength, uint8_t step) { + FAS_ASSERT(ltc_state != NULL_PTR); + FAS_ASSERT(pSpiInterface != NULL_PTR); + FAS_ASSERT(pTxBuff != NULL_PTR); + FAS_ASSERT(pRxBuff != NULL_PTR); STD_RETURN_TYPE_e statusSPI = STD_NOT_OK; /* send WRCOMM to send I2C message to write EEPROM */ @@ -4108,6 +4176,8 @@ static STD_RETURN_TYPE_e LTC_SendEepromWriteCommand( * */ static void LTC_SetEepromWriteCommand(LTC_STATE_s *ltc_state, uint16_t *pTxBuff, uint8_t step) { + FAS_ASSERT(ltc_state != NULL_PTR); + FAS_ASSERT(pTxBuff != NULL_PTR); DATA_READ_DATA(ltc_state->ltcData.slaveControl); uint32_t address = ltc_state->ltcData.slaveControl->eepromWriteAddressToUse; @@ -4126,7 +4196,6 @@ static void LTC_SetEepromWriteCommand(LTC_STATE_s *ltc_state, uint16_t *pTxBuff, pTxBuff[8u + (i * 8u)] = LTC_ICOM_BLANK | (address2 >> 4u); pTxBuff[9u + (i * 8u)] = LTC_FCOM_MASTER_NACK | (address2 << 4u); } - } else { /* step == 1 */ for (uint16_t i = 0; i < LTC_N_LTC; i++) { const uint8_t data = ltc_state->ltcData.slaveControl->eepromValueWrite[i]; @@ -4152,12 +4221,12 @@ static void LTC_SetEepromWriteCommand(LTC_STATE_s *ltc_state, uint16_t *pTxBuff, * * This function calls the function LTC_SetMuxChCommand() to set the data. * - * @param pSpiInterface pointer to SPI configuration - * @param pTxBuff transmit buffer - * @param pRxBuff receive buffer - * @param frameLength number of words to transmit - * @param mux multiplexer ID to be configured (0,1,2 or 3) - * @param channel multiplexer channel to be configured (0 to 7) + * @param pSpiInterface pointer to SPI configuration + * @param pTxBuff transmit buffer + * @param pRxBuff receive buffer + * @param frameLength number of words to transmit + * @param mux multiplexer ID to be configured (0,1,2 or 3) + * @param channel multiplexer channel to be configured (0 to 7) * * @return #STD_OK if SPI transmission is OK, #STD_NOT_OK otherwise */ @@ -4168,6 +4237,10 @@ static STD_RETURN_TYPE_e LTC_SetMuxChannel( uint32_t frameLength, uint8_t mux, uint8_t channel) { + FAS_ASSERT(pSpiInterface != NULL_PTR); + FAS_ASSERT(pTxBuff != NULL_PTR); + FAS_ASSERT(pRxBuff != NULL_PTR); + STD_RETURN_TYPE_e statusSPI = STD_NOT_OK; /* send WRCOMM to send I2C message to choose channel */ @@ -4196,6 +4269,10 @@ static STD_RETURN_TYPE_e LTC_SendI2cCommand( uint16_t *pRxBuff, uint32_t frameLength, uint16_t *cmd_data) { + FAS_ASSERT(pSpiInterface != NULL_PTR); + FAS_ASSERT(pTxBuff != NULL_PTR); + FAS_ASSERT(pRxBuff != NULL_PTR); + FAS_ASSERT(cmd_data != NULL_PTR); STD_RETURN_TYPE_e statusSPI = STD_NOT_OK; for (uint16_t i = 0; i < BS_NR_OF_MODULES_PER_STRING; i++) { @@ -4225,6 +4302,8 @@ static STD_RETURN_TYPE_e LTC_SendI2cCommand( * */ static void LTC_TempSensSaveTemp(LTC_STATE_s *ltc_state, uint16_t *pRxBuff) { + FAS_ASSERT(ltc_state != NULL_PTR); + FAS_ASSERT(pRxBuff != NULL_PTR); DATA_READ_DATA(ltc_state->ltcData.slaveControl); for (uint16_t i = 0; i < LTC_N_LTC; i++) { @@ -4258,6 +4337,11 @@ static STD_RETURN_TYPE_e LTC_SetPortExpander( uint16_t *pTxBuff, uint16_t *pRxBuff, uint32_t frameLength) { + FAS_ASSERT(ltc_state != NULL_PTR); + FAS_ASSERT(pSpiInterface != NULL_PTR); + FAS_ASSERT(pTxBuff != NULL_PTR); + FAS_ASSERT(pRxBuff != NULL_PTR); + STD_RETURN_TYPE_e statusSPI = STD_NOT_OK; DATA_READ_DATA(ltc_state->ltcData.slaveControl); @@ -4297,6 +4381,8 @@ static STD_RETURN_TYPE_e LTC_SetPortExpander( * */ static void LTC_PortExpanderSaveValues(LTC_STATE_s *ltc_state, uint16_t *pRxBuff) { + FAS_ASSERT(ltc_state != NULL_PTR); + FAS_ASSERT(pRxBuff != NULL_PTR); DATA_READ_DATA(ltc_state->ltcData.slaveControl); /* extract data */ @@ -4329,6 +4415,10 @@ static STD_RETURN_TYPE_e LTC_SetPortExpanderDirectionTi( uint16_t *pRxBuff, uint32_t frameLength, LTC_PORT_EXPANDER_TI_DIRECTION_e direction) { + FAS_ASSERT(ltc_state != NULL_PTR); + FAS_ASSERT(pSpiInterface != NULL_PTR); + FAS_ASSERT(pTxBuff != NULL_PTR); + FAS_ASSERT(pRxBuff != NULL_PTR); STD_RETURN_TYPE_e statusSPI = STD_NOT_OK; DATA_READ_DATA(ltc_state->ltcData.slaveControl); @@ -4374,6 +4464,10 @@ static STD_RETURN_TYPE_e LTC_SetPortExpanderOutputTi( uint16_t *pTxBuff, uint16_t *pRxBuff, uint32_t frameLength) { + FAS_ASSERT(ltc_state != NULL_PTR); + FAS_ASSERT(pSpiInterface != NULL_PTR); + FAS_ASSERT(pTxBuff != NULL_PTR); + FAS_ASSERT(pRxBuff != NULL_PTR); STD_RETURN_TYPE_e statusSPI = STD_NOT_OK; DATA_READ_DATA(ltc_state->ltcData.slaveControl); @@ -4422,6 +4516,10 @@ static STD_RETURN_TYPE_e LTC_GetPortExpanderInputTi( uint16_t *pRxBuff, uint32_t frameLength, uint8_t step) { + FAS_ASSERT(ltc_state != NULL_PTR); + FAS_ASSERT(pSpiInterface != NULL_PTR); + FAS_ASSERT(pTxBuff != NULL_PTR); + FAS_ASSERT(pRxBuff != NULL_PTR); STD_RETURN_TYPE_e statusSPI = STD_NOT_OK; if (step == 0u) { @@ -4438,7 +4536,6 @@ static STD_RETURN_TYPE_e LTC_GetPortExpanderInputTi( pTxBuff[8u + (i * 8u)] = LTC_ICOM_NO_TRANSMIT; /* no transmission */ pTxBuff[9u + (i * 8u)] = 0; /* dummy data */ } - } else { DATA_READ_DATA(ltc_state->ltcData.slaveControl); @@ -4468,6 +4565,8 @@ static STD_RETURN_TYPE_e LTC_GetPortExpanderInputTi( * @param pTxBuff transmit buffer */ static void LTC_PortExpanderSaveValuesTi(LTC_STATE_s *ltc_state, uint16_t *pTxBuff) { + FAS_ASSERT(ltc_state != NULL_PTR); + FAS_ASSERT(pTxBuff != NULL_PTR); DATA_READ_DATA(ltc_state->ltcData.slaveControl); /* extract data */ @@ -4491,6 +4590,7 @@ static void LTC_PortExpanderSaveValuesTi(LTC_STATE_s *ltc_state, uint16_t *pTxBu * */ static STD_RETURN_TYPE_e LTC_I2cClock(SPI_INTERFACE_CONFIG_s *pSpiInterface) { + FAS_ASSERT(pSpiInterface != NULL_PTR); STD_RETURN_TYPE_e statusSPI = STD_NOT_OK; uint16_t ltc_TXBufferClock[4u + 9u]; @@ -4503,7 +4603,7 @@ static STD_RETURN_TYPE_e LTC_I2cClock(SPI_INTERFACE_CONFIG_s *pSpiInterface) { ltc_TXBufferClock[2] = ltc_cmdSTCOMM[2]; ltc_TXBufferClock[3] = ltc_cmdSTCOMM[3]; - statusSPI = LTC_TransmitI2cCommand(pSpiInterface, ltc_TXBufferClock); + statusSPI = LTC_TRANSMIT_I2C_COMMAND(pSpiInterface, ltc_TXBufferClock); return statusSPI; } @@ -4518,6 +4618,7 @@ static STD_RETURN_TYPE_e LTC_I2cClock(SPI_INTERFACE_CONFIG_s *pSpiInterface) { * @return frequency of the SPI clock */ static uint32_t LTC_GetSpiClock(SPI_INTERFACE_CONFIG_s *pSpiInterface) { + FAS_ASSERT(pSpiInterface != NULL_PTR); uint32_t SPI_Clock = 0; uint32_t prescaler = 0; @@ -4559,6 +4660,7 @@ static uint32_t LTC_GetSpiClock(SPI_INTERFACE_CONFIG_s *pSpiInterface) { * */ static void LTC_SetTransferTimes(LTC_STATE_s *ltc_state) { + FAS_ASSERT(ltc_state != NULL_PTR); uint32_t transferTime_us = 0; uint32_t SPI_Clock = 0; @@ -4596,6 +4698,7 @@ static void LTC_SetTransferTimes(LTC_STATE_s *ltc_state) { * @return result of the state request that was made, taken from LTC_RETURN_TYPE_e */ static LTC_RETURN_TYPE_e LTC_CheckStateRequest(LTC_STATE_s *ltc_state, LTC_REQUEST_s statereq) { + FAS_ASSERT(ltc_state != NULL_PTR); LTC_RETURN_TYPE_e retVal = LTC_OK; if (statereq.string >= BS_NR_OF_STRINGS) { retVal = LTC_ILLEGAL_REQUEST; @@ -4618,6 +4721,7 @@ static LTC_RETURN_TYPE_e LTC_CheckStateRequest(LTC_STATE_s *ltc_state, LTC_REQUE } extern bool LTC_IsFirstMeasurementCycleFinished(LTC_STATE_s *ltc_state) { + FAS_ASSERT(ltc_state != NULL_PTR); bool retval = false; OS_EnterTaskCritical(); diff --git a/src/app/driver/afe/ltc/6813-1/ltc_6813-1.json b/src/app/driver/afe/ltc/6813-1/ltc_6813-1.json index e5106bf9..ab69d8bb 100644 --- a/src/app/driver/afe/ltc/6813-1/ltc_6813-1.json +++ b/src/app/driver/afe/ltc/6813-1/ltc_6813-1.json @@ -2,8 +2,6 @@ "include": [ ".", "config", - "../../api", - "common", - "common/config" + "../../api" ] } diff --git a/src/app/driver/afe/ltc/6813-1/wscript b/src/app/driver/afe/ltc/6813-1/wscript index b9d4d32a..e29e6f8d 100644 --- a/src/app/driver/afe/ltc/6813-1/wscript +++ b/src/app/driver/afe/ltc/6813-1/wscript @@ -76,7 +76,7 @@ def build(bld): os.path.join("..", "..", "..", "..", "main", "include"), os.path.join("..", "..", "..", "..", "task", "os"), ] - includes.extend(bld.env.INCLUDES_OPERATING_SYSTEM) + includes.extend(bld.env.INCLUDES_RTOS) cflags = bld.env.CFLAGS_FOXBMS target = f"{bld.env.APPNAME.lower()}-afe-driver" bld.stlib( diff --git a/src/app/driver/afe/ltc/api/ltc_afe.c b/src/app/driver/afe/ltc/api/ltc_afe.c index 258ecfb5..4f571e9e 100644 --- a/src/app/driver/afe/ltc/api/ltc_afe.c +++ b/src/app/driver/afe/ltc/api/ltc_afe.c @@ -43,8 +43,8 @@ * @file ltc_afe.c * @author foxBMS Team * @date 2020-05-08 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVER * @prefix AFE * diff --git a/src/app/driver/afe/ltc/common/config/ltc_afe_dma_cfg.c b/src/app/driver/afe/ltc/common/config/ltc_afe_dma_cfg.c index 9b1cc421..67080932 100644 --- a/src/app/driver/afe/ltc/common/config/ltc_afe_dma_cfg.c +++ b/src/app/driver/afe/ltc/common/config/ltc_afe_dma_cfg.c @@ -43,15 +43,13 @@ * @file ltc_afe_dma_cfg.c * @author foxBMS Team * @date 2020-03-05 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS_CONFIGURATION * @prefix DMA * * @brief Configuration for the DMA module * - * - * */ /*========== Includes =======================================================*/ diff --git a/src/app/driver/afe/ltc/common/config/ltc_afe_dma_cfg.h b/src/app/driver/afe/ltc/common/config/ltc_afe_dma_cfg.h index e11e90af..52957deb 100644 --- a/src/app/driver/afe/ltc/common/config/ltc_afe_dma_cfg.h +++ b/src/app/driver/afe/ltc/common/config/ltc_afe_dma_cfg.h @@ -43,8 +43,8 @@ * @file ltc_afe_dma_cfg.h * @author foxBMS Team * @date 2020-03-05 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix DMA * diff --git a/src/app/driver/afe/ltc/common/config/ltc_cfg.h b/src/app/driver/afe/ltc/common/config/ltc_cfg.h index ac4c7bca..52f5eecf 100644 --- a/src/app/driver/afe/ltc/common/config/ltc_cfg.h +++ b/src/app/driver/afe/ltc/common/config/ltc_cfg.h @@ -43,8 +43,8 @@ * @file ltc_cfg.h * @author foxBMS Team * @date 2015-02-18 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS_CONFIGURATION * @prefix LTC * diff --git a/src/app/driver/afe/ltc/common/ltc.h b/src/app/driver/afe/ltc/common/ltc.h index dc37a4de..c422d828 100644 --- a/src/app/driver/afe/ltc/common/ltc.h +++ b/src/app/driver/afe/ltc/common/ltc.h @@ -43,8 +43,8 @@ * @file ltc.h * @author foxBMS Team * @date 2015-09-01 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix LTC * diff --git a/src/app/driver/afe/ltc/common/ltc_afe_dma.c b/src/app/driver/afe/ltc/common/ltc_afe_dma.c index 92ab7446..20f59a9f 100644 --- a/src/app/driver/afe/ltc/common/ltc_afe_dma.c +++ b/src/app/driver/afe/ltc/common/ltc_afe_dma.c @@ -43,8 +43,8 @@ * @file ltc_afe_dma.c * @author foxBMS Team * @date 2020-05-27 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix AFE * @@ -72,10 +72,12 @@ /*========== Extern Function Implementations ================================*/ extern bool AFE_IsTransmitOngoing(LTC_STATE_s *pLtcState) { + FAS_ASSERT(pLtcState != NULL_PTR); return pLtcState->transmit_ongoing; } extern void AFE_SetTransmitOngoing(LTC_STATE_s *pLtcState) { + FAS_ASSERT(pLtcState != NULL_PTR); pLtcState->transmit_ongoing = true; } diff --git a/src/app/driver/afe/ltc/common/ltc_afe_dma.h b/src/app/driver/afe/ltc/common/ltc_afe_dma.h index be4f9de9..596224ae 100644 --- a/src/app/driver/afe/ltc/common/ltc_afe_dma.h +++ b/src/app/driver/afe/ltc/common/ltc_afe_dma.h @@ -43,8 +43,8 @@ * @file ltc_afe_dma.h * @author foxBMS Team * @date 2020-05-27 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix AFE * diff --git a/src/app/driver/afe/ltc/common/ltc_defs.h b/src/app/driver/afe/ltc/common/ltc_defs.h index 38f8863d..4e5a2223 100644 --- a/src/app/driver/afe/ltc/common/ltc_defs.h +++ b/src/app/driver/afe/ltc/common/ltc_defs.h @@ -43,8 +43,8 @@ * @file ltc_defs.h * @author foxBMS Team * @date 2015-09-01 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix LTC * @@ -261,16 +261,16 @@ typedef enum { /** Substates for digital filter check */ typedef enum { - LTC_REQUEST_CLEAR_CELLVOLTAGES, + LTC_REQUEST_CLEAR_CELL_VOLTAGES, LTC_REQUEST_CLEAR_AUX_REGISTER, LTC_REQUEST_CLEAR_STATUS_REGISTER, - LTC_REQUEST_DIGITAL_FILTER_CHECK_CELLVOLTAGES, - LTC_DIGITAL_FILTER_SELF_TEST_1_CELLVOLTAGES, + LTC_REQUEST_DIGITAL_FILTER_CHECK_CELL_VOLTAGES, + LTC_DIGITAL_FILTER_SELF_TEST_1_CELL_VOLTAGES, LTC_DIGITAL_FILTER_SELF_TEST_1_AUX, LTC_DIGITAL_FILTER_READ_STATUS_REGISTER_A, LTC_DIGITAL_FILTER_READ_STATUS_REGISTER_B, LTC_DIGITAL_FILTER_SELF_TEST_1_STATUS, - LTC_DIGITAL_FILTER_SELF_TEST_2_CELLVOLTAGES, + LTC_DIGITAL_FILTER_SELF_TEST_2_CELL_VOLTAGES, LTC_DIGITAL_FILTER_SELF_TEST_2_AUX, LTC_DIGITAL_FILTER_READ_STATUS_REGISTER_A_2, LTC_DIGITAL_FILTER_READ_STATUS_REGISTER_B_2, @@ -446,11 +446,9 @@ typedef struct { uint16_t *usedCellIndex; LTC_OPENWIRE_DETECTION_s *openWireDetection; LTC_ERRORTABLE_s *errorTable; - DATA_BLOCK_USER_MUX_s *user_mux; uint16_t *GPIOVoltages; /* LTC2_NUMBER_OF_GPIOS * NR_OF_LTCs */ uint16_t *valid_GPIOPECs; /* NR_OF_LTCs */ - } LTC_DATAPTR_s; /** This struct contains error counter and pointer to used error buffers */ @@ -585,7 +583,6 @@ typedef struct { uint8_t muxmeas_nr_end [BS_NR_OF_STRINGS]; /*!< number of multiplexer channels that have to be measured; end number of sequence, where measurement is finished*/ uint8_t configuration[6]; /*!< holds the configuration of the ltc (configuration register) */ - } LTC_STATE_s; /*========== Extern Function Prototypes =====================================*/ diff --git a/src/app/driver/afe/ltc/wscript b/src/app/driver/afe/ltc/wscript index 74b4491d..a4ef3a28 100644 --- a/src/app/driver/afe/ltc/wscript +++ b/src/app/driver/afe/ltc/wscript @@ -45,4 +45,4 @@ Helper script to recursively build the embedded sources""" def build(bld): """selects the driver library to be build""" - bld.recurse(bld.env.afe_chip) + bld.recurse(bld.env.afe_ic) diff --git a/src/app/driver/afe/maxim/api/mxm_afe.c b/src/app/driver/afe/maxim/api/mxm_afe.c index fb650d09..2c53c377 100644 --- a/src/app/driver/afe/maxim/api/mxm_afe.c +++ b/src/app/driver/afe/maxim/api/mxm_afe.c @@ -43,8 +43,8 @@ * @file mxm_afe.c * @author foxBMS Team * @date 2020-06-16 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVER * @prefix AFE * @@ -65,11 +65,11 @@ /*========== Static Constant and Variable Definitions =======================*/ /** state variable for the MAX17841B driver */ -/* AXIVION Next Line Style Generic-InitializeAllVariables: state variable has an initializer function */ +/* AXIVION Next Codeline Style Generic-InitializeAllVariables: state variable has an initializer function */ static MXM_41B_INSTANCE_s mxm_41bState; /** state variable for the Battery Management protocol driver */ -/* AXIVION Next Line Style Generic-InitializeAllVariables: state variable has an initializer function */ +/* AXIVION Next Codeline Style Generic-InitializeAllVariables: state variable has an initializer function */ static MXM_5X_INSTANCE_s mxm_5xState; /** @@ -134,7 +134,7 @@ static MXM_MONITORING_INSTANCE_s mxm_state = { * The state-machines are called in such a way that the main blocking * point is the SPI interface. (That means the order is optimized so * that every cycle a SPI command should be available for sending or - * receiving as this is the limiting ressource.) + * receiving as this is the limiting resource.) */ static void MXM_Tick(void); @@ -190,7 +190,6 @@ extern STD_RETURN_TYPE_e AFE_TriggerIc(void) { mxm_state.allowStartup = allowStartup; /* if a first measurement has been done, operation has been requested before */ mxm_state.operationRequested = (operationRequested || firstMeasurementDone); - } else { MXM_Tick(); } diff --git a/src/app/driver/afe/maxim/common/config/mxm_cfg.c b/src/app/driver/afe/maxim/common/config/mxm_cfg.c index 99215c28..77f5a18e 100644 --- a/src/app/driver/afe/maxim/common/config/mxm_cfg.c +++ b/src/app/driver/afe/maxim/common/config/mxm_cfg.c @@ -43,8 +43,8 @@ * @file mxm_cfg.c * @author foxBMS Team * @date 2019-01-09 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS_CONFIGURATION * @prefix MXM * @@ -77,18 +77,18 @@ extern void MXM_InitializeMonitoringPins(void) { IO_PinReset(&MXM_17841B_GIOPORT->DOUT, MXM_17841B_SHTNDL_PIN); /* configure functional of SIMO and SOMI pin */ - SPI_SetFunctional(spi_MxmInterface.pNode, SPI_PIN_SIMO, true); - SPI_SetFunctional(spi_MxmInterface.pNode, SPI_PIN_SOMI, true); + SPI_SetFunctional(spi_mxmInterface.pNode, SPI_PIN_SIMO, true); + SPI_SetFunctional(spi_mxmInterface.pNode, SPI_PIN_SOMI, true); } extern STD_RETURN_TYPE_e MXM_GetSPIStateReady(void) { - return SPI_CheckInterfaceAvailable(spi_MxmInterface.pNode); + return SPI_CheckInterfaceAvailable(spi_mxmInterface.pNode); } extern STD_RETURN_TYPE_e MXM_SendData(uint16_t *txBuffer, uint16_t length) { FAS_ASSERT(txBuffer != NULL_PTR); FAS_ASSERT(length != 0u); - const STD_RETURN_TYPE_e spiReturnValue = SPI_TransmitData(&spi_MxmInterface, txBuffer, length); + const STD_RETURN_TYPE_e spiReturnValue = SPI_TransmitData(&spi_mxmInterface, txBuffer, length); /* this driver currently only handles one physical string, therefore reporting to string 0 */ (void)DIAG_CheckEvent(spiReturnValue, DIAG_ID_AFE_SPI, DIAG_STRING, 0u); return spiReturnValue; @@ -98,7 +98,7 @@ extern STD_RETURN_TYPE_e MXM_ReceiveData(uint16_t *txBuffer, uint16_t *rxBuffer, FAS_ASSERT(txBuffer != NULL_PTR); FAS_ASSERT(rxBuffer != NULL_PTR); FAS_ASSERT(length != 0u); - const STD_RETURN_TYPE_e spiReturnValue = SPI_TransmitReceiveData(&spi_MxmInterface, txBuffer, rxBuffer, length); + const STD_RETURN_TYPE_e spiReturnValue = SPI_TransmitReceiveData(&spi_mxmInterface, txBuffer, rxBuffer, length); /* this driver currently only handles one physical string, therefore reporting to string 0 */ (void)DIAG_CheckEvent(spiReturnValue, DIAG_ID_AFE_SPI, DIAG_STRING, 0u); return spiReturnValue; diff --git a/src/app/driver/afe/maxim/common/config/mxm_cfg.h b/src/app/driver/afe/maxim/common/config/mxm_cfg.h index 614e93f5..34257a6d 100644 --- a/src/app/driver/afe/maxim/common/config/mxm_cfg.h +++ b/src/app/driver/afe/maxim/common/config/mxm_cfg.h @@ -43,8 +43,8 @@ * @file mxm_cfg.h * @author foxBMS Team * @date 2019-01-09 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS_CONFIGURATION * @prefix MXM * @@ -71,7 +71,7 @@ * @{ */ #define MXM_17841B_GIOPORT (hetREG1) -#define MXM_17841B_SHTNDL_PIN (21U) +#define MXM_17841B_SHTNDL_PIN (21u) /**@}*/ /** diff --git a/src/app/driver/afe/maxim/common/mxm_17841b.c b/src/app/driver/afe/maxim/common/mxm_17841b.c index 29ca9ae4..cdd8e3f5 100644 --- a/src/app/driver/afe/maxim/common/mxm_17841b.c +++ b/src/app/driver/afe/maxim/common/mxm_17841b.c @@ -43,8 +43,8 @@ * @file mxm_17841b.c * @author foxBMS Team * @date 2018-12-14 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix MXM * @@ -361,7 +361,7 @@ static STD_RETURN_TYPE_e MXM_41BConfigRegisterWrite(MXM_41B_INSTANCE_s *pInstanc mxm_spi_temp_buffer[5u] = pInstance->regConfig2; mxm_spi_temp_buffer[6u] = pInstance->regConfig3; /* AXIVION Enable Style Generic-NoMagicNumbers: */ - f_static_assert((6u < MXM_41B_CONFIG_REGISTER_LENGTH), "Revise this function and config register length!"); + FAS_STATIC_ASSERT((6u < MXM_41B_CONFIG_REGISTER_LENGTH), "Revise this function and config register length!"); return MXM_41BRegisterWrite( pInstance, MXM_REG_RX_INTERRUPT_ENABLE_W, mxm_spi_temp_buffer, MXM_41B_CONFIG_REGISTER_LENGTH); @@ -533,7 +533,6 @@ static void MXM_41BStateHandlerGetVersion(MXM_41B_INSTANCE_s *pInstance) { MXM_41BTransitionToIdleSuccess(pInstance); } - } else { /* something is very broken */ MXM_41BTransitionToIdleError(pInstance); diff --git a/src/app/driver/afe/maxim/common/mxm_17841b.h b/src/app/driver/afe/maxim/common/mxm_17841b.h index 338d3949..242f1186 100644 --- a/src/app/driver/afe/maxim/common/mxm_17841b.h +++ b/src/app/driver/afe/maxim/common/mxm_17841b.h @@ -43,8 +43,8 @@ * @file mxm_17841b.h * @author foxBMS Team * @date 2018-12-14 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix MXM * diff --git a/src/app/driver/afe/maxim/common/mxm_1785x.c b/src/app/driver/afe/maxim/common/mxm_1785x.c index ef2dc904..4cad0ac2 100644 --- a/src/app/driver/afe/maxim/common/mxm_1785x.c +++ b/src/app/driver/afe/maxim/common/mxm_1785x.c @@ -43,8 +43,8 @@ * @file mxm_1785x.c * @author foxBMS Team * @date 2019-01-15 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix MXM * @@ -119,7 +119,7 @@ static void MXM_GetDataFrom5XStateMachine(MXM_MONITORING_INSTANCE_s *pInstance); * array. * @details This function expects a preprocessed RX buffer with an answer * to a READALL command. It will parse the data bytes from this - * message into an array structured like mxm_local_cellvoltages. + * message into an array structured like mxm_local_cellVoltages. * The offset of the measured cell has to be defined. For example * cell 1 has an offset of 0 and cell 4 has an offset of 3. The * offset for the READALL command is always defined in reference @@ -184,7 +184,7 @@ static STD_RETURN_TYPE_e MXM_ParseVoltageReadall( * @return #STD_OK if the self-check has been performed successfully, * otherwise #STD_NOT_OK */ -static STD_RETURN_TYPE_e must_check_return MXM_ParseVoltageReadallTest(MXM_MONITORING_INSTANCE_s *pInstance); +static STD_RETURN_TYPE_e GEN_MUST_CHECK_RETURN MXM_ParseVoltageReadallTest(MXM_MONITORING_INSTANCE_s *pInstance); /*========== Static Function Implementations ================================*/ @@ -482,7 +482,7 @@ static STD_RETURN_TYPE_e MXM_ParseVoltageReadall( return retval; } -static STD_RETURN_TYPE_e must_check_return MXM_ParseVoltageReadallTest(MXM_MONITORING_INSTANCE_s *pInstance) { +static STD_RETURN_TYPE_e GEN_MUST_CHECK_RETURN MXM_ParseVoltageReadallTest(MXM_MONITORING_INSTANCE_s *pInstance) { FAS_ASSERT(pInstance != NULL_PTR); STD_RETURN_TYPE_e retval = STD_OK; @@ -499,7 +499,7 @@ static STD_RETURN_TYPE_e must_check_return MXM_ParseVoltageReadallTest(MXM_MONIT testBuffer[0] = BATTERY_MANAGEMENT_HELLOALL; if (MXM_ParseVoltageReadall(testBuffer, testBufferLength, &pInstance->localVoltages, MXM_CONVERSION_UNIPOLAR) != STD_NOT_OK) { - /* AXIVION Next Line Style FaultDetection-UnusedAssignments: return value collects all negative results. */ + /* AXIVION Next Codeline Style FaultDetection-UnusedAssignments: return value collects all negative results. */ retval = STD_NOT_OK; } @@ -508,17 +508,17 @@ static STD_RETURN_TYPE_e must_check_return MXM_ParseVoltageReadallTest(MXM_MONIT testBuffer[1] = (uint8_t)MXM_REG_VERSION; if (MXM_ParseVoltageReadall(testBuffer, testBufferLength, &pInstance->localVoltages, MXM_CONVERSION_UNIPOLAR) != STD_NOT_OK) { - /* AXIVION Next Line Style FaultDetection-UnusedAssignments: return value collects all negative results. */ + /* AXIVION Next Codeline Style FaultDetection-UnusedAssignments: return value collects all negative results. */ retval = STD_NOT_OK; } /* bogus conversion type */ testBuffer[0] = BATTERY_MANAGEMENT_READALL; testBuffer[1] = (uint8_t)MXM_REG_CELL1; - /* AXIVION Next Line Style MisraC2012Directive-4.1 MisraC2012-10.5: explicitely invalid value in order to provoke error response */ + /* AXIVION Next Codeline Style MisraC2012Directive-4.1 MisraC2012-10.5: explicitly invalid value in order to provoke error response */ if (MXM_ParseVoltageReadall(testBuffer, testBufferLength, &pInstance->localVoltages, (MXM_CONVERSION_TYPE_e)42) != STD_NOT_OK) { - /* AXIVION Next Line Style FaultDetection-UnusedAssignments: return value collects all negative results. */ + /* AXIVION Next Codeline Style FaultDetection-UnusedAssignments: return value collects all negative results. */ retval = STD_NOT_OK; } @@ -528,7 +528,7 @@ static STD_RETURN_TYPE_e must_check_return MXM_ParseVoltageReadallTest(MXM_MONIT testBufferLength = 5; if (MXM_ParseVoltageReadall(testBuffer, testBufferLength, &pInstance->localVoltages, MXM_CONVERSION_UNIPOLAR) != STD_NOT_OK) { - /* AXIVION Next Line Style FaultDetection-UnusedAssignments: return value collects all negative results. */ + /* AXIVION Next Codeline Style FaultDetection-UnusedAssignments: return value collects all negative results. */ retval = STD_NOT_OK; } @@ -546,18 +546,18 @@ static STD_RETURN_TYPE_e must_check_return MXM_ParseVoltageReadallTest(MXM_MONIT testBufferLength = 10u; if (MXM_ParseVoltageReadall(testBuffer, testBufferLength, &pInstance->localVoltages, MXM_CONVERSION_UNIPOLAR) != STD_OK) { - /* AXIVION Next Line Style FaultDetection-UnusedAssignments: return value collects all negative results. */ + /* AXIVION Next Codeline Style FaultDetection-UnusedAssignments: return value collects all negative results. */ retval = STD_NOT_OK; } else { if ((pInstance->localVoltages.cellVoltages_mV[0] != MXM_REF_UNIPOLAR_CELL_mV) || (pInstance->localVoltages.cellVoltages_mV[14] != 0u) || (pInstance->localVoltages.cellVoltages_mV[28] != MXM_REF_UNIPOLAR_CELL_mV)) { - /* AXIVION Next Line Style FaultDetection-UnusedAssignments: return value collects all negative results. */ + /* AXIVION Next Codeline Style FaultDetection-UnusedAssignments: return value collects all negative results. */ retval = STD_NOT_OK; } } - /* null mxm_local_cellvoltages */ + /* null mxm_local_cellVoltages */ for (uint16_t i_0 = 0; i_0 < (MXM_MAXIMUM_NR_OF_CELLS_PER_MODULE * MXM_MAXIMUM_NR_OF_MODULES); i_0++) { pInstance->localVoltages.cellVoltages_mV[i_0] = 0; } @@ -576,18 +576,18 @@ static STD_RETURN_TYPE_e must_check_return MXM_ParseVoltageReadallTest(MXM_MONIT testBufferLength = 10; if (MXM_ParseVoltageReadall(testBuffer, testBufferLength, &pInstance->localVoltages, MXM_CONVERSION_UNIPOLAR) != STD_OK) { - /* AXIVION Next Line Style FaultDetection-UnusedAssignments: return value collects all negative results. */ + /* AXIVION Next Codeline Style FaultDetection-UnusedAssignments: return value collects all negative results. */ retval = STD_NOT_OK; } else { if ((pInstance->localVoltages.cellVoltages_mV[1] != MXM_REF_UNIPOLAR_CELL_mV) || (pInstance->localVoltages.cellVoltages_mV[15] != 0u) || (pInstance->localVoltages.cellVoltages_mV[29] != MXM_REF_UNIPOLAR_CELL_mV)) { - /* AXIVION Next Line Style FaultDetection-UnusedAssignments: return value collects all negative results. */ + /* AXIVION Next Codeline Style FaultDetection-UnusedAssignments: return value collects all negative results. */ retval = STD_NOT_OK; } } - /* null mxm_local_cellvoltages */ + /* null mxm_local_cellVoltages */ for (uint16_t i_1 = 0; i_1 < (MXM_MAXIMUM_NR_OF_CELLS_PER_MODULE * MXM_MAXIMUM_NR_OF_MODULES); i_1++) { pInstance->localVoltages.cellVoltages_mV[i_1] = 0; } @@ -602,16 +602,16 @@ static STD_RETURN_TYPE_e must_check_return MXM_ParseVoltageReadallTest(MXM_MONIT testBufferLength = 6; if (MXM_ParseVoltageReadall(testBuffer, testBufferLength, &pInstance->localVoltages, MXM_CONVERSION_UNIPOLAR) != STD_OK) { - /* AXIVION Next Line Style FaultDetection-UnusedAssignments: return value collects all negative results. */ + /* AXIVION Next Codeline Style FaultDetection-UnusedAssignments: return value collects all negative results. */ retval = STD_NOT_OK; } else { if (pInstance->localVoltages.cellVoltages_mV[2] != MXM_REF_UNIPOLAR_CELL_mV) { - /* AXIVION Next Line Style FaultDetection-UnusedAssignments: return value collects all negative results. */ + /* AXIVION Next Codeline Style FaultDetection-UnusedAssignments: return value collects all negative results. */ retval = STD_NOT_OK; } } - /* null mxm_local_cellvoltages */ + /* null mxm_local_cellVoltages */ for (uint16_t i_2 = 0; i_2 < (MXM_MAXIMUM_NR_OF_CELLS_PER_MODULE * MXM_MAXIMUM_NR_OF_MODULES); i_2++) { pInstance->localVoltages.cellVoltages_mV[i_2] = 0; } @@ -626,16 +626,16 @@ static STD_RETURN_TYPE_e must_check_return MXM_ParseVoltageReadallTest(MXM_MONIT testBufferLength = 6; if (MXM_ParseVoltageReadall(testBuffer, testBufferLength, &pInstance->localVoltages, MXM_CONVERSION_UNIPOLAR) != STD_OK) { - /* AXIVION Next Line Style FaultDetection-UnusedAssignments: return value collects all negative results. */ + /* AXIVION Next Codeline Style FaultDetection-UnusedAssignments: return value collects all negative results. */ retval = STD_NOT_OK; } else { if (pInstance->localVoltages.cellVoltages_mV[3] != MXM_REF_UNIPOLAR_CELL_mV) { - /* AXIVION Next Line Style FaultDetection-UnusedAssignments: return value collects all negative results. */ + /* AXIVION Next Codeline Style FaultDetection-UnusedAssignments: return value collects all negative results. */ retval = STD_NOT_OK; } } - /* null mxm_local_cellvoltages */ + /* null mxm_local_cellVoltages */ for (uint16_t i_3 = 0; i_3 < (MXM_MAXIMUM_NR_OF_CELLS_PER_MODULE * MXM_MAXIMUM_NR_OF_MODULES); i_3++) { pInstance->localVoltages.cellVoltages_mV[i_3] = 0; } @@ -650,16 +650,16 @@ static STD_RETURN_TYPE_e must_check_return MXM_ParseVoltageReadallTest(MXM_MONIT testBufferLength = 6; if (MXM_ParseVoltageReadall(testBuffer, testBufferLength, &pInstance->localVoltages, MXM_CONVERSION_UNIPOLAR) != STD_OK) { - /* AXIVION Next Line Style FaultDetection-UnusedAssignments: return value collects all negative results. */ + /* AXIVION Next Codeline Style FaultDetection-UnusedAssignments: return value collects all negative results. */ retval = STD_NOT_OK; } else { if (pInstance->localVoltages.cellVoltages_mV[4] != MXM_REF_UNIPOLAR_CELL_mV) { - /* AXIVION Next Line Style FaultDetection-UnusedAssignments: return value collects all negative results. */ + /* AXIVION Next Codeline Style FaultDetection-UnusedAssignments: return value collects all negative results. */ retval = STD_NOT_OK; } } - /* null mxm_local_cellvoltages */ + /* null mxm_local_cellVoltages */ for (uint16_t i_4 = 0; i_4 < (MXM_MAXIMUM_NR_OF_CELLS_PER_MODULE * MXM_MAXIMUM_NR_OF_MODULES); i_4++) { pInstance->localVoltages.cellVoltages_mV[i_4] = 0; } @@ -674,16 +674,16 @@ static STD_RETURN_TYPE_e must_check_return MXM_ParseVoltageReadallTest(MXM_MONIT testBufferLength = 6; if (MXM_ParseVoltageReadall(testBuffer, testBufferLength, &pInstance->localVoltages, MXM_CONVERSION_UNIPOLAR) != STD_OK) { - /* AXIVION Next Line Style FaultDetection-UnusedAssignments: return value collects all negative results. */ + /* AXIVION Next Codeline Style FaultDetection-UnusedAssignments: return value collects all negative results. */ retval = STD_NOT_OK; } else { if (pInstance->localVoltages.cellVoltages_mV[5] != MXM_REF_UNIPOLAR_CELL_mV) { - /* AXIVION Next Line Style FaultDetection-UnusedAssignments: return value collects all negative results. */ + /* AXIVION Next Codeline Style FaultDetection-UnusedAssignments: return value collects all negative results. */ retval = STD_NOT_OK; } } - /* null mxm_local_cellvoltages */ + /* null mxm_local_cellVoltages */ for (uint16_t i_5 = 0; i_5 < (MXM_MAXIMUM_NR_OF_CELLS_PER_MODULE * MXM_MAXIMUM_NR_OF_MODULES); i_5++) { pInstance->localVoltages.cellVoltages_mV[i_5] = 0; } @@ -698,16 +698,16 @@ static STD_RETURN_TYPE_e must_check_return MXM_ParseVoltageReadallTest(MXM_MONIT testBufferLength = 6; if (MXM_ParseVoltageReadall(testBuffer, testBufferLength, &pInstance->localVoltages, MXM_CONVERSION_UNIPOLAR) != STD_OK) { - /* AXIVION Next Line Style FaultDetection-UnusedAssignments: return value collects all negative results. */ + /* AXIVION Next Codeline Style FaultDetection-UnusedAssignments: return value collects all negative results. */ retval = STD_NOT_OK; } else { if (pInstance->localVoltages.cellVoltages_mV[6] != MXM_REF_UNIPOLAR_CELL_mV) { - /* AXIVION Next Line Style FaultDetection-UnusedAssignments: return value collects all negative results. */ + /* AXIVION Next Codeline Style FaultDetection-UnusedAssignments: return value collects all negative results. */ retval = STD_NOT_OK; } } - /* null mxm_local_cellvoltages */ + /* null mxm_local_cellVoltages */ for (uint16_t i_6 = 0; i_6 < (MXM_MAXIMUM_NR_OF_CELLS_PER_MODULE * MXM_MAXIMUM_NR_OF_MODULES); i_6++) { pInstance->localVoltages.cellVoltages_mV[i_6] = 0; } @@ -722,16 +722,16 @@ static STD_RETURN_TYPE_e must_check_return MXM_ParseVoltageReadallTest(MXM_MONIT testBufferLength = 6; if (MXM_ParseVoltageReadall(testBuffer, testBufferLength, &pInstance->localVoltages, MXM_CONVERSION_UNIPOLAR) != STD_OK) { - /* AXIVION Next Line Style FaultDetection-UnusedAssignments: return value collects all negative results. */ + /* AXIVION Next Codeline Style FaultDetection-UnusedAssignments: return value collects all negative results. */ retval = STD_NOT_OK; } else { if (pInstance->localVoltages.cellVoltages_mV[7] != MXM_REF_UNIPOLAR_CELL_mV) { - /* AXIVION Next Line Style FaultDetection-UnusedAssignments: return value collects all negative results. */ + /* AXIVION Next Codeline Style FaultDetection-UnusedAssignments: return value collects all negative results. */ retval = STD_NOT_OK; } } - /* null mxm_local_cellvoltages */ + /* null mxm_local_cellVoltages */ for (uint16_t i_7 = 0; i_7 < (MXM_MAXIMUM_NR_OF_CELLS_PER_MODULE * MXM_MAXIMUM_NR_OF_MODULES); i_7++) { pInstance->localVoltages.cellVoltages_mV[i_7] = 0; } @@ -746,16 +746,16 @@ static STD_RETURN_TYPE_e must_check_return MXM_ParseVoltageReadallTest(MXM_MONIT testBufferLength = 6; if (MXM_ParseVoltageReadall(testBuffer, testBufferLength, &pInstance->localVoltages, MXM_CONVERSION_UNIPOLAR) != STD_OK) { - /* AXIVION Next Line Style FaultDetection-UnusedAssignments: return value collects all negative results. */ + /* AXIVION Next Codeline Style FaultDetection-UnusedAssignments: return value collects all negative results. */ retval = STD_NOT_OK; } else { if (pInstance->localVoltages.cellVoltages_mV[8] != MXM_REF_UNIPOLAR_CELL_mV) { - /* AXIVION Next Line Style FaultDetection-UnusedAssignments: return value collects all negative results. */ + /* AXIVION Next Codeline Style FaultDetection-UnusedAssignments: return value collects all negative results. */ retval = STD_NOT_OK; } } - /* null mxm_local_cellvoltages */ + /* null mxm_local_cellVoltages */ for (uint16_t i_8 = 0; i_8 < (MXM_MAXIMUM_NR_OF_CELLS_PER_MODULE * MXM_MAXIMUM_NR_OF_MODULES); i_8++) { pInstance->localVoltages.cellVoltages_mV[i_8] = 0; } @@ -770,16 +770,16 @@ static STD_RETURN_TYPE_e must_check_return MXM_ParseVoltageReadallTest(MXM_MONIT testBufferLength = 6; if (MXM_ParseVoltageReadall(testBuffer, testBufferLength, &pInstance->localVoltages, MXM_CONVERSION_UNIPOLAR) != STD_OK) { - /* AXIVION Next Line Style FaultDetection-UnusedAssignments: return value collects all negative results. */ + /* AXIVION Next Codeline Style FaultDetection-UnusedAssignments: return value collects all negative results. */ retval = STD_NOT_OK; } else { if (pInstance->localVoltages.cellVoltages_mV[9] != MXM_REF_UNIPOLAR_CELL_mV) { - /* AXIVION Next Line Style FaultDetection-UnusedAssignments: return value collects all negative results. */ + /* AXIVION Next Codeline Style FaultDetection-UnusedAssignments: return value collects all negative results. */ retval = STD_NOT_OK; } } - /* null mxm_local_cellvoltages */ + /* null mxm_local_cellVoltages */ for (uint16_t i_9 = 0; i_9 < (MXM_MAXIMUM_NR_OF_CELLS_PER_MODULE * MXM_MAXIMUM_NR_OF_MODULES); i_9++) { pInstance->localVoltages.cellVoltages_mV[i_9] = 0; } @@ -794,16 +794,16 @@ static STD_RETURN_TYPE_e must_check_return MXM_ParseVoltageReadallTest(MXM_MONIT testBufferLength = 6; if (MXM_ParseVoltageReadall(testBuffer, testBufferLength, &pInstance->localVoltages, MXM_CONVERSION_UNIPOLAR) != STD_OK) { - /* AXIVION Next Line Style FaultDetection-UnusedAssignments: return value collects all negative results. */ + /* AXIVION Next Codeline Style FaultDetection-UnusedAssignments: return value collects all negative results. */ retval = STD_NOT_OK; } else { if (pInstance->localVoltages.cellVoltages_mV[10] != MXM_REF_UNIPOLAR_CELL_mV) { - /* AXIVION Next Line Style FaultDetection-UnusedAssignments: return value collects all negative results. */ + /* AXIVION Next Codeline Style FaultDetection-UnusedAssignments: return value collects all negative results. */ retval = STD_NOT_OK; } } - /* null mxm_local_cellvoltages */ + /* null mxm_local_cellVoltages */ for (uint16_t i_10 = 0; i_10 < (MXM_MAXIMUM_NR_OF_CELLS_PER_MODULE * MXM_MAXIMUM_NR_OF_MODULES); i_10++) { pInstance->localVoltages.cellVoltages_mV[i_10] = 0; } @@ -818,16 +818,16 @@ static STD_RETURN_TYPE_e must_check_return MXM_ParseVoltageReadallTest(MXM_MONIT testBufferLength = 6; if (MXM_ParseVoltageReadall(testBuffer, testBufferLength, &pInstance->localVoltages, MXM_CONVERSION_UNIPOLAR) != STD_OK) { - /* AXIVION Next Line Style FaultDetection-UnusedAssignments: return value collects all negative results. */ + /* AXIVION Next Codeline Style FaultDetection-UnusedAssignments: return value collects all negative results. */ retval = STD_NOT_OK; } else { if (pInstance->localVoltages.cellVoltages_mV[11] != MXM_REF_UNIPOLAR_CELL_mV) { - /* AXIVION Next Line Style FaultDetection-UnusedAssignments: return value collects all negative results. */ + /* AXIVION Next Codeline Style FaultDetection-UnusedAssignments: return value collects all negative results. */ retval = STD_NOT_OK; } } - /* null mxm_local_cellvoltages */ + /* null mxm_local_cellVoltages */ for (uint16_t i_11 = 0; i_11 < (MXM_MAXIMUM_NR_OF_CELLS_PER_MODULE * MXM_MAXIMUM_NR_OF_MODULES); i_11++) { pInstance->localVoltages.cellVoltages_mV[i_11] = 0; } @@ -842,16 +842,16 @@ static STD_RETURN_TYPE_e must_check_return MXM_ParseVoltageReadallTest(MXM_MONIT testBufferLength = 6; if (MXM_ParseVoltageReadall(testBuffer, testBufferLength, &pInstance->localVoltages, MXM_CONVERSION_UNIPOLAR) != STD_OK) { - /* AXIVION Next Line Style FaultDetection-UnusedAssignments: return value collects all negative results. */ + /* AXIVION Next Codeline Style FaultDetection-UnusedAssignments: return value collects all negative results. */ retval = STD_NOT_OK; } else { if (pInstance->localVoltages.cellVoltages_mV[12] != MXM_REF_UNIPOLAR_CELL_mV) { - /* AXIVION Next Line Style FaultDetection-UnusedAssignments: return value collects all negative results. */ + /* AXIVION Next Codeline Style FaultDetection-UnusedAssignments: return value collects all negative results. */ retval = STD_NOT_OK; } } - /* null mxm_local_cellvoltages */ + /* null mxm_local_cellVoltages */ for (uint16_t i_12 = 0; i_12 < (MXM_MAXIMUM_NR_OF_CELLS_PER_MODULE * MXM_MAXIMUM_NR_OF_MODULES); i_12++) { pInstance->localVoltages.cellVoltages_mV[i_12] = 0; } @@ -866,7 +866,7 @@ static STD_RETURN_TYPE_e must_check_return MXM_ParseVoltageReadallTest(MXM_MONIT testBufferLength = 6; if (MXM_ParseVoltageReadall(testBuffer, testBufferLength, &pInstance->localVoltages, MXM_CONVERSION_UNIPOLAR) != STD_OK) { - /* AXIVION Next Line Style FaultDetection-UnusedAssignments: return value collects all negative results. */ + /* AXIVION Next Codeline Style FaultDetection-UnusedAssignments: return value collects all negative results. */ retval = STD_NOT_OK; } else { if (pInstance->localVoltages.cellVoltages_mV[13] != MXM_REF_UNIPOLAR_CELL_mV) { @@ -874,7 +874,7 @@ static STD_RETURN_TYPE_e must_check_return MXM_ParseVoltageReadallTest(MXM_MONIT } } - /* null mxm_local_cellvoltages */ + /* null mxm_local_cellVoltages */ for (uint16_t i_13 = 0; i_13 < (MXM_MAXIMUM_NR_OF_CELLS_PER_MODULE * MXM_MAXIMUM_NR_OF_MODULES); i_13++) { pInstance->localVoltages.cellVoltages_mV[i_13] = 0; } @@ -937,7 +937,7 @@ extern void MXM_HandleStateWriteall( } } -extern bool must_check_return MXM_HandleStateReadall( +extern bool GEN_MUST_CHECK_RETURN MXM_HandleStateReadall( MXM_MONITORING_INSTANCE_s *pInstance, MXM_REG_NAME_e registerName, MXM_STATEMACHINE_OPERATION_STATES_e nextState) { @@ -973,7 +973,7 @@ extern STD_RETURN_TYPE_e MXM_ProcessOpenWire(const MXM_MONITORING_INSTANCE_s *co FAS_ASSERT(kpkInstance->pOpenwire_table != NULL_PTR); const uint8_t numberOfSatellites = MXM_5XGetNumberOfSatellites(kpkInstance->pInstance5X); - f_static_assert( + FAS_STATIC_ASSERT( (((uint16_t)BATTERY_MANAGEMENT_TX_LENGTH_READALL + (2u * MXM_MAXIMUM_NR_OF_MODULES)) <= (uint8_t)UINT8_MAX), "please check assumptions: code cannot handle number of modules"); const uint8_t messageLength = BATTERY_MANAGEMENT_TX_LENGTH_READALL + (2u * numberOfSatellites); @@ -1271,7 +1271,7 @@ extern STD_RETURN_TYPE_e MXM_PreInitSelfCheck(MXM_MONITORING_INSTANCE_s *pState) return retval; } -extern MXM_MONITORING_STATE_e must_check_return +extern MXM_MONITORING_STATE_e GEN_MUST_CHECK_RETURN MXM_MonGetVoltages(MXM_MONITORING_INSTANCE_s *pState, MXM_REG_NAME_e regAddress) { FAS_ASSERT(pState != NULL_PTR); MXM_MONITORING_STATE_e retval = MXM_MONITORING_STATE_PENDING; @@ -1284,7 +1284,7 @@ extern MXM_MONITORING_STATE_e must_check_return MXM_GetDataFrom5XStateMachine(pState); uint8_t temp_len = BATTERY_MANAGEMENT_TX_LENGTH_READALL + (2u * MXM_5XGetNumberOfSatellites(pState->pInstance5X)); - /* AXIVION Next Line Style FaultDetection-UnusedAssignments: default value is set as a safety measure */ + /* AXIVION Next Codeline Style FaultDetection-UnusedAssignments: default value is set as a safety measure */ STD_RETURN_TYPE_e readallReturn = STD_NOT_OK; if (regAddress == MXM_REG_BLOCK) { readallReturn = MXM_ParseVoltageReadall( diff --git a/src/app/driver/afe/maxim/common/mxm_1785x.h b/src/app/driver/afe/maxim/common/mxm_1785x.h index 8fbef739..15a42bc6 100644 --- a/src/app/driver/afe/maxim/common/mxm_1785x.h +++ b/src/app/driver/afe/maxim/common/mxm_1785x.h @@ -43,8 +43,8 @@ * @file mxm_1785x.h * @author foxBMS Team * @date 2019-01-15 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix MXM * @@ -181,7 +181,7 @@ extern void MXM_HandleStateWriteall( * this to execute additional code when the message has been * read. */ -extern bool must_check_return MXM_HandleStateReadall( +extern bool GEN_MUST_CHECK_RETURN MXM_HandleStateReadall( MXM_MONITORING_INSTANCE_s *pInstance, MXM_REG_NAME_e registerName, MXM_STATEMACHINE_OPERATION_STATES_e nextState); @@ -238,7 +238,7 @@ extern void MXM_StateMachineOperation(MXM_MONITORING_INSTANCE_s *pState); * - MXM_MON_STATE_FAIL if the function failed and could * not recover on its own */ -extern MXM_MONITORING_STATE_e must_check_return +extern MXM_MONITORING_STATE_e GEN_MUST_CHECK_RETURN MXM_MonGetVoltages(MXM_MONITORING_INSTANCE_s *pState, MXM_REG_NAME_e regAddress); /** diff --git a/src/app/driver/afe/maxim/common/mxm_1785x_tools.c b/src/app/driver/afe/maxim/common/mxm_1785x_tools.c index d561ffdb..e1932ffd 100644 --- a/src/app/driver/afe/maxim/common/mxm_1785x_tools.c +++ b/src/app/driver/afe/maxim/common/mxm_1785x_tools.c @@ -43,8 +43,8 @@ * @file mxm_1785x_tools.c * @author foxBMS Team * @date 2020-07-15 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix MXM * @@ -93,7 +93,7 @@ static uint8_t MXM_FirstSetBit(uint16_t bitmask) { } /*========== Extern Function Implementations ================================*/ -extern STD_RETURN_TYPE_e must_check_return MXM_FirstSetBitTest(void) { +extern STD_RETURN_TYPE_e GEN_MUST_CHECK_RETURN MXM_FirstSetBitTest(void) { /* AXIVION Disable Style Generic-NoMagicNumbers: This test function uses magic numbers to test predefined values. */ /* bitmasks containing only zeros should return first bit set 16 */ @@ -147,7 +147,7 @@ extern void MXM_Convert( } } -extern STD_RETURN_TYPE_e must_check_return MXM_ConvertTest(void) { +extern STD_RETURN_TYPE_e GEN_MUST_CHECK_RETURN MXM_ConvertTest(void) { /* AXIVION Disable Style Generic-NoMagicNumbers: This test function uses magic numbers to test predefined values. */ MXM_CONVERSION_TYPE_e conversionType = MXM_CONVERSION_UNIPOLAR; @@ -206,7 +206,7 @@ extern void MXM_ExtractValueFromRegister(uint8_t lsb, uint8_t msb, MXM_REG_BM bi } } -extern STD_RETURN_TYPE_e must_check_return MXM_ExtractValueFromRegisterTest(void) { +extern STD_RETURN_TYPE_e GEN_MUST_CHECK_RETURN MXM_ExtractValueFromRegisterTest(void) { /* AXIVION Disable Style Generic-NoMagicNumbers: This test function uses magic numbers to test predefined values. */ uint8_t lsb = 0x31u; uint8_t msb = 0x85u; diff --git a/src/app/driver/afe/maxim/common/mxm_1785x_tools.h b/src/app/driver/afe/maxim/common/mxm_1785x_tools.h index 21393698..f72b965f 100644 --- a/src/app/driver/afe/maxim/common/mxm_1785x_tools.h +++ b/src/app/driver/afe/maxim/common/mxm_1785x_tools.h @@ -43,8 +43,8 @@ * @file mxm_1785x_tools.h * @author foxBMS Team * @date 2020-07-15 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix MXM * @@ -244,7 +244,7 @@ typedef struct { uint8_t muxCounter; /*!< counter for the currently selected mux channel */ uint8_t diagnosticCounter; /*!< upward counter for determining when a diagnostic cycle should be entered */ MXM_DC_BYTE_e dcByte; /*!< content of the data-check-byte */ - uint8_t mxmVoltageCellCounter; /*!< counter for getting all cellvoltages */ + uint8_t mxmVoltageCellCounter; /*!< counter for getting all cell voltages */ uint8_t highest5xDevice; /*!< address of highest monitoring device of the 5x family */ MXM_5X_STATE_REQUEST_STATUS_e requestStatus5x; /*!< status of request to 5x */ MXM_5X_COMMAND_PAYLOAD_s batteryCmdBuffer; /*!< buffer for Battery Management Commands */ @@ -310,7 +310,7 @@ extern void MXM_Convert( * the #MXM_Convert()-function computes the values as expected. * @return #STD_OK on successful execution, otherwise #STD_NOT_OK */ -extern STD_RETURN_TYPE_e must_check_return MXM_ConvertTest(void); +extern STD_RETURN_TYPE_e GEN_MUST_CHECK_RETURN MXM_ConvertTest(void); /** * @brief Extract a value from a single register. @@ -336,14 +336,14 @@ extern void MXM_ExtractValueFromRegister(uint8_t lsb, uint8_t msb, MXM_REG_BM bi * as expected. * @return #STD_OK if the self-check has passed successfully */ -extern STD_RETURN_TYPE_e must_check_return MXM_ExtractValueFromRegisterTest(void); +extern STD_RETURN_TYPE_e GEN_MUST_CHECK_RETURN MXM_ExtractValueFromRegisterTest(void); /** * @brief Test #MXM_FirstSetBit(). * @details Tests the function #MXM_FirstSetBit() if it works as expected. * @return #STD_OK if the self-check has passed successfully */ -extern STD_RETURN_TYPE_e must_check_return MXM_FirstSetBitTest(void); +extern STD_RETURN_TYPE_e GEN_MUST_CHECK_RETURN MXM_FirstSetBitTest(void); /** * @brief convert a unipolar 14bit-value and shifts it into the 16bit-format diff --git a/src/app/driver/afe/maxim/common/mxm_41b_register_map.h b/src/app/driver/afe/maxim/common/mxm_41b_register_map.h index 021ca743..64d00e0c 100644 --- a/src/app/driver/afe/maxim/common/mxm_41b_register_map.h +++ b/src/app/driver/afe/maxim/common/mxm_41b_register_map.h @@ -43,8 +43,8 @@ * @file mxm_41b_register_map.h * @author foxBMS Team * @date 2020-06-25 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix MXM * diff --git a/src/app/driver/afe/maxim/common/mxm_afe_dma.c b/src/app/driver/afe/maxim/common/mxm_afe_dma.c index 8ec89ea3..21f270d2 100644 --- a/src/app/driver/afe/maxim/common/mxm_afe_dma.c +++ b/src/app/driver/afe/maxim/common/mxm_afe_dma.c @@ -43,8 +43,8 @@ * @file mxm_afe_dma.c * @author foxBMS Team * @date 2020-06-16 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix AFE * diff --git a/src/app/driver/afe/maxim/common/mxm_afe_dma.h b/src/app/driver/afe/maxim/common/mxm_afe_dma.h index b3302285..ae7a3c01 100644 --- a/src/app/driver/afe/maxim/common/mxm_afe_dma.h +++ b/src/app/driver/afe/maxim/common/mxm_afe_dma.h @@ -43,8 +43,8 @@ * @file mxm_afe_dma.h * @author foxBMS Team * @date 2020-06-16 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix AFE * diff --git a/src/app/driver/afe/maxim/common/mxm_basic_defines.h b/src/app/driver/afe/maxim/common/mxm_basic_defines.h index de5a8d5e..d466b6f3 100644 --- a/src/app/driver/afe/maxim/common/mxm_basic_defines.h +++ b/src/app/driver/afe/maxim/common/mxm_basic_defines.h @@ -43,8 +43,8 @@ * @file mxm_basic_defines.h * @author foxBMS Team * @date 2020-02-11 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix MXM * diff --git a/src/app/driver/afe/maxim/common/mxm_battery_management.c b/src/app/driver/afe/maxim/common/mxm_battery_management.c index b6def0fb..022f9c8a 100644 --- a/src/app/driver/afe/maxim/common/mxm_battery_management.c +++ b/src/app/driver/afe/maxim/common/mxm_battery_management.c @@ -43,8 +43,8 @@ * @file mxm_battery_management.c * @author foxBMS Team * @date 2019-01-14 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix MXM * @@ -1068,7 +1068,7 @@ void MXM_5XStateMachine(MXM_41B_INSTANCE_s *pInstance41b, MXM_5X_INSTANCE_s *pIn } } -extern STD_RETURN_TYPE_e must_check_return MXM_5XUserAccessibleAddressSpaceCheckerSelfCheck(void) { +extern STD_RETURN_TYPE_e GEN_MUST_CHECK_RETURN MXM_5XUserAccessibleAddressSpaceCheckerSelfCheck(void) { /* check: * - user memory is contained in range 0x00 to 0x98 * - reserved addresses in user address space: diff --git a/src/app/driver/afe/maxim/common/mxm_battery_management.h b/src/app/driver/afe/maxim/common/mxm_battery_management.h index 94ecafcb..9f23c8d2 100644 --- a/src/app/driver/afe/maxim/common/mxm_battery_management.h +++ b/src/app/driver/afe/maxim/common/mxm_battery_management.h @@ -43,8 +43,8 @@ * @file mxm_battery_management.h * @author foxBMS Team * @date 2019-01-14 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix MXM * @@ -375,7 +375,7 @@ extern STD_RETURN_TYPE_e MXM_5XSetStateRequest( * monitoring IC. * @return #STD_OK if the selfcheck has been successful */ -extern STD_RETURN_TYPE_e must_check_return MXM_5XUserAccessibleAddressSpaceCheckerSelfCheck(void); +extern STD_RETURN_TYPE_e GEN_MUST_CHECK_RETURN MXM_5XUserAccessibleAddressSpaceCheckerSelfCheck(void); /** * @brief Initializes the state struct with default values diff --git a/src/app/driver/afe/maxim/common/mxm_bitextract.c b/src/app/driver/afe/maxim/common/mxm_bitextract.c index 68e2793b..7482b9e3 100644 --- a/src/app/driver/afe/maxim/common/mxm_bitextract.c +++ b/src/app/driver/afe/maxim/common/mxm_bitextract.c @@ -43,8 +43,8 @@ * @file mxm_bitextract.c * @author foxBMS Team * @date 2019-01-15 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix MXM * diff --git a/src/app/driver/afe/maxim/common/mxm_bitextract.h b/src/app/driver/afe/maxim/common/mxm_bitextract.h index b56c9201..528a5195 100644 --- a/src/app/driver/afe/maxim/common/mxm_bitextract.h +++ b/src/app/driver/afe/maxim/common/mxm_bitextract.h @@ -43,8 +43,8 @@ * @file mxm_bitextract.h * @author foxBMS Team * @date 2019-01-15 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix MXM * @@ -67,7 +67,7 @@ /** * @brief Bit-values for registers */ -/* AXIVION Disable Style MisraC2012-2.5: Defines are based on datasheet and exist all for completeness. */ +/* AXIVION Disable Style MisraC2012-2.5: Defines are based on data sheet and exist all for completeness. */ typedef uint8_t MXM_41B_REG_BIT_VALUE; /** one bit, 0u */ #define MXM_41B_REG_FALSE ((MXM_41B_REG_BIT_VALUE)0x00u) diff --git a/src/app/driver/afe/maxim/common/mxm_crc8.c b/src/app/driver/afe/maxim/common/mxm_crc8.c index 8470d17d..8e69307a 100644 --- a/src/app/driver/afe/maxim/common/mxm_crc8.c +++ b/src/app/driver/afe/maxim/common/mxm_crc8.c @@ -43,8 +43,8 @@ * @file mxm_crc8.c * @author foxBMS Team * @date 2019-02-05 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix MXM * @@ -137,7 +137,7 @@ extern uint8_t MXM_CRC8(uint16_t *pData, int32_t lenData) { return MXM_CRC8WithInitValue(pData, lenData, 0); } -extern STD_RETURN_TYPE_e must_check_return MXM_CRC8SelfTest(void) { +extern STD_RETURN_TYPE_e GEN_MUST_CHECK_RETURN MXM_CRC8SelfTest(void) { /* AXIVION Disable Style Generic-NoMagicNumbers: This test function uses magic numbers to test predefined values. */ uint16_t testSequence1[4] = {0x02u, 0x12u, 0xB1u, 0xB2u}; const uint8_t sequence1Result = MXM_CRC8(testSequence1, 4); diff --git a/src/app/driver/afe/maxim/common/mxm_crc8.h b/src/app/driver/afe/maxim/common/mxm_crc8.h index 4a18df15..4ccfe2cd 100644 --- a/src/app/driver/afe/maxim/common/mxm_crc8.h +++ b/src/app/driver/afe/maxim/common/mxm_crc8.h @@ -43,8 +43,8 @@ * @file mxm_crc8.h * @author foxBMS Team * @date 2019-02-05 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix MXM * @@ -88,7 +88,7 @@ extern uint8_t MXM_CRC8(uint16_t *pData, int32_t lenData); * asserts that the implementation matches the required algorithm. * @return #STD_OK if the selfcheck is successful and #STD_NOT_OK otherwise */ -extern STD_RETURN_TYPE_e must_check_return MXM_CRC8SelfTest(void); +extern STD_RETURN_TYPE_e GEN_MUST_CHECK_RETURN MXM_CRC8SelfTest(void); /*========== Externalized Static Functions Prototypes (Unit Test) ===========*/ diff --git a/src/app/driver/afe/maxim/common/mxm_register_map.h b/src/app/driver/afe/maxim/common/mxm_register_map.h index 89ff9244..e9e02e1f 100644 --- a/src/app/driver/afe/maxim/common/mxm_register_map.h +++ b/src/app/driver/afe/maxim/common/mxm_register_map.h @@ -43,8 +43,8 @@ * @file mxm_register_map.h * @author foxBMS Team * @date 2019-03-05 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix MXM * diff --git a/src/app/driver/afe/maxim/common/mxm_registry.c b/src/app/driver/afe/maxim/common/mxm_registry.c index f521a33c..f53b005e 100644 --- a/src/app/driver/afe/maxim/common/mxm_registry.c +++ b/src/app/driver/afe/maxim/common/mxm_registry.c @@ -43,8 +43,8 @@ * @file mxm_registry.c * @author foxBMS Team * @date 2020-07-16 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix MXM * @@ -111,7 +111,7 @@ extern STD_RETURN_TYPE_e MXM_MonRegistryConnectDevices(MXM_MONITORING_INSTANCE_s return retval; } -/* AXIVION Next Line Style MisraC2012-8.7: this function is API of the registry and should therefore be extern */ +/* AXIVION Next Codeline Style MisraC2012-8.7: this function is API of the registry and should therefore be extern */ extern uint8_t MXM_MonRegistryGetHighestConnected5XDevice(const MXM_MONITORING_INSTANCE_s *const kpkState) { FAS_ASSERT(kpkState != NULL_PTR); /* return highest connected device */ @@ -173,7 +173,7 @@ extern void MXM_MonRegistryParseVersionIntoDevices(MXM_MONITORING_INSTANCE_s *pS (model != (uint16_t)MXM_MODEL_ID_MAX17854)) { currentDevice->model = MXM_MODEL_ID_invalid; } else { - /* AXIVION Next Line Style MisraC2012-10.5: All invalid values have been cleared. */ + /* AXIVION Next Codeline Style MisraC2012-10.5: All invalid values have been cleared. */ currentDevice->model = (MXM_MODEL_ID_e)model; } @@ -183,7 +183,7 @@ extern void MXM_MonRegistryParseVersionIntoDevices(MXM_MONITORING_INSTANCE_s *pS if (version >= (uint16_t)MXM_SILICON_VERSION_INVALID) { currentDevice->siliconVersion = MXM_SILICON_VERSION_INVALID; } else { - /* AXIVION Next Line Style MisraC2012-10.5: All invalid values have been cleared. */ + /* AXIVION Next Codeline Style MisraC2012-10.5: All invalid values have been cleared. */ currentDevice->siliconVersion = (MXM_SILICON_VERSION_e)version; } } diff --git a/src/app/driver/afe/maxim/common/mxm_registry.h b/src/app/driver/afe/maxim/common/mxm_registry.h index 2df6bffd..3057b2c4 100644 --- a/src/app/driver/afe/maxim/common/mxm_registry.h +++ b/src/app/driver/afe/maxim/common/mxm_registry.h @@ -43,8 +43,8 @@ * @file mxm_registry.h * @author foxBMS Team * @date 2020-07-16 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix MXM * diff --git a/src/app/driver/afe/maxim/max17852/mxm_17852.c b/src/app/driver/afe/maxim/max17852/mxm_17852.c index ea3ce144..a736975f 100644 --- a/src/app/driver/afe/maxim/max17852/mxm_17852.c +++ b/src/app/driver/afe/maxim/max17852/mxm_17852.c @@ -43,8 +43,8 @@ * @file mxm_17852.c * @author foxBMS Team * @date 2021-11-24 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix MXM * @@ -253,7 +253,7 @@ extern void MXM_StateMachineOperation(MXM_MONITORING_INSTANCE_s *pState) { if (pState->mxmVoltageCellCounter < (uint8_t)UINT8_MAX) { pState->mxmVoltageCellCounter++; } - f_static_assert( + FAS_STATIC_ASSERT( MXM_VOLTAGE_READ_ARRAY_LENGTH <= (uint8_t)UINT8_MAX, "invalid define MXM_VOLTAGE_READ_ARRAY_LENGTH"); /* modified: read one additional aux entry */ diff --git a/src/app/driver/afe/maxim/max17852/wscript b/src/app/driver/afe/maxim/max17852/wscript index 9894274f..071a57a2 100644 --- a/src/app/driver/afe/maxim/max17852/wscript +++ b/src/app/driver/afe/maxim/max17852/wscript @@ -79,7 +79,7 @@ def build(bld): os.path.join("..", "..", "..", "..", "engine", "diag"), os.path.join("..", "..", "..", "..", "task", "os"), ] - includes.extend(bld.env.INCLUDES_OPERATING_SYSTEM) + includes.extend(bld.env.INCLUDES_RTOS) cflags = bld.env.CFLAGS_FOXBMS target = f"{bld.env.APPNAME.lower()}-afe-driver" bld.objects( diff --git a/src/app/driver/afe/maxim/wscript b/src/app/driver/afe/maxim/wscript index bb566d74..dbe11e47 100644 --- a/src/app/driver/afe/maxim/wscript +++ b/src/app/driver/afe/maxim/wscript @@ -45,4 +45,4 @@ Helper script to recursively build the embedded sources""" def build(bld): """selects the driver library to be build""" - bld.recurse(bld.env.afe_chip) + bld.recurse(bld.env.afe_ic) diff --git a/src/app/driver/afe/nxp/api/README.md b/src/app/driver/afe/nxp/api/README.md deleted file mode 100644 index 9310a75f..00000000 --- a/src/app/driver/afe/nxp/api/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# NXP API - -This is a dummy file in order to add the directory to git. This README.md can -be deleted as soon as NXP API headers are committed in this directory deleted. diff --git a/src/app/driver/afe/nxp/common/api/nxp_afe.c b/src/app/driver/afe/nxp/api/nxp_afe.c similarity index 78% rename from src/app/driver/afe/nxp/common/api/nxp_afe.c rename to src/app/driver/afe/nxp/api/nxp_afe.c index 90f891ee..6aaea2ad 100644 --- a/src/app/driver/afe/nxp/common/api/nxp_afe.c +++ b/src/app/driver/afe/nxp/api/nxp_afe.c @@ -43,12 +43,12 @@ * @file nxp_afe.c * @author foxBMS Team * @date 2020-05-25 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVER * @prefix AFE * - * @brief AFE driver implementation for NXP ICs + * @brief Measurement IC driver wrapper layer for NXP ICs */ /*========== Includes =======================================================*/ @@ -56,9 +56,9 @@ /* clang-format off */ #include "afe.h" /* clang-format on */ -#include "afe_dma.h" -#include "dma.h" -#include "n775.h" +#include "battery_system_cfg.h" + +#include "nxp_afe.h" /*========== Macros and Definitions =========================================*/ @@ -71,69 +71,56 @@ /*========== Static Function Implementations ================================*/ /*========== Extern Function Implementations ================================*/ + extern STD_RETURN_TYPE_e AFE_TriggerIc(void) { - N775_Trigger(); - return STD_OK; + return NXP_Measure(); } extern STD_RETURN_TYPE_e AFE_Initialize(void) { - return STD_OK; -} - -extern STD_RETURN_TYPE_e AFE_StartMeasurement(void) { - STD_RETURN_TYPE_e retval = STD_NOT_OK; - - if (N775_SetStateRequest(N775_STATE_INIT_REQUEST) == N775_OK) { - retval = STD_OK; - } - - return retval; + return NXP_Initialize(); } -extern bool AFE_IsFirstMeasurementCycleFinished(void) { - return N775_IsFirstMeasurementCycleFinished(); -} - -extern STD_RETURN_TYPE_e AFE_RequestIoWrite(uint8_t string) { - STD_RETURN_TYPE_e retval = STD_NOT_OK; - - return (retval); +extern STD_RETURN_TYPE_e AFE_RequestEepromRead(uint8_t string) { + FAS_ASSERT(string < BS_NR_OF_STRINGS); + return NXP_RequestEepromRead(string); } -extern STD_RETURN_TYPE_e AFE_RequestIoRead(uint8_t string) { - STD_RETURN_TYPE_e retval = STD_NOT_OK; - - return (retval); +extern STD_RETURN_TYPE_e AFE_RequestEepromWrite(uint8_t string) { + FAS_ASSERT(string < BS_NR_OF_STRINGS); + return NXP_RequestEepromWrite(string); } extern STD_RETURN_TYPE_e AFE_RequestTemperatureRead(uint8_t string) { - STD_RETURN_TYPE_e retval = STD_NOT_OK; - - return (retval); + FAS_ASSERT(string < BS_NR_OF_STRINGS); + return NXP_RequestTemperatureRead(string); } extern STD_RETURN_TYPE_e AFE_RequestBalancingFeedbackRead(uint8_t string) { - STD_RETURN_TYPE_e retval = STD_NOT_OK; - - return (retval); + FAS_ASSERT(string < BS_NR_OF_STRINGS); + return NXP_RequestBalancingFeedbackRead(string); } -extern STD_RETURN_TYPE_e AFE_RequestEepromRead(uint8_t string) { - STD_RETURN_TYPE_e retval = STD_NOT_OK; - - return (retval); +extern STD_RETURN_TYPE_e AFE_RequestOpenWireCheck(uint8_t string) { + FAS_ASSERT(string < BS_NR_OF_STRINGS); + return NXP_RequestOpenWireCheck(string); } -extern STD_RETURN_TYPE_e AFE_RequestEepromWrite(uint8_t string) { - STD_RETURN_TYPE_e retVal = STD_NOT_OK; +extern STD_RETURN_TYPE_e AFE_StartMeasurement(void) { + return NXP_StartMeasurement(); +} - return (retVal); +extern bool AFE_IsFirstMeasurementCycleFinished(void) { + return NXP_IsFirstMeasurementCycleFinished(); } -extern STD_RETURN_TYPE_e AFE_RequestOpenWireCheck(uint8_t string) { - STD_RETURN_TYPE_e retVal = STD_NOT_OK; +extern STD_RETURN_TYPE_e AFE_RequestIoRead(uint8_t string) { + FAS_ASSERT(string < BS_NR_OF_STRINGS); + return NXP_RequestIoRead(string); +} - return (retVal); +STD_RETURN_TYPE_e AFE_RequestIoWrite(uint8_t string) { + FAS_ASSERT(string < BS_NR_OF_STRINGS); + return NXP_RequestIoWrite(string); } /*========== Externalized Static Function Implementations (Unit Test) =======*/ diff --git a/src/app/driver/afe/nxp/api/nxp_afe.h b/src/app/driver/afe/nxp/api/nxp_afe.h new file mode 100644 index 00000000..06960c05 --- /dev/null +++ b/src/app/driver/afe/nxp/api/nxp_afe.h @@ -0,0 +1,83 @@ +/** + * + * @copyright © 2010 - 2022, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. + * All rights reserved. + * + * 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®″ + * + */ + +/** + * @file nxp_afe.h + * @author foxBMS Team + * @date 2021-06-04 (date of creation) + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 + * @ingroup DRIVER + * @prefix NXP + * + * @brief Measurement IC driver wrapper layer for NXP ICs + */ + +#ifndef FOXBMS__NXP_AFE_H_ +#define FOXBMS__NXP_AFE_H_ + +/*========== Includes =======================================================*/ +#include "general.h" +/* clang-format off */ +#include "afe.h" +/* clang-format on */ + +/*========== Macros and Definitions =========================================*/ + +/*========== Extern Constant and Variable Declarations ======================*/ + +/*========== Extern Function Prototypes =====================================*/ + +extern STD_RETURN_TYPE_e NXP_Measure(void); +extern STD_RETURN_TYPE_e NXP_Initialize(void); +extern STD_RETURN_TYPE_e NXP_RequestEepromRead(uint8_t string); +extern STD_RETURN_TYPE_e NXP_RequestEepromWrite(uint8_t string); +extern STD_RETURN_TYPE_e NXP_RequestTemperatureRead(uint8_t string); +extern STD_RETURN_TYPE_e NXP_RequestBalancingFeedbackRead(uint8_t string); +extern STD_RETURN_TYPE_e NXP_RequestOpenWireCheck(uint8_t string); +extern STD_RETURN_TYPE_e NXP_StartMeasurement(void); +extern bool NXP_IsFirstMeasurementCycleFinished(void); +extern STD_RETURN_TYPE_e NXP_RequestIoRead(uint8_t string); +STD_RETURN_TYPE_e NXP_RequestIoWrite(uint8_t string); + +/*========== Externalized Static Functions Prototypes (Unit Test) ===========*/ + +#endif /* FOXBMS__NXP_AFE_H_ */ diff --git a/src/app/driver/afe/nxp/common/MC33775A.h b/src/app/driver/afe/nxp/common/MC33775A.h deleted file mode 100644 index dfe6242c..00000000 --- a/src/app/driver/afe/nxp/common/MC33775A.h +++ /dev/null @@ -1,11962 +0,0 @@ -/* Copyright 2019 NXP. NXP Confidential. This software is owned or controlled by NXP and may only be -* used strictly in accordance with the applicable license terms found at -* https://www.nxp.com/LA_OPT_NXP_SW. Only the "internal use license" in Section 2.2 in the NXP SOFTWARE -* LICENSE AGREEMENT is granted for this software. -*/ - -/* -------------------------------------------------------------------------- - * Generated by com.nxp.ipxact.generators.vsw.VswComponentRegisterGenerator version 2019.03 - * Magillem Design Services S.A. Magillem Generator Studio. - * Input -remapStates was set to null - * Input -namespace was set to mc33775 - * Input -includeComponentName was set to false - * Input -includeMemoryMapName was set to false - * Input -includeMemoryRemapName was set to false - * Input -includeAddressBlockName was set to false - * Input -includeRegisterFileName was set to false - * Input -increasingBitfieldOffset was set to true - * Input -includeRegisterStructs was set to true - * Input -includeFileStdIntTypes was set to - * Input -includeFilters was set to [PUBLIC] - * Input -excludeFilters was set to null - * -------------------------------------------------------------------------- */ - -#ifndef MC33775MCU_IF_REG_H -#define MC33775MCU_IF_REG_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -/* Overall register macros */ -#define MC33775_MCU_IF_NR_OF_REGISTERS (215U) -#define MC33775_MCU_IF_MAX_OFFSET (0x101DU) - -/* -------------------------------------------------------------------------- - * ALLM_CFG (write-only):General measurement control. - * -------------------------------------------------------------------------- */ -#define MC33775_ALLM_CFG_OFFSET (0x1400U) -#define MC33775_ALLM_CFG_RW_MSK (0x0U) -#define MC33775_ALLM_CFG_RD_MSK (0x0U) -#define MC33775_ALLM_CFG_WR_MSK (0xFFFFU) -#define MC33775_ALLM_CFG_MW_MSK (0x0U) -#define MC33775_ALLM_CFG_RA_MSK (0x0U) -#define MC33775_ALLM_CFG_POR_MSK (0xffffU) -#define MC33775_ALLM_CFG_POR_VAL (0x0U) - -/* Field MEASEN: Writes MEASEN for primary and secondary measurement. */ -#define MC33775_ALLM_CFG_MEASEN_POS (0U) -#define MC33775_ALLM_CFG_MEASEN_MSK (0x1U) - -/* Field BALPAUSECYCMODEN: Writes BALPAUSECYCMODEN for primary and secondary measurement. */ -#define MC33775_ALLM_CFG_BALPAUSECYCMODEN_POS (1U) -#define MC33775_ALLM_CFG_BALPAUSECYCMODEN_MSK (0x2U) - -/* Field BALPAUSELEN: Writes BALPAUSELEN for primary and secondary measurement. */ -#define MC33775_ALLM_CFG_BALPAUSELEN_POS (2U) -#define MC33775_ALLM_CFG_BALPAUSELEN_MSK (0xFFFCU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t MEASEN : 1; - volatile uint16_t BALPAUSECYCMODEN : 1; - volatile uint16_t BALPAUSELEN : 14; - } B; -} mc33775_all_measurement_registers_allm_cfg_t; - -/* -------------------------------------------------------------------------- - * ALLM_APP_CTRL (write-only):Application measurement control. - * -------------------------------------------------------------------------- */ -#define MC33775_ALLM_APP_CTRL_OFFSET (0x1401U) -#define MC33775_ALLM_APP_CTRL_RW_MSK (0x0U) -#define MC33775_ALLM_APP_CTRL_RD_MSK (0x0U) -#define MC33775_ALLM_APP_CTRL_WR_MSK (0xFFFFU) -#define MC33775_ALLM_APP_CTRL_MW_MSK (0x0U) -#define MC33775_ALLM_APP_CTRL_RA_MSK (0x0U) -#define MC33775_ALLM_APP_CTRL_POR_MSK (0xffffU) -#define MC33775_ALLM_APP_CTRL_POR_VAL (0x7c00U) - -/* Field CAPVC: Writes CAPVC for primary measurement. No influence on secondary measurement as long as it is used without the PAUSEBAL bit. */ -#define MC33775_ALLM_APP_CTRL_CAPVC_POS (0U) -#define MC33775_ALLM_APP_CTRL_CAPVC_MSK (0x1U) - -/* Field CAPVMODULE: Writes CAPVMODULE for primary measurement. No influence on secondary measurement as long as it is used without the PAUSEBAL bit. */ -#define MC33775_ALLM_APP_CTRL_CAPVMODULE_POS (1U) -#define MC33775_ALLM_APP_CTRL_CAPVMODULE_MSK (0x2U) - -/* Field CAPAIN0: Writes CAPAIN0 for primary measurement. No influence on secondary measurement as long as it is used without the PAUSEBAL bit. */ -#define MC33775_ALLM_APP_CTRL_CAPAIN0_POS (2U) -#define MC33775_ALLM_APP_CTRL_CAPAIN0_MSK (0x4U) - -/* Field CAPAIN1: Writes CAPAIN1 for primary measurement. No influence on secondary measurement as long as it is used without the PAUSEBAL bit. */ -#define MC33775_ALLM_APP_CTRL_CAPAIN1_POS (3U) -#define MC33775_ALLM_APP_CTRL_CAPAIN1_MSK (0x8U) - -/* Field CAPAIN2: Writes CAPAIN2 for primary measurement. No influence on secondary measurement as long as it is used without the PAUSEBAL bit. */ -#define MC33775_ALLM_APP_CTRL_CAPAIN2_POS (4U) -#define MC33775_ALLM_APP_CTRL_CAPAIN2_MSK (0x10U) - -/* Field CAPAIN3: Writes CAPAIN3 for primary measurement. No influence on secondary measurement as long as it is used without the PAUSEBAL bit. */ -#define MC33775_ALLM_APP_CTRL_CAPAIN3_POS (5U) -#define MC33775_ALLM_APP_CTRL_CAPAIN3_MSK (0x20U) - -/* Field CAPAIN4: No influence on primary measurement as long as it is used without the PAUSEBAL bit. Writes CAPAIN4 for secondary measurement. */ -#define MC33775_ALLM_APP_CTRL_CAPAIN4_POS (6U) -#define MC33775_ALLM_APP_CTRL_CAPAIN4_MSK (0x40U) - -/* Field CAPAIN5: No influence on primary measurement as long as it is used without the PAUSEBAL bit. Writes CAPAIN5 for secondary measurement. */ -#define MC33775_ALLM_APP_CTRL_CAPAIN5_POS (7U) -#define MC33775_ALLM_APP_CTRL_CAPAIN5_MSK (0x80U) - -/* Field CAPAIN6: No influence on primary measurement as long as it is used without the PAUSEBAL bit. Writes CAPAIN6 for secondary measurement. */ -#define MC33775_ALLM_APP_CTRL_CAPAIN6_POS (8U) -#define MC33775_ALLM_APP_CTRL_CAPAIN6_MSK (0x100U) - -/* Field CAPAIN7: No influence on primary measurement as long as it is used without the PAUSEBAL bit. Writes CAPAIN7 for secondary measurement. */ -#define MC33775_ALLM_APP_CTRL_CAPAIN7_POS (9U) -#define MC33775_ALLM_APP_CTRL_CAPAIN7_MSK (0x200U) - -/* Field VCOLNUM: Writes VCOLNUM for primary measurement, if CAPVC is set. No influence on secondary measurement. */ -#define MC33775_ALLM_APP_CTRL_VCOLNUM_POS (10U) -#define MC33775_ALLM_APP_CTRL_VCOLNUM_MSK (0x7C00U) - -/* Field PAUSEBAL: Writes PAUSEBAL for primary and secondary measurement. */ -#define MC33775_ALLM_APP_CTRL_PAUSEBAL_POS (15U) -#define MC33775_ALLM_APP_CTRL_PAUSEBAL_MSK (0x8000U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t CAPVC : 1; - volatile uint16_t CAPVMODULE : 1; - volatile uint16_t CAPAIN0 : 1; - volatile uint16_t CAPAIN1 : 1; - volatile uint16_t CAPAIN2 : 1; - volatile uint16_t CAPAIN3 : 1; - volatile uint16_t CAPAIN4 : 1; - volatile uint16_t CAPAIN5 : 1; - volatile uint16_t CAPAIN6 : 1; - volatile uint16_t CAPAIN7 : 1; - volatile uint16_t VCOLNUM : 5; - volatile uint16_t PAUSEBAL : 1; - } B; -} mc33775_all_measurement_registers_allm_app_ctrl_t; - -/* -------------------------------------------------------------------------- - * ALLM_PER_CTRL (write-only):Periodic measurement control. - * -------------------------------------------------------------------------- */ -#define MC33775_ALLM_PER_CTRL_OFFSET (0x1402U) -#define MC33775_ALLM_PER_CTRL_RW_MSK (0x0U) -#define MC33775_ALLM_PER_CTRL_RD_MSK (0x0U) -#define MC33775_ALLM_PER_CTRL_WR_MSK (0x31FFU) -#define MC33775_ALLM_PER_CTRL_MW_MSK (0x0U) -#define MC33775_ALLM_PER_CTRL_RA_MSK (0x0U) -#define MC33775_ALLM_PER_CTRL_POR_MSK (0xffffU) -#define MC33775_ALLM_PER_CTRL_POR_VAL (0x10U) - -/* Field PERLEN: Writes PERLEN for primary and secondary measurement. */ -#define MC33775_ALLM_PER_CTRL_PERLEN_POS (0U) -#define MC33775_ALLM_PER_CTRL_PERLEN_MSK (0x1FFU) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_ALLM_PER_CTRL_RESERVED0_POS (9U) -#define MC33775_ALLM_PER_CTRL_RESERVED0_MSK (0xE00U) - -/* Field PERCTRL: Writes PERCTRL for primary and secondary measurement. */ -#define MC33775_ALLM_PER_CTRL_PERCTRL_POS (12U) -#define MC33775_ALLM_PER_CTRL_PERCTRL_MSK (0x3000U) - -/* Field reserved1: This read-only field is reserved and always has the value 0. */ -#define MC33775_ALLM_PER_CTRL_RESERVED1_POS (14U) -#define MC33775_ALLM_PER_CTRL_RESERVED1_MSK (0xC000U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t PERLEN : 9; - volatile uint16_t reserved0 : 3; - volatile uint16_t PERCTRL : 2; - volatile uint16_t reserved1 : 2; - } B; -} mc33775_all_measurement_registers_allm_per_ctrl_t; - -/* -------------------------------------------------------------------------- - * ALLM_SYNC_CTRL (write-only):Synchronous measurement control. - * -------------------------------------------------------------------------- */ -#define MC33775_ALLM_SYNC_CTRL_OFFSET (0x1403U) -#define MC33775_ALLM_SYNC_CTRL_RW_MSK (0x0U) -#define MC33775_ALLM_SYNC_CTRL_RD_MSK (0x0U) -#define MC33775_ALLM_SYNC_CTRL_WR_MSK (0xFC03U) -#define MC33775_ALLM_SYNC_CTRL_MW_MSK (0x0U) -#define MC33775_ALLM_SYNC_CTRL_RA_MSK (0x0U) -#define MC33775_ALLM_SYNC_CTRL_POR_MSK (0xffffU) -#define MC33775_ALLM_SYNC_CTRL_POR_VAL (0x7c00U) - -/* Field SYNCCYC: Writes SYNCCYC for primary and secondary measurement. */ -#define MC33775_ALLM_SYNC_CTRL_SYNCCYC_POS (0U) -#define MC33775_ALLM_SYNC_CTRL_SYNCCYC_MSK (0x1U) - -/* Field FASTVB: Dummy fast measurement cycle on primary measurement. Writes FASTVB for secondary measurement. */ -#define MC33775_ALLM_SYNC_CTRL_FASTVB_POS (1U) -#define MC33775_ALLM_SYNC_CTRL_FASTVB_MSK (0x2U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_ALLM_SYNC_CTRL_RESERVED0_POS (2U) -#define MC33775_ALLM_SYNC_CTRL_RESERVED0_MSK (0x3FCU) - -/* Field VBOLNUM: No influence on primary measurement. Writes VBOLNUM for secondary measurement. */ -#define MC33775_ALLM_SYNC_CTRL_VBOLNUM_POS (10U) -#define MC33775_ALLM_SYNC_CTRL_VBOLNUM_MSK (0x7C00U) - -/* Field PAUSEBAL: Writes PAUSEBAL for primary and secondary measurement. */ -#define MC33775_ALLM_SYNC_CTRL_PAUSEBAL_POS (15U) -#define MC33775_ALLM_SYNC_CTRL_PAUSEBAL_MSK (0x8000U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t SYNCCYC : 1; - volatile uint16_t FASTVB : 1; - volatile uint16_t reserved0 : 8; - volatile uint16_t VBOLNUM : 5; - volatile uint16_t PAUSEBAL : 1; - } B; -} mc33775_all_measurement_registers_allm_sync_ctrl_t; - -/* -------------------------------------------------------------------------- - * ALLM_VCVB_CFG (write-only):Cell voltage measurement enable. - * -------------------------------------------------------------------------- */ -#define MC33775_ALLM_VCVB_CFG_OFFSET (0x1408U) -#define MC33775_ALLM_VCVB_CFG_RW_MSK (0x0U) -#define MC33775_ALLM_VCVB_CFG_RD_MSK (0x0U) -#define MC33775_ALLM_VCVB_CFG_WR_MSK (0x3FFFU) -#define MC33775_ALLM_VCVB_CFG_MW_MSK (0x0U) -#define MC33775_ALLM_VCVB_CFG_RA_MSK (0x0U) -#define MC33775_ALLM_VCVB_CFG_POR_MSK (0xffffU) -#define MC33775_ALLM_VCVB_CFG_POR_VAL (0x0U) - -/* Field VCVB0EN: Writes VC0EN for primary and VCVB0EN secondary measurement. */ -#define MC33775_ALLM_VCVB_CFG_VCVB0EN_POS (0U) -#define MC33775_ALLM_VCVB_CFG_VCVB0EN_MSK (0x1U) - -/* Field VCVB1EN: Writes VC1EN for primary and VCVB1EN secondary measurement. */ -#define MC33775_ALLM_VCVB_CFG_VCVB1EN_POS (1U) -#define MC33775_ALLM_VCVB_CFG_VCVB1EN_MSK (0x2U) - -/* Field VCVB2EN: Writes VC2EN for primary and VCVB2EN secondary measurement. */ -#define MC33775_ALLM_VCVB_CFG_VCVB2EN_POS (2U) -#define MC33775_ALLM_VCVB_CFG_VCVB2EN_MSK (0x4U) - -/* Field VCVB3EN: Writes VC3EN for primary and VCVB3EN secondary measurement. */ -#define MC33775_ALLM_VCVB_CFG_VCVB3EN_POS (3U) -#define MC33775_ALLM_VCVB_CFG_VCVB3EN_MSK (0x8U) - -/* Field VCVB4EN: Writes VC4EN for primary and VCVB4EN secondary measurement. */ -#define MC33775_ALLM_VCVB_CFG_VCVB4EN_POS (4U) -#define MC33775_ALLM_VCVB_CFG_VCVB4EN_MSK (0x10U) - -/* Field VCVB5EN: Writes VC5EN for primary and VCVB5EN secondary measurement. */ -#define MC33775_ALLM_VCVB_CFG_VCVB5EN_POS (5U) -#define MC33775_ALLM_VCVB_CFG_VCVB5EN_MSK (0x20U) - -/* Field VCVB6EN: Writes VC6EN for primary and VCVB6EN secondary measurement. */ -#define MC33775_ALLM_VCVB_CFG_VCVB6EN_POS (6U) -#define MC33775_ALLM_VCVB_CFG_VCVB6EN_MSK (0x40U) - -/* Field VCVB7EN: Writes VC7EN for primary and VCVB7EN secondary measurement. */ -#define MC33775_ALLM_VCVB_CFG_VCVB7EN_POS (7U) -#define MC33775_ALLM_VCVB_CFG_VCVB7EN_MSK (0x80U) - -/* Field VCVB8EN: Writes VC8EN for primary and VCVB8EN secondary measurement. */ -#define MC33775_ALLM_VCVB_CFG_VCVB8EN_POS (8U) -#define MC33775_ALLM_VCVB_CFG_VCVB8EN_MSK (0x100U) - -/* Field VCVB9EN: Writes VC9EN for primary and VCVB9EN secondary measurement. */ -#define MC33775_ALLM_VCVB_CFG_VCVB9EN_POS (9U) -#define MC33775_ALLM_VCVB_CFG_VCVB9EN_MSK (0x200U) - -/* Field VCVB10EN: Writes VC10EN for primary and VCVB10EN secondary measurement. */ -#define MC33775_ALLM_VCVB_CFG_VCVB10EN_POS (10U) -#define MC33775_ALLM_VCVB_CFG_VCVB10EN_MSK (0x400U) - -/* Field VCVB11EN: Writes VC11EN for primary and VCVB11EN secondary measurement. */ -#define MC33775_ALLM_VCVB_CFG_VCVB11EN_POS (11U) -#define MC33775_ALLM_VCVB_CFG_VCVB11EN_MSK (0x800U) - -/* Field VCVB12EN: Writes VC12EN for primary and VCVB12EN secondary measurement. */ -#define MC33775_ALLM_VCVB_CFG_VCVB12EN_POS (12U) -#define MC33775_ALLM_VCVB_CFG_VCVB12EN_MSK (0x1000U) - -/* Field VCVB13EN: Writes VC13EN for primary and VCVB13EN secondary measurement. */ -#define MC33775_ALLM_VCVB_CFG_VCVB13EN_POS (13U) -#define MC33775_ALLM_VCVB_CFG_VCVB13EN_MSK (0x2000U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_ALLM_VCVB_CFG_RESERVED0_POS (14U) -#define MC33775_ALLM_VCVB_CFG_RESERVED0_MSK (0xC000U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VCVB0EN : 1; - volatile uint16_t VCVB1EN : 1; - volatile uint16_t VCVB2EN : 1; - volatile uint16_t VCVB3EN : 1; - volatile uint16_t VCVB4EN : 1; - volatile uint16_t VCVB5EN : 1; - volatile uint16_t VCVB6EN : 1; - volatile uint16_t VCVB7EN : 1; - volatile uint16_t VCVB8EN : 1; - volatile uint16_t VCVB9EN : 1; - volatile uint16_t VCVB10EN : 1; - volatile uint16_t VCVB11EN : 1; - volatile uint16_t VCVB12EN : 1; - volatile uint16_t VCVB13EN : 1; - volatile uint16_t reserved0 : 2; - } B; -} mc33775_all_measurement_registers_allm_vcvb_cfg_t; - -/* -------------------------------------------------------------------------- - * SYS_CFG_CRC (read-only):System Configuration CRC - * -------------------------------------------------------------------------- */ -#define MC33775_SYS_CFG_CRC_OFFSET (0x0U) -#define MC33775_SYS_CFG_CRC_RW_MSK (0x0U) -#define MC33775_SYS_CFG_CRC_RD_MSK (0xFFFFU) -#define MC33775_SYS_CFG_CRC_WR_MSK (0x0U) -#define MC33775_SYS_CFG_CRC_MW_MSK (0x0U) -#define MC33775_SYS_CFG_CRC_RA_MSK (0x0U) -#define MC33775_SYS_CFG_CRC_POR_MSK (0xffffU) -#define MC33775_SYS_CFG_CRC_POR_VAL (0x0U) - -/* Field CRC: This CRC value is recalculated with any write to a covered register and with any read to this register. The updated CRC value is available latest 100us after the last write. The CRC value is application specific and must be re-calculated by the MCU. The used polynomial is: 0xD175 (+1) = X^16 + X^15 + X^13 + X^9 + X^7 + X^6 + X^5 + X^3 + X^1 + 1. -Following registers are included: SYS_COM_CFG, SYS_COM_TO_CFG, SYS_SUPPLY_CFG, SYS_CYC_WAKEUP_CFG, SYS_TPL_CFG. */ -#define MC33775_SYS_CFG_CRC_CRC_POS (0U) -#define MC33775_SYS_CFG_CRC_CRC_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t CRC : 16; - } B; -} mc33775_system_control_registers_sys_cfg_crc_t; - -/* -------------------------------------------------------------------------- - * SYS_COM_CFG (read-write):Communication initialization. - * -------------------------------------------------------------------------- */ -#define MC33775_SYS_COM_CFG_OFFSET (0x1U) -#define MC33775_SYS_COM_CFG_RW_MSK (0xFFFFU) -#define MC33775_SYS_COM_CFG_RD_MSK (0xFFFFU) -#define MC33775_SYS_COM_CFG_WR_MSK (0xFFFFU) -#define MC33775_SYS_COM_CFG_MW_MSK (0x0U) -#define MC33775_SYS_COM_CFG_RA_MSK (0x0U) -#define MC33775_SYS_COM_CFG_POR_MSK (0xffffU) -#define MC33775_SYS_COM_CFG_POR_VAL (0x200U) - -/* Field DADD: Defines the device address. */ -#define MC33775_SYS_COM_CFG_DADD_POS (0U) -#define MC33775_SYS_COM_CFG_DADD_MSK (0x3FU) - -/* Enumerated value UNENUMERATED: Device is unenumerated. The bus forwarding is disabled. */ -#define MC33775_SYS_COM_CFG_DADD_UNENUMERATED_ENUM_VAL (0U) - -/* Enumerated value GLOBAL: Used for global read and write Commands. */ -#define MC33775_SYS_COM_CFG_DADD_GLOBAL_ENUM_VAL (63U) - -/* Field CADD: Defines the daisy chain address. Only used for responses to a all chain read request. */ -#define MC33775_SYS_COM_CFG_CADD_POS (6U) -#define MC33775_SYS_COM_CFG_CADD_MSK (0x1C0U) - -/* Enumerated value RESERVED: Reserved for future usage. */ -#define MC33775_SYS_COM_CFG_CADD_RESERVED_ENUM_VAL (0U) - -/* Enumerated value GLOBAL: Reserved for global write commands. */ -#define MC33775_SYS_COM_CFG_CADD_GLOBAL_ENUM_VAL (7U) - -/* Field BUSFW: Bus forwarding */ -#define MC33775_SYS_COM_CFG_BUSFW_POS (9U) -#define MC33775_SYS_COM_CFG_BUSFW_MSK (0x200U) - -/* Enumerated value DISABLED: Disabled. */ -#define MC33775_SYS_COM_CFG_BUSFW_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Enabled if DADD is unequal 00h. */ -#define MC33775_SYS_COM_CFG_BUSFW_ENABLED_ENUM_VAL (1U) - -/* Field NUMNODES: Number of nodes in the Daisy-Chain. Difference of NUMNODES and DADD defines the wait time for global write commands. */ -#define MC33775_SYS_COM_CFG_NUMNODES_POS (10U) -#define MC33775_SYS_COM_CFG_NUMNODES_MSK (0xFC00U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t DADD : 6; - volatile uint16_t CADD : 3; - volatile uint16_t BUSFW : 1; - volatile uint16_t NUMNODES : 6; - } B; -} mc33775_system_control_registers_sys_com_cfg_t; - -/* -------------------------------------------------------------------------- - * SYS_COM_TO_CFG (read-write):System communication timeout. - * -------------------------------------------------------------------------- */ -#define MC33775_SYS_COM_TO_CFG_OFFSET (0x2U) -#define MC33775_SYS_COM_TO_CFG_RW_MSK (0xFFFFU) -#define MC33775_SYS_COM_TO_CFG_RD_MSK (0xFFFFU) -#define MC33775_SYS_COM_TO_CFG_WR_MSK (0xFFFFU) -#define MC33775_SYS_COM_TO_CFG_MW_MSK (0x0U) -#define MC33775_SYS_COM_TO_CFG_RA_MSK (0x0U) -#define MC33775_SYS_COM_TO_CFG_POR_MSK (0xffffU) -#define MC33775_SYS_COM_TO_CFG_POR_VAL (0x1eU) - -/* Field COMTO: Communication timeout time LSB = 10msec. A value of 0 is treated as 10ms. */ -#define MC33775_SYS_COM_TO_CFG_COMTO_POS (0U) -#define MC33775_SYS_COM_TO_CFG_COMTO_MSK (0xFFU) - -/* Enumerated value T_MIN: 10 milliseconds */ -#define MC33775_SYS_COM_TO_CFG_COMTO_T_MIN_ENUM_VAL (0U) - -/* Enumerated value T_10m: 10 milliseconds */ -#define MC33775_SYS_COM_TO_CFG_COMTO_T_10M_ENUM_VAL (1U) - -/* Enumerated value T_MAX: 2550 milliseconds */ -#define MC33775_SYS_COM_TO_CFG_COMTO_T_MAX_ENUM_VAL (255U) - -/* Field COMTODISABLE: Communication timeout disable. Only intendet for software development activities. Must never be used in release software. */ -#define MC33775_SYS_COM_TO_CFG_COMTODISABLE_POS (8U) -#define MC33775_SYS_COM_TO_CFG_COMTODISABLE_MSK (0xFF00U) - -/* Enumerated value DISABLED: Communication timeout disabled. */ -#define MC33775_SYS_COM_TO_CFG_COMTODISABLE_DISABLED_ENUM_VAL (90U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t COMTO : 8; - volatile uint16_t COMTODISABLE : 8; - } B; -} mc33775_system_control_registers_sys_com_to_cfg_t; - -/* -------------------------------------------------------------------------- - * SYS_SUPPLY_CFG (read-write):Supply configuration. - * -------------------------------------------------------------------------- */ -#define MC33775_SYS_SUPPLY_CFG_OFFSET (0x3U) -#define MC33775_SYS_SUPPLY_CFG_RW_MSK (0x8007U) -#define MC33775_SYS_SUPPLY_CFG_RD_MSK (0x8007U) -#define MC33775_SYS_SUPPLY_CFG_WR_MSK (0x8007U) -#define MC33775_SYS_SUPPLY_CFG_MW_MSK (0x0U) -#define MC33775_SYS_SUPPLY_CFG_RA_MSK (0x0U) -#define MC33775_SYS_SUPPLY_CFG_POR_MSK (0xffffU) -#define MC33775_SYS_SUPPLY_CFG_POR_VAL (0x8003U) - -/* Field VAUXACT: Enable VAUX in active mode. */ -#define MC33775_SYS_SUPPLY_CFG_VAUXACT_POS (0U) -#define MC33775_SYS_SUPPLY_CFG_VAUXACT_MSK (0x1U) - -/* Enumerated value DISABLED: VAUX is disabled in active mode */ -#define MC33775_SYS_SUPPLY_CFG_VAUXACT_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: VAUX is enabled in active mode */ -#define MC33775_SYS_SUPPLY_CFG_VAUXACT_ENABLED_ENUM_VAL (1U) - -/* Field VAUXCYC: Enable VAUX in cyclic mode. */ -#define MC33775_SYS_SUPPLY_CFG_VAUXCYC_POS (1U) -#define MC33775_SYS_SUPPLY_CFG_VAUXCYC_MSK (0x2U) - -/* Enumerated value DISABLED: VAUX is disabled in cyclic mode */ -#define MC33775_SYS_SUPPLY_CFG_VAUXCYC_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: VAUX is enabled in cyclic mode */ -#define MC33775_SYS_SUPPLY_CFG_VAUXCYC_ENABLED_ENUM_VAL (1U) - -/* Field VDDCCYC: Enable VDDC in cyclic mode. */ -#define MC33775_SYS_SUPPLY_CFG_VDDCCYC_POS (2U) -#define MC33775_SYS_SUPPLY_CFG_VDDCCYC_MSK (0x4U) - -/* Enumerated value DISABLED: VDDC is disabled in cyclic mode */ -#define MC33775_SYS_SUPPLY_CFG_VDDCCYC_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: VDDC is enabled in cyclic mode */ -#define MC33775_SYS_SUPPLY_CFG_VDDCCYC_ENABLED_ENUM_VAL (1U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_SYS_SUPPLY_CFG_RESERVED0_POS (3U) -#define MC33775_SYS_SUPPLY_CFG_RESERVED0_MSK (0x7FF8U) - -/* Field CURMATCH: Enable IC supply current matching in active mode. */ -#define MC33775_SYS_SUPPLY_CFG_CURMATCH_POS (15U) -#define MC33775_SYS_SUPPLY_CFG_CURMATCH_MSK (0x8000U) - -/* Enumerated value DISABLED: Supply current matching is disabled */ -#define MC33775_SYS_SUPPLY_CFG_CURMATCH_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Supply current matching is enabled */ -#define MC33775_SYS_SUPPLY_CFG_CURMATCH_ENABLED_ENUM_VAL (1U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VAUXACT : 1; - volatile uint16_t VAUXCYC : 1; - volatile uint16_t VDDCCYC : 1; - volatile uint16_t reserved0 : 12; - volatile uint16_t CURMATCH : 1; - } B; -} mc33775_system_control_registers_sys_supply_cfg_t; - -/* -------------------------------------------------------------------------- - * SYS_MODE (read-write):System mode. - * -------------------------------------------------------------------------- */ -#define MC33775_SYS_MODE_OFFSET (0x4U) -#define MC33775_SYS_MODE_RW_MSK (0x0U) -#define MC33775_SYS_MODE_RD_MSK (0x1F00U) -#define MC33775_SYS_MODE_WR_MSK (0x1FU) -#define MC33775_SYS_MODE_MW_MSK (0x0U) -#define MC33775_SYS_MODE_RA_MSK (0x0U) -#define MC33775_SYS_MODE_POR_MSK (0xffffU) -#define MC33775_SYS_MODE_POR_VAL (0x1400U) - -/* Field TARGETMODE: Target_mode. The mode transition starts immediately after writing. 01010 = sleep, 10100 = deep sleep, Undefined values are ignored. */ -#define MC33775_SYS_MODE_TARGETMODE_POS (0U) -#define MC33775_SYS_MODE_TARGETMODE_MSK (0x1FU) - -/* Enumerated value SLEEP: Sleep mode */ -#define MC33775_SYS_MODE_TARGETMODE_SLEEP_ENUM_VAL (10U) - -/* Enumerated value DEEPSLEEP: Deep sleep mode */ -#define MC33775_SYS_MODE_TARGETMODE_DEEPSLEEP_ENUM_VAL (20U) - -/* Enumerated value RESERVED: Cyclic mode (not for customer use) */ -#define MC33775_SYS_MODE_TARGETMODE_RESERVED_ENUM_VAL (31U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_SYS_MODE_RESERVED0_POS (5U) -#define MC33775_SYS_MODE_RESERVED0_MSK (0xE0U) - -/* Field PREVMODE: Previous mode. */ -#define MC33775_SYS_MODE_PREVMODE_POS (8U) -#define MC33775_SYS_MODE_PREVMODE_MSK (0x1F00U) - -/* Enumerated value SLEEP: Sleep mode */ -#define MC33775_SYS_MODE_PREVMODE_SLEEP_ENUM_VAL (10U) - -/* Enumerated value DEEPSLEEP: Deep sleep mode */ -#define MC33775_SYS_MODE_PREVMODE_DEEPSLEEP_ENUM_VAL (20U) - -/* Enumerated value CYCLIC: Cyclic mode */ -#define MC33775_SYS_MODE_PREVMODE_CYCLIC_ENUM_VAL (31U) - -/* Field reserved1: This read-only field is reserved and always has the value 0. */ -#define MC33775_SYS_MODE_RESERVED1_POS (13U) -#define MC33775_SYS_MODE_RESERVED1_MSK (0xE000U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t TARGETMODE : 5; - volatile uint16_t reserved0 : 3; - volatile uint16_t PREVMODE : 5; - volatile uint16_t reserved1 : 3; - } B; -} mc33775_system_control_registers_sys_mode_t; - -/* -------------------------------------------------------------------------- - * SYS_CYC_WAKEUP_CFG (read-write):Interval for cyclic measurements. - * -------------------------------------------------------------------------- */ -#define MC33775_SYS_CYC_WAKEUP_CFG_OFFSET (0x5U) -#define MC33775_SYS_CYC_WAKEUP_CFG_RW_MSK (0xFFFFU) -#define MC33775_SYS_CYC_WAKEUP_CFG_RD_MSK (0xFFFFU) -#define MC33775_SYS_CYC_WAKEUP_CFG_WR_MSK (0xFFFFU) -#define MC33775_SYS_CYC_WAKEUP_CFG_MW_MSK (0x0U) -#define MC33775_SYS_CYC_WAKEUP_CFG_RA_MSK (0x0U) -#define MC33775_SYS_CYC_WAKEUP_CFG_POR_MSK (0xffffU) -#define MC33775_SYS_CYC_WAKEUP_CFG_POR_VAL (0x0U) - -/* Field PERIOD: Time between two cyclic wake-up events. */ -#define MC33775_SYS_CYC_WAKEUP_CFG_PERIOD_POS (0U) -#define MC33775_SYS_CYC_WAKEUP_CFG_PERIOD_MSK (0xFFFFU) - -/* Enumerated value DISABLED: Cyclic wakeup disabled. */ -#define MC33775_SYS_CYC_WAKEUP_CFG_PERIOD_DISABLED_ENUM_VAL (0U) - -/* Enumerated value PERIOD: PERIOD * 100ms */ -#define MC33775_SYS_CYC_WAKEUP_CFG_PERIOD_PERIOD_ENUM_VAL (1U) - -/* Enumerated value PERIOD_MAX: Maximum period time = 6553500 ms = approximately 1.8h */ -#define MC33775_SYS_CYC_WAKEUP_CFG_PERIOD_PERIOD_MAX_ENUM_VAL (65535U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t PERIOD : 16; - } B; -} mc33775_system_control_registers_sys_cyc_wakeup_cfg_t; - -/* -------------------------------------------------------------------------- - * SYS_TPL_CFG (read-write):TPL configuration (RESERVED for customer) - * -------------------------------------------------------------------------- */ -#define MC33775_SYS_TPL_CFG_OFFSET (0x6U) -#define MC33775_SYS_TPL_CFG_RW_MSK (0x1FU) -#define MC33775_SYS_TPL_CFG_RD_MSK (0x1FU) -#define MC33775_SYS_TPL_CFG_WR_MSK (0x1FU) -#define MC33775_SYS_TPL_CFG_MW_MSK (0x0U) -#define MC33775_SYS_TPL_CFG_RA_MSK (0x0U) -#define MC33775_SYS_TPL_CFG_POR_MSK (0xffffU) -#define MC33775_SYS_TPL_CFG_POR_VAL (0x10U) - -/* Field WAKEUPCOMPL: Defines compatibility for the lower TPL port. (Pin 45 and pin 46) */ -#define MC33775_SYS_TPL_CFG_WAKEUPCOMPL_POS (0U) -#define MC33775_SYS_TPL_CFG_WAKEUPCOMPL_MSK (0x1U) - -/* Enumerated value MC33775A: Wake-up signal is compatible to MC33775A. */ -#define MC33775_SYS_TPL_CFG_WAKEUPCOMPL_MC33775A_ENUM_VAL (0U) - -/* Enumerated value MC33664: Wake-up signal is compatible to MC33664. */ -#define MC33775_SYS_TPL_CFG_WAKEUPCOMPL_MC33664_ENUM_VAL (1U) - -/* Field WAKEUPCOMPH: Defines compatibility for the upper TPL port. (Pin 47 and pin 48) */ -#define MC33775_SYS_TPL_CFG_WAKEUPCOMPH_POS (1U) -#define MC33775_SYS_TPL_CFG_WAKEUPCOMPH_MSK (0x2U) - -/* Enumerated value MC33775A: Wake-up signal is compatible to MC33775A. */ -#define MC33775_SYS_TPL_CFG_WAKEUPCOMPH_MC33775A_ENUM_VAL (0U) - -/* Enumerated value MC33664: Wake-up signal is compatible to MC33664. */ -#define MC33775_SYS_TPL_CFG_WAKEUPCOMPH_MC33664_ENUM_VAL (1U) - -/* Field TXTERML: Termination active while transmit for the lower TPL port. (Pin 45 and pin 46) */ -#define MC33775_SYS_TPL_CFG_TXTERML_POS (2U) -#define MC33775_SYS_TPL_CFG_TXTERML_MSK (0x4U) - -/* Enumerated value DISABLED: Disabled. Termination inactive during transmit. Required for normal TPL operation. */ -#define MC33775_SYS_TPL_CFG_TXTERML_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Enabled. Termination active during transmit. Only needed at final daisy-chain node to have equal power consumption. */ -#define MC33775_SYS_TPL_CFG_TXTERML_ENABLED_ENUM_VAL (1U) - -/* Field TXTERMH: Termination active while transmit for the higher TPL port. (Pin 47 and pin 48) */ -#define MC33775_SYS_TPL_CFG_TXTERMH_POS (3U) -#define MC33775_SYS_TPL_CFG_TXTERMH_MSK (0x8U) - -/* Enumerated value DISABLED: Disabled. Termination inactive during transmit. Required for normal TPL operation. */ -#define MC33775_SYS_TPL_CFG_TXTERMH_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Enabled. Termination active during transmit. Only needed at final daisy-chain node to have equal power consumption. */ -#define MC33775_SYS_TPL_CFG_TXTERMH_ENABLED_ENUM_VAL (1U) - -/* Field DUALRESP: Dual response */ -#define MC33775_SYS_TPL_CFG_DUALRESP_POS (4U) -#define MC33775_SYS_TPL_CFG_DUALRESP_MSK (0x10U) - -/* Enumerated value DISABLED: Disabled. Responses are only transmitted at one side. */ -#define MC33775_SYS_TPL_CFG_DUALRESP_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Enabled.Responses are transmitted on both sides if DADD is unequal 00h. */ -#define MC33775_SYS_TPL_CFG_DUALRESP_ENABLED_ENUM_VAL (1U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_SYS_TPL_CFG_RESERVED0_POS (5U) -#define MC33775_SYS_TPL_CFG_RESERVED0_MSK (0xFFE0U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t WAKEUPCOMPL : 1; - volatile uint16_t WAKEUPCOMPH : 1; - volatile uint16_t TXTERML : 1; - volatile uint16_t TXTERMH : 1; - volatile uint16_t DUALRESP : 1; - volatile uint16_t reserved0 : 11; - } B; -} mc33775_system_control_registers_sys_tpl_cfg_t; - -/* -------------------------------------------------------------------------- - * SYS_CLK_SYNC_CTRL (read-write):Clock Synchronization. - * -------------------------------------------------------------------------- */ -#define MC33775_SYS_CLK_SYNC_CTRL_OFFSET (0x8U) -#define MC33775_SYS_CLK_SYNC_CTRL_RW_MSK (0xFFFFU) -#define MC33775_SYS_CLK_SYNC_CTRL_RD_MSK (0xFFFFU) -#define MC33775_SYS_CLK_SYNC_CTRL_WR_MSK (0xFFFFU) -#define MC33775_SYS_CLK_SYNC_CTRL_MW_MSK (0x0U) -#define MC33775_SYS_CLK_SYNC_CTRL_RA_MSK (0x0U) -#define MC33775_SYS_CLK_SYNC_CTRL_POR_MSK (0xffffU) -#define MC33775_SYS_CLK_SYNC_CTRL_POR_VAL (0x0U) - -/* Field SYNCCNT: Synchronization counter value: Writing a 0x0000 resets the counter with no adjustment. For other values it is checked if the internal counter value is higher, in which case the oscillator frequency is decreased. If it is lower the internal oscillator frequency is increased. Reading the value returns the current internal counter value. 1 LSB = 10us. */ -#define MC33775_SYS_CLK_SYNC_CTRL_SYNCCNT_POS (0U) -#define MC33775_SYS_CLK_SYNC_CTRL_SYNCCNT_MSK (0xFFFFU) - -/* Enumerated value RESET: Counter is reset with no adjustment. */ -#define MC33775_SYS_CLK_SYNC_CTRL_SYNCCNT_RESET_ENUM_VAL (0U) - -/* Enumerated value ADJUST: 10 us. */ -#define MC33775_SYS_CLK_SYNC_CTRL_SYNCCNT_ADJUST_ENUM_VAL (1U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t SYNCCNT : 16; - } B; -} mc33775_system_control_registers_sys_clk_sync_ctrl_t; - -/* -------------------------------------------------------------------------- - * SYS_VERSION (read-only):Device silicon identifier. - * -------------------------------------------------------------------------- */ -#define MC33775_SYS_VERSION_OFFSET (0x10U) -#define MC33775_SYS_VERSION_RW_MSK (0x0U) -#define MC33775_SYS_VERSION_RD_MSK (0xFFFFU) -#define MC33775_SYS_VERSION_WR_MSK (0x0U) -#define MC33775_SYS_VERSION_MW_MSK (0x0U) -#define MC33775_SYS_VERSION_RA_MSK (0x0U) -#define MC33775_SYS_VERSION_POR_MSK (0xffffU) -#define MC33775_SYS_VERSION_POR_VAL (0x0U) - -/* Field MREV: Metal revision ID. */ -#define MC33775_SYS_VERSION_MREV_POS (0U) -#define MC33775_SYS_VERSION_MREV_MSK (0xFU) - -/* Field FREV: Full mask revision ID. */ -#define MC33775_SYS_VERSION_FREV_POS (4U) -#define MC33775_SYS_VERSION_FREV_MSK (0xF0U) - -/* Field TYPE: Type identifier. */ -#define MC33775_SYS_VERSION_TYPE_POS (8U) -#define MC33775_SYS_VERSION_TYPE_MSK (0xFF00U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t MREV : 4; - volatile uint16_t FREV : 4; - volatile uint16_t TYPE : 8; - } B; -} mc33775_system_control_registers_sys_version_t; - -/* -------------------------------------------------------------------------- - * SYS_UID_LOW (read-only):Unique device ID lower part. - * -------------------------------------------------------------------------- */ -#define MC33775_SYS_UID_LOW_OFFSET (0x11U) -#define MC33775_SYS_UID_LOW_RW_MSK (0x0U) -#define MC33775_SYS_UID_LOW_RD_MSK (0xFFFFU) -#define MC33775_SYS_UID_LOW_WR_MSK (0x0U) -#define MC33775_SYS_UID_LOW_MW_MSK (0x0U) -#define MC33775_SYS_UID_LOW_RA_MSK (0x0U) -#define MC33775_SYS_UID_LOW_POR_MSK (0xffffU) -#define MC33775_SYS_UID_LOW_POR_VAL (0x0U) - -/* Field LOW: Lower part of unique device ID (encoded: wafer-lot, wafer-number, device coordinates, testprogram and test-steps). */ -#define MC33775_SYS_UID_LOW_LOW_POS (0U) -#define MC33775_SYS_UID_LOW_LOW_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t LOW : 16; - } B; -} mc33775_system_control_registers_sys_uid_low_t; - -/* -------------------------------------------------------------------------- - * SYS_UID_MID (read-only):Unique device ID middle part. - * -------------------------------------------------------------------------- */ -#define MC33775_SYS_UID_MID_OFFSET (0x12U) -#define MC33775_SYS_UID_MID_RW_MSK (0x0U) -#define MC33775_SYS_UID_MID_RD_MSK (0xFFFFU) -#define MC33775_SYS_UID_MID_WR_MSK (0x0U) -#define MC33775_SYS_UID_MID_MW_MSK (0x0U) -#define MC33775_SYS_UID_MID_RA_MSK (0x0U) -#define MC33775_SYS_UID_MID_POR_MSK (0xffffU) -#define MC33775_SYS_UID_MID_POR_VAL (0x0U) - -/* Field MID: Middle part of unique device ID (encoded: wafer-lot, wafer-number, device coordinates, testprogram and test-steps). */ -#define MC33775_SYS_UID_MID_MID_POS (0U) -#define MC33775_SYS_UID_MID_MID_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t MID : 16; - } B; -} mc33775_system_control_registers_sys_uid_mid_t; - -/* -------------------------------------------------------------------------- - * SYS_UID_HIGH (read-only):Unique device ID higher part. - * -------------------------------------------------------------------------- */ -#define MC33775_SYS_UID_HIGH_OFFSET (0x13U) -#define MC33775_SYS_UID_HIGH_RW_MSK (0x0U) -#define MC33775_SYS_UID_HIGH_RD_MSK (0xFFFFU) -#define MC33775_SYS_UID_HIGH_WR_MSK (0x0U) -#define MC33775_SYS_UID_HIGH_MW_MSK (0x0U) -#define MC33775_SYS_UID_HIGH_RA_MSK (0x0U) -#define MC33775_SYS_UID_HIGH_POR_MSK (0xffffU) -#define MC33775_SYS_UID_HIGH_POR_VAL (0x0U) - -/* Field HIGH: Higher part of unique device ID (encoded: wafer-lot, wafer-number, device coordinates, testprogram and test-steps). */ -#define MC33775_SYS_UID_HIGH_HIGH_POS (0U) -#define MC33775_SYS_UID_HIGH_HIGH_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t HIGH : 16; - } B; -} mc33775_system_control_registers_sys_uid_high_t; - -/* -------------------------------------------------------------------------- - * SYS_DS_STORAGE0 (read-write):Deep Sleep Storage Data0. The value is stored in the ULP domain. - * -------------------------------------------------------------------------- */ -#define MC33775_SYS_DS_STORAGE0_OFFSET (0x80U) -#define MC33775_SYS_DS_STORAGE0_RW_MSK (0xFFFFU) -#define MC33775_SYS_DS_STORAGE0_RD_MSK (0xFFFFU) -#define MC33775_SYS_DS_STORAGE0_WR_MSK (0xFFFFU) -#define MC33775_SYS_DS_STORAGE0_MW_MSK (0x0U) -#define MC33775_SYS_DS_STORAGE0_RA_MSK (0x0U) -#define MC33775_SYS_DS_STORAGE0_POR_MSK (0xffffU) -#define MC33775_SYS_DS_STORAGE0_POR_VAL (0x0U) - -/* Field DATA: Deep Sleep surviving data. This register has no reset. This register allows to store application data and has no influence on the device. */ -#define MC33775_SYS_DS_STORAGE0_DATA_POS (0U) -#define MC33775_SYS_DS_STORAGE0_DATA_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t DATA : 16; - } B; -} mc33775_system_control_registers_sys_ds_storage0_t; - -/* -------------------------------------------------------------------------- - * SYS_DS_STORAGE1 (read-write):Deep Sleep Storage Data1. The value is stored in the ULP domain. - * -------------------------------------------------------------------------- */ -#define MC33775_SYS_DS_STORAGE1_OFFSET (0x81U) -#define MC33775_SYS_DS_STORAGE1_RW_MSK (0xFFFFU) -#define MC33775_SYS_DS_STORAGE1_RD_MSK (0xFFFFU) -#define MC33775_SYS_DS_STORAGE1_WR_MSK (0xFFFFU) -#define MC33775_SYS_DS_STORAGE1_MW_MSK (0x0U) -#define MC33775_SYS_DS_STORAGE1_RA_MSK (0x0U) -#define MC33775_SYS_DS_STORAGE1_POR_MSK (0xffffU) -#define MC33775_SYS_DS_STORAGE1_POR_VAL (0x0U) - -/* Field DATA: Deep Sleep surviving data. This register has no reset. This register allows to store application data and has no influence on the device. */ -#define MC33775_SYS_DS_STORAGE1_DATA_POS (0U) -#define MC33775_SYS_DS_STORAGE1_DATA_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t DATA : 16; - } B; -} mc33775_system_control_registers_sys_ds_storage1_t; - -/* -------------------------------------------------------------------------- - * FEH_CFG_CRC (read-only):Configuration CRC - * -------------------------------------------------------------------------- */ -#define MC33775_FEH_CFG_CRC_OFFSET (0x400U) -#define MC33775_FEH_CFG_CRC_RW_MSK (0x0U) -#define MC33775_FEH_CFG_CRC_RD_MSK (0xFFFFU) -#define MC33775_FEH_CFG_CRC_WR_MSK (0x0U) -#define MC33775_FEH_CFG_CRC_MW_MSK (0x0U) -#define MC33775_FEH_CFG_CRC_RA_MSK (0x0U) -#define MC33775_FEH_CFG_CRC_POR_MSK (0xffffU) -#define MC33775_FEH_CFG_CRC_POR_VAL (0x0U) - -/* Field CRC: This CRC value is recalculated with any write to a covered register and with any read to this register. The updated CRC value is available latest 100us after the last write. The CRC value is application specific and must be re-calculated by the MCU. The used polynomial is: 0xD175 (+1) = X^16 + X^15 + X^13 + X^9 + X^7 + X^6 + X^5 + X^3 + X^1 + 1. -Following registers are included: FEH_ALARM_CFG, FEH_ALARM_OUT_CFG, FEH_WAKEUP_CFG, FEH_SUPPLY_FLT_POR_CFG0, FEH_SUPPLY_FLT_POR_CFG1, FEH_ANA_FLT_POR_CFG, FEH_COM_FLT_POR_CFG, FEH_SUPPLY_FLT_EVT_CFG0, FEH_SUPPLY_FLT_EVT_CFG1, FEH_ANA_FLT_EVT_CFG, FEH_COM_FLT_EVT_CFG, FEH_MEAS_FLT_EVT_CFG. */ -#define MC33775_FEH_CFG_CRC_CRC_POS (0U) -#define MC33775_FEH_CFG_CRC_CRC_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t CRC : 16; - } B; -} mc33775_event_handling_registers_feh_cfg_crc_t; - -/* -------------------------------------------------------------------------- - * FEH_ALARM_CFG (read-write):General alarm configuration. - * -------------------------------------------------------------------------- */ -#define MC33775_FEH_ALARM_CFG_OFFSET (0x401U) -#define MC33775_FEH_ALARM_CFG_RW_MSK (0xFFU) -#define MC33775_FEH_ALARM_CFG_RD_MSK (0xFFU) -#define MC33775_FEH_ALARM_CFG_WR_MSK (0xFFU) -#define MC33775_FEH_ALARM_CFG_MW_MSK (0x0U) -#define MC33775_FEH_ALARM_CFG_RA_MSK (0x0U) -#define MC33775_FEH_ALARM_CFG_POR_MSK (0xffffU) -#define MC33775_FEH_ALARM_CFG_POR_VAL (0x0U) - -/* Field ALARMIN: Enable alarm input Enabling the alarm input automatically enables the digital receiver for the Alarm input pin. */ -#define MC33775_FEH_ALARM_CFG_ALARMIN_POS (0U) -#define MC33775_FEH_ALARM_CFG_ALARMIN_MSK (0x3U) - -/* Enumerated value DISABLED: Alarm input is disabled */ -#define MC33775_FEH_ALARM_CFG_ALARMIN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value HIGH_ACTIVE: Alarm input is enabled, high active */ -#define MC33775_FEH_ALARM_CFG_ALARMIN_HIGH_ACTIVE_ENUM_VAL (1U) - -/* Enumerated value LOW_ACTIVE: Alarm input is enabled, low active */ -#define MC33775_FEH_ALARM_CFG_ALARMIN_LOW_ACTIVE_ENUM_VAL (2U) - -/* Enumerated value HEARTBEAT: Alarm input is enabled, heartbeat configuration */ -#define MC33775_FEH_ALARM_CFG_ALARMIN_HEARTBEAT_ENUM_VAL (3U) - -/* Field ALARMINHB: Input heartbeat low time setting */ -#define MC33775_FEH_ALARM_CFG_ALARMINHB_POS (2U) -#define MC33775_FEH_ALARM_CFG_ALARMINHB_MSK (0xCU) - -/* Enumerated value T_500u: 500 us */ -#define MC33775_FEH_ALARM_CFG_ALARMINHB_T_500U_ENUM_VAL (0U) - -/* Enumerated value T_1ms: 1 ms */ -#define MC33775_FEH_ALARM_CFG_ALARMINHB_T_1MS_ENUM_VAL (1U) - -/* Enumerated value T_10ms: 10 ms */ -#define MC33775_FEH_ALARM_CFG_ALARMINHB_T_10MS_ENUM_VAL (2U) - -/* Enumerated value T_100ms: 100 ms */ -#define MC33775_FEH_ALARM_CFG_ALARMINHB_T_100MS_ENUM_VAL (3U) - -/* Field ALARMOUT: Enable alarm output */ -#define MC33775_FEH_ALARM_CFG_ALARMOUT_POS (4U) -#define MC33775_FEH_ALARM_CFG_ALARMOUT_MSK (0x30U) - -/* Enumerated value DISABLED: disabled. Alarm output is fixed low */ -#define MC33775_FEH_ALARM_CFG_ALARMOUT_DISABLED_ENUM_VAL (0U) - -/* Enumerated value HIGH_ACTIVE: high active */ -#define MC33775_FEH_ALARM_CFG_ALARMOUT_HIGH_ACTIVE_ENUM_VAL (1U) - -/* Enumerated value LOW_ACTIVE: low active */ -#define MC33775_FEH_ALARM_CFG_ALARMOUT_LOW_ACTIVE_ENUM_VAL (2U) - -/* Enumerated value HEARTBEAT: heartbeat configuration */ -#define MC33775_FEH_ALARM_CFG_ALARMOUT_HEARTBEAT_ENUM_VAL (3U) - -/* Field ALARMOUTHB: Output heartbeat low time setting */ -#define MC33775_FEH_ALARM_CFG_ALARMOUTHB_POS (6U) -#define MC33775_FEH_ALARM_CFG_ALARMOUTHB_MSK (0xC0U) - -/* Enumerated value T_500u: 500 us */ -#define MC33775_FEH_ALARM_CFG_ALARMOUTHB_T_500U_ENUM_VAL (0U) - -/* Enumerated value T_1ms: 1 ms */ -#define MC33775_FEH_ALARM_CFG_ALARMOUTHB_T_1MS_ENUM_VAL (1U) - -/* Enumerated value T_10ms: 10 ms */ -#define MC33775_FEH_ALARM_CFG_ALARMOUTHB_T_10MS_ENUM_VAL (2U) - -/* Enumerated value T_100ms: 100 ms */ -#define MC33775_FEH_ALARM_CFG_ALARMOUTHB_T_100MS_ENUM_VAL (3U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_FEH_ALARM_CFG_RESERVED0_POS (8U) -#define MC33775_FEH_ALARM_CFG_RESERVED0_MSK (0xFF00U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t ALARMIN : 2; - volatile uint16_t ALARMINHB : 2; - volatile uint16_t ALARMOUT : 2; - volatile uint16_t ALARMOUTHB : 2; - volatile uint16_t reserved0 : 8; - } B; -} mc33775_event_handling_registers_feh_alarm_cfg_t; - -/* -------------------------------------------------------------------------- - * FEH_ALARM_OUT_CFG (read-write):Alarm output source selection. - * -------------------------------------------------------------------------- */ -#define MC33775_FEH_ALARM_OUT_CFG_OFFSET (0x402U) -#define MC33775_FEH_ALARM_OUT_CFG_RW_MSK (0x7FFFU) -#define MC33775_FEH_ALARM_OUT_CFG_RD_MSK (0x7FFFU) -#define MC33775_FEH_ALARM_OUT_CFG_WR_MSK (0x7FFFU) -#define MC33775_FEH_ALARM_OUT_CFG_MW_MSK (0x0U) -#define MC33775_FEH_ALARM_OUT_CFG_RA_MSK (0x0U) -#define MC33775_FEH_ALARM_OUT_CFG_POR_MSK (0xffffU) -#define MC33775_FEH_ALARM_OUT_CFG_POR_VAL (0x0U) - -/* Field VCOV: Enable output on alarm output for VC_OV. */ -#define MC33775_FEH_ALARM_OUT_CFG_VCOV_POS (0U) -#define MC33775_FEH_ALARM_OUT_CFG_VCOV_MSK (0x1U) - -/* Enumerated value DISABLED: disabled */ -#define MC33775_FEH_ALARM_OUT_CFG_VCOV_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: enabled */ -#define MC33775_FEH_ALARM_OUT_CFG_VCOV_ENABLED_ENUM_VAL (1U) - -/* Field VCUV0: Enable output on alarm output for VC_UV0. */ -#define MC33775_FEH_ALARM_OUT_CFG_VCUV0_POS (1U) -#define MC33775_FEH_ALARM_OUT_CFG_VCUV0_MSK (0x2U) - -/* Enumerated value DISABLED: disabled */ -#define MC33775_FEH_ALARM_OUT_CFG_VCUV0_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: enabled */ -#define MC33775_FEH_ALARM_OUT_CFG_VCUV0_ENABLED_ENUM_VAL (1U) - -/* Field VCUV1: Enable output on alarm output for VC_UV1. */ -#define MC33775_FEH_ALARM_OUT_CFG_VCUV1_POS (2U) -#define MC33775_FEH_ALARM_OUT_CFG_VCUV1_MSK (0x4U) - -/* Enumerated value DISABLED: disabled */ -#define MC33775_FEH_ALARM_OUT_CFG_VCUV1_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: enabled */ -#define MC33775_FEH_ALARM_OUT_CFG_VCUV1_ENABLED_ENUM_VAL (1U) - -/* Field AIN0OV: Enable output on alarm output for AIN0_OV. */ -#define MC33775_FEH_ALARM_OUT_CFG_AIN0OV_POS (3U) -#define MC33775_FEH_ALARM_OUT_CFG_AIN0OV_MSK (0x8U) - -/* Enumerated value DISABLED: disabled */ -#define MC33775_FEH_ALARM_OUT_CFG_AIN0OV_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: enabled */ -#define MC33775_FEH_ALARM_OUT_CFG_AIN0OV_ENABLED_ENUM_VAL (1U) - -/* Field AIN0UV: Enable output on alarm output for AIN0_UV. */ -#define MC33775_FEH_ALARM_OUT_CFG_AIN0UV_POS (4U) -#define MC33775_FEH_ALARM_OUT_CFG_AIN0UV_MSK (0x10U) - -/* Enumerated value DISABLED: disabled */ -#define MC33775_FEH_ALARM_OUT_CFG_AIN0UV_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: enabled */ -#define MC33775_FEH_ALARM_OUT_CFG_AIN0UV_ENABLED_ENUM_VAL (1U) - -/* Field AIN1OV: Enable output on alarm output for AIN1_OV. */ -#define MC33775_FEH_ALARM_OUT_CFG_AIN1OV_POS (5U) -#define MC33775_FEH_ALARM_OUT_CFG_AIN1OV_MSK (0x20U) - -/* Enumerated value DISABLED: disabled */ -#define MC33775_FEH_ALARM_OUT_CFG_AIN1OV_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: enabled */ -#define MC33775_FEH_ALARM_OUT_CFG_AIN1OV_ENABLED_ENUM_VAL (1U) - -/* Field AIN1UV: Enable output on alarm output for AIN1_UV. */ -#define MC33775_FEH_ALARM_OUT_CFG_AIN1UV_POS (6U) -#define MC33775_FEH_ALARM_OUT_CFG_AIN1UV_MSK (0x40U) - -/* Enumerated value DISABLED: disabled */ -#define MC33775_FEH_ALARM_OUT_CFG_AIN1UV_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: enabled */ -#define MC33775_FEH_ALARM_OUT_CFG_AIN1UV_ENABLED_ENUM_VAL (1U) - -/* Field AIN2OV: Enable output on alarm output for AIN2_OV. */ -#define MC33775_FEH_ALARM_OUT_CFG_AIN2OV_POS (7U) -#define MC33775_FEH_ALARM_OUT_CFG_AIN2OV_MSK (0x80U) - -/* Enumerated value DISABLED: disabled */ -#define MC33775_FEH_ALARM_OUT_CFG_AIN2OV_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: enabled */ -#define MC33775_FEH_ALARM_OUT_CFG_AIN2OV_ENABLED_ENUM_VAL (1U) - -/* Field AIN2UV: Enable output on alarm output for AIN2_UV. */ -#define MC33775_FEH_ALARM_OUT_CFG_AIN2UV_POS (8U) -#define MC33775_FEH_ALARM_OUT_CFG_AIN2UV_MSK (0x100U) - -/* Enumerated value DISABLED: disabled */ -#define MC33775_FEH_ALARM_OUT_CFG_AIN2UV_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: enabled */ -#define MC33775_FEH_ALARM_OUT_CFG_AIN2UV_ENABLED_ENUM_VAL (1U) - -/* Field AIN3OV: Enable output on alarm output for AIN3_OV. */ -#define MC33775_FEH_ALARM_OUT_CFG_AIN3OV_POS (9U) -#define MC33775_FEH_ALARM_OUT_CFG_AIN3OV_MSK (0x200U) - -/* Enumerated value DISABLED: disabled */ -#define MC33775_FEH_ALARM_OUT_CFG_AIN3OV_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: enabled */ -#define MC33775_FEH_ALARM_OUT_CFG_AIN3OV_ENABLED_ENUM_VAL (1U) - -/* Field AIN3UV: Enable output on alarm output for AIN3_UV. */ -#define MC33775_FEH_ALARM_OUT_CFG_AIN3UV_POS (10U) -#define MC33775_FEH_ALARM_OUT_CFG_AIN3UV_MSK (0x400U) - -/* Enumerated value DISABLED: disabled */ -#define MC33775_FEH_ALARM_OUT_CFG_AIN3UV_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: enabled */ -#define MC33775_FEH_ALARM_OUT_CFG_AIN3UV_ENABLED_ENUM_VAL (1U) - -/* Field ALARMIN: Enable output on alarm output for detected alarm input. */ -#define MC33775_FEH_ALARM_OUT_CFG_ALARMIN_POS (11U) -#define MC33775_FEH_ALARM_OUT_CFG_ALARMIN_MSK (0x800U) - -/* Enumerated value DISABLED: disabled */ -#define MC33775_FEH_ALARM_OUT_CFG_ALARMIN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: enabled */ -#define MC33775_FEH_ALARM_OUT_CFG_ALARMIN_ENABLED_ENUM_VAL (1U) - -/* Field WAKEUPIN: Enable output on detected wakeup input. Enabling this bit automatically enables the digital receiver for the wakeup input pin. */ -#define MC33775_FEH_ALARM_OUT_CFG_WAKEUPIN_POS (12U) -#define MC33775_FEH_ALARM_OUT_CFG_WAKEUPIN_MSK (0x1000U) - -/* Enumerated value DISABLED: disabled */ -#define MC33775_FEH_ALARM_OUT_CFG_WAKEUPIN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: enabled */ -#define MC33775_FEH_ALARM_OUT_CFG_WAKEUPIN_ENABLED_ENUM_VAL (1U) - -/* Field BALRDY: Enable output on alarm output for cell voltage balancing ready. */ -#define MC33775_FEH_ALARM_OUT_CFG_BALRDY_POS (13U) -#define MC33775_FEH_ALARM_OUT_CFG_BALRDY_MSK (0x2000U) - -/* Enumerated value DISABLED: disabled */ -#define MC33775_FEH_ALARM_OUT_CFG_BALRDY_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: enabled */ -#define MC33775_FEH_ALARM_OUT_CFG_BALRDY_ENABLED_ENUM_VAL (1U) - -/* Field SYSFLTEVT: Enable output on alarm output for a detected and selected system fault. */ -#define MC33775_FEH_ALARM_OUT_CFG_SYSFLTEVT_POS (14U) -#define MC33775_FEH_ALARM_OUT_CFG_SYSFLTEVT_MSK (0x4000U) - -/* Enumerated value DISABLED: disabled */ -#define MC33775_FEH_ALARM_OUT_CFG_SYSFLTEVT_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: enabled */ -#define MC33775_FEH_ALARM_OUT_CFG_SYSFLTEVT_ENABLED_ENUM_VAL (1U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_FEH_ALARM_OUT_CFG_RESERVED0_POS (15U) -#define MC33775_FEH_ALARM_OUT_CFG_RESERVED0_MSK (0x8000U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VCOV : 1; - volatile uint16_t VCUV0 : 1; - volatile uint16_t VCUV1 : 1; - volatile uint16_t AIN0OV : 1; - volatile uint16_t AIN0UV : 1; - volatile uint16_t AIN1OV : 1; - volatile uint16_t AIN1UV : 1; - volatile uint16_t AIN2OV : 1; - volatile uint16_t AIN2UV : 1; - volatile uint16_t AIN3OV : 1; - volatile uint16_t AIN3UV : 1; - volatile uint16_t ALARMIN : 1; - volatile uint16_t WAKEUPIN : 1; - volatile uint16_t BALRDY : 1; - volatile uint16_t SYSFLTEVT : 1; - volatile uint16_t reserved0 : 1; - } B; -} mc33775_event_handling_registers_feh_alarm_out_cfg_t; - -/* -------------------------------------------------------------------------- - * FEH_ALARM_OUT_REASON (read-only):Alarm output reason. - * -------------------------------------------------------------------------- */ -#define MC33775_FEH_ALARM_OUT_REASON_OFFSET (0x403U) -#define MC33775_FEH_ALARM_OUT_REASON_RW_MSK (0x0U) -#define MC33775_FEH_ALARM_OUT_REASON_RD_MSK (0x7FFFU) -#define MC33775_FEH_ALARM_OUT_REASON_WR_MSK (0x0U) -#define MC33775_FEH_ALARM_OUT_REASON_MW_MSK (0x0U) -#define MC33775_FEH_ALARM_OUT_REASON_RA_MSK (0x7FFFU) -#define MC33775_FEH_ALARM_OUT_REASON_POR_MSK (0xffffU) -#define MC33775_FEH_ALARM_OUT_REASON_POR_VAL (0x0U) - -/* Field VCOV: VC_OV */ -#define MC33775_FEH_ALARM_OUT_REASON_VCOV_POS (0U) -#define MC33775_FEH_ALARM_OUT_REASON_VCOV_MSK (0x1U) - -/* Enumerated value NO_ALARM: Alarm not caused by VC_OV */ -#define MC33775_FEH_ALARM_OUT_REASON_VCOV_NO_ALARM_ENUM_VAL (0U) - -/* Enumerated value ALARM: Alarm caused by VC_OV */ -#define MC33775_FEH_ALARM_OUT_REASON_VCOV_ALARM_ENUM_VAL (1U) - -/* Field VCUV0: VC_UV0 */ -#define MC33775_FEH_ALARM_OUT_REASON_VCUV0_POS (1U) -#define MC33775_FEH_ALARM_OUT_REASON_VCUV0_MSK (0x2U) - -/* Enumerated value NO_ALARM: Alarm not caused by VC_UV0 */ -#define MC33775_FEH_ALARM_OUT_REASON_VCUV0_NO_ALARM_ENUM_VAL (0U) - -/* Enumerated value ALARM: Alarm caused by VC_UV0 */ -#define MC33775_FEH_ALARM_OUT_REASON_VCUV0_ALARM_ENUM_VAL (1U) - -/* Field VCUV1: VC_UV1 */ -#define MC33775_FEH_ALARM_OUT_REASON_VCUV1_POS (2U) -#define MC33775_FEH_ALARM_OUT_REASON_VCUV1_MSK (0x4U) - -/* Enumerated value NO_ALARM: Alarm not caused by VC_UV1 */ -#define MC33775_FEH_ALARM_OUT_REASON_VCUV1_NO_ALARM_ENUM_VAL (0U) - -/* Enumerated value ALARM: Alarm caused by VC_UV1 */ -#define MC33775_FEH_ALARM_OUT_REASON_VCUV1_ALARM_ENUM_VAL (1U) - -/* Field AIN0OV: AIN0_OV */ -#define MC33775_FEH_ALARM_OUT_REASON_AIN0OV_POS (3U) -#define MC33775_FEH_ALARM_OUT_REASON_AIN0OV_MSK (0x8U) - -/* Enumerated value NO_ALARM: Alarm not caused by AIN0_OV */ -#define MC33775_FEH_ALARM_OUT_REASON_AIN0OV_NO_ALARM_ENUM_VAL (0U) - -/* Enumerated value ALARM: Alarm caused by AIN0_OV */ -#define MC33775_FEH_ALARM_OUT_REASON_AIN0OV_ALARM_ENUM_VAL (1U) - -/* Field AIN0UV: AIN0_UV */ -#define MC33775_FEH_ALARM_OUT_REASON_AIN0UV_POS (4U) -#define MC33775_FEH_ALARM_OUT_REASON_AIN0UV_MSK (0x10U) - -/* Enumerated value NO_ALARM: Alarm not caused by AIN0_UV */ -#define MC33775_FEH_ALARM_OUT_REASON_AIN0UV_NO_ALARM_ENUM_VAL (0U) - -/* Enumerated value ALARM: Alarm caused by AIN0_UV */ -#define MC33775_FEH_ALARM_OUT_REASON_AIN0UV_ALARM_ENUM_VAL (1U) - -/* Field AIN1OV: AIN1_OV */ -#define MC33775_FEH_ALARM_OUT_REASON_AIN1OV_POS (5U) -#define MC33775_FEH_ALARM_OUT_REASON_AIN1OV_MSK (0x20U) - -/* Enumerated value NO_ALARM: Alarm not caused by AIN1_OV */ -#define MC33775_FEH_ALARM_OUT_REASON_AIN1OV_NO_ALARM_ENUM_VAL (0U) - -/* Enumerated value ALARM: Alarm caused by AIN1_OV */ -#define MC33775_FEH_ALARM_OUT_REASON_AIN1OV_ALARM_ENUM_VAL (1U) - -/* Field AIN1UV: AIN1_UV */ -#define MC33775_FEH_ALARM_OUT_REASON_AIN1UV_POS (6U) -#define MC33775_FEH_ALARM_OUT_REASON_AIN1UV_MSK (0x40U) - -/* Enumerated value NO_ALARM: Alarm not caused by AIN1_UV */ -#define MC33775_FEH_ALARM_OUT_REASON_AIN1UV_NO_ALARM_ENUM_VAL (0U) - -/* Enumerated value ALARM: Alarm caused by AIN1_UV */ -#define MC33775_FEH_ALARM_OUT_REASON_AIN1UV_ALARM_ENUM_VAL (1U) - -/* Field AIN2OV: AIN2_OV */ -#define MC33775_FEH_ALARM_OUT_REASON_AIN2OV_POS (7U) -#define MC33775_FEH_ALARM_OUT_REASON_AIN2OV_MSK (0x80U) - -/* Enumerated value NO_ALARM: Alarm not caused by AIN2_OV */ -#define MC33775_FEH_ALARM_OUT_REASON_AIN2OV_NO_ALARM_ENUM_VAL (0U) - -/* Enumerated value ALARM: Alarm caused by AIN2_OV */ -#define MC33775_FEH_ALARM_OUT_REASON_AIN2OV_ALARM_ENUM_VAL (1U) - -/* Field AIN2UV: AIN2_UV */ -#define MC33775_FEH_ALARM_OUT_REASON_AIN2UV_POS (8U) -#define MC33775_FEH_ALARM_OUT_REASON_AIN2UV_MSK (0x100U) - -/* Enumerated value NO_ALARM: Alarm not caused by AIN2_UV */ -#define MC33775_FEH_ALARM_OUT_REASON_AIN2UV_NO_ALARM_ENUM_VAL (0U) - -/* Enumerated value ALARM: Alarm caused by AIN2_UV */ -#define MC33775_FEH_ALARM_OUT_REASON_AIN2UV_ALARM_ENUM_VAL (1U) - -/* Field AIN3OV: AIN3_OV */ -#define MC33775_FEH_ALARM_OUT_REASON_AIN3OV_POS (9U) -#define MC33775_FEH_ALARM_OUT_REASON_AIN3OV_MSK (0x200U) - -/* Enumerated value NO_ALARM: Alarm not caused by AIN3_OV */ -#define MC33775_FEH_ALARM_OUT_REASON_AIN3OV_NO_ALARM_ENUM_VAL (0U) - -/* Enumerated value ALARM: Alarm caused by AIN3_OV */ -#define MC33775_FEH_ALARM_OUT_REASON_AIN3OV_ALARM_ENUM_VAL (1U) - -/* Field AIN3UV: AIN3_UV */ -#define MC33775_FEH_ALARM_OUT_REASON_AIN3UV_POS (10U) -#define MC33775_FEH_ALARM_OUT_REASON_AIN3UV_MSK (0x400U) - -/* Enumerated value NO_ALARM: Alarm not caused by AIN3_UV */ -#define MC33775_FEH_ALARM_OUT_REASON_AIN3UV_NO_ALARM_ENUM_VAL (0U) - -/* Enumerated value ALARM: Alarm caused by AIN3_UV */ -#define MC33775_FEH_ALARM_OUT_REASON_AIN3UV_ALARM_ENUM_VAL (1U) - -/* Field ALARMIN: Detected alarm input */ -#define MC33775_FEH_ALARM_OUT_REASON_ALARMIN_POS (11U) -#define MC33775_FEH_ALARM_OUT_REASON_ALARMIN_MSK (0x800U) - -/* Enumerated value NO_ALARM: Alarm not caused by detected alarm input */ -#define MC33775_FEH_ALARM_OUT_REASON_ALARMIN_NO_ALARM_ENUM_VAL (0U) - -/* Enumerated value ALARM: Alarm caused by detected alarm input */ -#define MC33775_FEH_ALARM_OUT_REASON_ALARMIN_ALARM_ENUM_VAL (1U) - -/* Field WAKEUPIN: Detected wakeup input */ -#define MC33775_FEH_ALARM_OUT_REASON_WAKEUPIN_POS (12U) -#define MC33775_FEH_ALARM_OUT_REASON_WAKEUPIN_MSK (0x1000U) - -/* Enumerated value NO_ALARM: Alarm not caused by detected wakeup input */ -#define MC33775_FEH_ALARM_OUT_REASON_WAKEUPIN_NO_ALARM_ENUM_VAL (0U) - -/* Enumerated value ALARM: Alarm caused by detected wakeup input */ -#define MC33775_FEH_ALARM_OUT_REASON_WAKEUPIN_ALARM_ENUM_VAL (1U) - -/* Field BALRDY: Cell voltage balancing ready */ -#define MC33775_FEH_ALARM_OUT_REASON_BALRDY_POS (13U) -#define MC33775_FEH_ALARM_OUT_REASON_BALRDY_MSK (0x2000U) - -/* Enumerated value NO_ALARM: Alarm not caused by cell voltage balancing ready */ -#define MC33775_FEH_ALARM_OUT_REASON_BALRDY_NO_ALARM_ENUM_VAL (0U) - -/* Enumerated value ALARM: Alarm caused by cell voltage balancing ready */ -#define MC33775_FEH_ALARM_OUT_REASON_BALRDY_ALARM_ENUM_VAL (1U) - -/* Field SYSFLTEVT: Detected system fault. */ -#define MC33775_FEH_ALARM_OUT_REASON_SYSFLTEVT_POS (14U) -#define MC33775_FEH_ALARM_OUT_REASON_SYSFLTEVT_MSK (0x4000U) - -/* Enumerated value NO_ALARM: Alarm not caused by detected system fault */ -#define MC33775_FEH_ALARM_OUT_REASON_SYSFLTEVT_NO_ALARM_ENUM_VAL (0U) - -/* Enumerated value ALARM: Alarm caused by detected system fault */ -#define MC33775_FEH_ALARM_OUT_REASON_SYSFLTEVT_ALARM_ENUM_VAL (1U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_FEH_ALARM_OUT_REASON_RESERVED0_POS (15U) -#define MC33775_FEH_ALARM_OUT_REASON_RESERVED0_MSK (0x8000U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VCOV : 1; - volatile uint16_t VCUV0 : 1; - volatile uint16_t VCUV1 : 1; - volatile uint16_t AIN0OV : 1; - volatile uint16_t AIN0UV : 1; - volatile uint16_t AIN1OV : 1; - volatile uint16_t AIN1UV : 1; - volatile uint16_t AIN2OV : 1; - volatile uint16_t AIN2UV : 1; - volatile uint16_t AIN3OV : 1; - volatile uint16_t AIN3UV : 1; - volatile uint16_t ALARMIN : 1; - volatile uint16_t WAKEUPIN : 1; - volatile uint16_t BALRDY : 1; - volatile uint16_t SYSFLTEVT : 1; - volatile uint16_t reserved0 : 1; - } B; -} mc33775_event_handling_registers_feh_alarm_out_reason_t; - -/* -------------------------------------------------------------------------- - * FEH_WAKEUP_CFG (read-write):Wake up source configuration. - * -------------------------------------------------------------------------- */ -#define MC33775_FEH_WAKEUP_CFG_OFFSET (0x408U) -#define MC33775_FEH_WAKEUP_CFG_RW_MSK (0xFFFFU) -#define MC33775_FEH_WAKEUP_CFG_RD_MSK (0xFFFFU) -#define MC33775_FEH_WAKEUP_CFG_WR_MSK (0xFFFFU) -#define MC33775_FEH_WAKEUP_CFG_MW_MSK (0x0U) -#define MC33775_FEH_WAKEUP_CFG_RA_MSK (0x0U) -#define MC33775_FEH_WAKEUP_CFG_POR_MSK (0xffffU) -#define MC33775_FEH_WAKEUP_CFG_POR_VAL (0x0U) - -/* Field VCOV: Enable wakeup on VC_OV. */ -#define MC33775_FEH_WAKEUP_CFG_VCOV_POS (0U) -#define MC33775_FEH_WAKEUP_CFG_VCOV_MSK (0x1U) - -/* Enumerated value DISABLED: disabled */ -#define MC33775_FEH_WAKEUP_CFG_VCOV_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: enabled */ -#define MC33775_FEH_WAKEUP_CFG_VCOV_ENABLED_ENUM_VAL (1U) - -/* Field VCUV0: Enable wakeup on VC_UV0. */ -#define MC33775_FEH_WAKEUP_CFG_VCUV0_POS (1U) -#define MC33775_FEH_WAKEUP_CFG_VCUV0_MSK (0x2U) - -/* Enumerated value DISABLED: disabled */ -#define MC33775_FEH_WAKEUP_CFG_VCUV0_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: enabled */ -#define MC33775_FEH_WAKEUP_CFG_VCUV0_ENABLED_ENUM_VAL (1U) - -/* Field VCUV1: Enable wakeup on VC_UV1. */ -#define MC33775_FEH_WAKEUP_CFG_VCUV1_POS (2U) -#define MC33775_FEH_WAKEUP_CFG_VCUV1_MSK (0x4U) - -/* Enumerated value DISABLED: disabled */ -#define MC33775_FEH_WAKEUP_CFG_VCUV1_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: enabled */ -#define MC33775_FEH_WAKEUP_CFG_VCUV1_ENABLED_ENUM_VAL (1U) - -/* Field AIN0OV: Enable wakeup on AIN0_OV. */ -#define MC33775_FEH_WAKEUP_CFG_AIN0OV_POS (3U) -#define MC33775_FEH_WAKEUP_CFG_AIN0OV_MSK (0x8U) - -/* Enumerated value DISABLED: disabled */ -#define MC33775_FEH_WAKEUP_CFG_AIN0OV_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: enabled */ -#define MC33775_FEH_WAKEUP_CFG_AIN0OV_ENABLED_ENUM_VAL (1U) - -/* Field AIN0UV: Enable wakeup on AIN0_UV. */ -#define MC33775_FEH_WAKEUP_CFG_AIN0UV_POS (4U) -#define MC33775_FEH_WAKEUP_CFG_AIN0UV_MSK (0x10U) - -/* Enumerated value DISABLED: disabled */ -#define MC33775_FEH_WAKEUP_CFG_AIN0UV_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: enabled */ -#define MC33775_FEH_WAKEUP_CFG_AIN0UV_ENABLED_ENUM_VAL (1U) - -/* Field AIN1OV: Enable wakeup on AIN1_OV. */ -#define MC33775_FEH_WAKEUP_CFG_AIN1OV_POS (5U) -#define MC33775_FEH_WAKEUP_CFG_AIN1OV_MSK (0x20U) - -/* Enumerated value DISABLED: disabled */ -#define MC33775_FEH_WAKEUP_CFG_AIN1OV_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: enabled */ -#define MC33775_FEH_WAKEUP_CFG_AIN1OV_ENABLED_ENUM_VAL (1U) - -/* Field AIN1UV: Enable wakeup on AIN1_UV. */ -#define MC33775_FEH_WAKEUP_CFG_AIN1UV_POS (6U) -#define MC33775_FEH_WAKEUP_CFG_AIN1UV_MSK (0x40U) - -/* Enumerated value DISABLED: disabled */ -#define MC33775_FEH_WAKEUP_CFG_AIN1UV_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: enabled */ -#define MC33775_FEH_WAKEUP_CFG_AIN1UV_ENABLED_ENUM_VAL (1U) - -/* Field AIN2OV: Enable wakeup on AIN2_OV. */ -#define MC33775_FEH_WAKEUP_CFG_AIN2OV_POS (7U) -#define MC33775_FEH_WAKEUP_CFG_AIN2OV_MSK (0x80U) - -/* Enumerated value DISABLED: disabled */ -#define MC33775_FEH_WAKEUP_CFG_AIN2OV_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: enabled */ -#define MC33775_FEH_WAKEUP_CFG_AIN2OV_ENABLED_ENUM_VAL (1U) - -/* Field AIN2UV: Enable wakeup on AIN2_UV. */ -#define MC33775_FEH_WAKEUP_CFG_AIN2UV_POS (8U) -#define MC33775_FEH_WAKEUP_CFG_AIN2UV_MSK (0x100U) - -/* Enumerated value DISABLED: disabled */ -#define MC33775_FEH_WAKEUP_CFG_AIN2UV_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: enabled */ -#define MC33775_FEH_WAKEUP_CFG_AIN2UV_ENABLED_ENUM_VAL (1U) - -/* Field AIN3OV: Enable wakeup on AIN3_OV. */ -#define MC33775_FEH_WAKEUP_CFG_AIN3OV_POS (9U) -#define MC33775_FEH_WAKEUP_CFG_AIN3OV_MSK (0x200U) - -/* Enumerated value DISABLED: disabled */ -#define MC33775_FEH_WAKEUP_CFG_AIN3OV_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: enabled */ -#define MC33775_FEH_WAKEUP_CFG_AIN3OV_ENABLED_ENUM_VAL (1U) - -/* Field AIN3UV: Enable wakeup on AIN3_UV. */ -#define MC33775_FEH_WAKEUP_CFG_AIN3UV_POS (10U) -#define MC33775_FEH_WAKEUP_CFG_AIN3UV_MSK (0x400U) - -/* Enumerated value DISABLED: disabled */ -#define MC33775_FEH_WAKEUP_CFG_AIN3UV_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: enabled */ -#define MC33775_FEH_WAKEUP_CFG_AIN3UV_ENABLED_ENUM_VAL (1U) - -/* Field ALARMIN: Enable wakeup on detected alarm input */ -#define MC33775_FEH_WAKEUP_CFG_ALARMIN_POS (11U) -#define MC33775_FEH_WAKEUP_CFG_ALARMIN_MSK (0x800U) - -/* Enumerated value DISABLED: disabled */ -#define MC33775_FEH_WAKEUP_CFG_ALARMIN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: enabled */ -#define MC33775_FEH_WAKEUP_CFG_ALARMIN_ENABLED_ENUM_VAL (1U) - -/* Field WAKEUPIN: Enable wakeup on detected wakeup input. Enabling this bit automatically enables the digital receiver for wake-up input 0. */ -#define MC33775_FEH_WAKEUP_CFG_WAKEUPIN_POS (12U) -#define MC33775_FEH_WAKEUP_CFG_WAKEUPIN_MSK (0x1000U) - -/* Enumerated value DISABLED: disabled */ -#define MC33775_FEH_WAKEUP_CFG_WAKEUPIN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: enabled */ -#define MC33775_FEH_WAKEUP_CFG_WAKEUPIN_ENABLED_ENUM_VAL (1U) - -/* Field BALRDY: Enable wakeup on cell voltage balancing ready. */ -#define MC33775_FEH_WAKEUP_CFG_BALRDY_POS (13U) -#define MC33775_FEH_WAKEUP_CFG_BALRDY_MSK (0x2000U) - -/* Enumerated value DISABLED: disabled */ -#define MC33775_FEH_WAKEUP_CFG_BALRDY_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: enabled */ -#define MC33775_FEH_WAKEUP_CFG_BALRDY_ENABLED_ENUM_VAL (1U) - -/* Field SYSFLTEVT: Enable wakeup on a detected system fault. */ -#define MC33775_FEH_WAKEUP_CFG_SYSFLTEVT_POS (14U) -#define MC33775_FEH_WAKEUP_CFG_SYSFLTEVT_MSK (0x4000U) - -/* Enumerated value DISABLED: disabled */ -#define MC33775_FEH_WAKEUP_CFG_SYSFLTEVT_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: enabled */ -#define MC33775_FEH_WAKEUP_CFG_SYSFLTEVT_ENABLED_ENUM_VAL (1U) - -/* Field TPLWAKEUP: Wake TPL */ -#define MC33775_FEH_WAKEUP_CFG_TPLWAKEUP_POS (15U) -#define MC33775_FEH_WAKEUP_CFG_TPLWAKEUP_MSK (0x8000U) - -/* Enumerated value DISABLED: disabled */ -#define MC33775_FEH_WAKEUP_CFG_TPLWAKEUP_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: enabled. Device sends wake-up frames on TPL if wake-up reason was other than communication */ -#define MC33775_FEH_WAKEUP_CFG_TPLWAKEUP_ENABLED_ENUM_VAL (1U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VCOV : 1; - volatile uint16_t VCUV0 : 1; - volatile uint16_t VCUV1 : 1; - volatile uint16_t AIN0OV : 1; - volatile uint16_t AIN0UV : 1; - volatile uint16_t AIN1OV : 1; - volatile uint16_t AIN1UV : 1; - volatile uint16_t AIN2OV : 1; - volatile uint16_t AIN2UV : 1; - volatile uint16_t AIN3OV : 1; - volatile uint16_t AIN3UV : 1; - volatile uint16_t ALARMIN : 1; - volatile uint16_t WAKEUPIN : 1; - volatile uint16_t BALRDY : 1; - volatile uint16_t SYSFLTEVT : 1; - volatile uint16_t TPLWAKEUP : 1; - } B; -} mc33775_event_handling_registers_feh_wakeup_cfg_t; - -/* -------------------------------------------------------------------------- - * FEH_WAKEUP_REASON (read-only):Wake up reason register. - * -------------------------------------------------------------------------- */ -#define MC33775_FEH_WAKEUP_REASON_OFFSET (0x409U) -#define MC33775_FEH_WAKEUP_REASON_RW_MSK (0x0U) -#define MC33775_FEH_WAKEUP_REASON_RD_MSK (0xFFFFU) -#define MC33775_FEH_WAKEUP_REASON_WR_MSK (0x0U) -#define MC33775_FEH_WAKEUP_REASON_MW_MSK (0x0U) -#define MC33775_FEH_WAKEUP_REASON_RA_MSK (0xFFFFU) -#define MC33775_FEH_WAKEUP_REASON_POR_MSK (0xffffU) -#define MC33775_FEH_WAKEUP_REASON_POR_VAL (0x0U) - -/* Field VCOV: VC_OV */ -#define MC33775_FEH_WAKEUP_REASON_VCOV_POS (0U) -#define MC33775_FEH_WAKEUP_REASON_VCOV_MSK (0x1U) - -/* Enumerated value NO_WAKE: Wakeup not caused by VC_OV */ -#define MC33775_FEH_WAKEUP_REASON_VCOV_NO_WAKE_ENUM_VAL (0U) - -/* Enumerated value WAKE_UP: Wakeup caused by VC_OV */ -#define MC33775_FEH_WAKEUP_REASON_VCOV_WAKE_UP_ENUM_VAL (1U) - -/* Field VCUV0: VC_UV0 */ -#define MC33775_FEH_WAKEUP_REASON_VCUV0_POS (1U) -#define MC33775_FEH_WAKEUP_REASON_VCUV0_MSK (0x2U) - -/* Enumerated value NO_WAKE: Wakeup not caused by VC_UV0 */ -#define MC33775_FEH_WAKEUP_REASON_VCUV0_NO_WAKE_ENUM_VAL (0U) - -/* Enumerated value WAKE_UP: Wakeup caused by VC_UV0 */ -#define MC33775_FEH_WAKEUP_REASON_VCUV0_WAKE_UP_ENUM_VAL (1U) - -/* Field VCUV1: VC_UV1 */ -#define MC33775_FEH_WAKEUP_REASON_VCUV1_POS (2U) -#define MC33775_FEH_WAKEUP_REASON_VCUV1_MSK (0x4U) - -/* Enumerated value NO_WAKE: Wakeup not caused by VC_UV1 */ -#define MC33775_FEH_WAKEUP_REASON_VCUV1_NO_WAKE_ENUM_VAL (0U) - -/* Enumerated value WAKE_UP: Wakeup caused by VC_UV1 */ -#define MC33775_FEH_WAKEUP_REASON_VCUV1_WAKE_UP_ENUM_VAL (1U) - -/* Field AIN0OV: AIN0_OV */ -#define MC33775_FEH_WAKEUP_REASON_AIN0OV_POS (3U) -#define MC33775_FEH_WAKEUP_REASON_AIN0OV_MSK (0x8U) - -/* Enumerated value NO_WAKE: Wakeup not caused by AIN0_OV */ -#define MC33775_FEH_WAKEUP_REASON_AIN0OV_NO_WAKE_ENUM_VAL (0U) - -/* Enumerated value WAKE_UP: Wakeup caused by AIN0_OV */ -#define MC33775_FEH_WAKEUP_REASON_AIN0OV_WAKE_UP_ENUM_VAL (1U) - -/* Field AIN0UV: AIN0_UV */ -#define MC33775_FEH_WAKEUP_REASON_AIN0UV_POS (4U) -#define MC33775_FEH_WAKEUP_REASON_AIN0UV_MSK (0x10U) - -/* Enumerated value NO_WAKE: Wakeup not caused by AIN0_UV */ -#define MC33775_FEH_WAKEUP_REASON_AIN0UV_NO_WAKE_ENUM_VAL (0U) - -/* Enumerated value WAKE_UP: Wakeup caused by AIN0_UV */ -#define MC33775_FEH_WAKEUP_REASON_AIN0UV_WAKE_UP_ENUM_VAL (1U) - -/* Field AIN1OV: AIN1_OV */ -#define MC33775_FEH_WAKEUP_REASON_AIN1OV_POS (5U) -#define MC33775_FEH_WAKEUP_REASON_AIN1OV_MSK (0x20U) - -/* Enumerated value NO_WAKE: Wakeup not caused by AIN1_OV */ -#define MC33775_FEH_WAKEUP_REASON_AIN1OV_NO_WAKE_ENUM_VAL (0U) - -/* Enumerated value WAKE_UP: Wakeup caused by AIN1_OV */ -#define MC33775_FEH_WAKEUP_REASON_AIN1OV_WAKE_UP_ENUM_VAL (1U) - -/* Field AIN1UV: AIN1_UV */ -#define MC33775_FEH_WAKEUP_REASON_AIN1UV_POS (6U) -#define MC33775_FEH_WAKEUP_REASON_AIN1UV_MSK (0x40U) - -/* Enumerated value NO_WAKE: Wakeup not caused by AIN1_UV */ -#define MC33775_FEH_WAKEUP_REASON_AIN1UV_NO_WAKE_ENUM_VAL (0U) - -/* Enumerated value WAKE_UP: Wakeup caused by AIN1_UV */ -#define MC33775_FEH_WAKEUP_REASON_AIN1UV_WAKE_UP_ENUM_VAL (1U) - -/* Field AIN2OV: AIN2_OV */ -#define MC33775_FEH_WAKEUP_REASON_AIN2OV_POS (7U) -#define MC33775_FEH_WAKEUP_REASON_AIN2OV_MSK (0x80U) - -/* Enumerated value NO_WAKE: Wakeup not caused by AIN2_OV */ -#define MC33775_FEH_WAKEUP_REASON_AIN2OV_NO_WAKE_ENUM_VAL (0U) - -/* Enumerated value WAKE_UP: Wakeup caused by AIN2_OV */ -#define MC33775_FEH_WAKEUP_REASON_AIN2OV_WAKE_UP_ENUM_VAL (1U) - -/* Field AIN2UV: AIN2_UV */ -#define MC33775_FEH_WAKEUP_REASON_AIN2UV_POS (8U) -#define MC33775_FEH_WAKEUP_REASON_AIN2UV_MSK (0x100U) - -/* Enumerated value NO_WAKE: Wakeup not caused by AIN2_UV */ -#define MC33775_FEH_WAKEUP_REASON_AIN2UV_NO_WAKE_ENUM_VAL (0U) - -/* Enumerated value WAKE_UP: Wakeup caused by AIN2_UV */ -#define MC33775_FEH_WAKEUP_REASON_AIN2UV_WAKE_UP_ENUM_VAL (1U) - -/* Field AIN3OV: AIN3_OV */ -#define MC33775_FEH_WAKEUP_REASON_AIN3OV_POS (9U) -#define MC33775_FEH_WAKEUP_REASON_AIN3OV_MSK (0x200U) - -/* Enumerated value NO_WAKE: Wakeup not caused by AIN3_OV */ -#define MC33775_FEH_WAKEUP_REASON_AIN3OV_NO_WAKE_ENUM_VAL (0U) - -/* Enumerated value WAKE_UP: Wakeup caused by AIN3_OV */ -#define MC33775_FEH_WAKEUP_REASON_AIN3OV_WAKE_UP_ENUM_VAL (1U) - -/* Field AIN3UV: AIN3_UV */ -#define MC33775_FEH_WAKEUP_REASON_AIN3UV_POS (10U) -#define MC33775_FEH_WAKEUP_REASON_AIN3UV_MSK (0x400U) - -/* Enumerated value NO_WAKE: Wakeup not caused by AIN3_UV */ -#define MC33775_FEH_WAKEUP_REASON_AIN3UV_NO_WAKE_ENUM_VAL (0U) - -/* Enumerated value WAKE_UP: Wakeup caused by AIN3_UV */ -#define MC33775_FEH_WAKEUP_REASON_AIN3UV_WAKE_UP_ENUM_VAL (1U) - -/* Field ALARMIN: Detected alarm input */ -#define MC33775_FEH_WAKEUP_REASON_ALARMIN_POS (11U) -#define MC33775_FEH_WAKEUP_REASON_ALARMIN_MSK (0x800U) - -/* Enumerated value NO_WAKE: Wakeup not caused by detected Wakeup input */ -#define MC33775_FEH_WAKEUP_REASON_ALARMIN_NO_WAKE_ENUM_VAL (0U) - -/* Enumerated value WAKE_UP: Wakeup caused by detected Wakeup input */ -#define MC33775_FEH_WAKEUP_REASON_ALARMIN_WAKE_UP_ENUM_VAL (1U) - -/* Field WAKEUPIN: Detected wakeup input */ -#define MC33775_FEH_WAKEUP_REASON_WAKEUPIN_POS (12U) -#define MC33775_FEH_WAKEUP_REASON_WAKEUPIN_MSK (0x1000U) - -/* Enumerated value NO_WAKE: Wakeup not caused by detected wakeup input */ -#define MC33775_FEH_WAKEUP_REASON_WAKEUPIN_NO_WAKE_ENUM_VAL (0U) - -/* Enumerated value WAKE_UP: Wakeup caused by detected wakeup input */ -#define MC33775_FEH_WAKEUP_REASON_WAKEUPIN_WAKE_UP_ENUM_VAL (1U) - -/* Field BALRDY: Cell voltage balancing ready */ -#define MC33775_FEH_WAKEUP_REASON_BALRDY_POS (13U) -#define MC33775_FEH_WAKEUP_REASON_BALRDY_MSK (0x2000U) - -/* Enumerated value NO_WAKE: Wakeup not caused by cell voltage balancing ready */ -#define MC33775_FEH_WAKEUP_REASON_BALRDY_NO_WAKE_ENUM_VAL (0U) - -/* Enumerated value WAKE_UP: Wakeup caused by cell voltage balancing ready */ -#define MC33775_FEH_WAKEUP_REASON_BALRDY_WAKE_UP_ENUM_VAL (1U) - -/* Field SYSFLTEVT: Detected system fault. */ -#define MC33775_FEH_WAKEUP_REASON_SYSFLTEVT_POS (14U) -#define MC33775_FEH_WAKEUP_REASON_SYSFLTEVT_MSK (0x4000U) - -/* Enumerated value NO_WAKE: Wakeup not caused by detected system fault */ -#define MC33775_FEH_WAKEUP_REASON_SYSFLTEVT_NO_WAKE_ENUM_VAL (0U) - -/* Enumerated value WAKE_UP: Wakeup caused by detected system fault */ -#define MC33775_FEH_WAKEUP_REASON_SYSFLTEVT_WAKE_UP_ENUM_VAL (1U) - -/* Field COMM: Communication detected */ -#define MC33775_FEH_WAKEUP_REASON_COMM_POS (15U) -#define MC33775_FEH_WAKEUP_REASON_COMM_MSK (0x8000U) - -/* Enumerated value NO_WAKE: Wakeup not caused by detected communication */ -#define MC33775_FEH_WAKEUP_REASON_COMM_NO_WAKE_ENUM_VAL (0U) - -/* Enumerated value WAKE_UP: Wakeup caused by detected communication */ -#define MC33775_FEH_WAKEUP_REASON_COMM_WAKE_UP_ENUM_VAL (1U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VCOV : 1; - volatile uint16_t VCUV0 : 1; - volatile uint16_t VCUV1 : 1; - volatile uint16_t AIN0OV : 1; - volatile uint16_t AIN0UV : 1; - volatile uint16_t AIN1OV : 1; - volatile uint16_t AIN1UV : 1; - volatile uint16_t AIN2OV : 1; - volatile uint16_t AIN2UV : 1; - volatile uint16_t AIN3OV : 1; - volatile uint16_t AIN3UV : 1; - volatile uint16_t ALARMIN : 1; - volatile uint16_t WAKEUPIN : 1; - volatile uint16_t BALRDY : 1; - volatile uint16_t SYSFLTEVT : 1; - volatile uint16_t COMM : 1; - } B; -} mc33775_event_handling_registers_feh_wakeup_reason_t; - -/* -------------------------------------------------------------------------- - * FEH_MON_BIST_CTRL (read-write):Monitor BIST control register. - * -------------------------------------------------------------------------- */ -#define MC33775_FEH_MON_BIST_CTRL_OFFSET (0x410U) -#define MC33775_FEH_MON_BIST_CTRL_RW_MSK (0xFFFEU) -#define MC33775_FEH_MON_BIST_CTRL_RD_MSK (0xFFFEU) -#define MC33775_FEH_MON_BIST_CTRL_WR_MSK (0xFFFFU) -#define MC33775_FEH_MON_BIST_CTRL_MW_MSK (0x0U) -#define MC33775_FEH_MON_BIST_CTRL_RA_MSK (0x0U) -#define MC33775_FEH_MON_BIST_CTRL_POR_MSK (0xffffU) -#define MC33775_FEH_MON_BIST_CTRL_POR_VAL (0x0U) - -/* Field STARTBIST: Start BIST of all supply monitors, including VAUXOV, VAUXUV, VDDCOV and VDDCUV, which are not run at start-up. If the BIST is executed while measurements are running, some created secondary measurement results might be invalid. Read as zero. */ -#define MC33775_FEH_MON_BIST_CTRL_STARTBIST_POS (0U) -#define MC33775_FEH_MON_BIST_CTRL_STARTBIST_MSK (0x1U) - -/* Enumerated value NO_START: Do not start BIST */ -#define MC33775_FEH_MON_BIST_CTRL_STARTBIST_NO_START_ENUM_VAL (0U) - -/* Enumerated value STATUS: Read as zero. */ -#define MC33775_FEH_MON_BIST_CTRL_STARTBIST_STATUS_ENUM_VAL (0U) - -/* Enumerated value START: Start BIST */ -#define MC33775_FEH_MON_BIST_CTRL_STARTBIST_START_ENUM_VAL (1U) - -/* Field BISTCRC: CRC of the sequential BIST results. The value is different for the automatic BIST after start-up and a manual started BIST, as more monitors are then included. */ -#define MC33775_FEH_MON_BIST_CTRL_BISTCRC_POS (1U) -#define MC33775_FEH_MON_BIST_CTRL_BISTCRC_MSK (0xFFFEU) - -/* Enumerated value STARTUP: Value TBD represents correct CRC value for start-up BIST */ -#define MC33775_FEH_MON_BIST_CTRL_BISTCRC_STARTUP_ENUM_VAL (0U) - -/* Enumerated value MANUAL: Value TBD represents correct CRC value for manual started BIST */ -#define MC33775_FEH_MON_BIST_CTRL_BISTCRC_MANUAL_ENUM_VAL (1U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t STARTBIST : 1; - volatile uint16_t BISTCRC : 15; - } B; -} mc33775_event_handling_registers_feh_mon_bist_ctrl_t; - -/* -------------------------------------------------------------------------- - * FEH_MON_BIST_RES (read-only):Monitor BIST result register. Note: value will change at start-up, if everything is fine to 0x0000. - * -------------------------------------------------------------------------- */ -#define MC33775_FEH_MON_BIST_RES_OFFSET (0x411U) -#define MC33775_FEH_MON_BIST_RES_RW_MSK (0x0U) -#define MC33775_FEH_MON_BIST_RES_RD_MSK (0x3FFFU) -#define MC33775_FEH_MON_BIST_RES_WR_MSK (0x0U) -#define MC33775_FEH_MON_BIST_RES_MW_MSK (0x0U) -#define MC33775_FEH_MON_BIST_RES_RA_MSK (0x0U) -#define MC33775_FEH_MON_BIST_RES_POR_MSK (0xffffU) -#define MC33775_FEH_MON_BIST_RES_POR_VAL (0x3ffU) - -/* Field VBATOV: VBAT Supply over-voltage BIST failed. */ -#define MC33775_FEH_MON_BIST_RES_VBATOV_POS (0U) -#define MC33775_FEH_MON_BIST_RES_VBATOV_MSK (0x1U) - -/* Enumerated value PASS: BIST passed */ -#define MC33775_FEH_MON_BIST_RES_VBATOV_PASS_ENUM_VAL (0U) - -/* Enumerated value FAIL: BIST failed */ -#define MC33775_FEH_MON_BIST_RES_VBATOV_FAIL_ENUM_VAL (1U) - -/* Field VDDAOV: VDDA Supply over-voltage BIST failed. */ -#define MC33775_FEH_MON_BIST_RES_VDDAOV_POS (1U) -#define MC33775_FEH_MON_BIST_RES_VDDAOV_MSK (0x2U) - -/* Enumerated value PASS: BIST passed */ -#define MC33775_FEH_MON_BIST_RES_VDDAOV_PASS_ENUM_VAL (0U) - -/* Enumerated value FAIL: BIST failed */ -#define MC33775_FEH_MON_BIST_RES_VDDAOV_FAIL_ENUM_VAL (1U) - -/* Field VDDAUV: VDDA Supply under-voltage BIST failed. */ -#define MC33775_FEH_MON_BIST_RES_VDDAUV_POS (2U) -#define MC33775_FEH_MON_BIST_RES_VDDAUV_MSK (0x4U) - -/* Enumerated value PASS: BIST passed */ -#define MC33775_FEH_MON_BIST_RES_VDDAUV_PASS_ENUM_VAL (0U) - -/* Enumerated value FAIL: BIST failed */ -#define MC33775_FEH_MON_BIST_RES_VDDAUV_FAIL_ENUM_VAL (1U) - -/* Field V2P5AOV: V2P5A over-voltage BIST failed. */ -#define MC33775_FEH_MON_BIST_RES_V2P5AOV_POS (3U) -#define MC33775_FEH_MON_BIST_RES_V2P5AOV_MSK (0x8U) - -/* Enumerated value PASS: BIST passed */ -#define MC33775_FEH_MON_BIST_RES_V2P5AOV_PASS_ENUM_VAL (0U) - -/* Enumerated value FAIL: BIST failed */ -#define MC33775_FEH_MON_BIST_RES_V2P5AOV_FAIL_ENUM_VAL (1U) - -/* Field V2P5AUV: V2P5A under-voltage BIST failed. */ -#define MC33775_FEH_MON_BIST_RES_V2P5AUV_POS (4U) -#define MC33775_FEH_MON_BIST_RES_V2P5AUV_MSK (0x10U) - -/* Enumerated value PASS: BIST passed */ -#define MC33775_FEH_MON_BIST_RES_V2P5AUV_PASS_ENUM_VAL (0U) - -/* Enumerated value FAIL: BIST failed */ -#define MC33775_FEH_MON_BIST_RES_V2P5AUV_FAIL_ENUM_VAL (1U) - -/* Field AFECPOV: Analog Frontend Charge Pump over-voltage BIST failed. */ -#define MC33775_FEH_MON_BIST_RES_AFECPOV_POS (5U) -#define MC33775_FEH_MON_BIST_RES_AFECPOV_MSK (0x20U) - -/* Enumerated value PASS: BIST passed */ -#define MC33775_FEH_MON_BIST_RES_AFECPOV_PASS_ENUM_VAL (0U) - -/* Enumerated value FAIL: BIST failed */ -#define MC33775_FEH_MON_BIST_RES_AFECPOV_FAIL_ENUM_VAL (1U) - -/* Field AFECPUV: Analog Frontend Charge Pump under-voltage BIST failed. */ -#define MC33775_FEH_MON_BIST_RES_AFECPUV_POS (6U) -#define MC33775_FEH_MON_BIST_RES_AFECPUV_MSK (0x40U) - -/* Enumerated value PASS: BIST passed */ -#define MC33775_FEH_MON_BIST_RES_AFECPUV_PASS_ENUM_VAL (0U) - -/* Enumerated value FAIL: BIST failed */ -#define MC33775_FEH_MON_BIST_RES_AFECPUV_FAIL_ENUM_VAL (1U) - -/* Field IBIASPERMOC: IBIAS_PERM over-current BIST failed. */ -#define MC33775_FEH_MON_BIST_RES_IBIASPERMOC_POS (7U) -#define MC33775_FEH_MON_BIST_RES_IBIASPERMOC_MSK (0x80U) - -/* Enumerated value PASS: BIST passed */ -#define MC33775_FEH_MON_BIST_RES_IBIASPERMOC_PASS_ENUM_VAL (0U) - -/* Enumerated value FAIL: BIST failed */ -#define MC33775_FEH_MON_BIST_RES_IBIASPERMOC_FAIL_ENUM_VAL (1U) - -/* Field IBIASPERMUC: IBIAS_PERM under-current BIST failed. */ -#define MC33775_FEH_MON_BIST_RES_IBIASPERMUC_POS (8U) -#define MC33775_FEH_MON_BIST_RES_IBIASPERMUC_MSK (0x100U) - -/* Enumerated value PASS: BIST passed */ -#define MC33775_FEH_MON_BIST_RES_IBIASPERMUC_PASS_ENUM_VAL (0U) - -/* Enumerated value FAIL: BIST failed */ -#define MC33775_FEH_MON_BIST_RES_IBIASPERMUC_FAIL_ENUM_VAL (1U) - -/* Field VPREREFSUV: VPREREFSUV Supply under-voltage BIST failed. */ -#define MC33775_FEH_MON_BIST_RES_VPREREFSUV_POS (9U) -#define MC33775_FEH_MON_BIST_RES_VPREREFSUV_MSK (0x200U) - -/* Enumerated value PASS: BIST passed */ -#define MC33775_FEH_MON_BIST_RES_VPREREFSUV_PASS_ENUM_VAL (0U) - -/* Enumerated value FAIL: BIST failed */ -#define MC33775_FEH_MON_BIST_RES_VPREREFSUV_FAIL_ENUM_VAL (1U) - -/* Field VAUXOV: VAUX Supply over-voltage BIST failed. Not part of start-up BIST, only executed for manual BIST execution. */ -#define MC33775_FEH_MON_BIST_RES_VAUXOV_POS (10U) -#define MC33775_FEH_MON_BIST_RES_VAUXOV_MSK (0x400U) - -/* Enumerated value PASS: BIST passed */ -#define MC33775_FEH_MON_BIST_RES_VAUXOV_PASS_ENUM_VAL (0U) - -/* Enumerated value FAIL: BIST failed */ -#define MC33775_FEH_MON_BIST_RES_VAUXOV_FAIL_ENUM_VAL (1U) - -/* Field VAUXUV: VAUX Supply under-voltage BIST failed. Not part of start-up BIST, only executed for manual BIST execution. */ -#define MC33775_FEH_MON_BIST_RES_VAUXUV_POS (11U) -#define MC33775_FEH_MON_BIST_RES_VAUXUV_MSK (0x800U) - -/* Enumerated value PASS: BIST passed */ -#define MC33775_FEH_MON_BIST_RES_VAUXUV_PASS_ENUM_VAL (0U) - -/* Enumerated value FAIL: BIST failed */ -#define MC33775_FEH_MON_BIST_RES_VAUXUV_FAIL_ENUM_VAL (1U) - -/* Field VDDCOV: VDDC Supply over-voltage BIST failed. Not part of start-up BIST, only executed for manual BIST execution. */ -#define MC33775_FEH_MON_BIST_RES_VDDCOV_POS (12U) -#define MC33775_FEH_MON_BIST_RES_VDDCOV_MSK (0x1000U) - -/* Enumerated value PASS: BIST passed */ -#define MC33775_FEH_MON_BIST_RES_VDDCOV_PASS_ENUM_VAL (0U) - -/* Enumerated value FAIL: BIST failed */ -#define MC33775_FEH_MON_BIST_RES_VDDCOV_FAIL_ENUM_VAL (1U) - -/* Field VDDCUV: VDDC Supply under-voltage BIST failed. Not part of start-up BIST, only executed for manual BIST execution. */ -#define MC33775_FEH_MON_BIST_RES_VDDCUV_POS (13U) -#define MC33775_FEH_MON_BIST_RES_VDDCUV_MSK (0x2000U) - -/* Enumerated value PASS: BIST passed */ -#define MC33775_FEH_MON_BIST_RES_VDDCUV_PASS_ENUM_VAL (0U) - -/* Enumerated value FAIL: BIST failed */ -#define MC33775_FEH_MON_BIST_RES_VDDCUV_FAIL_ENUM_VAL (1U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_FEH_MON_BIST_RES_RESERVED0_POS (14U) -#define MC33775_FEH_MON_BIST_RES_RESERVED0_MSK (0xC000U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VBATOV : 1; - volatile uint16_t VDDAOV : 1; - volatile uint16_t VDDAUV : 1; - volatile uint16_t V2P5AOV : 1; - volatile uint16_t V2P5AUV : 1; - volatile uint16_t AFECPOV : 1; - volatile uint16_t AFECPUV : 1; - volatile uint16_t IBIASPERMOC : 1; - volatile uint16_t IBIASPERMUC : 1; - volatile uint16_t VPREREFSUV : 1; - volatile uint16_t VAUXOV : 1; - volatile uint16_t VAUXUV : 1; - volatile uint16_t VDDCOV : 1; - volatile uint16_t VDDCUV : 1; - volatile uint16_t reserved0 : 2; - } B; -} mc33775_event_handling_registers_feh_mon_bist_res_t; - -/* -------------------------------------------------------------------------- - * FEH_ACC_ERR (read-only):Access error status register - * -------------------------------------------------------------------------- */ -#define MC33775_FEH_ACC_ERR_OFFSET (0x41EU) -#define MC33775_FEH_ACC_ERR_RW_MSK (0x0U) -#define MC33775_FEH_ACC_ERR_RD_MSK (0xFFFFU) -#define MC33775_FEH_ACC_ERR_WR_MSK (0x0U) -#define MC33775_FEH_ACC_ERR_MW_MSK (0x0U) -#define MC33775_FEH_ACC_ERR_RA_MSK (0xFFFFU) -#define MC33775_FEH_ACC_ERR_POR_MSK (0xffffU) -#define MC33775_FEH_ACC_ERR_POR_VAL (0x0U) - -/* Field ERRADD: Address of the last access which created an access error */ -#define MC33775_FEH_ACC_ERR_ERRADD_POS (0U) -#define MC33775_FEH_ACC_ERR_ERRADD_MSK (0x3FFFU) - -/* Field ERRACC: Access type of the last access error */ -#define MC33775_FEH_ACC_ERR_ERRACC_POS (14U) -#define MC33775_FEH_ACC_ERR_ERRACC_MSK (0x4000U) - -/* Enumerated value READ: Last error occurred during a read access */ -#define MC33775_FEH_ACC_ERR_ERRACC_READ_ENUM_VAL (0U) - -/* Enumerated value WRITE: Last error occurred during a write access */ -#define MC33775_FEH_ACC_ERR_ERRACC_WRITE_ENUM_VAL (1U) - -/* Field ERRSTAT: Access error status */ -#define MC33775_FEH_ACC_ERR_ERRSTAT_POS (15U) -#define MC33775_FEH_ACC_ERR_ERRSTAT_MSK (0x8000U) - -/* Enumerated value NO_ERROR: No error occurred */ -#define MC33775_FEH_ACC_ERR_ERRSTAT_NO_ERROR_ENUM_VAL (0U) - -/* Enumerated value ERROR: Access error has occurred */ -#define MC33775_FEH_ACC_ERR_ERRSTAT_ERROR_ENUM_VAL (1U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t ERRADD : 14; - volatile uint16_t ERRACC : 1; - volatile uint16_t ERRSTAT : 1; - } B; -} mc33775_event_handling_registers_feh_acc_err_t; - -/* -------------------------------------------------------------------------- - * FEH_GRP_FLT_STAT (read-only):Main system fault status register. this register holds one bit per fault group. For each fault group a separate status register exists. The bit here is cleared if all its sources are cleared. - * -------------------------------------------------------------------------- */ -#define MC33775_FEH_GRP_FLT_STAT_OFFSET (0x41FU) -#define MC33775_FEH_GRP_FLT_STAT_RW_MSK (0x0U) -#define MC33775_FEH_GRP_FLT_STAT_RD_MSK (0xFU) -#define MC33775_FEH_GRP_FLT_STAT_WR_MSK (0x0U) -#define MC33775_FEH_GRP_FLT_STAT_MW_MSK (0x0U) -#define MC33775_FEH_GRP_FLT_STAT_RA_MSK (0x0U) -#define MC33775_FEH_GRP_FLT_STAT_POR_MSK (0xffffU) -#define MC33775_FEH_GRP_FLT_STAT_POR_VAL (0x0U) - -/* Field SUPPLYFLT: Internal/external supply fault status */ -#define MC33775_FEH_GRP_FLT_STAT_SUPPLYFLT_POS (0U) -#define MC33775_FEH_GRP_FLT_STAT_SUPPLYFLT_MSK (0x1U) - -/* Enumerated value NO_ERROR: No supply error detected */ -#define MC33775_FEH_GRP_FLT_STAT_SUPPLYFLT_NO_ERROR_ENUM_VAL (0U) - -/* Enumerated value ERROR: Supply error detected */ -#define MC33775_FEH_GRP_FLT_STAT_SUPPLYFLT_ERROR_ENUM_VAL (1U) - -/* Field ANAFLT: Analog fault status */ -#define MC33775_FEH_GRP_FLT_STAT_ANAFLT_POS (1U) -#define MC33775_FEH_GRP_FLT_STAT_ANAFLT_MSK (0x2U) - -/* Enumerated value NO_ERROR: No analog fault detected */ -#define MC33775_FEH_GRP_FLT_STAT_ANAFLT_NO_ERROR_ENUM_VAL (0U) - -/* Enumerated value ERROR: Analog fault detected */ -#define MC33775_FEH_GRP_FLT_STAT_ANAFLT_ERROR_ENUM_VAL (1U) - -/* Field COMFLT: Communication fault status */ -#define MC33775_FEH_GRP_FLT_STAT_COMFLT_POS (2U) -#define MC33775_FEH_GRP_FLT_STAT_COMFLT_MSK (0x4U) - -/* Enumerated value NO_ERROR: No communication fault detected */ -#define MC33775_FEH_GRP_FLT_STAT_COMFLT_NO_ERROR_ENUM_VAL (0U) - -/* Enumerated value ERROR: Communication fault detected. */ -#define MC33775_FEH_GRP_FLT_STAT_COMFLT_ERROR_ENUM_VAL (1U) - -/* Field MEASFLT: Measurement fault status */ -#define MC33775_FEH_GRP_FLT_STAT_MEASFLT_POS (3U) -#define MC33775_FEH_GRP_FLT_STAT_MEASFLT_MSK (0x8U) - -/* Enumerated value NO_ERROR: No measurement fault detected */ -#define MC33775_FEH_GRP_FLT_STAT_MEASFLT_NO_ERROR_ENUM_VAL (0U) - -/* Enumerated value ERROR: Measurement fault detected */ -#define MC33775_FEH_GRP_FLT_STAT_MEASFLT_ERROR_ENUM_VAL (1U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_FEH_GRP_FLT_STAT_RESERVED0_POS (4U) -#define MC33775_FEH_GRP_FLT_STAT_RESERVED0_MSK (0xFFF0U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t SUPPLYFLT : 1; - volatile uint16_t ANAFLT : 1; - volatile uint16_t COMFLT : 1; - volatile uint16_t MEASFLT : 1; - volatile uint16_t reserved0 : 12; - } B; -} mc33775_event_handling_registers_feh_grp_flt_stat_t; - -/* -------------------------------------------------------------------------- - * FEH_SUPPLY_FLT_STAT0 (read-write):Supply fault status register 0 (these monitors are part of the BIST). - * -------------------------------------------------------------------------- */ -#define MC33775_FEH_SUPPLY_FLT_STAT0_OFFSET (0x420U) -#define MC33775_FEH_SUPPLY_FLT_STAT0_RW_MSK (0x3FFFU) -#define MC33775_FEH_SUPPLY_FLT_STAT0_RD_MSK (0x3FFFU) -#define MC33775_FEH_SUPPLY_FLT_STAT0_WR_MSK (0x3FFFU) -#define MC33775_FEH_SUPPLY_FLT_STAT0_MW_MSK (0x3FFFU) -#define MC33775_FEH_SUPPLY_FLT_STAT0_RA_MSK (0x0U) -#define MC33775_FEH_SUPPLY_FLT_STAT0_POR_MSK (0xffffU) -#define MC33775_FEH_SUPPLY_FLT_STAT0_POR_VAL (0x0U) - -/* Field VBATOV: VBAT Supply over-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_STAT0_VBATOV_POS (0U) -#define MC33775_FEH_SUPPLY_FLT_STAT0_VBATOV_MSK (0x1U) - -/* Enumerated value NO_OV: No VBAT Supply over-voltage detected. */ -#define MC33775_FEH_SUPPLY_FLT_STAT0_VBATOV_NO_OV_ENUM_VAL (0U) - -/* Enumerated value OV: VBAT Supply over-voltage detected. */ -#define MC33775_FEH_SUPPLY_FLT_STAT0_VBATOV_OV_ENUM_VAL (1U) - -/* Field VDDAOV: VDDA Supply over-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_STAT0_VDDAOV_POS (1U) -#define MC33775_FEH_SUPPLY_FLT_STAT0_VDDAOV_MSK (0x2U) - -/* Enumerated value NO_OV: No VDDA Supply over-voltage detected. */ -#define MC33775_FEH_SUPPLY_FLT_STAT0_VDDAOV_NO_OV_ENUM_VAL (0U) - -/* Enumerated value OV: VDDA Supply over-voltage detected. */ -#define MC33775_FEH_SUPPLY_FLT_STAT0_VDDAOV_OV_ENUM_VAL (1U) - -/* Field VDDAUV: VDDA Supply under-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_STAT0_VDDAUV_POS (2U) -#define MC33775_FEH_SUPPLY_FLT_STAT0_VDDAUV_MSK (0x4U) - -/* Enumerated value NO_UV: No VDDA Supply under-voltage detected. */ -#define MC33775_FEH_SUPPLY_FLT_STAT0_VDDAUV_NO_UV_ENUM_VAL (0U) - -/* Enumerated value UV: VDDA Supply under-voltage detected. */ -#define MC33775_FEH_SUPPLY_FLT_STAT0_VDDAUV_UV_ENUM_VAL (1U) - -/* Field V2P5AOV: V2P5A Supply over-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_STAT0_V2P5AOV_POS (3U) -#define MC33775_FEH_SUPPLY_FLT_STAT0_V2P5AOV_MSK (0x8U) - -/* Enumerated value NO_OV: No V2P5A Supply over-voltage detected. */ -#define MC33775_FEH_SUPPLY_FLT_STAT0_V2P5AOV_NO_OV_ENUM_VAL (0U) - -/* Enumerated value OV: V2P5A Supply over-voltage detected. */ -#define MC33775_FEH_SUPPLY_FLT_STAT0_V2P5AOV_OV_ENUM_VAL (1U) - -/* Field V2P5AUV: V2P5A Supply under-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_STAT0_V2P5AUV_POS (4U) -#define MC33775_FEH_SUPPLY_FLT_STAT0_V2P5AUV_MSK (0x10U) - -/* Enumerated value NO_UV: No V2P5A Supply under-voltage detected. */ -#define MC33775_FEH_SUPPLY_FLT_STAT0_V2P5AUV_NO_UV_ENUM_VAL (0U) - -/* Enumerated value UV: V2P5A Supply under-voltage detected. */ -#define MC33775_FEH_SUPPLY_FLT_STAT0_V2P5AUV_UV_ENUM_VAL (1U) - -/* Field AFECPOV: AFE Charge Pump over-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_STAT0_AFECPOV_POS (5U) -#define MC33775_FEH_SUPPLY_FLT_STAT0_AFECPOV_MSK (0x20U) - -/* Enumerated value NO_OV: No AFE Charge Pump over-voltage detected. */ -#define MC33775_FEH_SUPPLY_FLT_STAT0_AFECPOV_NO_OV_ENUM_VAL (0U) - -/* Enumerated value OV: AFE Charge Pump over-voltage detected. */ -#define MC33775_FEH_SUPPLY_FLT_STAT0_AFECPOV_OV_ENUM_VAL (1U) - -/* Field AFECPUV: AFE Charge Pump under-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_STAT0_AFECPUV_POS (6U) -#define MC33775_FEH_SUPPLY_FLT_STAT0_AFECPUV_MSK (0x40U) - -/* Enumerated value NO_UV: No AFE Charge Pump under-voltage detected. */ -#define MC33775_FEH_SUPPLY_FLT_STAT0_AFECPUV_NO_UV_ENUM_VAL (0U) - -/* Enumerated value UV: AFE Charge Pump under-voltage detected. */ -#define MC33775_FEH_SUPPLY_FLT_STAT0_AFECPUV_UV_ENUM_VAL (1U) - -/* Field IBIASPERMOC: IBIAS_PERM over-current fault. */ -#define MC33775_FEH_SUPPLY_FLT_STAT0_IBIASPERMOC_POS (7U) -#define MC33775_FEH_SUPPLY_FLT_STAT0_IBIASPERMOC_MSK (0x80U) - -/* Enumerated value NO_OC: No IBIAS_PERM over-current detected. */ -#define MC33775_FEH_SUPPLY_FLT_STAT0_IBIASPERMOC_NO_OC_ENUM_VAL (0U) - -/* Enumerated value OC: IBIAS_PERM over-current detected. */ -#define MC33775_FEH_SUPPLY_FLT_STAT0_IBIASPERMOC_OC_ENUM_VAL (1U) - -/* Field IBIASPERMUC: IBIAS_PERM under-current fault. */ -#define MC33775_FEH_SUPPLY_FLT_STAT0_IBIASPERMUC_POS (8U) -#define MC33775_FEH_SUPPLY_FLT_STAT0_IBIASPERMUC_MSK (0x100U) - -/* Enumerated value NO_UC: No IBIAS_PERM under-current detected. */ -#define MC33775_FEH_SUPPLY_FLT_STAT0_IBIASPERMUC_NO_UC_ENUM_VAL (0U) - -/* Enumerated value UC: IBIAS_PERM under-current detected. */ -#define MC33775_FEH_SUPPLY_FLT_STAT0_IBIASPERMUC_UC_ENUM_VAL (1U) - -/* Field VPREREFSUV: VPREREFS Supply under-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_STAT0_VPREREFSUV_POS (9U) -#define MC33775_FEH_SUPPLY_FLT_STAT0_VPREREFSUV_MSK (0x200U) - -/* Enumerated value NO_UV: No VPREREFS Supply under-voltage detected. */ -#define MC33775_FEH_SUPPLY_FLT_STAT0_VPREREFSUV_NO_UV_ENUM_VAL (0U) - -/* Enumerated value UV: VPREREFS Supply under-voltage detected. */ -#define MC33775_FEH_SUPPLY_FLT_STAT0_VPREREFSUV_UV_ENUM_VAL (1U) - -/* Field VAUXOV: VAUX Supply over-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_STAT0_VAUXOV_POS (10U) -#define MC33775_FEH_SUPPLY_FLT_STAT0_VAUXOV_MSK (0x400U) - -/* Enumerated value NO_OV: No VAUX Supply over-voltage detected. */ -#define MC33775_FEH_SUPPLY_FLT_STAT0_VAUXOV_NO_OV_ENUM_VAL (0U) - -/* Enumerated value OV: VAUX Supply over-voltage detected. */ -#define MC33775_FEH_SUPPLY_FLT_STAT0_VAUXOV_OV_ENUM_VAL (1U) - -/* Field VAUXUV: VAUX Supply under-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_STAT0_VAUXUV_POS (11U) -#define MC33775_FEH_SUPPLY_FLT_STAT0_VAUXUV_MSK (0x800U) - -/* Enumerated value NO_UV: No VAUX Supply under-voltage detected. */ -#define MC33775_FEH_SUPPLY_FLT_STAT0_VAUXUV_NO_UV_ENUM_VAL (0U) - -/* Enumerated value UV: VAUX Supply under-voltage detected. */ -#define MC33775_FEH_SUPPLY_FLT_STAT0_VAUXUV_UV_ENUM_VAL (1U) - -/* Field VDDCOV: VDDC Supply over-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_STAT0_VDDCOV_POS (12U) -#define MC33775_FEH_SUPPLY_FLT_STAT0_VDDCOV_MSK (0x1000U) - -/* Enumerated value NO_OV: No VDDC Supply over-voltage detected. */ -#define MC33775_FEH_SUPPLY_FLT_STAT0_VDDCOV_NO_OV_ENUM_VAL (0U) - -/* Enumerated value OV: VDDC Supply over-voltage detected. */ -#define MC33775_FEH_SUPPLY_FLT_STAT0_VDDCOV_OV_ENUM_VAL (1U) - -/* Field VDDCUV: VDDC Supply under-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_STAT0_VDDCUV_POS (13U) -#define MC33775_FEH_SUPPLY_FLT_STAT0_VDDCUV_MSK (0x2000U) - -/* Enumerated value NO_UV: No VDDC Supply under-voltage detected. */ -#define MC33775_FEH_SUPPLY_FLT_STAT0_VDDCUV_NO_UV_ENUM_VAL (0U) - -/* Enumerated value UV: VDDC Supply under-voltage detected. */ -#define MC33775_FEH_SUPPLY_FLT_STAT0_VDDCUV_UV_ENUM_VAL (1U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_FEH_SUPPLY_FLT_STAT0_RESERVED0_POS (14U) -#define MC33775_FEH_SUPPLY_FLT_STAT0_RESERVED0_MSK (0xC000U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VBATOV : 1; - volatile uint16_t VDDAOV : 1; - volatile uint16_t VDDAUV : 1; - volatile uint16_t V2P5AOV : 1; - volatile uint16_t V2P5AUV : 1; - volatile uint16_t AFECPOV : 1; - volatile uint16_t AFECPUV : 1; - volatile uint16_t IBIASPERMOC : 1; - volatile uint16_t IBIASPERMUC : 1; - volatile uint16_t VPREREFSUV : 1; - volatile uint16_t VAUXOV : 1; - volatile uint16_t VAUXUV : 1; - volatile uint16_t VDDCOV : 1; - volatile uint16_t VDDCUV : 1; - volatile uint16_t reserved0 : 2; - } B; -} mc33775_event_handling_registers_feh_supply_flt_stat0_t; - -/* -------------------------------------------------------------------------- - * FEH_SUPPLY_FLT_STAT1 (read-write):Supply fault status register 1 (these monitors are not part of the BIST). - * -------------------------------------------------------------------------- */ -#define MC33775_FEH_SUPPLY_FLT_STAT1_OFFSET (0x421U) -#define MC33775_FEH_SUPPLY_FLT_STAT1_RW_MSK (0x3FU) -#define MC33775_FEH_SUPPLY_FLT_STAT1_RD_MSK (0x3FU) -#define MC33775_FEH_SUPPLY_FLT_STAT1_WR_MSK (0x3FU) -#define MC33775_FEH_SUPPLY_FLT_STAT1_MW_MSK (0x3FU) -#define MC33775_FEH_SUPPLY_FLT_STAT1_RA_MSK (0x0U) -#define MC33775_FEH_SUPPLY_FLT_STAT1_POR_MSK (0xffffU) -#define MC33775_FEH_SUPPLY_FLT_STAT1_POR_VAL (0x0U) - -/* Field VBATLV: VBAT Supply low-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_STAT1_VBATLV_POS (0U) -#define MC33775_FEH_SUPPLY_FLT_STAT1_VBATLV_MSK (0x1U) - -/* Enumerated value NO_LV: No VBAT Supply low-voltage detected. */ -#define MC33775_FEH_SUPPLY_FLT_STAT1_VBATLV_NO_LV_ENUM_VAL (0U) - -/* Enumerated value LV: VBAT Supply low-voltage detected. */ -#define MC33775_FEH_SUPPLY_FLT_STAT1_VBATLV_LV_ENUM_VAL (1U) - -/* Field VPREREFSOV: VPREREFS Supply over-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_STAT1_VPREREFSOV_POS (1U) -#define MC33775_FEH_SUPPLY_FLT_STAT1_VPREREFSOV_MSK (0x2U) - -/* Enumerated value NO_OV: No VPREREFS Supply over-voltage detected. */ -#define MC33775_FEH_SUPPLY_FLT_STAT1_VPREREFSOV_NO_OV_ENUM_VAL (0U) - -/* Enumerated value OV: VPREREFS Supply over-voltage detected. */ -#define MC33775_FEH_SUPPLY_FLT_STAT1_VPREREFSOV_OV_ENUM_VAL (1U) - -/* Field VDDCHC: VDDC high-current fault. */ -#define MC33775_FEH_SUPPLY_FLT_STAT1_VDDCHC_POS (2U) -#define MC33775_FEH_SUPPLY_FLT_STAT1_VDDCHC_MSK (0x4U) - -/* Enumerated value NO_HC: No VDDC high-current detected. */ -#define MC33775_FEH_SUPPLY_FLT_STAT1_VDDCHC_NO_HC_ENUM_VAL (0U) - -/* Enumerated value HC: VDDC high-current detected. */ -#define MC33775_FEH_SUPPLY_FLT_STAT1_VDDCHC_HC_ENUM_VAL (1U) - -/* Field VDDIOOV: VDDIO Supply over-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_STAT1_VDDIOOV_POS (3U) -#define MC33775_FEH_SUPPLY_FLT_STAT1_VDDIOOV_MSK (0x8U) - -/* Enumerated value NO_OV: No VDDIO Supply over-voltage detected. */ -#define MC33775_FEH_SUPPLY_FLT_STAT1_VDDIOOV_NO_OV_ENUM_VAL (0U) - -/* Enumerated value OV: VDDIO Supply over-voltage detected. */ -#define MC33775_FEH_SUPPLY_FLT_STAT1_VDDIOOV_OV_ENUM_VAL (1U) - -/* Field VDDIOUV: VDDIO Supply under-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_STAT1_VDDIOUV_POS (4U) -#define MC33775_FEH_SUPPLY_FLT_STAT1_VDDIOUV_MSK (0x10U) - -/* Enumerated value NO_UV: No VDDIO Supply under-voltage detected. */ -#define MC33775_FEH_SUPPLY_FLT_STAT1_VDDIOUV_NO_UV_ENUM_VAL (0U) - -/* Enumerated value UV: VDDIO Supply under-voltage detected. */ -#define MC33775_FEH_SUPPLY_FLT_STAT1_VDDIOUV_UV_ENUM_VAL (1U) - -/* Field VPREOV: VPRE Supply over-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_STAT1_VPREOV_POS (5U) -#define MC33775_FEH_SUPPLY_FLT_STAT1_VPREOV_MSK (0x20U) - -/* Enumerated value NO_OV: No VPRE Supply over-voltage detected. */ -#define MC33775_FEH_SUPPLY_FLT_STAT1_VPREOV_NO_OV_ENUM_VAL (0U) - -/* Enumerated value OV: VPRE Supply over-voltage detected. */ -#define MC33775_FEH_SUPPLY_FLT_STAT1_VPREOV_OV_ENUM_VAL (1U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_FEH_SUPPLY_FLT_STAT1_RESERVED0_POS (6U) -#define MC33775_FEH_SUPPLY_FLT_STAT1_RESERVED0_MSK (0xFFC0U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VBATLV : 1; - volatile uint16_t VPREREFSOV : 1; - volatile uint16_t VDDCHC : 1; - volatile uint16_t VDDIOOV : 1; - volatile uint16_t VDDIOUV : 1; - volatile uint16_t VPREOV : 1; - volatile uint16_t reserved0 : 10; - } B; -} mc33775_event_handling_registers_feh_supply_flt_stat1_t; - -/* -------------------------------------------------------------------------- - * FEH_ANA_FLT_STAT (read-write):Analog fault status register. - * -------------------------------------------------------------------------- */ -#define MC33775_FEH_ANA_FLT_STAT_OFFSET (0x422U) -#define MC33775_FEH_ANA_FLT_STAT_RW_MSK (0x7U) -#define MC33775_FEH_ANA_FLT_STAT_RD_MSK (0x7U) -#define MC33775_FEH_ANA_FLT_STAT_WR_MSK (0x7U) -#define MC33775_FEH_ANA_FLT_STAT_MW_MSK (0x7U) -#define MC33775_FEH_ANA_FLT_STAT_RA_MSK (0x0U) -#define MC33775_FEH_ANA_FLT_STAT_POR_MSK (0xffffU) -#define MC33775_FEH_ANA_FLT_STAT_POR_VAL (0x0U) - -/* Field MONBIST: Monitor BIST failure fault. */ -#define MC33775_FEH_ANA_FLT_STAT_MONBIST_POS (0U) -#define MC33775_FEH_ANA_FLT_STAT_MONBIST_MSK (0x1U) - -/* Enumerated value NO_FLT: No monitor BIST failure detected. */ -#define MC33775_FEH_ANA_FLT_STAT_MONBIST_NO_FLT_ENUM_VAL (0U) - -/* Enumerated value FAILURE: Monitor BIST failure detected. */ -#define MC33775_FEH_ANA_FLT_STAT_MONBIST_FAILURE_ENUM_VAL (1U) - -/* Field BALFLT: Cell balance function fault. */ -#define MC33775_FEH_ANA_FLT_STAT_BALFLT_POS (1U) -#define MC33775_FEH_ANA_FLT_STAT_BALFLT_MSK (0x2U) - -/* Enumerated value NO_FLT: No cell balancing fault detected */ -#define MC33775_FEH_ANA_FLT_STAT_BALFLT_NO_FLT_ENUM_VAL (0U) - -/* Enumerated value FAULT: Cell balancing fault detected */ -#define MC33775_FEH_ANA_FLT_STAT_BALFLT_FAULT_ENUM_VAL (1U) - -/* Field FUSEFLT: A correctable ECC error of the fuse data has been detected. */ -#define MC33775_FEH_ANA_FLT_STAT_FUSEFLT_POS (2U) -#define MC33775_FEH_ANA_FLT_STAT_FUSEFLT_MSK (0x4U) - -/* Enumerated value NO_ECC: No correctable ECC error detected */ -#define MC33775_FEH_ANA_FLT_STAT_FUSEFLT_NO_ECC_ENUM_VAL (0U) - -/* Enumerated value ECC: An error was corrected by using the ECC */ -#define MC33775_FEH_ANA_FLT_STAT_FUSEFLT_ECC_ENUM_VAL (1U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_FEH_ANA_FLT_STAT_RESERVED0_POS (3U) -#define MC33775_FEH_ANA_FLT_STAT_RESERVED0_MSK (0xFFF8U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t MONBIST : 1; - volatile uint16_t BALFLT : 1; - volatile uint16_t FUSEFLT : 1; - volatile uint16_t reserved0 : 13; - } B; -} mc33775_event_handling_registers_feh_ana_flt_stat_t; - -/* -------------------------------------------------------------------------- - * FEH_COM_FLT_STAT (read-write):Communication fault status register. - * -------------------------------------------------------------------------- */ -#define MC33775_FEH_COM_FLT_STAT_OFFSET (0x423U) -#define MC33775_FEH_COM_FLT_STAT_RW_MSK (0xFF1FU) -#define MC33775_FEH_COM_FLT_STAT_RD_MSK (0xFF1FU) -#define MC33775_FEH_COM_FLT_STAT_WR_MSK (0xFF1FU) -#define MC33775_FEH_COM_FLT_STAT_MW_MSK (0xFF1FU) -#define MC33775_FEH_COM_FLT_STAT_RA_MSK (0x0U) -#define MC33775_FEH_COM_FLT_STAT_POR_MSK (0xffffU) -#define MC33775_FEH_COM_FLT_STAT_POR_VAL (0x0U) - -/* Field FRAMEERR: Communication frame error (Wrong number of bits or bit-length error) */ -#define MC33775_FEH_COM_FLT_STAT_FRAMEERR_POS (0U) -#define MC33775_FEH_COM_FLT_STAT_FRAMEERR_MSK (0x1U) - -/* Enumerated value NO_ERROR: No communication frame error detected. */ -#define MC33775_FEH_COM_FLT_STAT_FRAMEERR_NO_ERROR_ENUM_VAL (0U) - -/* Enumerated value ERROR: Communication frame error detected. */ -#define MC33775_FEH_COM_FLT_STAT_FRAMEERR_ERROR_ENUM_VAL (1U) - -/* Field CRCERR: Communication CRC error */ -#define MC33775_FEH_COM_FLT_STAT_CRCERR_POS (1U) -#define MC33775_FEH_COM_FLT_STAT_CRCERR_MSK (0x2U) - -/* Enumerated value NO_ERROR: No communication CRC error detected. */ -#define MC33775_FEH_COM_FLT_STAT_CRCERR_NO_ERROR_ENUM_VAL (0U) - -/* Enumerated value ERROR: Communication CRC error detected. */ -#define MC33775_FEH_COM_FLT_STAT_CRCERR_ERROR_ENUM_VAL (1U) - -/* Field ERRCNTOF: Communication error counter overflow */ -#define MC33775_FEH_COM_FLT_STAT_ERRCNTOF_POS (2U) -#define MC33775_FEH_COM_FLT_STAT_ERRCNTOF_MSK (0x4U) - -/* Enumerated value NO_MAX: Communication error counter has not reached max value. */ -#define MC33775_FEH_COM_FLT_STAT_ERRCNTOF_NO_MAX_ENUM_VAL (0U) - -/* Enumerated value MAX: Communication error counter has reached max value. */ -#define MC33775_FEH_COM_FLT_STAT_ERRCNTOF_MAX_ENUM_VAL (1U) - -/* Field COMTO: Communication timeout fault status */ -#define MC33775_FEH_COM_FLT_STAT_COMTO_POS (3U) -#define MC33775_FEH_COM_FLT_STAT_COMTO_MSK (0x8U) - -/* Enumerated value NO_TIMEOUT: No communication timeout has happened. */ -#define MC33775_FEH_COM_FLT_STAT_COMTO_NO_TIMEOUT_ENUM_VAL (0U) - -/* Enumerated value TIMEMOUT: Communication timeout has happened. */ -#define MC33775_FEH_COM_FLT_STAT_COMTO_TIMEMOUT_ENUM_VAL (1U) - -/* Field RSPLENERR: Response length error */ -#define MC33775_FEH_COM_FLT_STAT_RSPLENERR_POS (4U) -#define MC33775_FEH_COM_FLT_STAT_RSPLENERR_MSK (0x10U) - -/* Enumerated value NO_ERROR: No response length error occurred */ -#define MC33775_FEH_COM_FLT_STAT_RSPLENERR_NO_ERROR_ENUM_VAL (0U) - -/* Enumerated value ERROR: The number of SPI clocks did not fit to the length of a requested response */ -#define MC33775_FEH_COM_FLT_STAT_RSPLENERR_ERROR_ENUM_VAL (1U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_FEH_COM_FLT_STAT_RESERVED0_POS (5U) -#define MC33775_FEH_COM_FLT_STAT_RESERVED0_MSK (0xE0U) - -/* Field COMERRCNT: Number of communication errors (frame errors, CRC errors) since last clear, counter saturates at 0xFF. Write with any data unequal 0 clears the counter. */ -#define MC33775_FEH_COM_FLT_STAT_COMERRCNT_POS (8U) -#define MC33775_FEH_COM_FLT_STAT_COMERRCNT_MSK (0xFF00U) - -/* Enumerated value NO_ERROR: No communication error occurred */ -#define MC33775_FEH_COM_FLT_STAT_COMERRCNT_NO_ERROR_ENUM_VAL (0U) - -/* Enumerated value CNT: CNT errors occurred */ -#define MC33775_FEH_COM_FLT_STAT_COMERRCNT_CNT_ENUM_VAL (1U) - -/* Enumerated value MAX: Maximum communication error counter = 255 communication errors occurred. */ -#define MC33775_FEH_COM_FLT_STAT_COMERRCNT_MAX_ENUM_VAL (255U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t FRAMEERR : 1; - volatile uint16_t CRCERR : 1; - volatile uint16_t ERRCNTOF : 1; - volatile uint16_t COMTO : 1; - volatile uint16_t RSPLENERR : 1; - volatile uint16_t reserved0 : 3; - volatile uint16_t COMERRCNT : 8; - } B; -} mc33775_event_handling_registers_feh_com_flt_stat_t; - -/* -------------------------------------------------------------------------- - * FEH_MEAS_FLT_STAT (read-write):Other fault status register. - * -------------------------------------------------------------------------- */ -#define MC33775_FEH_MEAS_FLT_STAT_OFFSET (0x424U) -#define MC33775_FEH_MEAS_FLT_STAT_RW_MSK (0x7U) -#define MC33775_FEH_MEAS_FLT_STAT_RD_MSK (0x7U) -#define MC33775_FEH_MEAS_FLT_STAT_WR_MSK (0x7U) -#define MC33775_FEH_MEAS_FLT_STAT_MW_MSK (0x7U) -#define MC33775_FEH_MEAS_FLT_STAT_RA_MSK (0x0U) -#define MC33775_FEH_MEAS_FLT_STAT_POR_MSK (0xffffU) -#define MC33775_FEH_MEAS_FLT_STAT_POR_VAL (0x0U) - -/* Field PRIMCALCRCFLT: A fault in the primary measurement chain calibration data */ -#define MC33775_FEH_MEAS_FLT_STAT_PRIMCALCRCFLT_POS (0U) -#define MC33775_FEH_MEAS_FLT_STAT_PRIMCALCRCFLT_MSK (0x1U) - -/* Enumerated value NO_FLT: No fault in primary measurement chain calibration data detected. */ -#define MC33775_FEH_MEAS_FLT_STAT_PRIMCALCRCFLT_NO_FLT_ENUM_VAL (0U) - -/* Enumerated value FAULT: A fault in the primary measurement chain calibration data has been detected. */ -#define MC33775_FEH_MEAS_FLT_STAT_PRIMCALCRCFLT_FAULT_ENUM_VAL (1U) - -/* Field SECCALCCRCFLT: A fault in the secondary measurement chain calibration data */ -#define MC33775_FEH_MEAS_FLT_STAT_SECCALCCRCFLT_POS (1U) -#define MC33775_FEH_MEAS_FLT_STAT_SECCALCCRCFLT_MSK (0x2U) - -/* Enumerated value NO_FLT: No fault in secondary measurement chain calibration data detected. */ -#define MC33775_FEH_MEAS_FLT_STAT_SECCALCCRCFLT_NO_FLT_ENUM_VAL (0U) - -/* Enumerated value FAULT: A fault in the secondary measurement chain calibration data has been detected. */ -#define MC33775_FEH_MEAS_FLT_STAT_SECCALCCRCFLT_FAULT_ENUM_VAL (1U) - -/* Field SYNCMEASFLT: Synchronization fault between the measurement units */ -#define MC33775_FEH_MEAS_FLT_STAT_SYNCMEASFLT_POS (2U) -#define MC33775_FEH_MEAS_FLT_STAT_SYNCMEASFLT_MSK (0x4U) - -/* Enumerated value NO_FLT: No synchronization fault between the measurement units for a Sync cycle has been detected.. */ -#define MC33775_FEH_MEAS_FLT_STAT_SYNCMEASFLT_NO_FLT_ENUM_VAL (0U) - -/* Enumerated value FAULT: Synchronization fault between the measurement units for a Sync cycle has been detected.. */ -#define MC33775_FEH_MEAS_FLT_STAT_SYNCMEASFLT_FAULT_ENUM_VAL (1U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_FEH_MEAS_FLT_STAT_RESERVED0_POS (3U) -#define MC33775_FEH_MEAS_FLT_STAT_RESERVED0_MSK (0xFFF8U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t PRIMCALCRCFLT : 1; - volatile uint16_t SECCALCCRCFLT : 1; - volatile uint16_t SYNCMEASFLT : 1; - volatile uint16_t reserved0 : 13; - } B; -} mc33775_event_handling_registers_feh_meas_flt_stat_t; - -/* -------------------------------------------------------------------------- - * FEH_SUPPLY_FLT_POR_CFG0 (read-write):Supply fault POR selection 0. - * -------------------------------------------------------------------------- */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_OFFSET (0x428U) -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_RW_MSK (0x3FFFU) -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_RD_MSK (0x3FFFU) -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_WR_MSK (0x3FFFU) -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_MW_MSK (0x0U) -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_RA_MSK (0x0U) -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_POR_MSK (0xffffU) -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_POR_VAL (0x0U) - -/* Field VBATOVEN: POR on VBAT Supply over-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VBATOVEN_POS (0U) -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VBATOVEN_MSK (0x1U) - -/* Enumerated value NO_POR: No POR in case of VBAT supply over-voltage */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VBATOVEN_NO_POR_ENUM_VAL (0U) - -/* Enumerated value POR: VBAT supply over-voltage error leads to POR */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VBATOVEN_POR_ENUM_VAL (1U) - -/* Field VDDAOVEN: POR on VDDA Supply over-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VDDAOVEN_POS (1U) -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VDDAOVEN_MSK (0x2U) - -/* Enumerated value NO_POR: No POR in case of VDDA supply over-voltage */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VDDAOVEN_NO_POR_ENUM_VAL (0U) - -/* Enumerated value POR: VDDA supply over-voltage error leads to POR */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VDDAOVEN_POR_ENUM_VAL (1U) - -/* Field VDDAUVEN: POR on VDDA Supply under-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VDDAUVEN_POS (2U) -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VDDAUVEN_MSK (0x4U) - -/* Enumerated value NO_POR: No POR in case of VDDA supply under-voltage */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VDDAUVEN_NO_POR_ENUM_VAL (0U) - -/* Enumerated value POR: VDDA supply under-voltage error leads to POR */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VDDAUVEN_POR_ENUM_VAL (1U) - -/* Field V2P5AOVEN: POR on V2P5A Supply over-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_V2P5AOVEN_POS (3U) -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_V2P5AOVEN_MSK (0x8U) - -/* Enumerated value NO_POR: No POR in case of V2P5A supply over-voltage */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_V2P5AOVEN_NO_POR_ENUM_VAL (0U) - -/* Enumerated value POR: V2P5A supply over-voltage error leads to POR */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_V2P5AOVEN_POR_ENUM_VAL (1U) - -/* Field V2P5AUVEN: POR on V2P5A Supply under-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_V2P5AUVEN_POS (4U) -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_V2P5AUVEN_MSK (0x10U) - -/* Enumerated value NO_POR: No POR in case of V2P5A supply under-voltage */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_V2P5AUVEN_NO_POR_ENUM_VAL (0U) - -/* Enumerated value POR: V2P5A supply under-voltage error leads to POR */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_V2P5AUVEN_POR_ENUM_VAL (1U) - -/* Field AFECPOVEN: POR on AFE Charge Pump over-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_AFECPOVEN_POS (5U) -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_AFECPOVEN_MSK (0x20U) - -/* Enumerated value NO_POR: No POR in case of AFE Charge Pump over-voltage */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_AFECPOVEN_NO_POR_ENUM_VAL (0U) - -/* Enumerated value POR: AFE Charge Pump over-voltage error leads to POR */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_AFECPOVEN_POR_ENUM_VAL (1U) - -/* Field AFECPUVEN: POR on AFE Charge Pump under-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_AFECPUVEN_POS (6U) -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_AFECPUVEN_MSK (0x40U) - -/* Enumerated value NO_POR: No POR in case of AFE Charge Pump under-voltage */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_AFECPUVEN_NO_POR_ENUM_VAL (0U) - -/* Enumerated value POR: AFE Charge Pump under-voltage error leads to POR */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_AFECPUVEN_POR_ENUM_VAL (1U) - -/* Field IBIASPERMOCEN: POR on IBIAS_PERM over-current fault. */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_IBIASPERMOCEN_POS (7U) -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_IBIASPERMOCEN_MSK (0x80U) - -/* Enumerated value NO_POR: No POR in case of IBIAS_PERM over-current */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_IBIASPERMOCEN_NO_POR_ENUM_VAL (0U) - -/* Enumerated value POR: IBIAS_PERM over-current error leads to POR */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_IBIASPERMOCEN_POR_ENUM_VAL (1U) - -/* Field IBIASPERMUCEN: POR on IBIAS_PERM under-current fault. */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_IBIASPERMUCEN_POS (8U) -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_IBIASPERMUCEN_MSK (0x100U) - -/* Enumerated value NO_POR: No POR in case of IBIAS_PERM under-current */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_IBIASPERMUCEN_NO_POR_ENUM_VAL (0U) - -/* Enumerated value POR: IBIAS_PERM under-current error leads to POR */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_IBIASPERMUCEN_POR_ENUM_VAL (1U) - -/* Field VPREREFSUVEN: POR on VPREREFS Supply under-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VPREREFSUVEN_POS (9U) -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VPREREFSUVEN_MSK (0x200U) - -/* Enumerated value NO_POR: No POR in case of VPREREFS supply under-voltage */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VPREREFSUVEN_NO_POR_ENUM_VAL (0U) - -/* Enumerated value POR: VPREREFS supply under-voltage error leads to POR */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VPREREFSUVEN_POR_ENUM_VAL (1U) - -/* Field VAUXOVEN: POR on VAUX over-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VAUXOVEN_POS (10U) -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VAUXOVEN_MSK (0x400U) - -/* Enumerated value NO_POR: No POR in case of VAUX supply over-voltage */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VAUXOVEN_NO_POR_ENUM_VAL (0U) - -/* Enumerated value POR: VAUX supply over-voltage error leads to POR */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VAUXOVEN_POR_ENUM_VAL (1U) - -/* Field VAUXUVEN: POR on VAUX under-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VAUXUVEN_POS (11U) -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VAUXUVEN_MSK (0x800U) - -/* Enumerated value NO_POR: No POR in case of VAUX supply under-voltage */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VAUXUVEN_NO_POR_ENUM_VAL (0U) - -/* Enumerated value POR: VAUX supply under-voltage error leads to POR */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VAUXUVEN_POR_ENUM_VAL (1U) - -/* Field VDDCOVEN: POR on VDDC over-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VDDCOVEN_POS (12U) -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VDDCOVEN_MSK (0x1000U) - -/* Enumerated value NO_POR: No POR in case of VDDC over-voltage */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VDDCOVEN_NO_POR_ENUM_VAL (0U) - -/* Enumerated value POR: VDDC over-voltage error leads to POR */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VDDCOVEN_POR_ENUM_VAL (1U) - -/* Field VDDCUVEN: POR on VDDC under-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VDDCUVEN_POS (13U) -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VDDCUVEN_MSK (0x2000U) - -/* Enumerated value NO_POR: No POR in case of VDDC under-voltage */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VDDCUVEN_NO_POR_ENUM_VAL (0U) - -/* Enumerated value POR: VDDC under-voltage error leads to POR */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VDDCUVEN_POR_ENUM_VAL (1U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_RESERVED0_POS (14U) -#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_RESERVED0_MSK (0xC000U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VBATOVEN : 1; - volatile uint16_t VDDAOVEN : 1; - volatile uint16_t VDDAUVEN : 1; - volatile uint16_t V2P5AOVEN : 1; - volatile uint16_t V2P5AUVEN : 1; - volatile uint16_t AFECPOVEN : 1; - volatile uint16_t AFECPUVEN : 1; - volatile uint16_t IBIASPERMOCEN : 1; - volatile uint16_t IBIASPERMUCEN : 1; - volatile uint16_t VPREREFSUVEN : 1; - volatile uint16_t VAUXOVEN : 1; - volatile uint16_t VAUXUVEN : 1; - volatile uint16_t VDDCOVEN : 1; - volatile uint16_t VDDCUVEN : 1; - volatile uint16_t reserved0 : 2; - } B; -} mc33775_event_handling_registers_feh_supply_flt_por_cfg0_t; - -/* -------------------------------------------------------------------------- - * FEH_SUPPLY_FLT_POR_CFG1 (read-write):Supply fault POR selection 1. - * -------------------------------------------------------------------------- */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_OFFSET (0x429U) -#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_RW_MSK (0x3FU) -#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_RD_MSK (0x3FU) -#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_WR_MSK (0x3FU) -#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_MW_MSK (0x0U) -#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_RA_MSK (0x0U) -#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_POR_MSK (0xffffU) -#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_POR_VAL (0x0U) - -/* Field VBATLVEN: POR on VBAT Supply low-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_VBATLVEN_POS (0U) -#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_VBATLVEN_MSK (0x1U) - -/* Enumerated value NO_POR: No POR in case of VBAT supply low-voltage */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_VBATLVEN_NO_POR_ENUM_VAL (0U) - -/* Enumerated value POR: VBAT supply low-voltage error leads to POR */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_VBATLVEN_POR_ENUM_VAL (1U) - -/* Field VPREREFSOVEN: POR on VPREREFS Supply over-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_VPREREFSOVEN_POS (1U) -#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_VPREREFSOVEN_MSK (0x2U) - -/* Enumerated value NO_POR: No POR in case of VPREREFS over-voltage */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_VPREREFSOVEN_NO_POR_ENUM_VAL (0U) - -/* Enumerated value POR: VPREREFS over-voltage error leads to POR */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_VPREREFSOVEN_POR_ENUM_VAL (1U) - -/* Field VDDCHCEN: POR on VDDC high-current fault. */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_VDDCHCEN_POS (2U) -#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_VDDCHCEN_MSK (0x4U) - -/* Enumerated value NO_POR: No POR in case of VDDC high-current */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_VDDCHCEN_NO_POR_ENUM_VAL (0U) - -/* Enumerated value POR: VDDC high-current error leads to POR */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_VDDCHCEN_POR_ENUM_VAL (1U) - -/* Field VDDIOOVEN: POR on VDDIO Supply over-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_VDDIOOVEN_POS (3U) -#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_VDDIOOVEN_MSK (0x8U) - -/* Enumerated value NO_POR: No POR in case of VDDIO supply over-voltage */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_VDDIOOVEN_NO_POR_ENUM_VAL (0U) - -/* Enumerated value POR: VDDIO supply over-voltage error leads to POR */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_VDDIOOVEN_POR_ENUM_VAL (1U) - -/* Field VDDIOUVEN: POR on VDDIO Supply under-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_VDDIOUVEN_POS (4U) -#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_VDDIOUVEN_MSK (0x10U) - -/* Enumerated value NO_POR: No POR in case of VDDIO supply under-voltage */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_VDDIOUVEN_NO_POR_ENUM_VAL (0U) - -/* Enumerated value POR: VDDIO supply under-voltage error leads to POR */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_VDDIOUVEN_POR_ENUM_VAL (1U) - -/* Field VPREOVEN: POR on VPRE Supply over-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_VPREOVEN_POS (5U) -#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_VPREOVEN_MSK (0x20U) - -/* Enumerated value NO_POR: No POR in case of VPRE over-voltage */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_VPREOVEN_NO_POR_ENUM_VAL (0U) - -/* Enumerated value POR: VPRE over-voltage error leads to POR */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_VPREOVEN_POR_ENUM_VAL (1U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_RESERVED0_POS (6U) -#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_RESERVED0_MSK (0xFFC0U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VBATLVEN : 1; - volatile uint16_t VPREREFSOVEN : 1; - volatile uint16_t VDDCHCEN : 1; - volatile uint16_t VDDIOOVEN : 1; - volatile uint16_t VDDIOUVEN : 1; - volatile uint16_t VPREOVEN : 1; - volatile uint16_t reserved0 : 10; - } B; -} mc33775_event_handling_registers_feh_supply_flt_por_cfg1_t; - -/* -------------------------------------------------------------------------- - * FEH_ANA_FLT_POR_CFG (read-only):Analog fault POR selection. - * -------------------------------------------------------------------------- */ -#define MC33775_FEH_ANA_FLT_POR_CFG_OFFSET (0x42AU) -#define MC33775_FEH_ANA_FLT_POR_CFG_RW_MSK (0x0U) -#define MC33775_FEH_ANA_FLT_POR_CFG_RD_MSK (0x0U) -#define MC33775_FEH_ANA_FLT_POR_CFG_WR_MSK (0x0U) -#define MC33775_FEH_ANA_FLT_POR_CFG_MW_MSK (0x0U) -#define MC33775_FEH_ANA_FLT_POR_CFG_RA_MSK (0x0U) -#define MC33775_FEH_ANA_FLT_POR_CFG_POR_MSK (0xffffU) -#define MC33775_FEH_ANA_FLT_POR_CFG_POR_VAL (0x0U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_FEH_ANA_FLT_POR_CFG_RESERVED0_POS (0U) -#define MC33775_FEH_ANA_FLT_POR_CFG_RESERVED0_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t reserved0 : 16; - } B; -} mc33775_event_handling_registers_feh_ana_flt_por_cfg_t; - -/* -------------------------------------------------------------------------- - * FEH_COM_FLT_POR_CFG (read-write):Communication fault POR enable register. - * -------------------------------------------------------------------------- */ -#define MC33775_FEH_COM_FLT_POR_CFG_OFFSET (0x42BU) -#define MC33775_FEH_COM_FLT_POR_CFG_RW_MSK (0xCU) -#define MC33775_FEH_COM_FLT_POR_CFG_RD_MSK (0xCU) -#define MC33775_FEH_COM_FLT_POR_CFG_WR_MSK (0xCU) -#define MC33775_FEH_COM_FLT_POR_CFG_MW_MSK (0x0U) -#define MC33775_FEH_COM_FLT_POR_CFG_RA_MSK (0x0U) -#define MC33775_FEH_COM_FLT_POR_CFG_POR_MSK (0xffffU) -#define MC33775_FEH_COM_FLT_POR_CFG_POR_VAL (0x8U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_FEH_COM_FLT_POR_CFG_RESERVED0_POS (0U) -#define MC33775_FEH_COM_FLT_POR_CFG_RESERVED0_MSK (0x3U) - -/* Field ERRCNTOFEN: Communication error counter max value leads to POR */ -#define MC33775_FEH_COM_FLT_POR_CFG_ERRCNTOFEN_POS (2U) -#define MC33775_FEH_COM_FLT_POR_CFG_ERRCNTOFEN_MSK (0x4U) - -/* Enumerated value NO_POR: Communication error counter has reached max value. */ -#define MC33775_FEH_COM_FLT_POR_CFG_ERRCNTOFEN_NO_POR_ENUM_VAL (0U) - -/* Enumerated value POR: Communication error counter max value leads to POR */ -#define MC33775_FEH_COM_FLT_POR_CFG_ERRCNTOFEN_POR_ENUM_VAL (1U) - -/* Field COMTOEN: Create a POR if a communication timeout happens. */ -#define MC33775_FEH_COM_FLT_POR_CFG_COMTOEN_POS (3U) -#define MC33775_FEH_COM_FLT_POR_CFG_COMTOEN_MSK (0x8U) - -/* Enumerated value PREV_MOD: Device fallbacks to prev. Mode in case of communication timeout */ -#define MC33775_FEH_COM_FLT_POR_CFG_COMTOEN_PREV_MOD_ENUM_VAL (0U) - -/* Enumerated value POR: POR in case of communication timeout */ -#define MC33775_FEH_COM_FLT_POR_CFG_COMTOEN_POR_ENUM_VAL (1U) - -/* Field reserved1: This read-only field is reserved and always has the value 0. */ -#define MC33775_FEH_COM_FLT_POR_CFG_RESERVED1_POS (4U) -#define MC33775_FEH_COM_FLT_POR_CFG_RESERVED1_MSK (0xFFF0U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t reserved0 : 2; - volatile uint16_t ERRCNTOFEN : 1; - volatile uint16_t COMTOEN : 1; - volatile uint16_t reserved1 : 12; - } B; -} mc33775_event_handling_registers_feh_com_flt_por_cfg_t; - -/* -------------------------------------------------------------------------- - * FEH_SUPPLY_FLT_EVT_CFG0 (read-write):Supply fault event selection register 0. - * -------------------------------------------------------------------------- */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_OFFSET (0x430U) -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_RW_MSK (0x3FFFU) -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_RD_MSK (0x3FFFU) -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_WR_MSK (0x3FFFU) -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_MW_MSK (0x0U) -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_RA_MSK (0x0U) -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_POR_MSK (0xffffU) -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_POR_VAL (0x0U) - -/* Field VBATOVEN: Event on VBAT Supply over-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VBATOVEN_POS (0U) -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VBATOVEN_MSK (0x1U) - -/* Enumerated value NO_EV: No event on VBAT Supply over-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VBATOVEN_NO_EV_ENUM_VAL (0U) - -/* Enumerated value EVENT: Event on VBAT Supply over-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VBATOVEN_EVENT_ENUM_VAL (1U) - -/* Field VDDAOVEN: Event on VDDA Supply over-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VDDAOVEN_POS (1U) -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VDDAOVEN_MSK (0x2U) - -/* Enumerated value NO_EV: No event on VDDA Supply over-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VDDAOVEN_NO_EV_ENUM_VAL (0U) - -/* Enumerated value EVENT: Event on VDDA Supply over-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VDDAOVEN_EVENT_ENUM_VAL (1U) - -/* Field VDDAUVEN: Event on VDDA Supply under-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VDDAUVEN_POS (2U) -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VDDAUVEN_MSK (0x4U) - -/* Enumerated value NO_EV: No event on VDDA Supply under-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VDDAUVEN_NO_EV_ENUM_VAL (0U) - -/* Enumerated value EVENT: Event on VDDA Supply under-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VDDAUVEN_EVENT_ENUM_VAL (1U) - -/* Field V2P5AOVEN: Event on V2P5A Supply over-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_V2P5AOVEN_POS (3U) -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_V2P5AOVEN_MSK (0x8U) - -/* Enumerated value NO_EV: No event on V2P5A Supply over-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_V2P5AOVEN_NO_EV_ENUM_VAL (0U) - -/* Enumerated value EVENT: Event on V2P5A Supply over-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_V2P5AOVEN_EVENT_ENUM_VAL (1U) - -/* Field V2P5AUVEN: Event on V2P5A Supply under-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_V2P5AUVEN_POS (4U) -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_V2P5AUVEN_MSK (0x10U) - -/* Enumerated value NO_EV: No event on V2P5A Supply under-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_V2P5AUVEN_NO_EV_ENUM_VAL (0U) - -/* Enumerated value EVENT: Event on V2P5A Supply under-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_V2P5AUVEN_EVENT_ENUM_VAL (1U) - -/* Field AFECPOVEN: Event on AFE Charge Pump over-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_AFECPOVEN_POS (5U) -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_AFECPOVEN_MSK (0x20U) - -/* Enumerated value NO_EV: No event on AFE Charge Pump over-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_AFECPOVEN_NO_EV_ENUM_VAL (0U) - -/* Enumerated value EVENT: Event on AFE Charge Pump over-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_AFECPOVEN_EVENT_ENUM_VAL (1U) - -/* Field AFECPUVEN: Event on AFE Charge Pump under-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_AFECPUVEN_POS (6U) -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_AFECPUVEN_MSK (0x40U) - -/* Enumerated value NO_EV: No event on AFE Charge Pump under-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_AFECPUVEN_NO_EV_ENUM_VAL (0U) - -/* Enumerated value EVENT: Event on AFE Charge Pump under-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_AFECPUVEN_EVENT_ENUM_VAL (1U) - -/* Field IBIASPERMOCEN: Event on IBIAS_PERM over-current fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_IBIASPERMOCEN_POS (7U) -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_IBIASPERMOCEN_MSK (0x80U) - -/* Enumerated value NO_EV: No event on IBIAS_PERM over-current fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_IBIASPERMOCEN_NO_EV_ENUM_VAL (0U) - -/* Enumerated value EVENT: Event on IBIAS_PERM over-current fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_IBIASPERMOCEN_EVENT_ENUM_VAL (1U) - -/* Field IBIASPERMUCEN: Event on IBIAS_PERM under-current fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_IBIASPERMUCEN_POS (8U) -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_IBIASPERMUCEN_MSK (0x100U) - -/* Enumerated value NO_EV: No event on IBIAS_PERM under-current fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_IBIASPERMUCEN_NO_EV_ENUM_VAL (0U) - -/* Enumerated value EVENT: Event on IBIAS_PERM under-current fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_IBIASPERMUCEN_EVENT_ENUM_VAL (1U) - -/* Field VPREREFSUVEN: Event on VPREREFS Supply under-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VPREREFSUVEN_POS (9U) -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VPREREFSUVEN_MSK (0x200U) - -/* Enumerated value NO_EV: No event on VPREREFS Supply under-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VPREREFSUVEN_NO_EV_ENUM_VAL (0U) - -/* Enumerated value EVENT: Event on VPREREFS Supply under-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VPREREFSUVEN_EVENT_ENUM_VAL (1U) - -/* Field VAUXOVEN: Event on VAUX over-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VAUXOVEN_POS (10U) -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VAUXOVEN_MSK (0x400U) - -/* Enumerated value NO_EV: No event on VAUX over-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VAUXOVEN_NO_EV_ENUM_VAL (0U) - -/* Enumerated value EVENT: Event on VAUX over-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VAUXOVEN_EVENT_ENUM_VAL (1U) - -/* Field VAUXUVEN: Event on VAUX under-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VAUXUVEN_POS (11U) -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VAUXUVEN_MSK (0x800U) - -/* Enumerated value NO_EV: No event on VAUX under-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VAUXUVEN_NO_EV_ENUM_VAL (0U) - -/* Enumerated value EVENT: Event on VAUX under-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VAUXUVEN_EVENT_ENUM_VAL (1U) - -/* Field VDDCOVEN: Event on VDDC over-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VDDCOVEN_POS (12U) -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VDDCOVEN_MSK (0x1000U) - -/* Enumerated value NO_EV: No event on VDDC over-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VDDCOVEN_NO_EV_ENUM_VAL (0U) - -/* Enumerated value EVENT: Event on VDDC over-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VDDCOVEN_EVENT_ENUM_VAL (1U) - -/* Field VDDCUVEN: Event on VDDC under-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VDDCUVEN_POS (13U) -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VDDCUVEN_MSK (0x2000U) - -/* Enumerated value NO_EV: No event on VDDC under-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VDDCUVEN_NO_EV_ENUM_VAL (0U) - -/* Enumerated value EVENT: Event on VDDC under-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VDDCUVEN_EVENT_ENUM_VAL (1U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_RESERVED0_POS (14U) -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_RESERVED0_MSK (0xC000U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VBATOVEN : 1; - volatile uint16_t VDDAOVEN : 1; - volatile uint16_t VDDAUVEN : 1; - volatile uint16_t V2P5AOVEN : 1; - volatile uint16_t V2P5AUVEN : 1; - volatile uint16_t AFECPOVEN : 1; - volatile uint16_t AFECPUVEN : 1; - volatile uint16_t IBIASPERMOCEN : 1; - volatile uint16_t IBIASPERMUCEN : 1; - volatile uint16_t VPREREFSUVEN : 1; - volatile uint16_t VAUXOVEN : 1; - volatile uint16_t VAUXUVEN : 1; - volatile uint16_t VDDCOVEN : 1; - volatile uint16_t VDDCUVEN : 1; - volatile uint16_t reserved0 : 2; - } B; -} mc33775_event_handling_registers_feh_supply_flt_evt_cfg0_t; - -/* -------------------------------------------------------------------------- - * FEH_SUPPLY_FLT_EVT_CFG1 (read-write):Supply fault event selection register 1. - * -------------------------------------------------------------------------- */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_OFFSET (0x431U) -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_RW_MSK (0x3FU) -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_RD_MSK (0x3FU) -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_WR_MSK (0x3FU) -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_MW_MSK (0x0U) -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_RA_MSK (0x0U) -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_POR_MSK (0xffffU) -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_POR_VAL (0x0U) - -/* Field VBATLVEN: Event on VBAT Supply low-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_VBATLVEN_POS (0U) -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_VBATLVEN_MSK (0x1U) - -/* Enumerated value NO_EV: No event on VBAT Supply low-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_VBATLVEN_NO_EV_ENUM_VAL (0U) - -/* Enumerated value EVENT: Event on VBAT Supply low-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_VBATLVEN_EVENT_ENUM_VAL (1U) - -/* Field VPREREFSOVEN: Event on VPREREFS Supply over-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_VPREREFSOVEN_POS (1U) -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_VPREREFSOVEN_MSK (0x2U) - -/* Enumerated value NO_EV: No event on VPREREFS Supply over-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_VPREREFSOVEN_NO_EV_ENUM_VAL (0U) - -/* Enumerated value EVENT: Event on VPREREFS Supply over-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_VPREREFSOVEN_EVENT_ENUM_VAL (1U) - -/* Field VDDCHCEN: Event on VDDC high-current fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_VDDCHCEN_POS (2U) -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_VDDCHCEN_MSK (0x4U) - -/* Enumerated value NO_EV: No event on VDDC high-current fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_VDDCHCEN_NO_EV_ENUM_VAL (0U) - -/* Enumerated value EVENT: Event on VDDC high-current fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_VDDCHCEN_EVENT_ENUM_VAL (1U) - -/* Field VDDIOOVEN: Event on VDDIO Supply over-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_VDDIOOVEN_POS (3U) -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_VDDIOOVEN_MSK (0x8U) - -/* Enumerated value NO_EV: No event on VDDIO Supply over-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_VDDIOOVEN_NO_EV_ENUM_VAL (0U) - -/* Enumerated value EVENT: Event on VDDIO Supply over-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_VDDIOOVEN_EVENT_ENUM_VAL (1U) - -/* Field VDDIOUVEN: Event on VDDIO Supply under-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_VDDIOUVEN_POS (4U) -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_VDDIOUVEN_MSK (0x10U) - -/* Enumerated value NO_EV: No event on VDDIO Supply under-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_VDDIOUVEN_NO_EV_ENUM_VAL (0U) - -/* Enumerated value EVENT: Event on VDDIO Supply under-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_VDDIOUVEN_EVENT_ENUM_VAL (1U) - -/* Field VPREOVEN: Event on VPRE Supply over-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_VPREOVEN_POS (5U) -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_VPREOVEN_MSK (0x20U) - -/* Enumerated value NO_EV: No event on VPRE Supply over-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_VPREOVEN_NO_EV_ENUM_VAL (0U) - -/* Enumerated value EVENT: Event on VPRE Supply over-voltage fault. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_VPREOVEN_EVENT_ENUM_VAL (1U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_RESERVED0_POS (6U) -#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_RESERVED0_MSK (0xFFC0U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VBATLVEN : 1; - volatile uint16_t VPREREFSOVEN : 1; - volatile uint16_t VDDCHCEN : 1; - volatile uint16_t VDDIOOVEN : 1; - volatile uint16_t VDDIOUVEN : 1; - volatile uint16_t VPREOVEN : 1; - volatile uint16_t reserved0 : 10; - } B; -} mc33775_event_handling_registers_feh_supply_flt_evt_cfg1_t; - -/* -------------------------------------------------------------------------- - * FEH_ANA_FLT_EVT_CFG (read-write):Analog fault event enable register. - * -------------------------------------------------------------------------- */ -#define MC33775_FEH_ANA_FLT_EVT_CFG_OFFSET (0x432U) -#define MC33775_FEH_ANA_FLT_EVT_CFG_RW_MSK (0x7U) -#define MC33775_FEH_ANA_FLT_EVT_CFG_RD_MSK (0x7U) -#define MC33775_FEH_ANA_FLT_EVT_CFG_WR_MSK (0x7U) -#define MC33775_FEH_ANA_FLT_EVT_CFG_MW_MSK (0x0U) -#define MC33775_FEH_ANA_FLT_EVT_CFG_RA_MSK (0x0U) -#define MC33775_FEH_ANA_FLT_EVT_CFG_POR_MSK (0xffffU) -#define MC33775_FEH_ANA_FLT_EVT_CFG_POR_VAL (0x0U) - -/* Field MONBISTEN: Event on Monitor BIST fault. */ -#define MC33775_FEH_ANA_FLT_EVT_CFG_MONBISTEN_POS (0U) -#define MC33775_FEH_ANA_FLT_EVT_CFG_MONBISTEN_MSK (0x1U) - -/* Enumerated value NO_EV: No event on Monitor BIST fault. */ -#define MC33775_FEH_ANA_FLT_EVT_CFG_MONBISTEN_NO_EV_ENUM_VAL (0U) - -/* Enumerated value EVENT: Event on Monitor BIST fault. */ -#define MC33775_FEH_ANA_FLT_EVT_CFG_MONBISTEN_EVENT_ENUM_VAL (1U) - -/* Field BALFLTEN: Event on cell balance function fault. */ -#define MC33775_FEH_ANA_FLT_EVT_CFG_BALFLTEN_POS (1U) -#define MC33775_FEH_ANA_FLT_EVT_CFG_BALFLTEN_MSK (0x2U) - -/* Enumerated value NO_EV: No event on cell balance function fault. */ -#define MC33775_FEH_ANA_FLT_EVT_CFG_BALFLTEN_NO_EV_ENUM_VAL (0U) - -/* Enumerated value EVENT: Event on cell balance function fault. */ -#define MC33775_FEH_ANA_FLT_EVT_CFG_BALFLTEN_EVENT_ENUM_VAL (1U) - -/* Field FUSEFLTEN: Event on a corrected bit error in the fuse data has been detected. */ -#define MC33775_FEH_ANA_FLT_EVT_CFG_FUSEFLTEN_POS (2U) -#define MC33775_FEH_ANA_FLT_EVT_CFG_FUSEFLTEN_MSK (0x4U) - -/* Enumerated value NO_EV: No event on a corrected bit error in the fuse data has been detected. */ -#define MC33775_FEH_ANA_FLT_EVT_CFG_FUSEFLTEN_NO_EV_ENUM_VAL (0U) - -/* Enumerated value EVENT: Event on a corrected bit error in the fuse data has been detected. */ -#define MC33775_FEH_ANA_FLT_EVT_CFG_FUSEFLTEN_EVENT_ENUM_VAL (1U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_FEH_ANA_FLT_EVT_CFG_RESERVED0_POS (3U) -#define MC33775_FEH_ANA_FLT_EVT_CFG_RESERVED0_MSK (0xFFF8U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t MONBISTEN : 1; - volatile uint16_t BALFLTEN : 1; - volatile uint16_t FUSEFLTEN : 1; - volatile uint16_t reserved0 : 13; - } B; -} mc33775_event_handling_registers_feh_ana_flt_evt_cfg_t; - -/* -------------------------------------------------------------------------- - * FEH_COM_FLT_EVT_CFG (read-write):Communication fault event enable register. - * -------------------------------------------------------------------------- */ -#define MC33775_FEH_COM_FLT_EVT_CFG_OFFSET (0x433U) -#define MC33775_FEH_COM_FLT_EVT_CFG_RW_MSK (0x17U) -#define MC33775_FEH_COM_FLT_EVT_CFG_RD_MSK (0x17U) -#define MC33775_FEH_COM_FLT_EVT_CFG_WR_MSK (0x17U) -#define MC33775_FEH_COM_FLT_EVT_CFG_MW_MSK (0x0U) -#define MC33775_FEH_COM_FLT_EVT_CFG_RA_MSK (0x0U) -#define MC33775_FEH_COM_FLT_EVT_CFG_POR_MSK (0xffffU) -#define MC33775_FEH_COM_FLT_EVT_CFG_POR_VAL (0x0U) - -/* Field FRAMEERREN: Event on communication error detected. Wrong number of bits, bit-length error. */ -#define MC33775_FEH_COM_FLT_EVT_CFG_FRAMEERREN_POS (0U) -#define MC33775_FEH_COM_FLT_EVT_CFG_FRAMEERREN_MSK (0x1U) - -/* Enumerated value NO_EV: No event on communication error detected. */ -#define MC33775_FEH_COM_FLT_EVT_CFG_FRAMEERREN_NO_EV_ENUM_VAL (0U) - -/* Enumerated value EVENT: Event on communication error detected. */ -#define MC33775_FEH_COM_FLT_EVT_CFG_FRAMEERREN_EVENT_ENUM_VAL (1U) - -/* Field CRCERREN: Event on communication CRC error detected. */ -#define MC33775_FEH_COM_FLT_EVT_CFG_CRCERREN_POS (1U) -#define MC33775_FEH_COM_FLT_EVT_CFG_CRCERREN_MSK (0x2U) - -/* Enumerated value NO_EV: No event on communication CRC error detected. */ -#define MC33775_FEH_COM_FLT_EVT_CFG_CRCERREN_NO_EV_ENUM_VAL (0U) - -/* Enumerated value EVENT: Event on communication CRC error detected. */ -#define MC33775_FEH_COM_FLT_EVT_CFG_CRCERREN_EVENT_ENUM_VAL (1U) - -/* Field ERRCNTOFEN: Event on communication error counter has reached max value. */ -#define MC33775_FEH_COM_FLT_EVT_CFG_ERRCNTOFEN_POS (2U) -#define MC33775_FEH_COM_FLT_EVT_CFG_ERRCNTOFEN_MSK (0x4U) - -/* Enumerated value NO_EV: No event on communication error counter has reached max value. */ -#define MC33775_FEH_COM_FLT_EVT_CFG_ERRCNTOFEN_NO_EV_ENUM_VAL (0U) - -/* Enumerated value EVENT: Event on communication error counter has reached max value. */ -#define MC33775_FEH_COM_FLT_EVT_CFG_ERRCNTOFEN_EVENT_ENUM_VAL (1U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_FEH_COM_FLT_EVT_CFG_RESERVED0_POS (3U) -#define MC33775_FEH_COM_FLT_EVT_CFG_RESERVED0_MSK (0x8U) - -/* Field RSPLENERREN: Event on number of SPI clocks did not fit to the length of a requested response */ -#define MC33775_FEH_COM_FLT_EVT_CFG_RSPLENERREN_POS (4U) -#define MC33775_FEH_COM_FLT_EVT_CFG_RSPLENERREN_MSK (0x10U) - -/* Enumerated value NO_EV: No event on number of SPI clocks did not fit to the length of a requested response */ -#define MC33775_FEH_COM_FLT_EVT_CFG_RSPLENERREN_NO_EV_ENUM_VAL (0U) - -/* Enumerated value EVENT: Event on number of SPI clocks did not fit to the length of a requested response */ -#define MC33775_FEH_COM_FLT_EVT_CFG_RSPLENERREN_EVENT_ENUM_VAL (1U) - -/* Field reserved1: This read-only field is reserved and always has the value 0. */ -#define MC33775_FEH_COM_FLT_EVT_CFG_RESERVED1_POS (5U) -#define MC33775_FEH_COM_FLT_EVT_CFG_RESERVED1_MSK (0xFFE0U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t FRAMEERREN : 1; - volatile uint16_t CRCERREN : 1; - volatile uint16_t ERRCNTOFEN : 1; - volatile uint16_t reserved0 : 1; - volatile uint16_t RSPLENERREN : 1; - volatile uint16_t reserved1 : 11; - } B; -} mc33775_event_handling_registers_feh_com_flt_evt_cfg_t; - -/* -------------------------------------------------------------------------- - * FEH_MEAS_FLT_EVT_CFG (read-write):Measurement fault event enable register. - * -------------------------------------------------------------------------- */ -#define MC33775_FEH_MEAS_FLT_EVT_CFG_OFFSET (0x434U) -#define MC33775_FEH_MEAS_FLT_EVT_CFG_RW_MSK (0x7U) -#define MC33775_FEH_MEAS_FLT_EVT_CFG_RD_MSK (0x7U) -#define MC33775_FEH_MEAS_FLT_EVT_CFG_WR_MSK (0x7U) -#define MC33775_FEH_MEAS_FLT_EVT_CFG_MW_MSK (0x0U) -#define MC33775_FEH_MEAS_FLT_EVT_CFG_RA_MSK (0x0U) -#define MC33775_FEH_MEAS_FLT_EVT_CFG_POR_MSK (0xffffU) -#define MC33775_FEH_MEAS_FLT_EVT_CFG_POR_VAL (0x0U) - -/* Field PRIMCALCRCFLTEN: Event on primary calibration CRC fault. */ -#define MC33775_FEH_MEAS_FLT_EVT_CFG_PRIMCALCRCFLTEN_POS (0U) -#define MC33775_FEH_MEAS_FLT_EVT_CFG_PRIMCALCRCFLTEN_MSK (0x1U) - -/* Enumerated value NO_EV: No event on primary calibration CRC fault. */ -#define MC33775_FEH_MEAS_FLT_EVT_CFG_PRIMCALCRCFLTEN_NO_EV_ENUM_VAL (0U) - -/* Enumerated value EVENT: Event on primary calibration CRC fault. */ -#define MC33775_FEH_MEAS_FLT_EVT_CFG_PRIMCALCRCFLTEN_EVENT_ENUM_VAL (1U) - -/* Field SECCALCRCFLTEN: Event on secondary calibration CRC fault. */ -#define MC33775_FEH_MEAS_FLT_EVT_CFG_SECCALCRCFLTEN_POS (1U) -#define MC33775_FEH_MEAS_FLT_EVT_CFG_SECCALCRCFLTEN_MSK (0x2U) - -/* Enumerated value NO_EV: No event on secondary calibration CRC fault. */ -#define MC33775_FEH_MEAS_FLT_EVT_CFG_SECCALCRCFLTEN_NO_EV_ENUM_VAL (0U) - -/* Enumerated value EVENT: Event on secondary calibration CRC fault. */ -#define MC33775_FEH_MEAS_FLT_EVT_CFG_SECCALCRCFLTEN_EVENT_ENUM_VAL (1U) - -/* Field SYNCMEASFLTEN: Event on synchronization fault between the measurement units for a Sync cycle. */ -#define MC33775_FEH_MEAS_FLT_EVT_CFG_SYNCMEASFLTEN_POS (2U) -#define MC33775_FEH_MEAS_FLT_EVT_CFG_SYNCMEASFLTEN_MSK (0x4U) - -/* Enumerated value NO_EV: No event on synchronization fault. */ -#define MC33775_FEH_MEAS_FLT_EVT_CFG_SYNCMEASFLTEN_NO_EV_ENUM_VAL (0U) - -/* Enumerated value EVENT: Event on synchronization fault. */ -#define MC33775_FEH_MEAS_FLT_EVT_CFG_SYNCMEASFLTEN_EVENT_ENUM_VAL (1U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_FEH_MEAS_FLT_EVT_CFG_RESERVED0_POS (3U) -#define MC33775_FEH_MEAS_FLT_EVT_CFG_RESERVED0_MSK (0xFFF8U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t PRIMCALCRCFLTEN : 1; - volatile uint16_t SECCALCRCFLTEN : 1; - volatile uint16_t SYNCMEASFLTEN : 1; - volatile uint16_t reserved0 : 13; - } B; -} mc33775_event_handling_registers_feh_meas_flt_evt_cfg_t; - -/* -------------------------------------------------------------------------- - * FEH_POR_REASON (read-only):Last power on reset reason. The value is stored in the ULP domain. - * -------------------------------------------------------------------------- */ -#define MC33775_FEH_POR_REASON_OFFSET (0x480U) -#define MC33775_FEH_POR_REASON_RW_MSK (0x0U) -#define MC33775_FEH_POR_REASON_RD_MSK (0x3FFU) -#define MC33775_FEH_POR_REASON_WR_MSK (0x0U) -#define MC33775_FEH_POR_REASON_MW_MSK (0x0U) -#define MC33775_FEH_POR_REASON_RA_MSK (0x0U) -#define MC33775_FEH_POR_REASON_POR_MSK (0xffffU) -#define MC33775_FEH_POR_REASON_POR_VAL (0x0U) - -/* Field SOURCE: Reason for last POR: Binary coded and protected by an EDC. */ -#define MC33775_FEH_POR_REASON_SOURCE_POS (0U) -#define MC33775_FEH_POR_REASON_SOURCE_MSK (0x3FFU) - -/* Enumerated value VDDDLPPERMUV: POR caused by VDDDLPPERMUV */ -#define MC33775_FEH_POR_REASON_SOURCE_VDDDLPPERMUV_ENUM_VAL (0U) - -/* Enumerated value VDDDLPUV: POR caused by VDDDLPUV */ -#define MC33775_FEH_POR_REASON_SOURCE_VDDDLPUV_ENUM_VAL (15U) - -/* Enumerated value RESET: POR caused by RESET */ -#define MC33775_FEH_POR_REASON_SOURCE_RESET_ENUM_VAL (65U) - -/* Enumerated value VDDDUV: POR caused by VDDDUV */ -#define MC33775_FEH_POR_REASON_SOURCE_VDDDUV_ENUM_VAL (78U) - -/* Enumerated value VBATLV: POR caused by VBATLV */ -#define MC33775_FEH_POR_REASON_SOURCE_VBATLV_ENUM_VAL (131U) - -/* Enumerated value VDDIOUV: POR caused by VDDIOUV */ -#define MC33775_FEH_POR_REASON_SOURCE_VDDIOUV_ENUM_VAL (140U) - -/* Enumerated value SWRESET: POR caused by software Deep Sleep request */ -#define MC33775_FEH_POR_REASON_SOURCE_SWRESET_ENUM_VAL (191U) - -/* Enumerated value VBATOV: POR caused by VBATOV */ -#define MC33775_FEH_POR_REASON_SOURCE_VBATOV_ENUM_VAL (194U) - -/* Enumerated value VDDDOV: POR caused by VDDDOV */ -#define MC33775_FEH_POR_REASON_SOURCE_VDDDOV_ENUM_VAL (205U) - -/* Enumerated value VDDCOV: POR caused by VDDCOV */ -#define MC33775_FEH_POR_REASON_SOURCE_VDDCOV_ENUM_VAL (261U) - -/* Enumerated value VAUXUV: POR caused by VAUXUV */ -#define MC33775_FEH_POR_REASON_SOURCE_VAUXUV_ENUM_VAL (266U) - -/* Enumerated value VBATUV: POR caused by VBATUV */ -#define MC33775_FEH_POR_REASON_SOURCE_VBATUV_ENUM_VAL (324U) - -/* Enumerated value VDDIOOV: POR caused by VDDIOOV */ -#define MC33775_FEH_POR_REASON_SOURCE_VDDIOOV_ENUM_VAL (331U) - -/* Enumerated value VDDCUV: POR caused by VDDCUV */ -#define MC33775_FEH_POR_REASON_SOURCE_VDDCUV_ENUM_VAL (390U) - -/* Enumerated value VAUXOV: POR caused by VAUXOV */ -#define MC33775_FEH_POR_REASON_SOURCE_VAUXOV_ENUM_VAL (393U) - -/* Enumerated value VDDCOC: POR caused by VDDCOC */ -#define MC33775_FEH_POR_REASON_SOURCE_VDDCOC_ENUM_VAL (455U) - -/* Enumerated value VDDCHC: POR caused by VDDCHC */ -#define MC33775_FEH_POR_REASON_SOURCE_VDDCHC_ENUM_VAL (456U) - -/* Enumerated value VDDAUV: POR caused by VDDAUV */ -#define MC33775_FEH_POR_REASON_SOURCE_VDDAUV_ENUM_VAL (529U) - -/* Enumerated value SLEEPOSC: POR caused by SLEEPOSC */ -#define MC33775_FEH_POR_REASON_SOURCE_SLEEPOSC_ENUM_VAL (542U) - -/* Enumerated value VDDAOV: POR caused by VDDAOV */ -#define MC33775_FEH_POR_REASON_SOURCE_VDDAOV_ENUM_VAL (592U) - -/* Enumerated value COMTO: POR caused by COMTO */ -#define MC33775_FEH_POR_REASON_SOURCE_COMTO_ENUM_VAL (607U) - -/* Enumerated value VPREOV: POR caused by VPREOV */ -#define MC33775_FEH_POR_REASON_SOURCE_VPREOV_ENUM_VAL (658U) - -/* Enumerated value SECCLK: POR caused by SECCLK */ -#define MC33775_FEH_POR_REASON_SOURCE_SECCLK_ENUM_VAL (669U) - -/* Enumerated value LOGICERR: POR caused by LOGICERR */ -#define MC33775_FEH_POR_REASON_SOURCE_LOGICERR_ENUM_VAL (673U) - -/* Enumerated value VPREREFSOV: POR caused by VPREREFSOV */ -#define MC33775_FEH_POR_REASON_SOURCE_VPREREFSOV_ENUM_VAL (723U) - -/* Enumerated value PRMCLK: POR caused by PRMCLK */ -#define MC33775_FEH_POR_REASON_SOURCE_PRMCLK_ENUM_VAL (732U) - -/* Enumerated value COMERRORS: POR caused by COMERRORS */ -#define MC33775_FEH_POR_REASON_SOURCE_COMERRORS_ENUM_VAL (736U) - -/* Enumerated value VPREREFSUV: POR caused by VPREREFSUV */ -#define MC33775_FEH_POR_REASON_SOURCE_VPREREFSUV_ENUM_VAL (788U) - -/* Enumerated value OTEMPSHUTDOWN: POR caused by OTEMPSHUTDOWN */ -#define MC33775_FEH_POR_REASON_SOURCE_OTEMPSHUTDOWN_ENUM_VAL (795U) - -/* Enumerated value V2P5AOV: POR caused by V2P5AOV */ -#define MC33775_FEH_POR_REASON_SOURCE_V2P5AOV_ENUM_VAL (853U) - -/* Enumerated value IBIASPERMUC: POR caused by IBIASPERMUC */ -#define MC33775_FEH_POR_REASON_SOURCE_IBIASPERMUC_ENUM_VAL (858U) - -/* Enumerated value AFECPOV: POR caused by AFECPOV */ -#define MC33775_FEH_POR_REASON_SOURCE_AFECPOV_ENUM_VAL (919U) - -/* Enumerated value AFECPUV: POR caused by AFECPUV */ -#define MC33775_FEH_POR_REASON_SOURCE_AFECPUV_ENUM_VAL (920U) - -/* Enumerated value V2P5AUV: POR caused by V2P5AUV */ -#define MC33775_FEH_POR_REASON_SOURCE_V2P5AUV_ENUM_VAL (982U) - -/* Enumerated value IBIASPERMOC: POR caused by IBIASPERMOC */ -#define MC33775_FEH_POR_REASON_SOURCE_IBIASPERMOC_ENUM_VAL (985U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_FEH_POR_REASON_RESERVED0_POS (10U) -#define MC33775_FEH_POR_REASON_RESERVED0_MSK (0xFC00U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t SOURCE : 10; - volatile uint16_t reserved0 : 6; - } B; -} mc33775_event_handling_registers_feh_por_reason_t; - -/* -------------------------------------------------------------------------- - * GPIO_CFG0 (read-write):GPIO configuration 0 - * -------------------------------------------------------------------------- */ -#define MC33775_GPIO_CFG0_OFFSET (0x800U) -#define MC33775_GPIO_CFG0_RW_MSK (0xFFFFU) -#define MC33775_GPIO_CFG0_RD_MSK (0xFFFFU) -#define MC33775_GPIO_CFG0_WR_MSK (0xFFFFU) -#define MC33775_GPIO_CFG0_MW_MSK (0x0U) -#define MC33775_GPIO_CFG0_RA_MSK (0x0U) -#define MC33775_GPIO_CFG0_POR_MSK (0xffffU) -#define MC33775_GPIO_CFG0_POR_VAL (0x0U) - -/* Field INPEN0: Enable the input for GPIO0. If a special function requires digital input, the according receiver is enabled automatically. This is not reflected in this bit. */ -#define MC33775_GPIO_CFG0_INPEN0_POS (0U) -#define MC33775_GPIO_CFG0_INPEN0_MSK (0x1U) - -/* Enumerated value DISABLED: Input is disabled */ -#define MC33775_GPIO_CFG0_INPEN0_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Input is enabled */ -#define MC33775_GPIO_CFG0_INPEN0_ENABLED_ENUM_VAL (1U) - -/* Field INPEN1: Enable the input for GPIO1. If a special function requires digital input, the according receiver is enabled automatically. This is not reflected in this bit. */ -#define MC33775_GPIO_CFG0_INPEN1_POS (1U) -#define MC33775_GPIO_CFG0_INPEN1_MSK (0x2U) - -/* Enumerated value DISABLED: Input is disabled */ -#define MC33775_GPIO_CFG0_INPEN1_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Input is enabled */ -#define MC33775_GPIO_CFG0_INPEN1_ENABLED_ENUM_VAL (1U) - -/* Field INPEN2: Enable the input for GPIO2. If a special function requires digital input, the according receiver is enabled automatically. This is not reflected in this bit. */ -#define MC33775_GPIO_CFG0_INPEN2_POS (2U) -#define MC33775_GPIO_CFG0_INPEN2_MSK (0x4U) - -/* Enumerated value DISABLED: Input is disabled */ -#define MC33775_GPIO_CFG0_INPEN2_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Input is enabled */ -#define MC33775_GPIO_CFG0_INPEN2_ENABLED_ENUM_VAL (1U) - -/* Field INPEN3: Enable the input for GPIO3. If a special function requires digital input, the according receiver is enabled automatically. This is not reflected in this bit. */ -#define MC33775_GPIO_CFG0_INPEN3_POS (3U) -#define MC33775_GPIO_CFG0_INPEN3_MSK (0x8U) - -/* Enumerated value DISABLED: Input is disabled */ -#define MC33775_GPIO_CFG0_INPEN3_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Input is enabled */ -#define MC33775_GPIO_CFG0_INPEN3_ENABLED_ENUM_VAL (1U) - -/* Field INPEN4: Enable the input for GPIO4. If a special function requires digital input, the according receiver is enabled automatically. This is not reflected in this bit. */ -#define MC33775_GPIO_CFG0_INPEN4_POS (4U) -#define MC33775_GPIO_CFG0_INPEN4_MSK (0x10U) - -/* Enumerated value DISABLED: Input is disabled */ -#define MC33775_GPIO_CFG0_INPEN4_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Input is enabled */ -#define MC33775_GPIO_CFG0_INPEN4_ENABLED_ENUM_VAL (1U) - -/* Field INPEN5: Enable the input for GPIO5. If a special function requires digital input, the according receiver is enabled automatically. This is not reflected in this bit. */ -#define MC33775_GPIO_CFG0_INPEN5_POS (5U) -#define MC33775_GPIO_CFG0_INPEN5_MSK (0x20U) - -/* Enumerated value DISABLED: Input is disabled */ -#define MC33775_GPIO_CFG0_INPEN5_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Input is enabled */ -#define MC33775_GPIO_CFG0_INPEN5_ENABLED_ENUM_VAL (1U) - -/* Field INPEN6: Enable the input for GPIO6. If a special function requires digital input, the according receiver is enabled automatically. This is not reflected in this bit. */ -#define MC33775_GPIO_CFG0_INPEN6_POS (6U) -#define MC33775_GPIO_CFG0_INPEN6_MSK (0x40U) - -/* Enumerated value DISABLED: Input is disabled */ -#define MC33775_GPIO_CFG0_INPEN6_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Input is enabled */ -#define MC33775_GPIO_CFG0_INPEN6_ENABLED_ENUM_VAL (1U) - -/* Field INPEN7: Enable the input for GPIO7. If a special function requires digital input, the according receiver is enabled automatically. This is not reflected in this bit. */ -#define MC33775_GPIO_CFG0_INPEN7_POS (7U) -#define MC33775_GPIO_CFG0_INPEN7_MSK (0x80U) - -/* Enumerated value DISABLED: Input is disabled */ -#define MC33775_GPIO_CFG0_INPEN7_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Input is enabled */ -#define MC33775_GPIO_CFG0_INPEN7_ENABLED_ENUM_VAL (1U) - -/* Field OUTEN0: Enable the output of the GPIO0. */ -#define MC33775_GPIO_CFG0_OUTEN0_POS (8U) -#define MC33775_GPIO_CFG0_OUTEN0_MSK (0x100U) - -/* Enumerated value DISABLED: Output is disabled */ -#define MC33775_GPIO_CFG0_OUTEN0_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Output is enabled */ -#define MC33775_GPIO_CFG0_OUTEN0_ENABLED_ENUM_VAL (1U) - -/* Field OUTEN1: Enable the output of the GPIO1. */ -#define MC33775_GPIO_CFG0_OUTEN1_POS (9U) -#define MC33775_GPIO_CFG0_OUTEN1_MSK (0x200U) - -/* Enumerated value DISABLED: Output is disabled */ -#define MC33775_GPIO_CFG0_OUTEN1_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Output is enabled */ -#define MC33775_GPIO_CFG0_OUTEN1_ENABLED_ENUM_VAL (1U) - -/* Field OUTEN2: Enable the output of the GPIO2. */ -#define MC33775_GPIO_CFG0_OUTEN2_POS (10U) -#define MC33775_GPIO_CFG0_OUTEN2_MSK (0x400U) - -/* Enumerated value DISABLED: Output is disabled */ -#define MC33775_GPIO_CFG0_OUTEN2_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Output is enabled */ -#define MC33775_GPIO_CFG0_OUTEN2_ENABLED_ENUM_VAL (1U) - -/* Field OUTEN3: Enable the output of the GPIO3. */ -#define MC33775_GPIO_CFG0_OUTEN3_POS (11U) -#define MC33775_GPIO_CFG0_OUTEN3_MSK (0x800U) - -/* Enumerated value DISABLED: Output is disabled */ -#define MC33775_GPIO_CFG0_OUTEN3_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Output is enabled */ -#define MC33775_GPIO_CFG0_OUTEN3_ENABLED_ENUM_VAL (1U) - -/* Field OUTEN4: Enable the output of the GPIO4. */ -#define MC33775_GPIO_CFG0_OUTEN4_POS (12U) -#define MC33775_GPIO_CFG0_OUTEN4_MSK (0x1000U) - -/* Enumerated value DISABLED: Output is disabled */ -#define MC33775_GPIO_CFG0_OUTEN4_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Output is enabled */ -#define MC33775_GPIO_CFG0_OUTEN4_ENABLED_ENUM_VAL (1U) - -/* Field OUTEN5: Enable the output of the GPIO5. */ -#define MC33775_GPIO_CFG0_OUTEN5_POS (13U) -#define MC33775_GPIO_CFG0_OUTEN5_MSK (0x2000U) - -/* Enumerated value DISABLED: Output is disabled */ -#define MC33775_GPIO_CFG0_OUTEN5_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Output is enabled */ -#define MC33775_GPIO_CFG0_OUTEN5_ENABLED_ENUM_VAL (1U) - -/* Field OUTEN6: Enable the output of the GPIO6. */ -#define MC33775_GPIO_CFG0_OUTEN6_POS (14U) -#define MC33775_GPIO_CFG0_OUTEN6_MSK (0x4000U) - -/* Enumerated value DISABLED: Output is disabled */ -#define MC33775_GPIO_CFG0_OUTEN6_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Output is enabled */ -#define MC33775_GPIO_CFG0_OUTEN6_ENABLED_ENUM_VAL (1U) - -/* Field OUTEN7: Enable the output of the GPIO7. */ -#define MC33775_GPIO_CFG0_OUTEN7_POS (15U) -#define MC33775_GPIO_CFG0_OUTEN7_MSK (0x8000U) - -/* Enumerated value DISABLED: Output is disabled */ -#define MC33775_GPIO_CFG0_OUTEN7_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Output is enabled */ -#define MC33775_GPIO_CFG0_OUTEN7_ENABLED_ENUM_VAL (1U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t INPEN0 : 1; - volatile uint16_t INPEN1 : 1; - volatile uint16_t INPEN2 : 1; - volatile uint16_t INPEN3 : 1; - volatile uint16_t INPEN4 : 1; - volatile uint16_t INPEN5 : 1; - volatile uint16_t INPEN6 : 1; - volatile uint16_t INPEN7 : 1; - volatile uint16_t OUTEN0 : 1; - volatile uint16_t OUTEN1 : 1; - volatile uint16_t OUTEN2 : 1; - volatile uint16_t OUTEN3 : 1; - volatile uint16_t OUTEN4 : 1; - volatile uint16_t OUTEN5 : 1; - volatile uint16_t OUTEN6 : 1; - volatile uint16_t OUTEN7 : 1; - } B; -} mc33775_gpio_registers_gpio_cfg0_t; - -/* -------------------------------------------------------------------------- - * GPIO_CFG1 (read-write):GPIO configuration 1 - * -------------------------------------------------------------------------- */ -#define MC33775_GPIO_CFG1_OFFSET (0x801U) -#define MC33775_GPIO_CFG1_RW_MSK (0xFFU) -#define MC33775_GPIO_CFG1_RD_MSK (0xFFU) -#define MC33775_GPIO_CFG1_WR_MSK (0xFFU) -#define MC33775_GPIO_CFG1_MW_MSK (0x0U) -#define MC33775_GPIO_CFG1_RA_MSK (0x0U) -#define MC33775_GPIO_CFG1_POR_MSK (0xffffU) -#define MC33775_GPIO_CFG1_POR_VAL (0x0U) - -/* Field ODEN0: Open Drain enable, GPIO0. */ -#define MC33775_GPIO_CFG1_ODEN0_POS (0U) -#define MC33775_GPIO_CFG1_ODEN0_MSK (0x1U) - -/* Enumerated value DISABLED: Open Drain disabled */ -#define MC33775_GPIO_CFG1_ODEN0_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Open Drain enabled */ -#define MC33775_GPIO_CFG1_ODEN0_ENABLED_ENUM_VAL (1U) - -/* Field ODEN1: Open Drain enable, GPIO1. */ -#define MC33775_GPIO_CFG1_ODEN1_POS (1U) -#define MC33775_GPIO_CFG1_ODEN1_MSK (0x2U) - -/* Enumerated value DISABLED: Open Drain disabled */ -#define MC33775_GPIO_CFG1_ODEN1_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Open Drain enabled */ -#define MC33775_GPIO_CFG1_ODEN1_ENABLED_ENUM_VAL (1U) - -/* Field ODEN2: Open Drain enable, GPIO2. */ -#define MC33775_GPIO_CFG1_ODEN2_POS (2U) -#define MC33775_GPIO_CFG1_ODEN2_MSK (0x4U) - -/* Enumerated value DISABLED: Open Drain disabled */ -#define MC33775_GPIO_CFG1_ODEN2_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Open Drain enabled */ -#define MC33775_GPIO_CFG1_ODEN2_ENABLED_ENUM_VAL (1U) - -/* Field ODEN3: Open Drain enable, GPIO3. */ -#define MC33775_GPIO_CFG1_ODEN3_POS (3U) -#define MC33775_GPIO_CFG1_ODEN3_MSK (0x8U) - -/* Enumerated value DISABLED: Open Drain disabled */ -#define MC33775_GPIO_CFG1_ODEN3_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Open Drain enabled */ -#define MC33775_GPIO_CFG1_ODEN3_ENABLED_ENUM_VAL (1U) - -/* Field ODEN4: Open Drain enable, GPIO4. */ -#define MC33775_GPIO_CFG1_ODEN4_POS (4U) -#define MC33775_GPIO_CFG1_ODEN4_MSK (0x10U) - -/* Enumerated value DISABLED: Open Drain disabled */ -#define MC33775_GPIO_CFG1_ODEN4_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Open Drain enabled */ -#define MC33775_GPIO_CFG1_ODEN4_ENABLED_ENUM_VAL (1U) - -/* Field ODEN5: Open Drain enable, GPIO5. */ -#define MC33775_GPIO_CFG1_ODEN5_POS (5U) -#define MC33775_GPIO_CFG1_ODEN5_MSK (0x20U) - -/* Enumerated value DISABLED: Open Drain disabled */ -#define MC33775_GPIO_CFG1_ODEN5_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Open Drain enabled */ -#define MC33775_GPIO_CFG1_ODEN5_ENABLED_ENUM_VAL (1U) - -/* Field ODEN6: Open Drain enable, GPIO6. */ -#define MC33775_GPIO_CFG1_ODEN6_POS (6U) -#define MC33775_GPIO_CFG1_ODEN6_MSK (0x40U) - -/* Enumerated value DISABLED: Open Drain disabled */ -#define MC33775_GPIO_CFG1_ODEN6_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Open Drain enabled */ -#define MC33775_GPIO_CFG1_ODEN6_ENABLED_ENUM_VAL (1U) - -/* Field ODEN7: Open Drain enable, GPIO7. */ -#define MC33775_GPIO_CFG1_ODEN7_POS (7U) -#define MC33775_GPIO_CFG1_ODEN7_MSK (0x80U) - -/* Enumerated value DISABLED: Open Drain disabled */ -#define MC33775_GPIO_CFG1_ODEN7_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Open Drain enabled */ -#define MC33775_GPIO_CFG1_ODEN7_ENABLED_ENUM_VAL (1U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_GPIO_CFG1_RESERVED0_POS (8U) -#define MC33775_GPIO_CFG1_RESERVED0_MSK (0xFF00U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t ODEN0 : 1; - volatile uint16_t ODEN1 : 1; - volatile uint16_t ODEN2 : 1; - volatile uint16_t ODEN3 : 1; - volatile uint16_t ODEN4 : 1; - volatile uint16_t ODEN5 : 1; - volatile uint16_t ODEN6 : 1; - volatile uint16_t ODEN7 : 1; - volatile uint16_t reserved0 : 8; - } B; -} mc33775_gpio_registers_gpio_cfg1_t; - -/* -------------------------------------------------------------------------- - * GPIO_OUT (read-write):GPIO output - * -------------------------------------------------------------------------- */ -#define MC33775_GPIO_OUT_OFFSET (0x802U) -#define MC33775_GPIO_OUT_RW_MSK (0xFFU) -#define MC33775_GPIO_OUT_RD_MSK (0xFFU) -#define MC33775_GPIO_OUT_WR_MSK (0xFFU) -#define MC33775_GPIO_OUT_MW_MSK (0x0U) -#define MC33775_GPIO_OUT_RA_MSK (0x0U) -#define MC33775_GPIO_OUT_POR_MSK (0xffffU) -#define MC33775_GPIO_OUT_POR_VAL (0x0U) - -/* Field OUT0: Set the output level of the gpio function for GPIO0. */ -#define MC33775_GPIO_OUT_OUT0_POS (0U) -#define MC33775_GPIO_OUT_OUT0_MSK (0x1U) - -/* Enumerated value LOW: GPIO is low */ -#define MC33775_GPIO_OUT_OUT0_LOW_ENUM_VAL (0U) - -/* Enumerated value HIGH: GPIO is high */ -#define MC33775_GPIO_OUT_OUT0_HIGH_ENUM_VAL (1U) - -/* Field OUT1: Set the output level of the gpio function for GPIO1. */ -#define MC33775_GPIO_OUT_OUT1_POS (1U) -#define MC33775_GPIO_OUT_OUT1_MSK (0x2U) - -/* Enumerated value LOW: GPIO is low */ -#define MC33775_GPIO_OUT_OUT1_LOW_ENUM_VAL (0U) - -/* Enumerated value HIGH: GPIO is high */ -#define MC33775_GPIO_OUT_OUT1_HIGH_ENUM_VAL (1U) - -/* Field OUT2: Set the output level of the gpio function for GPIO2. */ -#define MC33775_GPIO_OUT_OUT2_POS (2U) -#define MC33775_GPIO_OUT_OUT2_MSK (0x4U) - -/* Enumerated value LOW: GPIO is low */ -#define MC33775_GPIO_OUT_OUT2_LOW_ENUM_VAL (0U) - -/* Enumerated value HIGH: GPIO is high */ -#define MC33775_GPIO_OUT_OUT2_HIGH_ENUM_VAL (1U) - -/* Field OUT3: Set the output level of the gpio function for GPIO3. */ -#define MC33775_GPIO_OUT_OUT3_POS (3U) -#define MC33775_GPIO_OUT_OUT3_MSK (0x8U) - -/* Enumerated value LOW: GPIO is low */ -#define MC33775_GPIO_OUT_OUT3_LOW_ENUM_VAL (0U) - -/* Enumerated value HIGH: GPIO is high */ -#define MC33775_GPIO_OUT_OUT3_HIGH_ENUM_VAL (1U) - -/* Field OUT4: Set the output level of the gpio function for GPIO4. */ -#define MC33775_GPIO_OUT_OUT4_POS (4U) -#define MC33775_GPIO_OUT_OUT4_MSK (0x10U) - -/* Enumerated value LOW: GPIO is low */ -#define MC33775_GPIO_OUT_OUT4_LOW_ENUM_VAL (0U) - -/* Enumerated value HIGH: GPIO is high */ -#define MC33775_GPIO_OUT_OUT4_HIGH_ENUM_VAL (1U) - -/* Field OUT5: Set the output level of the gpio function for GPIO5. */ -#define MC33775_GPIO_OUT_OUT5_POS (5U) -#define MC33775_GPIO_OUT_OUT5_MSK (0x20U) - -/* Enumerated value LOW: GPIO is low */ -#define MC33775_GPIO_OUT_OUT5_LOW_ENUM_VAL (0U) - -/* Enumerated value HIGH: GPIO is high */ -#define MC33775_GPIO_OUT_OUT5_HIGH_ENUM_VAL (1U) - -/* Field OUT6: Set the output level of the gpio function for GPIO6. */ -#define MC33775_GPIO_OUT_OUT6_POS (6U) -#define MC33775_GPIO_OUT_OUT6_MSK (0x40U) - -/* Enumerated value LOW: GPIO is low */ -#define MC33775_GPIO_OUT_OUT6_LOW_ENUM_VAL (0U) - -/* Enumerated value HIGH: GPIO is high */ -#define MC33775_GPIO_OUT_OUT6_HIGH_ENUM_VAL (1U) - -/* Field OUT7: Set the output level of the gpio function for GPIO7. */ -#define MC33775_GPIO_OUT_OUT7_POS (7U) -#define MC33775_GPIO_OUT_OUT7_MSK (0x80U) - -/* Enumerated value LOW: GPIO is low */ -#define MC33775_GPIO_OUT_OUT7_LOW_ENUM_VAL (0U) - -/* Enumerated value HIGH: GPIO is high */ -#define MC33775_GPIO_OUT_OUT7_HIGH_ENUM_VAL (1U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_GPIO_OUT_RESERVED0_POS (8U) -#define MC33775_GPIO_OUT_RESERVED0_MSK (0xFF00U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t OUT0 : 1; - volatile uint16_t OUT1 : 1; - volatile uint16_t OUT2 : 1; - volatile uint16_t OUT3 : 1; - volatile uint16_t OUT4 : 1; - volatile uint16_t OUT5 : 1; - volatile uint16_t OUT6 : 1; - volatile uint16_t OUT7 : 1; - volatile uint16_t reserved0 : 8; - } B; -} mc33775_gpio_registers_gpio_out_t; - -/* -------------------------------------------------------------------------- - * GPIO_IN (read-only):GPIO input - * -------------------------------------------------------------------------- */ -#define MC33775_GPIO_IN_OFFSET (0x804U) -#define MC33775_GPIO_IN_RW_MSK (0x0U) -#define MC33775_GPIO_IN_RD_MSK (0xFFFFU) -#define MC33775_GPIO_IN_WR_MSK (0x0U) -#define MC33775_GPIO_IN_MW_MSK (0x0U) -#define MC33775_GPIO_IN_RA_MSK (0xFF00U) -#define MC33775_GPIO_IN_POR_MSK (0xffffU) -#define MC33775_GPIO_IN_POR_VAL (0x0U) - -/* Field IN0: Read the level of the gpio function of GPIO0. */ -#define MC33775_GPIO_IN_IN0_POS (0U) -#define MC33775_GPIO_IN_IN0_MSK (0x1U) - -/* Enumerated value LOW: GPIO is low */ -#define MC33775_GPIO_IN_IN0_LOW_ENUM_VAL (0U) - -/* Enumerated value HIGH: GPIO is high */ -#define MC33775_GPIO_IN_IN0_HIGH_ENUM_VAL (1U) - -/* Field IN1: Read the level of the gpio function of GPIO1. */ -#define MC33775_GPIO_IN_IN1_POS (1U) -#define MC33775_GPIO_IN_IN1_MSK (0x2U) - -/* Enumerated value LOW: GPIO is low */ -#define MC33775_GPIO_IN_IN1_LOW_ENUM_VAL (0U) - -/* Enumerated value HIGH: GPIO is high */ -#define MC33775_GPIO_IN_IN1_HIGH_ENUM_VAL (1U) - -/* Field IN2: Read the level of the gpio function of GPIO2. */ -#define MC33775_GPIO_IN_IN2_POS (2U) -#define MC33775_GPIO_IN_IN2_MSK (0x4U) - -/* Enumerated value LOW: GPIO is low */ -#define MC33775_GPIO_IN_IN2_LOW_ENUM_VAL (0U) - -/* Enumerated value HIGH: GPIO is high */ -#define MC33775_GPIO_IN_IN2_HIGH_ENUM_VAL (1U) - -/* Field IN3: Read the level of the gpio function of GPIO3. */ -#define MC33775_GPIO_IN_IN3_POS (3U) -#define MC33775_GPIO_IN_IN3_MSK (0x8U) - -/* Enumerated value LOW: GPIO is low */ -#define MC33775_GPIO_IN_IN3_LOW_ENUM_VAL (0U) - -/* Enumerated value HIGH: GPIO is high */ -#define MC33775_GPIO_IN_IN3_HIGH_ENUM_VAL (1U) - -/* Field IN4: Read the level of the gpio function of GPIO4. */ -#define MC33775_GPIO_IN_IN4_POS (4U) -#define MC33775_GPIO_IN_IN4_MSK (0x10U) - -/* Enumerated value LOW: GPIO is low */ -#define MC33775_GPIO_IN_IN4_LOW_ENUM_VAL (0U) - -/* Enumerated value HIGH: GPIO is high */ -#define MC33775_GPIO_IN_IN4_HIGH_ENUM_VAL (1U) - -/* Field IN5: Read the level of the gpio function of GPIO5. */ -#define MC33775_GPIO_IN_IN5_POS (5U) -#define MC33775_GPIO_IN_IN5_MSK (0x20U) - -/* Enumerated value LOW: GPIO is low */ -#define MC33775_GPIO_IN_IN5_LOW_ENUM_VAL (0U) - -/* Enumerated value HIGH: GPIO is high */ -#define MC33775_GPIO_IN_IN5_HIGH_ENUM_VAL (1U) - -/* Field IN6: Read the level of the gpio function of GPIO6. */ -#define MC33775_GPIO_IN_IN6_POS (6U) -#define MC33775_GPIO_IN_IN6_MSK (0x40U) - -/* Enumerated value LOW: GPIO is low */ -#define MC33775_GPIO_IN_IN6_LOW_ENUM_VAL (0U) - -/* Enumerated value HIGH: GPIO is high */ -#define MC33775_GPIO_IN_IN6_HIGH_ENUM_VAL (1U) - -/* Field IN7: Read the level of the gpio function of GPIO7. */ -#define MC33775_GPIO_IN_IN7_POS (7U) -#define MC33775_GPIO_IN_IN7_MSK (0x80U) - -/* Enumerated value LOW: GPIO is low */ -#define MC33775_GPIO_IN_IN7_LOW_ENUM_VAL (0U) - -/* Enumerated value HIGH: GPIO is high */ -#define MC33775_GPIO_IN_IN7_HIGH_ENUM_VAL (1U) - -/* Field HIGHDET0: High value on GPIO0. */ -#define MC33775_GPIO_IN_HIGHDET0_POS (8U) -#define MC33775_GPIO_IN_HIGHDET0_MSK (0x100U) - -/* Enumerated value NO_HIGH: No high level observed */ -#define MC33775_GPIO_IN_HIGHDET0_NO_HIGH_ENUM_VAL (0U) - -/* Enumerated value HIGH: High level observed. */ -#define MC33775_GPIO_IN_HIGHDET0_HIGH_ENUM_VAL (1U) - -/* Field HIGHDET1: High value on GPIO1. */ -#define MC33775_GPIO_IN_HIGHDET1_POS (9U) -#define MC33775_GPIO_IN_HIGHDET1_MSK (0x200U) - -/* Enumerated value NO_HIGH: No high level observed */ -#define MC33775_GPIO_IN_HIGHDET1_NO_HIGH_ENUM_VAL (0U) - -/* Enumerated value HIGH: High level observed. */ -#define MC33775_GPIO_IN_HIGHDET1_HIGH_ENUM_VAL (1U) - -/* Field HIGHDET2: High value on GPIO2. */ -#define MC33775_GPIO_IN_HIGHDET2_POS (10U) -#define MC33775_GPIO_IN_HIGHDET2_MSK (0x400U) - -/* Enumerated value NO_HIGH: No high level observed */ -#define MC33775_GPIO_IN_HIGHDET2_NO_HIGH_ENUM_VAL (0U) - -/* Enumerated value HIGH: High level observed. */ -#define MC33775_GPIO_IN_HIGHDET2_HIGH_ENUM_VAL (1U) - -/* Field HIGHDET3: High value on GPIO3. */ -#define MC33775_GPIO_IN_HIGHDET3_POS (11U) -#define MC33775_GPIO_IN_HIGHDET3_MSK (0x800U) - -/* Enumerated value NO_HIGH: No high level observed */ -#define MC33775_GPIO_IN_HIGHDET3_NO_HIGH_ENUM_VAL (0U) - -/* Enumerated value HIGH: High level observed. */ -#define MC33775_GPIO_IN_HIGHDET3_HIGH_ENUM_VAL (1U) - -/* Field HIGHDET4: High value on GPIO4. */ -#define MC33775_GPIO_IN_HIGHDET4_POS (12U) -#define MC33775_GPIO_IN_HIGHDET4_MSK (0x1000U) - -/* Enumerated value NO_HIGH: No high level observed */ -#define MC33775_GPIO_IN_HIGHDET4_NO_HIGH_ENUM_VAL (0U) - -/* Enumerated value HIGH: High level observed. */ -#define MC33775_GPIO_IN_HIGHDET4_HIGH_ENUM_VAL (1U) - -/* Field HIGHDET5: High value on GPIO5. */ -#define MC33775_GPIO_IN_HIGHDET5_POS (13U) -#define MC33775_GPIO_IN_HIGHDET5_MSK (0x2000U) - -/* Enumerated value NO_HIGH: No high level observed */ -#define MC33775_GPIO_IN_HIGHDET5_NO_HIGH_ENUM_VAL (0U) - -/* Enumerated value HIGH: High level observed. */ -#define MC33775_GPIO_IN_HIGHDET5_HIGH_ENUM_VAL (1U) - -/* Field HIGHDET6: High value on GPIO6. */ -#define MC33775_GPIO_IN_HIGHDET6_POS (14U) -#define MC33775_GPIO_IN_HIGHDET6_MSK (0x4000U) - -/* Enumerated value NO_HIGH: No high level observed */ -#define MC33775_GPIO_IN_HIGHDET6_NO_HIGH_ENUM_VAL (0U) - -/* Enumerated value HIGH: High level observed. */ -#define MC33775_GPIO_IN_HIGHDET6_HIGH_ENUM_VAL (1U) - -/* Field HIGHDET7: High value on GPIO7. */ -#define MC33775_GPIO_IN_HIGHDET7_POS (15U) -#define MC33775_GPIO_IN_HIGHDET7_MSK (0x8000U) - -/* Enumerated value NO_HIGH: No high level observed */ -#define MC33775_GPIO_IN_HIGHDET7_NO_HIGH_ENUM_VAL (0U) - -/* Enumerated value HIGH: High level observed. */ -#define MC33775_GPIO_IN_HIGHDET7_HIGH_ENUM_VAL (1U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t IN0 : 1; - volatile uint16_t IN1 : 1; - volatile uint16_t IN2 : 1; - volatile uint16_t IN3 : 1; - volatile uint16_t IN4 : 1; - volatile uint16_t IN5 : 1; - volatile uint16_t IN6 : 1; - volatile uint16_t IN7 : 1; - volatile uint16_t HIGHDET0 : 1; - volatile uint16_t HIGHDET1 : 1; - volatile uint16_t HIGHDET2 : 1; - volatile uint16_t HIGHDET3 : 1; - volatile uint16_t HIGHDET4 : 1; - volatile uint16_t HIGHDET5 : 1; - volatile uint16_t HIGHDET6 : 1; - volatile uint16_t HIGHDET7 : 1; - } B; -} mc33775_gpio_registers_gpio_in_t; - -/* -------------------------------------------------------------------------- - * I2C_CFG (read-write):I2C configuration - * -------------------------------------------------------------------------- */ -#define MC33775_I2C_CFG_OFFSET (0xC00U) -#define MC33775_I2C_CFG_RW_MSK (0x3U) -#define MC33775_I2C_CFG_RD_MSK (0x3U) -#define MC33775_I2C_CFG_WR_MSK (0x3U) -#define MC33775_I2C_CFG_MW_MSK (0x0U) -#define MC33775_I2C_CFG_RA_MSK (0x0U) -#define MC33775_I2C_CFG_POR_MSK (0xffffU) -#define MC33775_I2C_CFG_POR_VAL (0x0U) - -/* Field EN: Enable I2C interface. If the I2C interface is disabled while it is active, a stop condition is created and the bus is released. When enabling this bit the GPIO to which the I2C lines are connected are switched to the I2C function (input receiver active and open-drain output function). */ -#define MC33775_I2C_CFG_EN_POS (0U) -#define MC33775_I2C_CFG_EN_MSK (0x1U) - -/* Enumerated value DISABLED: I2C interface disabled */ -#define MC33775_I2C_CFG_EN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: I2C interface enabled */ -#define MC33775_I2C_CFG_EN_ENABLED_ENUM_VAL (1U) - -/* Field CLKSEL: I2C clock selection */ -#define MC33775_I2C_CFG_CLKSEL_POS (1U) -#define MC33775_I2C_CFG_CLKSEL_MSK (0x2U) - -/* Enumerated value F_100k: I2C clock is 100 kHz */ -#define MC33775_I2C_CFG_CLKSEL_F_100K_ENUM_VAL (0U) - -/* Enumerated value F_400k: I2C clock is 400 kHz */ -#define MC33775_I2C_CFG_CLKSEL_F_400K_ENUM_VAL (1U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_I2C_CFG_RESERVED0_POS (2U) -#define MC33775_I2C_CFG_RESERVED0_MSK (0xFFFCU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t EN : 1; - volatile uint16_t CLKSEL : 1; - volatile uint16_t reserved0 : 14; - } B; -} mc33775_i2c_registers_i2c_cfg_t; - -/* -------------------------------------------------------------------------- - * I2C_CTRL (read-write):I2C control - * -------------------------------------------------------------------------- */ -#define MC33775_I2C_CTRL_OFFSET (0xC01U) -#define MC33775_I2C_CTRL_RW_MSK (0xF1FU) -#define MC33775_I2C_CTRL_RD_MSK (0xF1FU) -#define MC33775_I2C_CTRL_WR_MSK (0xF1FU) -#define MC33775_I2C_CTRL_MW_MSK (0x0U) -#define MC33775_I2C_CTRL_RA_MSK (0x0U) -#define MC33775_I2C_CTRL_POR_MSK (0xffffU) -#define MC33775_I2C_CTRL_POR_VAL (0x0U) - -/* Field START: Start the I2C transmission, by setting the number of bytes (including Dev. Address to be transmitted/read) */ -#define MC33775_I2C_CTRL_START_POS (0U) -#define MC33775_I2C_CTRL_START_MSK (0xFU) - -/* Enumerated value SEND_1: Send one byte */ -#define MC33775_I2C_CTRL_START_SEND_1_ENUM_VAL (1U) - -/* Enumerated value SEND_14: Send 14 bytes */ -#define MC33775_I2C_CTRL_START_SEND_14_ENUM_VAL (14U) - -/* Enumerated value SEND_MAX: Send 14 bytes */ -#define MC33775_I2C_CTRL_START_SEND_MAX_ENUM_VAL (15U) - -/* Field STPAFTER: Send a stop condition after the last byte. */ -#define MC33775_I2C_CTRL_STPAFTER_POS (4U) -#define MC33775_I2C_CTRL_STPAFTER_MSK (0x10U) - -/* Enumerated value NO_STOP: No stop condition sent after last byte */ -#define MC33775_I2C_CTRL_STPAFTER_NO_STOP_ENUM_VAL (0U) - -/* Enumerated value STOP: Stop condition sent after last byte */ -#define MC33775_I2C_CTRL_STPAFTER_STOP_ENUM_VAL (1U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_I2C_CTRL_RESERVED0_POS (5U) -#define MC33775_I2C_CTRL_RESERVED0_MSK (0xE0U) - -/* Field RDAFTER: Switch to read (Repeated Start Condition after byte) 0 = off */ -#define MC33775_I2C_CTRL_RDAFTER_POS (8U) -#define MC33775_I2C_CTRL_RDAFTER_MSK (0xF00U) - -/* Enumerated value NO_READ: No switch to read. */ -#define MC33775_I2C_CTRL_RDAFTER_NO_READ_ENUM_VAL (0U) - -/* Enumerated value READ_1: Switch to read after 1 byte */ -#define MC33775_I2C_CTRL_RDAFTER_READ_1_ENUM_VAL (1U) - -/* Enumerated value READ_14: Switch to read after 14 bytes */ -#define MC33775_I2C_CTRL_RDAFTER_READ_14_ENUM_VAL (14U) - -/* Enumerated value RESERVED: Reserved. Do not use. */ -#define MC33775_I2C_CTRL_RDAFTER_RESERVED_ENUM_VAL (15U) - -/* Field reserved1: This read-only field is reserved and always has the value 0. */ -#define MC33775_I2C_CTRL_RESERVED1_POS (12U) -#define MC33775_I2C_CTRL_RESERVED1_MSK (0xF000U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t START : 4; - volatile uint16_t STPAFTER : 1; - volatile uint16_t reserved0 : 3; - volatile uint16_t RDAFTER : 4; - volatile uint16_t reserved1 : 4; - } B; -} mc33775_i2c_registers_i2c_ctrl_t; - -/* -------------------------------------------------------------------------- - * I2C_STAT (read-only):I2C status - * -------------------------------------------------------------------------- */ -#define MC33775_I2C_STAT_OFFSET (0xC02U) -#define MC33775_I2C_STAT_RW_MSK (0x0U) -#define MC33775_I2C_STAT_RD_MSK (0xF0FU) -#define MC33775_I2C_STAT_WR_MSK (0x0U) -#define MC33775_I2C_STAT_MW_MSK (0x0U) -#define MC33775_I2C_STAT_RA_MSK (0x0U) -#define MC33775_I2C_STAT_POR_MSK (0xffffU) -#define MC33775_I2C_STAT_POR_VAL (0x0U) - -/* Field PENDING: I2C execution pending */ -#define MC33775_I2C_STAT_PENDING_POS (0U) -#define MC33775_I2C_STAT_PENDING_MSK (0x1U) - -/* Enumerated value NO_TRX: No transfer is in execution, data registers can be accessed */ -#define MC33775_I2C_STAT_PENDING_NO_TRX_ENUM_VAL (0U) - -/* Enumerated value TRX: A transfer is in execution, no access to the data registers is allowed */ -#define MC33775_I2C_STAT_PENDING_TRX_ENUM_VAL (1U) - -/* Field ACTIVE: I2C transmission active */ -#define MC33775_I2C_STAT_ACTIVE_POS (1U) -#define MC33775_I2C_STAT_ACTIVE_MSK (0x2U) - -/* Enumerated value NO_TRX: No transaction is ongoing. */ -#define MC33775_I2C_STAT_ACTIVE_NO_TRX_ENUM_VAL (0U) - -/* Enumerated value TRX: A transaction is ongoing (no STOP condition so far), bus is held with SCL low */ -#define MC33775_I2C_STAT_ACTIVE_TRX_ENUM_VAL (1U) - -/* Field NACKRCV: NACK received */ -#define MC33775_I2C_STAT_NACKRCV_POS (2U) -#define MC33775_I2C_STAT_NACKRCV_MSK (0x4U) - -/* Enumerated value NO_NACK: No NACK was received */ -#define MC33775_I2C_STAT_NACKRCV_NO_NACK_ENUM_VAL (0U) - -/* Enumerated value NACK: A NACK was received */ -#define MC33775_I2C_STAT_NACKRCV_NACK_ENUM_VAL (1U) - -/* Field ARBLOST: Wrong data bit */ -#define MC33775_I2C_STAT_ARBLOST_POS (3U) -#define MC33775_I2C_STAT_ARBLOST_MSK (0x8U) - -/* Enumerated value NO_FLT: No wrong data bits detected */ -#define MC33775_I2C_STAT_ARBLOST_NO_FLT_ENUM_VAL (0U) - -/* Enumerated value FAULT: A wrong data bit was detected */ -#define MC33775_I2C_STAT_ARBLOST_FAULT_ENUM_VAL (1U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_I2C_STAT_RESERVED0_POS (4U) -#define MC33775_I2C_STAT_RESERVED0_MSK (0xF0U) - -/* Field LEN: number of bytes transferred until NACK received */ -#define MC33775_I2C_STAT_LEN_POS (8U) -#define MC33775_I2C_STAT_LEN_MSK (0xF00U) - -/* Enumerated value NACK_0: No bytes transmitted until NACK was received */ -#define MC33775_I2C_STAT_LEN_NACK_0_ENUM_VAL (0U) - -/* Enumerated value NACK_1: 1 byte transmitted until NACK was received */ -#define MC33775_I2C_STAT_LEN_NACK_1_ENUM_VAL (1U) - -/* Enumerated value NACK_14: 14 bytes transmitted until NACK was received */ -#define MC33775_I2C_STAT_LEN_NACK_14_ENUM_VAL (14U) - -/* Enumerated value RESERVED: Reserved. Not used. */ -#define MC33775_I2C_STAT_LEN_RESERVED_ENUM_VAL (15U) - -/* Field reserved1: This read-only field is reserved and always has the value 0. */ -#define MC33775_I2C_STAT_RESERVED1_POS (12U) -#define MC33775_I2C_STAT_RESERVED1_MSK (0xF000U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t PENDING : 1; - volatile uint16_t ACTIVE : 1; - volatile uint16_t NACKRCV : 1; - volatile uint16_t ARBLOST : 1; - volatile uint16_t reserved0 : 4; - volatile uint16_t LEN : 4; - volatile uint16_t reserved1 : 4; - } B; -} mc33775_i2c_registers_i2c_stat_t; - -/* -------------------------------------------------------------------------- - * I2C_DATA0 (read-write):I2C data register 0 - * -------------------------------------------------------------------------- */ -#define MC33775_I2C_DATA0_OFFSET (0xC04U) -#define MC33775_I2C_DATA0_RW_MSK (0xFFFFU) -#define MC33775_I2C_DATA0_RD_MSK (0xFFFFU) -#define MC33775_I2C_DATA0_WR_MSK (0xFFFFU) -#define MC33775_I2C_DATA0_MW_MSK (0x0U) -#define MC33775_I2C_DATA0_RA_MSK (0x0U) -#define MC33775_I2C_DATA0_POR_MSK (0xffffU) -#define MC33775_I2C_DATA0_POR_VAL (0x0U) - -/* Field BYTE0: I2C data byte 0 (e.g. device address) */ -#define MC33775_I2C_DATA0_BYTE0_POS (0U) -#define MC33775_I2C_DATA0_BYTE0_MSK (0xFFU) - -/* Field BYTE1: I2C data byte 1 (e.g. data or sub address) */ -#define MC33775_I2C_DATA0_BYTE1_POS (8U) -#define MC33775_I2C_DATA0_BYTE1_MSK (0xFF00U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t BYTE0 : 8; - volatile uint16_t BYTE1 : 8; - } B; -} mc33775_i2c_registers_i2c_data0_t; - -/* -------------------------------------------------------------------------- - * I2C_DATA1 (read-write):I2C data register 1 - * -------------------------------------------------------------------------- */ -#define MC33775_I2C_DATA1_OFFSET (0xC05U) -#define MC33775_I2C_DATA1_RW_MSK (0xFFFFU) -#define MC33775_I2C_DATA1_RD_MSK (0xFFFFU) -#define MC33775_I2C_DATA1_WR_MSK (0xFFFFU) -#define MC33775_I2C_DATA1_MW_MSK (0x0U) -#define MC33775_I2C_DATA1_RA_MSK (0x0U) -#define MC33775_I2C_DATA1_POR_MSK (0xffffU) -#define MC33775_I2C_DATA1_POR_VAL (0x0U) - -/* Field BYTE2: I2C data byte 2 */ -#define MC33775_I2C_DATA1_BYTE2_POS (0U) -#define MC33775_I2C_DATA1_BYTE2_MSK (0xFFU) - -/* Field BYTE3: I2C data byte 3 */ -#define MC33775_I2C_DATA1_BYTE3_POS (8U) -#define MC33775_I2C_DATA1_BYTE3_MSK (0xFF00U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t BYTE2 : 8; - volatile uint16_t BYTE3 : 8; - } B; -} mc33775_i2c_registers_i2c_data1_t; - -/* -------------------------------------------------------------------------- - * I2C_DATA2 (read-write):I2C data register 2 - * -------------------------------------------------------------------------- */ -#define MC33775_I2C_DATA2_OFFSET (0xC06U) -#define MC33775_I2C_DATA2_RW_MSK (0xFFFFU) -#define MC33775_I2C_DATA2_RD_MSK (0xFFFFU) -#define MC33775_I2C_DATA2_WR_MSK (0xFFFFU) -#define MC33775_I2C_DATA2_MW_MSK (0x0U) -#define MC33775_I2C_DATA2_RA_MSK (0x0U) -#define MC33775_I2C_DATA2_POR_MSK (0xffffU) -#define MC33775_I2C_DATA2_POR_VAL (0x0U) - -/* Field BYTE4: I2C data byte 4 */ -#define MC33775_I2C_DATA2_BYTE4_POS (0U) -#define MC33775_I2C_DATA2_BYTE4_MSK (0xFFU) - -/* Field BYTE5: I2C data byte 5 */ -#define MC33775_I2C_DATA2_BYTE5_POS (8U) -#define MC33775_I2C_DATA2_BYTE5_MSK (0xFF00U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t BYTE4 : 8; - volatile uint16_t BYTE5 : 8; - } B; -} mc33775_i2c_registers_i2c_data2_t; - -/* -------------------------------------------------------------------------- - * I2C_DATA3 (read-write):I2C data register 3 - * -------------------------------------------------------------------------- */ -#define MC33775_I2C_DATA3_OFFSET (0xC07U) -#define MC33775_I2C_DATA3_RW_MSK (0xFFFFU) -#define MC33775_I2C_DATA3_RD_MSK (0xFFFFU) -#define MC33775_I2C_DATA3_WR_MSK (0xFFFFU) -#define MC33775_I2C_DATA3_MW_MSK (0x0U) -#define MC33775_I2C_DATA3_RA_MSK (0x0U) -#define MC33775_I2C_DATA3_POR_MSK (0xffffU) -#define MC33775_I2C_DATA3_POR_VAL (0x0U) - -/* Field BYTE6: I2C data byte 6 */ -#define MC33775_I2C_DATA3_BYTE6_POS (0U) -#define MC33775_I2C_DATA3_BYTE6_MSK (0xFFU) - -/* Field BYTE7: I2C data byte 7 */ -#define MC33775_I2C_DATA3_BYTE7_POS (8U) -#define MC33775_I2C_DATA3_BYTE7_MSK (0xFF00U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t BYTE6 : 8; - volatile uint16_t BYTE7 : 8; - } B; -} mc33775_i2c_registers_i2c_data3_t; - -/* -------------------------------------------------------------------------- - * I2C_DATA4 (read-write):I2C data register 4 - * -------------------------------------------------------------------------- */ -#define MC33775_I2C_DATA4_OFFSET (0xC08U) -#define MC33775_I2C_DATA4_RW_MSK (0xFFFFU) -#define MC33775_I2C_DATA4_RD_MSK (0xFFFFU) -#define MC33775_I2C_DATA4_WR_MSK (0xFFFFU) -#define MC33775_I2C_DATA4_MW_MSK (0x0U) -#define MC33775_I2C_DATA4_RA_MSK (0x0U) -#define MC33775_I2C_DATA4_POR_MSK (0xffffU) -#define MC33775_I2C_DATA4_POR_VAL (0x0U) - -/* Field BYTE8: I2C data byte 8 */ -#define MC33775_I2C_DATA4_BYTE8_POS (0U) -#define MC33775_I2C_DATA4_BYTE8_MSK (0xFFU) - -/* Field BYTE9: I2C data byte 9 */ -#define MC33775_I2C_DATA4_BYTE9_POS (8U) -#define MC33775_I2C_DATA4_BYTE9_MSK (0xFF00U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t BYTE8 : 8; - volatile uint16_t BYTE9 : 8; - } B; -} mc33775_i2c_registers_i2c_data4_t; - -/* -------------------------------------------------------------------------- - * I2C_DATA5 (read-write):I2C data register 5 - * -------------------------------------------------------------------------- */ -#define MC33775_I2C_DATA5_OFFSET (0xC09U) -#define MC33775_I2C_DATA5_RW_MSK (0xFFFFU) -#define MC33775_I2C_DATA5_RD_MSK (0xFFFFU) -#define MC33775_I2C_DATA5_WR_MSK (0xFFFFU) -#define MC33775_I2C_DATA5_MW_MSK (0x0U) -#define MC33775_I2C_DATA5_RA_MSK (0x0U) -#define MC33775_I2C_DATA5_POR_MSK (0xffffU) -#define MC33775_I2C_DATA5_POR_VAL (0x0U) - -/* Field BYTE10: I2C data byte 10 */ -#define MC33775_I2C_DATA5_BYTE10_POS (0U) -#define MC33775_I2C_DATA5_BYTE10_MSK (0xFFU) - -/* Field BYTE11: I2C data byte 11 */ -#define MC33775_I2C_DATA5_BYTE11_POS (8U) -#define MC33775_I2C_DATA5_BYTE11_MSK (0xFF00U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t BYTE10 : 8; - volatile uint16_t BYTE11 : 8; - } B; -} mc33775_i2c_registers_i2c_data5_t; - -/* -------------------------------------------------------------------------- - * I2C_DATA6 (read-write):I2C data register 6 - * -------------------------------------------------------------------------- */ -#define MC33775_I2C_DATA6_OFFSET (0xC0AU) -#define MC33775_I2C_DATA6_RW_MSK (0xFFFFU) -#define MC33775_I2C_DATA6_RD_MSK (0xFFFFU) -#define MC33775_I2C_DATA6_WR_MSK (0xFFFFU) -#define MC33775_I2C_DATA6_MW_MSK (0x0U) -#define MC33775_I2C_DATA6_RA_MSK (0x0U) -#define MC33775_I2C_DATA6_POR_MSK (0xffffU) -#define MC33775_I2C_DATA6_POR_VAL (0x0U) - -/* Field BYTE12: I2C data byte 12 */ -#define MC33775_I2C_DATA6_BYTE12_POS (0U) -#define MC33775_I2C_DATA6_BYTE12_MSK (0xFFU) - -/* Field BYTE13: I2C data byte 13 */ -#define MC33775_I2C_DATA6_BYTE13_POS (8U) -#define MC33775_I2C_DATA6_BYTE13_MSK (0xFF00U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t BYTE12 : 8; - volatile uint16_t BYTE13 : 8; - } B; -} mc33775_i2c_registers_i2c_data6_t; - -/* -------------------------------------------------------------------------- - * PRMM_CFG (read-write):General measurement control. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_CFG_OFFSET (0x1800U) -#define MC33775_PRMM_CFG_RW_MSK (0xFFFFU) -#define MC33775_PRMM_CFG_RD_MSK (0xFFFFU) -#define MC33775_PRMM_CFG_WR_MSK (0xFFFFU) -#define MC33775_PRMM_CFG_MW_MSK (0x0U) -#define MC33775_PRMM_CFG_RA_MSK (0x0U) -#define MC33775_PRMM_CFG_POR_MSK (0xffffU) -#define MC33775_PRMM_CFG_POR_VAL (0x0U) - -/* Field MEASEN: Enable the data acquisition. Setting this bit to zero initiates a result clear and invalidate action (this includes resetting all ready bits). The bit can only be set xxx us after it has been cleared. This bit is cleared when entering Sleep mode. Cyclic measurements are always executed, regardless of the value of this bit. Balancing is not stopped automatically (if in Active mode), as it would be permanently inhibited while measurement is active. If balancing shall be paused, please do so via the balancing control. */ -#define MC33775_PRMM_CFG_MEASEN_POS (0U) -#define MC33775_PRMM_CFG_MEASEN_MSK (0x1U) - -/* Enumerated value DISABLED: Data acquisition disabled */ -#define MC33775_PRMM_CFG_MEASEN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Data acquisition enabled */ -#define MC33775_PRMM_CFG_MEASEN_ENABLED_ENUM_VAL (1U) - -/* Field BALPAUSECYCMODEN: Enable balancing autopause. This delays the start of measurements after entering Cyclic mode until the autopause counter has elapsed. */ -#define MC33775_PRMM_CFG_BALPAUSECYCMODEN_POS (1U) -#define MC33775_PRMM_CFG_BALPAUSECYCMODEN_MSK (0x2U) - -/* Enumerated value DISABLED: Autopause for balancing is disabled. */ -#define MC33775_PRMM_CFG_BALPAUSECYCMODEN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Autopause for balancing is enabled. Measurements are started when the autopause counter is elapsed. */ -#define MC33775_PRMM_CFG_BALPAUSECYCMODEN_ENABLED_ENUM_VAL (1U) - -/* Field BALPAUSELEN: Pause of balancing before measurement cycle is executed. An on-going balancing pause operation is not influenced by a change of this value. 1 LSB = 10us. */ -#define MC33775_PRMM_CFG_BALPAUSELEN_POS (2U) -#define MC33775_PRMM_CFG_BALPAUSELEN_MSK (0xFFFCU) - -/* Enumerated value NO_PAUSE: No Pause. */ -#define MC33775_PRMM_CFG_BALPAUSELEN_NO_PAUSE_ENUM_VAL (0U) - -/* Enumerated value PAUSE_10u: Pause = 10 us */ -#define MC33775_PRMM_CFG_BALPAUSELEN_PAUSE_10U_ENUM_VAL (1U) - -/* Enumerated value MAX: Maximum pause = 163830 us = 163 ms */ -#define MC33775_PRMM_CFG_BALPAUSELEN_MAX_ENUM_VAL (16383U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t MEASEN : 1; - volatile uint16_t BALPAUSECYCMODEN : 1; - volatile uint16_t BALPAUSELEN : 14; - } B; -} mc33775_primary_measurement_registers_prmm_cfg_t; - -/* -------------------------------------------------------------------------- - * PRMM_APP_CTRL (read-write):Application measurement control. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_APP_CTRL_OFFSET (0x1801U) -#define MC33775_PRMM_APP_CTRL_RW_MSK (0x7C00U) -#define MC33775_PRMM_APP_CTRL_RD_MSK (0x7C00U) -#define MC33775_PRMM_APP_CTRL_WR_MSK (0xFFFFU) -#define MC33775_PRMM_APP_CTRL_MW_MSK (0x0U) -#define MC33775_PRMM_APP_CTRL_RA_MSK (0x0U) -#define MC33775_PRMM_APP_CTRL_POR_MSK (0xffffU) -#define MC33775_PRMM_APP_CTRL_POR_VAL (0x7c00U) - -/* Field CAPVC: Capture the application measurement values of the cell terminal measurements. The values are now readable via the app_result register. This bit is only available in the primary measurement chain. */ -#define MC33775_PRMM_APP_CTRL_CAPVC_POS (0U) -#define MC33775_PRMM_APP_CTRL_CAPVC_MSK (0x1U) - -/* Enumerated value NO_CAP: Measurements are not captured. */ -#define MC33775_PRMM_APP_CTRL_CAPVC_NO_CAP_ENUM_VAL (0U) - -/* Enumerated value CAP: Measurements are captured. */ -#define MC33775_PRMM_APP_CTRL_CAPVC_CAP_ENUM_VAL (1U) - -/* Field CAPVMODULE: Capture the application measurement value of the module voltage measurement. The values are now readable via the app_result register. This bit is only available in the primary measurement chain. */ -#define MC33775_PRMM_APP_CTRL_CAPVMODULE_POS (1U) -#define MC33775_PRMM_APP_CTRL_CAPVMODULE_MSK (0x2U) - -/* Enumerated value NO_CAP: Measurements are not captured. */ -#define MC33775_PRMM_APP_CTRL_CAPVMODULE_NO_CAP_ENUM_VAL (0U) - -/* Enumerated value CAP: Measurements are captured. */ -#define MC33775_PRMM_APP_CTRL_CAPVMODULE_CAP_ENUM_VAL (1U) - -/* Field CAPAIN0: Capture the application measurement value of the aux0 terminal measurement. The values are now readable via the app_result register. This bit is only available in the primary measurement chain. */ -#define MC33775_PRMM_APP_CTRL_CAPAIN0_POS (2U) -#define MC33775_PRMM_APP_CTRL_CAPAIN0_MSK (0x4U) - -/* Enumerated value NO_CAP: Measurements are not captured. */ -#define MC33775_PRMM_APP_CTRL_CAPAIN0_NO_CAP_ENUM_VAL (0U) - -/* Enumerated value CAP: Measurements are captured. */ -#define MC33775_PRMM_APP_CTRL_CAPAIN0_CAP_ENUM_VAL (1U) - -/* Field CAPAIN1: Capture the application measurement value of the aux1 terminal measurement. The values are now readable via the app_result register. This bit is only available in the primary measurement chain. */ -#define MC33775_PRMM_APP_CTRL_CAPAIN1_POS (3U) -#define MC33775_PRMM_APP_CTRL_CAPAIN1_MSK (0x8U) - -/* Enumerated value NO_CAP: Measurements are not captured. */ -#define MC33775_PRMM_APP_CTRL_CAPAIN1_NO_CAP_ENUM_VAL (0U) - -/* Enumerated value CAP: Measurements are captured. */ -#define MC33775_PRMM_APP_CTRL_CAPAIN1_CAP_ENUM_VAL (1U) - -/* Field CAPAIN2: Capture the application measurement value of the aux2 terminal measurement. The values are now readable via the app_result register. This bit is only available in the primary measurement chain. */ -#define MC33775_PRMM_APP_CTRL_CAPAIN2_POS (4U) -#define MC33775_PRMM_APP_CTRL_CAPAIN2_MSK (0x10U) - -/* Enumerated value NO_CAP: Measurements are not captured. */ -#define MC33775_PRMM_APP_CTRL_CAPAIN2_NO_CAP_ENUM_VAL (0U) - -/* Enumerated value CAP: Measurements are captured. */ -#define MC33775_PRMM_APP_CTRL_CAPAIN2_CAP_ENUM_VAL (1U) - -/* Field CAPAIN3: Capture the application measurement value of the aux3 terminal measurement. The values are now readable via the app_result register. This bit is only available in the primary measurement chain. */ -#define MC33775_PRMM_APP_CTRL_CAPAIN3_POS (5U) -#define MC33775_PRMM_APP_CTRL_CAPAIN3_MSK (0x20U) - -/* Enumerated value NO_CAP: Measurements are not captured. */ -#define MC33775_PRMM_APP_CTRL_CAPAIN3_NO_CAP_ENUM_VAL (0U) - -/* Enumerated value CAP: Measurements are captured. */ -#define MC33775_PRMM_APP_CTRL_CAPAIN3_CAP_ENUM_VAL (1U) - -/* Field CAPAIN4: Trigger the balancing autopause if set in combination with the PAUSEBAL bit. Needed to keep primary and secondary measurement synchron when used via the ALLM access. In secondary: Capture the application measurement value of the aux4 terminal measurement. */ -#define MC33775_PRMM_APP_CTRL_CAPAIN4_POS (6U) -#define MC33775_PRMM_APP_CTRL_CAPAIN4_MSK (0x40U) - -/* Enumerated value NO_CAP: Measurements are not captured. */ -#define MC33775_PRMM_APP_CTRL_CAPAIN4_NO_CAP_ENUM_VAL (0U) - -/* Enumerated value CAP: Measurements are captured. */ -#define MC33775_PRMM_APP_CTRL_CAPAIN4_CAP_ENUM_VAL (1U) - -/* Field CAPAIN5: Trigger the balancing autopause if set in combination with the PAUSEBAL bit. Needed to keep primary and secondary measurement synchron when used via the ALLM access. In primary: Capture the application measurement value of the aux5 terminal measurement. */ -#define MC33775_PRMM_APP_CTRL_CAPAIN5_POS (7U) -#define MC33775_PRMM_APP_CTRL_CAPAIN5_MSK (0x80U) - -/* Enumerated value NO_CAP: Measurements are not captured. */ -#define MC33775_PRMM_APP_CTRL_CAPAIN5_NO_CAP_ENUM_VAL (0U) - -/* Enumerated value CAP: Measurements are captured. */ -#define MC33775_PRMM_APP_CTRL_CAPAIN5_CAP_ENUM_VAL (1U) - -/* Field CAPAIN6: Trigger the balancing autopause if set in combination with the PAUSEBAL bit. Needed to keep primary and secondary measurement synchron when used via the ALLM access. In primary: Capture the application measurement value of the aux6 terminal measurement. */ -#define MC33775_PRMM_APP_CTRL_CAPAIN6_POS (8U) -#define MC33775_PRMM_APP_CTRL_CAPAIN6_MSK (0x100U) - -/* Enumerated value NO_CAP: Measurements are not captured. */ -#define MC33775_PRMM_APP_CTRL_CAPAIN6_NO_CAP_ENUM_VAL (0U) - -/* Enumerated value CAP: Measurements are captured. */ -#define MC33775_PRMM_APP_CTRL_CAPAIN6_CAP_ENUM_VAL (1U) - -/* Field CAPAIN7: Trigger the balancing autopause if set in combination with the PAUSEBAL bit. Needed to keep primary and secondary measurement synchron when used via the ALLM access. In primary: Capture the application measurement value of the aux7 terminal measurement. */ -#define MC33775_PRMM_APP_CTRL_CAPAIN7_POS (9U) -#define MC33775_PRMM_APP_CTRL_CAPAIN7_MSK (0x200U) - -/* Enumerated value NO_CAP: Measurements are not captured. */ -#define MC33775_PRMM_APP_CTRL_CAPAIN7_NO_CAP_ENUM_VAL (0U) - -/* Enumerated value CAP: Measurements are captured. */ -#define MC33775_PRMM_APP_CTRL_CAPAIN7_CAP_ENUM_VAL (1U) - -/* Field VCOLNUM: VC number for which the open load detection is enabled. 0 - 13 = channel for which the open load detection is enabled. 14 - 30 = reserved (no open load detection mechanism is enabled). Writing this bitfield is only possible if CAPVC is set as well. */ -#define MC33775_PRMM_APP_CTRL_VCOLNUM_POS (10U) -#define MC33775_PRMM_APP_CTRL_VCOLNUM_MSK (0x7C00U) - -/* Enumerated value DISABLED: Open load detection is disabled */ -#define MC33775_PRMM_APP_CTRL_VCOLNUM_DISABLED_ENUM_VAL (31U) - -/* Field PAUSEBAL: Pause the balancing during this capture cycle. If balancing was not paused before, the start of data capture is delayed until the autopause timer has elapsed. If no CAPxxx is set this bit is ignored. */ -#define MC33775_PRMM_APP_CTRL_PAUSEBAL_POS (15U) -#define MC33775_PRMM_APP_CTRL_PAUSEBAL_MSK (0x8000U) - -/* Enumerated value NO_PAUSE: Continue with balancing. */ -#define MC33775_PRMM_APP_CTRL_PAUSEBAL_NO_PAUSE_ENUM_VAL (0U) - -/* Enumerated value PAUSE: Pause the balancing during this capture cycle. */ -#define MC33775_PRMM_APP_CTRL_PAUSEBAL_PAUSE_ENUM_VAL (1U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t CAPVC : 1; - volatile uint16_t CAPVMODULE : 1; - volatile uint16_t CAPAIN0 : 1; - volatile uint16_t CAPAIN1 : 1; - volatile uint16_t CAPAIN2 : 1; - volatile uint16_t CAPAIN3 : 1; - volatile uint16_t CAPAIN4 : 1; - volatile uint16_t CAPAIN5 : 1; - volatile uint16_t CAPAIN6 : 1; - volatile uint16_t CAPAIN7 : 1; - volatile uint16_t VCOLNUM : 5; - volatile uint16_t PAUSEBAL : 1; - } B; -} mc33775_primary_measurement_registers_prmm_app_ctrl_t; - -/* -------------------------------------------------------------------------- - * PRMM_PER_CTRL (read-write):Periodic measurement control. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_PER_CTRL_OFFSET (0x1802U) -#define MC33775_PRMM_PER_CTRL_RW_MSK (0x31FFU) -#define MC33775_PRMM_PER_CTRL_RD_MSK (0x31FFU) -#define MC33775_PRMM_PER_CTRL_WR_MSK (0x31FFU) -#define MC33775_PRMM_PER_CTRL_MW_MSK (0x0U) -#define MC33775_PRMM_PER_CTRL_RA_MSK (0x0U) -#define MC33775_PRMM_PER_CTRL_POR_MSK (0xffffU) -#define MC33775_PRMM_PER_CTRL_POR_VAL (0x10U) - -/* Field PERLEN: Number of measurements for one periodic measurement. The minimum is 16. Writing a value lower than 16 leads to a 16 in the register. */ -#define MC33775_PRMM_PER_CTRL_PERLEN_POS (0U) -#define MC33775_PRMM_PER_CTRL_PERLEN_MSK (0x1FFU) - -/* Enumerated value PER_16: minimum value = 16 measurements per period */ -#define MC33775_PRMM_PER_CTRL_PERLEN_PER_16_ENUM_VAL (16U) - -/* Enumerated value PER_17: 17 measurements per period */ -#define MC33775_PRMM_PER_CTRL_PERLEN_PER_17_ENUM_VAL (17U) - -/* Enumerated value PER_MAX: maximum value = 511 measurements per period */ -#define MC33775_PRMM_PER_CTRL_PERLEN_PER_MAX_ENUM_VAL (511U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_PRMM_PER_CTRL_RESERVED0_POS (9U) -#define MC33775_PRMM_PER_CTRL_RESERVED0_MSK (0xE00U) - -/* Field PERCTRL: Control the periodic result behavior. */ -#define MC33775_PRMM_PER_CTRL_PERCTRL_POS (12U) -#define MC33775_PRMM_PER_CTRL_PERCTRL_MSK (0x3000U) - -/* Enumerated value AUTO: Periodic results are automatically updated */ -#define MC33775_PRMM_PER_CTRL_PERCTRL_AUTO_ENUM_VAL (0U) - -/* Enumerated value RESERVED: reserved */ -#define MC33775_PRMM_PER_CTRL_PERCTRL_RESERVED_ENUM_VAL (1U) - -/* Enumerated value HOLD: Periodic results are held */ -#define MC33775_PRMM_PER_CTRL_PERCTRL_HOLD_ENUM_VAL (2U) - -/* Enumerated value ONCE: Periodic results are updated once with the last results. (each write updates the results). */ -#define MC33775_PRMM_PER_CTRL_PERCTRL_ONCE_ENUM_VAL (3U) - -/* Field reserved1: This read-only field is reserved and always has the value 0. */ -#define MC33775_PRMM_PER_CTRL_RESERVED1_POS (14U) -#define MC33775_PRMM_PER_CTRL_RESERVED1_MSK (0xC000U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t PERLEN : 9; - volatile uint16_t reserved0 : 3; - volatile uint16_t PERCTRL : 2; - volatile uint16_t reserved1 : 2; - } B; -} mc33775_primary_measurement_registers_prmm_per_ctrl_t; - -/* -------------------------------------------------------------------------- - * PRMM_SYNC_CTRL (write-only):Synchronous measurement control. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_SYNC_CTRL_OFFSET (0x1803U) -#define MC33775_PRMM_SYNC_CTRL_RW_MSK (0x0U) -#define MC33775_PRMM_SYNC_CTRL_RD_MSK (0x0U) -#define MC33775_PRMM_SYNC_CTRL_WR_MSK (0x8003U) -#define MC33775_PRMM_SYNC_CTRL_MW_MSK (0x0U) -#define MC33775_PRMM_SYNC_CTRL_RA_MSK (0x0U) -#define MC33775_PRMM_SYNC_CTRL_POR_MSK (0xffffU) -#define MC33775_PRMM_SYNC_CTRL_POR_VAL (0x0U) - -/* Field SYNCCYC: Start a synchronous measurement cycle. In this cycle the CT and CB voltages are measured and stored as matching pairs. If no VC channel is enabled or if set during a running synchronous measurement cycle the set is ignored. Read as zero. */ -#define MC33775_PRMM_SYNC_CTRL_SYNCCYC_POS (0U) -#define MC33775_PRMM_SYNC_CTRL_SYNCCYC_MSK (0x1U) - -/* Enumerated value NO_START: No new start a synchronous measurement cycle. */ -#define MC33775_PRMM_SYNC_CTRL_SYNCCYC_NO_START_ENUM_VAL (0U) - -/* Enumerated value STATUS: Read a zero */ -#define MC33775_PRMM_SYNC_CTRL_SYNCCYC_STATUS_ENUM_VAL (0U) - -/* Enumerated value START: Start a synchronous measurement cycle. */ -#define MC33775_PRMM_SYNC_CTRL_SYNCCYC_START_ENUM_VAL (1U) - -/* Field FASTCYC: Start of a dummy Fast measurement cycle. In this cycle nothing is actually measured and stored. The bit is only implemented to keep the balancing autopause synchronous between primary and secondary measurement. If set together with SYNCCYC or during an active synchronous measurement cycle, this bit is ignored. Read as zero. */ -#define MC33775_PRMM_SYNC_CTRL_FASTCYC_POS (1U) -#define MC33775_PRMM_SYNC_CTRL_FASTCYC_MSK (0x2U) - -/* Enumerated value NO_FAST: No new start of a dummy fast measurement cycle. */ -#define MC33775_PRMM_SYNC_CTRL_FASTCYC_NO_FAST_ENUM_VAL (0U) - -/* Enumerated value STATUS: Read as zero. */ -#define MC33775_PRMM_SYNC_CTRL_FASTCYC_STATUS_ENUM_VAL (0U) - -/* Enumerated value FAST: Start a new dummy fast measurement cycle. */ -#define MC33775_PRMM_SYNC_CTRL_FASTCYC_FAST_ENUM_VAL (1U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_PRMM_SYNC_CTRL_RESERVED0_POS (2U) -#define MC33775_PRMM_SYNC_CTRL_RESERVED0_MSK (0x7FFCU) - -/* Field PAUSEBAL: Pause the balancing during this capture cycle. If balancing was not paused before, the start of data capture is delayed until the autopause timer has elapsed. If no capture cycle is started this bit is ignored. */ -#define MC33775_PRMM_SYNC_CTRL_PAUSEBAL_POS (15U) -#define MC33775_PRMM_SYNC_CTRL_PAUSEBAL_MSK (0x8000U) - -/* Enumerated value NO_PAUSE: Continue with balancing. */ -#define MC33775_PRMM_SYNC_CTRL_PAUSEBAL_NO_PAUSE_ENUM_VAL (0U) - -/* Enumerated value PAUSE: Pause the balancing during this capture cycle. */ -#define MC33775_PRMM_SYNC_CTRL_PAUSEBAL_PAUSE_ENUM_VAL (1U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t SYNCCYC : 1; - volatile uint16_t FASTCYC : 1; - volatile uint16_t reserved0 : 13; - volatile uint16_t PAUSEBAL : 1; - } B; -} mc33775_primary_measurement_registers_prmm_sync_ctrl_t; - -/* -------------------------------------------------------------------------- - * PRMM_VC_CFG (read-write):Cell voltage measurement enable. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_VC_CFG_OFFSET (0x1808U) -#define MC33775_PRMM_VC_CFG_RW_MSK (0x3FFFU) -#define MC33775_PRMM_VC_CFG_RD_MSK (0x3FFFU) -#define MC33775_PRMM_VC_CFG_WR_MSK (0x3FFFU) -#define MC33775_PRMM_VC_CFG_MW_MSK (0x0U) -#define MC33775_PRMM_VC_CFG_RA_MSK (0x0U) -#define MC33775_PRMM_VC_CFG_POR_MSK (0xffffU) -#define MC33775_PRMM_VC_CFG_POR_VAL (0x0U) - -/* Field VC0EN: Enable measurement of cell voltage 0. Changes to this bit during active measurement can lead to undefined results. */ -#define MC33775_PRMM_VC_CFG_VC0EN_POS (0U) -#define MC33775_PRMM_VC_CFG_VC0EN_MSK (0x1U) - -/* Enumerated value DISABLED: Measurement disabled */ -#define MC33775_PRMM_VC_CFG_VC0EN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Measurement enabled */ -#define MC33775_PRMM_VC_CFG_VC0EN_ENABLED_ENUM_VAL (1U) - -/* Field VC1EN: Enable measurement of cell voltage 1. Changes to this bit during active measurement can lead to undefined results. */ -#define MC33775_PRMM_VC_CFG_VC1EN_POS (1U) -#define MC33775_PRMM_VC_CFG_VC1EN_MSK (0x2U) - -/* Enumerated value DISABLED: Measurement disabled */ -#define MC33775_PRMM_VC_CFG_VC1EN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Measurement enabled */ -#define MC33775_PRMM_VC_CFG_VC1EN_ENABLED_ENUM_VAL (1U) - -/* Field VC2EN: Enable measurement of cell voltage 2. Changes to this bit during active measurement can lead to undefined results. */ -#define MC33775_PRMM_VC_CFG_VC2EN_POS (2U) -#define MC33775_PRMM_VC_CFG_VC2EN_MSK (0x4U) - -/* Enumerated value DISABLED: Measurement disabled */ -#define MC33775_PRMM_VC_CFG_VC2EN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Measurement enabled */ -#define MC33775_PRMM_VC_CFG_VC2EN_ENABLED_ENUM_VAL (1U) - -/* Field VC3EN: Enable measurement of cell voltage 3. Changes to this bit during active measurement can lead to undefined results. */ -#define MC33775_PRMM_VC_CFG_VC3EN_POS (3U) -#define MC33775_PRMM_VC_CFG_VC3EN_MSK (0x8U) - -/* Enumerated value DISABLED: Measurement disabled */ -#define MC33775_PRMM_VC_CFG_VC3EN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Measurement enabled */ -#define MC33775_PRMM_VC_CFG_VC3EN_ENABLED_ENUM_VAL (1U) - -/* Field VC4EN: Enable measurement of cell voltage 4. Changes to this bit during active measurement can lead to undefined results. */ -#define MC33775_PRMM_VC_CFG_VC4EN_POS (4U) -#define MC33775_PRMM_VC_CFG_VC4EN_MSK (0x10U) - -/* Enumerated value DISABLED: Measurement disabled */ -#define MC33775_PRMM_VC_CFG_VC4EN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Measurement enabled */ -#define MC33775_PRMM_VC_CFG_VC4EN_ENABLED_ENUM_VAL (1U) - -/* Field VC5EN: Enable measurement of cell voltage 5. Changes to this bit during active measurement can lead to undefined results. */ -#define MC33775_PRMM_VC_CFG_VC5EN_POS (5U) -#define MC33775_PRMM_VC_CFG_VC5EN_MSK (0x20U) - -/* Enumerated value DISABLED: Measurement disabled */ -#define MC33775_PRMM_VC_CFG_VC5EN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Measurement enabled */ -#define MC33775_PRMM_VC_CFG_VC5EN_ENABLED_ENUM_VAL (1U) - -/* Field VC6EN: Enable measurement of cell voltage 6. Changes to this bit during active measurement can lead to undefined results. */ -#define MC33775_PRMM_VC_CFG_VC6EN_POS (6U) -#define MC33775_PRMM_VC_CFG_VC6EN_MSK (0x40U) - -/* Enumerated value DISABLED: Measurement disabled */ -#define MC33775_PRMM_VC_CFG_VC6EN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Measurement enabled */ -#define MC33775_PRMM_VC_CFG_VC6EN_ENABLED_ENUM_VAL (1U) - -/* Field VC7EN: Enable measurement of cell voltage 7. Changes to this bit during active measurement can lead to undefined results. */ -#define MC33775_PRMM_VC_CFG_VC7EN_POS (7U) -#define MC33775_PRMM_VC_CFG_VC7EN_MSK (0x80U) - -/* Enumerated value DISABLED: Measurement disabled */ -#define MC33775_PRMM_VC_CFG_VC7EN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Measurement enabled */ -#define MC33775_PRMM_VC_CFG_VC7EN_ENABLED_ENUM_VAL (1U) - -/* Field VC8EN: Enable measurement of cell voltage 8. Changes to this bit during active measurement can lead to undefined results. */ -#define MC33775_PRMM_VC_CFG_VC8EN_POS (8U) -#define MC33775_PRMM_VC_CFG_VC8EN_MSK (0x100U) - -/* Enumerated value DISABLED: Measurement disabled */ -#define MC33775_PRMM_VC_CFG_VC8EN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Measurement enabled */ -#define MC33775_PRMM_VC_CFG_VC8EN_ENABLED_ENUM_VAL (1U) - -/* Field VC9EN: Enable measurement of cell voltage 9. Changes to this bit during active measurement can lead to undefined results. */ -#define MC33775_PRMM_VC_CFG_VC9EN_POS (9U) -#define MC33775_PRMM_VC_CFG_VC9EN_MSK (0x200U) - -/* Enumerated value DISABLED: Measurement disabled */ -#define MC33775_PRMM_VC_CFG_VC9EN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Measurement enabled */ -#define MC33775_PRMM_VC_CFG_VC9EN_ENABLED_ENUM_VAL (1U) - -/* Field VC10EN: Enable measurement of cell voltage 10. Changes to this bit during active measurement can lead to undefined results. */ -#define MC33775_PRMM_VC_CFG_VC10EN_POS (10U) -#define MC33775_PRMM_VC_CFG_VC10EN_MSK (0x400U) - -/* Enumerated value DISABLED: Measurement disabled */ -#define MC33775_PRMM_VC_CFG_VC10EN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Measurement enabled */ -#define MC33775_PRMM_VC_CFG_VC10EN_ENABLED_ENUM_VAL (1U) - -/* Field VC11EN: Enable measurement of cell voltage 11. Changes to this bit during active measurement can lead to undefined results. */ -#define MC33775_PRMM_VC_CFG_VC11EN_POS (11U) -#define MC33775_PRMM_VC_CFG_VC11EN_MSK (0x800U) - -/* Enumerated value DISABLED: Measurement disabled */ -#define MC33775_PRMM_VC_CFG_VC11EN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Measurement enabled */ -#define MC33775_PRMM_VC_CFG_VC11EN_ENABLED_ENUM_VAL (1U) - -/* Field VC12EN: Enable measurement of cell voltage 12. Changes to this bit during active measurement can lead to undefined results. */ -#define MC33775_PRMM_VC_CFG_VC12EN_POS (12U) -#define MC33775_PRMM_VC_CFG_VC12EN_MSK (0x1000U) - -/* Enumerated value DISABLED: Measurement disabled */ -#define MC33775_PRMM_VC_CFG_VC12EN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Measurement enabled */ -#define MC33775_PRMM_VC_CFG_VC12EN_ENABLED_ENUM_VAL (1U) - -/* Field VC13EN: Enable measurement of cell voltage 13. Changes to this bit during active measurement can lead to undefined results. */ -#define MC33775_PRMM_VC_CFG_VC13EN_POS (13U) -#define MC33775_PRMM_VC_CFG_VC13EN_MSK (0x2000U) - -/* Enumerated value DISABLED: Measurement disabled */ -#define MC33775_PRMM_VC_CFG_VC13EN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Measurement enabled */ -#define MC33775_PRMM_VC_CFG_VC13EN_ENABLED_ENUM_VAL (1U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_PRMM_VC_CFG_RESERVED0_POS (14U) -#define MC33775_PRMM_VC_CFG_RESERVED0_MSK (0xC000U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VC0EN : 1; - volatile uint16_t VC1EN : 1; - volatile uint16_t VC2EN : 1; - volatile uint16_t VC3EN : 1; - volatile uint16_t VC4EN : 1; - volatile uint16_t VC5EN : 1; - volatile uint16_t VC6EN : 1; - volatile uint16_t VC7EN : 1; - volatile uint16_t VC8EN : 1; - volatile uint16_t VC9EN : 1; - volatile uint16_t VC10EN : 1; - volatile uint16_t VC11EN : 1; - volatile uint16_t VC12EN : 1; - volatile uint16_t VC13EN : 1; - volatile uint16_t reserved0 : 2; - } B; -} mc33775_primary_measurement_registers_prmm_vc_cfg_t; - -/* -------------------------------------------------------------------------- - * PRMM_AIN_CFG (read-write):AINx and VMODULE measurement enables. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_AIN_CFG_OFFSET (0x1809U) -#define MC33775_PRMM_AIN_CFG_RW_MSK (0xFF9FU) -#define MC33775_PRMM_AIN_CFG_RD_MSK (0xFF9FU) -#define MC33775_PRMM_AIN_CFG_WR_MSK (0xFF9FU) -#define MC33775_PRMM_AIN_CFG_MW_MSK (0x0U) -#define MC33775_PRMM_AIN_CFG_RA_MSK (0x0U) -#define MC33775_PRMM_AIN_CFG_POR_MSK (0xffffU) -#define MC33775_PRMM_AIN_CFG_POR_VAL (0x80U) - -/* Field AIN0EN: Enable measurement of AIN0. Changes to this bit during active measurement can lead to undefined results. Note: TBC Switches the GPIO0/AIN0 to the analog measurement function. */ -#define MC33775_PRMM_AIN_CFG_AIN0EN_POS (0U) -#define MC33775_PRMM_AIN_CFG_AIN0EN_MSK (0x1U) - -/* Enumerated value DISABLED: Measurement disabled */ -#define MC33775_PRMM_AIN_CFG_AIN0EN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Measurement enabled */ -#define MC33775_PRMM_AIN_CFG_AIN0EN_ENABLED_ENUM_VAL (1U) - -/* Field AIN1EN: Enable measurement of AIN1. Changes to this bit during active measurement can lead to undefined results. */ -#define MC33775_PRMM_AIN_CFG_AIN1EN_POS (1U) -#define MC33775_PRMM_AIN_CFG_AIN1EN_MSK (0x2U) - -/* Enumerated value DISABLED: Measurement disabled */ -#define MC33775_PRMM_AIN_CFG_AIN1EN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Measurement enabled */ -#define MC33775_PRMM_AIN_CFG_AIN1EN_ENABLED_ENUM_VAL (1U) - -/* Field AIN2EN: Enable measurement of AIN2. Changes to this bit during active measurement can lead to undefined results. */ -#define MC33775_PRMM_AIN_CFG_AIN2EN_POS (2U) -#define MC33775_PRMM_AIN_CFG_AIN2EN_MSK (0x4U) - -/* Enumerated value DISABLED: Measurement disabled */ -#define MC33775_PRMM_AIN_CFG_AIN2EN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Measurement enabled */ -#define MC33775_PRMM_AIN_CFG_AIN2EN_ENABLED_ENUM_VAL (1U) - -/* Field AIN3EN: Enable measurement of AIN3. Changes to this bit during active measurement can lead to undefined results. */ -#define MC33775_PRMM_AIN_CFG_AIN3EN_POS (3U) -#define MC33775_PRMM_AIN_CFG_AIN3EN_MSK (0x8U) - -/* Enumerated value DISABLED: Measurement disabled */ -#define MC33775_PRMM_AIN_CFG_AIN3EN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Measurement enabled */ -#define MC33775_PRMM_AIN_CFG_AIN3EN_ENABLED_ENUM_VAL (1U) - -/* Field VMODULEEN: Enable measurement of VMODULE. Changes to this bit during active measurement can lead to undefined results. Note: VMODULE is measured in parallel to AIN4. */ -#define MC33775_PRMM_AIN_CFG_VMODULEEN_POS (4U) -#define MC33775_PRMM_AIN_CFG_VMODULEEN_MSK (0x10U) - -/* Enumerated value DISABLED: Measurement disabled */ -#define MC33775_PRMM_AIN_CFG_VMODULEEN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Measurement enabled */ -#define MC33775_PRMM_AIN_CFG_VMODULEEN_ENABLED_ENUM_VAL (1U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_PRMM_AIN_CFG_RESERVED0_POS (5U) -#define MC33775_PRMM_AIN_CFG_RESERVED0_MSK (0x60U) - -/* Field FLTAPPINV: Invalidate AINx application results in case of fault. */ -#define MC33775_PRMM_AIN_CFG_FLTAPPINV_POS (7U) -#define MC33775_PRMM_AIN_CFG_FLTAPPINV_MSK (0x80U) - -/* Enumerated value VALID: AINx application results are not invalidated in case of a fault */ -#define MC33775_PRMM_AIN_CFG_FLTAPPINV_VALID_ENUM_VAL (0U) - -/* Enumerated value INVALID: AINx application results are invalidated when a fault is detected. */ -#define MC33775_PRMM_AIN_CFG_FLTAPPINV_INVALID_ENUM_VAL (1U) - -/* Field RATIOMETRICAIN0: Reference selection for AIN0. Changes to these bits during active measurement can lead to undefined results. */ -#define MC33775_PRMM_AIN_CFG_RATIOMETRICAIN0_POS (8U) -#define MC33775_PRMM_AIN_CFG_RATIOMETRICAIN0_MSK (0x300U) - -/* Enumerated value PRMVREF: Absolute (PRMVREF) */ -#define MC33775_PRMM_AIN_CFG_RATIOMETRICAIN0_PRMVREF_ENUM_VAL (0U) - -/* Enumerated value RESERVED: reserved */ -#define MC33775_PRMM_AIN_CFG_RATIOMETRICAIN0_RESERVED_ENUM_VAL (1U) - -/* Enumerated value VAUX: Ratiometric (VAUX) */ -#define MC33775_PRMM_AIN_CFG_RATIOMETRICAIN0_VAUX_ENUM_VAL (2U) - -/* Enumerated value VDDC: Ratiometric (VDDC) */ -#define MC33775_PRMM_AIN_CFG_RATIOMETRICAIN0_VDDC_ENUM_VAL (3U) - -/* Field RATIOMETRICAIN1: Reference selection for AIN1. Changes to these bits during active measurement can lead to undefined results. */ -#define MC33775_PRMM_AIN_CFG_RATIOMETRICAIN1_POS (10U) -#define MC33775_PRMM_AIN_CFG_RATIOMETRICAIN1_MSK (0xC00U) - -/* Enumerated value PRMVREF: Absolute (PRMVREF) */ -#define MC33775_PRMM_AIN_CFG_RATIOMETRICAIN1_PRMVREF_ENUM_VAL (0U) - -/* Enumerated value RESERVED: reserved */ -#define MC33775_PRMM_AIN_CFG_RATIOMETRICAIN1_RESERVED_ENUM_VAL (1U) - -/* Enumerated value VAUX: Ratiometric (VAUX) */ -#define MC33775_PRMM_AIN_CFG_RATIOMETRICAIN1_VAUX_ENUM_VAL (2U) - -/* Enumerated value VDDC: Ratiometric (VDDC) */ -#define MC33775_PRMM_AIN_CFG_RATIOMETRICAIN1_VDDC_ENUM_VAL (3U) - -/* Field RATIOMETRICAIN2: Reference selection for AIN2. Changes to these bits during active measurement can lead to undefined results. */ -#define MC33775_PRMM_AIN_CFG_RATIOMETRICAIN2_POS (12U) -#define MC33775_PRMM_AIN_CFG_RATIOMETRICAIN2_MSK (0x3000U) - -/* Enumerated value PRMVREF: Absolute (PRMVREF) */ -#define MC33775_PRMM_AIN_CFG_RATIOMETRICAIN2_PRMVREF_ENUM_VAL (0U) - -/* Enumerated value RESERVED: reserved */ -#define MC33775_PRMM_AIN_CFG_RATIOMETRICAIN2_RESERVED_ENUM_VAL (1U) - -/* Enumerated value VAUX: Ratiometric (VAUX) */ -#define MC33775_PRMM_AIN_CFG_RATIOMETRICAIN2_VAUX_ENUM_VAL (2U) - -/* Enumerated value VDDC: Ratiometric (VDDC) */ -#define MC33775_PRMM_AIN_CFG_RATIOMETRICAIN2_VDDC_ENUM_VAL (3U) - -/* Field RATIOMETRICAIN3: Reference selection for AIN3. Changes to these bits during active measurement can lead to undefined results. */ -#define MC33775_PRMM_AIN_CFG_RATIOMETRICAIN3_POS (14U) -#define MC33775_PRMM_AIN_CFG_RATIOMETRICAIN3_MSK (0xC000U) - -/* Enumerated value PRMVREF: Absolute (PRMVREF) */ -#define MC33775_PRMM_AIN_CFG_RATIOMETRICAIN3_PRMVREF_ENUM_VAL (0U) - -/* Enumerated value RESERVED: reserved */ -#define MC33775_PRMM_AIN_CFG_RATIOMETRICAIN3_RESERVED_ENUM_VAL (1U) - -/* Enumerated value VAUX: Ratiometric (VAUX) */ -#define MC33775_PRMM_AIN_CFG_RATIOMETRICAIN3_VAUX_ENUM_VAL (2U) - -/* Enumerated value VDDC: Ratiometric (VDDC) */ -#define MC33775_PRMM_AIN_CFG_RATIOMETRICAIN3_VDDC_ENUM_VAL (3U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t AIN0EN : 1; - volatile uint16_t AIN1EN : 1; - volatile uint16_t AIN2EN : 1; - volatile uint16_t AIN3EN : 1; - volatile uint16_t VMODULEEN : 1; - volatile uint16_t reserved0 : 2; - volatile uint16_t FLTAPPINV : 1; - volatile uint16_t RATIOMETRICAIN0 : 2; - volatile uint16_t RATIOMETRICAIN1 : 2; - volatile uint16_t RATIOMETRICAIN2 : 2; - volatile uint16_t RATIOMETRICAIN3 : 2; - } B; -} mc33775_primary_measurement_registers_prmm_ain_cfg_t; - -/* -------------------------------------------------------------------------- - * PRMM_AIN_OL_CFG (read-write):AINx open_load detection enable. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_AIN_OL_CFG_OFFSET (0x180AU) -#define MC33775_PRMM_AIN_OL_CFG_RW_MSK (0xFU) -#define MC33775_PRMM_AIN_OL_CFG_RD_MSK (0xFU) -#define MC33775_PRMM_AIN_OL_CFG_WR_MSK (0xFU) -#define MC33775_PRMM_AIN_OL_CFG_MW_MSK (0x0U) -#define MC33775_PRMM_AIN_OL_CFG_RA_MSK (0x0U) -#define MC33775_PRMM_AIN_OL_CFG_POR_MSK (0xffffU) -#define MC33775_PRMM_AIN_OL_CFG_POR_VAL (0x0U) - -/* Field AIN0EN: Open load detection circuit for AIN0 */ -#define MC33775_PRMM_AIN_OL_CFG_AIN0EN_POS (0U) -#define MC33775_PRMM_AIN_OL_CFG_AIN0EN_MSK (0x1U) - -/* Enumerated value DISABLED: Disable the open load detection circuit. */ -#define MC33775_PRMM_AIN_OL_CFG_AIN0EN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Enable the open load detection circuit. */ -#define MC33775_PRMM_AIN_OL_CFG_AIN0EN_ENABLED_ENUM_VAL (1U) - -/* Field AIN1EN: Open load detection circuit for AIN1 */ -#define MC33775_PRMM_AIN_OL_CFG_AIN1EN_POS (1U) -#define MC33775_PRMM_AIN_OL_CFG_AIN1EN_MSK (0x2U) - -/* Enumerated value DISABLED: Disable the open load detection circuit. */ -#define MC33775_PRMM_AIN_OL_CFG_AIN1EN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Enable the open load detection circuit. */ -#define MC33775_PRMM_AIN_OL_CFG_AIN1EN_ENABLED_ENUM_VAL (1U) - -/* Field AIN2EN: Open load detection circuit for AIN2 */ -#define MC33775_PRMM_AIN_OL_CFG_AIN2EN_POS (2U) -#define MC33775_PRMM_AIN_OL_CFG_AIN2EN_MSK (0x4U) - -/* Enumerated value DISABLED: Disable the open load detection circuit. */ -#define MC33775_PRMM_AIN_OL_CFG_AIN2EN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Enable the open load detection circuit. */ -#define MC33775_PRMM_AIN_OL_CFG_AIN2EN_ENABLED_ENUM_VAL (1U) - -/* Field AIN3EN: Open load detection circuit for AIN3 */ -#define MC33775_PRMM_AIN_OL_CFG_AIN3EN_POS (3U) -#define MC33775_PRMM_AIN_OL_CFG_AIN3EN_MSK (0x8U) - -/* Enumerated value DISABLED: Disable the open load detection circuit. */ -#define MC33775_PRMM_AIN_OL_CFG_AIN3EN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Enable the open load detection circuit. */ -#define MC33775_PRMM_AIN_OL_CFG_AIN3EN_ENABLED_ENUM_VAL (1U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_PRMM_AIN_OL_CFG_RESERVED0_POS (4U) -#define MC33775_PRMM_AIN_OL_CFG_RESERVED0_MSK (0xFFF0U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t AIN0EN : 1; - volatile uint16_t AIN1EN : 1; - volatile uint16_t AIN2EN : 1; - volatile uint16_t AIN3EN : 1; - volatile uint16_t reserved0 : 12; - } B; -} mc33775_primary_measurement_registers_prmm_ain_ol_cfg_t; - -/* -------------------------------------------------------------------------- - * PRMM_VDIV_CFG (read-write):Voltage divider enable. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_VDIV_CFG_OFFSET (0x180BU) -#define MC33775_PRMM_VDIV_CFG_RW_MSK (0x7U) -#define MC33775_PRMM_VDIV_CFG_RD_MSK (0x7U) -#define MC33775_PRMM_VDIV_CFG_WR_MSK (0x7U) -#define MC33775_PRMM_VDIV_CFG_MW_MSK (0x0U) -#define MC33775_PRMM_VDIV_CFG_RA_MSK (0x0U) -#define MC33775_PRMM_VDIV_CFG_POR_MSK (0xffffU) -#define MC33775_PRMM_VDIV_CFG_POR_VAL (0x7U) - -/* Field VAUXEN: Voltage divider for primary VAUX measurement */ -#define MC33775_PRMM_VDIV_CFG_VAUXEN_POS (0U) -#define MC33775_PRMM_VDIV_CFG_VAUXEN_MSK (0x1U) - -/* Enumerated value DISABLED: Voltage divider for primary VAUX measurement is disabled. */ -#define MC33775_PRMM_VDIV_CFG_VAUXEN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Voltage divider for primary VAUX measurement is enabled. */ -#define MC33775_PRMM_VDIV_CFG_VAUXEN_ENABLED_ENUM_VAL (1U) - -/* Field VDDCEN: Voltage divider for primary VDDC measurement */ -#define MC33775_PRMM_VDIV_CFG_VDDCEN_POS (1U) -#define MC33775_PRMM_VDIV_CFG_VDDCEN_MSK (0x2U) - -/* Enumerated value DISABLED: Voltage divider for primary VDDC measurement is disabled. */ -#define MC33775_PRMM_VDIV_CFG_VDDCEN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Voltage divider for primary VDDC measurement is enabled. */ -#define MC33775_PRMM_VDIV_CFG_VDDCEN_ENABLED_ENUM_VAL (1U) - -/* Field VMODULEEN: Voltage divider for VMODULE. */ -#define MC33775_PRMM_VDIV_CFG_VMODULEEN_POS (2U) -#define MC33775_PRMM_VDIV_CFG_VMODULEEN_MSK (0x4U) - -/* Enumerated value DISABLED: Voltage divider for VMODULE is disabled. */ -#define MC33775_PRMM_VDIV_CFG_VMODULEEN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Voltage divider for VMODULE is enabled. */ -#define MC33775_PRMM_VDIV_CFG_VMODULEEN_ENABLED_ENUM_VAL (1U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_PRMM_VDIV_CFG_RESERVED0_POS (3U) -#define MC33775_PRMM_VDIV_CFG_RESERVED0_MSK (0xFFF8U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VAUXEN : 1; - volatile uint16_t VDDCEN : 1; - volatile uint16_t VMODULEEN : 1; - volatile uint16_t reserved0 : 13; - } B; -} mc33775_primary_measurement_registers_prmm_vdiv_cfg_t; - -/* -------------------------------------------------------------------------- - * PRMM_VC_OV_UV_CFG (read-write):Cell voltage over- and undervoltage check enable. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_VC_OV_UV_CFG_OFFSET (0x1810U) -#define MC33775_PRMM_VC_OV_UV_CFG_RW_MSK (0x3FFFU) -#define MC33775_PRMM_VC_OV_UV_CFG_RD_MSK (0x3FFFU) -#define MC33775_PRMM_VC_OV_UV_CFG_WR_MSK (0x3FFFU) -#define MC33775_PRMM_VC_OV_UV_CFG_MW_MSK (0x0U) -#define MC33775_PRMM_VC_OV_UV_CFG_RA_MSK (0x0U) -#define MC33775_PRMM_VC_OV_UV_CFG_POR_MSK (0xffffU) -#define MC33775_PRMM_VC_OV_UV_CFG_POR_VAL (0x0U) - -/* Field VC0EN: Include VC0 in VC over- and under-voltage checks */ -#define MC33775_PRMM_VC_OV_UV_CFG_VC0EN_POS (0U) -#define MC33775_PRMM_VC_OV_UV_CFG_VC0EN_MSK (0x1U) - -/* Enumerated value NO_CHECK: VC0 is not included in VC over- and under-voltage checks. */ -#define MC33775_PRMM_VC_OV_UV_CFG_VC0EN_NO_CHECK_ENUM_VAL (0U) - -/* Enumerated value UV_OV: VC0 is included in VC over- and under-voltage checks. */ -#define MC33775_PRMM_VC_OV_UV_CFG_VC0EN_UV_OV_ENUM_VAL (1U) - -/* Field VC1EN: Include VC1 in VC over- and under-voltage checks */ -#define MC33775_PRMM_VC_OV_UV_CFG_VC1EN_POS (1U) -#define MC33775_PRMM_VC_OV_UV_CFG_VC1EN_MSK (0x2U) - -/* Enumerated value NO_CHECK: VC1 is not included in VC over- and under-voltage checks. */ -#define MC33775_PRMM_VC_OV_UV_CFG_VC1EN_NO_CHECK_ENUM_VAL (0U) - -/* Enumerated value UV_OV: VC1 is included in VC over- and under-voltage checks. */ -#define MC33775_PRMM_VC_OV_UV_CFG_VC1EN_UV_OV_ENUM_VAL (1U) - -/* Field VC2EN: Include VC2 in VC over- and under-voltage checks */ -#define MC33775_PRMM_VC_OV_UV_CFG_VC2EN_POS (2U) -#define MC33775_PRMM_VC_OV_UV_CFG_VC2EN_MSK (0x4U) - -/* Enumerated value NO_CHECK: VC2 is not included in VC over- and under-voltage checks. */ -#define MC33775_PRMM_VC_OV_UV_CFG_VC2EN_NO_CHECK_ENUM_VAL (0U) - -/* Enumerated value UV_OV: VC2 is included in VC over- and under-voltage checks. */ -#define MC33775_PRMM_VC_OV_UV_CFG_VC2EN_UV_OV_ENUM_VAL (1U) - -/* Field VC3EN: Include VC3 in VC over- and under-voltage checks */ -#define MC33775_PRMM_VC_OV_UV_CFG_VC3EN_POS (3U) -#define MC33775_PRMM_VC_OV_UV_CFG_VC3EN_MSK (0x8U) - -/* Enumerated value NO_CHECK: VC3 is not included in VC over- and under-voltage checks. */ -#define MC33775_PRMM_VC_OV_UV_CFG_VC3EN_NO_CHECK_ENUM_VAL (0U) - -/* Enumerated value UV_OV: VC3 is included in VC over- and under-voltage checks. */ -#define MC33775_PRMM_VC_OV_UV_CFG_VC3EN_UV_OV_ENUM_VAL (1U) - -/* Field VC4EN: Include VC4 in VC over- and under-voltage checks */ -#define MC33775_PRMM_VC_OV_UV_CFG_VC4EN_POS (4U) -#define MC33775_PRMM_VC_OV_UV_CFG_VC4EN_MSK (0x10U) - -/* Enumerated value NO_CHECK: VC4 is not included in VC over- and under-voltage checks. */ -#define MC33775_PRMM_VC_OV_UV_CFG_VC4EN_NO_CHECK_ENUM_VAL (0U) - -/* Enumerated value UV_OV: VC4 is included in VC over- and under-voltage checks. */ -#define MC33775_PRMM_VC_OV_UV_CFG_VC4EN_UV_OV_ENUM_VAL (1U) - -/* Field VC5EN: Include VC5 in VC over- and under-voltage checks */ -#define MC33775_PRMM_VC_OV_UV_CFG_VC5EN_POS (5U) -#define MC33775_PRMM_VC_OV_UV_CFG_VC5EN_MSK (0x20U) - -/* Enumerated value NO_CHECK: VC5 is not included in VC over- and under-voltage checks. */ -#define MC33775_PRMM_VC_OV_UV_CFG_VC5EN_NO_CHECK_ENUM_VAL (0U) - -/* Enumerated value UV_OV: VC5 is included in VC over- and under-voltage checks. */ -#define MC33775_PRMM_VC_OV_UV_CFG_VC5EN_UV_OV_ENUM_VAL (1U) - -/* Field VC6EN: Include VC6 in VC over- and under-voltage checks */ -#define MC33775_PRMM_VC_OV_UV_CFG_VC6EN_POS (6U) -#define MC33775_PRMM_VC_OV_UV_CFG_VC6EN_MSK (0x40U) - -/* Enumerated value NO_CHECK: VC6 is not included in VC over- and under-voltage checks. */ -#define MC33775_PRMM_VC_OV_UV_CFG_VC6EN_NO_CHECK_ENUM_VAL (0U) - -/* Enumerated value UV_OV: VC6 is included in VC over- and under-voltage checks. */ -#define MC33775_PRMM_VC_OV_UV_CFG_VC6EN_UV_OV_ENUM_VAL (1U) - -/* Field VC7EN: Include VC7 in VC over- and under-voltage checks */ -#define MC33775_PRMM_VC_OV_UV_CFG_VC7EN_POS (7U) -#define MC33775_PRMM_VC_OV_UV_CFG_VC7EN_MSK (0x80U) - -/* Enumerated value NO_CHECK: VC7 is not included in VC over- and under-voltage checks. */ -#define MC33775_PRMM_VC_OV_UV_CFG_VC7EN_NO_CHECK_ENUM_VAL (0U) - -/* Enumerated value UV_OV: VC7 is included in VC over- and under-voltage checks. */ -#define MC33775_PRMM_VC_OV_UV_CFG_VC7EN_UV_OV_ENUM_VAL (1U) - -/* Field VC8EN: Include VC8 in VC over- and under-voltage checks */ -#define MC33775_PRMM_VC_OV_UV_CFG_VC8EN_POS (8U) -#define MC33775_PRMM_VC_OV_UV_CFG_VC8EN_MSK (0x100U) - -/* Enumerated value NO_CHECK: VC8 is not included in VC over- and under-voltage checks. */ -#define MC33775_PRMM_VC_OV_UV_CFG_VC8EN_NO_CHECK_ENUM_VAL (0U) - -/* Enumerated value UV_OV: VC8 is included in VC over- and under-voltage checks. */ -#define MC33775_PRMM_VC_OV_UV_CFG_VC8EN_UV_OV_ENUM_VAL (1U) - -/* Field VC9EN: Include VC9 in VC over- and under-voltage checks */ -#define MC33775_PRMM_VC_OV_UV_CFG_VC9EN_POS (9U) -#define MC33775_PRMM_VC_OV_UV_CFG_VC9EN_MSK (0x200U) - -/* Enumerated value NO_CHECK: VC9 is not included in VC over- and under-voltage checks. */ -#define MC33775_PRMM_VC_OV_UV_CFG_VC9EN_NO_CHECK_ENUM_VAL (0U) - -/* Enumerated value UV_OV: VC9 is included in VC over- and under-voltage checks. */ -#define MC33775_PRMM_VC_OV_UV_CFG_VC9EN_UV_OV_ENUM_VAL (1U) - -/* Field VC10EN: Include VC10 in VC over- and under-voltage checks */ -#define MC33775_PRMM_VC_OV_UV_CFG_VC10EN_POS (10U) -#define MC33775_PRMM_VC_OV_UV_CFG_VC10EN_MSK (0x400U) - -/* Enumerated value NO_CHECK: VC10 is not included in VC over- and under-voltage checks. */ -#define MC33775_PRMM_VC_OV_UV_CFG_VC10EN_NO_CHECK_ENUM_VAL (0U) - -/* Enumerated value UV_OV: VC10 is included in VC over- and under-voltage checks. */ -#define MC33775_PRMM_VC_OV_UV_CFG_VC10EN_UV_OV_ENUM_VAL (1U) - -/* Field VC11EN: Include VC11 in VC over- and under-voltage checks */ -#define MC33775_PRMM_VC_OV_UV_CFG_VC11EN_POS (11U) -#define MC33775_PRMM_VC_OV_UV_CFG_VC11EN_MSK (0x800U) - -/* Enumerated value NO_CHECK: VC11 is not included in VC over- and under-voltage checks. */ -#define MC33775_PRMM_VC_OV_UV_CFG_VC11EN_NO_CHECK_ENUM_VAL (0U) - -/* Enumerated value UV_OV: VC11 is included in VC over- and under-voltage checks. */ -#define MC33775_PRMM_VC_OV_UV_CFG_VC11EN_UV_OV_ENUM_VAL (1U) - -/* Field VC12EN: Include VC12 in VC over- and under-voltage checks */ -#define MC33775_PRMM_VC_OV_UV_CFG_VC12EN_POS (12U) -#define MC33775_PRMM_VC_OV_UV_CFG_VC12EN_MSK (0x1000U) - -/* Enumerated value NO_CHECK: VC12 is not included in VC over- and under-voltage checks. */ -#define MC33775_PRMM_VC_OV_UV_CFG_VC12EN_NO_CHECK_ENUM_VAL (0U) - -/* Enumerated value UV_OV: VC12 is included in VC over- and under-voltage checks. */ -#define MC33775_PRMM_VC_OV_UV_CFG_VC12EN_UV_OV_ENUM_VAL (1U) - -/* Field VC13EN: Include VC13 in VC over- and under-voltage checks */ -#define MC33775_PRMM_VC_OV_UV_CFG_VC13EN_POS (13U) -#define MC33775_PRMM_VC_OV_UV_CFG_VC13EN_MSK (0x2000U) - -/* Enumerated value NO_CHECK: VC13 is not included in VC over- and under-voltage checks. */ -#define MC33775_PRMM_VC_OV_UV_CFG_VC13EN_NO_CHECK_ENUM_VAL (0U) - -/* Enumerated value UV_OV: VC13 is included in VC over- and under-voltage checks. */ -#define MC33775_PRMM_VC_OV_UV_CFG_VC13EN_UV_OV_ENUM_VAL (1U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_PRMM_VC_OV_UV_CFG_RESERVED0_POS (14U) -#define MC33775_PRMM_VC_OV_UV_CFG_RESERVED0_MSK (0xC000U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VC0EN : 1; - volatile uint16_t VC1EN : 1; - volatile uint16_t VC2EN : 1; - volatile uint16_t VC3EN : 1; - volatile uint16_t VC4EN : 1; - volatile uint16_t VC5EN : 1; - volatile uint16_t VC6EN : 1; - volatile uint16_t VC7EN : 1; - volatile uint16_t VC8EN : 1; - volatile uint16_t VC9EN : 1; - volatile uint16_t VC10EN : 1; - volatile uint16_t VC11EN : 1; - volatile uint16_t VC12EN : 1; - volatile uint16_t VC13EN : 1; - volatile uint16_t reserved0 : 2; - } B; -} mc33775_primary_measurement_registers_prmm_vc_ov_uv_cfg_t; - -/* -------------------------------------------------------------------------- - * PRMM_VC_OV_TH_CFG (read-write):Upper comparator limit for VC0..13. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_VC_OV_TH_CFG_OFFSET (0x1811U) -#define MC33775_PRMM_VC_OV_TH_CFG_RW_MSK (0xFFFFU) -#define MC33775_PRMM_VC_OV_TH_CFG_RD_MSK (0xFFFFU) -#define MC33775_PRMM_VC_OV_TH_CFG_WR_MSK (0xFFFFU) -#define MC33775_PRMM_VC_OV_TH_CFG_MW_MSK (0x0U) -#define MC33775_PRMM_VC_OV_TH_CFG_RA_MSK (0x0U) -#define MC33775_PRMM_VC_OV_TH_CFG_POR_MSK (0xffffU) -#define MC33775_PRMM_VC_OV_TH_CFG_POR_VAL (0x7fffU) - -/* Field LIMIT: Limit value. If this limit is reached, the OV fault is activated. */ -#define MC33775_PRMM_VC_OV_TH_CFG_LIMIT_POS (0U) -#define MC33775_PRMM_VC_OV_TH_CFG_LIMIT_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t LIMIT : 16; - } B; -} mc33775_primary_measurement_registers_prmm_vc_ov_th_cfg_t; - -/* -------------------------------------------------------------------------- - * PRMM_VC_UV0_TH_CFG (read-write):Lower comparator limit 0 for VC0..13. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_VC_UV0_TH_CFG_OFFSET (0x1812U) -#define MC33775_PRMM_VC_UV0_TH_CFG_RW_MSK (0xFFFFU) -#define MC33775_PRMM_VC_UV0_TH_CFG_RD_MSK (0xFFFFU) -#define MC33775_PRMM_VC_UV0_TH_CFG_WR_MSK (0xFFFFU) -#define MC33775_PRMM_VC_UV0_TH_CFG_MW_MSK (0x0U) -#define MC33775_PRMM_VC_UV0_TH_CFG_RA_MSK (0x0U) -#define MC33775_PRMM_VC_UV0_TH_CFG_POR_MSK (0xffffU) -#define MC33775_PRMM_VC_UV0_TH_CFG_POR_VAL (0x0U) - -/* Field LIMIT: Limit value. If this limit is reached, the channel individual UV fault is activated. Note: This limit is used for the channel individual balancing disable. */ -#define MC33775_PRMM_VC_UV0_TH_CFG_LIMIT_POS (0U) -#define MC33775_PRMM_VC_UV0_TH_CFG_LIMIT_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t LIMIT : 16; - } B; -} mc33775_primary_measurement_registers_prmm_vc_uv0_th_cfg_t; - -/* -------------------------------------------------------------------------- - * PRMM_VC_UV1_TH_CFG (read-write):Lower comparator limit 1 for VC0..13. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_VC_UV1_TH_CFG_OFFSET (0x1813U) -#define MC33775_PRMM_VC_UV1_TH_CFG_RW_MSK (0xFFFFU) -#define MC33775_PRMM_VC_UV1_TH_CFG_RD_MSK (0xFFFFU) -#define MC33775_PRMM_VC_UV1_TH_CFG_WR_MSK (0xFFFFU) -#define MC33775_PRMM_VC_UV1_TH_CFG_MW_MSK (0x0U) -#define MC33775_PRMM_VC_UV1_TH_CFG_RA_MSK (0x0U) -#define MC33775_PRMM_VC_UV1_TH_CFG_POR_MSK (0xffffU) -#define MC33775_PRMM_VC_UV1_TH_CFG_POR_VAL (0x0U) - -/* Field LIMIT: Limit value. If this limit is reached, the global UV fault is activated. Note: This limit is used for the global balancing disable. */ -#define MC33775_PRMM_VC_UV1_TH_CFG_LIMIT_POS (0U) -#define MC33775_PRMM_VC_UV1_TH_CFG_LIMIT_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t LIMIT : 16; - } B; -} mc33775_primary_measurement_registers_prmm_vc_uv1_th_cfg_t; - -/* -------------------------------------------------------------------------- - * PRMM_AIN0_OV_TH_CFG (read-write):Upper comparator limit forAIN0. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_AIN0_OV_TH_CFG_OFFSET (0x1814U) -#define MC33775_PRMM_AIN0_OV_TH_CFG_RW_MSK (0xFFFFU) -#define MC33775_PRMM_AIN0_OV_TH_CFG_RD_MSK (0xFFFFU) -#define MC33775_PRMM_AIN0_OV_TH_CFG_WR_MSK (0xFFFFU) -#define MC33775_PRMM_AIN0_OV_TH_CFG_MW_MSK (0x0U) -#define MC33775_PRMM_AIN0_OV_TH_CFG_RA_MSK (0x0U) -#define MC33775_PRMM_AIN0_OV_TH_CFG_POR_MSK (0xffffU) -#define MC33775_PRMM_AIN0_OV_TH_CFG_POR_VAL (0x7fffU) - -/* Field LIMIT: Limit value. If this limit is reached, the OV fault is activated. Note: Signed value (two's complement). */ -#define MC33775_PRMM_AIN0_OV_TH_CFG_LIMIT_POS (0U) -#define MC33775_PRMM_AIN0_OV_TH_CFG_LIMIT_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t LIMIT : 16; - } B; -} mc33775_primary_measurement_registers_prmm_ain0_ov_th_cfg_t; - -/* -------------------------------------------------------------------------- - * PRMM_AIN1_OV_TH_CFG (read-write):Upper comparator limit forAIN1. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_AIN1_OV_TH_CFG_OFFSET (0x1815U) -#define MC33775_PRMM_AIN1_OV_TH_CFG_RW_MSK (0xFFFFU) -#define MC33775_PRMM_AIN1_OV_TH_CFG_RD_MSK (0xFFFFU) -#define MC33775_PRMM_AIN1_OV_TH_CFG_WR_MSK (0xFFFFU) -#define MC33775_PRMM_AIN1_OV_TH_CFG_MW_MSK (0x0U) -#define MC33775_PRMM_AIN1_OV_TH_CFG_RA_MSK (0x0U) -#define MC33775_PRMM_AIN1_OV_TH_CFG_POR_MSK (0xffffU) -#define MC33775_PRMM_AIN1_OV_TH_CFG_POR_VAL (0x7fffU) - -/* Field LIMIT: Limit value. If this limit is reached, the OV fault is activated. */ -#define MC33775_PRMM_AIN1_OV_TH_CFG_LIMIT_POS (0U) -#define MC33775_PRMM_AIN1_OV_TH_CFG_LIMIT_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t LIMIT : 16; - } B; -} mc33775_primary_measurement_registers_prmm_ain1_ov_th_cfg_t; - -/* -------------------------------------------------------------------------- - * PRMM_AIN2_OV_TH_CFG (read-write):Upper comparator limit forAIN2. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_AIN2_OV_TH_CFG_OFFSET (0x1816U) -#define MC33775_PRMM_AIN2_OV_TH_CFG_RW_MSK (0xFFFFU) -#define MC33775_PRMM_AIN2_OV_TH_CFG_RD_MSK (0xFFFFU) -#define MC33775_PRMM_AIN2_OV_TH_CFG_WR_MSK (0xFFFFU) -#define MC33775_PRMM_AIN2_OV_TH_CFG_MW_MSK (0x0U) -#define MC33775_PRMM_AIN2_OV_TH_CFG_RA_MSK (0x0U) -#define MC33775_PRMM_AIN2_OV_TH_CFG_POR_MSK (0xffffU) -#define MC33775_PRMM_AIN2_OV_TH_CFG_POR_VAL (0x7fffU) - -/* Field LIMIT: Limit value. If this limit is reached, the OV fault is activated. */ -#define MC33775_PRMM_AIN2_OV_TH_CFG_LIMIT_POS (0U) -#define MC33775_PRMM_AIN2_OV_TH_CFG_LIMIT_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t LIMIT : 16; - } B; -} mc33775_primary_measurement_registers_prmm_ain2_ov_th_cfg_t; - -/* -------------------------------------------------------------------------- - * PRMM_AIN3_OV_TH_CFG (read-write):Upper comparator limit forAIN3. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_AIN3_OV_TH_CFG_OFFSET (0x1817U) -#define MC33775_PRMM_AIN3_OV_TH_CFG_RW_MSK (0xFFFFU) -#define MC33775_PRMM_AIN3_OV_TH_CFG_RD_MSK (0xFFFFU) -#define MC33775_PRMM_AIN3_OV_TH_CFG_WR_MSK (0xFFFFU) -#define MC33775_PRMM_AIN3_OV_TH_CFG_MW_MSK (0x0U) -#define MC33775_PRMM_AIN3_OV_TH_CFG_RA_MSK (0x0U) -#define MC33775_PRMM_AIN3_OV_TH_CFG_POR_MSK (0xffffU) -#define MC33775_PRMM_AIN3_OV_TH_CFG_POR_VAL (0x7fffU) - -/* Field LIMIT: Limit value. If this limit is reached, the OV fault is activated. */ -#define MC33775_PRMM_AIN3_OV_TH_CFG_LIMIT_POS (0U) -#define MC33775_PRMM_AIN3_OV_TH_CFG_LIMIT_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t LIMIT : 16; - } B; -} mc33775_primary_measurement_registers_prmm_ain3_ov_th_cfg_t; - -/* -------------------------------------------------------------------------- - * PRMM_AIN0_UV_TH_CFG (read-write):Lower comparator limit forAIN0. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_AIN0_UV_TH_CFG_OFFSET (0x1818U) -#define MC33775_PRMM_AIN0_UV_TH_CFG_RW_MSK (0xFFFFU) -#define MC33775_PRMM_AIN0_UV_TH_CFG_RD_MSK (0xFFFFU) -#define MC33775_PRMM_AIN0_UV_TH_CFG_WR_MSK (0xFFFFU) -#define MC33775_PRMM_AIN0_UV_TH_CFG_MW_MSK (0x0U) -#define MC33775_PRMM_AIN0_UV_TH_CFG_RA_MSK (0x0U) -#define MC33775_PRMM_AIN0_UV_TH_CFG_POR_MSK (0xffffU) -#define MC33775_PRMM_AIN0_UV_TH_CFG_POR_VAL (0x8001U) - -/* Field LIMIT: Limit value. If this limit is reached, the UV fault is activated. */ -#define MC33775_PRMM_AIN0_UV_TH_CFG_LIMIT_POS (0U) -#define MC33775_PRMM_AIN0_UV_TH_CFG_LIMIT_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t LIMIT : 16; - } B; -} mc33775_primary_measurement_registers_prmm_ain0_uv_th_cfg_t; - -/* -------------------------------------------------------------------------- - * PRMM_AIN1_UV_TH_CFG (read-write):Lower comparator limit forAIN1. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_AIN1_UV_TH_CFG_OFFSET (0x1819U) -#define MC33775_PRMM_AIN1_UV_TH_CFG_RW_MSK (0xFFFFU) -#define MC33775_PRMM_AIN1_UV_TH_CFG_RD_MSK (0xFFFFU) -#define MC33775_PRMM_AIN1_UV_TH_CFG_WR_MSK (0xFFFFU) -#define MC33775_PRMM_AIN1_UV_TH_CFG_MW_MSK (0x0U) -#define MC33775_PRMM_AIN1_UV_TH_CFG_RA_MSK (0x0U) -#define MC33775_PRMM_AIN1_UV_TH_CFG_POR_MSK (0xffffU) -#define MC33775_PRMM_AIN1_UV_TH_CFG_POR_VAL (0x8001U) - -/* Field LIMIT: Limit value. If this limit is reached, the UV fault is activated. */ -#define MC33775_PRMM_AIN1_UV_TH_CFG_LIMIT_POS (0U) -#define MC33775_PRMM_AIN1_UV_TH_CFG_LIMIT_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t LIMIT : 16; - } B; -} mc33775_primary_measurement_registers_prmm_ain1_uv_th_cfg_t; - -/* -------------------------------------------------------------------------- - * PRMM_AIN2_UV_TH_CFG (read-write):Lower comparator limit forAIN2. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_AIN2_UV_TH_CFG_OFFSET (0x181AU) -#define MC33775_PRMM_AIN2_UV_TH_CFG_RW_MSK (0xFFFFU) -#define MC33775_PRMM_AIN2_UV_TH_CFG_RD_MSK (0xFFFFU) -#define MC33775_PRMM_AIN2_UV_TH_CFG_WR_MSK (0xFFFFU) -#define MC33775_PRMM_AIN2_UV_TH_CFG_MW_MSK (0x0U) -#define MC33775_PRMM_AIN2_UV_TH_CFG_RA_MSK (0x0U) -#define MC33775_PRMM_AIN2_UV_TH_CFG_POR_MSK (0xffffU) -#define MC33775_PRMM_AIN2_UV_TH_CFG_POR_VAL (0x8001U) - -/* Field LIMIT: Limit value. If this limit is reached, the UV fault is activated. */ -#define MC33775_PRMM_AIN2_UV_TH_CFG_LIMIT_POS (0U) -#define MC33775_PRMM_AIN2_UV_TH_CFG_LIMIT_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t LIMIT : 16; - } B; -} mc33775_primary_measurement_registers_prmm_ain2_uv_th_cfg_t; - -/* -------------------------------------------------------------------------- - * PRMM_AIN3_UV_TH_CFG (read-write):Lower comparator limit forAIN3. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_AIN3_UV_TH_CFG_OFFSET (0x181BU) -#define MC33775_PRMM_AIN3_UV_TH_CFG_RW_MSK (0xFFFFU) -#define MC33775_PRMM_AIN3_UV_TH_CFG_RD_MSK (0xFFFFU) -#define MC33775_PRMM_AIN3_UV_TH_CFG_WR_MSK (0xFFFFU) -#define MC33775_PRMM_AIN3_UV_TH_CFG_MW_MSK (0x0U) -#define MC33775_PRMM_AIN3_UV_TH_CFG_RA_MSK (0x0U) -#define MC33775_PRMM_AIN3_UV_TH_CFG_POR_MSK (0xffffU) -#define MC33775_PRMM_AIN3_UV_TH_CFG_POR_VAL (0x8001U) - -/* Field LIMIT: Limit value. If this limit is reached, the UV fault is activated. */ -#define MC33775_PRMM_AIN3_UV_TH_CFG_LIMIT_POS (0U) -#define MC33775_PRMM_AIN3_UV_TH_CFG_LIMIT_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t LIMIT : 16; - } B; -} mc33775_primary_measurement_registers_prmm_ain3_uv_th_cfg_t; - -/* -------------------------------------------------------------------------- - * PRMM_CAL_CRC (read-write):CRC over calibration data. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_CAL_CRC_OFFSET (0x181EU) -#define MC33775_PRMM_CAL_CRC_RW_MSK (0xFFFFU) -#define MC33775_PRMM_CAL_CRC_RD_MSK (0xFFFFU) -#define MC33775_PRMM_CAL_CRC_WR_MSK (0xFFFFU) -#define MC33775_PRMM_CAL_CRC_MW_MSK (0x0U) -#define MC33775_PRMM_CAL_CRC_RA_MSK (0x0U) -#define MC33775_PRMM_CAL_CRC_POR_MSK (0xffffU) -#define MC33775_PRMM_CAL_CRC_POR_VAL (0x0U) - -/* Field CRC: CRC over calibration data. The CRC calculation runs automatically every time when a synchronous measurement cycle is started and when the calibration data is read from the NVM. */ -#define MC33775_PRMM_CAL_CRC_CRC_POS (0U) -#define MC33775_PRMM_CAL_CRC_CRC_MSK (0xFFFFU) - -/* Enumerated value CALIBCRC: The expected value of the calibration CRC. */ -#define MC33775_PRMM_CAL_CRC_CRC_CALIBCRC_ENUM_VAL (48879U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t CRC : 16; - } B; -} mc33775_primary_measurement_registers_prmm_cal_crc_t; - -/* -------------------------------------------------------------------------- - * PRMM_CFG_CRC (read-only):CRC over configuration values. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_CFG_CRC_OFFSET (0x181FU) -#define MC33775_PRMM_CFG_CRC_RW_MSK (0x0U) -#define MC33775_PRMM_CFG_CRC_RD_MSK (0xFFFFU) -#define MC33775_PRMM_CFG_CRC_WR_MSK (0x0U) -#define MC33775_PRMM_CFG_CRC_MW_MSK (0x0U) -#define MC33775_PRMM_CFG_CRC_RA_MSK (0x0U) -#define MC33775_PRMM_CFG_CRC_POR_MSK (0xffffU) -#define MC33775_PRMM_CFG_CRC_POR_VAL (0x0U) - -/* Field CRC: This CRC value is recalculated with any transition into Active mode, with any write to a covered register and with any read to this register. The updated CRC value is available latest 100us after the last write. The CRC value is application specific and must be re-calculated by the MCU. The used polynomial is: 0xD175 (+1) = X^16 + X^15 + X^13 + X^9 + X^7 + X^6 + X^5 + X^3 + X^1 + 1. -Following registers are included: PRMM_CFG, PRMM_PER_CTRL, PRMM_VC_CFG, PRMM_AIN_CFG, PRMM_VDIV_CFG, PRMM_VC_OV_UV_CFG, PRMM_VC_OV_TH_CFG, PRMM_VC_UV0_TH_CFG, PRMM_VC_UV1_TH_CFG, PRMM_AIN0_OV_TH_CFG, PRMM_AIN1_OV_TH_CFG, PRMM_AIN2_OV_TH_CFG, PRMM_AIN3_OV_TH_CFG, PRMM_AIN0_UV_TH_CFG, PRMM_AIN1_UV_TH_CFG, PRMM_AIN2_UV_TH_CFG, PRMM_AIN3_UV_TH_CFG. */ -#define MC33775_PRMM_CFG_CRC_CRC_POS (0U) -#define MC33775_PRMM_CFG_CRC_CRC_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t CRC : 16; - } B; -} mc33775_primary_measurement_registers_prmm_cfg_crc_t; - -/* -------------------------------------------------------------------------- - * PRMM_VC_OV_FLT_STAT (read-only):Cell voltage over-voltage faults - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_VC_OV_FLT_STAT_OFFSET (0x1820U) -#define MC33775_PRMM_VC_OV_FLT_STAT_RW_MSK (0x0U) -#define MC33775_PRMM_VC_OV_FLT_STAT_RD_MSK (0x3FFFU) -#define MC33775_PRMM_VC_OV_FLT_STAT_WR_MSK (0x0U) -#define MC33775_PRMM_VC_OV_FLT_STAT_MW_MSK (0x0U) -#define MC33775_PRMM_VC_OV_FLT_STAT_RA_MSK (0x3FFFU) -#define MC33775_PRMM_VC_OV_FLT_STAT_POR_MSK (0xffffU) -#define MC33775_PRMM_VC_OV_FLT_STAT_POR_VAL (0x0U) - -/* Field VC0: Over-voltage status VC0 */ -#define MC33775_PRMM_VC_OV_FLT_STAT_VC0_POS (0U) -#define MC33775_PRMM_VC_OV_FLT_STAT_VC0_MSK (0x1U) - -/* Enumerated value NO_OV: No over-voltage detected */ -#define MC33775_PRMM_VC_OV_FLT_STAT_VC0_NO_OV_ENUM_VAL (0U) - -/* Enumerated value OV: Over-voltage detected */ -#define MC33775_PRMM_VC_OV_FLT_STAT_VC0_OV_ENUM_VAL (1U) - -/* Field VC1: Over-voltage status VC1 */ -#define MC33775_PRMM_VC_OV_FLT_STAT_VC1_POS (1U) -#define MC33775_PRMM_VC_OV_FLT_STAT_VC1_MSK (0x2U) - -/* Enumerated value NO_OV: No over-voltage detected */ -#define MC33775_PRMM_VC_OV_FLT_STAT_VC1_NO_OV_ENUM_VAL (0U) - -/* Enumerated value OV: Over-voltage detected */ -#define MC33775_PRMM_VC_OV_FLT_STAT_VC1_OV_ENUM_VAL (1U) - -/* Field VC2: Over-voltage status VC2 */ -#define MC33775_PRMM_VC_OV_FLT_STAT_VC2_POS (2U) -#define MC33775_PRMM_VC_OV_FLT_STAT_VC2_MSK (0x4U) - -/* Enumerated value NO_OV: No over-voltage detected */ -#define MC33775_PRMM_VC_OV_FLT_STAT_VC2_NO_OV_ENUM_VAL (0U) - -/* Enumerated value OV: Over-voltage detected */ -#define MC33775_PRMM_VC_OV_FLT_STAT_VC2_OV_ENUM_VAL (1U) - -/* Field VC3: Over-voltage status VC3 */ -#define MC33775_PRMM_VC_OV_FLT_STAT_VC3_POS (3U) -#define MC33775_PRMM_VC_OV_FLT_STAT_VC3_MSK (0x8U) - -/* Enumerated value NO_OV: No over-voltage detected */ -#define MC33775_PRMM_VC_OV_FLT_STAT_VC3_NO_OV_ENUM_VAL (0U) - -/* Enumerated value OV: Over-voltage detected */ -#define MC33775_PRMM_VC_OV_FLT_STAT_VC3_OV_ENUM_VAL (1U) - -/* Field VC4: Over-voltage status VC4 */ -#define MC33775_PRMM_VC_OV_FLT_STAT_VC4_POS (4U) -#define MC33775_PRMM_VC_OV_FLT_STAT_VC4_MSK (0x10U) - -/* Enumerated value NO_OV: No over-voltage detected */ -#define MC33775_PRMM_VC_OV_FLT_STAT_VC4_NO_OV_ENUM_VAL (0U) - -/* Enumerated value OV: Over-voltage detected */ -#define MC33775_PRMM_VC_OV_FLT_STAT_VC4_OV_ENUM_VAL (1U) - -/* Field VC5: Over-voltage status VC5 */ -#define MC33775_PRMM_VC_OV_FLT_STAT_VC5_POS (5U) -#define MC33775_PRMM_VC_OV_FLT_STAT_VC5_MSK (0x20U) - -/* Enumerated value NO_OV: No over-voltage detected */ -#define MC33775_PRMM_VC_OV_FLT_STAT_VC5_NO_OV_ENUM_VAL (0U) - -/* Enumerated value OV: Over-voltage detected */ -#define MC33775_PRMM_VC_OV_FLT_STAT_VC5_OV_ENUM_VAL (1U) - -/* Field VC6: Over-voltage status VC6 */ -#define MC33775_PRMM_VC_OV_FLT_STAT_VC6_POS (6U) -#define MC33775_PRMM_VC_OV_FLT_STAT_VC6_MSK (0x40U) - -/* Enumerated value NO_OV: No over-voltage detected */ -#define MC33775_PRMM_VC_OV_FLT_STAT_VC6_NO_OV_ENUM_VAL (0U) - -/* Enumerated value OV: Over-voltage detected */ -#define MC33775_PRMM_VC_OV_FLT_STAT_VC6_OV_ENUM_VAL (1U) - -/* Field VC7: Over-voltage status VC7 */ -#define MC33775_PRMM_VC_OV_FLT_STAT_VC7_POS (7U) -#define MC33775_PRMM_VC_OV_FLT_STAT_VC7_MSK (0x80U) - -/* Enumerated value NO_OV: No over-voltage detected */ -#define MC33775_PRMM_VC_OV_FLT_STAT_VC7_NO_OV_ENUM_VAL (0U) - -/* Enumerated value OV: Over-voltage detected */ -#define MC33775_PRMM_VC_OV_FLT_STAT_VC7_OV_ENUM_VAL (1U) - -/* Field VC8: Over-voltage status VC8 */ -#define MC33775_PRMM_VC_OV_FLT_STAT_VC8_POS (8U) -#define MC33775_PRMM_VC_OV_FLT_STAT_VC8_MSK (0x100U) - -/* Enumerated value NO_OV: No over-voltage detected */ -#define MC33775_PRMM_VC_OV_FLT_STAT_VC8_NO_OV_ENUM_VAL (0U) - -/* Enumerated value OV: Over-voltage detected */ -#define MC33775_PRMM_VC_OV_FLT_STAT_VC8_OV_ENUM_VAL (1U) - -/* Field VC9: Over-voltage status VC9 */ -#define MC33775_PRMM_VC_OV_FLT_STAT_VC9_POS (9U) -#define MC33775_PRMM_VC_OV_FLT_STAT_VC9_MSK (0x200U) - -/* Enumerated value NO_OV: No over-voltage detected */ -#define MC33775_PRMM_VC_OV_FLT_STAT_VC9_NO_OV_ENUM_VAL (0U) - -/* Enumerated value OV: Over-voltage detected */ -#define MC33775_PRMM_VC_OV_FLT_STAT_VC9_OV_ENUM_VAL (1U) - -/* Field VC10: Over-voltage status VC10 */ -#define MC33775_PRMM_VC_OV_FLT_STAT_VC10_POS (10U) -#define MC33775_PRMM_VC_OV_FLT_STAT_VC10_MSK (0x400U) - -/* Enumerated value NO_OV: No over-voltage detected */ -#define MC33775_PRMM_VC_OV_FLT_STAT_VC10_NO_OV_ENUM_VAL (0U) - -/* Enumerated value OV: Over-voltage detected */ -#define MC33775_PRMM_VC_OV_FLT_STAT_VC10_OV_ENUM_VAL (1U) - -/* Field VC11: Over-voltage status VC11 */ -#define MC33775_PRMM_VC_OV_FLT_STAT_VC11_POS (11U) -#define MC33775_PRMM_VC_OV_FLT_STAT_VC11_MSK (0x800U) - -/* Enumerated value NO_OV: No over-voltage detected */ -#define MC33775_PRMM_VC_OV_FLT_STAT_VC11_NO_OV_ENUM_VAL (0U) - -/* Enumerated value OV: Over-voltage detected */ -#define MC33775_PRMM_VC_OV_FLT_STAT_VC11_OV_ENUM_VAL (1U) - -/* Field VC12: Over-voltage status VC12 */ -#define MC33775_PRMM_VC_OV_FLT_STAT_VC12_POS (12U) -#define MC33775_PRMM_VC_OV_FLT_STAT_VC12_MSK (0x1000U) - -/* Enumerated value NO_OV: No over-voltage detected */ -#define MC33775_PRMM_VC_OV_FLT_STAT_VC12_NO_OV_ENUM_VAL (0U) - -/* Enumerated value OV: Over-voltage detected */ -#define MC33775_PRMM_VC_OV_FLT_STAT_VC12_OV_ENUM_VAL (1U) - -/* Field VC13: Over-voltage status VC13 */ -#define MC33775_PRMM_VC_OV_FLT_STAT_VC13_POS (13U) -#define MC33775_PRMM_VC_OV_FLT_STAT_VC13_MSK (0x2000U) - -/* Enumerated value NO_OV: No over-voltage detected */ -#define MC33775_PRMM_VC_OV_FLT_STAT_VC13_NO_OV_ENUM_VAL (0U) - -/* Enumerated value OV: Over-voltage detected */ -#define MC33775_PRMM_VC_OV_FLT_STAT_VC13_OV_ENUM_VAL (1U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_PRMM_VC_OV_FLT_STAT_RESERVED0_POS (14U) -#define MC33775_PRMM_VC_OV_FLT_STAT_RESERVED0_MSK (0xC000U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VC0 : 1; - volatile uint16_t VC1 : 1; - volatile uint16_t VC2 : 1; - volatile uint16_t VC3 : 1; - volatile uint16_t VC4 : 1; - volatile uint16_t VC5 : 1; - volatile uint16_t VC6 : 1; - volatile uint16_t VC7 : 1; - volatile uint16_t VC8 : 1; - volatile uint16_t VC9 : 1; - volatile uint16_t VC10 : 1; - volatile uint16_t VC11 : 1; - volatile uint16_t VC12 : 1; - volatile uint16_t VC13 : 1; - volatile uint16_t reserved0 : 2; - } B; -} mc33775_primary_measurement_registers_prmm_vc_ov_flt_stat_t; - -/* -------------------------------------------------------------------------- - * PRMM_VC_UV0_FLT_STAT (read-only):Cell voltage under-value faults with respect to limit 0. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_VC_UV0_FLT_STAT_OFFSET (0x1821U) -#define MC33775_PRMM_VC_UV0_FLT_STAT_RW_MSK (0x0U) -#define MC33775_PRMM_VC_UV0_FLT_STAT_RD_MSK (0x3FFFU) -#define MC33775_PRMM_VC_UV0_FLT_STAT_WR_MSK (0x0U) -#define MC33775_PRMM_VC_UV0_FLT_STAT_MW_MSK (0x0U) -#define MC33775_PRMM_VC_UV0_FLT_STAT_RA_MSK (0x3FFFU) -#define MC33775_PRMM_VC_UV0_FLT_STAT_POR_MSK (0xffffU) -#define MC33775_PRMM_VC_UV0_FLT_STAT_POR_VAL (0x0U) - -/* Field VC0: Under-voltage status VC0 */ -#define MC33775_PRMM_VC_UV0_FLT_STAT_VC0_POS (0U) -#define MC33775_PRMM_VC_UV0_FLT_STAT_VC0_MSK (0x1U) - -/* Enumerated value NO_UV: No under-voltage detected */ -#define MC33775_PRMM_VC_UV0_FLT_STAT_VC0_NO_UV_ENUM_VAL (0U) - -/* Enumerated value UV: Under-voltage detected */ -#define MC33775_PRMM_VC_UV0_FLT_STAT_VC0_UV_ENUM_VAL (1U) - -/* Field VC1: Under-voltage status VC1 */ -#define MC33775_PRMM_VC_UV0_FLT_STAT_VC1_POS (1U) -#define MC33775_PRMM_VC_UV0_FLT_STAT_VC1_MSK (0x2U) - -/* Enumerated value NO_UV: No under-voltage detected */ -#define MC33775_PRMM_VC_UV0_FLT_STAT_VC1_NO_UV_ENUM_VAL (0U) - -/* Enumerated value UV: Under-voltage detected */ -#define MC33775_PRMM_VC_UV0_FLT_STAT_VC1_UV_ENUM_VAL (1U) - -/* Field VC2: Under-voltage status VC2 */ -#define MC33775_PRMM_VC_UV0_FLT_STAT_VC2_POS (2U) -#define MC33775_PRMM_VC_UV0_FLT_STAT_VC2_MSK (0x4U) - -/* Enumerated value NO_UV: No under-voltage detected */ -#define MC33775_PRMM_VC_UV0_FLT_STAT_VC2_NO_UV_ENUM_VAL (0U) - -/* Enumerated value UV: Under-voltage detected */ -#define MC33775_PRMM_VC_UV0_FLT_STAT_VC2_UV_ENUM_VAL (1U) - -/* Field VC3: Under-voltage status VC3 */ -#define MC33775_PRMM_VC_UV0_FLT_STAT_VC3_POS (3U) -#define MC33775_PRMM_VC_UV0_FLT_STAT_VC3_MSK (0x8U) - -/* Enumerated value NO_UV: No under-voltage detected */ -#define MC33775_PRMM_VC_UV0_FLT_STAT_VC3_NO_UV_ENUM_VAL (0U) - -/* Enumerated value UV: Under-voltage detected */ -#define MC33775_PRMM_VC_UV0_FLT_STAT_VC3_UV_ENUM_VAL (1U) - -/* Field VC4: Under-voltage status VC4 */ -#define MC33775_PRMM_VC_UV0_FLT_STAT_VC4_POS (4U) -#define MC33775_PRMM_VC_UV0_FLT_STAT_VC4_MSK (0x10U) - -/* Enumerated value NO_UV: No under-voltage detected */ -#define MC33775_PRMM_VC_UV0_FLT_STAT_VC4_NO_UV_ENUM_VAL (0U) - -/* Enumerated value UV: Under-voltage detected */ -#define MC33775_PRMM_VC_UV0_FLT_STAT_VC4_UV_ENUM_VAL (1U) - -/* Field VC5: Under-voltage status VC5 */ -#define MC33775_PRMM_VC_UV0_FLT_STAT_VC5_POS (5U) -#define MC33775_PRMM_VC_UV0_FLT_STAT_VC5_MSK (0x20U) - -/* Enumerated value NO_UV: No under-voltage detected */ -#define MC33775_PRMM_VC_UV0_FLT_STAT_VC5_NO_UV_ENUM_VAL (0U) - -/* Enumerated value UV: Under-voltage detected */ -#define MC33775_PRMM_VC_UV0_FLT_STAT_VC5_UV_ENUM_VAL (1U) - -/* Field VC6: Under-voltage status VC6 */ -#define MC33775_PRMM_VC_UV0_FLT_STAT_VC6_POS (6U) -#define MC33775_PRMM_VC_UV0_FLT_STAT_VC6_MSK (0x40U) - -/* Enumerated value NO_UV: No under-voltage detected */ -#define MC33775_PRMM_VC_UV0_FLT_STAT_VC6_NO_UV_ENUM_VAL (0U) - -/* Enumerated value UV: Under-voltage detected */ -#define MC33775_PRMM_VC_UV0_FLT_STAT_VC6_UV_ENUM_VAL (1U) - -/* Field VC7: Under-voltage status VC7 */ -#define MC33775_PRMM_VC_UV0_FLT_STAT_VC7_POS (7U) -#define MC33775_PRMM_VC_UV0_FLT_STAT_VC7_MSK (0x80U) - -/* Enumerated value NO_UV: No under-voltage detected */ -#define MC33775_PRMM_VC_UV0_FLT_STAT_VC7_NO_UV_ENUM_VAL (0U) - -/* Enumerated value UV: Under-voltage detected */ -#define MC33775_PRMM_VC_UV0_FLT_STAT_VC7_UV_ENUM_VAL (1U) - -/* Field VC8: Under-voltage status VC8 */ -#define MC33775_PRMM_VC_UV0_FLT_STAT_VC8_POS (8U) -#define MC33775_PRMM_VC_UV0_FLT_STAT_VC8_MSK (0x100U) - -/* Enumerated value NO_UV: No under-voltage detected */ -#define MC33775_PRMM_VC_UV0_FLT_STAT_VC8_NO_UV_ENUM_VAL (0U) - -/* Enumerated value UV: Under-voltage detected */ -#define MC33775_PRMM_VC_UV0_FLT_STAT_VC8_UV_ENUM_VAL (1U) - -/* Field VC9: Under-voltage status VC9 */ -#define MC33775_PRMM_VC_UV0_FLT_STAT_VC9_POS (9U) -#define MC33775_PRMM_VC_UV0_FLT_STAT_VC9_MSK (0x200U) - -/* Enumerated value NO_UV: No under-voltage detected */ -#define MC33775_PRMM_VC_UV0_FLT_STAT_VC9_NO_UV_ENUM_VAL (0U) - -/* Enumerated value UV: Under-voltage detected */ -#define MC33775_PRMM_VC_UV0_FLT_STAT_VC9_UV_ENUM_VAL (1U) - -/* Field VC10: Under-voltage status VC10 */ -#define MC33775_PRMM_VC_UV0_FLT_STAT_VC10_POS (10U) -#define MC33775_PRMM_VC_UV0_FLT_STAT_VC10_MSK (0x400U) - -/* Enumerated value NO_UV: No under-voltage detected */ -#define MC33775_PRMM_VC_UV0_FLT_STAT_VC10_NO_UV_ENUM_VAL (0U) - -/* Enumerated value UV: Under-voltage detected */ -#define MC33775_PRMM_VC_UV0_FLT_STAT_VC10_UV_ENUM_VAL (1U) - -/* Field VC11: Under-voltage status VC11 */ -#define MC33775_PRMM_VC_UV0_FLT_STAT_VC11_POS (11U) -#define MC33775_PRMM_VC_UV0_FLT_STAT_VC11_MSK (0x800U) - -/* Enumerated value NO_UV: No under-voltage detected */ -#define MC33775_PRMM_VC_UV0_FLT_STAT_VC11_NO_UV_ENUM_VAL (0U) - -/* Enumerated value UV: Under-voltage detected */ -#define MC33775_PRMM_VC_UV0_FLT_STAT_VC11_UV_ENUM_VAL (1U) - -/* Field VC12: Under-voltage status VC12 */ -#define MC33775_PRMM_VC_UV0_FLT_STAT_VC12_POS (12U) -#define MC33775_PRMM_VC_UV0_FLT_STAT_VC12_MSK (0x1000U) - -/* Enumerated value NO_UV: No under-voltage detected */ -#define MC33775_PRMM_VC_UV0_FLT_STAT_VC12_NO_UV_ENUM_VAL (0U) - -/* Enumerated value UV: Under-voltage detected */ -#define MC33775_PRMM_VC_UV0_FLT_STAT_VC12_UV_ENUM_VAL (1U) - -/* Field VC13: Under-voltage status VC13 */ -#define MC33775_PRMM_VC_UV0_FLT_STAT_VC13_POS (13U) -#define MC33775_PRMM_VC_UV0_FLT_STAT_VC13_MSK (0x2000U) - -/* Enumerated value NO_UV: No under-voltage detected */ -#define MC33775_PRMM_VC_UV0_FLT_STAT_VC13_NO_UV_ENUM_VAL (0U) - -/* Enumerated value UV: Under-voltage detected */ -#define MC33775_PRMM_VC_UV0_FLT_STAT_VC13_UV_ENUM_VAL (1U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_PRMM_VC_UV0_FLT_STAT_RESERVED0_POS (14U) -#define MC33775_PRMM_VC_UV0_FLT_STAT_RESERVED0_MSK (0xC000U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VC0 : 1; - volatile uint16_t VC1 : 1; - volatile uint16_t VC2 : 1; - volatile uint16_t VC3 : 1; - volatile uint16_t VC4 : 1; - volatile uint16_t VC5 : 1; - volatile uint16_t VC6 : 1; - volatile uint16_t VC7 : 1; - volatile uint16_t VC8 : 1; - volatile uint16_t VC9 : 1; - volatile uint16_t VC10 : 1; - volatile uint16_t VC11 : 1; - volatile uint16_t VC12 : 1; - volatile uint16_t VC13 : 1; - volatile uint16_t reserved0 : 2; - } B; -} mc33775_primary_measurement_registers_prmm_vc_uv0_flt_stat_t; - -/* -------------------------------------------------------------------------- - * PRMM_VC_UV1_FLT_STAT (read-only):Cell voltage under-value faults with respect to limit 1. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_VC_UV1_FLT_STAT_OFFSET (0x1822U) -#define MC33775_PRMM_VC_UV1_FLT_STAT_RW_MSK (0x0U) -#define MC33775_PRMM_VC_UV1_FLT_STAT_RD_MSK (0x3FFFU) -#define MC33775_PRMM_VC_UV1_FLT_STAT_WR_MSK (0x0U) -#define MC33775_PRMM_VC_UV1_FLT_STAT_MW_MSK (0x0U) -#define MC33775_PRMM_VC_UV1_FLT_STAT_RA_MSK (0x3FFFU) -#define MC33775_PRMM_VC_UV1_FLT_STAT_POR_MSK (0xffffU) -#define MC33775_PRMM_VC_UV1_FLT_STAT_POR_VAL (0x0U) - -/* Field VC0: Under-voltage status VC0 */ -#define MC33775_PRMM_VC_UV1_FLT_STAT_VC0_POS (0U) -#define MC33775_PRMM_VC_UV1_FLT_STAT_VC0_MSK (0x1U) - -/* Enumerated value NO_UV: No under-voltage detected */ -#define MC33775_PRMM_VC_UV1_FLT_STAT_VC0_NO_UV_ENUM_VAL (0U) - -/* Enumerated value UV: Under-voltage detected */ -#define MC33775_PRMM_VC_UV1_FLT_STAT_VC0_UV_ENUM_VAL (1U) - -/* Field VC1: Under-voltage status VC1 */ -#define MC33775_PRMM_VC_UV1_FLT_STAT_VC1_POS (1U) -#define MC33775_PRMM_VC_UV1_FLT_STAT_VC1_MSK (0x2U) - -/* Enumerated value NO_UV: No under-voltage detected */ -#define MC33775_PRMM_VC_UV1_FLT_STAT_VC1_NO_UV_ENUM_VAL (0U) - -/* Enumerated value UV: Under-voltage detected */ -#define MC33775_PRMM_VC_UV1_FLT_STAT_VC1_UV_ENUM_VAL (1U) - -/* Field VC2: Under-voltage status VC2 */ -#define MC33775_PRMM_VC_UV1_FLT_STAT_VC2_POS (2U) -#define MC33775_PRMM_VC_UV1_FLT_STAT_VC2_MSK (0x4U) - -/* Enumerated value NO_UV: No under-voltage detected */ -#define MC33775_PRMM_VC_UV1_FLT_STAT_VC2_NO_UV_ENUM_VAL (0U) - -/* Enumerated value UV: Under-voltage detected */ -#define MC33775_PRMM_VC_UV1_FLT_STAT_VC2_UV_ENUM_VAL (1U) - -/* Field VC3: Under-voltage status VC3 */ -#define MC33775_PRMM_VC_UV1_FLT_STAT_VC3_POS (3U) -#define MC33775_PRMM_VC_UV1_FLT_STAT_VC3_MSK (0x8U) - -/* Enumerated value NO_UV: No under-voltage detected */ -#define MC33775_PRMM_VC_UV1_FLT_STAT_VC3_NO_UV_ENUM_VAL (0U) - -/* Enumerated value UV: Under-voltage detected */ -#define MC33775_PRMM_VC_UV1_FLT_STAT_VC3_UV_ENUM_VAL (1U) - -/* Field VC4: Under-voltage status VC4 */ -#define MC33775_PRMM_VC_UV1_FLT_STAT_VC4_POS (4U) -#define MC33775_PRMM_VC_UV1_FLT_STAT_VC4_MSK (0x10U) - -/* Enumerated value NO_UV: No under-voltage detected */ -#define MC33775_PRMM_VC_UV1_FLT_STAT_VC4_NO_UV_ENUM_VAL (0U) - -/* Enumerated value UV: Under-voltage detected */ -#define MC33775_PRMM_VC_UV1_FLT_STAT_VC4_UV_ENUM_VAL (1U) - -/* Field VC5: Under-voltage status VC5 */ -#define MC33775_PRMM_VC_UV1_FLT_STAT_VC5_POS (5U) -#define MC33775_PRMM_VC_UV1_FLT_STAT_VC5_MSK (0x20U) - -/* Enumerated value NO_UV: No under-voltage detected */ -#define MC33775_PRMM_VC_UV1_FLT_STAT_VC5_NO_UV_ENUM_VAL (0U) - -/* Enumerated value UV: Under-voltage detected */ -#define MC33775_PRMM_VC_UV1_FLT_STAT_VC5_UV_ENUM_VAL (1U) - -/* Field VC6: Under-voltage status VC6 */ -#define MC33775_PRMM_VC_UV1_FLT_STAT_VC6_POS (6U) -#define MC33775_PRMM_VC_UV1_FLT_STAT_VC6_MSK (0x40U) - -/* Enumerated value NO_UV: No under-voltage detected */ -#define MC33775_PRMM_VC_UV1_FLT_STAT_VC6_NO_UV_ENUM_VAL (0U) - -/* Enumerated value UV: Under-voltage detected */ -#define MC33775_PRMM_VC_UV1_FLT_STAT_VC6_UV_ENUM_VAL (1U) - -/* Field VC7: Under-voltage status VC7 */ -#define MC33775_PRMM_VC_UV1_FLT_STAT_VC7_POS (7U) -#define MC33775_PRMM_VC_UV1_FLT_STAT_VC7_MSK (0x80U) - -/* Enumerated value NO_UV: No under-voltage detected */ -#define MC33775_PRMM_VC_UV1_FLT_STAT_VC7_NO_UV_ENUM_VAL (0U) - -/* Enumerated value UV: Under-voltage detected */ -#define MC33775_PRMM_VC_UV1_FLT_STAT_VC7_UV_ENUM_VAL (1U) - -/* Field VC8: Under-voltage status VC8 */ -#define MC33775_PRMM_VC_UV1_FLT_STAT_VC8_POS (8U) -#define MC33775_PRMM_VC_UV1_FLT_STAT_VC8_MSK (0x100U) - -/* Enumerated value NO_UV: No under-voltage detected */ -#define MC33775_PRMM_VC_UV1_FLT_STAT_VC8_NO_UV_ENUM_VAL (0U) - -/* Enumerated value UV: Under-voltage detected */ -#define MC33775_PRMM_VC_UV1_FLT_STAT_VC8_UV_ENUM_VAL (1U) - -/* Field VC9: Under-voltage status VC9 */ -#define MC33775_PRMM_VC_UV1_FLT_STAT_VC9_POS (9U) -#define MC33775_PRMM_VC_UV1_FLT_STAT_VC9_MSK (0x200U) - -/* Enumerated value NO_UV: No under-voltage detected */ -#define MC33775_PRMM_VC_UV1_FLT_STAT_VC9_NO_UV_ENUM_VAL (0U) - -/* Enumerated value UV: Under-voltage detected */ -#define MC33775_PRMM_VC_UV1_FLT_STAT_VC9_UV_ENUM_VAL (1U) - -/* Field VC10: Under-voltage status VC10 */ -#define MC33775_PRMM_VC_UV1_FLT_STAT_VC10_POS (10U) -#define MC33775_PRMM_VC_UV1_FLT_STAT_VC10_MSK (0x400U) - -/* Enumerated value NO_UV: No under-voltage detected */ -#define MC33775_PRMM_VC_UV1_FLT_STAT_VC10_NO_UV_ENUM_VAL (0U) - -/* Enumerated value UV: Under-voltage detected */ -#define MC33775_PRMM_VC_UV1_FLT_STAT_VC10_UV_ENUM_VAL (1U) - -/* Field VC11: Under-voltage status VC11 */ -#define MC33775_PRMM_VC_UV1_FLT_STAT_VC11_POS (11U) -#define MC33775_PRMM_VC_UV1_FLT_STAT_VC11_MSK (0x800U) - -/* Enumerated value NO_UV: No under-voltage detected */ -#define MC33775_PRMM_VC_UV1_FLT_STAT_VC11_NO_UV_ENUM_VAL (0U) - -/* Enumerated value UV: Under-voltage detected */ -#define MC33775_PRMM_VC_UV1_FLT_STAT_VC11_UV_ENUM_VAL (1U) - -/* Field VC12: Under-voltage status VC12 */ -#define MC33775_PRMM_VC_UV1_FLT_STAT_VC12_POS (12U) -#define MC33775_PRMM_VC_UV1_FLT_STAT_VC12_MSK (0x1000U) - -/* Enumerated value NO_UV: No under-voltage detected */ -#define MC33775_PRMM_VC_UV1_FLT_STAT_VC12_NO_UV_ENUM_VAL (0U) - -/* Enumerated value UV: Under-voltage detected */ -#define MC33775_PRMM_VC_UV1_FLT_STAT_VC12_UV_ENUM_VAL (1U) - -/* Field VC13: Under-voltage status VC13 */ -#define MC33775_PRMM_VC_UV1_FLT_STAT_VC13_POS (13U) -#define MC33775_PRMM_VC_UV1_FLT_STAT_VC13_MSK (0x2000U) - -/* Enumerated value NO_UV: No under-voltage detected */ -#define MC33775_PRMM_VC_UV1_FLT_STAT_VC13_NO_UV_ENUM_VAL (0U) - -/* Enumerated value UV: Under-voltage detected */ -#define MC33775_PRMM_VC_UV1_FLT_STAT_VC13_UV_ENUM_VAL (1U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_PRMM_VC_UV1_FLT_STAT_RESERVED0_POS (14U) -#define MC33775_PRMM_VC_UV1_FLT_STAT_RESERVED0_MSK (0xC000U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VC0 : 1; - volatile uint16_t VC1 : 1; - volatile uint16_t VC2 : 1; - volatile uint16_t VC3 : 1; - volatile uint16_t VC4 : 1; - volatile uint16_t VC5 : 1; - volatile uint16_t VC6 : 1; - volatile uint16_t VC7 : 1; - volatile uint16_t VC8 : 1; - volatile uint16_t VC9 : 1; - volatile uint16_t VC10 : 1; - volatile uint16_t VC11 : 1; - volatile uint16_t VC12 : 1; - volatile uint16_t VC13 : 1; - volatile uint16_t reserved0 : 2; - } B; -} mc33775_primary_measurement_registers_prmm_vc_uv1_flt_stat_t; - -/* -------------------------------------------------------------------------- - * PRMM_AIN_OV_FLT_STAT (read-only):AINx over-value faults. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_AIN_OV_FLT_STAT_OFFSET (0x1823U) -#define MC33775_PRMM_AIN_OV_FLT_STAT_RW_MSK (0x0U) -#define MC33775_PRMM_AIN_OV_FLT_STAT_RD_MSK (0xFU) -#define MC33775_PRMM_AIN_OV_FLT_STAT_WR_MSK (0x0U) -#define MC33775_PRMM_AIN_OV_FLT_STAT_MW_MSK (0x0U) -#define MC33775_PRMM_AIN_OV_FLT_STAT_RA_MSK (0xFU) -#define MC33775_PRMM_AIN_OV_FLT_STAT_POR_MSK (0xffffU) -#define MC33775_PRMM_AIN_OV_FLT_STAT_POR_VAL (0x0U) - -/* Field AIN0: Over-voltage status AIN0 */ -#define MC33775_PRMM_AIN_OV_FLT_STAT_AIN0_POS (0U) -#define MC33775_PRMM_AIN_OV_FLT_STAT_AIN0_MSK (0x1U) - -/* Enumerated value NO_OV: No over-voltage detected */ -#define MC33775_PRMM_AIN_OV_FLT_STAT_AIN0_NO_OV_ENUM_VAL (0U) - -/* Enumerated value OV: Over-voltage detected */ -#define MC33775_PRMM_AIN_OV_FLT_STAT_AIN0_OV_ENUM_VAL (1U) - -/* Field AIN1: Over-voltage status AIN1 */ -#define MC33775_PRMM_AIN_OV_FLT_STAT_AIN1_POS (1U) -#define MC33775_PRMM_AIN_OV_FLT_STAT_AIN1_MSK (0x2U) - -/* Enumerated value NO_OV: No over-voltage detected */ -#define MC33775_PRMM_AIN_OV_FLT_STAT_AIN1_NO_OV_ENUM_VAL (0U) - -/* Enumerated value OV: Over-voltage detected */ -#define MC33775_PRMM_AIN_OV_FLT_STAT_AIN1_OV_ENUM_VAL (1U) - -/* Field AIN2: Over-voltage status AIN2 */ -#define MC33775_PRMM_AIN_OV_FLT_STAT_AIN2_POS (2U) -#define MC33775_PRMM_AIN_OV_FLT_STAT_AIN2_MSK (0x4U) - -/* Enumerated value NO_OV: No over-voltage detected */ -#define MC33775_PRMM_AIN_OV_FLT_STAT_AIN2_NO_OV_ENUM_VAL (0U) - -/* Enumerated value OV: Over-voltage detected */ -#define MC33775_PRMM_AIN_OV_FLT_STAT_AIN2_OV_ENUM_VAL (1U) - -/* Field AIN3: Over-voltage status AIN3 */ -#define MC33775_PRMM_AIN_OV_FLT_STAT_AIN3_POS (3U) -#define MC33775_PRMM_AIN_OV_FLT_STAT_AIN3_MSK (0x8U) - -/* Enumerated value NO_OV: No over-voltage detected */ -#define MC33775_PRMM_AIN_OV_FLT_STAT_AIN3_NO_OV_ENUM_VAL (0U) - -/* Enumerated value OV: Over-voltage detected */ -#define MC33775_PRMM_AIN_OV_FLT_STAT_AIN3_OV_ENUM_VAL (1U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_PRMM_AIN_OV_FLT_STAT_RESERVED0_POS (4U) -#define MC33775_PRMM_AIN_OV_FLT_STAT_RESERVED0_MSK (0xFFF0U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t AIN0 : 1; - volatile uint16_t AIN1 : 1; - volatile uint16_t AIN2 : 1; - volatile uint16_t AIN3 : 1; - volatile uint16_t reserved0 : 12; - } B; -} mc33775_primary_measurement_registers_prmm_ain_ov_flt_stat_t; - -/* -------------------------------------------------------------------------- - * PRMM_AIN_UV_FLT_STAT (read-only):AINx under-value faults. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_AIN_UV_FLT_STAT_OFFSET (0x1824U) -#define MC33775_PRMM_AIN_UV_FLT_STAT_RW_MSK (0x0U) -#define MC33775_PRMM_AIN_UV_FLT_STAT_RD_MSK (0xFU) -#define MC33775_PRMM_AIN_UV_FLT_STAT_WR_MSK (0x0U) -#define MC33775_PRMM_AIN_UV_FLT_STAT_MW_MSK (0x0U) -#define MC33775_PRMM_AIN_UV_FLT_STAT_RA_MSK (0xFU) -#define MC33775_PRMM_AIN_UV_FLT_STAT_POR_MSK (0xffffU) -#define MC33775_PRMM_AIN_UV_FLT_STAT_POR_VAL (0x0U) - -/* Field AIN0: Under-voltage status AIN0 */ -#define MC33775_PRMM_AIN_UV_FLT_STAT_AIN0_POS (0U) -#define MC33775_PRMM_AIN_UV_FLT_STAT_AIN0_MSK (0x1U) - -/* Enumerated value NO_UV: No under-voltage detected */ -#define MC33775_PRMM_AIN_UV_FLT_STAT_AIN0_NO_UV_ENUM_VAL (0U) - -/* Enumerated value UV: Under-voltage detected */ -#define MC33775_PRMM_AIN_UV_FLT_STAT_AIN0_UV_ENUM_VAL (1U) - -/* Field AIN1: Under-voltage status AIN1 */ -#define MC33775_PRMM_AIN_UV_FLT_STAT_AIN1_POS (1U) -#define MC33775_PRMM_AIN_UV_FLT_STAT_AIN1_MSK (0x2U) - -/* Enumerated value NO_UV: No under-voltage detected */ -#define MC33775_PRMM_AIN_UV_FLT_STAT_AIN1_NO_UV_ENUM_VAL (0U) - -/* Enumerated value UV: Under-voltage detected */ -#define MC33775_PRMM_AIN_UV_FLT_STAT_AIN1_UV_ENUM_VAL (1U) - -/* Field AIN2: Under-voltage status AIN2 */ -#define MC33775_PRMM_AIN_UV_FLT_STAT_AIN2_POS (2U) -#define MC33775_PRMM_AIN_UV_FLT_STAT_AIN2_MSK (0x4U) - -/* Enumerated value NO_UV: No under-voltage detected */ -#define MC33775_PRMM_AIN_UV_FLT_STAT_AIN2_NO_UV_ENUM_VAL (0U) - -/* Enumerated value UV: Under-voltage detected */ -#define MC33775_PRMM_AIN_UV_FLT_STAT_AIN2_UV_ENUM_VAL (1U) - -/* Field AIN3: Under-voltage status AIN3 */ -#define MC33775_PRMM_AIN_UV_FLT_STAT_AIN3_POS (3U) -#define MC33775_PRMM_AIN_UV_FLT_STAT_AIN3_MSK (0x8U) - -/* Enumerated value NO_UV: No under-voltage detected */ -#define MC33775_PRMM_AIN_UV_FLT_STAT_AIN3_NO_UV_ENUM_VAL (0U) - -/* Enumerated value UV: Under-voltage detected */ -#define MC33775_PRMM_AIN_UV_FLT_STAT_AIN3_UV_ENUM_VAL (1U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_PRMM_AIN_UV_FLT_STAT_RESERVED0_POS (4U) -#define MC33775_PRMM_AIN_UV_FLT_STAT_RESERVED0_MSK (0xFFF0U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t AIN0 : 1; - volatile uint16_t AIN1 : 1; - volatile uint16_t AIN2 : 1; - volatile uint16_t AIN3 : 1; - volatile uint16_t reserved0 : 12; - } B; -} mc33775_primary_measurement_registers_prmm_ain_uv_flt_stat_t; - -/* -------------------------------------------------------------------------- - * PRMM_MEAS_STAT (read-only):Measurement status. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_MEAS_STAT_OFFSET (0x183EU) -#define MC33775_PRMM_MEAS_STAT_RW_MSK (0x0U) -#define MC33775_PRMM_MEAS_STAT_RD_MSK (0xF33FU) -#define MC33775_PRMM_MEAS_STAT_WR_MSK (0x0U) -#define MC33775_PRMM_MEAS_STAT_MW_MSK (0x0U) -#define MC33775_PRMM_MEAS_STAT_RA_MSK (0x0U) -#define MC33775_PRMM_MEAS_STAT_POR_MSK (0xffffU) -#define MC33775_PRMM_MEAS_STAT_POR_VAL (0x0U) - -/* Field APPRDYVC: A new VC application result can be requested / captured. */ -#define MC33775_PRMM_MEAS_STAT_APPRDYVC_POS (0U) -#define MC33775_PRMM_MEAS_STAT_APPRDYVC_MSK (0x1U) - -/* Enumerated value NO_DATA: No data available (<16 sample) */ -#define MC33775_PRMM_MEAS_STAT_APPRDYVC_NO_DATA_ENUM_VAL (0U) - -/* Enumerated value DATA: Data can be captured (>=16 samples are captured). */ -#define MC33775_PRMM_MEAS_STAT_APPRDYVC_DATA_ENUM_VAL (1U) - -/* Field APPRDYVMODULE: A new VMODULE application result can be requested / captured. */ -#define MC33775_PRMM_MEAS_STAT_APPRDYVMODULE_POS (1U) -#define MC33775_PRMM_MEAS_STAT_APPRDYVMODULE_MSK (0x2U) - -/* Enumerated value NO_DATA: No data available (<16 sample) */ -#define MC33775_PRMM_MEAS_STAT_APPRDYVMODULE_NO_DATA_ENUM_VAL (0U) - -/* Enumerated value DATA: Data can be captured (>=16 samples are captured). */ -#define MC33775_PRMM_MEAS_STAT_APPRDYVMODULE_DATA_ENUM_VAL (1U) - -/* Field APPRDYAIN0: A new AIN0 application result can be requested / captured. */ -#define MC33775_PRMM_MEAS_STAT_APPRDYAIN0_POS (2U) -#define MC33775_PRMM_MEAS_STAT_APPRDYAIN0_MSK (0x4U) - -/* Enumerated value NO_DATA: No data available (<16 sample) */ -#define MC33775_PRMM_MEAS_STAT_APPRDYAIN0_NO_DATA_ENUM_VAL (0U) - -/* Enumerated value DATA: Data can be captured (>=16 samples are captured). */ -#define MC33775_PRMM_MEAS_STAT_APPRDYAIN0_DATA_ENUM_VAL (1U) - -/* Field APPRDYAIN1: A new AIN1 application result can be requested / captured. */ -#define MC33775_PRMM_MEAS_STAT_APPRDYAIN1_POS (3U) -#define MC33775_PRMM_MEAS_STAT_APPRDYAIN1_MSK (0x8U) - -/* Enumerated value NO_DATA: No data available (<16 sample) */ -#define MC33775_PRMM_MEAS_STAT_APPRDYAIN1_NO_DATA_ENUM_VAL (0U) - -/* Enumerated value DATA: Data can be captured (>=16 samples are captured). */ -#define MC33775_PRMM_MEAS_STAT_APPRDYAIN1_DATA_ENUM_VAL (1U) - -/* Field APPRDYAIN2: A new AIN2 application result can be requested / captured. */ -#define MC33775_PRMM_MEAS_STAT_APPRDYAIN2_POS (4U) -#define MC33775_PRMM_MEAS_STAT_APPRDYAIN2_MSK (0x10U) - -/* Enumerated value NO_DATA: No data available (<16 sample) */ -#define MC33775_PRMM_MEAS_STAT_APPRDYAIN2_NO_DATA_ENUM_VAL (0U) - -/* Enumerated value DATA: Data can be captured (>=16 samples are captured). */ -#define MC33775_PRMM_MEAS_STAT_APPRDYAIN2_DATA_ENUM_VAL (1U) - -/* Field APPRDYAIN3: A new AIN3 application result can be requested / captured. */ -#define MC33775_PRMM_MEAS_STAT_APPRDYAIN3_POS (5U) -#define MC33775_PRMM_MEAS_STAT_APPRDYAIN3_MSK (0x20U) - -/* Enumerated value NO_DATA: No data available (<16 sample) */ -#define MC33775_PRMM_MEAS_STAT_APPRDYAIN3_NO_DATA_ENUM_VAL (0U) - -/* Enumerated value DATA: Data can be captured (>=16 samples are captured). */ -#define MC33775_PRMM_MEAS_STAT_APPRDYAIN3_DATA_ENUM_VAL (1U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_PRMM_MEAS_STAT_RESERVED0_POS (6U) -#define MC33775_PRMM_MEAS_STAT_RESERVED0_MSK (0xC0U) - -/* Field PERRDY: New periodic result data has been created (depending on the periodic update mode, they might need to be requested) , the bit is cleared by a read into the periodic result range. */ -#define MC33775_PRMM_MEAS_STAT_PERRDY_POS (8U) -#define MC33775_PRMM_MEAS_STAT_PERRDY_MSK (0x100U) - -/* Enumerated value NO_DATA: No data available */ -#define MC33775_PRMM_MEAS_STAT_PERRDY_NO_DATA_ENUM_VAL (0U) - -/* Enumerated value DATA: Sample data available. */ -#define MC33775_PRMM_MEAS_STAT_PERRDY_DATA_ENUM_VAL (1U) - -/* Field SYNCRDY: Synchronous measurement data is ready for readout, the bit is cleared by a read into the safety result range. */ -#define MC33775_PRMM_MEAS_STAT_SYNCRDY_POS (9U) -#define MC33775_PRMM_MEAS_STAT_SYNCRDY_MSK (0x200U) - -/* Enumerated value NO_DATA: No data available */ -#define MC33775_PRMM_MEAS_STAT_SYNCRDY_NO_DATA_ENUM_VAL (0U) - -/* Enumerated value DATA: Sample data available. */ -#define MC33775_PRMM_MEAS_STAT_SYNCRDY_DATA_ENUM_VAL (1U) - -/* Field reserved1: This read-only field is reserved and always has the value 0. */ -#define MC33775_PRMM_MEAS_STAT_RESERVED1_POS (10U) -#define MC33775_PRMM_MEAS_STAT_RESERVED1_MSK (0xC00U) - -/* Field SUPPLYFLT: Internal/external supply fault status */ -#define MC33775_PRMM_MEAS_STAT_SUPPLYFLT_POS (12U) -#define MC33775_PRMM_MEAS_STAT_SUPPLYFLT_MSK (0x1000U) - -/* Enumerated value NO_FLT: No supply error detected */ -#define MC33775_PRMM_MEAS_STAT_SUPPLYFLT_NO_FLT_ENUM_VAL (0U) - -/* Enumerated value FAULT: Supply error detected */ -#define MC33775_PRMM_MEAS_STAT_SUPPLYFLT_FAULT_ENUM_VAL (1U) - -/* Field ANAFLT: Analog fault status */ -#define MC33775_PRMM_MEAS_STAT_ANAFLT_POS (13U) -#define MC33775_PRMM_MEAS_STAT_ANAFLT_MSK (0x2000U) - -/* Enumerated value NO_FLT: No analog fault detected */ -#define MC33775_PRMM_MEAS_STAT_ANAFLT_NO_FLT_ENUM_VAL (0U) - -/* Enumerated value FAULT: Analog fault detected */ -#define MC33775_PRMM_MEAS_STAT_ANAFLT_FAULT_ENUM_VAL (1U) - -/* Field COMFLT: Communication fault status */ -#define MC33775_PRMM_MEAS_STAT_COMFLT_POS (14U) -#define MC33775_PRMM_MEAS_STAT_COMFLT_MSK (0x4000U) - -/* Enumerated value NO_FLT: No communication fault detected */ -#define MC33775_PRMM_MEAS_STAT_COMFLT_NO_FLT_ENUM_VAL (0U) - -/* Enumerated value FAULT: Communication fault detected. */ -#define MC33775_PRMM_MEAS_STAT_COMFLT_FAULT_ENUM_VAL (1U) - -/* Field MEASFLT: Measurement fault status */ -#define MC33775_PRMM_MEAS_STAT_MEASFLT_POS (15U) -#define MC33775_PRMM_MEAS_STAT_MEASFLT_MSK (0x8000U) - -/* Enumerated value NO_FLT: No measurement fault detected */ -#define MC33775_PRMM_MEAS_STAT_MEASFLT_NO_FLT_ENUM_VAL (0U) - -/* Enumerated value FAULT: Measurement fault detected */ -#define MC33775_PRMM_MEAS_STAT_MEASFLT_FAULT_ENUM_VAL (1U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t APPRDYVC : 1; - volatile uint16_t APPRDYVMODULE : 1; - volatile uint16_t APPRDYAIN0 : 1; - volatile uint16_t APPRDYAIN1 : 1; - volatile uint16_t APPRDYAIN2 : 1; - volatile uint16_t APPRDYAIN3 : 1; - volatile uint16_t reserved0 : 2; - volatile uint16_t PERRDY : 1; - volatile uint16_t SYNCRDY : 1; - volatile uint16_t reserved1 : 2; - volatile uint16_t SUPPLYFLT : 1; - volatile uint16_t ANAFLT : 1; - volatile uint16_t COMFLT : 1; - volatile uint16_t MEASFLT : 1; - } B; -} mc33775_primary_measurement_registers_prmm_meas_stat_t; - -/* -------------------------------------------------------------------------- - * PRMM_APP_VC_CNT (read-only):Application measurement VC sample count number. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_APP_VC_CNT_OFFSET (0x183FU) -#define MC33775_PRMM_APP_VC_CNT_RW_MSK (0x0U) -#define MC33775_PRMM_APP_VC_CNT_RD_MSK (0xFFFFU) -#define MC33775_PRMM_APP_VC_CNT_WR_MSK (0x0U) -#define MC33775_PRMM_APP_VC_CNT_MW_MSK (0x0U) -#define MC33775_PRMM_APP_VC_CNT_RA_MSK (0xFFFFU) -#define MC33775_PRMM_APP_VC_CNT_POR_MSK (0xffffU) -#define MC33775_PRMM_APP_VC_CNT_POR_VAL (0x0U) - -/* Field NUM: Number of samples used for Application result. */ -#define MC33775_PRMM_APP_VC_CNT_NUM_POS (0U) -#define MC33775_PRMM_APP_VC_CNT_NUM_MSK (0xFFFFU) - -/* Enumerated value LOW: Zero or insufficient samples, VC Application results are invalid. */ -#define MC33775_PRMM_APP_VC_CNT_NUM_LOW_ENUM_VAL (0U) - -/* Enumerated value OVERRUN: Sample counter overrun, VC Application results are invalid. */ -#define MC33775_PRMM_APP_VC_CNT_NUM_OVERRUN_ENUM_VAL (65535U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t NUM : 16; - } B; -} mc33775_primary_measurement_registers_prmm_app_vc_cnt_t; - -/* -------------------------------------------------------------------------- - * PRMM_APP_VC0 (read-only):Application measurement result cell 0. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_APP_VC0_OFFSET (0x1840U) -#define MC33775_PRMM_APP_VC0_RW_MSK (0x0U) -#define MC33775_PRMM_APP_VC0_RD_MSK (0xFFFFU) -#define MC33775_PRMM_APP_VC0_WR_MSK (0x0U) -#define MC33775_PRMM_APP_VC0_MW_MSK (0x0U) -#define MC33775_PRMM_APP_VC0_RA_MSK (0x0U) -#define MC33775_PRMM_APP_VC0_POR_MSK (0xffffU) -#define MC33775_PRMM_APP_VC0_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of cell 0 at the last application capture as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_APP_VC0_VALUE_POS (0U) -#define MC33775_PRMM_APP_VC0_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_app_vc0_t; - -/* -------------------------------------------------------------------------- - * PRMM_APP_VC1 (read-only):Application measurement result cell 1. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_APP_VC1_OFFSET (0x1841U) -#define MC33775_PRMM_APP_VC1_RW_MSK (0x0U) -#define MC33775_PRMM_APP_VC1_RD_MSK (0xFFFFU) -#define MC33775_PRMM_APP_VC1_WR_MSK (0x0U) -#define MC33775_PRMM_APP_VC1_MW_MSK (0x0U) -#define MC33775_PRMM_APP_VC1_RA_MSK (0x0U) -#define MC33775_PRMM_APP_VC1_POR_MSK (0xffffU) -#define MC33775_PRMM_APP_VC1_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of cell 1 at the last application capture as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_APP_VC1_VALUE_POS (0U) -#define MC33775_PRMM_APP_VC1_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_app_vc1_t; - -/* -------------------------------------------------------------------------- - * PRMM_APP_VC2 (read-only):Application measurement result cell 2. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_APP_VC2_OFFSET (0x1842U) -#define MC33775_PRMM_APP_VC2_RW_MSK (0x0U) -#define MC33775_PRMM_APP_VC2_RD_MSK (0xFFFFU) -#define MC33775_PRMM_APP_VC2_WR_MSK (0x0U) -#define MC33775_PRMM_APP_VC2_MW_MSK (0x0U) -#define MC33775_PRMM_APP_VC2_RA_MSK (0x0U) -#define MC33775_PRMM_APP_VC2_POR_MSK (0xffffU) -#define MC33775_PRMM_APP_VC2_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of cell 2 at the last application capture as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_APP_VC2_VALUE_POS (0U) -#define MC33775_PRMM_APP_VC2_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_app_vc2_t; - -/* -------------------------------------------------------------------------- - * PRMM_APP_VC3 (read-only):Application measurement result cell 3. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_APP_VC3_OFFSET (0x1843U) -#define MC33775_PRMM_APP_VC3_RW_MSK (0x0U) -#define MC33775_PRMM_APP_VC3_RD_MSK (0xFFFFU) -#define MC33775_PRMM_APP_VC3_WR_MSK (0x0U) -#define MC33775_PRMM_APP_VC3_MW_MSK (0x0U) -#define MC33775_PRMM_APP_VC3_RA_MSK (0x0U) -#define MC33775_PRMM_APP_VC3_POR_MSK (0xffffU) -#define MC33775_PRMM_APP_VC3_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of cell 3 at the last application capture as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_APP_VC3_VALUE_POS (0U) -#define MC33775_PRMM_APP_VC3_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_app_vc3_t; - -/* -------------------------------------------------------------------------- - * PRMM_APP_VC4 (read-only):Application measurement result cell 4. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_APP_VC4_OFFSET (0x1844U) -#define MC33775_PRMM_APP_VC4_RW_MSK (0x0U) -#define MC33775_PRMM_APP_VC4_RD_MSK (0xFFFFU) -#define MC33775_PRMM_APP_VC4_WR_MSK (0x0U) -#define MC33775_PRMM_APP_VC4_MW_MSK (0x0U) -#define MC33775_PRMM_APP_VC4_RA_MSK (0x0U) -#define MC33775_PRMM_APP_VC4_POR_MSK (0xffffU) -#define MC33775_PRMM_APP_VC4_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of cell 4 at the last application capture as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_APP_VC4_VALUE_POS (0U) -#define MC33775_PRMM_APP_VC4_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_app_vc4_t; - -/* -------------------------------------------------------------------------- - * PRMM_APP_VC5 (read-only):Application measurement result cell 5. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_APP_VC5_OFFSET (0x1845U) -#define MC33775_PRMM_APP_VC5_RW_MSK (0x0U) -#define MC33775_PRMM_APP_VC5_RD_MSK (0xFFFFU) -#define MC33775_PRMM_APP_VC5_WR_MSK (0x0U) -#define MC33775_PRMM_APP_VC5_MW_MSK (0x0U) -#define MC33775_PRMM_APP_VC5_RA_MSK (0x0U) -#define MC33775_PRMM_APP_VC5_POR_MSK (0xffffU) -#define MC33775_PRMM_APP_VC5_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of cell 5 at the last application capture as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_APP_VC5_VALUE_POS (0U) -#define MC33775_PRMM_APP_VC5_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_app_vc5_t; - -/* -------------------------------------------------------------------------- - * PRMM_APP_VC6 (read-only):Application measurement result cell 6. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_APP_VC6_OFFSET (0x1846U) -#define MC33775_PRMM_APP_VC6_RW_MSK (0x0U) -#define MC33775_PRMM_APP_VC6_RD_MSK (0xFFFFU) -#define MC33775_PRMM_APP_VC6_WR_MSK (0x0U) -#define MC33775_PRMM_APP_VC6_MW_MSK (0x0U) -#define MC33775_PRMM_APP_VC6_RA_MSK (0x0U) -#define MC33775_PRMM_APP_VC6_POR_MSK (0xffffU) -#define MC33775_PRMM_APP_VC6_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of cell 6 at the last application capture as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_APP_VC6_VALUE_POS (0U) -#define MC33775_PRMM_APP_VC6_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_app_vc6_t; - -/* -------------------------------------------------------------------------- - * PRMM_APP_VC7 (read-only):Application measurement result cell 7. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_APP_VC7_OFFSET (0x1847U) -#define MC33775_PRMM_APP_VC7_RW_MSK (0x0U) -#define MC33775_PRMM_APP_VC7_RD_MSK (0xFFFFU) -#define MC33775_PRMM_APP_VC7_WR_MSK (0x0U) -#define MC33775_PRMM_APP_VC7_MW_MSK (0x0U) -#define MC33775_PRMM_APP_VC7_RA_MSK (0x0U) -#define MC33775_PRMM_APP_VC7_POR_MSK (0xffffU) -#define MC33775_PRMM_APP_VC7_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of cell 7 at the last application capture as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_APP_VC7_VALUE_POS (0U) -#define MC33775_PRMM_APP_VC7_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_app_vc7_t; - -/* -------------------------------------------------------------------------- - * PRMM_APP_VC8 (read-only):Application measurement result cell 8. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_APP_VC8_OFFSET (0x1848U) -#define MC33775_PRMM_APP_VC8_RW_MSK (0x0U) -#define MC33775_PRMM_APP_VC8_RD_MSK (0xFFFFU) -#define MC33775_PRMM_APP_VC8_WR_MSK (0x0U) -#define MC33775_PRMM_APP_VC8_MW_MSK (0x0U) -#define MC33775_PRMM_APP_VC8_RA_MSK (0x0U) -#define MC33775_PRMM_APP_VC8_POR_MSK (0xffffU) -#define MC33775_PRMM_APP_VC8_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of cell 8 at the last application capture as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_APP_VC8_VALUE_POS (0U) -#define MC33775_PRMM_APP_VC8_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_app_vc8_t; - -/* -------------------------------------------------------------------------- - * PRMM_APP_VC9 (read-only):Application measurement result cell 9. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_APP_VC9_OFFSET (0x1849U) -#define MC33775_PRMM_APP_VC9_RW_MSK (0x0U) -#define MC33775_PRMM_APP_VC9_RD_MSK (0xFFFFU) -#define MC33775_PRMM_APP_VC9_WR_MSK (0x0U) -#define MC33775_PRMM_APP_VC9_MW_MSK (0x0U) -#define MC33775_PRMM_APP_VC9_RA_MSK (0x0U) -#define MC33775_PRMM_APP_VC9_POR_MSK (0xffffU) -#define MC33775_PRMM_APP_VC9_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of cell 9 at the last application capture as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_APP_VC9_VALUE_POS (0U) -#define MC33775_PRMM_APP_VC9_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_app_vc9_t; - -/* -------------------------------------------------------------------------- - * PRMM_APP_VC10 (read-only):Application measurement result cell 10. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_APP_VC10_OFFSET (0x184AU) -#define MC33775_PRMM_APP_VC10_RW_MSK (0x0U) -#define MC33775_PRMM_APP_VC10_RD_MSK (0xFFFFU) -#define MC33775_PRMM_APP_VC10_WR_MSK (0x0U) -#define MC33775_PRMM_APP_VC10_MW_MSK (0x0U) -#define MC33775_PRMM_APP_VC10_RA_MSK (0x0U) -#define MC33775_PRMM_APP_VC10_POR_MSK (0xffffU) -#define MC33775_PRMM_APP_VC10_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of cell 10 at the last application capture as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_APP_VC10_VALUE_POS (0U) -#define MC33775_PRMM_APP_VC10_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_app_vc10_t; - -/* -------------------------------------------------------------------------- - * PRMM_APP_VC11 (read-only):Application measurement result cell 11. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_APP_VC11_OFFSET (0x184BU) -#define MC33775_PRMM_APP_VC11_RW_MSK (0x0U) -#define MC33775_PRMM_APP_VC11_RD_MSK (0xFFFFU) -#define MC33775_PRMM_APP_VC11_WR_MSK (0x0U) -#define MC33775_PRMM_APP_VC11_MW_MSK (0x0U) -#define MC33775_PRMM_APP_VC11_RA_MSK (0x0U) -#define MC33775_PRMM_APP_VC11_POR_MSK (0xffffU) -#define MC33775_PRMM_APP_VC11_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of cell 11 at the last application capture as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_APP_VC11_VALUE_POS (0U) -#define MC33775_PRMM_APP_VC11_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_app_vc11_t; - -/* -------------------------------------------------------------------------- - * PRMM_APP_VC12 (read-only):Application measurement result cell 12. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_APP_VC12_OFFSET (0x184CU) -#define MC33775_PRMM_APP_VC12_RW_MSK (0x0U) -#define MC33775_PRMM_APP_VC12_RD_MSK (0xFFFFU) -#define MC33775_PRMM_APP_VC12_WR_MSK (0x0U) -#define MC33775_PRMM_APP_VC12_MW_MSK (0x0U) -#define MC33775_PRMM_APP_VC12_RA_MSK (0x0U) -#define MC33775_PRMM_APP_VC12_POR_MSK (0xffffU) -#define MC33775_PRMM_APP_VC12_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of cell 12 at the last application capture as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_APP_VC12_VALUE_POS (0U) -#define MC33775_PRMM_APP_VC12_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_app_vc12_t; - -/* -------------------------------------------------------------------------- - * PRMM_APP_VC13 (read-only):Application measurement result cell 13. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_APP_VC13_OFFSET (0x184DU) -#define MC33775_PRMM_APP_VC13_RW_MSK (0x0U) -#define MC33775_PRMM_APP_VC13_RD_MSK (0xFFFFU) -#define MC33775_PRMM_APP_VC13_WR_MSK (0x0U) -#define MC33775_PRMM_APP_VC13_MW_MSK (0x0U) -#define MC33775_PRMM_APP_VC13_RA_MSK (0x0U) -#define MC33775_PRMM_APP_VC13_POR_MSK (0xffffU) -#define MC33775_PRMM_APP_VC13_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of cell 13 at the last application capture as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_APP_VC13_VALUE_POS (0U) -#define MC33775_PRMM_APP_VC13_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_app_vc13_t; - -/* -------------------------------------------------------------------------- - * PRMM_APP_VMODULE (read-only):Application measurement result module voltage. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_APP_VMODULE_OFFSET (0x184EU) -#define MC33775_PRMM_APP_VMODULE_RW_MSK (0x0U) -#define MC33775_PRMM_APP_VMODULE_RD_MSK (0xFFFFU) -#define MC33775_PRMM_APP_VMODULE_WR_MSK (0x0U) -#define MC33775_PRMM_APP_VMODULE_MW_MSK (0x0U) -#define MC33775_PRMM_APP_VMODULE_RA_MSK (0x0U) -#define MC33775_PRMM_APP_VMODULE_POR_MSK (0xffffU) -#define MC33775_PRMM_APP_VMODULE_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of VMODULE at the last application capture as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_APP_VMODULE_VALUE_POS (0U) -#define MC33775_PRMM_APP_VMODULE_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_app_vmodule_t; - -/* -------------------------------------------------------------------------- - * PRMM_APP_AIN0 (read-only):Application measurement result AIN0. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_APP_AIN0_OFFSET (0x184FU) -#define MC33775_PRMM_APP_AIN0_RW_MSK (0x0U) -#define MC33775_PRMM_APP_AIN0_RD_MSK (0xFFFFU) -#define MC33775_PRMM_APP_AIN0_WR_MSK (0x0U) -#define MC33775_PRMM_APP_AIN0_MW_MSK (0x0U) -#define MC33775_PRMM_APP_AIN0_RA_MSK (0x0U) -#define MC33775_PRMM_APP_AIN0_POR_MSK (0xffffU) -#define MC33775_PRMM_APP_AIN0_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of AIN0 at the last application capture as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_APP_AIN0_VALUE_POS (0U) -#define MC33775_PRMM_APP_AIN0_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_app_ain0_t; - -/* -------------------------------------------------------------------------- - * PRMM_APP_AIN1 (read-only):Application measurement result AIN1. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_APP_AIN1_OFFSET (0x1850U) -#define MC33775_PRMM_APP_AIN1_RW_MSK (0x0U) -#define MC33775_PRMM_APP_AIN1_RD_MSK (0xFFFFU) -#define MC33775_PRMM_APP_AIN1_WR_MSK (0x0U) -#define MC33775_PRMM_APP_AIN1_MW_MSK (0x0U) -#define MC33775_PRMM_APP_AIN1_RA_MSK (0x0U) -#define MC33775_PRMM_APP_AIN1_POR_MSK (0xffffU) -#define MC33775_PRMM_APP_AIN1_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of AIN1 at the last application capture as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_APP_AIN1_VALUE_POS (0U) -#define MC33775_PRMM_APP_AIN1_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_app_ain1_t; - -/* -------------------------------------------------------------------------- - * PRMM_APP_AIN2 (read-only):Application measurement result AIN2. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_APP_AIN2_OFFSET (0x1851U) -#define MC33775_PRMM_APP_AIN2_RW_MSK (0x0U) -#define MC33775_PRMM_APP_AIN2_RD_MSK (0xFFFFU) -#define MC33775_PRMM_APP_AIN2_WR_MSK (0x0U) -#define MC33775_PRMM_APP_AIN2_MW_MSK (0x0U) -#define MC33775_PRMM_APP_AIN2_RA_MSK (0x0U) -#define MC33775_PRMM_APP_AIN2_POR_MSK (0xffffU) -#define MC33775_PRMM_APP_AIN2_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of AIN2 at the last application capture as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_APP_AIN2_VALUE_POS (0U) -#define MC33775_PRMM_APP_AIN2_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_app_ain2_t; - -/* -------------------------------------------------------------------------- - * PRMM_APP_AIN3 (read-only):Application measurement result AIN3. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_APP_AIN3_OFFSET (0x1852U) -#define MC33775_PRMM_APP_AIN3_RW_MSK (0x0U) -#define MC33775_PRMM_APP_AIN3_RD_MSK (0xFFFFU) -#define MC33775_PRMM_APP_AIN3_WR_MSK (0x0U) -#define MC33775_PRMM_APP_AIN3_MW_MSK (0x0U) -#define MC33775_PRMM_APP_AIN3_RA_MSK (0x0U) -#define MC33775_PRMM_APP_AIN3_POR_MSK (0xffffU) -#define MC33775_PRMM_APP_AIN3_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of AIN3 at the last application capture as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_APP_AIN3_VALUE_POS (0U) -#define MC33775_PRMM_APP_AIN3_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_app_ain3_t; - -/* -------------------------------------------------------------------------- - * PRMM_PER_NUM (read-only):Measurement period number of the primary periodic results. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_PER_NUM_OFFSET (0x185FU) -#define MC33775_PRMM_PER_NUM_RW_MSK (0x0U) -#define MC33775_PRMM_PER_NUM_RD_MSK (0xFFFFU) -#define MC33775_PRMM_PER_NUM_WR_MSK (0x0U) -#define MC33775_PRMM_PER_NUM_MW_MSK (0x0U) -#define MC33775_PRMM_PER_NUM_RA_MSK (0x0U) -#define MC33775_PRMM_PER_NUM_POR_MSK (0xffffU) -#define MC33775_PRMM_PER_NUM_POR_VAL (0x0U) - -/* Field NUM: Number of the periodic cycle in which the primary periodic results have been created. The value is incremented for each periodic cycle executed. The counting wraps at its limit. */ -#define MC33775_PRMM_PER_NUM_NUM_POS (0U) -#define MC33775_PRMM_PER_NUM_NUM_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t NUM : 16; - } B; -} mc33775_primary_measurement_registers_prmm_per_num_t; - -/* -------------------------------------------------------------------------- - * PRMM_PER_VC0 (read-only):Periodic measurement result cell0. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_PER_VC0_OFFSET (0x1860U) -#define MC33775_PRMM_PER_VC0_RW_MSK (0x0U) -#define MC33775_PRMM_PER_VC0_RD_MSK (0xFFFFU) -#define MC33775_PRMM_PER_VC0_WR_MSK (0x0U) -#define MC33775_PRMM_PER_VC0_MW_MSK (0x0U) -#define MC33775_PRMM_PER_VC0_RA_MSK (0x0U) -#define MC33775_PRMM_PER_VC0_POR_MSK (0xffffU) -#define MC33775_PRMM_PER_VC0_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of cell 0 of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_PER_VC0_VALUE_POS (0U) -#define MC33775_PRMM_PER_VC0_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_per_vc0_t; - -/* -------------------------------------------------------------------------- - * PRMM_PER_VC1 (read-only):Periodic measurement result cell1. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_PER_VC1_OFFSET (0x1861U) -#define MC33775_PRMM_PER_VC1_RW_MSK (0x0U) -#define MC33775_PRMM_PER_VC1_RD_MSK (0xFFFFU) -#define MC33775_PRMM_PER_VC1_WR_MSK (0x0U) -#define MC33775_PRMM_PER_VC1_MW_MSK (0x0U) -#define MC33775_PRMM_PER_VC1_RA_MSK (0x0U) -#define MC33775_PRMM_PER_VC1_POR_MSK (0xffffU) -#define MC33775_PRMM_PER_VC1_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of cell 1 of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_PER_VC1_VALUE_POS (0U) -#define MC33775_PRMM_PER_VC1_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_per_vc1_t; - -/* -------------------------------------------------------------------------- - * PRMM_PER_VC2 (read-only):Periodic measurement result cell2. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_PER_VC2_OFFSET (0x1862U) -#define MC33775_PRMM_PER_VC2_RW_MSK (0x0U) -#define MC33775_PRMM_PER_VC2_RD_MSK (0xFFFFU) -#define MC33775_PRMM_PER_VC2_WR_MSK (0x0U) -#define MC33775_PRMM_PER_VC2_MW_MSK (0x0U) -#define MC33775_PRMM_PER_VC2_RA_MSK (0x0U) -#define MC33775_PRMM_PER_VC2_POR_MSK (0xffffU) -#define MC33775_PRMM_PER_VC2_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of cell 2 of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_PER_VC2_VALUE_POS (0U) -#define MC33775_PRMM_PER_VC2_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_per_vc2_t; - -/* -------------------------------------------------------------------------- - * PRMM_PER_VC3 (read-only):Periodic measurement result cell3. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_PER_VC3_OFFSET (0x1863U) -#define MC33775_PRMM_PER_VC3_RW_MSK (0x0U) -#define MC33775_PRMM_PER_VC3_RD_MSK (0xFFFFU) -#define MC33775_PRMM_PER_VC3_WR_MSK (0x0U) -#define MC33775_PRMM_PER_VC3_MW_MSK (0x0U) -#define MC33775_PRMM_PER_VC3_RA_MSK (0x0U) -#define MC33775_PRMM_PER_VC3_POR_MSK (0xffffU) -#define MC33775_PRMM_PER_VC3_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of cell 3 of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_PER_VC3_VALUE_POS (0U) -#define MC33775_PRMM_PER_VC3_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_per_vc3_t; - -/* -------------------------------------------------------------------------- - * PRMM_PER_VC4 (read-only):Periodic measurement result cell4. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_PER_VC4_OFFSET (0x1864U) -#define MC33775_PRMM_PER_VC4_RW_MSK (0x0U) -#define MC33775_PRMM_PER_VC4_RD_MSK (0xFFFFU) -#define MC33775_PRMM_PER_VC4_WR_MSK (0x0U) -#define MC33775_PRMM_PER_VC4_MW_MSK (0x0U) -#define MC33775_PRMM_PER_VC4_RA_MSK (0x0U) -#define MC33775_PRMM_PER_VC4_POR_MSK (0xffffU) -#define MC33775_PRMM_PER_VC4_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of cell 4 of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_PER_VC4_VALUE_POS (0U) -#define MC33775_PRMM_PER_VC4_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_per_vc4_t; - -/* -------------------------------------------------------------------------- - * PRMM_PER_VC5 (read-only):Periodic measurement result cell5. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_PER_VC5_OFFSET (0x1865U) -#define MC33775_PRMM_PER_VC5_RW_MSK (0x0U) -#define MC33775_PRMM_PER_VC5_RD_MSK (0xFFFFU) -#define MC33775_PRMM_PER_VC5_WR_MSK (0x0U) -#define MC33775_PRMM_PER_VC5_MW_MSK (0x0U) -#define MC33775_PRMM_PER_VC5_RA_MSK (0x0U) -#define MC33775_PRMM_PER_VC5_POR_MSK (0xffffU) -#define MC33775_PRMM_PER_VC5_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of cell 5 of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_PER_VC5_VALUE_POS (0U) -#define MC33775_PRMM_PER_VC5_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_per_vc5_t; - -/* -------------------------------------------------------------------------- - * PRMM_PER_VC6 (read-only):Periodic measurement result cell6. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_PER_VC6_OFFSET (0x1866U) -#define MC33775_PRMM_PER_VC6_RW_MSK (0x0U) -#define MC33775_PRMM_PER_VC6_RD_MSK (0xFFFFU) -#define MC33775_PRMM_PER_VC6_WR_MSK (0x0U) -#define MC33775_PRMM_PER_VC6_MW_MSK (0x0U) -#define MC33775_PRMM_PER_VC6_RA_MSK (0x0U) -#define MC33775_PRMM_PER_VC6_POR_MSK (0xffffU) -#define MC33775_PRMM_PER_VC6_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of cell 6 of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_PER_VC6_VALUE_POS (0U) -#define MC33775_PRMM_PER_VC6_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_per_vc6_t; - -/* -------------------------------------------------------------------------- - * PRMM_PER_VC7 (read-only):Periodic measurement result cell7. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_PER_VC7_OFFSET (0x1867U) -#define MC33775_PRMM_PER_VC7_RW_MSK (0x0U) -#define MC33775_PRMM_PER_VC7_RD_MSK (0xFFFFU) -#define MC33775_PRMM_PER_VC7_WR_MSK (0x0U) -#define MC33775_PRMM_PER_VC7_MW_MSK (0x0U) -#define MC33775_PRMM_PER_VC7_RA_MSK (0x0U) -#define MC33775_PRMM_PER_VC7_POR_MSK (0xffffU) -#define MC33775_PRMM_PER_VC7_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of cell 7 of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_PER_VC7_VALUE_POS (0U) -#define MC33775_PRMM_PER_VC7_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_per_vc7_t; - -/* -------------------------------------------------------------------------- - * PRMM_PER_VC8 (read-only):Periodic measurement result cell8. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_PER_VC8_OFFSET (0x1868U) -#define MC33775_PRMM_PER_VC8_RW_MSK (0x0U) -#define MC33775_PRMM_PER_VC8_RD_MSK (0xFFFFU) -#define MC33775_PRMM_PER_VC8_WR_MSK (0x0U) -#define MC33775_PRMM_PER_VC8_MW_MSK (0x0U) -#define MC33775_PRMM_PER_VC8_RA_MSK (0x0U) -#define MC33775_PRMM_PER_VC8_POR_MSK (0xffffU) -#define MC33775_PRMM_PER_VC8_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of cell 8 of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_PER_VC8_VALUE_POS (0U) -#define MC33775_PRMM_PER_VC8_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_per_vc8_t; - -/* -------------------------------------------------------------------------- - * PRMM_PER_VC9 (read-only):Periodic measurement result cell9. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_PER_VC9_OFFSET (0x1869U) -#define MC33775_PRMM_PER_VC9_RW_MSK (0x0U) -#define MC33775_PRMM_PER_VC9_RD_MSK (0xFFFFU) -#define MC33775_PRMM_PER_VC9_WR_MSK (0x0U) -#define MC33775_PRMM_PER_VC9_MW_MSK (0x0U) -#define MC33775_PRMM_PER_VC9_RA_MSK (0x0U) -#define MC33775_PRMM_PER_VC9_POR_MSK (0xffffU) -#define MC33775_PRMM_PER_VC9_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of cell 9 of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_PER_VC9_VALUE_POS (0U) -#define MC33775_PRMM_PER_VC9_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_per_vc9_t; - -/* -------------------------------------------------------------------------- - * PRMM_PER_VC10 (read-only):Periodic measurement result cell10. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_PER_VC10_OFFSET (0x186AU) -#define MC33775_PRMM_PER_VC10_RW_MSK (0x0U) -#define MC33775_PRMM_PER_VC10_RD_MSK (0xFFFFU) -#define MC33775_PRMM_PER_VC10_WR_MSK (0x0U) -#define MC33775_PRMM_PER_VC10_MW_MSK (0x0U) -#define MC33775_PRMM_PER_VC10_RA_MSK (0x0U) -#define MC33775_PRMM_PER_VC10_POR_MSK (0xffffU) -#define MC33775_PRMM_PER_VC10_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of cell 10 of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_PER_VC10_VALUE_POS (0U) -#define MC33775_PRMM_PER_VC10_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_per_vc10_t; - -/* -------------------------------------------------------------------------- - * PRMM_PER_VC11 (read-only):Periodic measurement result cell11. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_PER_VC11_OFFSET (0x186BU) -#define MC33775_PRMM_PER_VC11_RW_MSK (0x0U) -#define MC33775_PRMM_PER_VC11_RD_MSK (0xFFFFU) -#define MC33775_PRMM_PER_VC11_WR_MSK (0x0U) -#define MC33775_PRMM_PER_VC11_MW_MSK (0x0U) -#define MC33775_PRMM_PER_VC11_RA_MSK (0x0U) -#define MC33775_PRMM_PER_VC11_POR_MSK (0xffffU) -#define MC33775_PRMM_PER_VC11_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of cell 11 of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_PER_VC11_VALUE_POS (0U) -#define MC33775_PRMM_PER_VC11_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_per_vc11_t; - -/* -------------------------------------------------------------------------- - * PRMM_PER_VC12 (read-only):Periodic measurement result cell12. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_PER_VC12_OFFSET (0x186CU) -#define MC33775_PRMM_PER_VC12_RW_MSK (0x0U) -#define MC33775_PRMM_PER_VC12_RD_MSK (0xFFFFU) -#define MC33775_PRMM_PER_VC12_WR_MSK (0x0U) -#define MC33775_PRMM_PER_VC12_MW_MSK (0x0U) -#define MC33775_PRMM_PER_VC12_RA_MSK (0x0U) -#define MC33775_PRMM_PER_VC12_POR_MSK (0xffffU) -#define MC33775_PRMM_PER_VC12_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of cell 12 of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_PER_VC12_VALUE_POS (0U) -#define MC33775_PRMM_PER_VC12_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_per_vc12_t; - -/* -------------------------------------------------------------------------- - * PRMM_PER_VC13 (read-only):Periodic measurement result cell13. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_PER_VC13_OFFSET (0x186DU) -#define MC33775_PRMM_PER_VC13_RW_MSK (0x0U) -#define MC33775_PRMM_PER_VC13_RD_MSK (0xFFFFU) -#define MC33775_PRMM_PER_VC13_WR_MSK (0x0U) -#define MC33775_PRMM_PER_VC13_MW_MSK (0x0U) -#define MC33775_PRMM_PER_VC13_RA_MSK (0x0U) -#define MC33775_PRMM_PER_VC13_POR_MSK (0xffffU) -#define MC33775_PRMM_PER_VC13_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of cell 13 of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_PER_VC13_VALUE_POS (0U) -#define MC33775_PRMM_PER_VC13_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_per_vc13_t; - -/* -------------------------------------------------------------------------- - * PRMM_PER_VMODULE (read-only):Periodic measurement result module voltage. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_PER_VMODULE_OFFSET (0x186EU) -#define MC33775_PRMM_PER_VMODULE_RW_MSK (0x0U) -#define MC33775_PRMM_PER_VMODULE_RD_MSK (0xFFFFU) -#define MC33775_PRMM_PER_VMODULE_WR_MSK (0x0U) -#define MC33775_PRMM_PER_VMODULE_MW_MSK (0x0U) -#define MC33775_PRMM_PER_VMODULE_RA_MSK (0x0U) -#define MC33775_PRMM_PER_VMODULE_POR_MSK (0xffffU) -#define MC33775_PRMM_PER_VMODULE_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of VMODULE of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_PER_VMODULE_VALUE_POS (0U) -#define MC33775_PRMM_PER_VMODULE_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_per_vmodule_t; - -/* -------------------------------------------------------------------------- - * PRMM_PER_AIN0 (read-only):Periodic measurement result AIN0. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_PER_AIN0_OFFSET (0x186FU) -#define MC33775_PRMM_PER_AIN0_RW_MSK (0x0U) -#define MC33775_PRMM_PER_AIN0_RD_MSK (0xFFFFU) -#define MC33775_PRMM_PER_AIN0_WR_MSK (0x0U) -#define MC33775_PRMM_PER_AIN0_MW_MSK (0x0U) -#define MC33775_PRMM_PER_AIN0_RA_MSK (0x0U) -#define MC33775_PRMM_PER_AIN0_POR_MSK (0xffffU) -#define MC33775_PRMM_PER_AIN0_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of AIN0 of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_PER_AIN0_VALUE_POS (0U) -#define MC33775_PRMM_PER_AIN0_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_per_ain0_t; - -/* -------------------------------------------------------------------------- - * PRMM_PER_AIN1 (read-only):Periodic measurement result AIN1. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_PER_AIN1_OFFSET (0x1870U) -#define MC33775_PRMM_PER_AIN1_RW_MSK (0x0U) -#define MC33775_PRMM_PER_AIN1_RD_MSK (0xFFFFU) -#define MC33775_PRMM_PER_AIN1_WR_MSK (0x0U) -#define MC33775_PRMM_PER_AIN1_MW_MSK (0x0U) -#define MC33775_PRMM_PER_AIN1_RA_MSK (0x0U) -#define MC33775_PRMM_PER_AIN1_POR_MSK (0xffffU) -#define MC33775_PRMM_PER_AIN1_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of AIN1 of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_PER_AIN1_VALUE_POS (0U) -#define MC33775_PRMM_PER_AIN1_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_per_ain1_t; - -/* -------------------------------------------------------------------------- - * PRMM_PER_AIN2 (read-only):Periodic measurement result AIN2. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_PER_AIN2_OFFSET (0x1871U) -#define MC33775_PRMM_PER_AIN2_RW_MSK (0x0U) -#define MC33775_PRMM_PER_AIN2_RD_MSK (0xFFFFU) -#define MC33775_PRMM_PER_AIN2_WR_MSK (0x0U) -#define MC33775_PRMM_PER_AIN2_MW_MSK (0x0U) -#define MC33775_PRMM_PER_AIN2_RA_MSK (0x0U) -#define MC33775_PRMM_PER_AIN2_POR_MSK (0xffffU) -#define MC33775_PRMM_PER_AIN2_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of AIN2 of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_PER_AIN2_VALUE_POS (0U) -#define MC33775_PRMM_PER_AIN2_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_per_ain2_t; - -/* -------------------------------------------------------------------------- - * PRMM_PER_AIN3 (read-only):Periodic measurement result AIN3. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_PER_AIN3_OFFSET (0x1872U) -#define MC33775_PRMM_PER_AIN3_RW_MSK (0x0U) -#define MC33775_PRMM_PER_AIN3_RD_MSK (0xFFFFU) -#define MC33775_PRMM_PER_AIN3_WR_MSK (0x0U) -#define MC33775_PRMM_PER_AIN3_MW_MSK (0x0U) -#define MC33775_PRMM_PER_AIN3_RA_MSK (0x0U) -#define MC33775_PRMM_PER_AIN3_POR_MSK (0xffffU) -#define MC33775_PRMM_PER_AIN3_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of AIN3 of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_PER_AIN3_VALUE_POS (0U) -#define MC33775_PRMM_PER_AIN3_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_per_ain3_t; - -/* -------------------------------------------------------------------------- - * PRMM_PER_PRMTEMP (read-only):Periodic measurement result primary device temperature. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_PER_PRMTEMP_OFFSET (0x1873U) -#define MC33775_PRMM_PER_PRMTEMP_RW_MSK (0x0U) -#define MC33775_PRMM_PER_PRMTEMP_RD_MSK (0xFFFFU) -#define MC33775_PRMM_PER_PRMTEMP_WR_MSK (0x0U) -#define MC33775_PRMM_PER_PRMTEMP_MW_MSK (0x0U) -#define MC33775_PRMM_PER_PRMTEMP_RA_MSK (0x0U) -#define MC33775_PRMM_PER_PRMTEMP_POR_MSK (0xffffU) -#define MC33775_PRMM_PER_PRMTEMP_POR_VAL (0x8000U) - -/* Field VALUE: Measured value of primary temperature sensor of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_PER_PRMTEMP_VALUE_POS (0U) -#define MC33775_PRMM_PER_PRMTEMP_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_per_prmtemp_t; - -/* -------------------------------------------------------------------------- - * PRMM_PER_SECVREF (read-only):Periodic measurement result secondary voltage reference. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_PER_SECVREF_OFFSET (0x1874U) -#define MC33775_PRMM_PER_SECVREF_RW_MSK (0x0U) -#define MC33775_PRMM_PER_SECVREF_RD_MSK (0xFFFFU) -#define MC33775_PRMM_PER_SECVREF_WR_MSK (0x0U) -#define MC33775_PRMM_PER_SECVREF_MW_MSK (0x0U) -#define MC33775_PRMM_PER_SECVREF_RA_MSK (0x0U) -#define MC33775_PRMM_PER_SECVREF_POR_MSK (0xffffU) -#define MC33775_PRMM_PER_SECVREF_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of secondary reference voltage of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_PER_SECVREF_VALUE_POS (0U) -#define MC33775_PRMM_PER_SECVREF_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_per_secvref_t; - -/* -------------------------------------------------------------------------- - * PRMM_PER_VAUX (read-only):Periodic measurement result auxiliary supply voltage. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_PER_VAUX_OFFSET (0x1875U) -#define MC33775_PRMM_PER_VAUX_RW_MSK (0x0U) -#define MC33775_PRMM_PER_VAUX_RD_MSK (0xFFFFU) -#define MC33775_PRMM_PER_VAUX_WR_MSK (0x0U) -#define MC33775_PRMM_PER_VAUX_MW_MSK (0x0U) -#define MC33775_PRMM_PER_VAUX_RA_MSK (0x0U) -#define MC33775_PRMM_PER_VAUX_POR_MSK (0xffffU) -#define MC33775_PRMM_PER_VAUX_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of VAUX of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_PER_VAUX_VALUE_POS (0U) -#define MC33775_PRMM_PER_VAUX_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_per_vaux_t; - -/* -------------------------------------------------------------------------- - * PRMM_PER_VDDC (read-only):Periodic measurement result VDDC. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_PER_VDDC_OFFSET (0x1876U) -#define MC33775_PRMM_PER_VDDC_RW_MSK (0x0U) -#define MC33775_PRMM_PER_VDDC_RD_MSK (0xFFFFU) -#define MC33775_PRMM_PER_VDDC_WR_MSK (0x0U) -#define MC33775_PRMM_PER_VDDC_MW_MSK (0x0U) -#define MC33775_PRMM_PER_VDDC_RA_MSK (0x0U) -#define MC33775_PRMM_PER_VDDC_POR_MSK (0xffffU) -#define MC33775_PRMM_PER_VDDC_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of VDDC of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_PER_VDDC_VALUE_POS (0U) -#define MC33775_PRMM_PER_VDDC_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_per_vddc_t; - -/* -------------------------------------------------------------------------- - * PRMM_PER_LDOVREF (read-only):Periodic measurement result LDO reference voltage. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_PER_LDOVREF_OFFSET (0x1877U) -#define MC33775_PRMM_PER_LDOVREF_RW_MSK (0x0U) -#define MC33775_PRMM_PER_LDOVREF_RD_MSK (0xFFFFU) -#define MC33775_PRMM_PER_LDOVREF_WR_MSK (0x0U) -#define MC33775_PRMM_PER_LDOVREF_MW_MSK (0x0U) -#define MC33775_PRMM_PER_LDOVREF_RA_MSK (0x0U) -#define MC33775_PRMM_PER_LDOVREF_POR_MSK (0xffffU) -#define MC33775_PRMM_PER_LDOVREF_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of the LDO reference of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_PER_LDOVREF_VALUE_POS (0U) -#define MC33775_PRMM_PER_LDOVREF_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_per_ldovref_t; - -/* -------------------------------------------------------------------------- - * PRMM_SYNC_NUM (read-only):Measurement period number of the synchronous results. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_SYNC_NUM_OFFSET (0x187FU) -#define MC33775_PRMM_SYNC_NUM_RW_MSK (0x0U) -#define MC33775_PRMM_SYNC_NUM_RD_MSK (0xFFFFU) -#define MC33775_PRMM_SYNC_NUM_WR_MSK (0x0U) -#define MC33775_PRMM_SYNC_NUM_MW_MSK (0x0U) -#define MC33775_PRMM_SYNC_NUM_RA_MSK (0x0U) -#define MC33775_PRMM_SYNC_NUM_POR_MSK (0xffffU) -#define MC33775_PRMM_SYNC_NUM_POR_VAL (0x0U) - -/* Field NUM: Number of the synchronous cycle in which the synchronous results have been created. The value is incremented for each synchronous cycle executed. The counting wraps at its limit. */ -#define MC33775_PRMM_SYNC_NUM_NUM_POS (0U) -#define MC33775_PRMM_SYNC_NUM_NUM_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t NUM : 16; - } B; -} mc33775_primary_measurement_registers_prmm_sync_num_t; - -/* -------------------------------------------------------------------------- - * PRMM_SYNC_VC0 (read-only):Synchronous measurement result cell 0. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_SYNC_VC0_OFFSET (0x1880U) -#define MC33775_PRMM_SYNC_VC0_RW_MSK (0x0U) -#define MC33775_PRMM_SYNC_VC0_RD_MSK (0xFFFFU) -#define MC33775_PRMM_SYNC_VC0_WR_MSK (0x0U) -#define MC33775_PRMM_SYNC_VC0_MW_MSK (0x0U) -#define MC33775_PRMM_SYNC_VC0_RA_MSK (0x0U) -#define MC33775_PRMM_SYNC_VC0_POR_MSK (0xffffU) -#define MC33775_PRMM_SYNC_VC0_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of cell 0 of the last synchronous cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_SYNC_VC0_VALUE_POS (0U) -#define MC33775_PRMM_SYNC_VC0_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_sync_vc0_t; - -/* -------------------------------------------------------------------------- - * PRMM_SYNC_VC1 (read-only):Synchronous measurement result cell 1. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_SYNC_VC1_OFFSET (0x1881U) -#define MC33775_PRMM_SYNC_VC1_RW_MSK (0x0U) -#define MC33775_PRMM_SYNC_VC1_RD_MSK (0xFFFFU) -#define MC33775_PRMM_SYNC_VC1_WR_MSK (0x0U) -#define MC33775_PRMM_SYNC_VC1_MW_MSK (0x0U) -#define MC33775_PRMM_SYNC_VC1_RA_MSK (0x0U) -#define MC33775_PRMM_SYNC_VC1_POR_MSK (0xffffU) -#define MC33775_PRMM_SYNC_VC1_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of cell 1 of the last synchronous cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_SYNC_VC1_VALUE_POS (0U) -#define MC33775_PRMM_SYNC_VC1_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_sync_vc1_t; - -/* -------------------------------------------------------------------------- - * PRMM_SYNC_VC2 (read-only):Synchronous measurement result cell 2. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_SYNC_VC2_OFFSET (0x1882U) -#define MC33775_PRMM_SYNC_VC2_RW_MSK (0x0U) -#define MC33775_PRMM_SYNC_VC2_RD_MSK (0xFFFFU) -#define MC33775_PRMM_SYNC_VC2_WR_MSK (0x0U) -#define MC33775_PRMM_SYNC_VC2_MW_MSK (0x0U) -#define MC33775_PRMM_SYNC_VC2_RA_MSK (0x0U) -#define MC33775_PRMM_SYNC_VC2_POR_MSK (0xffffU) -#define MC33775_PRMM_SYNC_VC2_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of cell 2 of the last synchronous cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_SYNC_VC2_VALUE_POS (0U) -#define MC33775_PRMM_SYNC_VC2_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_sync_vc2_t; - -/* -------------------------------------------------------------------------- - * PRMM_SYNC_VC3 (read-only):Synchronous measurement result cell 3. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_SYNC_VC3_OFFSET (0x1883U) -#define MC33775_PRMM_SYNC_VC3_RW_MSK (0x0U) -#define MC33775_PRMM_SYNC_VC3_RD_MSK (0xFFFFU) -#define MC33775_PRMM_SYNC_VC3_WR_MSK (0x0U) -#define MC33775_PRMM_SYNC_VC3_MW_MSK (0x0U) -#define MC33775_PRMM_SYNC_VC3_RA_MSK (0x0U) -#define MC33775_PRMM_SYNC_VC3_POR_MSK (0xffffU) -#define MC33775_PRMM_SYNC_VC3_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of cell 3 of the last synchronous cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_SYNC_VC3_VALUE_POS (0U) -#define MC33775_PRMM_SYNC_VC3_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_sync_vc3_t; - -/* -------------------------------------------------------------------------- - * PRMM_SYNC_VC4 (read-only):Synchronous measurement result cell 4. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_SYNC_VC4_OFFSET (0x1884U) -#define MC33775_PRMM_SYNC_VC4_RW_MSK (0x0U) -#define MC33775_PRMM_SYNC_VC4_RD_MSK (0xFFFFU) -#define MC33775_PRMM_SYNC_VC4_WR_MSK (0x0U) -#define MC33775_PRMM_SYNC_VC4_MW_MSK (0x0U) -#define MC33775_PRMM_SYNC_VC4_RA_MSK (0x0U) -#define MC33775_PRMM_SYNC_VC4_POR_MSK (0xffffU) -#define MC33775_PRMM_SYNC_VC4_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of cell 4 of the last synchronous cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_SYNC_VC4_VALUE_POS (0U) -#define MC33775_PRMM_SYNC_VC4_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_sync_vc4_t; - -/* -------------------------------------------------------------------------- - * PRMM_SYNC_VC5 (read-only):Synchronous measurement result cell 5. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_SYNC_VC5_OFFSET (0x1885U) -#define MC33775_PRMM_SYNC_VC5_RW_MSK (0x0U) -#define MC33775_PRMM_SYNC_VC5_RD_MSK (0xFFFFU) -#define MC33775_PRMM_SYNC_VC5_WR_MSK (0x0U) -#define MC33775_PRMM_SYNC_VC5_MW_MSK (0x0U) -#define MC33775_PRMM_SYNC_VC5_RA_MSK (0x0U) -#define MC33775_PRMM_SYNC_VC5_POR_MSK (0xffffU) -#define MC33775_PRMM_SYNC_VC5_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of cell 5 of the last synchronous cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_SYNC_VC5_VALUE_POS (0U) -#define MC33775_PRMM_SYNC_VC5_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_sync_vc5_t; - -/* -------------------------------------------------------------------------- - * PRMM_SYNC_VC6 (read-only):Synchronous measurement result cell 6. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_SYNC_VC6_OFFSET (0x1886U) -#define MC33775_PRMM_SYNC_VC6_RW_MSK (0x0U) -#define MC33775_PRMM_SYNC_VC6_RD_MSK (0xFFFFU) -#define MC33775_PRMM_SYNC_VC6_WR_MSK (0x0U) -#define MC33775_PRMM_SYNC_VC6_MW_MSK (0x0U) -#define MC33775_PRMM_SYNC_VC6_RA_MSK (0x0U) -#define MC33775_PRMM_SYNC_VC6_POR_MSK (0xffffU) -#define MC33775_PRMM_SYNC_VC6_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of cell 6 of the last synchronous cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_SYNC_VC6_VALUE_POS (0U) -#define MC33775_PRMM_SYNC_VC6_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_sync_vc6_t; - -/* -------------------------------------------------------------------------- - * PRMM_SYNC_VC7 (read-only):Synchronous measurement result cell 7. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_SYNC_VC7_OFFSET (0x1887U) -#define MC33775_PRMM_SYNC_VC7_RW_MSK (0x0U) -#define MC33775_PRMM_SYNC_VC7_RD_MSK (0xFFFFU) -#define MC33775_PRMM_SYNC_VC7_WR_MSK (0x0U) -#define MC33775_PRMM_SYNC_VC7_MW_MSK (0x0U) -#define MC33775_PRMM_SYNC_VC7_RA_MSK (0x0U) -#define MC33775_PRMM_SYNC_VC7_POR_MSK (0xffffU) -#define MC33775_PRMM_SYNC_VC7_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of cell 7 of the last synchronous cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_SYNC_VC7_VALUE_POS (0U) -#define MC33775_PRMM_SYNC_VC7_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_sync_vc7_t; - -/* -------------------------------------------------------------------------- - * PRMM_SYNC_VC8 (read-only):Synchronous measurement result cell 8. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_SYNC_VC8_OFFSET (0x1888U) -#define MC33775_PRMM_SYNC_VC8_RW_MSK (0x0U) -#define MC33775_PRMM_SYNC_VC8_RD_MSK (0xFFFFU) -#define MC33775_PRMM_SYNC_VC8_WR_MSK (0x0U) -#define MC33775_PRMM_SYNC_VC8_MW_MSK (0x0U) -#define MC33775_PRMM_SYNC_VC8_RA_MSK (0x0U) -#define MC33775_PRMM_SYNC_VC8_POR_MSK (0xffffU) -#define MC33775_PRMM_SYNC_VC8_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of cell 8 of the last synchronous cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_SYNC_VC8_VALUE_POS (0U) -#define MC33775_PRMM_SYNC_VC8_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_sync_vc8_t; - -/* -------------------------------------------------------------------------- - * PRMM_SYNC_VC9 (read-only):Synchronous measurement result cell 9. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_SYNC_VC9_OFFSET (0x1889U) -#define MC33775_PRMM_SYNC_VC9_RW_MSK (0x0U) -#define MC33775_PRMM_SYNC_VC9_RD_MSK (0xFFFFU) -#define MC33775_PRMM_SYNC_VC9_WR_MSK (0x0U) -#define MC33775_PRMM_SYNC_VC9_MW_MSK (0x0U) -#define MC33775_PRMM_SYNC_VC9_RA_MSK (0x0U) -#define MC33775_PRMM_SYNC_VC9_POR_MSK (0xffffU) -#define MC33775_PRMM_SYNC_VC9_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of cell 9 of the last synchronous cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_SYNC_VC9_VALUE_POS (0U) -#define MC33775_PRMM_SYNC_VC9_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_sync_vc9_t; - -/* -------------------------------------------------------------------------- - * PRMM_SYNC_VC10 (read-only):Synchronous measurement result cell 10. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_SYNC_VC10_OFFSET (0x188AU) -#define MC33775_PRMM_SYNC_VC10_RW_MSK (0x0U) -#define MC33775_PRMM_SYNC_VC10_RD_MSK (0xFFFFU) -#define MC33775_PRMM_SYNC_VC10_WR_MSK (0x0U) -#define MC33775_PRMM_SYNC_VC10_MW_MSK (0x0U) -#define MC33775_PRMM_SYNC_VC10_RA_MSK (0x0U) -#define MC33775_PRMM_SYNC_VC10_POR_MSK (0xffffU) -#define MC33775_PRMM_SYNC_VC10_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of cell 10 of the last synchronous cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_SYNC_VC10_VALUE_POS (0U) -#define MC33775_PRMM_SYNC_VC10_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_sync_vc10_t; - -/* -------------------------------------------------------------------------- - * PRMM_SYNC_VC11 (read-only):Synchronous measurement result cell 11. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_SYNC_VC11_OFFSET (0x188BU) -#define MC33775_PRMM_SYNC_VC11_RW_MSK (0x0U) -#define MC33775_PRMM_SYNC_VC11_RD_MSK (0xFFFFU) -#define MC33775_PRMM_SYNC_VC11_WR_MSK (0x0U) -#define MC33775_PRMM_SYNC_VC11_MW_MSK (0x0U) -#define MC33775_PRMM_SYNC_VC11_RA_MSK (0x0U) -#define MC33775_PRMM_SYNC_VC11_POR_MSK (0xffffU) -#define MC33775_PRMM_SYNC_VC11_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of cell 11 of the last synchronous cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_SYNC_VC11_VALUE_POS (0U) -#define MC33775_PRMM_SYNC_VC11_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_sync_vc11_t; - -/* -------------------------------------------------------------------------- - * PRMM_SYNC_VC12 (read-only):Synchronous measurement result cell 12. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_SYNC_VC12_OFFSET (0x188CU) -#define MC33775_PRMM_SYNC_VC12_RW_MSK (0x0U) -#define MC33775_PRMM_SYNC_VC12_RD_MSK (0xFFFFU) -#define MC33775_PRMM_SYNC_VC12_WR_MSK (0x0U) -#define MC33775_PRMM_SYNC_VC12_MW_MSK (0x0U) -#define MC33775_PRMM_SYNC_VC12_RA_MSK (0x0U) -#define MC33775_PRMM_SYNC_VC12_POR_MSK (0xffffU) -#define MC33775_PRMM_SYNC_VC12_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of cell 12 of the last synchronous cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_SYNC_VC12_VALUE_POS (0U) -#define MC33775_PRMM_SYNC_VC12_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_sync_vc12_t; - -/* -------------------------------------------------------------------------- - * PRMM_SYNC_VC13 (read-only):Synchronous measurement result cell 13. - * -------------------------------------------------------------------------- */ -#define MC33775_PRMM_SYNC_VC13_OFFSET (0x188DU) -#define MC33775_PRMM_SYNC_VC13_RW_MSK (0x0U) -#define MC33775_PRMM_SYNC_VC13_RD_MSK (0xFFFFU) -#define MC33775_PRMM_SYNC_VC13_WR_MSK (0x0U) -#define MC33775_PRMM_SYNC_VC13_MW_MSK (0x0U) -#define MC33775_PRMM_SYNC_VC13_RA_MSK (0x0U) -#define MC33775_PRMM_SYNC_VC13_POR_MSK (0xffffU) -#define MC33775_PRMM_SYNC_VC13_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of cell 13 of the last synchronous cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_PRMM_SYNC_VC13_VALUE_POS (0U) -#define MC33775_PRMM_SYNC_VC13_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_primary_measurement_registers_prmm_sync_vc13_t; - -/* -------------------------------------------------------------------------- - * SECM_CFG (read-write):General measurement control. - * -------------------------------------------------------------------------- */ -#define MC33775_SECM_CFG_OFFSET (0x1C00U) -#define MC33775_SECM_CFG_RW_MSK (0xFFFFU) -#define MC33775_SECM_CFG_RD_MSK (0xFFFFU) -#define MC33775_SECM_CFG_WR_MSK (0xFFFFU) -#define MC33775_SECM_CFG_MW_MSK (0x0U) -#define MC33775_SECM_CFG_RA_MSK (0x0U) -#define MC33775_SECM_CFG_POR_MSK (0xffffU) -#define MC33775_SECM_CFG_POR_VAL (0x0U) - -/* Field MEASEN: Enable the data acquisition. Setting this bit to zero initiates a result clear and invalidate action (this includes resetting all ready bits). The bit can only be set xxx us after it has been cleared. This bit is cleared when entering Sleep mode. Cyclic measurements are always executed, regardless of the value of this bit. Balancing is not stopped automatically (if in Active mode), as it would be permanently inhibited while measurement is active. If balancing shall be paused, please do so via the balancing control. */ -#define MC33775_SECM_CFG_MEASEN_POS (0U) -#define MC33775_SECM_CFG_MEASEN_MSK (0x1U) - -/* Enumerated value DISABLED: Data acquisition disabled */ -#define MC33775_SECM_CFG_MEASEN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Data acquisition enabled */ -#define MC33775_SECM_CFG_MEASEN_ENABLED_ENUM_VAL (1U) - -/* Field BALPAUSECYCMODEN: Enable balancing autopause. This delays the start of measurements after entering Cyclic mode until the autopause counter has elapsed. This field has no effect in secondary measurement. */ -#define MC33775_SECM_CFG_BALPAUSECYCMODEN_POS (1U) -#define MC33775_SECM_CFG_BALPAUSECYCMODEN_MSK (0x2U) - -/* Enumerated value DISABLED: Autopause for balancing is disabled. */ -#define MC33775_SECM_CFG_BALPAUSECYCMODEN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Autopause for balancing is enabled. Measurements are started when the autopause counter is elapsed. */ -#define MC33775_SECM_CFG_BALPAUSECYCMODEN_ENABLED_ENUM_VAL (1U) - -/* Field BALPAUSELEN: Pause of balancing before measurement cycle is executed. An on-going balancing pause operation is not influenced by a change of this value. 1 LSB = 10us. */ -#define MC33775_SECM_CFG_BALPAUSELEN_POS (2U) -#define MC33775_SECM_CFG_BALPAUSELEN_MSK (0xFFFCU) - -/* Enumerated value NO_PAUSE: No Pause. */ -#define MC33775_SECM_CFG_BALPAUSELEN_NO_PAUSE_ENUM_VAL (0U) - -/* Enumerated value PAUSE_10u: Pause = 10 us */ -#define MC33775_SECM_CFG_BALPAUSELEN_PAUSE_10U_ENUM_VAL (1U) - -/* Enumerated value MAX: Maximum pause = 163830 us = 163 ms */ -#define MC33775_SECM_CFG_BALPAUSELEN_MAX_ENUM_VAL (16383U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t MEASEN : 1; - volatile uint16_t BALPAUSECYCMODEN : 1; - volatile uint16_t BALPAUSELEN : 14; - } B; -} mc33775_secondary_measurement_registers_secm_cfg_t; - -/* -------------------------------------------------------------------------- - * SECM_APP_CTRL (write-only):Application measurement control. - * -------------------------------------------------------------------------- */ -#define MC33775_SECM_APP_CTRL_OFFSET (0x1C01U) -#define MC33775_SECM_APP_CTRL_RW_MSK (0x0U) -#define MC33775_SECM_APP_CTRL_RD_MSK (0x0U) -#define MC33775_SECM_APP_CTRL_WR_MSK (0x83FFU) -#define MC33775_SECM_APP_CTRL_MW_MSK (0x0U) -#define MC33775_SECM_APP_CTRL_RA_MSK (0x0U) -#define MC33775_SECM_APP_CTRL_POR_MSK (0xffffU) -#define MC33775_SECM_APP_CTRL_POR_VAL (0x0U) - -/* Field CAPVC: Trigger the balancing autopause if set in combination with the PAUSEBAL bit. Needed to keep primary and secondary measurement synchron when used via the ALLM access. In primary: Capture the application measurement value of the cell terminal measurements. */ -#define MC33775_SECM_APP_CTRL_CAPVC_POS (0U) -#define MC33775_SECM_APP_CTRL_CAPVC_MSK (0x1U) - -/* Enumerated value NO_CAP: Measurements are not captured. */ -#define MC33775_SECM_APP_CTRL_CAPVC_NO_CAP_ENUM_VAL (0U) - -/* Enumerated value CAP: Measurements are captured. */ -#define MC33775_SECM_APP_CTRL_CAPVC_CAP_ENUM_VAL (1U) - -/* Field CAPVMODULE: Trigger the balancing autopause if set in combination with the PAUSEBAL bit. Needed to keep primary and secondary measurement synchron when used via the ALLM access. In primary: Capture the application measurement value of the module voltage measurement. */ -#define MC33775_SECM_APP_CTRL_CAPVMODULE_POS (1U) -#define MC33775_SECM_APP_CTRL_CAPVMODULE_MSK (0x2U) - -/* Enumerated value NO_CAP: Measurements are not captured. */ -#define MC33775_SECM_APP_CTRL_CAPVMODULE_NO_CAP_ENUM_VAL (0U) - -/* Enumerated value CAP: Measurements are captured. */ -#define MC33775_SECM_APP_CTRL_CAPVMODULE_CAP_ENUM_VAL (1U) - -/* Field CAPAIN0: Trigger the balancing autopause if set in combination with the PAUSEBAL bit. Needed to keep primary and secondary measurement synchron when used via the ALLM access. In primary: Capture the application measurement value of the aux0 terminal measurement. */ -#define MC33775_SECM_APP_CTRL_CAPAIN0_POS (2U) -#define MC33775_SECM_APP_CTRL_CAPAIN0_MSK (0x4U) - -/* Enumerated value NO_CAP: Measurements are not captured. */ -#define MC33775_SECM_APP_CTRL_CAPAIN0_NO_CAP_ENUM_VAL (0U) - -/* Enumerated value CAP: Measurements are captured. */ -#define MC33775_SECM_APP_CTRL_CAPAIN0_CAP_ENUM_VAL (1U) - -/* Field CAPAIN1: Trigger the balancing autopause if set in combination with the PAUSEBAL bit. Needed to keep primary and secondary measurement synchron when used via the ALLM access. In primary: Capture the application measurement value of the aux1 terminal measurement. */ -#define MC33775_SECM_APP_CTRL_CAPAIN1_POS (3U) -#define MC33775_SECM_APP_CTRL_CAPAIN1_MSK (0x8U) - -/* Enumerated value NO_CAP: Measurements are not captured. */ -#define MC33775_SECM_APP_CTRL_CAPAIN1_NO_CAP_ENUM_VAL (0U) - -/* Enumerated value CAP: Measurements are captured. */ -#define MC33775_SECM_APP_CTRL_CAPAIN1_CAP_ENUM_VAL (1U) - -/* Field CAPAIN2: Trigger the balancing autopause if set in combination with the PAUSEBAL bit. Needed to keep primary and secondary measurement synchron when used via the ALLM access. In primary: Capture the application measurement value of the aux2 terminal measurement. */ -#define MC33775_SECM_APP_CTRL_CAPAIN2_POS (4U) -#define MC33775_SECM_APP_CTRL_CAPAIN2_MSK (0x10U) - -/* Enumerated value NO_CAP: Measurements are not captured. */ -#define MC33775_SECM_APP_CTRL_CAPAIN2_NO_CAP_ENUM_VAL (0U) - -/* Enumerated value CAP: Measurements are captured. */ -#define MC33775_SECM_APP_CTRL_CAPAIN2_CAP_ENUM_VAL (1U) - -/* Field CAPAIN3: Trigger the balancing autopause if set in combination with the PAUSEBAL bit. Needed to keep primary and secondary measurement synchron when used via the ALLM access. In primary: Capture the application measurement value of the aux3 terminal measurement. */ -#define MC33775_SECM_APP_CTRL_CAPAIN3_POS (5U) -#define MC33775_SECM_APP_CTRL_CAPAIN3_MSK (0x20U) - -/* Enumerated value NO_CAP: Measurements are not captured. */ -#define MC33775_SECM_APP_CTRL_CAPAIN3_NO_CAP_ENUM_VAL (0U) - -/* Enumerated value CAP: Measurements are captured. */ -#define MC33775_SECM_APP_CTRL_CAPAIN3_CAP_ENUM_VAL (1U) - -/* Field CAPAIN4: Capture the application measurement value of the aux4 terminal measurement. The values are now readable via the app_result register. This bit is only available in the secondary measurement chain. */ -#define MC33775_SECM_APP_CTRL_CAPAIN4_POS (6U) -#define MC33775_SECM_APP_CTRL_CAPAIN4_MSK (0x40U) - -/* Enumerated value NO_CAP: Measurements are not captured. */ -#define MC33775_SECM_APP_CTRL_CAPAIN4_NO_CAP_ENUM_VAL (0U) - -/* Enumerated value CAP: Measurements are captured. */ -#define MC33775_SECM_APP_CTRL_CAPAIN4_CAP_ENUM_VAL (1U) - -/* Field CAPAIN5: Capture the application measurement value of the aux5 terminal measurement. The values are now readable via the app_result register. This bit is only available in the secondary measurement chain. */ -#define MC33775_SECM_APP_CTRL_CAPAIN5_POS (7U) -#define MC33775_SECM_APP_CTRL_CAPAIN5_MSK (0x80U) - -/* Enumerated value NO_CAP: Measurements are not captured. */ -#define MC33775_SECM_APP_CTRL_CAPAIN5_NO_CAP_ENUM_VAL (0U) - -/* Enumerated value CAP: Measurements are captured. */ -#define MC33775_SECM_APP_CTRL_CAPAIN5_CAP_ENUM_VAL (1U) - -/* Field CAPAIN6: Capture the application measurement value of the aux6 terminal measurement. The values are now readable via the app_result register. This bit is only available in the secondary measurement chain. */ -#define MC33775_SECM_APP_CTRL_CAPAIN6_POS (8U) -#define MC33775_SECM_APP_CTRL_CAPAIN6_MSK (0x100U) - -/* Enumerated value NO_CAP: Measurements are not captured. */ -#define MC33775_SECM_APP_CTRL_CAPAIN6_NO_CAP_ENUM_VAL (0U) - -/* Enumerated value CAP: Measurements are captured. */ -#define MC33775_SECM_APP_CTRL_CAPAIN6_CAP_ENUM_VAL (1U) - -/* Field CAPAIN7: Capture the application measurement value of the aux7 terminal measurement. The values are now readable via the app_result register. This bit is only available in the secondary measurement chain. */ -#define MC33775_SECM_APP_CTRL_CAPAIN7_POS (9U) -#define MC33775_SECM_APP_CTRL_CAPAIN7_MSK (0x200U) - -/* Enumerated value NO_CAP: Measurements are not captured. */ -#define MC33775_SECM_APP_CTRL_CAPAIN7_NO_CAP_ENUM_VAL (0U) - -/* Enumerated value CAP: Measurements are captured. */ -#define MC33775_SECM_APP_CTRL_CAPAIN7_CAP_ENUM_VAL (1U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_SECM_APP_CTRL_RESERVED0_POS (10U) -#define MC33775_SECM_APP_CTRL_RESERVED0_MSK (0x7C00U) - -/* Field PAUSEBAL: Pause the balancing during this capture cycle. If balancing was not paused before, the start of data capture is delayed until the autopause timer has elapsed. This field has no effect in secondary measurement. */ -#define MC33775_SECM_APP_CTRL_PAUSEBAL_POS (15U) -#define MC33775_SECM_APP_CTRL_PAUSEBAL_MSK (0x8000U) - -/* Enumerated value NO_PAUSE: Continue with balancing. */ -#define MC33775_SECM_APP_CTRL_PAUSEBAL_NO_PAUSE_ENUM_VAL (0U) - -/* Enumerated value PAUSE: Pause the balancing during this capture cycle. */ -#define MC33775_SECM_APP_CTRL_PAUSEBAL_PAUSE_ENUM_VAL (1U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t CAPVC : 1; - volatile uint16_t CAPVMODULE : 1; - volatile uint16_t CAPAIN0 : 1; - volatile uint16_t CAPAIN1 : 1; - volatile uint16_t CAPAIN2 : 1; - volatile uint16_t CAPAIN3 : 1; - volatile uint16_t CAPAIN4 : 1; - volatile uint16_t CAPAIN5 : 1; - volatile uint16_t CAPAIN6 : 1; - volatile uint16_t CAPAIN7 : 1; - volatile uint16_t reserved0 : 5; - volatile uint16_t PAUSEBAL : 1; - } B; -} mc33775_secondary_measurement_registers_secm_app_ctrl_t; - -/* -------------------------------------------------------------------------- - * SECM_PER_CTRL (read-write):Periodic measurement control. - * -------------------------------------------------------------------------- */ -#define MC33775_SECM_PER_CTRL_OFFSET (0x1C02U) -#define MC33775_SECM_PER_CTRL_RW_MSK (0x31FFU) -#define MC33775_SECM_PER_CTRL_RD_MSK (0x31FFU) -#define MC33775_SECM_PER_CTRL_WR_MSK (0x31FFU) -#define MC33775_SECM_PER_CTRL_MW_MSK (0x0U) -#define MC33775_SECM_PER_CTRL_RA_MSK (0x0U) -#define MC33775_SECM_PER_CTRL_POR_MSK (0xffffU) -#define MC33775_SECM_PER_CTRL_POR_VAL (0x10U) - -/* Field PERLEN: Number of measurements for one periodic measurement. The minimum is 16. Writing a value lower than 16 leads to a 16 in the register. */ -#define MC33775_SECM_PER_CTRL_PERLEN_POS (0U) -#define MC33775_SECM_PER_CTRL_PERLEN_MSK (0x1FFU) - -/* Enumerated value PER_16: minimum value = 16 measurements per period */ -#define MC33775_SECM_PER_CTRL_PERLEN_PER_16_ENUM_VAL (16U) - -/* Enumerated value PER_17: 17 measurements per period */ -#define MC33775_SECM_PER_CTRL_PERLEN_PER_17_ENUM_VAL (17U) - -/* Enumerated value PER_MAX: maximum value = 511 measurements per period */ -#define MC33775_SECM_PER_CTRL_PERLEN_PER_MAX_ENUM_VAL (511U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_SECM_PER_CTRL_RESERVED0_POS (9U) -#define MC33775_SECM_PER_CTRL_RESERVED0_MSK (0xE00U) - -/* Field PERCTRL: Control the periodic result behavior. */ -#define MC33775_SECM_PER_CTRL_PERCTRL_POS (12U) -#define MC33775_SECM_PER_CTRL_PERCTRL_MSK (0x3000U) - -/* Enumerated value AUTO: Periodic results are automatically updated */ -#define MC33775_SECM_PER_CTRL_PERCTRL_AUTO_ENUM_VAL (0U) - -/* Enumerated value RESERVED: reserved */ -#define MC33775_SECM_PER_CTRL_PERCTRL_RESERVED_ENUM_VAL (1U) - -/* Enumerated value HOLD: Periodic results are held */ -#define MC33775_SECM_PER_CTRL_PERCTRL_HOLD_ENUM_VAL (2U) - -/* Enumerated value ONCE: Periodic results are updated once with the last results. (each write updates the results). */ -#define MC33775_SECM_PER_CTRL_PERCTRL_ONCE_ENUM_VAL (3U) - -/* Field reserved1: This read-only field is reserved and always has the value 0. */ -#define MC33775_SECM_PER_CTRL_RESERVED1_POS (14U) -#define MC33775_SECM_PER_CTRL_RESERVED1_MSK (0xC000U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t PERLEN : 9; - volatile uint16_t reserved0 : 3; - volatile uint16_t PERCTRL : 2; - volatile uint16_t reserved1 : 2; - } B; -} mc33775_secondary_measurement_registers_secm_per_ctrl_t; - -/* -------------------------------------------------------------------------- - * SECM_SYNC_CTRL (read-write):Synchronous measurement control. - * -------------------------------------------------------------------------- */ -#define MC33775_SECM_SYNC_CTRL_OFFSET (0x1C03U) -#define MC33775_SECM_SYNC_CTRL_RW_MSK (0x7C00U) -#define MC33775_SECM_SYNC_CTRL_RD_MSK (0x7C00U) -#define MC33775_SECM_SYNC_CTRL_WR_MSK (0xFC03U) -#define MC33775_SECM_SYNC_CTRL_MW_MSK (0x0U) -#define MC33775_SECM_SYNC_CTRL_RA_MSK (0x0U) -#define MC33775_SECM_SYNC_CTRL_POR_MSK (0xffffU) -#define MC33775_SECM_SYNC_CTRL_POR_VAL (0x7c00U) - -/* Field SYNCCYC: Start a synchronous measurement cycle. In this cycle the CT and CB voltages are measured and stored as matching pairs. If no VB channel is enabled or if set during a running synchronous measurement cycle or a running Fast VB cycle, the set is ignored. Read as zero. */ -#define MC33775_SECM_SYNC_CTRL_SYNCCYC_POS (0U) -#define MC33775_SECM_SYNC_CTRL_SYNCCYC_MSK (0x1U) - -/* Enumerated value NO_START: No new start a synchronous measurement cycle. */ -#define MC33775_SECM_SYNC_CTRL_SYNCCYC_NO_START_ENUM_VAL (0U) - -/* Enumerated value STATUS: Read as zero. */ -#define MC33775_SECM_SYNC_CTRL_SYNCCYC_STATUS_ENUM_VAL (0U) - -/* Enumerated value START: Start a synchronous measurement cycle. */ -#define MC33775_SECM_SYNC_CTRL_SYNCCYC_START_ENUM_VAL (1U) - -/* Field FASTVB: Start a Fast VB measurement cycle. In this cycle the CB voltages are measured (with 24 chopped cycles each) and stored in the Sync result registers. If set together with SYNCCYC or during an active synchronous measurement cycle, this bit is ignored. Read as zero. */ -#define MC33775_SECM_SYNC_CTRL_FASTVB_POS (1U) -#define MC33775_SECM_SYNC_CTRL_FASTVB_MSK (0x2U) - -/* Enumerated value NO_FAST: No new start of a fast VB measurement cycle. */ -#define MC33775_SECM_SYNC_CTRL_FASTVB_NO_FAST_ENUM_VAL (0U) - -/* Enumerated value STATUS: Read as zero. */ -#define MC33775_SECM_SYNC_CTRL_FASTVB_STATUS_ENUM_VAL (0U) - -/* Enumerated value FAST: Start a new fast VB measurement cycle. */ -#define MC33775_SECM_SYNC_CTRL_FASTVB_FAST_ENUM_VAL (1U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_SECM_SYNC_CTRL_RESERVED0_POS (2U) -#define MC33775_SECM_SYNC_CTRL_RESERVED0_MSK (0x3FCU) - -/* Field VBOLNUM: VB number for which the open load detection is enabled. 0 - 13 = channel for which the open load detection is enabled. 14 - 29 = reserved (no open load detection mechanism is enabled). 30 = the open load detection is enabled for the currently measured channel. */ -#define MC33775_SECM_SYNC_CTRL_VBOLNUM_POS (10U) -#define MC33775_SECM_SYNC_CTRL_VBOLNUM_MSK (0x7C00U) - -/* Enumerated value DISABLED: Open load detection is disabled */ -#define MC33775_SECM_SYNC_CTRL_VBOLNUM_DISABLED_ENUM_VAL (31U) - -/* Field PAUSEBAL: Pause the balancing during this capture cycle. If balancing was not paused before, the start of data capture is delayed until the autopause timer has elapsed. If no capture cycle is started this bit is ignored. */ -#define MC33775_SECM_SYNC_CTRL_PAUSEBAL_POS (15U) -#define MC33775_SECM_SYNC_CTRL_PAUSEBAL_MSK (0x8000U) - -/* Enumerated value NO_PAUSE: Continue with balancing. */ -#define MC33775_SECM_SYNC_CTRL_PAUSEBAL_NO_PAUSE_ENUM_VAL (0U) - -/* Enumerated value PAUSE: Pause the balancing during this capture cycle. */ -#define MC33775_SECM_SYNC_CTRL_PAUSEBAL_PAUSE_ENUM_VAL (1U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t SYNCCYC : 1; - volatile uint16_t FASTVB : 1; - volatile uint16_t reserved0 : 8; - volatile uint16_t VBOLNUM : 5; - volatile uint16_t PAUSEBAL : 1; - } B; -} mc33775_secondary_measurement_registers_secm_sync_ctrl_t; - -/* -------------------------------------------------------------------------- - * SECM_VB_CFG (read-write):Balance voltage measurement enable. - * -------------------------------------------------------------------------- */ -#define MC33775_SECM_VB_CFG_OFFSET (0x1C08U) -#define MC33775_SECM_VB_CFG_RW_MSK (0x3FFFU) -#define MC33775_SECM_VB_CFG_RD_MSK (0x3FFFU) -#define MC33775_SECM_VB_CFG_WR_MSK (0x3FFFU) -#define MC33775_SECM_VB_CFG_MW_MSK (0x0U) -#define MC33775_SECM_VB_CFG_RA_MSK (0x0U) -#define MC33775_SECM_VB_CFG_POR_MSK (0xffffU) -#define MC33775_SECM_VB_CFG_POR_VAL (0x0U) - -/* Field VB0EN: Enable measurement of balance voltage 0. Changes to this bit during active measurement can lead to undefined results. */ -#define MC33775_SECM_VB_CFG_VB0EN_POS (0U) -#define MC33775_SECM_VB_CFG_VB0EN_MSK (0x1U) - -/* Enumerated value DISABLED: Measurement disabled */ -#define MC33775_SECM_VB_CFG_VB0EN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Measurement enabled */ -#define MC33775_SECM_VB_CFG_VB0EN_ENABLED_ENUM_VAL (1U) - -/* Field VB1EN: Enable measurement of balance voltage 1. Changes to this bit during active measurement can lead to undefined results. */ -#define MC33775_SECM_VB_CFG_VB1EN_POS (1U) -#define MC33775_SECM_VB_CFG_VB1EN_MSK (0x2U) - -/* Enumerated value DISABLED: Measurement disabled */ -#define MC33775_SECM_VB_CFG_VB1EN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Measurement enabled */ -#define MC33775_SECM_VB_CFG_VB1EN_ENABLED_ENUM_VAL (1U) - -/* Field VB2EN: Enable measurement of balance voltage 2. Changes to this bit during active measurement can lead to undefined results. */ -#define MC33775_SECM_VB_CFG_VB2EN_POS (2U) -#define MC33775_SECM_VB_CFG_VB2EN_MSK (0x4U) - -/* Enumerated value DISABLED: Measurement disabled */ -#define MC33775_SECM_VB_CFG_VB2EN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Measurement enabled */ -#define MC33775_SECM_VB_CFG_VB2EN_ENABLED_ENUM_VAL (1U) - -/* Field VB3EN: Enable measurement of balance voltage 3. Changes to this bit during active measurement can lead to undefined results. */ -#define MC33775_SECM_VB_CFG_VB3EN_POS (3U) -#define MC33775_SECM_VB_CFG_VB3EN_MSK (0x8U) - -/* Enumerated value DISABLED: Measurement disabled */ -#define MC33775_SECM_VB_CFG_VB3EN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Measurement enabled */ -#define MC33775_SECM_VB_CFG_VB3EN_ENABLED_ENUM_VAL (1U) - -/* Field VB4EN: Enable measurement of balance voltage 4. Changes to this bit during active measurement can lead to undefined results. */ -#define MC33775_SECM_VB_CFG_VB4EN_POS (4U) -#define MC33775_SECM_VB_CFG_VB4EN_MSK (0x10U) - -/* Enumerated value DISABLED: Measurement disabled */ -#define MC33775_SECM_VB_CFG_VB4EN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Measurement enabled */ -#define MC33775_SECM_VB_CFG_VB4EN_ENABLED_ENUM_VAL (1U) - -/* Field VB5EN: Enable measurement of balance voltage 5. Changes to this bit during active measurement can lead to undefined results. */ -#define MC33775_SECM_VB_CFG_VB5EN_POS (5U) -#define MC33775_SECM_VB_CFG_VB5EN_MSK (0x20U) - -/* Enumerated value DISABLED: Measurement disabled */ -#define MC33775_SECM_VB_CFG_VB5EN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Measurement enabled */ -#define MC33775_SECM_VB_CFG_VB5EN_ENABLED_ENUM_VAL (1U) - -/* Field VB6EN: Enable measurement of balance voltage 6. Changes to this bit during active measurement can lead to undefined results. */ -#define MC33775_SECM_VB_CFG_VB6EN_POS (6U) -#define MC33775_SECM_VB_CFG_VB6EN_MSK (0x40U) - -/* Enumerated value DISABLED: Measurement disabled */ -#define MC33775_SECM_VB_CFG_VB6EN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Measurement enabled */ -#define MC33775_SECM_VB_CFG_VB6EN_ENABLED_ENUM_VAL (1U) - -/* Field VB7EN: Enable measurement of balance voltage 7. Changes to this bit during active measurement can lead to undefined results. */ -#define MC33775_SECM_VB_CFG_VB7EN_POS (7U) -#define MC33775_SECM_VB_CFG_VB7EN_MSK (0x80U) - -/* Enumerated value DISABLED: Measurement disabled */ -#define MC33775_SECM_VB_CFG_VB7EN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Measurement enabled */ -#define MC33775_SECM_VB_CFG_VB7EN_ENABLED_ENUM_VAL (1U) - -/* Field VB8EN: Enable measurement of balance voltage 8. Changes to this bit during active measurement can lead to undefined results. */ -#define MC33775_SECM_VB_CFG_VB8EN_POS (8U) -#define MC33775_SECM_VB_CFG_VB8EN_MSK (0x100U) - -/* Enumerated value DISABLED: Measurement disabled */ -#define MC33775_SECM_VB_CFG_VB8EN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Measurement enabled */ -#define MC33775_SECM_VB_CFG_VB8EN_ENABLED_ENUM_VAL (1U) - -/* Field VB9EN: Enable measurement of balance voltage 9. Changes to this bit during active measurement can lead to undefined results. */ -#define MC33775_SECM_VB_CFG_VB9EN_POS (9U) -#define MC33775_SECM_VB_CFG_VB9EN_MSK (0x200U) - -/* Enumerated value DISABLED: Measurement disabled */ -#define MC33775_SECM_VB_CFG_VB9EN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Measurement enabled */ -#define MC33775_SECM_VB_CFG_VB9EN_ENABLED_ENUM_VAL (1U) - -/* Field VB10EN: Enable measurement of balance voltage 10. Changes to this bit during active measurement can lead to undefined results. */ -#define MC33775_SECM_VB_CFG_VB10EN_POS (10U) -#define MC33775_SECM_VB_CFG_VB10EN_MSK (0x400U) - -/* Enumerated value DISABLED: Measurement disabled */ -#define MC33775_SECM_VB_CFG_VB10EN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Measurement enabled */ -#define MC33775_SECM_VB_CFG_VB10EN_ENABLED_ENUM_VAL (1U) - -/* Field VB11EN: Enable measurement of balance voltage 11. Changes to this bit during active measurement can lead to undefined results. */ -#define MC33775_SECM_VB_CFG_VB11EN_POS (11U) -#define MC33775_SECM_VB_CFG_VB11EN_MSK (0x800U) - -/* Enumerated value DISABLED: Measurement disabled */ -#define MC33775_SECM_VB_CFG_VB11EN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Measurement enabled */ -#define MC33775_SECM_VB_CFG_VB11EN_ENABLED_ENUM_VAL (1U) - -/* Field VB12EN: Enable measurement of balance voltage 12. Changes to this bit during active measurement can lead to undefined results. */ -#define MC33775_SECM_VB_CFG_VB12EN_POS (12U) -#define MC33775_SECM_VB_CFG_VB12EN_MSK (0x1000U) - -/* Enumerated value DISABLED: Measurement disabled */ -#define MC33775_SECM_VB_CFG_VB12EN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Measurement enabled */ -#define MC33775_SECM_VB_CFG_VB12EN_ENABLED_ENUM_VAL (1U) - -/* Field VB13EN: Enable measurement of balance voltage 13. Changes to this bit during active measurement can lead to undefined results. */ -#define MC33775_SECM_VB_CFG_VB13EN_POS (13U) -#define MC33775_SECM_VB_CFG_VB13EN_MSK (0x2000U) - -/* Enumerated value DISABLED: Measurement disabled */ -#define MC33775_SECM_VB_CFG_VB13EN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Measurement enabled */ -#define MC33775_SECM_VB_CFG_VB13EN_ENABLED_ENUM_VAL (1U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_SECM_VB_CFG_RESERVED0_POS (14U) -#define MC33775_SECM_VB_CFG_RESERVED0_MSK (0xC000U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VB0EN : 1; - volatile uint16_t VB1EN : 1; - volatile uint16_t VB2EN : 1; - volatile uint16_t VB3EN : 1; - volatile uint16_t VB4EN : 1; - volatile uint16_t VB5EN : 1; - volatile uint16_t VB6EN : 1; - volatile uint16_t VB7EN : 1; - volatile uint16_t VB8EN : 1; - volatile uint16_t VB9EN : 1; - volatile uint16_t VB10EN : 1; - volatile uint16_t VB11EN : 1; - volatile uint16_t VB12EN : 1; - volatile uint16_t VB13EN : 1; - volatile uint16_t reserved0 : 2; - } B; -} mc33775_secondary_measurement_registers_secm_vb_cfg_t; - -/* -------------------------------------------------------------------------- - * SECM_AIN_CFG (read-write):Measurement enables for extra channel. - * -------------------------------------------------------------------------- */ -#define MC33775_SECM_AIN_CFG_OFFSET (0x1C09U) -#define MC33775_SECM_AIN_CFG_RW_MSK (0xFF8FU) -#define MC33775_SECM_AIN_CFG_RD_MSK (0xFF8FU) -#define MC33775_SECM_AIN_CFG_WR_MSK (0xFF8FU) -#define MC33775_SECM_AIN_CFG_MW_MSK (0x0U) -#define MC33775_SECM_AIN_CFG_RA_MSK (0x0U) -#define MC33775_SECM_AIN_CFG_POR_MSK (0xffffU) -#define MC33775_SECM_AIN_CFG_POR_VAL (0x80U) - -/* Field AIN4EN: Enable measurement of AIN4. Changes to this bit during active measurement can lead to undefined results. Note: TBC Switches the GPIO4/AIN4 to the analog measurement function. */ -#define MC33775_SECM_AIN_CFG_AIN4EN_POS (0U) -#define MC33775_SECM_AIN_CFG_AIN4EN_MSK (0x1U) - -/* Enumerated value DISABLED: Measurement disabled */ -#define MC33775_SECM_AIN_CFG_AIN4EN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Measurement enabled */ -#define MC33775_SECM_AIN_CFG_AIN4EN_ENABLED_ENUM_VAL (1U) - -/* Field AIN5EN: Enable measurement of AIN5. Changes to this bit during active measurement can lead to undefined results. */ -#define MC33775_SECM_AIN_CFG_AIN5EN_POS (1U) -#define MC33775_SECM_AIN_CFG_AIN5EN_MSK (0x2U) - -/* Enumerated value DISABLED: Measurement disabled */ -#define MC33775_SECM_AIN_CFG_AIN5EN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Measurement enabled */ -#define MC33775_SECM_AIN_CFG_AIN5EN_ENABLED_ENUM_VAL (1U) - -/* Field AIN6EN: Enable measurement of AIN6. Changes to this bit during active measurement can lead to undefined results. */ -#define MC33775_SECM_AIN_CFG_AIN6EN_POS (2U) -#define MC33775_SECM_AIN_CFG_AIN6EN_MSK (0x4U) - -/* Enumerated value DISABLED: Measurement disabled */ -#define MC33775_SECM_AIN_CFG_AIN6EN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Measurement enabled */ -#define MC33775_SECM_AIN_CFG_AIN6EN_ENABLED_ENUM_VAL (1U) - -/* Field AIN7EN: Enable measurement of AIN7. Changes to this bit during active measurement can lead to undefined results. */ -#define MC33775_SECM_AIN_CFG_AIN7EN_POS (3U) -#define MC33775_SECM_AIN_CFG_AIN7EN_MSK (0x8U) - -/* Enumerated value DISABLED: Measurement disabled */ -#define MC33775_SECM_AIN_CFG_AIN7EN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Measurement enabled */ -#define MC33775_SECM_AIN_CFG_AIN7EN_ENABLED_ENUM_VAL (1U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_SECM_AIN_CFG_RESERVED0_POS (4U) -#define MC33775_SECM_AIN_CFG_RESERVED0_MSK (0x70U) - -/* Field FLTAPPINV: Invalidate AINx application results in case of fault. */ -#define MC33775_SECM_AIN_CFG_FLTAPPINV_POS (7U) -#define MC33775_SECM_AIN_CFG_FLTAPPINV_MSK (0x80U) - -/* Enumerated value VAILD: AINx application results are not invalidated in case of a fault */ -#define MC33775_SECM_AIN_CFG_FLTAPPINV_VAILD_ENUM_VAL (0U) - -/* Enumerated value INVALID: AINx application results are invalidated when a fault is detected. */ -#define MC33775_SECM_AIN_CFG_FLTAPPINV_INVALID_ENUM_VAL (1U) - -/* Field RATIOMETRICAIN4: Reference selection for AIN4. Changes to these bits during active measurement can lead to undefined results. */ -#define MC33775_SECM_AIN_CFG_RATIOMETRICAIN4_POS (8U) -#define MC33775_SECM_AIN_CFG_RATIOMETRICAIN4_MSK (0x300U) - -/* Enumerated value SECVREF: Absolute (SECVREF) */ -#define MC33775_SECM_AIN_CFG_RATIOMETRICAIN4_SECVREF_ENUM_VAL (0U) - -/* Enumerated value RESERVED: reserved */ -#define MC33775_SECM_AIN_CFG_RATIOMETRICAIN4_RESERVED_ENUM_VAL (1U) - -/* Enumerated value VAUX: Ratiometric (VAUX) */ -#define MC33775_SECM_AIN_CFG_RATIOMETRICAIN4_VAUX_ENUM_VAL (2U) - -/* Enumerated value VDDC: Ratiometric (VDDC) */ -#define MC33775_SECM_AIN_CFG_RATIOMETRICAIN4_VDDC_ENUM_VAL (3U) - -/* Field RATIOMETRICAIN5: Reference selection for AIN5. Changes to these bits during active measurement can lead to undefined results. */ -#define MC33775_SECM_AIN_CFG_RATIOMETRICAIN5_POS (10U) -#define MC33775_SECM_AIN_CFG_RATIOMETRICAIN5_MSK (0xC00U) - -/* Enumerated value SECVREF: Absolute (SECVREF) */ -#define MC33775_SECM_AIN_CFG_RATIOMETRICAIN5_SECVREF_ENUM_VAL (0U) - -/* Enumerated value RESERVED: reserved */ -#define MC33775_SECM_AIN_CFG_RATIOMETRICAIN5_RESERVED_ENUM_VAL (1U) - -/* Enumerated value VAUX: Ratiometric (VAUX) */ -#define MC33775_SECM_AIN_CFG_RATIOMETRICAIN5_VAUX_ENUM_VAL (2U) - -/* Enumerated value VDDC: Ratiometric (VDDC) */ -#define MC33775_SECM_AIN_CFG_RATIOMETRICAIN5_VDDC_ENUM_VAL (3U) - -/* Field RATIOMETRICAIN6: Reference selection for AIN6. Changes to these bits during active measurement can lead to undefined results. */ -#define MC33775_SECM_AIN_CFG_RATIOMETRICAIN6_POS (12U) -#define MC33775_SECM_AIN_CFG_RATIOMETRICAIN6_MSK (0x3000U) - -/* Enumerated value SECVREF: Absolute (SECVREF) */ -#define MC33775_SECM_AIN_CFG_RATIOMETRICAIN6_SECVREF_ENUM_VAL (0U) - -/* Enumerated value RESERVED: reserved */ -#define MC33775_SECM_AIN_CFG_RATIOMETRICAIN6_RESERVED_ENUM_VAL (1U) - -/* Enumerated value VAUX: Ratiometric (VAUX) */ -#define MC33775_SECM_AIN_CFG_RATIOMETRICAIN6_VAUX_ENUM_VAL (2U) - -/* Enumerated value VDDC: Ratiometric (VDDC) */ -#define MC33775_SECM_AIN_CFG_RATIOMETRICAIN6_VDDC_ENUM_VAL (3U) - -/* Field RATIOMETRICAIN7: Reference selection for AIN7. Changes to these bits during active measurement can lead to undefined results. */ -#define MC33775_SECM_AIN_CFG_RATIOMETRICAIN7_POS (14U) -#define MC33775_SECM_AIN_CFG_RATIOMETRICAIN7_MSK (0xC000U) - -/* Enumerated value SECVREF: Absolute (SECVREF) */ -#define MC33775_SECM_AIN_CFG_RATIOMETRICAIN7_SECVREF_ENUM_VAL (0U) - -/* Enumerated value RESERVED: reserved */ -#define MC33775_SECM_AIN_CFG_RATIOMETRICAIN7_RESERVED_ENUM_VAL (1U) - -/* Enumerated value VAUX: Ratiometric (VAUX) */ -#define MC33775_SECM_AIN_CFG_RATIOMETRICAIN7_VAUX_ENUM_VAL (2U) - -/* Enumerated value VDDC: Ratiometric (VDDC) */ -#define MC33775_SECM_AIN_CFG_RATIOMETRICAIN7_VDDC_ENUM_VAL (3U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t AIN4EN : 1; - volatile uint16_t AIN5EN : 1; - volatile uint16_t AIN6EN : 1; - volatile uint16_t AIN7EN : 1; - volatile uint16_t reserved0 : 3; - volatile uint16_t FLTAPPINV : 1; - volatile uint16_t RATIOMETRICAIN4 : 2; - volatile uint16_t RATIOMETRICAIN5 : 2; - volatile uint16_t RATIOMETRICAIN6 : 2; - volatile uint16_t RATIOMETRICAIN7 : 2; - } B; -} mc33775_secondary_measurement_registers_secm_ain_cfg_t; - -/* -------------------------------------------------------------------------- - * SECM_AIN_OL_CFG (read-write):AINx open_load detection enable. - * -------------------------------------------------------------------------- */ -#define MC33775_SECM_AIN_OL_CFG_OFFSET (0x1C0AU) -#define MC33775_SECM_AIN_OL_CFG_RW_MSK (0xFU) -#define MC33775_SECM_AIN_OL_CFG_RD_MSK (0xFU) -#define MC33775_SECM_AIN_OL_CFG_WR_MSK (0xFU) -#define MC33775_SECM_AIN_OL_CFG_MW_MSK (0x0U) -#define MC33775_SECM_AIN_OL_CFG_RA_MSK (0x0U) -#define MC33775_SECM_AIN_OL_CFG_POR_MSK (0xffffU) -#define MC33775_SECM_AIN_OL_CFG_POR_VAL (0x0U) - -/* Field AIN4EN: Open load detection circuit for AIN4 */ -#define MC33775_SECM_AIN_OL_CFG_AIN4EN_POS (0U) -#define MC33775_SECM_AIN_OL_CFG_AIN4EN_MSK (0x1U) - -/* Enumerated value DISABLED: Disable the open load detection circuit. */ -#define MC33775_SECM_AIN_OL_CFG_AIN4EN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Enable the open load detection circuit. */ -#define MC33775_SECM_AIN_OL_CFG_AIN4EN_ENABLED_ENUM_VAL (1U) - -/* Field AIN5EN: Open load detection circuit for AIN5 */ -#define MC33775_SECM_AIN_OL_CFG_AIN5EN_POS (1U) -#define MC33775_SECM_AIN_OL_CFG_AIN5EN_MSK (0x2U) - -/* Enumerated value DISABLED: Disable the open load detection circuit. */ -#define MC33775_SECM_AIN_OL_CFG_AIN5EN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Enable the open load detection circuit. */ -#define MC33775_SECM_AIN_OL_CFG_AIN5EN_ENABLED_ENUM_VAL (1U) - -/* Field AIN6EN: Open load detection circuit for AIN6 */ -#define MC33775_SECM_AIN_OL_CFG_AIN6EN_POS (2U) -#define MC33775_SECM_AIN_OL_CFG_AIN6EN_MSK (0x4U) - -/* Enumerated value DISABLED: Disable the open load detection circuit. */ -#define MC33775_SECM_AIN_OL_CFG_AIN6EN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Enable the open load detection circuit. */ -#define MC33775_SECM_AIN_OL_CFG_AIN6EN_ENABLED_ENUM_VAL (1U) - -/* Field AIN7EN: Open load detection circuit for AIN7 */ -#define MC33775_SECM_AIN_OL_CFG_AIN7EN_POS (3U) -#define MC33775_SECM_AIN_OL_CFG_AIN7EN_MSK (0x8U) - -/* Enumerated value DISABLED: Disable the open load detection circuit. */ -#define MC33775_SECM_AIN_OL_CFG_AIN7EN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Enable the open load detection circuit. */ -#define MC33775_SECM_AIN_OL_CFG_AIN7EN_ENABLED_ENUM_VAL (1U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_SECM_AIN_OL_CFG_RESERVED0_POS (4U) -#define MC33775_SECM_AIN_OL_CFG_RESERVED0_MSK (0xFFF0U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t AIN4EN : 1; - volatile uint16_t AIN5EN : 1; - volatile uint16_t AIN6EN : 1; - volatile uint16_t AIN7EN : 1; - volatile uint16_t reserved0 : 12; - } B; -} mc33775_secondary_measurement_registers_secm_ain_ol_cfg_t; - -/* -------------------------------------------------------------------------- - * SECM_VDIV_CFG (read-write):Voltage divider enable. - * -------------------------------------------------------------------------- */ -#define MC33775_SECM_VDIV_CFG_OFFSET (0x1C0BU) -#define MC33775_SECM_VDIV_CFG_RW_MSK (0x3U) -#define MC33775_SECM_VDIV_CFG_RD_MSK (0x3U) -#define MC33775_SECM_VDIV_CFG_WR_MSK (0x3U) -#define MC33775_SECM_VDIV_CFG_MW_MSK (0x0U) -#define MC33775_SECM_VDIV_CFG_RA_MSK (0x0U) -#define MC33775_SECM_VDIV_CFG_POR_MSK (0xffffU) -#define MC33775_SECM_VDIV_CFG_POR_VAL (0x3U) - -/* Field VAUXEN: Enable the voltage divider for secondary VAUX measurement. */ -#define MC33775_SECM_VDIV_CFG_VAUXEN_POS (0U) -#define MC33775_SECM_VDIV_CFG_VAUXEN_MSK (0x1U) - -/* Enumerated value DISABLED: Voltage divider for VAUX is disabled. */ -#define MC33775_SECM_VDIV_CFG_VAUXEN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Voltage divider for VAUX is enabled. */ -#define MC33775_SECM_VDIV_CFG_VAUXEN_ENABLED_ENUM_VAL (1U) - -/* Field VDDCEN: Enable the voltage divider for secondary VDDC measurement. */ -#define MC33775_SECM_VDIV_CFG_VDDCEN_POS (1U) -#define MC33775_SECM_VDIV_CFG_VDDCEN_MSK (0x2U) - -/* Enumerated value DISABLED: Voltage divider for VDDC is disabled. */ -#define MC33775_SECM_VDIV_CFG_VDDCEN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Voltage divider for VDDC is enabled. */ -#define MC33775_SECM_VDIV_CFG_VDDCEN_ENABLED_ENUM_VAL (1U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_SECM_VDIV_CFG_RESERVED0_POS (2U) -#define MC33775_SECM_VDIV_CFG_RESERVED0_MSK (0xFFFCU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VAUXEN : 1; - volatile uint16_t VDDCEN : 1; - volatile uint16_t reserved0 : 14; - } B; -} mc33775_secondary_measurement_registers_secm_vdiv_cfg_t; - -/* -------------------------------------------------------------------------- - * SECM_CAL_CRC (read-write):CRC over calibration data. - * -------------------------------------------------------------------------- */ -#define MC33775_SECM_CAL_CRC_OFFSET (0x1C1EU) -#define MC33775_SECM_CAL_CRC_RW_MSK (0xFFFFU) -#define MC33775_SECM_CAL_CRC_RD_MSK (0xFFFFU) -#define MC33775_SECM_CAL_CRC_WR_MSK (0xFFFFU) -#define MC33775_SECM_CAL_CRC_MW_MSK (0x0U) -#define MC33775_SECM_CAL_CRC_RA_MSK (0x0U) -#define MC33775_SECM_CAL_CRC_POR_MSK (0xffffU) -#define MC33775_SECM_CAL_CRC_POR_VAL (0x0U) - -/* Field CRC: CRC over calibration data. The CRC calculation runs automatically every time when a synchronous measurement cycle is started and when the calibration data is read from the NVM. */ -#define MC33775_SECM_CAL_CRC_CRC_POS (0U) -#define MC33775_SECM_CAL_CRC_CRC_MSK (0xFFFFU) - -/* Enumerated value CALIBCRC: The expected value of the calibration CRC. */ -#define MC33775_SECM_CAL_CRC_CRC_CALIBCRC_ENUM_VAL (48879U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t CRC : 16; - } B; -} mc33775_secondary_measurement_registers_secm_cal_crc_t; - -/* -------------------------------------------------------------------------- - * SECM_CFG_CRC (read-only):CRC over configuration values. - * -------------------------------------------------------------------------- */ -#define MC33775_SECM_CFG_CRC_OFFSET (0x1C1FU) -#define MC33775_SECM_CFG_CRC_RW_MSK (0x0U) -#define MC33775_SECM_CFG_CRC_RD_MSK (0xFFFFU) -#define MC33775_SECM_CFG_CRC_WR_MSK (0x0U) -#define MC33775_SECM_CFG_CRC_MW_MSK (0x0U) -#define MC33775_SECM_CFG_CRC_RA_MSK (0x0U) -#define MC33775_SECM_CFG_CRC_POR_MSK (0xffffU) -#define MC33775_SECM_CFG_CRC_POR_VAL (0x0U) - -/* Field CRC: This CRC value is recalculated with any write to a covered register. The updated CRC value is available latest 100us after the last write. The CRC value is application specific and must be re-calculated by the MCU. The used polynomial is: 0xD175 (+1) = X^16 + X^15 + X^13 + X^9 + X^7 + X^6 + X^5 + X^3 + X^1 + 1. -Following registers are included: SECM_CFG, SECM_PER_CTRL, SECM_VB_CFG, SECM_AIN_CFG, SECM_VDIV_CFG. */ -#define MC33775_SECM_CFG_CRC_CRC_POS (0U) -#define MC33775_SECM_CFG_CRC_CRC_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t CRC : 16; - } B; -} mc33775_secondary_measurement_registers_secm_cfg_crc_t; - -/* -------------------------------------------------------------------------- - * SECM_MEAS_STAT (read-only):Measurement status. - * -------------------------------------------------------------------------- */ -#define MC33775_SECM_MEAS_STAT_OFFSET (0x1C3EU) -#define MC33775_SECM_MEAS_STAT_RW_MSK (0x0U) -#define MC33775_SECM_MEAS_STAT_RD_MSK (0xF30FU) -#define MC33775_SECM_MEAS_STAT_WR_MSK (0x0U) -#define MC33775_SECM_MEAS_STAT_MW_MSK (0x0U) -#define MC33775_SECM_MEAS_STAT_RA_MSK (0x0U) -#define MC33775_SECM_MEAS_STAT_POR_MSK (0xffffU) -#define MC33775_SECM_MEAS_STAT_POR_VAL (0x0U) - -/* Field APPRDYAIN4: A new AIN4 application result can be requested / captured. */ -#define MC33775_SECM_MEAS_STAT_APPRDYAIN4_POS (0U) -#define MC33775_SECM_MEAS_STAT_APPRDYAIN4_MSK (0x1U) - -/* Enumerated value NO_DATA: No data available (<16 sample) */ -#define MC33775_SECM_MEAS_STAT_APPRDYAIN4_NO_DATA_ENUM_VAL (0U) - -/* Enumerated value DATA: Data can be captured (>=16 samples are captured). */ -#define MC33775_SECM_MEAS_STAT_APPRDYAIN4_DATA_ENUM_VAL (1U) - -/* Field APPRDYAIN5: A new AIN5 application result can be requested / captured. */ -#define MC33775_SECM_MEAS_STAT_APPRDYAIN5_POS (1U) -#define MC33775_SECM_MEAS_STAT_APPRDYAIN5_MSK (0x2U) - -/* Enumerated value NO_DATA: No data available (<16 sample) */ -#define MC33775_SECM_MEAS_STAT_APPRDYAIN5_NO_DATA_ENUM_VAL (0U) - -/* Enumerated value DATA: Data can be captured (>=16 samples are captured). */ -#define MC33775_SECM_MEAS_STAT_APPRDYAIN5_DATA_ENUM_VAL (1U) - -/* Field APPRDYAIN6: A new AIN6 application result can be requested / captured. */ -#define MC33775_SECM_MEAS_STAT_APPRDYAIN6_POS (2U) -#define MC33775_SECM_MEAS_STAT_APPRDYAIN6_MSK (0x4U) - -/* Enumerated value NO_DATA: No data available (<16 sample) */ -#define MC33775_SECM_MEAS_STAT_APPRDYAIN6_NO_DATA_ENUM_VAL (0U) - -/* Enumerated value DATA: Data can be captured (>=16 samples are captured). */ -#define MC33775_SECM_MEAS_STAT_APPRDYAIN6_DATA_ENUM_VAL (1U) - -/* Field APPRDYAIN7: A new AIN7 application result can be requested / captured. */ -#define MC33775_SECM_MEAS_STAT_APPRDYAIN7_POS (3U) -#define MC33775_SECM_MEAS_STAT_APPRDYAIN7_MSK (0x8U) - -/* Enumerated value NO_DATA: No data available (<16 sample) */ -#define MC33775_SECM_MEAS_STAT_APPRDYAIN7_NO_DATA_ENUM_VAL (0U) - -/* Enumerated value DATA: Data can be captured (>=16 samples are captured). */ -#define MC33775_SECM_MEAS_STAT_APPRDYAIN7_DATA_ENUM_VAL (1U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_SECM_MEAS_STAT_RESERVED0_POS (4U) -#define MC33775_SECM_MEAS_STAT_RESERVED0_MSK (0xF0U) - -/* Field PERRDY: New periodic result data has been created (depending on the periodic update mode, they might need to be requested) , the bit is cleared by a read into the periodic result range. */ -#define MC33775_SECM_MEAS_STAT_PERRDY_POS (8U) -#define MC33775_SECM_MEAS_STAT_PERRDY_MSK (0x100U) - -/* Enumerated value NO_DATA: No data available */ -#define MC33775_SECM_MEAS_STAT_PERRDY_NO_DATA_ENUM_VAL (0U) - -/* Enumerated value DATA: Sample data available. */ -#define MC33775_SECM_MEAS_STAT_PERRDY_DATA_ENUM_VAL (1U) - -/* Field SYNCRDY: Synchronous measurement data is ready for readout, the bit is cleared by a read into the safety result range. */ -#define MC33775_SECM_MEAS_STAT_SYNCRDY_POS (9U) -#define MC33775_SECM_MEAS_STAT_SYNCRDY_MSK (0x200U) - -/* Enumerated value NO_DATA: No data available */ -#define MC33775_SECM_MEAS_STAT_SYNCRDY_NO_DATA_ENUM_VAL (0U) - -/* Enumerated value DATA: Sample data available. */ -#define MC33775_SECM_MEAS_STAT_SYNCRDY_DATA_ENUM_VAL (1U) - -/* Field reserved1: This read-only field is reserved and always has the value 0. */ -#define MC33775_SECM_MEAS_STAT_RESERVED1_POS (10U) -#define MC33775_SECM_MEAS_STAT_RESERVED1_MSK (0xC00U) - -/* Field SUPPLYFLT: Internal/external supply fault status */ -#define MC33775_SECM_MEAS_STAT_SUPPLYFLT_POS (12U) -#define MC33775_SECM_MEAS_STAT_SUPPLYFLT_MSK (0x1000U) - -/* Enumerated value NO_FLT: No supply error detected */ -#define MC33775_SECM_MEAS_STAT_SUPPLYFLT_NO_FLT_ENUM_VAL (0U) - -/* Enumerated value FAULT: Supply error detected */ -#define MC33775_SECM_MEAS_STAT_SUPPLYFLT_FAULT_ENUM_VAL (1U) - -/* Field ANAFLT: Analog fault status */ -#define MC33775_SECM_MEAS_STAT_ANAFLT_POS (13U) -#define MC33775_SECM_MEAS_STAT_ANAFLT_MSK (0x2000U) - -/* Enumerated value NO_FLT: No analog fault detected */ -#define MC33775_SECM_MEAS_STAT_ANAFLT_NO_FLT_ENUM_VAL (0U) - -/* Enumerated value FAULT: Analog fault detected */ -#define MC33775_SECM_MEAS_STAT_ANAFLT_FAULT_ENUM_VAL (1U) - -/* Field COMFLT: Communication fault status */ -#define MC33775_SECM_MEAS_STAT_COMFLT_POS (14U) -#define MC33775_SECM_MEAS_STAT_COMFLT_MSK (0x4000U) - -/* Enumerated value NO_FLT: No communication fault detected */ -#define MC33775_SECM_MEAS_STAT_COMFLT_NO_FLT_ENUM_VAL (0U) - -/* Enumerated value FAULT: Communication fault detected. */ -#define MC33775_SECM_MEAS_STAT_COMFLT_FAULT_ENUM_VAL (1U) - -/* Field MEASFLT: Measurement fault status */ -#define MC33775_SECM_MEAS_STAT_MEASFLT_POS (15U) -#define MC33775_SECM_MEAS_STAT_MEASFLT_MSK (0x8000U) - -/* Enumerated value NO_FLT: No measurement fault detected */ -#define MC33775_SECM_MEAS_STAT_MEASFLT_NO_FLT_ENUM_VAL (0U) - -/* Enumerated value FAULT: Measurement fault detected */ -#define MC33775_SECM_MEAS_STAT_MEASFLT_FAULT_ENUM_VAL (1U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t APPRDYAIN4 : 1; - volatile uint16_t APPRDYAIN5 : 1; - volatile uint16_t APPRDYAIN6 : 1; - volatile uint16_t APPRDYAIN7 : 1; - volatile uint16_t reserved0 : 4; - volatile uint16_t PERRDY : 1; - volatile uint16_t SYNCRDY : 1; - volatile uint16_t reserved1 : 2; - volatile uint16_t SUPPLYFLT : 1; - volatile uint16_t ANAFLT : 1; - volatile uint16_t COMFLT : 1; - volatile uint16_t MEASFLT : 1; - } B; -} mc33775_secondary_measurement_registers_secm_meas_stat_t; - -/* -------------------------------------------------------------------------- - * SECM_APP_AIN4 (read-only):Application measurement result AIN4. - * -------------------------------------------------------------------------- */ -#define MC33775_SECM_APP_AIN4_OFFSET (0x1C4FU) -#define MC33775_SECM_APP_AIN4_RW_MSK (0x0U) -#define MC33775_SECM_APP_AIN4_RD_MSK (0xFFFFU) -#define MC33775_SECM_APP_AIN4_WR_MSK (0x0U) -#define MC33775_SECM_APP_AIN4_MW_MSK (0x0U) -#define MC33775_SECM_APP_AIN4_RA_MSK (0x0U) -#define MC33775_SECM_APP_AIN4_POR_MSK (0xffffU) -#define MC33775_SECM_APP_AIN4_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of AIN4 at the last application capture as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_SECM_APP_AIN4_VALUE_POS (0U) -#define MC33775_SECM_APP_AIN4_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_secondary_measurement_registers_secm_app_ain4_t; - -/* -------------------------------------------------------------------------- - * SECM_APP_AIN5 (read-only):Application measurement result AIN5. - * -------------------------------------------------------------------------- */ -#define MC33775_SECM_APP_AIN5_OFFSET (0x1C50U) -#define MC33775_SECM_APP_AIN5_RW_MSK (0x0U) -#define MC33775_SECM_APP_AIN5_RD_MSK (0xFFFFU) -#define MC33775_SECM_APP_AIN5_WR_MSK (0x0U) -#define MC33775_SECM_APP_AIN5_MW_MSK (0x0U) -#define MC33775_SECM_APP_AIN5_RA_MSK (0x0U) -#define MC33775_SECM_APP_AIN5_POR_MSK (0xffffU) -#define MC33775_SECM_APP_AIN5_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of AIN5 at the last application capture as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_SECM_APP_AIN5_VALUE_POS (0U) -#define MC33775_SECM_APP_AIN5_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_secondary_measurement_registers_secm_app_ain5_t; - -/* -------------------------------------------------------------------------- - * SECM_APP_AIN6 (read-only):Application measurement result AIN6. - * -------------------------------------------------------------------------- */ -#define MC33775_SECM_APP_AIN6_OFFSET (0x1C51U) -#define MC33775_SECM_APP_AIN6_RW_MSK (0x0U) -#define MC33775_SECM_APP_AIN6_RD_MSK (0xFFFFU) -#define MC33775_SECM_APP_AIN6_WR_MSK (0x0U) -#define MC33775_SECM_APP_AIN6_MW_MSK (0x0U) -#define MC33775_SECM_APP_AIN6_RA_MSK (0x0U) -#define MC33775_SECM_APP_AIN6_POR_MSK (0xffffU) -#define MC33775_SECM_APP_AIN6_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of AIN6 at the last application capture as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_SECM_APP_AIN6_VALUE_POS (0U) -#define MC33775_SECM_APP_AIN6_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_secondary_measurement_registers_secm_app_ain6_t; - -/* -------------------------------------------------------------------------- - * SECM_APP_AIN7 (read-only):Application measurement result AIN7. - * -------------------------------------------------------------------------- */ -#define MC33775_SECM_APP_AIN7_OFFSET (0x1C52U) -#define MC33775_SECM_APP_AIN7_RW_MSK (0x0U) -#define MC33775_SECM_APP_AIN7_RD_MSK (0xFFFFU) -#define MC33775_SECM_APP_AIN7_WR_MSK (0x0U) -#define MC33775_SECM_APP_AIN7_MW_MSK (0x0U) -#define MC33775_SECM_APP_AIN7_RA_MSK (0x0U) -#define MC33775_SECM_APP_AIN7_POR_MSK (0xffffU) -#define MC33775_SECM_APP_AIN7_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of AIN7 at the last application capture as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_SECM_APP_AIN7_VALUE_POS (0U) -#define MC33775_SECM_APP_AIN7_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_secondary_measurement_registers_secm_app_ain7_t; - -/* -------------------------------------------------------------------------- - * SECM_PER_NUM (read-only):Measurement period number of the secondary periodic results. - * -------------------------------------------------------------------------- */ -#define MC33775_SECM_PER_NUM_OFFSET (0x1C5FU) -#define MC33775_SECM_PER_NUM_RW_MSK (0x0U) -#define MC33775_SECM_PER_NUM_RD_MSK (0xFFFFU) -#define MC33775_SECM_PER_NUM_WR_MSK (0x0U) -#define MC33775_SECM_PER_NUM_MW_MSK (0x0U) -#define MC33775_SECM_PER_NUM_RA_MSK (0x0U) -#define MC33775_SECM_PER_NUM_POR_MSK (0xffffU) -#define MC33775_SECM_PER_NUM_POR_VAL (0x0U) - -/* Field NUM: Number of the periodic cycle in which the secondary periodic results have been created. The value is incremented for each periodic cycle executed. The counting wraps at its limit. */ -#define MC33775_SECM_PER_NUM_NUM_POS (0U) -#define MC33775_SECM_PER_NUM_NUM_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t NUM : 16; - } B; -} mc33775_secondary_measurement_registers_secm_per_num_t; - -/* -------------------------------------------------------------------------- - * SECM_PER_AIN4 (read-only):Periodic measurement result AIN4. - * -------------------------------------------------------------------------- */ -#define MC33775_SECM_PER_AIN4_OFFSET (0x1C6FU) -#define MC33775_SECM_PER_AIN4_RW_MSK (0x0U) -#define MC33775_SECM_PER_AIN4_RD_MSK (0xFFFFU) -#define MC33775_SECM_PER_AIN4_WR_MSK (0x0U) -#define MC33775_SECM_PER_AIN4_MW_MSK (0x0U) -#define MC33775_SECM_PER_AIN4_RA_MSK (0x0U) -#define MC33775_SECM_PER_AIN4_POR_MSK (0xffffU) -#define MC33775_SECM_PER_AIN4_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of AIN4 of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_SECM_PER_AIN4_VALUE_POS (0U) -#define MC33775_SECM_PER_AIN4_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_secondary_measurement_registers_secm_per_ain4_t; - -/* -------------------------------------------------------------------------- - * SECM_PER_AIN5 (read-only):Periodic measurement result AIN5. - * -------------------------------------------------------------------------- */ -#define MC33775_SECM_PER_AIN5_OFFSET (0x1C70U) -#define MC33775_SECM_PER_AIN5_RW_MSK (0x0U) -#define MC33775_SECM_PER_AIN5_RD_MSK (0xFFFFU) -#define MC33775_SECM_PER_AIN5_WR_MSK (0x0U) -#define MC33775_SECM_PER_AIN5_MW_MSK (0x0U) -#define MC33775_SECM_PER_AIN5_RA_MSK (0x0U) -#define MC33775_SECM_PER_AIN5_POR_MSK (0xffffU) -#define MC33775_SECM_PER_AIN5_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of AIN5 of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_SECM_PER_AIN5_VALUE_POS (0U) -#define MC33775_SECM_PER_AIN5_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_secondary_measurement_registers_secm_per_ain5_t; - -/* -------------------------------------------------------------------------- - * SECM_PER_AIN6 (read-only):Periodic measurement result AIN6. - * -------------------------------------------------------------------------- */ -#define MC33775_SECM_PER_AIN6_OFFSET (0x1C71U) -#define MC33775_SECM_PER_AIN6_RW_MSK (0x0U) -#define MC33775_SECM_PER_AIN6_RD_MSK (0xFFFFU) -#define MC33775_SECM_PER_AIN6_WR_MSK (0x0U) -#define MC33775_SECM_PER_AIN6_MW_MSK (0x0U) -#define MC33775_SECM_PER_AIN6_RA_MSK (0x0U) -#define MC33775_SECM_PER_AIN6_POR_MSK (0xffffU) -#define MC33775_SECM_PER_AIN6_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of AIN6 of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_SECM_PER_AIN6_VALUE_POS (0U) -#define MC33775_SECM_PER_AIN6_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_secondary_measurement_registers_secm_per_ain6_t; - -/* -------------------------------------------------------------------------- - * SECM_PER_AIN7 (read-only):Periodic measurement result AIN7. - * -------------------------------------------------------------------------- */ -#define MC33775_SECM_PER_AIN7_OFFSET (0x1C72U) -#define MC33775_SECM_PER_AIN7_RW_MSK (0x0U) -#define MC33775_SECM_PER_AIN7_RD_MSK (0xFFFFU) -#define MC33775_SECM_PER_AIN7_WR_MSK (0x0U) -#define MC33775_SECM_PER_AIN7_MW_MSK (0x0U) -#define MC33775_SECM_PER_AIN7_RA_MSK (0x0U) -#define MC33775_SECM_PER_AIN7_POR_MSK (0xffffU) -#define MC33775_SECM_PER_AIN7_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of AIN7 of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_SECM_PER_AIN7_VALUE_POS (0U) -#define MC33775_SECM_PER_AIN7_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_secondary_measurement_registers_secm_per_ain7_t; - -/* -------------------------------------------------------------------------- - * SECM_PER_SECTEMP (read-only):Periodic measurement result secondary device temperature. - * -------------------------------------------------------------------------- */ -#define MC33775_SECM_PER_SECTEMP_OFFSET (0x1C73U) -#define MC33775_SECM_PER_SECTEMP_RW_MSK (0x0U) -#define MC33775_SECM_PER_SECTEMP_RD_MSK (0xFFFFU) -#define MC33775_SECM_PER_SECTEMP_WR_MSK (0x0U) -#define MC33775_SECM_PER_SECTEMP_MW_MSK (0x0U) -#define MC33775_SECM_PER_SECTEMP_RA_MSK (0x0U) -#define MC33775_SECM_PER_SECTEMP_POR_MSK (0xffffU) -#define MC33775_SECM_PER_SECTEMP_POR_VAL (0x8000U) - -/* Field VALUE: Measured temperature of secondary temperature sensor of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_SECM_PER_SECTEMP_VALUE_POS (0U) -#define MC33775_SECM_PER_SECTEMP_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_secondary_measurement_registers_secm_per_sectemp_t; - -/* -------------------------------------------------------------------------- - * SECM_PER_PRMVREF (read-only):Periodic measurement result primary voltage reference. - * -------------------------------------------------------------------------- */ -#define MC33775_SECM_PER_PRMVREF_OFFSET (0x1C74U) -#define MC33775_SECM_PER_PRMVREF_RW_MSK (0x0U) -#define MC33775_SECM_PER_PRMVREF_RD_MSK (0xFFFFU) -#define MC33775_SECM_PER_PRMVREF_WR_MSK (0x0U) -#define MC33775_SECM_PER_PRMVREF_MW_MSK (0x0U) -#define MC33775_SECM_PER_PRMVREF_RA_MSK (0x0U) -#define MC33775_SECM_PER_PRMVREF_POR_MSK (0xffffU) -#define MC33775_SECM_PER_PRMVREF_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of the primary voltage reference of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_SECM_PER_PRMVREF_VALUE_POS (0U) -#define MC33775_SECM_PER_PRMVREF_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_secondary_measurement_registers_secm_per_prmvref_t; - -/* -------------------------------------------------------------------------- - * SECM_PER_VAUX (read-only):Periodic measurement result auxiliary supply voltage. - * -------------------------------------------------------------------------- */ -#define MC33775_SECM_PER_VAUX_OFFSET (0x1C75U) -#define MC33775_SECM_PER_VAUX_RW_MSK (0x0U) -#define MC33775_SECM_PER_VAUX_RD_MSK (0xFFFFU) -#define MC33775_SECM_PER_VAUX_WR_MSK (0x0U) -#define MC33775_SECM_PER_VAUX_MW_MSK (0x0U) -#define MC33775_SECM_PER_VAUX_RA_MSK (0x0U) -#define MC33775_SECM_PER_VAUX_POR_MSK (0xffffU) -#define MC33775_SECM_PER_VAUX_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of VAUX of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_SECM_PER_VAUX_VALUE_POS (0U) -#define MC33775_SECM_PER_VAUX_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_secondary_measurement_registers_secm_per_vaux_t; - -/* -------------------------------------------------------------------------- - * SECM_PER_VBAT (read-only):Periodic measurement result VBAT. - * -------------------------------------------------------------------------- */ -#define MC33775_SECM_PER_VBAT_OFFSET (0x1C76U) -#define MC33775_SECM_PER_VBAT_RW_MSK (0x0U) -#define MC33775_SECM_PER_VBAT_RD_MSK (0xFFFFU) -#define MC33775_SECM_PER_VBAT_WR_MSK (0x0U) -#define MC33775_SECM_PER_VBAT_MW_MSK (0x0U) -#define MC33775_SECM_PER_VBAT_RA_MSK (0x0U) -#define MC33775_SECM_PER_VBAT_POR_MSK (0xffffU) -#define MC33775_SECM_PER_VBAT_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of VBAT of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_SECM_PER_VBAT_VALUE_POS (0U) -#define MC33775_SECM_PER_VBAT_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_secondary_measurement_registers_secm_per_vbat_t; - -/* -------------------------------------------------------------------------- - * SECM_PER_VDDA (read-only):Periodic measurement result VDDA. - * -------------------------------------------------------------------------- */ -#define MC33775_SECM_PER_VDDA_OFFSET (0x1C77U) -#define MC33775_SECM_PER_VDDA_RW_MSK (0x0U) -#define MC33775_SECM_PER_VDDA_RD_MSK (0xFFFFU) -#define MC33775_SECM_PER_VDDA_WR_MSK (0x0U) -#define MC33775_SECM_PER_VDDA_MW_MSK (0x0U) -#define MC33775_SECM_PER_VDDA_RA_MSK (0x0U) -#define MC33775_SECM_PER_VDDA_POR_MSK (0xffffU) -#define MC33775_SECM_PER_VDDA_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of VDDA of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_SECM_PER_VDDA_VALUE_POS (0U) -#define MC33775_SECM_PER_VDDA_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_secondary_measurement_registers_secm_per_vdda_t; - -/* -------------------------------------------------------------------------- - * SECM_PER_VDDC (read-only):Periodic measurement result VDDC. - * -------------------------------------------------------------------------- */ -#define MC33775_SECM_PER_VDDC_OFFSET (0x1C78U) -#define MC33775_SECM_PER_VDDC_RW_MSK (0x0U) -#define MC33775_SECM_PER_VDDC_RD_MSK (0xFFFFU) -#define MC33775_SECM_PER_VDDC_WR_MSK (0x0U) -#define MC33775_SECM_PER_VDDC_MW_MSK (0x0U) -#define MC33775_SECM_PER_VDDC_RA_MSK (0x0U) -#define MC33775_SECM_PER_VDDC_POR_MSK (0xffffU) -#define MC33775_SECM_PER_VDDC_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of VDDC of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_SECM_PER_VDDC_VALUE_POS (0U) -#define MC33775_SECM_PER_VDDC_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_secondary_measurement_registers_secm_per_vddc_t; - -/* -------------------------------------------------------------------------- - * SECM_PER_MONVREF (read-only):Periodic measurement result voltage monitor reference. - * -------------------------------------------------------------------------- */ -#define MC33775_SECM_PER_MONVREF_OFFSET (0x1C79U) -#define MC33775_SECM_PER_MONVREF_RW_MSK (0x0U) -#define MC33775_SECM_PER_MONVREF_RD_MSK (0xFFFFU) -#define MC33775_SECM_PER_MONVREF_WR_MSK (0x0U) -#define MC33775_SECM_PER_MONVREF_MW_MSK (0x0U) -#define MC33775_SECM_PER_MONVREF_RA_MSK (0x0U) -#define MC33775_SECM_PER_MONVREF_POR_MSK (0xffffU) -#define MC33775_SECM_PER_MONVREF_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of the monitor reference of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_SECM_PER_MONVREF_VALUE_POS (0U) -#define MC33775_SECM_PER_MONVREF_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_secondary_measurement_registers_secm_per_monvref_t; - -/* -------------------------------------------------------------------------- - * SECM_PER_NPNISENSE (read-only):Periodic measurement result NPN current sensor. - * -------------------------------------------------------------------------- */ -#define MC33775_SECM_PER_NPNISENSE_OFFSET (0x1C7AU) -#define MC33775_SECM_PER_NPNISENSE_RW_MSK (0x0U) -#define MC33775_SECM_PER_NPNISENSE_RD_MSK (0xFFFFU) -#define MC33775_SECM_PER_NPNISENSE_WR_MSK (0x0U) -#define MC33775_SECM_PER_NPNISENSE_MW_MSK (0x0U) -#define MC33775_SECM_PER_NPNISENSE_RA_MSK (0x0U) -#define MC33775_SECM_PER_NPNISENSE_POR_MSK (0xffffU) -#define MC33775_SECM_PER_NPNISENSE_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of NPN current sensor of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_SECM_PER_NPNISENSE_VALUE_POS (0U) -#define MC33775_SECM_PER_NPNISENSE_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_secondary_measurement_registers_secm_per_npnisense_t; - -/* -------------------------------------------------------------------------- - * SECM_SYNC_NUM (read-only):Measurement number of the secondary synchronous results. - * -------------------------------------------------------------------------- */ -#define MC33775_SECM_SYNC_NUM_OFFSET (0x1C7FU) -#define MC33775_SECM_SYNC_NUM_RW_MSK (0x0U) -#define MC33775_SECM_SYNC_NUM_RD_MSK (0xFFFFU) -#define MC33775_SECM_SYNC_NUM_WR_MSK (0x0U) -#define MC33775_SECM_SYNC_NUM_MW_MSK (0x0U) -#define MC33775_SECM_SYNC_NUM_RA_MSK (0x0U) -#define MC33775_SECM_SYNC_NUM_POR_MSK (0xffffU) -#define MC33775_SECM_SYNC_NUM_POR_VAL (0x0U) - -/* Field NUM: Number of the synchronous cycle in which the secondary results have been created. The value is incremented for each synchronous cycle executed. The counting wraps at its limit. The value is not incremented for FASTVB cycle. */ -#define MC33775_SECM_SYNC_NUM_NUM_POS (0U) -#define MC33775_SECM_SYNC_NUM_NUM_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t NUM : 16; - } B; -} mc33775_secondary_measurement_registers_secm_sync_num_t; - -/* -------------------------------------------------------------------------- - * SECM_SYNC_VB0 (read-only):Synchronous measurement result from balancing pins cell 0. - * -------------------------------------------------------------------------- */ -#define MC33775_SECM_SYNC_VB0_OFFSET (0x1C80U) -#define MC33775_SECM_SYNC_VB0_RW_MSK (0x0U) -#define MC33775_SECM_SYNC_VB0_RD_MSK (0xFFFFU) -#define MC33775_SECM_SYNC_VB0_WR_MSK (0x0U) -#define MC33775_SECM_SYNC_VB0_MW_MSK (0x0U) -#define MC33775_SECM_SYNC_VB0_RA_MSK (0x0U) -#define MC33775_SECM_SYNC_VB0_POR_MSK (0xffffU) -#define MC33775_SECM_SYNC_VB0_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of cell 0 of the last synchronous cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_SECM_SYNC_VB0_VALUE_POS (0U) -#define MC33775_SECM_SYNC_VB0_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_secondary_measurement_registers_secm_sync_vb0_t; - -/* -------------------------------------------------------------------------- - * SECM_SYNC_VB1 (read-only):Synchronous measurement result from balancing pins cell 1. - * -------------------------------------------------------------------------- */ -#define MC33775_SECM_SYNC_VB1_OFFSET (0x1C81U) -#define MC33775_SECM_SYNC_VB1_RW_MSK (0x0U) -#define MC33775_SECM_SYNC_VB1_RD_MSK (0xFFFFU) -#define MC33775_SECM_SYNC_VB1_WR_MSK (0x0U) -#define MC33775_SECM_SYNC_VB1_MW_MSK (0x0U) -#define MC33775_SECM_SYNC_VB1_RA_MSK (0x0U) -#define MC33775_SECM_SYNC_VB1_POR_MSK (0xffffU) -#define MC33775_SECM_SYNC_VB1_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of cell 1 of the last synchronous cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_SECM_SYNC_VB1_VALUE_POS (0U) -#define MC33775_SECM_SYNC_VB1_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_secondary_measurement_registers_secm_sync_vb1_t; - -/* -------------------------------------------------------------------------- - * SECM_SYNC_VB2 (read-only):Synchronous measurement result from balancing pins cell 2. - * -------------------------------------------------------------------------- */ -#define MC33775_SECM_SYNC_VB2_OFFSET (0x1C82U) -#define MC33775_SECM_SYNC_VB2_RW_MSK (0x0U) -#define MC33775_SECM_SYNC_VB2_RD_MSK (0xFFFFU) -#define MC33775_SECM_SYNC_VB2_WR_MSK (0x0U) -#define MC33775_SECM_SYNC_VB2_MW_MSK (0x0U) -#define MC33775_SECM_SYNC_VB2_RA_MSK (0x0U) -#define MC33775_SECM_SYNC_VB2_POR_MSK (0xffffU) -#define MC33775_SECM_SYNC_VB2_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of cell 2 of the last synchronous cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_SECM_SYNC_VB2_VALUE_POS (0U) -#define MC33775_SECM_SYNC_VB2_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_secondary_measurement_registers_secm_sync_vb2_t; - -/* -------------------------------------------------------------------------- - * SECM_SYNC_VB3 (read-only):Synchronous measurement result from balancing pins cell 3. - * -------------------------------------------------------------------------- */ -#define MC33775_SECM_SYNC_VB3_OFFSET (0x1C83U) -#define MC33775_SECM_SYNC_VB3_RW_MSK (0x0U) -#define MC33775_SECM_SYNC_VB3_RD_MSK (0xFFFFU) -#define MC33775_SECM_SYNC_VB3_WR_MSK (0x0U) -#define MC33775_SECM_SYNC_VB3_MW_MSK (0x0U) -#define MC33775_SECM_SYNC_VB3_RA_MSK (0x0U) -#define MC33775_SECM_SYNC_VB3_POR_MSK (0xffffU) -#define MC33775_SECM_SYNC_VB3_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of cell 3 of the last synchronous cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_SECM_SYNC_VB3_VALUE_POS (0U) -#define MC33775_SECM_SYNC_VB3_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_secondary_measurement_registers_secm_sync_vb3_t; - -/* -------------------------------------------------------------------------- - * SECM_SYNC_VB4 (read-only):Synchronous measurement result from balancing pins cell 4. - * -------------------------------------------------------------------------- */ -#define MC33775_SECM_SYNC_VB4_OFFSET (0x1C84U) -#define MC33775_SECM_SYNC_VB4_RW_MSK (0x0U) -#define MC33775_SECM_SYNC_VB4_RD_MSK (0xFFFFU) -#define MC33775_SECM_SYNC_VB4_WR_MSK (0x0U) -#define MC33775_SECM_SYNC_VB4_MW_MSK (0x0U) -#define MC33775_SECM_SYNC_VB4_RA_MSK (0x0U) -#define MC33775_SECM_SYNC_VB4_POR_MSK (0xffffU) -#define MC33775_SECM_SYNC_VB4_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of cell 4 of the last synchronous cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_SECM_SYNC_VB4_VALUE_POS (0U) -#define MC33775_SECM_SYNC_VB4_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_secondary_measurement_registers_secm_sync_vb4_t; - -/* -------------------------------------------------------------------------- - * SECM_SYNC_VB5 (read-only):Synchronous measurement result from balancing pins cell 5. - * -------------------------------------------------------------------------- */ -#define MC33775_SECM_SYNC_VB5_OFFSET (0x1C85U) -#define MC33775_SECM_SYNC_VB5_RW_MSK (0x0U) -#define MC33775_SECM_SYNC_VB5_RD_MSK (0xFFFFU) -#define MC33775_SECM_SYNC_VB5_WR_MSK (0x0U) -#define MC33775_SECM_SYNC_VB5_MW_MSK (0x0U) -#define MC33775_SECM_SYNC_VB5_RA_MSK (0x0U) -#define MC33775_SECM_SYNC_VB5_POR_MSK (0xffffU) -#define MC33775_SECM_SYNC_VB5_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of cell 5 of the last synchronous cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_SECM_SYNC_VB5_VALUE_POS (0U) -#define MC33775_SECM_SYNC_VB5_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_secondary_measurement_registers_secm_sync_vb5_t; - -/* -------------------------------------------------------------------------- - * SECM_SYNC_VB6 (read-only):Synchronous measurement result from balancing pins cell 6. - * -------------------------------------------------------------------------- */ -#define MC33775_SECM_SYNC_VB6_OFFSET (0x1C86U) -#define MC33775_SECM_SYNC_VB6_RW_MSK (0x0U) -#define MC33775_SECM_SYNC_VB6_RD_MSK (0xFFFFU) -#define MC33775_SECM_SYNC_VB6_WR_MSK (0x0U) -#define MC33775_SECM_SYNC_VB6_MW_MSK (0x0U) -#define MC33775_SECM_SYNC_VB6_RA_MSK (0x0U) -#define MC33775_SECM_SYNC_VB6_POR_MSK (0xffffU) -#define MC33775_SECM_SYNC_VB6_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of cell 6 of the last synchronous cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_SECM_SYNC_VB6_VALUE_POS (0U) -#define MC33775_SECM_SYNC_VB6_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_secondary_measurement_registers_secm_sync_vb6_t; - -/* -------------------------------------------------------------------------- - * SECM_SYNC_VB7 (read-only):Synchronous measurement result from balancing pins cell 7. - * -------------------------------------------------------------------------- */ -#define MC33775_SECM_SYNC_VB7_OFFSET (0x1C87U) -#define MC33775_SECM_SYNC_VB7_RW_MSK (0x0U) -#define MC33775_SECM_SYNC_VB7_RD_MSK (0xFFFFU) -#define MC33775_SECM_SYNC_VB7_WR_MSK (0x0U) -#define MC33775_SECM_SYNC_VB7_MW_MSK (0x0U) -#define MC33775_SECM_SYNC_VB7_RA_MSK (0x0U) -#define MC33775_SECM_SYNC_VB7_POR_MSK (0xffffU) -#define MC33775_SECM_SYNC_VB7_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of cell 7 of the last synchronous cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_SECM_SYNC_VB7_VALUE_POS (0U) -#define MC33775_SECM_SYNC_VB7_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_secondary_measurement_registers_secm_sync_vb7_t; - -/* -------------------------------------------------------------------------- - * SECM_SYNC_VB8 (read-only):Synchronous measurement result from balancing pins cell 8. - * -------------------------------------------------------------------------- */ -#define MC33775_SECM_SYNC_VB8_OFFSET (0x1C88U) -#define MC33775_SECM_SYNC_VB8_RW_MSK (0x0U) -#define MC33775_SECM_SYNC_VB8_RD_MSK (0xFFFFU) -#define MC33775_SECM_SYNC_VB8_WR_MSK (0x0U) -#define MC33775_SECM_SYNC_VB8_MW_MSK (0x0U) -#define MC33775_SECM_SYNC_VB8_RA_MSK (0x0U) -#define MC33775_SECM_SYNC_VB8_POR_MSK (0xffffU) -#define MC33775_SECM_SYNC_VB8_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of cell 8 of the last synchronous cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_SECM_SYNC_VB8_VALUE_POS (0U) -#define MC33775_SECM_SYNC_VB8_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_secondary_measurement_registers_secm_sync_vb8_t; - -/* -------------------------------------------------------------------------- - * SECM_SYNC_VB9 (read-only):Synchronous measurement result from balancing pins cell 9. - * -------------------------------------------------------------------------- */ -#define MC33775_SECM_SYNC_VB9_OFFSET (0x1C89U) -#define MC33775_SECM_SYNC_VB9_RW_MSK (0x0U) -#define MC33775_SECM_SYNC_VB9_RD_MSK (0xFFFFU) -#define MC33775_SECM_SYNC_VB9_WR_MSK (0x0U) -#define MC33775_SECM_SYNC_VB9_MW_MSK (0x0U) -#define MC33775_SECM_SYNC_VB9_RA_MSK (0x0U) -#define MC33775_SECM_SYNC_VB9_POR_MSK (0xffffU) -#define MC33775_SECM_SYNC_VB9_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of cell 9 of the last synchronous cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_SECM_SYNC_VB9_VALUE_POS (0U) -#define MC33775_SECM_SYNC_VB9_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_secondary_measurement_registers_secm_sync_vb9_t; - -/* -------------------------------------------------------------------------- - * SECM_SYNC_VB10 (read-only):Synchronous measurement result from balancing pins cell 10. - * -------------------------------------------------------------------------- */ -#define MC33775_SECM_SYNC_VB10_OFFSET (0x1C8AU) -#define MC33775_SECM_SYNC_VB10_RW_MSK (0x0U) -#define MC33775_SECM_SYNC_VB10_RD_MSK (0xFFFFU) -#define MC33775_SECM_SYNC_VB10_WR_MSK (0x0U) -#define MC33775_SECM_SYNC_VB10_MW_MSK (0x0U) -#define MC33775_SECM_SYNC_VB10_RA_MSK (0x0U) -#define MC33775_SECM_SYNC_VB10_POR_MSK (0xffffU) -#define MC33775_SECM_SYNC_VB10_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of cell 10 of the last synchronous cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_SECM_SYNC_VB10_VALUE_POS (0U) -#define MC33775_SECM_SYNC_VB10_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_secondary_measurement_registers_secm_sync_vb10_t; - -/* -------------------------------------------------------------------------- - * SECM_SYNC_VB11 (read-only):Synchronous measurement result from balancing pins cell 11. - * -------------------------------------------------------------------------- */ -#define MC33775_SECM_SYNC_VB11_OFFSET (0x1C8BU) -#define MC33775_SECM_SYNC_VB11_RW_MSK (0x0U) -#define MC33775_SECM_SYNC_VB11_RD_MSK (0xFFFFU) -#define MC33775_SECM_SYNC_VB11_WR_MSK (0x0U) -#define MC33775_SECM_SYNC_VB11_MW_MSK (0x0U) -#define MC33775_SECM_SYNC_VB11_RA_MSK (0x0U) -#define MC33775_SECM_SYNC_VB11_POR_MSK (0xffffU) -#define MC33775_SECM_SYNC_VB11_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of cell 11 of the last synchronous cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_SECM_SYNC_VB11_VALUE_POS (0U) -#define MC33775_SECM_SYNC_VB11_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_secondary_measurement_registers_secm_sync_vb11_t; - -/* -------------------------------------------------------------------------- - * SECM_SYNC_VB12 (read-only):Synchronous measurement result from balancing pins cell 12. - * -------------------------------------------------------------------------- */ -#define MC33775_SECM_SYNC_VB12_OFFSET (0x1C8CU) -#define MC33775_SECM_SYNC_VB12_RW_MSK (0x0U) -#define MC33775_SECM_SYNC_VB12_RD_MSK (0xFFFFU) -#define MC33775_SECM_SYNC_VB12_WR_MSK (0x0U) -#define MC33775_SECM_SYNC_VB12_MW_MSK (0x0U) -#define MC33775_SECM_SYNC_VB12_RA_MSK (0x0U) -#define MC33775_SECM_SYNC_VB12_POR_MSK (0xffffU) -#define MC33775_SECM_SYNC_VB12_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of cell 12 of the last synchronous cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_SECM_SYNC_VB12_VALUE_POS (0U) -#define MC33775_SECM_SYNC_VB12_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_secondary_measurement_registers_secm_sync_vb12_t; - -/* -------------------------------------------------------------------------- - * SECM_SYNC_VB13 (read-only):Synchronous measurement result from balancing pins cell 13. - * -------------------------------------------------------------------------- */ -#define MC33775_SECM_SYNC_VB13_OFFSET (0x1C8DU) -#define MC33775_SECM_SYNC_VB13_RW_MSK (0x0U) -#define MC33775_SECM_SYNC_VB13_RD_MSK (0xFFFFU) -#define MC33775_SECM_SYNC_VB13_WR_MSK (0x0U) -#define MC33775_SECM_SYNC_VB13_MW_MSK (0x0U) -#define MC33775_SECM_SYNC_VB13_RA_MSK (0x0U) -#define MC33775_SECM_SYNC_VB13_POR_MSK (0xffffU) -#define MC33775_SECM_SYNC_VB13_POR_VAL (0x8000U) - -/* Field VALUE: Measured voltage of cell 13 of the last synchronous cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ -#define MC33775_SECM_SYNC_VB13_VALUE_POS (0U) -#define MC33775_SECM_SYNC_VB13_VALUE_MSK (0xFFFFU) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t VALUE : 16; - } B; -} mc33775_secondary_measurement_registers_secm_sync_vb13_t; - -/* -------------------------------------------------------------------------- - * BAL_GLOB_CFG (read-write):The global balancing configuration register is used to configure the balancing modes. - * -------------------------------------------------------------------------- */ -#define MC33775_BAL_GLOB_CFG_OFFSET (0x1000U) -#define MC33775_BAL_GLOB_CFG_RW_MSK (0x31FU) -#define MC33775_BAL_GLOB_CFG_RD_MSK (0x31FU) -#define MC33775_BAL_GLOB_CFG_WR_MSK (0x31FU) -#define MC33775_BAL_GLOB_CFG_MW_MSK (0x0U) -#define MC33775_BAL_GLOB_CFG_RA_MSK (0x0U) -#define MC33775_BAL_GLOB_CFG_POR_MSK (0xffffU) -#define MC33775_BAL_GLOB_CFG_POR_VAL (0x0U) - -/* Field BALEN: Enables the balancing activity. This bit is cleared in case of a balancing timeout or if an enabled global under-voltage condition is reached. All channel individual counters are stopped if zero. The emergency discharge works without setting this bit. */ -#define MC33775_BAL_GLOB_CFG_BALEN_POS (0U) -#define MC33775_BAL_GLOB_CFG_BALEN_MSK (0x1U) - -/* Enumerated value DISABLED: Balancing is disabled. */ -#define MC33775_BAL_GLOB_CFG_BALEN_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Balancing is enabled. */ -#define MC33775_BAL_GLOB_CFG_BALEN_ENABLED_ENUM_VAL (1U) - -/* Field TMRBALEN: Enables the timer based balancing feature. All channel individual counters are stopped if zero. */ -#define MC33775_BAL_GLOB_CFG_TMRBALEN_POS (1U) -#define MC33775_BAL_GLOB_CFG_TMRBALEN_MSK (0x2U) - -/* Enumerated value INDEPENDENT: Balancing is independent of the cell balancing timer. */ -#define MC33775_BAL_GLOB_CFG_TMRBALEN_INDEPENDENT_ENUM_VAL (0U) - -/* Enumerated value STOP: Balancing for all cells will be stopped when cell balancing timer expires. */ -#define MC33775_BAL_GLOB_CFG_TMRBALEN_STOP_ENUM_VAL (1U) - -/* Field CHUV0BALEN: Enables the voltage based balancing for the individual channel. Balancing stops once each individual channel reaches the under-voltage threshold. */ -#define MC33775_BAL_GLOB_CFG_CHUV0BALEN_POS (2U) -#define MC33775_BAL_GLOB_CFG_CHUV0BALEN_MSK (0x4U) - -/* Enumerated value INDEPENDENT: Balancing is independent of the cell undervoltage threshold. */ -#define MC33775_BAL_GLOB_CFG_CHUV0BALEN_INDEPENDENT_ENUM_VAL (0U) - -/* Enumerated value STOP: Balancing for the individual cells stops once the cell undervoltage threshold is reached. */ -#define MC33775_BAL_GLOB_CFG_CHUV0BALEN_STOP_ENUM_VAL (1U) - -/* Field GLOBUV1BALEN: Enables the Global undervoltage based balancing feature. */ -#define MC33775_BAL_GLOB_CFG_GLOBUV1BALEN_POS (3U) -#define MC33775_BAL_GLOB_CFG_GLOBUV1BALEN_MSK (0x8U) - -/* Enumerated value INDEPENDENT: Balancing is independent of the global undervoltage threshold. */ -#define MC33775_BAL_GLOB_CFG_GLOBUV1BALEN_INDEPENDENT_ENUM_VAL (0U) - -/* Enumerated value STOP: Balancing for all cells stops once the global undervoltage threshold is reached by any cell. */ -#define MC33775_BAL_GLOB_CFG_GLOBUV1BALEN_STOP_ENUM_VAL (1U) - -/* Field TEMPMODBALEN: Enables the temperature modulated balancing. After an over-temperature condition the balancing is halted until an under-temperature condition is detected. */ -#define MC33775_BAL_GLOB_CFG_TEMPMODBALEN_POS (4U) -#define MC33775_BAL_GLOB_CFG_TEMPMODBALEN_MSK (0x10U) - -/* Enumerated value NOTEMPMOD: Balancing is not temperature modulated. */ -#define MC33775_BAL_GLOB_CFG_TEMPMODBALEN_NOTEMPMOD_ENUM_VAL (0U) - -/* Enumerated value TEMPMOD: Balancing is temperature modulated. */ -#define MC33775_BAL_GLOB_CFG_TEMPMODBALEN_TEMPMOD_ENUM_VAL (1U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_BAL_GLOB_CFG_RESERVED0_POS (5U) -#define MC33775_BAL_GLOB_CFG_RESERVED0_MSK (0xE0U) - -/* Field TEMPSRC: Selects the source channel (AINx) for temperature modulated balancing. */ -#define MC33775_BAL_GLOB_CFG_TEMPSRC_POS (8U) -#define MC33775_BAL_GLOB_CFG_TEMPSRC_MSK (0x300U) - -/* Enumerated value AIN0: Selects AIN0 as source for temperature measurement. */ -#define MC33775_BAL_GLOB_CFG_TEMPSRC_AIN0_ENUM_VAL (0U) - -/* Enumerated value AIN1: Selects AIN1 as source for temperature measurement. */ -#define MC33775_BAL_GLOB_CFG_TEMPSRC_AIN1_ENUM_VAL (1U) - -/* Enumerated value AIN2: Selects AIN2 as source for temperature measurement. */ -#define MC33775_BAL_GLOB_CFG_TEMPSRC_AIN2_ENUM_VAL (2U) - -/* Enumerated value AIN3: Selects AIN3 as source for temperature measurement. */ -#define MC33775_BAL_GLOB_CFG_TEMPSRC_AIN3_ENUM_VAL (3U) - -/* Field reserved1: This read-only field is reserved and always has the value 0. */ -#define MC33775_BAL_GLOB_CFG_RESERVED1_POS (10U) -#define MC33775_BAL_GLOB_CFG_RESERVED1_MSK (0xFC00U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t BALEN : 1; - volatile uint16_t TMRBALEN : 1; - volatile uint16_t CHUV0BALEN : 1; - volatile uint16_t GLOBUV1BALEN : 1; - volatile uint16_t TEMPMODBALEN : 1; - volatile uint16_t reserved0 : 3; - volatile uint16_t TEMPSRC : 2; - volatile uint16_t reserved1 : 6; - } B; -} mc33775_balancing_registers_bal_glob_cfg_t; - -/* -------------------------------------------------------------------------- - * BAL_GLOB_TO_TMR (read-write):The Global Balancing timeout timer register is used to configure the maximum balancing time for all balancing activities to make sure that in case of fault the balancing switches are switched OFF. - * -------------------------------------------------------------------------- */ -#define MC33775_BAL_GLOB_TO_TMR_OFFSET (0x1001U) -#define MC33775_BAL_GLOB_TO_TMR_RW_MSK (0xFFFFU) -#define MC33775_BAL_GLOB_TO_TMR_RD_MSK (0xFFFFU) -#define MC33775_BAL_GLOB_TO_TMR_WR_MSK (0xFFFFU) -#define MC33775_BAL_GLOB_TO_TMR_MW_MSK (0x0U) -#define MC33775_BAL_GLOB_TO_TMR_RA_MSK (0x0U) -#define MC33775_BAL_GLOB_TO_TMR_POR_MSK (0xffffU) -#define MC33775_BAL_GLOB_TO_TMR_POR_VAL (0x0U) - -/* Field TOTIME: Balancing timeout value, used for normal balancing. The value of this field represents the current counter value when read. The BAL_GLOB_CFG.BALEN is cleared when zero is reached. The counter saturates at zero. It counts down regardless of the balancing enable state as long as its value is non-zero. */ -#define MC33775_BAL_GLOB_TO_TMR_TOTIME_POS (0U) -#define MC33775_BAL_GLOB_TO_TMR_TOTIME_MSK (0xFFFFU) - -/* Enumerated value EXPIRED: Balancing time is expired */ -#define MC33775_BAL_GLOB_TO_TMR_TOTIME_EXPIRED_ENUM_VAL (0U) - -/* Enumerated value BALTIME: Balancing time is set to BALTIME * 10 seconds */ -#define MC33775_BAL_GLOB_TO_TMR_TOTIME_BALTIME_ENUM_VAL (1U) - -/* Enumerated value MAX: Maximum balancing time = 655350 seconds = approximately 182 hours = approximately 7.6 days */ -#define MC33775_BAL_GLOB_TO_TMR_TOTIME_MAX_ENUM_VAL (65535U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t TOTIME : 16; - } B; -} mc33775_balancing_registers_bal_glob_to_tmr_t; - -/* -------------------------------------------------------------------------- - * BAL_CH_CFG (read-write):Balancing channel individual enable - * -------------------------------------------------------------------------- */ -#define MC33775_BAL_CH_CFG_OFFSET (0x1002U) -#define MC33775_BAL_CH_CFG_RW_MSK (0x3FFFU) -#define MC33775_BAL_CH_CFG_RD_MSK (0x3FFFU) -#define MC33775_BAL_CH_CFG_WR_MSK (0x3FFFU) -#define MC33775_BAL_CH_CFG_MW_MSK (0x0U) -#define MC33775_BAL_CH_CFG_RA_MSK (0x0U) -#define MC33775_BAL_CH_CFG_POR_MSK (0xffffU) -#define MC33775_BAL_CH_CFG_POR_VAL (0x0U) - -/* Field CHEN0: Enable balancing for channel 0. The bit is cleared by the device in case of: a) a detected over-current condition on channel 0. b) a detected and enabled individual under-voltage condition for channel 0. c) the channel timer of channel 0 (BAL_TMR_CH0) is zero. */ -#define MC33775_BAL_CH_CFG_CHEN0_POS (0U) -#define MC33775_BAL_CH_CFG_CHEN0_MSK (0x1U) - -/* Enumerated value DISABLED: Balancing for Channel 0 is disabled. The balancing timer for Channel 0 is stopped. */ -#define MC33775_BAL_CH_CFG_CHEN0_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Balancing for Channel 0 is enabled. */ -#define MC33775_BAL_CH_CFG_CHEN0_ENABLED_ENUM_VAL (1U) - -/* Field CHEN1: Enable balancing for channel 1. The bit is cleared by the device in case of: a) a detected over-current condition on channel 1. b) a detected and enabled individual under-voltage condition for channel 1. c) the channel timer of channel 0 (BAL_TMR_CH1) is zero. */ -#define MC33775_BAL_CH_CFG_CHEN1_POS (1U) -#define MC33775_BAL_CH_CFG_CHEN1_MSK (0x2U) - -/* Enumerated value DISABLED: Balancing for Channel 1 is disabled. The balancing timer for Channel 1 is stopped. */ -#define MC33775_BAL_CH_CFG_CHEN1_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Balancing for Channel 1 is enabled. */ -#define MC33775_BAL_CH_CFG_CHEN1_ENABLED_ENUM_VAL (1U) - -/* Field CHEN2: Enable balancing for channel 2. The bit is cleared by the device in case of: a) a detected over-current condition on channel 2. b) a detected and enabled individual under-voltage condition for channel 2. c) the channel timer of channel 0 (BAL_TMR_CH2) is zero. */ -#define MC33775_BAL_CH_CFG_CHEN2_POS (2U) -#define MC33775_BAL_CH_CFG_CHEN2_MSK (0x4U) - -/* Enumerated value DISABLED: Balancing for Channel 2 is disabled. The balancing timer for Channel 2 is stopped. */ -#define MC33775_BAL_CH_CFG_CHEN2_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Balancing for Channel 2 is enabled. */ -#define MC33775_BAL_CH_CFG_CHEN2_ENABLED_ENUM_VAL (1U) - -/* Field CHEN3: Enable balancing for channel 3. The bit is cleared by the device in case of: a) a detected over-current condition on channel 3. b) a detected and enabled individual under-voltage condition for channel 3. c) the channel timer of channel 0 (BAL_TMR_CH3) is zero. */ -#define MC33775_BAL_CH_CFG_CHEN3_POS (3U) -#define MC33775_BAL_CH_CFG_CHEN3_MSK (0x8U) - -/* Enumerated value DISABLED: Balancing for Channel 3 is disabled. The balancing timer for Channel 3 is stopped. */ -#define MC33775_BAL_CH_CFG_CHEN3_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Balancing for Channel 3 is enabled. */ -#define MC33775_BAL_CH_CFG_CHEN3_ENABLED_ENUM_VAL (1U) - -/* Field CHEN4: Enable balancing for channel 4. The bit is cleared by the device in case of: a) a detected over-current condition on channel 4. b) a detected and enabled individual under-voltage condition for channel 4. c) the channel timer of channel 0 (BAL_TMR_CH4) is zero. */ -#define MC33775_BAL_CH_CFG_CHEN4_POS (4U) -#define MC33775_BAL_CH_CFG_CHEN4_MSK (0x10U) - -/* Enumerated value DISABLED: Balancing for Channel 4 is disabled. The balancing timer for Channel 4 is stopped. */ -#define MC33775_BAL_CH_CFG_CHEN4_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Balancing for Channel 4 is enabled. */ -#define MC33775_BAL_CH_CFG_CHEN4_ENABLED_ENUM_VAL (1U) - -/* Field CHEN5: Enable balancing for channel 5. The bit is cleared by the device in case of: a) a detected over-current condition on channel 5. b) a detected and enabled individual under-voltage condition for channel 5. c) the channel timer of channel 0 (BAL_TMR_CH5) is zero. */ -#define MC33775_BAL_CH_CFG_CHEN5_POS (5U) -#define MC33775_BAL_CH_CFG_CHEN5_MSK (0x20U) - -/* Enumerated value DISABLED: Balancing for Channel 5 is disabled. The balancing timer for Channel 5 is stopped. */ -#define MC33775_BAL_CH_CFG_CHEN5_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Balancing for Channel 5 is enabled. */ -#define MC33775_BAL_CH_CFG_CHEN5_ENABLED_ENUM_VAL (1U) - -/* Field CHEN6: Enable balancing for channel 6. The bit is cleared by the device in case of: a) a detected over-current condition on channel 6. b) a detected and enabled individual under-voltage condition for channel 6. c) the channel timer of channel 0 (BAL_TMR_CH6) is zero. */ -#define MC33775_BAL_CH_CFG_CHEN6_POS (6U) -#define MC33775_BAL_CH_CFG_CHEN6_MSK (0x40U) - -/* Enumerated value DISABLED: Balancing for Channel 6 is disabled. The balancing timer for Channel 6 is stopped. */ -#define MC33775_BAL_CH_CFG_CHEN6_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Balancing for Channel 6 is enabled. */ -#define MC33775_BAL_CH_CFG_CHEN6_ENABLED_ENUM_VAL (1U) - -/* Field CHEN7: Enable balancing for channel 7. The bit is cleared by the device in case of: a) a detected over-current condition on channel 7. b) a detected and enabled individual under-voltage condition for channel 7. c) the channel timer of channel 0 (BAL_TMR_CH7) is zero. */ -#define MC33775_BAL_CH_CFG_CHEN7_POS (7U) -#define MC33775_BAL_CH_CFG_CHEN7_MSK (0x80U) - -/* Enumerated value DISABLED: Balancing for Channel 7 is disabled. The balancing timer for Channel 7 is stopped. */ -#define MC33775_BAL_CH_CFG_CHEN7_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Balancing for Channel 7 is enabled. */ -#define MC33775_BAL_CH_CFG_CHEN7_ENABLED_ENUM_VAL (1U) - -/* Field CHEN8: Enable balancing for channel 8. The bit is cleared by the device in case of: a) a detected over-current condition on channel 8. b) a detected and enabled individual under-voltage condition for channel 8. c) the channel timer of channel 0 (BAL_TMR_CH8) is zero. */ -#define MC33775_BAL_CH_CFG_CHEN8_POS (8U) -#define MC33775_BAL_CH_CFG_CHEN8_MSK (0x100U) - -/* Enumerated value DISABLED: Balancing for Channel 8 is disabled. The balancing timer for Channel 8 is stopped. */ -#define MC33775_BAL_CH_CFG_CHEN8_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Balancing for Channel 8 is enabled. */ -#define MC33775_BAL_CH_CFG_CHEN8_ENABLED_ENUM_VAL (1U) - -/* Field CHEN9: Enable balancing for channel 9. The bit is cleared by the device in case of: a) a detected over-current condition on channel 9. b) a detected and enabled individual under-voltage condition for channel 9. c) the channel timer of channel 0 (BAL_TMR_CH9) is zero. */ -#define MC33775_BAL_CH_CFG_CHEN9_POS (9U) -#define MC33775_BAL_CH_CFG_CHEN9_MSK (0x200U) - -/* Enumerated value DISABLED: Balancing for Channel 9 is disabled. The balancing timer for Channel 9 is stopped. */ -#define MC33775_BAL_CH_CFG_CHEN9_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Balancing for Channel 9 is enabled. */ -#define MC33775_BAL_CH_CFG_CHEN9_ENABLED_ENUM_VAL (1U) - -/* Field CHEN10: Enable balancing for channel 10. The bit is cleared by the device in case of: a) a detected over-current condition on channel 10. b) a detected and enabled individual under-voltage condition for channel 10. c) the channel timer of channel 0 (BAL_TMR_CH10) is zero. */ -#define MC33775_BAL_CH_CFG_CHEN10_POS (10U) -#define MC33775_BAL_CH_CFG_CHEN10_MSK (0x400U) - -/* Enumerated value DISABLED: Balancing for Channel 10 is disabled. The balancing timer for Channel 10 is stopped. */ -#define MC33775_BAL_CH_CFG_CHEN10_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Balancing for Channel 10 is enabled. */ -#define MC33775_BAL_CH_CFG_CHEN10_ENABLED_ENUM_VAL (1U) - -/* Field CHEN11: Enable balancing for channel 11. The bit is cleared by the device in case of: a) a detected over-current condition on channel 11. b) a detected and enabled individual under-voltage condition for channel 11. c) the channel timer of channel 0 (BAL_TMR_CH11) is zero. */ -#define MC33775_BAL_CH_CFG_CHEN11_POS (11U) -#define MC33775_BAL_CH_CFG_CHEN11_MSK (0x800U) - -/* Enumerated value DISABLED: Balancing for Channel 11 is disabled. The balancing timer for Channel 11 is stopped. */ -#define MC33775_BAL_CH_CFG_CHEN11_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Balancing for Channel 11 is enabled. */ -#define MC33775_BAL_CH_CFG_CHEN11_ENABLED_ENUM_VAL (1U) - -/* Field CHEN12: Enable balancing for channel 12. The bit is cleared by the device in case of: a) a detected over-current condition on channel 12. b) a detected and enabled individual under-voltage condition for channel 12. c) the channel timer of channel 0 (BAL_TMR_CH12) is zero. */ -#define MC33775_BAL_CH_CFG_CHEN12_POS (12U) -#define MC33775_BAL_CH_CFG_CHEN12_MSK (0x1000U) - -/* Enumerated value DISABLED: Balancing for Channel 12 is disabled. The balancing timer for Channel 12 is stopped. */ -#define MC33775_BAL_CH_CFG_CHEN12_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Balancing for Channel 12 is enabled. */ -#define MC33775_BAL_CH_CFG_CHEN12_ENABLED_ENUM_VAL (1U) - -/* Field CHEN13: Enable balancing for channel 13. The bit is cleared by the device in case of: a) a detected over-current condition on channel 13. b) a detected and enabled individual under-voltage condition for channel 13. c) the channel timer of channel 0 (BAL_TMR_CH13) is zero. */ -#define MC33775_BAL_CH_CFG_CHEN13_POS (13U) -#define MC33775_BAL_CH_CFG_CHEN13_MSK (0x2000U) - -/* Enumerated value DISABLED: Balancing for Channel 13 is disabled. The balancing timer for Channel 13 is stopped. */ -#define MC33775_BAL_CH_CFG_CHEN13_DISABLED_ENUM_VAL (0U) - -/* Enumerated value ENABLED: Balancing for Channel 13 is enabled. */ -#define MC33775_BAL_CH_CFG_CHEN13_ENABLED_ENUM_VAL (1U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_BAL_CH_CFG_RESERVED0_POS (14U) -#define MC33775_BAL_CH_CFG_RESERVED0_MSK (0xC000U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t CHEN0 : 1; - volatile uint16_t CHEN1 : 1; - volatile uint16_t CHEN2 : 1; - volatile uint16_t CHEN3 : 1; - volatile uint16_t CHEN4 : 1; - volatile uint16_t CHEN5 : 1; - volatile uint16_t CHEN6 : 1; - volatile uint16_t CHEN7 : 1; - volatile uint16_t CHEN8 : 1; - volatile uint16_t CHEN9 : 1; - volatile uint16_t CHEN10 : 1; - volatile uint16_t CHEN11 : 1; - volatile uint16_t CHEN12 : 1; - volatile uint16_t CHEN13 : 1; - volatile uint16_t reserved0 : 2; - } B; -} mc33775_balancing_registers_bal_ch_cfg_t; - -/* -------------------------------------------------------------------------- - * BAL_PRE_TMR (read-write):Pre-balancing timer - * -------------------------------------------------------------------------- */ -#define MC33775_BAL_PRE_TMR_OFFSET (0x1003U) -#define MC33775_BAL_PRE_TMR_RW_MSK (0xFFFFU) -#define MC33775_BAL_PRE_TMR_RD_MSK (0xFFFFU) -#define MC33775_BAL_PRE_TMR_WR_MSK (0xFFFFU) -#define MC33775_BAL_PRE_TMR_MW_MSK (0x0U) -#define MC33775_BAL_PRE_TMR_RA_MSK (0x0U) -#define MC33775_BAL_PRE_TMR_POR_MSK (0xffffU) -#define MC33775_BAL_PRE_TMR_POR_VAL (0x0U) - -/* Field PREBALTIME: Downcounter which runs if BALEN is set. Inhibits the balancing and holds the individual channel timer. The value of this field represents the current counter value when read. The counting saturates at 0 and activates the balancing. The BAL_GLOB_TO_TMR is not influenced by this timer. */ -#define MC33775_BAL_PRE_TMR_PREBALTIME_POS (0U) -#define MC33775_BAL_PRE_TMR_PREBALTIME_MSK (0xFFFFU) - -/* Enumerated value EXPIRED: Pre-balancing time is expired. */ -#define MC33775_BAL_PRE_TMR_PREBALTIME_EXPIRED_ENUM_VAL (0U) - -/* Enumerated value PREBAL: Pre-balancing time is set to PREBAL * 10 seconds */ -#define MC33775_BAL_PRE_TMR_PREBALTIME_PREBAL_ENUM_VAL (1U) - -/* Enumerated value MAX: Maximum pre-balancing time = 655350 seconds = approximately 182 hours = approximately 7.6 days */ -#define MC33775_BAL_PRE_TMR_PREBALTIME_MAX_ENUM_VAL (65535U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t PREBALTIME : 16; - } B; -} mc33775_balancing_registers_bal_pre_tmr_t; - -/* -------------------------------------------------------------------------- - * BAL_AUTO_DISCHRG_CTRL (read-write):Emergency discharge enable - * -------------------------------------------------------------------------- */ -#define MC33775_BAL_AUTO_DISCHRG_CTRL_OFFSET (0x1004U) -#define MC33775_BAL_AUTO_DISCHRG_CTRL_RW_MSK (0xFFFFU) -#define MC33775_BAL_AUTO_DISCHRG_CTRL_RD_MSK (0xFFFFU) -#define MC33775_BAL_AUTO_DISCHRG_CTRL_WR_MSK (0xFFFFU) -#define MC33775_BAL_AUTO_DISCHRG_CTRL_MW_MSK (0x0U) -#define MC33775_BAL_AUTO_DISCHRG_CTRL_RA_MSK (0x0U) -#define MC33775_BAL_AUTO_DISCHRG_CTRL_POR_MSK (0xffffU) -#define MC33775_BAL_AUTO_DISCHRG_CTRL_POR_VAL (0x2152U) - -/* Field KEY: Key for enabling auto discharge. After enabling, discharge will continue until disable key is received. Other values than DEADh or 2152h have no influence on the device functionality. */ -#define MC33775_BAL_AUTO_DISCHRG_CTRL_KEY_POS (0U) -#define MC33775_BAL_AUTO_DISCHRG_CTRL_KEY_MSK (0xFFFFU) - -/* Enumerated value OTHERS: Other values will be ignored. */ -#define MC33775_BAL_AUTO_DISCHRG_CTRL_KEY_OTHERS_ENUM_VAL (1U) - -/* Enumerated value DISABLED: Disable key for auto discharge. */ -#define MC33775_BAL_AUTO_DISCHRG_CTRL_KEY_DISABLED_ENUM_VAL (8530U) - -/* Enumerated value ENABLED: Enable key for auto discharge. */ -#define MC33775_BAL_AUTO_DISCHRG_CTRL_KEY_ENABLED_ENUM_VAL (57005U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t KEY : 16; - } B; -} mc33775_balancing_registers_bal_auto_dischrg_ctrl_t; - -/* -------------------------------------------------------------------------- - * BAL_CH_UV0_STAT (read-only):Channel under-voltage balancing status - * -------------------------------------------------------------------------- */ -#define MC33775_BAL_CH_UV0_STAT_OFFSET (0x1009U) -#define MC33775_BAL_CH_UV0_STAT_RW_MSK (0x0U) -#define MC33775_BAL_CH_UV0_STAT_RD_MSK (0x3FFFU) -#define MC33775_BAL_CH_UV0_STAT_WR_MSK (0x0U) -#define MC33775_BAL_CH_UV0_STAT_MW_MSK (0x0U) -#define MC33775_BAL_CH_UV0_STAT_RA_MSK (0x3FFFU) -#define MC33775_BAL_CH_UV0_STAT_POR_MSK (0xffffU) -#define MC33775_BAL_CH_UV0_STAT_POR_VAL (0x0U) - -/* Field CH0: Status bit, if a channel under-voltage condition was the reason for disabling individual balancing of channel 0. */ -#define MC33775_BAL_CH_UV0_STAT_CH0_POS (0U) -#define MC33775_BAL_CH_UV0_STAT_CH0_MSK (0x1U) - -/* Enumerated value NOUV: Balancing of channel 0 was not disabled due to under-voltage condition. */ -#define MC33775_BAL_CH_UV0_STAT_CH0_NOUV_ENUM_VAL (0U) - -/* Enumerated value UV: Balancing of channel 0 was disabled due to under-voltage condition. */ -#define MC33775_BAL_CH_UV0_STAT_CH0_UV_ENUM_VAL (1U) - -/* Field CH1: Status bit, if a channel under-voltage condition was the reason for disabling individual balancing of channel 1. */ -#define MC33775_BAL_CH_UV0_STAT_CH1_POS (1U) -#define MC33775_BAL_CH_UV0_STAT_CH1_MSK (0x2U) - -/* Enumerated value NOUV: Balancing of channel 1 was not disabled due to under-voltage condition. */ -#define MC33775_BAL_CH_UV0_STAT_CH1_NOUV_ENUM_VAL (0U) - -/* Enumerated value UV: Balancing of channel 1 was disabled due to under-voltage condition. */ -#define MC33775_BAL_CH_UV0_STAT_CH1_UV_ENUM_VAL (1U) - -/* Field CH2: Status bit, if a channel under-voltage condition was the reason for disabling individual balancing of channel 2. */ -#define MC33775_BAL_CH_UV0_STAT_CH2_POS (2U) -#define MC33775_BAL_CH_UV0_STAT_CH2_MSK (0x4U) - -/* Enumerated value NOUV: Balancing of channel 2 was not disabled due to under-voltage condition. */ -#define MC33775_BAL_CH_UV0_STAT_CH2_NOUV_ENUM_VAL (0U) - -/* Enumerated value UV: Balancing of channel 2 was disabled due to under-voltage condition. */ -#define MC33775_BAL_CH_UV0_STAT_CH2_UV_ENUM_VAL (1U) - -/* Field CH3: Status bit, if a channel under-voltage condition was the reason for disabling individual balancing of channel 3. */ -#define MC33775_BAL_CH_UV0_STAT_CH3_POS (3U) -#define MC33775_BAL_CH_UV0_STAT_CH3_MSK (0x8U) - -/* Enumerated value NOUV: Balancing of channel 3 was not disabled due to under-voltage condition. */ -#define MC33775_BAL_CH_UV0_STAT_CH3_NOUV_ENUM_VAL (0U) - -/* Enumerated value UV: Balancing of channel 3 was disabled due to under-voltage condition. */ -#define MC33775_BAL_CH_UV0_STAT_CH3_UV_ENUM_VAL (1U) - -/* Field CH4: Status bit, if a channel under-voltage condition was the reason for disabling individual balancing of channel 4. */ -#define MC33775_BAL_CH_UV0_STAT_CH4_POS (4U) -#define MC33775_BAL_CH_UV0_STAT_CH4_MSK (0x10U) - -/* Enumerated value NOUV: Balancing of channel 4 was not disabled due to under-voltage condition. */ -#define MC33775_BAL_CH_UV0_STAT_CH4_NOUV_ENUM_VAL (0U) - -/* Enumerated value UV: Balancing of channel 4 was disabled due to under-voltage condition. */ -#define MC33775_BAL_CH_UV0_STAT_CH4_UV_ENUM_VAL (1U) - -/* Field CH5: Status bit, if a channel under-voltage condition was the reason for disabling individual balancing of channel 5. */ -#define MC33775_BAL_CH_UV0_STAT_CH5_POS (5U) -#define MC33775_BAL_CH_UV0_STAT_CH5_MSK (0x20U) - -/* Enumerated value NOUV: Balancing of channel 5 was not disabled due to under-voltage condition. */ -#define MC33775_BAL_CH_UV0_STAT_CH5_NOUV_ENUM_VAL (0U) - -/* Enumerated value UV: Balancing of channel 5 was disabled due to under-voltage condition. */ -#define MC33775_BAL_CH_UV0_STAT_CH5_UV_ENUM_VAL (1U) - -/* Field CH6: Status bit, if a channel under-voltage condition was the reason for disabling individual balancing of channel 6. */ -#define MC33775_BAL_CH_UV0_STAT_CH6_POS (6U) -#define MC33775_BAL_CH_UV0_STAT_CH6_MSK (0x40U) - -/* Enumerated value NOUV: Balancing of channel 6 was not disabled due to under-voltage condition. */ -#define MC33775_BAL_CH_UV0_STAT_CH6_NOUV_ENUM_VAL (0U) - -/* Enumerated value UV: Balancing of channel 6 was disabled due to under-voltage condition. */ -#define MC33775_BAL_CH_UV0_STAT_CH6_UV_ENUM_VAL (1U) - -/* Field CH7: Status bit, if a channel under-voltage condition was the reason for disabling individual balancing of channel 7. */ -#define MC33775_BAL_CH_UV0_STAT_CH7_POS (7U) -#define MC33775_BAL_CH_UV0_STAT_CH7_MSK (0x80U) - -/* Enumerated value NOUV: Balancing of channel 7 was not disabled due to under-voltage condition. */ -#define MC33775_BAL_CH_UV0_STAT_CH7_NOUV_ENUM_VAL (0U) - -/* Enumerated value UV: Balancing of channel 7 was disabled due to under-voltage condition. */ -#define MC33775_BAL_CH_UV0_STAT_CH7_UV_ENUM_VAL (1U) - -/* Field CH8: Status bit, if a channel under-voltage condition was the reason for disabling individual balancing of channel 8. */ -#define MC33775_BAL_CH_UV0_STAT_CH8_POS (8U) -#define MC33775_BAL_CH_UV0_STAT_CH8_MSK (0x100U) - -/* Enumerated value NOUV: Balancing of channel 8 was not disabled due to under-voltage condition. */ -#define MC33775_BAL_CH_UV0_STAT_CH8_NOUV_ENUM_VAL (0U) - -/* Enumerated value UV: Balancing of channel 8 was disabled due to under-voltage condition. */ -#define MC33775_BAL_CH_UV0_STAT_CH8_UV_ENUM_VAL (1U) - -/* Field CH9: Status bit, if a channel under-voltage condition was the reason for disabling individual balancing of channel 9. */ -#define MC33775_BAL_CH_UV0_STAT_CH9_POS (9U) -#define MC33775_BAL_CH_UV0_STAT_CH9_MSK (0x200U) - -/* Enumerated value NOUV: Balancing of channel 9 was not disabled due to under-voltage condition. */ -#define MC33775_BAL_CH_UV0_STAT_CH9_NOUV_ENUM_VAL (0U) - -/* Enumerated value UV: Balancing of channel 9 was disabled due to under-voltage condition. */ -#define MC33775_BAL_CH_UV0_STAT_CH9_UV_ENUM_VAL (1U) - -/* Field CH10: Status bit, if a channel under-voltage condition was the reason for disabling individual balancing of channel 10. */ -#define MC33775_BAL_CH_UV0_STAT_CH10_POS (10U) -#define MC33775_BAL_CH_UV0_STAT_CH10_MSK (0x400U) - -/* Enumerated value NOUV: Balancing of channel 10 was not disabled due to under-voltage condition. */ -#define MC33775_BAL_CH_UV0_STAT_CH10_NOUV_ENUM_VAL (0U) - -/* Enumerated value UV: Balancing of channel 10 was disabled due to under-voltage condition. */ -#define MC33775_BAL_CH_UV0_STAT_CH10_UV_ENUM_VAL (1U) - -/* Field CH11: Status bit, if a channel under-voltage condition was the reason for disabling individual balancing of channel 11. */ -#define MC33775_BAL_CH_UV0_STAT_CH11_POS (11U) -#define MC33775_BAL_CH_UV0_STAT_CH11_MSK (0x800U) - -/* Enumerated value NOUV: Balancing of channel 11 was not disabled due to under-voltage condition. */ -#define MC33775_BAL_CH_UV0_STAT_CH11_NOUV_ENUM_VAL (0U) - -/* Enumerated value UV: Balancing of channel 11 was disabled due to under-voltage condition. */ -#define MC33775_BAL_CH_UV0_STAT_CH11_UV_ENUM_VAL (1U) - -/* Field CH12: Status bit, if a channel under-voltage condition was the reason for disabling individual balancing of channel 12. */ -#define MC33775_BAL_CH_UV0_STAT_CH12_POS (12U) -#define MC33775_BAL_CH_UV0_STAT_CH12_MSK (0x1000U) - -/* Enumerated value NOUV: Balancing of channel 12 was not disabled due to under-voltage condition. */ -#define MC33775_BAL_CH_UV0_STAT_CH12_NOUV_ENUM_VAL (0U) - -/* Enumerated value UV: Balancing of channel 12 was disabled due to under-voltage condition. */ -#define MC33775_BAL_CH_UV0_STAT_CH12_UV_ENUM_VAL (1U) - -/* Field CH13: Status bit, if a channel under-voltage condition was the reason for disabling individual balancing of channel 13. */ -#define MC33775_BAL_CH_UV0_STAT_CH13_POS (13U) -#define MC33775_BAL_CH_UV0_STAT_CH13_MSK (0x2000U) - -/* Enumerated value NOUV: Balancing of channel 13 was not disabled due to under-voltage condition. */ -#define MC33775_BAL_CH_UV0_STAT_CH13_NOUV_ENUM_VAL (0U) - -/* Enumerated value UV: Balancing of channel 13 was disabled due to under-voltage condition. */ -#define MC33775_BAL_CH_UV0_STAT_CH13_UV_ENUM_VAL (1U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_BAL_CH_UV0_STAT_RESERVED0_POS (14U) -#define MC33775_BAL_CH_UV0_STAT_RESERVED0_MSK (0xC000U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t CH0 : 1; - volatile uint16_t CH1 : 1; - volatile uint16_t CH2 : 1; - volatile uint16_t CH3 : 1; - volatile uint16_t CH4 : 1; - volatile uint16_t CH5 : 1; - volatile uint16_t CH6 : 1; - volatile uint16_t CH7 : 1; - volatile uint16_t CH8 : 1; - volatile uint16_t CH9 : 1; - volatile uint16_t CH10 : 1; - volatile uint16_t CH11 : 1; - volatile uint16_t CH12 : 1; - volatile uint16_t CH13 : 1; - volatile uint16_t reserved0 : 2; - } B; -} mc33775_balancing_registers_bal_ch_uv0_stat_t; - -/* -------------------------------------------------------------------------- - * BAL_GLOB_UV1_STAT (read-only):Global under-voltage balancing status - * -------------------------------------------------------------------------- */ -#define MC33775_BAL_GLOB_UV1_STAT_OFFSET (0x100AU) -#define MC33775_BAL_GLOB_UV1_STAT_RW_MSK (0x0U) -#define MC33775_BAL_GLOB_UV1_STAT_RD_MSK (0x3FFFU) -#define MC33775_BAL_GLOB_UV1_STAT_WR_MSK (0x0U) -#define MC33775_BAL_GLOB_UV1_STAT_MW_MSK (0x0U) -#define MC33775_BAL_GLOB_UV1_STAT_RA_MSK (0x3FFFU) -#define MC33775_BAL_GLOB_UV1_STAT_POR_MSK (0xffffU) -#define MC33775_BAL_GLOB_UV1_STAT_POR_VAL (0x0U) - -/* Field CH0: Status bit, if a global under-voltage of channel 0 condition was the reason for disabling the global balancing: */ -#define MC33775_BAL_GLOB_UV1_STAT_CH0_POS (0U) -#define MC33775_BAL_GLOB_UV1_STAT_CH0_MSK (0x1U) - -/* Enumerated value NOUV: Balancing of channel 0 was not disabled due to global under-voltage condition. */ -#define MC33775_BAL_GLOB_UV1_STAT_CH0_NOUV_ENUM_VAL (0U) - -/* Enumerated value UV: Balancing of channel 0 was disabled due to global under-voltage condition. */ -#define MC33775_BAL_GLOB_UV1_STAT_CH0_UV_ENUM_VAL (1U) - -/* Field CH1: Status bit, if a global under-voltage of channel 1 condition was the reason for disabling the global balancing: */ -#define MC33775_BAL_GLOB_UV1_STAT_CH1_POS (1U) -#define MC33775_BAL_GLOB_UV1_STAT_CH1_MSK (0x2U) - -/* Enumerated value NOUV: Balancing of channel 1 was not disabled due to global under-voltage condition. */ -#define MC33775_BAL_GLOB_UV1_STAT_CH1_NOUV_ENUM_VAL (0U) - -/* Enumerated value UV: Balancing of channel 1 was disabled due to global under-voltage condition. */ -#define MC33775_BAL_GLOB_UV1_STAT_CH1_UV_ENUM_VAL (1U) - -/* Field CH2: Status bit, if a global under-voltage of channel 2 condition was the reason for disabling the global balancing: */ -#define MC33775_BAL_GLOB_UV1_STAT_CH2_POS (2U) -#define MC33775_BAL_GLOB_UV1_STAT_CH2_MSK (0x4U) - -/* Enumerated value NOUV: Balancing of channel 2 was not disabled due to global under-voltage condition. */ -#define MC33775_BAL_GLOB_UV1_STAT_CH2_NOUV_ENUM_VAL (0U) - -/* Enumerated value UV: Balancing of channel 2 was disabled due to global under-voltage condition. */ -#define MC33775_BAL_GLOB_UV1_STAT_CH2_UV_ENUM_VAL (1U) - -/* Field CH3: Status bit, if a global under-voltage of channel 3 condition was the reason for disabling the global balancing: */ -#define MC33775_BAL_GLOB_UV1_STAT_CH3_POS (3U) -#define MC33775_BAL_GLOB_UV1_STAT_CH3_MSK (0x8U) - -/* Enumerated value NOUV: Balancing of channel 3 was not disabled due to global under-voltage condition. */ -#define MC33775_BAL_GLOB_UV1_STAT_CH3_NOUV_ENUM_VAL (0U) - -/* Enumerated value UV: Balancing of channel 3 was disabled due to global under-voltage condition. */ -#define MC33775_BAL_GLOB_UV1_STAT_CH3_UV_ENUM_VAL (1U) - -/* Field CH4: Status bit, if a global under-voltage of channel 4 condition was the reason for disabling the global balancing: */ -#define MC33775_BAL_GLOB_UV1_STAT_CH4_POS (4U) -#define MC33775_BAL_GLOB_UV1_STAT_CH4_MSK (0x10U) - -/* Enumerated value NOUV: Balancing of channel 4 was not disabled due to global under-voltage condition. */ -#define MC33775_BAL_GLOB_UV1_STAT_CH4_NOUV_ENUM_VAL (0U) - -/* Enumerated value UV: Balancing of channel 4 was disabled due to global under-voltage condition. */ -#define MC33775_BAL_GLOB_UV1_STAT_CH4_UV_ENUM_VAL (1U) - -/* Field CH5: Status bit, if a global under-voltage of channel 5 condition was the reason for disabling the global balancing: */ -#define MC33775_BAL_GLOB_UV1_STAT_CH5_POS (5U) -#define MC33775_BAL_GLOB_UV1_STAT_CH5_MSK (0x20U) - -/* Enumerated value NOUV: Balancing of channel 5 was not disabled due to global under-voltage condition. */ -#define MC33775_BAL_GLOB_UV1_STAT_CH5_NOUV_ENUM_VAL (0U) - -/* Enumerated value UV: Balancing of channel 5 was disabled due to global under-voltage condition. */ -#define MC33775_BAL_GLOB_UV1_STAT_CH5_UV_ENUM_VAL (1U) - -/* Field CH6: Status bit, if a global under-voltage of channel 6 condition was the reason for disabling the global balancing: */ -#define MC33775_BAL_GLOB_UV1_STAT_CH6_POS (6U) -#define MC33775_BAL_GLOB_UV1_STAT_CH6_MSK (0x40U) - -/* Enumerated value NOUV: Balancing of channel 6 was not disabled due to global under-voltage condition. */ -#define MC33775_BAL_GLOB_UV1_STAT_CH6_NOUV_ENUM_VAL (0U) - -/* Enumerated value UV: Balancing of channel 6 was disabled due to global under-voltage condition. */ -#define MC33775_BAL_GLOB_UV1_STAT_CH6_UV_ENUM_VAL (1U) - -/* Field CH7: Status bit, if a global under-voltage of channel 7 condition was the reason for disabling the global balancing: */ -#define MC33775_BAL_GLOB_UV1_STAT_CH7_POS (7U) -#define MC33775_BAL_GLOB_UV1_STAT_CH7_MSK (0x80U) - -/* Enumerated value NOUV: Balancing of channel 7 was not disabled due to global under-voltage condition. */ -#define MC33775_BAL_GLOB_UV1_STAT_CH7_NOUV_ENUM_VAL (0U) - -/* Enumerated value UV: Balancing of channel 7 was disabled due to global under-voltage condition. */ -#define MC33775_BAL_GLOB_UV1_STAT_CH7_UV_ENUM_VAL (1U) - -/* Field CH8: Status bit, if a global under-voltage of channel 8 condition was the reason for disabling the global balancing: */ -#define MC33775_BAL_GLOB_UV1_STAT_CH8_POS (8U) -#define MC33775_BAL_GLOB_UV1_STAT_CH8_MSK (0x100U) - -/* Enumerated value NOUV: Balancing of channel 8 was not disabled due to global under-voltage condition. */ -#define MC33775_BAL_GLOB_UV1_STAT_CH8_NOUV_ENUM_VAL (0U) - -/* Enumerated value UV: Balancing of channel 8 was disabled due to global under-voltage condition. */ -#define MC33775_BAL_GLOB_UV1_STAT_CH8_UV_ENUM_VAL (1U) - -/* Field CH9: Status bit, if a global under-voltage of channel 9 condition was the reason for disabling the global balancing: */ -#define MC33775_BAL_GLOB_UV1_STAT_CH9_POS (9U) -#define MC33775_BAL_GLOB_UV1_STAT_CH9_MSK (0x200U) - -/* Enumerated value NOUV: Balancing of channel 9 was not disabled due to global under-voltage condition. */ -#define MC33775_BAL_GLOB_UV1_STAT_CH9_NOUV_ENUM_VAL (0U) - -/* Enumerated value UV: Balancing of channel 9 was disabled due to global under-voltage condition. */ -#define MC33775_BAL_GLOB_UV1_STAT_CH9_UV_ENUM_VAL (1U) - -/* Field CH10: Status bit, if a global under-voltage of channel 10 condition was the reason for disabling the global balancing: */ -#define MC33775_BAL_GLOB_UV1_STAT_CH10_POS (10U) -#define MC33775_BAL_GLOB_UV1_STAT_CH10_MSK (0x400U) - -/* Enumerated value NOUV: Balancing of channel 10 was not disabled due to global under-voltage condition. */ -#define MC33775_BAL_GLOB_UV1_STAT_CH10_NOUV_ENUM_VAL (0U) - -/* Enumerated value UV: Balancing of channel 10 was disabled due to global under-voltage condition. */ -#define MC33775_BAL_GLOB_UV1_STAT_CH10_UV_ENUM_VAL (1U) - -/* Field CH11: Status bit, if a global under-voltage of channel 11 condition was the reason for disabling the global balancing: */ -#define MC33775_BAL_GLOB_UV1_STAT_CH11_POS (11U) -#define MC33775_BAL_GLOB_UV1_STAT_CH11_MSK (0x800U) - -/* Enumerated value NOUV: Balancing of channel 11 was not disabled due to global under-voltage condition. */ -#define MC33775_BAL_GLOB_UV1_STAT_CH11_NOUV_ENUM_VAL (0U) - -/* Enumerated value UV: Balancing of channel 11 was disabled due to global under-voltage condition. */ -#define MC33775_BAL_GLOB_UV1_STAT_CH11_UV_ENUM_VAL (1U) - -/* Field CH12: Status bit, if a global under-voltage of channel 12 condition was the reason for disabling the global balancing: */ -#define MC33775_BAL_GLOB_UV1_STAT_CH12_POS (12U) -#define MC33775_BAL_GLOB_UV1_STAT_CH12_MSK (0x1000U) - -/* Enumerated value NOUV: Balancing of channel 12 was not disabled due to global under-voltage condition. */ -#define MC33775_BAL_GLOB_UV1_STAT_CH12_NOUV_ENUM_VAL (0U) - -/* Enumerated value UV: Balancing of channel 12 was disabled due to global under-voltage condition. */ -#define MC33775_BAL_GLOB_UV1_STAT_CH12_UV_ENUM_VAL (1U) - -/* Field CH13: Status bit, if a global under-voltage of channel 13 condition was the reason for disabling the global balancing: */ -#define MC33775_BAL_GLOB_UV1_STAT_CH13_POS (13U) -#define MC33775_BAL_GLOB_UV1_STAT_CH13_MSK (0x2000U) - -/* Enumerated value NOUV: Balancing of channel 13 was not disabled due to global under-voltage condition. */ -#define MC33775_BAL_GLOB_UV1_STAT_CH13_NOUV_ENUM_VAL (0U) - -/* Enumerated value UV: Balancing of channel 13 was disabled due to global under-voltage condition. */ -#define MC33775_BAL_GLOB_UV1_STAT_CH13_UV_ENUM_VAL (1U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_BAL_GLOB_UV1_STAT_RESERVED0_POS (14U) -#define MC33775_BAL_GLOB_UV1_STAT_RESERVED0_MSK (0xC000U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t CH0 : 1; - volatile uint16_t CH1 : 1; - volatile uint16_t CH2 : 1; - volatile uint16_t CH3 : 1; - volatile uint16_t CH4 : 1; - volatile uint16_t CH5 : 1; - volatile uint16_t CH6 : 1; - volatile uint16_t CH7 : 1; - volatile uint16_t CH8 : 1; - volatile uint16_t CH9 : 1; - volatile uint16_t CH10 : 1; - volatile uint16_t CH11 : 1; - volatile uint16_t CH12 : 1; - volatile uint16_t CH13 : 1; - volatile uint16_t reserved0 : 2; - } B; -} mc33775_balancing_registers_bal_glob_uv1_stat_t; - -/* -------------------------------------------------------------------------- - * BAL_STAT0 (read-only):Logical balancing channel status - * -------------------------------------------------------------------------- */ -#define MC33775_BAL_STAT0_OFFSET (0x100BU) -#define MC33775_BAL_STAT0_RW_MSK (0x0U) -#define MC33775_BAL_STAT0_RD_MSK (0x3FFFU) -#define MC33775_BAL_STAT0_WR_MSK (0x0U) -#define MC33775_BAL_STAT0_MW_MSK (0x0U) -#define MC33775_BAL_STAT0_RA_MSK (0x0U) -#define MC33775_BAL_STAT0_POR_MSK (0xffffU) -#define MC33775_BAL_STAT0_POR_VAL (0x0U) - -/* Field CH0: Balancing channel 0 status (without PWM) */ -#define MC33775_BAL_STAT0_CH0_POS (0U) -#define MC33775_BAL_STAT0_CH0_MSK (0x1U) - -/* Enumerated value INACTIVE: Balancing for channel 0 inactive. */ -#define MC33775_BAL_STAT0_CH0_INACTIVE_ENUM_VAL (0U) - -/* Enumerated value ACTIVE: Balancing for channel 0 active. */ -#define MC33775_BAL_STAT0_CH0_ACTIVE_ENUM_VAL (1U) - -/* Field CH1: Balancing channel 1 status (without PWM) */ -#define MC33775_BAL_STAT0_CH1_POS (1U) -#define MC33775_BAL_STAT0_CH1_MSK (0x2U) - -/* Enumerated value INACTIVE: Balancing for channel 1 inactive. */ -#define MC33775_BAL_STAT0_CH1_INACTIVE_ENUM_VAL (0U) - -/* Enumerated value ACTIVE: Balancing for channel 1 active. */ -#define MC33775_BAL_STAT0_CH1_ACTIVE_ENUM_VAL (1U) - -/* Field CH2: Balancing channel 2 status (without PWM) */ -#define MC33775_BAL_STAT0_CH2_POS (2U) -#define MC33775_BAL_STAT0_CH2_MSK (0x4U) - -/* Enumerated value INACTIVE: Balancing for channel 2 inactive. */ -#define MC33775_BAL_STAT0_CH2_INACTIVE_ENUM_VAL (0U) - -/* Enumerated value ACTIVE: Balancing for channel 2 active. */ -#define MC33775_BAL_STAT0_CH2_ACTIVE_ENUM_VAL (1U) - -/* Field CH3: Balancing channel 3 status (without PWM) */ -#define MC33775_BAL_STAT0_CH3_POS (3U) -#define MC33775_BAL_STAT0_CH3_MSK (0x8U) - -/* Enumerated value INACTIVE: Balancing for channel 3 inactive. */ -#define MC33775_BAL_STAT0_CH3_INACTIVE_ENUM_VAL (0U) - -/* Enumerated value ACTIVE: Balancing for channel 3 active. */ -#define MC33775_BAL_STAT0_CH3_ACTIVE_ENUM_VAL (1U) - -/* Field CH4: Balancing channel 4 status (without PWM) */ -#define MC33775_BAL_STAT0_CH4_POS (4U) -#define MC33775_BAL_STAT0_CH4_MSK (0x10U) - -/* Enumerated value INACTIVE: Balancing for channel 4 inactive. */ -#define MC33775_BAL_STAT0_CH4_INACTIVE_ENUM_VAL (0U) - -/* Enumerated value ACTIVE: Balancing for channel 4 active. */ -#define MC33775_BAL_STAT0_CH4_ACTIVE_ENUM_VAL (1U) - -/* Field CH5: Balancing channel 5 status (without PWM) */ -#define MC33775_BAL_STAT0_CH5_POS (5U) -#define MC33775_BAL_STAT0_CH5_MSK (0x20U) - -/* Enumerated value INACTIVE: Balancing for channel 5 inactive. */ -#define MC33775_BAL_STAT0_CH5_INACTIVE_ENUM_VAL (0U) - -/* Enumerated value ACTIVE: Balancing for channel 5 active. */ -#define MC33775_BAL_STAT0_CH5_ACTIVE_ENUM_VAL (1U) - -/* Field CH6: Balancing channel 6 status (without PWM) */ -#define MC33775_BAL_STAT0_CH6_POS (6U) -#define MC33775_BAL_STAT0_CH6_MSK (0x40U) - -/* Enumerated value INACTIVE: Balancing for channel 6 inactive. */ -#define MC33775_BAL_STAT0_CH6_INACTIVE_ENUM_VAL (0U) - -/* Enumerated value ACTIVE: Balancing for channel 6 active. */ -#define MC33775_BAL_STAT0_CH6_ACTIVE_ENUM_VAL (1U) - -/* Field CH7: Balancing channel 7 status (without PWM) */ -#define MC33775_BAL_STAT0_CH7_POS (7U) -#define MC33775_BAL_STAT0_CH7_MSK (0x80U) - -/* Enumerated value INACTIVE: Balancing for channel 7 inactive. */ -#define MC33775_BAL_STAT0_CH7_INACTIVE_ENUM_VAL (0U) - -/* Enumerated value ACTIVE: Balancing for channel 7 active. */ -#define MC33775_BAL_STAT0_CH7_ACTIVE_ENUM_VAL (1U) - -/* Field CH8: Balancing channel 8 status (without PWM) */ -#define MC33775_BAL_STAT0_CH8_POS (8U) -#define MC33775_BAL_STAT0_CH8_MSK (0x100U) - -/* Enumerated value INACTIVE: Balancing for channel 8 inactive. */ -#define MC33775_BAL_STAT0_CH8_INACTIVE_ENUM_VAL (0U) - -/* Enumerated value ACTIVE: Balancing for channel 8 active. */ -#define MC33775_BAL_STAT0_CH8_ACTIVE_ENUM_VAL (1U) - -/* Field CH9: Balancing channel 9 status (without PWM) */ -#define MC33775_BAL_STAT0_CH9_POS (9U) -#define MC33775_BAL_STAT0_CH9_MSK (0x200U) - -/* Enumerated value INACTIVE: Balancing for channel 9 inactive. */ -#define MC33775_BAL_STAT0_CH9_INACTIVE_ENUM_VAL (0U) - -/* Enumerated value ACTIVE: Balancing for channel 9 active. */ -#define MC33775_BAL_STAT0_CH9_ACTIVE_ENUM_VAL (1U) - -/* Field CH10: Balancing channel 10 status (without PWM) */ -#define MC33775_BAL_STAT0_CH10_POS (10U) -#define MC33775_BAL_STAT0_CH10_MSK (0x400U) - -/* Enumerated value INACTIVE: Balancing for channel 10 inactive. */ -#define MC33775_BAL_STAT0_CH10_INACTIVE_ENUM_VAL (0U) - -/* Enumerated value ACTIVE: Balancing for channel 10 active. */ -#define MC33775_BAL_STAT0_CH10_ACTIVE_ENUM_VAL (1U) - -/* Field CH11: Balancing channel 11 status (without PWM) */ -#define MC33775_BAL_STAT0_CH11_POS (11U) -#define MC33775_BAL_STAT0_CH11_MSK (0x800U) - -/* Enumerated value INACTIVE: Balancing for channel 11 inactive. */ -#define MC33775_BAL_STAT0_CH11_INACTIVE_ENUM_VAL (0U) - -/* Enumerated value ACTIVE: Balancing for channel 11 active. */ -#define MC33775_BAL_STAT0_CH11_ACTIVE_ENUM_VAL (1U) - -/* Field CH12: Balancing channel 12 status (without PWM) */ -#define MC33775_BAL_STAT0_CH12_POS (12U) -#define MC33775_BAL_STAT0_CH12_MSK (0x1000U) - -/* Enumerated value INACTIVE: Balancing for channel 12 inactive. */ -#define MC33775_BAL_STAT0_CH12_INACTIVE_ENUM_VAL (0U) - -/* Enumerated value ACTIVE: Balancing for channel 12 active. */ -#define MC33775_BAL_STAT0_CH12_ACTIVE_ENUM_VAL (1U) - -/* Field CH13: Balancing channel 13 status (without PWM) */ -#define MC33775_BAL_STAT0_CH13_POS (13U) -#define MC33775_BAL_STAT0_CH13_MSK (0x2000U) - -/* Enumerated value INACTIVE: Balancing for channel 13 inactive. */ -#define MC33775_BAL_STAT0_CH13_INACTIVE_ENUM_VAL (0U) - -/* Enumerated value ACTIVE: Balancing for channel 13 active. */ -#define MC33775_BAL_STAT0_CH13_ACTIVE_ENUM_VAL (1U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_BAL_STAT0_RESERVED0_POS (14U) -#define MC33775_BAL_STAT0_RESERVED0_MSK (0xC000U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t CH0 : 1; - volatile uint16_t CH1 : 1; - volatile uint16_t CH2 : 1; - volatile uint16_t CH3 : 1; - volatile uint16_t CH4 : 1; - volatile uint16_t CH5 : 1; - volatile uint16_t CH6 : 1; - volatile uint16_t CH7 : 1; - volatile uint16_t CH8 : 1; - volatile uint16_t CH9 : 1; - volatile uint16_t CH10 : 1; - volatile uint16_t CH11 : 1; - volatile uint16_t CH12 : 1; - volatile uint16_t CH13 : 1; - volatile uint16_t reserved0 : 2; - } B; -} mc33775_balancing_registers_bal_stat0_t; - -/* -------------------------------------------------------------------------- - * BAL_STAT1 (read-only):Balancing status - * -------------------------------------------------------------------------- */ -#define MC33775_BAL_STAT1_OFFSET (0x100CU) -#define MC33775_BAL_STAT1_RW_MSK (0x0U) -#define MC33775_BAL_STAT1_RD_MSK (0x8007U) -#define MC33775_BAL_STAT1_WR_MSK (0x0U) -#define MC33775_BAL_STAT1_MW_MSK (0x0U) -#define MC33775_BAL_STAT1_RA_MSK (0x8000U) -#define MC33775_BAL_STAT1_POR_MSK (0xffffU) -#define MC33775_BAL_STAT1_POR_VAL (0x0U) - -/* Field PREBALTMR: Pre-Balancing status */ -#define MC33775_BAL_STAT1_PREBALTMR_POS (0U) -#define MC33775_BAL_STAT1_PREBALTMR_MSK (0x1U) - -/* Enumerated value INACTIVE: No pre-balancing timer active. */ -#define MC33775_BAL_STAT1_PREBALTMR_INACTIVE_ENUM_VAL (0U) - -/* Enumerated value ACTIVE: Pre-balancing timer active (Balancing is inhibited). */ -#define MC33775_BAL_STAT1_PREBALTMR_ACTIVE_ENUM_VAL (1U) - -/* Field TEMPBALINHIBIT: Temperature balancing status */ -#define MC33775_BAL_STAT1_TEMPBALINHIBIT_POS (1U) -#define MC33775_BAL_STAT1_TEMPBALINHIBIT_MSK (0x2U) - -/* Enumerated value INACTIVE: Temperature based balancing control allows balancing. */ -#define MC33775_BAL_STAT1_TEMPBALINHIBIT_INACTIVE_ENUM_VAL (0U) - -/* Enumerated value ACTIVE: Temperature based balancing control inhibits balancing. */ -#define MC33775_BAL_STAT1_TEMPBALINHIBIT_ACTIVE_ENUM_VAL (1U) - -/* Field AUTODISCHRG: Auto discharge status */ -#define MC33775_BAL_STAT1_AUTODISCHRG_POS (2U) -#define MC33775_BAL_STAT1_AUTODISCHRG_MSK (0x4U) - -/* Enumerated value INACTIVE: Auto discharge inactive */ -#define MC33775_BAL_STAT1_AUTODISCHRG_INACTIVE_ENUM_VAL (0U) - -/* Enumerated value ACTIVE: Auto discharge active */ -#define MC33775_BAL_STAT1_AUTODISCHRG_ACTIVE_ENUM_VAL (1U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_BAL_STAT1_RESERVED0_POS (3U) -#define MC33775_BAL_STAT1_RESERVED0_MSK (0x7FF8U) - -/* Field RDY: The ready bit is set after the cell balancing operation is finished. Reasons for this are that the last BAL_CH_EN.CHx has been cleared by hardware or the BAL_GLOB_CFG.BALEN has been cleared by hardware. With setting of BAL_GLOB_CFG.BALEN this bit is cleared. */ -#define MC33775_BAL_STAT1_RDY_POS (15U) -#define MC33775_BAL_STAT1_RDY_MSK (0x8000U) - -/* Enumerated value ONGOING: Balancing operation in progress. */ -#define MC33775_BAL_STAT1_RDY_ONGOING_ENUM_VAL (0U) - -/* Enumerated value FINISHED: Balancing operation finished. */ -#define MC33775_BAL_STAT1_RDY_FINISHED_ENUM_VAL (1U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t PREBALTMR : 1; - volatile uint16_t TEMPBALINHIBIT : 1; - volatile uint16_t AUTODISCHRG : 1; - volatile uint16_t reserved0 : 12; - volatile uint16_t RDY : 1; - } B; -} mc33775_balancing_registers_bal_stat1_t; - -/* -------------------------------------------------------------------------- - * BAL_SWITCH_STAT (read-only):Physical balancing channel status - * -------------------------------------------------------------------------- */ -#define MC33775_BAL_SWITCH_STAT_OFFSET (0x100DU) -#define MC33775_BAL_SWITCH_STAT_RW_MSK (0x0U) -#define MC33775_BAL_SWITCH_STAT_RD_MSK (0x3FFFU) -#define MC33775_BAL_SWITCH_STAT_WR_MSK (0x0U) -#define MC33775_BAL_SWITCH_STAT_MW_MSK (0x0U) -#define MC33775_BAL_SWITCH_STAT_RA_MSK (0x0U) -#define MC33775_BAL_SWITCH_STAT_POR_MSK (0xffffU) -#define MC33775_BAL_SWITCH_STAT_POR_VAL (0x0U) - -/* Field CH0: Balancing FET status channel 0 This is the actual status (including PWM modulation) from the switch monitor circuit. */ -#define MC33775_BAL_SWITCH_STAT_CH0_POS (0U) -#define MC33775_BAL_SWITCH_STAT_CH0_MSK (0x1U) - -/* Enumerated value OPEN: Balancing FET is open. */ -#define MC33775_BAL_SWITCH_STAT_CH0_OPEN_ENUM_VAL (0U) - -/* Enumerated value CLOSED: Balancing FET is closed. */ -#define MC33775_BAL_SWITCH_STAT_CH0_CLOSED_ENUM_VAL (1U) - -/* Field CH1: Balancing FET status channel 1 This is the actual status (including PWM modulation) from the switch monitor circuit. */ -#define MC33775_BAL_SWITCH_STAT_CH1_POS (1U) -#define MC33775_BAL_SWITCH_STAT_CH1_MSK (0x2U) - -/* Enumerated value OPEN: Balancing FET is open. */ -#define MC33775_BAL_SWITCH_STAT_CH1_OPEN_ENUM_VAL (0U) - -/* Enumerated value CLOSED: Balancing FET is closed. */ -#define MC33775_BAL_SWITCH_STAT_CH1_CLOSED_ENUM_VAL (1U) - -/* Field CH2: Balancing FET status channel 2 This is the actual status (including PWM modulation) from the switch monitor circuit. */ -#define MC33775_BAL_SWITCH_STAT_CH2_POS (2U) -#define MC33775_BAL_SWITCH_STAT_CH2_MSK (0x4U) - -/* Enumerated value OPEN: Balancing FET is open. */ -#define MC33775_BAL_SWITCH_STAT_CH2_OPEN_ENUM_VAL (0U) - -/* Enumerated value CLOSED: Balancing FET is closed. */ -#define MC33775_BAL_SWITCH_STAT_CH2_CLOSED_ENUM_VAL (1U) - -/* Field CH3: Balancing FET status channel 3 This is the actual status (including PWM modulation) from the switch monitor circuit. */ -#define MC33775_BAL_SWITCH_STAT_CH3_POS (3U) -#define MC33775_BAL_SWITCH_STAT_CH3_MSK (0x8U) - -/* Enumerated value OPEN: Balancing FET is open. */ -#define MC33775_BAL_SWITCH_STAT_CH3_OPEN_ENUM_VAL (0U) - -/* Enumerated value CLOSED: Balancing FET is closed. */ -#define MC33775_BAL_SWITCH_STAT_CH3_CLOSED_ENUM_VAL (1U) - -/* Field CH4: Balancing FET status channel 4 This is the actual status (including PWM modulation) from the switch monitor circuit. */ -#define MC33775_BAL_SWITCH_STAT_CH4_POS (4U) -#define MC33775_BAL_SWITCH_STAT_CH4_MSK (0x10U) - -/* Enumerated value OPEN: Balancing FET is open. */ -#define MC33775_BAL_SWITCH_STAT_CH4_OPEN_ENUM_VAL (0U) - -/* Enumerated value CLOSED: Balancing FET is closed. */ -#define MC33775_BAL_SWITCH_STAT_CH4_CLOSED_ENUM_VAL (1U) - -/* Field CH5: Balancing FET status channel 5 This is the actual status (including PWM modulation) from the switch monitor circuit. */ -#define MC33775_BAL_SWITCH_STAT_CH5_POS (5U) -#define MC33775_BAL_SWITCH_STAT_CH5_MSK (0x20U) - -/* Enumerated value OPEN: Balancing FET is open. */ -#define MC33775_BAL_SWITCH_STAT_CH5_OPEN_ENUM_VAL (0U) - -/* Enumerated value CLOSED: Balancing FET is closed. */ -#define MC33775_BAL_SWITCH_STAT_CH5_CLOSED_ENUM_VAL (1U) - -/* Field CH6: Balancing FET status channel 6 This is the actual status (including PWM modulation) from the switch monitor circuit. */ -#define MC33775_BAL_SWITCH_STAT_CH6_POS (6U) -#define MC33775_BAL_SWITCH_STAT_CH6_MSK (0x40U) - -/* Enumerated value OPEN: Balancing FET is open. */ -#define MC33775_BAL_SWITCH_STAT_CH6_OPEN_ENUM_VAL (0U) - -/* Enumerated value CLOSED: Balancing FET is closed. */ -#define MC33775_BAL_SWITCH_STAT_CH6_CLOSED_ENUM_VAL (1U) - -/* Field CH7: Balancing FET status channel 7 This is the actual status (including PWM modulation) from the switch monitor circuit. */ -#define MC33775_BAL_SWITCH_STAT_CH7_POS (7U) -#define MC33775_BAL_SWITCH_STAT_CH7_MSK (0x80U) - -/* Enumerated value OPEN: Balancing FET is open. */ -#define MC33775_BAL_SWITCH_STAT_CH7_OPEN_ENUM_VAL (0U) - -/* Enumerated value CLOSED: Balancing FET is closed. */ -#define MC33775_BAL_SWITCH_STAT_CH7_CLOSED_ENUM_VAL (1U) - -/* Field CH8: Balancing FET status channel 8 This is the actual status (including PWM modulation) from the switch monitor circuit. */ -#define MC33775_BAL_SWITCH_STAT_CH8_POS (8U) -#define MC33775_BAL_SWITCH_STAT_CH8_MSK (0x100U) - -/* Enumerated value OPEN: Balancing FET is open. */ -#define MC33775_BAL_SWITCH_STAT_CH8_OPEN_ENUM_VAL (0U) - -/* Enumerated value CLOSED: Balancing FET is closed. */ -#define MC33775_BAL_SWITCH_STAT_CH8_CLOSED_ENUM_VAL (1U) - -/* Field CH9: Balancing FET status channel 9 This is the actual status (including PWM modulation) from the switch monitor circuit. */ -#define MC33775_BAL_SWITCH_STAT_CH9_POS (9U) -#define MC33775_BAL_SWITCH_STAT_CH9_MSK (0x200U) - -/* Enumerated value OPEN: Balancing FET is open. */ -#define MC33775_BAL_SWITCH_STAT_CH9_OPEN_ENUM_VAL (0U) - -/* Enumerated value CLOSED: Balancing FET is closed. */ -#define MC33775_BAL_SWITCH_STAT_CH9_CLOSED_ENUM_VAL (1U) - -/* Field CH10: Balancing FET status channel 10 This is the actual status (including PWM modulation) from the switch monitor circuit. */ -#define MC33775_BAL_SWITCH_STAT_CH10_POS (10U) -#define MC33775_BAL_SWITCH_STAT_CH10_MSK (0x400U) - -/* Enumerated value OPEN: Balancing FET is open. */ -#define MC33775_BAL_SWITCH_STAT_CH10_OPEN_ENUM_VAL (0U) - -/* Enumerated value CLOSED: Balancing FET is closed. */ -#define MC33775_BAL_SWITCH_STAT_CH10_CLOSED_ENUM_VAL (1U) - -/* Field CH11: Balancing FET status channel 11 This is the actual status (including PWM modulation) from the switch monitor circuit. */ -#define MC33775_BAL_SWITCH_STAT_CH11_POS (11U) -#define MC33775_BAL_SWITCH_STAT_CH11_MSK (0x800U) - -/* Enumerated value OPEN: Balancing FET is open. */ -#define MC33775_BAL_SWITCH_STAT_CH11_OPEN_ENUM_VAL (0U) - -/* Enumerated value CLOSED: Balancing FET is closed. */ -#define MC33775_BAL_SWITCH_STAT_CH11_CLOSED_ENUM_VAL (1U) - -/* Field CH12: Balancing FET status channel 12 This is the actual status (including PWM modulation) from the switch monitor circuit. */ -#define MC33775_BAL_SWITCH_STAT_CH12_POS (12U) -#define MC33775_BAL_SWITCH_STAT_CH12_MSK (0x1000U) - -/* Enumerated value OPEN: Balancing FET is open. */ -#define MC33775_BAL_SWITCH_STAT_CH12_OPEN_ENUM_VAL (0U) - -/* Enumerated value CLOSED: Balancing FET is closed. */ -#define MC33775_BAL_SWITCH_STAT_CH12_CLOSED_ENUM_VAL (1U) - -/* Field CH13: Balancing FET status channel 13 This is the actual status (including PWM modulation) from the switch monitor circuit. */ -#define MC33775_BAL_SWITCH_STAT_CH13_POS (13U) -#define MC33775_BAL_SWITCH_STAT_CH13_MSK (0x2000U) - -/* Enumerated value OPEN: Balancing FET is open. */ -#define MC33775_BAL_SWITCH_STAT_CH13_OPEN_ENUM_VAL (0U) - -/* Enumerated value CLOSED: Balancing FET is closed. */ -#define MC33775_BAL_SWITCH_STAT_CH13_CLOSED_ENUM_VAL (1U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_BAL_SWITCH_STAT_RESERVED0_POS (14U) -#define MC33775_BAL_SWITCH_STAT_RESERVED0_MSK (0xC000U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t CH0 : 1; - volatile uint16_t CH1 : 1; - volatile uint16_t CH2 : 1; - volatile uint16_t CH3 : 1; - volatile uint16_t CH4 : 1; - volatile uint16_t CH5 : 1; - volatile uint16_t CH6 : 1; - volatile uint16_t CH7 : 1; - volatile uint16_t CH8 : 1; - volatile uint16_t CH9 : 1; - volatile uint16_t CH10 : 1; - volatile uint16_t CH11 : 1; - volatile uint16_t CH12 : 1; - volatile uint16_t CH13 : 1; - volatile uint16_t reserved0 : 2; - } B; -} mc33775_balancing_registers_bal_switch_stat_t; - -/* -------------------------------------------------------------------------- - * BAL_SWITCH_FLT_STAT (read-only):Balancing switch fault - * -------------------------------------------------------------------------- */ -#define MC33775_BAL_SWITCH_FLT_STAT_OFFSET (0x100EU) -#define MC33775_BAL_SWITCH_FLT_STAT_RW_MSK (0x0U) -#define MC33775_BAL_SWITCH_FLT_STAT_RD_MSK (0x3FFFU) -#define MC33775_BAL_SWITCH_FLT_STAT_WR_MSK (0x0U) -#define MC33775_BAL_SWITCH_FLT_STAT_MW_MSK (0x0U) -#define MC33775_BAL_SWITCH_FLT_STAT_RA_MSK (0x3FFFU) -#define MC33775_BAL_SWITCH_FLT_STAT_POR_MSK (0xffffU) -#define MC33775_BAL_SWITCH_FLT_STAT_POR_VAL (0x0U) - -/* Field CH0: Balancing switch fault channel 0. Physical state of the Balancing circuit has differed from the expected one. This could be due to a broken switch, leakages or over current. */ -#define MC33775_BAL_SWITCH_FLT_STAT_CH0_POS (0U) -#define MC33775_BAL_SWITCH_FLT_STAT_CH0_MSK (0x1U) - -/* Enumerated value NOFLT: No fault detected. */ -#define MC33775_BAL_SWITCH_FLT_STAT_CH0_NOFLT_ENUM_VAL (0U) - -/* Enumerated value FAULT: Wrong switch state has been detected. */ -#define MC33775_BAL_SWITCH_FLT_STAT_CH0_FAULT_ENUM_VAL (1U) - -/* Field CH1: Balancing switch fault channel 1. Physical state of the Balancing circuit has differed from the expected one. This could be due to a broken switch, leakages or over current. */ -#define MC33775_BAL_SWITCH_FLT_STAT_CH1_POS (1U) -#define MC33775_BAL_SWITCH_FLT_STAT_CH1_MSK (0x2U) - -/* Enumerated value NOFLT: No fault detected. */ -#define MC33775_BAL_SWITCH_FLT_STAT_CH1_NOFLT_ENUM_VAL (0U) - -/* Enumerated value FAULT: Wrong switch state has been detected. */ -#define MC33775_BAL_SWITCH_FLT_STAT_CH1_FAULT_ENUM_VAL (1U) - -/* Field CH2: Balancing switch fault channel 2. Physical state of the Balancing circuit has differed from the expected one. This could be due to a broken switch, leakages or over current. */ -#define MC33775_BAL_SWITCH_FLT_STAT_CH2_POS (2U) -#define MC33775_BAL_SWITCH_FLT_STAT_CH2_MSK (0x4U) - -/* Enumerated value NOFLT: No fault detected. */ -#define MC33775_BAL_SWITCH_FLT_STAT_CH2_NOFLT_ENUM_VAL (0U) - -/* Enumerated value FAULT: Wrong switch state has been detected. */ -#define MC33775_BAL_SWITCH_FLT_STAT_CH2_FAULT_ENUM_VAL (1U) - -/* Field CH3: Balancing switch fault channel 3. Physical state of the Balancing circuit has differed from the expected one. This could be due to a broken switch, leakages or over current. */ -#define MC33775_BAL_SWITCH_FLT_STAT_CH3_POS (3U) -#define MC33775_BAL_SWITCH_FLT_STAT_CH3_MSK (0x8U) - -/* Enumerated value NOFLT: No fault detected. */ -#define MC33775_BAL_SWITCH_FLT_STAT_CH3_NOFLT_ENUM_VAL (0U) - -/* Enumerated value FAULT: Wrong switch state has been detected. */ -#define MC33775_BAL_SWITCH_FLT_STAT_CH3_FAULT_ENUM_VAL (1U) - -/* Field CH4: Balancing switch fault channel 4. Physical state of the Balancing circuit has differed from the expected one. This could be due to a broken switch, leakages or over current. */ -#define MC33775_BAL_SWITCH_FLT_STAT_CH4_POS (4U) -#define MC33775_BAL_SWITCH_FLT_STAT_CH4_MSK (0x10U) - -/* Enumerated value NOFLT: No fault detected. */ -#define MC33775_BAL_SWITCH_FLT_STAT_CH4_NOFLT_ENUM_VAL (0U) - -/* Enumerated value FAULT: Wrong switch state has been detected. */ -#define MC33775_BAL_SWITCH_FLT_STAT_CH4_FAULT_ENUM_VAL (1U) - -/* Field CH5: Balancing switch fault channel 5. Physical state of the Balancing circuit has differed from the expected one. This could be due to a broken switch, leakages or over current. */ -#define MC33775_BAL_SWITCH_FLT_STAT_CH5_POS (5U) -#define MC33775_BAL_SWITCH_FLT_STAT_CH5_MSK (0x20U) - -/* Enumerated value NOFLT: No fault detected. */ -#define MC33775_BAL_SWITCH_FLT_STAT_CH5_NOFLT_ENUM_VAL (0U) - -/* Enumerated value FAULT: Wrong switch state has been detected. */ -#define MC33775_BAL_SWITCH_FLT_STAT_CH5_FAULT_ENUM_VAL (1U) - -/* Field CH6: Balancing switch fault channel 6. Physical state of the Balancing circuit has differed from the expected one. This could be due to a broken switch, leakages or over current. */ -#define MC33775_BAL_SWITCH_FLT_STAT_CH6_POS (6U) -#define MC33775_BAL_SWITCH_FLT_STAT_CH6_MSK (0x40U) - -/* Enumerated value NOFLT: No fault detected. */ -#define MC33775_BAL_SWITCH_FLT_STAT_CH6_NOFLT_ENUM_VAL (0U) - -/* Enumerated value FAULT: Wrong switch state has been detected. */ -#define MC33775_BAL_SWITCH_FLT_STAT_CH6_FAULT_ENUM_VAL (1U) - -/* Field CH7: Balancing switch fault channel 7. Physical state of the Balancing circuit has differed from the expected one. This could be due to a broken switch, leakages or over current. */ -#define MC33775_BAL_SWITCH_FLT_STAT_CH7_POS (7U) -#define MC33775_BAL_SWITCH_FLT_STAT_CH7_MSK (0x80U) - -/* Enumerated value NOFLT: No fault detected. */ -#define MC33775_BAL_SWITCH_FLT_STAT_CH7_NOFLT_ENUM_VAL (0U) - -/* Enumerated value FAULT: Wrong switch state has been detected. */ -#define MC33775_BAL_SWITCH_FLT_STAT_CH7_FAULT_ENUM_VAL (1U) - -/* Field CH8: Balancing switch fault channel 8. Physical state of the Balancing circuit has differed from the expected one. This could be due to a broken switch, leakages or over current. */ -#define MC33775_BAL_SWITCH_FLT_STAT_CH8_POS (8U) -#define MC33775_BAL_SWITCH_FLT_STAT_CH8_MSK (0x100U) - -/* Enumerated value NOFLT: No fault detected. */ -#define MC33775_BAL_SWITCH_FLT_STAT_CH8_NOFLT_ENUM_VAL (0U) - -/* Enumerated value FAULT: Wrong switch state has been detected. */ -#define MC33775_BAL_SWITCH_FLT_STAT_CH8_FAULT_ENUM_VAL (1U) - -/* Field CH9: Balancing switch fault channel 9. Physical state of the Balancing circuit has differed from the expected one. This could be due to a broken switch, leakages or over current. */ -#define MC33775_BAL_SWITCH_FLT_STAT_CH9_POS (9U) -#define MC33775_BAL_SWITCH_FLT_STAT_CH9_MSK (0x200U) - -/* Enumerated value NOFLT: No fault detected. */ -#define MC33775_BAL_SWITCH_FLT_STAT_CH9_NOFLT_ENUM_VAL (0U) - -/* Enumerated value FAULT: Wrong switch state has been detected. */ -#define MC33775_BAL_SWITCH_FLT_STAT_CH9_FAULT_ENUM_VAL (1U) - -/* Field CH10: Balancing switch fault channel 10. Physical state of the Balancing circuit has differed from the expected one. This could be due to a broken switch, leakages or over current. */ -#define MC33775_BAL_SWITCH_FLT_STAT_CH10_POS (10U) -#define MC33775_BAL_SWITCH_FLT_STAT_CH10_MSK (0x400U) - -/* Enumerated value NOFLT: No fault detected. */ -#define MC33775_BAL_SWITCH_FLT_STAT_CH10_NOFLT_ENUM_VAL (0U) - -/* Enumerated value FAULT: Wrong switch state has been detected. */ -#define MC33775_BAL_SWITCH_FLT_STAT_CH10_FAULT_ENUM_VAL (1U) - -/* Field CH11: Balancing switch fault channel 11. Physical state of the Balancing circuit has differed from the expected one. This could be due to a broken switch, leakages or over current. */ -#define MC33775_BAL_SWITCH_FLT_STAT_CH11_POS (11U) -#define MC33775_BAL_SWITCH_FLT_STAT_CH11_MSK (0x800U) - -/* Enumerated value NOFLT: No fault detected. */ -#define MC33775_BAL_SWITCH_FLT_STAT_CH11_NOFLT_ENUM_VAL (0U) - -/* Enumerated value FAULT: Wrong switch state has been detected. */ -#define MC33775_BAL_SWITCH_FLT_STAT_CH11_FAULT_ENUM_VAL (1U) - -/* Field CH12: Balancing switch fault channel 12. Physical state of the Balancing circuit has differed from the expected one. This could be due to a broken switch, leakages or over current. */ -#define MC33775_BAL_SWITCH_FLT_STAT_CH12_POS (12U) -#define MC33775_BAL_SWITCH_FLT_STAT_CH12_MSK (0x1000U) - -/* Enumerated value NOFLT: No fault detected. */ -#define MC33775_BAL_SWITCH_FLT_STAT_CH12_NOFLT_ENUM_VAL (0U) - -/* Enumerated value FAULT: Wrong switch state has been detected. */ -#define MC33775_BAL_SWITCH_FLT_STAT_CH12_FAULT_ENUM_VAL (1U) - -/* Field CH13: Balancing switch fault channel 13. Physical state of the Balancing circuit has differed from the expected one. This could be due to a broken switch, leakages or over current. */ -#define MC33775_BAL_SWITCH_FLT_STAT_CH13_POS (13U) -#define MC33775_BAL_SWITCH_FLT_STAT_CH13_MSK (0x2000U) - -/* Enumerated value NOFLT: No fault detected. */ -#define MC33775_BAL_SWITCH_FLT_STAT_CH13_NOFLT_ENUM_VAL (0U) - -/* Enumerated value FAULT: Wrong switch state has been detected. */ -#define MC33775_BAL_SWITCH_FLT_STAT_CH13_FAULT_ENUM_VAL (1U) - -/* Field reserved0: This read-only field is reserved and always has the value 0. */ -#define MC33775_BAL_SWITCH_FLT_STAT_RESERVED0_POS (14U) -#define MC33775_BAL_SWITCH_FLT_STAT_RESERVED0_MSK (0xC000U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t CH0 : 1; - volatile uint16_t CH1 : 1; - volatile uint16_t CH2 : 1; - volatile uint16_t CH3 : 1; - volatile uint16_t CH4 : 1; - volatile uint16_t CH5 : 1; - volatile uint16_t CH6 : 1; - volatile uint16_t CH7 : 1; - volatile uint16_t CH8 : 1; - volatile uint16_t CH9 : 1; - volatile uint16_t CH10 : 1; - volatile uint16_t CH11 : 1; - volatile uint16_t CH12 : 1; - volatile uint16_t CH13 : 1; - volatile uint16_t reserved0 : 2; - } B; -} mc33775_balancing_registers_bal_switch_flt_stat_t; - -/* -------------------------------------------------------------------------- - * BAL_TMR_CH_ALL (write-only):Virtual register, writes in parallel into BAL_TMR_CH0 up to BAL_TMR_CH13 - * -------------------------------------------------------------------------- */ -#define MC33775_BAL_TMR_CH_ALL_OFFSET (0x100FU) -#define MC33775_BAL_TMR_CH_ALL_RW_MSK (0x0U) -#define MC33775_BAL_TMR_CH_ALL_RD_MSK (0x0U) -#define MC33775_BAL_TMR_CH_ALL_WR_MSK (0xFFFFU) -#define MC33775_BAL_TMR_CH_ALL_MW_MSK (0x0U) -#define MC33775_BAL_TMR_CH_ALL_RA_MSK (0x0U) -#define MC33775_BAL_TMR_CH_ALL_POR_MSK (0xffffU) -#define MC33775_BAL_TMR_CH_ALL_POR_VAL (0x0U) - -/* Field BALTIME: Sets the balancing time for all channels. */ -#define MC33775_BAL_TMR_CH_ALL_BALTIME_POS (0U) -#define MC33775_BAL_TMR_CH_ALL_BALTIME_MSK (0x3FFFU) - -/* Enumerated value EXPIRED: Balancing time is set to 0. */ -#define MC33775_BAL_TMR_CH_ALL_BALTIME_EXPIRED_ENUM_VAL (0U) - -/* Enumerated value BALTIME: Balancing time is set to BALTIME * 10 seconds */ -#define MC33775_BAL_TMR_CH_ALL_BALTIME_BALTIME_ENUM_VAL (1U) - -/* Enumerated value MAX: Sets maximum balancing time of 163830 seconds = approximately 45.5 hours. */ -#define MC33775_BAL_TMR_CH_ALL_BALTIME_MAX_ENUM_VAL (16383U) - -/* Field PWM: Sets the PWM duty cycle for all channels. PWM cycle time is 0.5 seconds. */ -#define MC33775_BAL_TMR_CH_ALL_PWM_POS (14U) -#define MC33775_BAL_TMR_CH_ALL_PWM_MSK (0xC000U) - -/* Enumerated value PWM25: PWM duty cycle set to 25%. */ -#define MC33775_BAL_TMR_CH_ALL_PWM_PWM25_ENUM_VAL (0U) - -/* Enumerated value PWM50: PWM duty cycle set to 50%. */ -#define MC33775_BAL_TMR_CH_ALL_PWM_PWM50_ENUM_VAL (1U) - -/* Enumerated value PWM75: PWM duty cycle set to 75%. */ -#define MC33775_BAL_TMR_CH_ALL_PWM_PWM75_ENUM_VAL (2U) - -/* Enumerated value PWM100: PWM duty cycle set to 100%. */ -#define MC33775_BAL_TMR_CH_ALL_PWM_PWM100_ENUM_VAL (3U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t BALTIME : 14; - volatile uint16_t PWM : 2; - } B; -} mc33775_balancing_registers_bal_tmr_ch_all_t; - -/* -------------------------------------------------------------------------- - * BAL_TMR_CH0 (read-write):Balancing timer channel 0 - * -------------------------------------------------------------------------- */ -#define MC33775_BAL_TMR_CH0_OFFSET (0x1010U) -#define MC33775_BAL_TMR_CH0_RW_MSK (0xFFFFU) -#define MC33775_BAL_TMR_CH0_RD_MSK (0xFFFFU) -#define MC33775_BAL_TMR_CH0_WR_MSK (0xFFFFU) -#define MC33775_BAL_TMR_CH0_MW_MSK (0x0U) -#define MC33775_BAL_TMR_CH0_RA_MSK (0x0U) -#define MC33775_BAL_TMR_CH0_POR_MSK (0xffffU) -#define MC33775_BAL_TMR_CH0_POR_VAL (0x0U) - -/* Field BALTIME: Balancing time for channel 0 The value of this field represents the current counter value when read. The counting saturates at 0. If the value is zero, the balancing for this channel is stopped. The counting is only active if balancing is enabled, timer based balancing is enabled and the channel enable is set. */ -#define MC33775_BAL_TMR_CH0_BALTIME_POS (0U) -#define MC33775_BAL_TMR_CH0_BALTIME_MSK (0x3FFFU) - -/* Enumerated value EXPIRED: Balancing time is set to 0. */ -#define MC33775_BAL_TMR_CH0_BALTIME_EXPIRED_ENUM_VAL (0U) - -/* Enumerated value BALTIME: Balancing time is set to BALTIME * 10 seconds */ -#define MC33775_BAL_TMR_CH0_BALTIME_BALTIME_ENUM_VAL (1U) - -/* Enumerated value MAX: Sets maximum balancing time of 163830 seconds = approximately 45.5 hours. */ -#define MC33775_BAL_TMR_CH0_BALTIME_MAX_ENUM_VAL (16383U) - -/* Field PWM: PWM duty cycle for channel 0. */ -#define MC33775_BAL_TMR_CH0_PWM_POS (14U) -#define MC33775_BAL_TMR_CH0_PWM_MSK (0xC000U) - -/* Enumerated value PWM25: PWM duty cycle set to 25%. */ -#define MC33775_BAL_TMR_CH0_PWM_PWM25_ENUM_VAL (0U) - -/* Enumerated value PWM50: PWM duty cycle set to 50%. */ -#define MC33775_BAL_TMR_CH0_PWM_PWM50_ENUM_VAL (1U) - -/* Enumerated value PWM75: PWM duty cycle set to 75%. */ -#define MC33775_BAL_TMR_CH0_PWM_PWM75_ENUM_VAL (2U) - -/* Enumerated value PWM100: PWM duty cycle set to 100%. */ -#define MC33775_BAL_TMR_CH0_PWM_PWM100_ENUM_VAL (3U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t BALTIME : 14; - volatile uint16_t PWM : 2; - } B; -} mc33775_balancing_registers_bal_tmr_ch0_t; - -/* -------------------------------------------------------------------------- - * BAL_TMR_CH1 (read-write):Balancing timer channel 1 - * -------------------------------------------------------------------------- */ -#define MC33775_BAL_TMR_CH1_OFFSET (0x1011U) -#define MC33775_BAL_TMR_CH1_RW_MSK (0xFFFFU) -#define MC33775_BAL_TMR_CH1_RD_MSK (0xFFFFU) -#define MC33775_BAL_TMR_CH1_WR_MSK (0xFFFFU) -#define MC33775_BAL_TMR_CH1_MW_MSK (0x0U) -#define MC33775_BAL_TMR_CH1_RA_MSK (0x0U) -#define MC33775_BAL_TMR_CH1_POR_MSK (0xffffU) -#define MC33775_BAL_TMR_CH1_POR_VAL (0x0U) - -/* Field BALTIME: Balancing time for channel 1 The value of this field represents the current counter value when read. The counting saturates at 0. If the value is zero, the balancing for this channel is stopped. The counting is only active if balancing is enabled, timer based balancing is enabled and the channel enable is set. */ -#define MC33775_BAL_TMR_CH1_BALTIME_POS (0U) -#define MC33775_BAL_TMR_CH1_BALTIME_MSK (0x3FFFU) - -/* Enumerated value EXPIRED: Balancing time is set to 0. */ -#define MC33775_BAL_TMR_CH1_BALTIME_EXPIRED_ENUM_VAL (0U) - -/* Enumerated value BALTIME: Balancing time is set to BALTIME * 10 seconds */ -#define MC33775_BAL_TMR_CH1_BALTIME_BALTIME_ENUM_VAL (1U) - -/* Enumerated value MAX: Sets maximum balancing time of 163830 seconds = approximately 45.5 hours. */ -#define MC33775_BAL_TMR_CH1_BALTIME_MAX_ENUM_VAL (16383U) - -/* Field PWM: PWM duty cycle for channel 1. */ -#define MC33775_BAL_TMR_CH1_PWM_POS (14U) -#define MC33775_BAL_TMR_CH1_PWM_MSK (0xC000U) - -/* Enumerated value PWM25: PWM duty cycle set to 25%. */ -#define MC33775_BAL_TMR_CH1_PWM_PWM25_ENUM_VAL (0U) - -/* Enumerated value PWM50: PWM duty cycle set to 50%. */ -#define MC33775_BAL_TMR_CH1_PWM_PWM50_ENUM_VAL (1U) - -/* Enumerated value PWM75: PWM duty cycle set to 75%. */ -#define MC33775_BAL_TMR_CH1_PWM_PWM75_ENUM_VAL (2U) - -/* Enumerated value PWM100: PWM duty cycle set to 100%. */ -#define MC33775_BAL_TMR_CH1_PWM_PWM100_ENUM_VAL (3U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t BALTIME : 14; - volatile uint16_t PWM : 2; - } B; -} mc33775_balancing_registers_bal_tmr_ch1_t; - -/* -------------------------------------------------------------------------- - * BAL_TMR_CH2 (read-write):Balancing timer channel 2 - * -------------------------------------------------------------------------- */ -#define MC33775_BAL_TMR_CH2_OFFSET (0x1012U) -#define MC33775_BAL_TMR_CH2_RW_MSK (0xFFFFU) -#define MC33775_BAL_TMR_CH2_RD_MSK (0xFFFFU) -#define MC33775_BAL_TMR_CH2_WR_MSK (0xFFFFU) -#define MC33775_BAL_TMR_CH2_MW_MSK (0x0U) -#define MC33775_BAL_TMR_CH2_RA_MSK (0x0U) -#define MC33775_BAL_TMR_CH2_POR_MSK (0xffffU) -#define MC33775_BAL_TMR_CH2_POR_VAL (0x0U) - -/* Field BALTIME: Balancing time for channel 2 The value of this field represents the current counter value when read. The counting saturates at 0. If the value is zero, the balancing for this channel is stopped. The counting is only active if balancing is enabled, timer based balancing is enabled and the channel enable is set. */ -#define MC33775_BAL_TMR_CH2_BALTIME_POS (0U) -#define MC33775_BAL_TMR_CH2_BALTIME_MSK (0x3FFFU) - -/* Enumerated value EXPIRED: Balancing time is set to 0. */ -#define MC33775_BAL_TMR_CH2_BALTIME_EXPIRED_ENUM_VAL (0U) - -/* Enumerated value BALTIME: Balancing time is set to BALTIME * 10 seconds */ -#define MC33775_BAL_TMR_CH2_BALTIME_BALTIME_ENUM_VAL (1U) - -/* Enumerated value MAX: Sets maximum balancing time of 163830 seconds = approximately 45.5 hours. */ -#define MC33775_BAL_TMR_CH2_BALTIME_MAX_ENUM_VAL (16383U) - -/* Field PWM: PWM duty cycle for channel 2. */ -#define MC33775_BAL_TMR_CH2_PWM_POS (14U) -#define MC33775_BAL_TMR_CH2_PWM_MSK (0xC000U) - -/* Enumerated value PWM25: PWM duty cycle set to 25%. */ -#define MC33775_BAL_TMR_CH2_PWM_PWM25_ENUM_VAL (0U) - -/* Enumerated value PWM50: PWM duty cycle set to 50%. */ -#define MC33775_BAL_TMR_CH2_PWM_PWM50_ENUM_VAL (1U) - -/* Enumerated value PWM75: PWM duty cycle set to 75%. */ -#define MC33775_BAL_TMR_CH2_PWM_PWM75_ENUM_VAL (2U) - -/* Enumerated value PWM100: PWM duty cycle set to 100%. */ -#define MC33775_BAL_TMR_CH2_PWM_PWM100_ENUM_VAL (3U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t BALTIME : 14; - volatile uint16_t PWM : 2; - } B; -} mc33775_balancing_registers_bal_tmr_ch2_t; - -/* -------------------------------------------------------------------------- - * BAL_TMR_CH3 (read-write):Balancing timer channel 3 - * -------------------------------------------------------------------------- */ -#define MC33775_BAL_TMR_CH3_OFFSET (0x1013U) -#define MC33775_BAL_TMR_CH3_RW_MSK (0xFFFFU) -#define MC33775_BAL_TMR_CH3_RD_MSK (0xFFFFU) -#define MC33775_BAL_TMR_CH3_WR_MSK (0xFFFFU) -#define MC33775_BAL_TMR_CH3_MW_MSK (0x0U) -#define MC33775_BAL_TMR_CH3_RA_MSK (0x0U) -#define MC33775_BAL_TMR_CH3_POR_MSK (0xffffU) -#define MC33775_BAL_TMR_CH3_POR_VAL (0x0U) - -/* Field BALTIME: Balancing time for channel 3 The value of this field represents the current counter value when read. The counting saturates at 0. If the value is zero, the balancing for this channel is stopped. The counting is only active if balancing is enabled, timer based balancing is enabled and the channel enable is set. */ -#define MC33775_BAL_TMR_CH3_BALTIME_POS (0U) -#define MC33775_BAL_TMR_CH3_BALTIME_MSK (0x3FFFU) - -/* Enumerated value EXPIRED: Balancing time is set to 0. */ -#define MC33775_BAL_TMR_CH3_BALTIME_EXPIRED_ENUM_VAL (0U) - -/* Enumerated value BALTIME: Balancing time is set to BALTIME * 10 seconds */ -#define MC33775_BAL_TMR_CH3_BALTIME_BALTIME_ENUM_VAL (1U) - -/* Enumerated value MAX: Sets maximum balancing time of 163830 seconds = approximately 45.5 hours. */ -#define MC33775_BAL_TMR_CH3_BALTIME_MAX_ENUM_VAL (16383U) - -/* Field PWM: PWM duty cycle for channel 3 */ -#define MC33775_BAL_TMR_CH3_PWM_POS (14U) -#define MC33775_BAL_TMR_CH3_PWM_MSK (0xC000U) - -/* Enumerated value PWM25: PWM duty cycle set to 25%. */ -#define MC33775_BAL_TMR_CH3_PWM_PWM25_ENUM_VAL (0U) - -/* Enumerated value PWM50: PWM duty cycle set to 50%. */ -#define MC33775_BAL_TMR_CH3_PWM_PWM50_ENUM_VAL (1U) - -/* Enumerated value PWM75: PWM duty cycle set to 75%. */ -#define MC33775_BAL_TMR_CH3_PWM_PWM75_ENUM_VAL (2U) - -/* Enumerated value PWM100: PWM duty cycle set to 100%. */ -#define MC33775_BAL_TMR_CH3_PWM_PWM100_ENUM_VAL (3U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t BALTIME : 14; - volatile uint16_t PWM : 2; - } B; -} mc33775_balancing_registers_bal_tmr_ch3_t; - -/* -------------------------------------------------------------------------- - * BAL_TMR_CH4 (read-write):Balancing timer channel 4 - * -------------------------------------------------------------------------- */ -#define MC33775_BAL_TMR_CH4_OFFSET (0x1014U) -#define MC33775_BAL_TMR_CH4_RW_MSK (0xFFFFU) -#define MC33775_BAL_TMR_CH4_RD_MSK (0xFFFFU) -#define MC33775_BAL_TMR_CH4_WR_MSK (0xFFFFU) -#define MC33775_BAL_TMR_CH4_MW_MSK (0x0U) -#define MC33775_BAL_TMR_CH4_RA_MSK (0x0U) -#define MC33775_BAL_TMR_CH4_POR_MSK (0xffffU) -#define MC33775_BAL_TMR_CH4_POR_VAL (0x0U) - -/* Field BALTIME: Balancing time for channel 4 The value of this field represents the current counter value when read. The counting saturates at 0. If the value is zero, the balancing for this channel is stopped. The counting is only active if balancing is enabled, timer based balancing is enabled and the channel enable is set. */ -#define MC33775_BAL_TMR_CH4_BALTIME_POS (0U) -#define MC33775_BAL_TMR_CH4_BALTIME_MSK (0x3FFFU) - -/* Enumerated value EXPIRED: Balancing time is set to 0. */ -#define MC33775_BAL_TMR_CH4_BALTIME_EXPIRED_ENUM_VAL (0U) - -/* Enumerated value BALTIME: Balancing time is set to BALTIME * 10 seconds */ -#define MC33775_BAL_TMR_CH4_BALTIME_BALTIME_ENUM_VAL (1U) - -/* Enumerated value MAX: Sets maximum balancing time of 163830 seconds = approximately 45.5 hours. */ -#define MC33775_BAL_TMR_CH4_BALTIME_MAX_ENUM_VAL (16383U) - -/* Field PWM: PWM duty cycle for channel 4. */ -#define MC33775_BAL_TMR_CH4_PWM_POS (14U) -#define MC33775_BAL_TMR_CH4_PWM_MSK (0xC000U) - -/* Enumerated value PWM25: PWM duty cycle set to 25%. */ -#define MC33775_BAL_TMR_CH4_PWM_PWM25_ENUM_VAL (0U) - -/* Enumerated value PWM50: PWM duty cycle set to 50%. */ -#define MC33775_BAL_TMR_CH4_PWM_PWM50_ENUM_VAL (1U) - -/* Enumerated value PWM75: PWM duty cycle set to 75%. */ -#define MC33775_BAL_TMR_CH4_PWM_PWM75_ENUM_VAL (2U) - -/* Enumerated value PWM100: PWM duty cycle set to 100%. */ -#define MC33775_BAL_TMR_CH4_PWM_PWM100_ENUM_VAL (3U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t BALTIME : 14; - volatile uint16_t PWM : 2; - } B; -} mc33775_balancing_registers_bal_tmr_ch4_t; - -/* -------------------------------------------------------------------------- - * BAL_TMR_CH5 (read-write):Balancing timer channel 5 - * -------------------------------------------------------------------------- */ -#define MC33775_BAL_TMR_CH5_OFFSET (0x1015U) -#define MC33775_BAL_TMR_CH5_RW_MSK (0xFFFFU) -#define MC33775_BAL_TMR_CH5_RD_MSK (0xFFFFU) -#define MC33775_BAL_TMR_CH5_WR_MSK (0xFFFFU) -#define MC33775_BAL_TMR_CH5_MW_MSK (0x0U) -#define MC33775_BAL_TMR_CH5_RA_MSK (0x0U) -#define MC33775_BAL_TMR_CH5_POR_MSK (0xffffU) -#define MC33775_BAL_TMR_CH5_POR_VAL (0x0U) - -/* Field BALTIME: Balancing time for channel 5 The value of this field represents the current counter value when read. The counting saturates at 0. If the value is zero, the balancing for this channel is stopped. The counting is only active if balancing is enabled, timer based balancing is enabled and the channel enable is set. */ -#define MC33775_BAL_TMR_CH5_BALTIME_POS (0U) -#define MC33775_BAL_TMR_CH5_BALTIME_MSK (0x3FFFU) - -/* Enumerated value EXPIRED: Balancing time is set to 0. */ -#define MC33775_BAL_TMR_CH5_BALTIME_EXPIRED_ENUM_VAL (0U) - -/* Enumerated value BALTIME: Balancing time is set to BALTIME * 10 seconds */ -#define MC33775_BAL_TMR_CH5_BALTIME_BALTIME_ENUM_VAL (1U) - -/* Enumerated value MAX: Sets maximum balancing time of 163830 seconds = approximately 45.5 hours. */ -#define MC33775_BAL_TMR_CH5_BALTIME_MAX_ENUM_VAL (16383U) - -/* Field PWM: PWM duty cycle for channel 5. */ -#define MC33775_BAL_TMR_CH5_PWM_POS (14U) -#define MC33775_BAL_TMR_CH5_PWM_MSK (0xC000U) - -/* Enumerated value PWM25: PWM duty cycle set to 25%. */ -#define MC33775_BAL_TMR_CH5_PWM_PWM25_ENUM_VAL (0U) - -/* Enumerated value PWM50: PWM duty cycle set to 50%. */ -#define MC33775_BAL_TMR_CH5_PWM_PWM50_ENUM_VAL (1U) - -/* Enumerated value PWM75: PWM duty cycle set to 75%. */ -#define MC33775_BAL_TMR_CH5_PWM_PWM75_ENUM_VAL (2U) - -/* Enumerated value PWM100: PWM duty cycle set to 100%. */ -#define MC33775_BAL_TMR_CH5_PWM_PWM100_ENUM_VAL (3U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t BALTIME : 14; - volatile uint16_t PWM : 2; - } B; -} mc33775_balancing_registers_bal_tmr_ch5_t; - -/* -------------------------------------------------------------------------- - * BAL_TMR_CH6 (read-write):Balancing timer channel 6 - * -------------------------------------------------------------------------- */ -#define MC33775_BAL_TMR_CH6_OFFSET (0x1016U) -#define MC33775_BAL_TMR_CH6_RW_MSK (0xFFFFU) -#define MC33775_BAL_TMR_CH6_RD_MSK (0xFFFFU) -#define MC33775_BAL_TMR_CH6_WR_MSK (0xFFFFU) -#define MC33775_BAL_TMR_CH6_MW_MSK (0x0U) -#define MC33775_BAL_TMR_CH6_RA_MSK (0x0U) -#define MC33775_BAL_TMR_CH6_POR_MSK (0xffffU) -#define MC33775_BAL_TMR_CH6_POR_VAL (0x0U) - -/* Field BALTIME: Balancing time for channel 6 The value of this field represents the current counter value when read. The counting saturates at 0. If the value is zero, the balancing for this channel is stopped. The counting is only active if balancing is enabled, timer based balancing is enabled and the channel enable is set. */ -#define MC33775_BAL_TMR_CH6_BALTIME_POS (0U) -#define MC33775_BAL_TMR_CH6_BALTIME_MSK (0x3FFFU) - -/* Enumerated value EXPIRED: Balancing time is set to 0. */ -#define MC33775_BAL_TMR_CH6_BALTIME_EXPIRED_ENUM_VAL (0U) - -/* Enumerated value BALTIME: Balancing time is set to BALTIME * 10 seconds */ -#define MC33775_BAL_TMR_CH6_BALTIME_BALTIME_ENUM_VAL (1U) - -/* Enumerated value MAX: Sets maximum balancing time of 163830 seconds = approximately 45.5 hours. */ -#define MC33775_BAL_TMR_CH6_BALTIME_MAX_ENUM_VAL (16383U) - -/* Field PWM: PWM duty cycle for channel 6. */ -#define MC33775_BAL_TMR_CH6_PWM_POS (14U) -#define MC33775_BAL_TMR_CH6_PWM_MSK (0xC000U) - -/* Enumerated value PWM25: PWM duty cycle set to 25%. */ -#define MC33775_BAL_TMR_CH6_PWM_PWM25_ENUM_VAL (0U) - -/* Enumerated value PWM50: PWM duty cycle set to 50%. */ -#define MC33775_BAL_TMR_CH6_PWM_PWM50_ENUM_VAL (1U) - -/* Enumerated value PWM75: PWM duty cycle set to 75%. */ -#define MC33775_BAL_TMR_CH6_PWM_PWM75_ENUM_VAL (2U) - -/* Enumerated value PWM100: PWM duty cycle set to 100%. */ -#define MC33775_BAL_TMR_CH6_PWM_PWM100_ENUM_VAL (3U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t BALTIME : 14; - volatile uint16_t PWM : 2; - } B; -} mc33775_balancing_registers_bal_tmr_ch6_t; - -/* -------------------------------------------------------------------------- - * BAL_TMR_CH7 (read-write):Balancing timer channel 7 - * -------------------------------------------------------------------------- */ -#define MC33775_BAL_TMR_CH7_OFFSET (0x1017U) -#define MC33775_BAL_TMR_CH7_RW_MSK (0xFFFFU) -#define MC33775_BAL_TMR_CH7_RD_MSK (0xFFFFU) -#define MC33775_BAL_TMR_CH7_WR_MSK (0xFFFFU) -#define MC33775_BAL_TMR_CH7_MW_MSK (0x0U) -#define MC33775_BAL_TMR_CH7_RA_MSK (0x0U) -#define MC33775_BAL_TMR_CH7_POR_MSK (0xffffU) -#define MC33775_BAL_TMR_CH7_POR_VAL (0x0U) - -/* Field BALTIME: Balancing time for channel 7 The value of this field represents the current counter value when read. The counting saturates at 0. If the value is zero, the balancing for this channel is stopped. The counting is only active if balancing is enabled, timer based balancing is enabled and the channel enable is set. */ -#define MC33775_BAL_TMR_CH7_BALTIME_POS (0U) -#define MC33775_BAL_TMR_CH7_BALTIME_MSK (0x3FFFU) - -/* Enumerated value EXPIRED: Balancing time is set to 0. */ -#define MC33775_BAL_TMR_CH7_BALTIME_EXPIRED_ENUM_VAL (0U) - -/* Enumerated value BALTIME: Balancing time is set to BALTIME * 10 seconds */ -#define MC33775_BAL_TMR_CH7_BALTIME_BALTIME_ENUM_VAL (1U) - -/* Enumerated value MAX: Sets maximum balancing time of 163830 seconds = approximately 45.5 hours. */ -#define MC33775_BAL_TMR_CH7_BALTIME_MAX_ENUM_VAL (16383U) - -/* Field PWM: PWM duty cycle for channel 7. */ -#define MC33775_BAL_TMR_CH7_PWM_POS (14U) -#define MC33775_BAL_TMR_CH7_PWM_MSK (0xC000U) - -/* Enumerated value PWM25: PWM duty cycle set to 25%. */ -#define MC33775_BAL_TMR_CH7_PWM_PWM25_ENUM_VAL (0U) - -/* Enumerated value PWM50: PWM duty cycle set to 50%. */ -#define MC33775_BAL_TMR_CH7_PWM_PWM50_ENUM_VAL (1U) - -/* Enumerated value PWM75: PWM duty cycle set to 75%. */ -#define MC33775_BAL_TMR_CH7_PWM_PWM75_ENUM_VAL (2U) - -/* Enumerated value PWM100: PWM duty cycle set to 100%. */ -#define MC33775_BAL_TMR_CH7_PWM_PWM100_ENUM_VAL (3U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t BALTIME : 14; - volatile uint16_t PWM : 2; - } B; -} mc33775_balancing_registers_bal_tmr_ch7_t; - -/* -------------------------------------------------------------------------- - * BAL_TMR_CH8 (read-write):Balancing timer channel 8 - * -------------------------------------------------------------------------- */ -#define MC33775_BAL_TMR_CH8_OFFSET (0x1018U) -#define MC33775_BAL_TMR_CH8_RW_MSK (0xFFFFU) -#define MC33775_BAL_TMR_CH8_RD_MSK (0xFFFFU) -#define MC33775_BAL_TMR_CH8_WR_MSK (0xFFFFU) -#define MC33775_BAL_TMR_CH8_MW_MSK (0x0U) -#define MC33775_BAL_TMR_CH8_RA_MSK (0x0U) -#define MC33775_BAL_TMR_CH8_POR_MSK (0xffffU) -#define MC33775_BAL_TMR_CH8_POR_VAL (0x0U) - -/* Field BALTIME: Balancing time for channel 8 The value of this field represents the current counter value when read. The counting saturates at 0. If the value is zero, the balancing for this channel is stopped. The counting is only active if balancing is enabled, timer based balancing is enabled and the channel enable is set. */ -#define MC33775_BAL_TMR_CH8_BALTIME_POS (0U) -#define MC33775_BAL_TMR_CH8_BALTIME_MSK (0x3FFFU) - -/* Enumerated value EXPIRED: Balancing time is set to 0. */ -#define MC33775_BAL_TMR_CH8_BALTIME_EXPIRED_ENUM_VAL (0U) - -/* Enumerated value BALTIME: Balancing time is set to BALTIME * 10 seconds */ -#define MC33775_BAL_TMR_CH8_BALTIME_BALTIME_ENUM_VAL (1U) - -/* Enumerated value MAX: Sets maximum balancing time of 163830 seconds = approximately 45.5 hours. */ -#define MC33775_BAL_TMR_CH8_BALTIME_MAX_ENUM_VAL (16383U) - -/* Field PWM: PWM duty cycle for channel 8. */ -#define MC33775_BAL_TMR_CH8_PWM_POS (14U) -#define MC33775_BAL_TMR_CH8_PWM_MSK (0xC000U) - -/* Enumerated value PWM25: PWM duty cycle set to 25%. */ -#define MC33775_BAL_TMR_CH8_PWM_PWM25_ENUM_VAL (0U) - -/* Enumerated value PWM50: PWM duty cycle set to 50%. */ -#define MC33775_BAL_TMR_CH8_PWM_PWM50_ENUM_VAL (1U) - -/* Enumerated value PWM75: PWM duty cycle set to 75%. */ -#define MC33775_BAL_TMR_CH8_PWM_PWM75_ENUM_VAL (2U) - -/* Enumerated value PWM100: PWM duty cycle set to 100%. */ -#define MC33775_BAL_TMR_CH8_PWM_PWM100_ENUM_VAL (3U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t BALTIME : 14; - volatile uint16_t PWM : 2; - } B; -} mc33775_balancing_registers_bal_tmr_ch8_t; - -/* -------------------------------------------------------------------------- - * BAL_TMR_CH9 (read-write):Balancing timer channel 9 - * -------------------------------------------------------------------------- */ -#define MC33775_BAL_TMR_CH9_OFFSET (0x1019U) -#define MC33775_BAL_TMR_CH9_RW_MSK (0xFFFFU) -#define MC33775_BAL_TMR_CH9_RD_MSK (0xFFFFU) -#define MC33775_BAL_TMR_CH9_WR_MSK (0xFFFFU) -#define MC33775_BAL_TMR_CH9_MW_MSK (0x0U) -#define MC33775_BAL_TMR_CH9_RA_MSK (0x0U) -#define MC33775_BAL_TMR_CH9_POR_MSK (0xffffU) -#define MC33775_BAL_TMR_CH9_POR_VAL (0x0U) - -/* Field BALTIME: Balancing time for channel 9 The value of this field represents the current counter value when read. The counting saturates at 0. If the value is zero, the balancing for this channel is stopped. The counting is only active if balancing is enabled, timer based balancing is enabled and the channel enable is set. */ -#define MC33775_BAL_TMR_CH9_BALTIME_POS (0U) -#define MC33775_BAL_TMR_CH9_BALTIME_MSK (0x3FFFU) - -/* Enumerated value EXPIRED: Balancing time is set to 0. */ -#define MC33775_BAL_TMR_CH9_BALTIME_EXPIRED_ENUM_VAL (0U) - -/* Enumerated value BALTIME: Balancing time is set to BALTIME * 10 seconds */ -#define MC33775_BAL_TMR_CH9_BALTIME_BALTIME_ENUM_VAL (1U) - -/* Enumerated value MAX: Sets maximum balancing time of 163830 seconds = approximately 45.5 hours. */ -#define MC33775_BAL_TMR_CH9_BALTIME_MAX_ENUM_VAL (16383U) - -/* Field PWM: PWM duty cycle for channel 9. */ -#define MC33775_BAL_TMR_CH9_PWM_POS (14U) -#define MC33775_BAL_TMR_CH9_PWM_MSK (0xC000U) - -/* Enumerated value PWM25: PWM duty cycle set to 25%. */ -#define MC33775_BAL_TMR_CH9_PWM_PWM25_ENUM_VAL (0U) - -/* Enumerated value PWM50: PWM duty cycle set to 50%. */ -#define MC33775_BAL_TMR_CH9_PWM_PWM50_ENUM_VAL (1U) - -/* Enumerated value PWM75: PWM duty cycle set to 75%. */ -#define MC33775_BAL_TMR_CH9_PWM_PWM75_ENUM_VAL (2U) - -/* Enumerated value PWM100: PWM duty cycle set to 100%. */ -#define MC33775_BAL_TMR_CH9_PWM_PWM100_ENUM_VAL (3U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t BALTIME : 14; - volatile uint16_t PWM : 2; - } B; -} mc33775_balancing_registers_bal_tmr_ch9_t; - -/* -------------------------------------------------------------------------- - * BAL_TMR_CH10 (read-write):Balancing timer channel 10 - * -------------------------------------------------------------------------- */ -#define MC33775_BAL_TMR_CH10_OFFSET (0x101AU) -#define MC33775_BAL_TMR_CH10_RW_MSK (0xFFFFU) -#define MC33775_BAL_TMR_CH10_RD_MSK (0xFFFFU) -#define MC33775_BAL_TMR_CH10_WR_MSK (0xFFFFU) -#define MC33775_BAL_TMR_CH10_MW_MSK (0x0U) -#define MC33775_BAL_TMR_CH10_RA_MSK (0x0U) -#define MC33775_BAL_TMR_CH10_POR_MSK (0xffffU) -#define MC33775_BAL_TMR_CH10_POR_VAL (0x0U) - -/* Field BALTIME: Balancing time for channel 10 The value of this field represents the current counter value when read. The counting saturates at 0. If the value is zero, the balancing for this channel is stopped. The counting is only active if balancing is enabled, timer based balancing is enabled and the channel enable is set. */ -#define MC33775_BAL_TMR_CH10_BALTIME_POS (0U) -#define MC33775_BAL_TMR_CH10_BALTIME_MSK (0x3FFFU) - -/* Enumerated value EXPIRED: Balancing time is set to 0. */ -#define MC33775_BAL_TMR_CH10_BALTIME_EXPIRED_ENUM_VAL (0U) - -/* Enumerated value BALTIME: Balancing time is set to BALTIME * 10 seconds */ -#define MC33775_BAL_TMR_CH10_BALTIME_BALTIME_ENUM_VAL (1U) - -/* Enumerated value MAX: Sets maximum balancing time of 163830 seconds = approximately 45.5 hours. */ -#define MC33775_BAL_TMR_CH10_BALTIME_MAX_ENUM_VAL (16383U) - -/* Field PWM: PWM duty cycle for channel 10. */ -#define MC33775_BAL_TMR_CH10_PWM_POS (14U) -#define MC33775_BAL_TMR_CH10_PWM_MSK (0xC000U) - -/* Enumerated value PWM25: PWM duty cycle set to 25%. */ -#define MC33775_BAL_TMR_CH10_PWM_PWM25_ENUM_VAL (0U) - -/* Enumerated value PWM50: PWM duty cycle set to 50%. */ -#define MC33775_BAL_TMR_CH10_PWM_PWM50_ENUM_VAL (1U) - -/* Enumerated value PWM75: PWM duty cycle set to 75%. */ -#define MC33775_BAL_TMR_CH10_PWM_PWM75_ENUM_VAL (2U) - -/* Enumerated value PWM100: PWM duty cycle set to 100%. */ -#define MC33775_BAL_TMR_CH10_PWM_PWM100_ENUM_VAL (3U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t BALTIME : 14; - volatile uint16_t PWM : 2; - } B; -} mc33775_balancing_registers_bal_tmr_ch10_t; - -/* -------------------------------------------------------------------------- - * BAL_TMR_CH11 (read-write):Balancing timer channel 11 - * -------------------------------------------------------------------------- */ -#define MC33775_BAL_TMR_CH11_OFFSET (0x101BU) -#define MC33775_BAL_TMR_CH11_RW_MSK (0xFFFFU) -#define MC33775_BAL_TMR_CH11_RD_MSK (0xFFFFU) -#define MC33775_BAL_TMR_CH11_WR_MSK (0xFFFFU) -#define MC33775_BAL_TMR_CH11_MW_MSK (0x0U) -#define MC33775_BAL_TMR_CH11_RA_MSK (0x0U) -#define MC33775_BAL_TMR_CH11_POR_MSK (0xffffU) -#define MC33775_BAL_TMR_CH11_POR_VAL (0x0U) - -/* Field BALTIME: Balancing time for channel 11 The value of this field represents the current counter value when read. The counting saturates at 0. If the value is zero, the balancing for this channel is stopped. The counting is only active if balancing is enabled, timer based balancing is enabled and the channel enable is set. */ -#define MC33775_BAL_TMR_CH11_BALTIME_POS (0U) -#define MC33775_BAL_TMR_CH11_BALTIME_MSK (0x3FFFU) - -/* Enumerated value EXPIRED: Balancing time is set to 0. */ -#define MC33775_BAL_TMR_CH11_BALTIME_EXPIRED_ENUM_VAL (0U) - -/* Enumerated value BALTIME: Balancing time is set to BALTIME * 10 seconds */ -#define MC33775_BAL_TMR_CH11_BALTIME_BALTIME_ENUM_VAL (1U) - -/* Enumerated value MAX: Sets maximum balancing time of 163830 seconds = approximately 45.5 hours. */ -#define MC33775_BAL_TMR_CH11_BALTIME_MAX_ENUM_VAL (16383U) - -/* Field PWM: PWM duty cycle for channel 11. */ -#define MC33775_BAL_TMR_CH11_PWM_POS (14U) -#define MC33775_BAL_TMR_CH11_PWM_MSK (0xC000U) - -/* Enumerated value PWM25: PWM duty cycle set to 25%. */ -#define MC33775_BAL_TMR_CH11_PWM_PWM25_ENUM_VAL (0U) - -/* Enumerated value PWM50: PWM duty cycle set to 50%. */ -#define MC33775_BAL_TMR_CH11_PWM_PWM50_ENUM_VAL (1U) - -/* Enumerated value PWM75: PWM duty cycle set to 75%. */ -#define MC33775_BAL_TMR_CH11_PWM_PWM75_ENUM_VAL (2U) - -/* Enumerated value PWM100: PWM duty cycle set to 100%. */ -#define MC33775_BAL_TMR_CH11_PWM_PWM100_ENUM_VAL (3U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t BALTIME : 14; - volatile uint16_t PWM : 2; - } B; -} mc33775_balancing_registers_bal_tmr_ch11_t; - -/* -------------------------------------------------------------------------- - * BAL_TMR_CH12 (read-write):Balancing timer channel 12 - * -------------------------------------------------------------------------- */ -#define MC33775_BAL_TMR_CH12_OFFSET (0x101CU) -#define MC33775_BAL_TMR_CH12_RW_MSK (0xFFFFU) -#define MC33775_BAL_TMR_CH12_RD_MSK (0xFFFFU) -#define MC33775_BAL_TMR_CH12_WR_MSK (0xFFFFU) -#define MC33775_BAL_TMR_CH12_MW_MSK (0x0U) -#define MC33775_BAL_TMR_CH12_RA_MSK (0x0U) -#define MC33775_BAL_TMR_CH12_POR_MSK (0xffffU) -#define MC33775_BAL_TMR_CH12_POR_VAL (0x0U) - -/* Field BALTIME: Balancing time for channel 12 The value of this field represents the current counter value when read. The counting saturates at 0. If the value is zero, the balancing for this channel is stopped. The counting is only active if balancing is enabled, timer based balancing is enabled and the channel enable is set. */ -#define MC33775_BAL_TMR_CH12_BALTIME_POS (0U) -#define MC33775_BAL_TMR_CH12_BALTIME_MSK (0x3FFFU) - -/* Enumerated value EXPIRED: Balancing time is set to 0. */ -#define MC33775_BAL_TMR_CH12_BALTIME_EXPIRED_ENUM_VAL (0U) - -/* Enumerated value BALTIME: Balancing time is set to BALTIME * 10 seconds */ -#define MC33775_BAL_TMR_CH12_BALTIME_BALTIME_ENUM_VAL (1U) - -/* Enumerated value MAX: Sets maximum balancing time of 163830 seconds = approximately 45.5 hours. */ -#define MC33775_BAL_TMR_CH12_BALTIME_MAX_ENUM_VAL (16383U) - -/* Field PWM: PWM duty cycle for channel 12 */ -#define MC33775_BAL_TMR_CH12_PWM_POS (14U) -#define MC33775_BAL_TMR_CH12_PWM_MSK (0xC000U) - -/* Enumerated value PWM25: PWM duty cycle set to 25%. */ -#define MC33775_BAL_TMR_CH12_PWM_PWM25_ENUM_VAL (0U) - -/* Enumerated value PWM50: PWM duty cycle set to 50%. */ -#define MC33775_BAL_TMR_CH12_PWM_PWM50_ENUM_VAL (1U) - -/* Enumerated value PWM75: PWM duty cycle set to 75%. */ -#define MC33775_BAL_TMR_CH12_PWM_PWM75_ENUM_VAL (2U) - -/* Enumerated value PWM100: PWM duty cycle set to 100%. */ -#define MC33775_BAL_TMR_CH12_PWM_PWM100_ENUM_VAL (3U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t BALTIME : 14; - volatile uint16_t PWM : 2; - } B; -} mc33775_balancing_registers_bal_tmr_ch12_t; - -/* -------------------------------------------------------------------------- - * BAL_TMR_CH13 (read-write):Balancing timer channel 13 - * -------------------------------------------------------------------------- */ -#define MC33775_BAL_TMR_CH13_OFFSET (0x101DU) -#define MC33775_BAL_TMR_CH13_RW_MSK (0xFFFFU) -#define MC33775_BAL_TMR_CH13_RD_MSK (0xFFFFU) -#define MC33775_BAL_TMR_CH13_WR_MSK (0xFFFFU) -#define MC33775_BAL_TMR_CH13_MW_MSK (0x0U) -#define MC33775_BAL_TMR_CH13_RA_MSK (0x0U) -#define MC33775_BAL_TMR_CH13_POR_MSK (0xffffU) -#define MC33775_BAL_TMR_CH13_POR_VAL (0x0U) - -/* Field BALTIME: Balancing time for channel 13 The value of this field represents the current counter value when read. The counting saturates at 0. If the value is zero, the balancing for this channel is stopped. The counting is only active if balancing is enabled, timer based balancing is enabled and the channel enable is set. */ -#define MC33775_BAL_TMR_CH13_BALTIME_POS (0U) -#define MC33775_BAL_TMR_CH13_BALTIME_MSK (0x3FFFU) - -/* Enumerated value EXPIRED: Balancing time is set to 0. */ -#define MC33775_BAL_TMR_CH13_BALTIME_EXPIRED_ENUM_VAL (0U) - -/* Enumerated value BALTIME: Balancing time is set to BALTIME * 10 seconds */ -#define MC33775_BAL_TMR_CH13_BALTIME_BALTIME_ENUM_VAL (1U) - -/* Enumerated value MAX: Sets maximum balancing time of 163830 seconds = approximately 45.5 hours. */ -#define MC33775_BAL_TMR_CH13_BALTIME_MAX_ENUM_VAL (16383U) - -/* Field PWM: PWM duty cycle for channel 13. */ -#define MC33775_BAL_TMR_CH13_PWM_POS (14U) -#define MC33775_BAL_TMR_CH13_PWM_MSK (0xC000U) - -/* Enumerated value PWM25: PWM duty cycle set to 25%. */ -#define MC33775_BAL_TMR_CH13_PWM_PWM25_ENUM_VAL (0U) - -/* Enumerated value PWM50: PWM duty cycle set to 50%. */ -#define MC33775_BAL_TMR_CH13_PWM_PWM50_ENUM_VAL (1U) - -/* Enumerated value PWM75: PWM duty cycle set to 75%. */ -#define MC33775_BAL_TMR_CH13_PWM_PWM75_ENUM_VAL (2U) - -/* Enumerated value PWM100: PWM duty cycle set to 100%. */ -#define MC33775_BAL_TMR_CH13_PWM_PWM100_ENUM_VAL (3U) - -typedef union { - volatile uint16_t R; - struct { - volatile uint16_t BALTIME : 14; - volatile uint16_t PWM : 2; - } B; -} mc33775_balancing_registers_bal_tmr_ch13_t; - -/* Overall register structs */ -typedef struct { - mc33775_system_control_registers_sys_cfg_crc_t SYS_CFG_CRC; - mc33775_system_control_registers_sys_com_cfg_t SYS_COM_CFG; - mc33775_system_control_registers_sys_com_to_cfg_t SYS_COM_TO_CFG; - mc33775_system_control_registers_sys_supply_cfg_t SYS_SUPPLY_CFG; - mc33775_system_control_registers_sys_mode_t SYS_MODE; - mc33775_system_control_registers_sys_cyc_wakeup_cfg_t SYS_CYC_WAKEUP_CFG; - mc33775_system_control_registers_sys_tpl_cfg_t SYS_TPL_CFG; - uint16_t RESERVED_7_7[1]; - mc33775_system_control_registers_sys_clk_sync_ctrl_t SYS_CLK_SYNC_CTRL; - uint16_t RESERVED_9_14[6]; - /* mc33775_system_control_registers_sys_dbg_ctrl_t SYS_DBG_CTRL; */ /* TODO: check */ - mc33775_system_control_registers_sys_version_t SYS_VERSION; - mc33775_system_control_registers_sys_uid_low_t SYS_UID_LOW; - mc33775_system_control_registers_sys_uid_mid_t SYS_UID_MID; - mc33775_system_control_registers_sys_uid_high_t SYS_UID_HIGH; - uint16_t RESERVED_20_127[108]; - mc33775_system_control_registers_sys_ds_storage0_t SYS_DS_STORAGE0; - mc33775_system_control_registers_sys_ds_storage1_t SYS_DS_STORAGE1; - uint16_t RESERVED_130_255[126]; - /* mc33775_system_control_registers_sys_com_tpl_cfg_t SYS_COM_TPL_CFG; */ /* TODO: check */ - uint16_t RESERVED_257_1023[767]; -} mc33775_system_control_registers_t; - -typedef struct { - mc33775_event_handling_registers_feh_cfg_crc_t FEH_CFG_CRC; - mc33775_event_handling_registers_feh_alarm_cfg_t FEH_ALARM_CFG; - mc33775_event_handling_registers_feh_alarm_out_cfg_t FEH_ALARM_OUT_CFG; - mc33775_event_handling_registers_feh_alarm_out_reason_t FEH_ALARM_OUT_REASON; - uint16_t RESERVED_4_7[4]; - mc33775_event_handling_registers_feh_wakeup_cfg_t FEH_WAKEUP_CFG; - mc33775_event_handling_registers_feh_wakeup_reason_t FEH_WAKEUP_REASON; - uint16_t RESERVED_10_15[6]; - mc33775_event_handling_registers_feh_mon_bist_ctrl_t FEH_MON_BIST_CTRL; - mc33775_event_handling_registers_feh_mon_bist_res_t FEH_MON_BIST_RES; - uint16_t RESERVED_18_29[12]; - mc33775_event_handling_registers_feh_acc_err_t FEH_ACC_ERR; - mc33775_event_handling_registers_feh_grp_flt_stat_t FEH_GRP_FLT_STAT; - mc33775_event_handling_registers_feh_supply_flt_stat0_t FEH_SUPPLY_FLT_STAT0; - mc33775_event_handling_registers_feh_supply_flt_stat1_t FEH_SUPPLY_FLT_STAT1; - mc33775_event_handling_registers_feh_ana_flt_stat_t FEH_ANA_FLT_STAT; - mc33775_event_handling_registers_feh_com_flt_stat_t FEH_COM_FLT_STAT; - mc33775_event_handling_registers_feh_meas_flt_stat_t FEH_MEAS_FLT_STAT; - uint16_t RESERVED_37_39[3]; - mc33775_event_handling_registers_feh_supply_flt_por_cfg0_t FEH_SUPPLY_FLT_POR_CFG0; - mc33775_event_handling_registers_feh_supply_flt_por_cfg1_t FEH_SUPPLY_FLT_POR_CFG1; - mc33775_event_handling_registers_feh_ana_flt_por_cfg_t FEH_ANA_FLT_POR_CFG; - mc33775_event_handling_registers_feh_com_flt_por_cfg_t FEH_COM_FLT_POR_CFG; - uint16_t RESERVED_44_47[4]; - mc33775_event_handling_registers_feh_supply_flt_evt_cfg0_t FEH_SUPPLY_FLT_EVT_CFG0; - mc33775_event_handling_registers_feh_supply_flt_evt_cfg1_t FEH_SUPPLY_FLT_EVT_CFG1; - mc33775_event_handling_registers_feh_ana_flt_evt_cfg_t FEH_ANA_FLT_EVT_CFG; - mc33775_event_handling_registers_feh_com_flt_evt_cfg_t FEH_COM_FLT_EVT_CFG; - mc33775_event_handling_registers_feh_meas_flt_evt_cfg_t FEH_MEAS_FLT_EVT_CFG; - uint16_t RESERVED_53_127[75]; - mc33775_event_handling_registers_feh_por_reason_t FEH_POR_REASON; - uint16_t RESERVED_129_1023[895]; -} mc33775_event_handling_registers_t; - -typedef struct { - mc33775_gpio_registers_gpio_cfg0_t GPIO_CFG0; - mc33775_gpio_registers_gpio_cfg1_t GPIO_CFG1; - mc33775_gpio_registers_gpio_out_t GPIO_OUT; - uint16_t RESERVED_3_3[1]; - mc33775_gpio_registers_gpio_in_t GPIO_IN; - uint16_t RESERVED_5_1023[1019]; -} mc33775_gpio_registers_t; - -typedef struct { - mc33775_i2c_registers_i2c_cfg_t I2C_CFG; - mc33775_i2c_registers_i2c_ctrl_t I2C_CTRL; - mc33775_i2c_registers_i2c_stat_t I2C_STAT; - uint16_t RESERVED_3_3[1]; - mc33775_i2c_registers_i2c_data0_t I2C_DATA0; - mc33775_i2c_registers_i2c_data1_t I2C_DATA1; - mc33775_i2c_registers_i2c_data2_t I2C_DATA2; - mc33775_i2c_registers_i2c_data3_t I2C_DATA3; - mc33775_i2c_registers_i2c_data4_t I2C_DATA4; - mc33775_i2c_registers_i2c_data5_t I2C_DATA5; - mc33775_i2c_registers_i2c_data6_t I2C_DATA6; - uint16_t RESERVED_11_1023[1013]; -} mc33775_i2c_registers_t; - -typedef struct { - mc33775_balancing_registers_bal_glob_cfg_t BAL_GLOB_CFG; - mc33775_balancing_registers_bal_glob_to_tmr_t BAL_GLOB_TO_TMR; - mc33775_balancing_registers_bal_ch_cfg_t BAL_CH_CFG; - mc33775_balancing_registers_bal_pre_tmr_t BAL_PRE_TMR; - mc33775_balancing_registers_bal_auto_dischrg_ctrl_t BAL_AUTO_DISCHRG_CTRL; - uint16_t RESERVED_5_8[4]; - mc33775_balancing_registers_bal_ch_uv0_stat_t BAL_CH_UV0_STAT; - mc33775_balancing_registers_bal_glob_uv1_stat_t BAL_GLOB_UV1_STAT; - mc33775_balancing_registers_bal_stat0_t BAL_STAT0; - mc33775_balancing_registers_bal_stat1_t BAL_STAT1; - mc33775_balancing_registers_bal_switch_stat_t BAL_SWITCH_STAT; - mc33775_balancing_registers_bal_switch_flt_stat_t BAL_SWITCH_FLT_STAT; - mc33775_balancing_registers_bal_tmr_ch_all_t BAL_TMR_CH_ALL; - mc33775_balancing_registers_bal_tmr_ch0_t BAL_TMR_CH0; - mc33775_balancing_registers_bal_tmr_ch1_t BAL_TMR_CH1; - mc33775_balancing_registers_bal_tmr_ch2_t BAL_TMR_CH2; - mc33775_balancing_registers_bal_tmr_ch3_t BAL_TMR_CH3; - mc33775_balancing_registers_bal_tmr_ch4_t BAL_TMR_CH4; - mc33775_balancing_registers_bal_tmr_ch5_t BAL_TMR_CH5; - mc33775_balancing_registers_bal_tmr_ch6_t BAL_TMR_CH6; - mc33775_balancing_registers_bal_tmr_ch7_t BAL_TMR_CH7; - mc33775_balancing_registers_bal_tmr_ch8_t BAL_TMR_CH8; - mc33775_balancing_registers_bal_tmr_ch9_t BAL_TMR_CH9; - mc33775_balancing_registers_bal_tmr_ch10_t BAL_TMR_CH10; - mc33775_balancing_registers_bal_tmr_ch11_t BAL_TMR_CH11; - mc33775_balancing_registers_bal_tmr_ch12_t BAL_TMR_CH12; - mc33775_balancing_registers_bal_tmr_ch13_t BAL_TMR_CH13; - uint16_t RESERVED_30_1023[994]; -} mc33775_balancing_registers_t; - -typedef struct { - mc33775_all_measurement_registers_allm_cfg_t ALLM_CFG; - mc33775_all_measurement_registers_allm_app_ctrl_t ALLM_APP_CTRL; - mc33775_all_measurement_registers_allm_per_ctrl_t ALLM_PER_CTRL; - mc33775_all_measurement_registers_allm_sync_ctrl_t ALLM_SYNC_CTRL; - uint16_t RESERVED_4_7[4]; - mc33775_all_measurement_registers_allm_vcvb_cfg_t ALLM_VCVB_CFG; - uint16_t RESERVED_9_1023[1015]; -} mc33775_all_measurement_registers_t; - -typedef struct { - mc33775_primary_measurement_registers_prmm_cfg_t PRMM_CFG; - mc33775_primary_measurement_registers_prmm_app_ctrl_t PRMM_APP_CTRL; - mc33775_primary_measurement_registers_prmm_per_ctrl_t PRMM_PER_CTRL; - mc33775_primary_measurement_registers_prmm_sync_ctrl_t PRMM_SYNC_CTRL; - uint16_t RESERVED_4_7[4]; - mc33775_primary_measurement_registers_prmm_vc_cfg_t PRMM_VC_CFG; - mc33775_primary_measurement_registers_prmm_ain_cfg_t PRMM_AIN_CFG; - mc33775_primary_measurement_registers_prmm_ain_ol_cfg_t PRMM_AIN_OL_CFG; - mc33775_primary_measurement_registers_prmm_vdiv_cfg_t PRMM_VDIV_CFG; - uint16_t RESERVED_12_15[4]; - mc33775_primary_measurement_registers_prmm_vc_ov_uv_cfg_t PRMM_VC_OV_UV_CFG; - mc33775_primary_measurement_registers_prmm_vc_ov_th_cfg_t PRMM_VC_OV_TH_CFG; - mc33775_primary_measurement_registers_prmm_vc_uv0_th_cfg_t PRMM_VC_UV0_TH_CFG; - mc33775_primary_measurement_registers_prmm_vc_uv1_th_cfg_t PRMM_VC_UV1_TH_CFG; - mc33775_primary_measurement_registers_prmm_ain0_ov_th_cfg_t PRMM_AIN0_OV_TH_CFG; - mc33775_primary_measurement_registers_prmm_ain1_ov_th_cfg_t PRMM_AIN1_OV_TH_CFG; - mc33775_primary_measurement_registers_prmm_ain2_ov_th_cfg_t PRMM_AIN2_OV_TH_CFG; - mc33775_primary_measurement_registers_prmm_ain3_ov_th_cfg_t PRMM_AIN3_OV_TH_CFG; - mc33775_primary_measurement_registers_prmm_ain0_uv_th_cfg_t PRMM_AIN0_UV_TH_CFG; - mc33775_primary_measurement_registers_prmm_ain1_uv_th_cfg_t PRMM_AIN1_UV_TH_CFG; - mc33775_primary_measurement_registers_prmm_ain2_uv_th_cfg_t PRMM_AIN2_UV_TH_CFG; - mc33775_primary_measurement_registers_prmm_ain3_uv_th_cfg_t PRMM_AIN3_UV_TH_CFG; - uint16_t RESERVED_28_29[2]; - mc33775_primary_measurement_registers_prmm_cal_crc_t PRMM_CAL_CRC; - mc33775_primary_measurement_registers_prmm_cfg_crc_t PRMM_CFG_CRC; - mc33775_primary_measurement_registers_prmm_vc_ov_flt_stat_t PRMM_VC_OV_FLT_STAT; - mc33775_primary_measurement_registers_prmm_vc_uv0_flt_stat_t PRMM_VC_UV0_FLT_STAT; - mc33775_primary_measurement_registers_prmm_vc_uv1_flt_stat_t PRMM_VC_UV1_FLT_STAT; - mc33775_primary_measurement_registers_prmm_ain_ov_flt_stat_t PRMM_AIN_OV_FLT_STAT; - mc33775_primary_measurement_registers_prmm_ain_uv_flt_stat_t PRMM_AIN_UV_FLT_STAT; - uint16_t RESERVED_37_61[25]; - mc33775_primary_measurement_registers_prmm_meas_stat_t PRMM_MEAS_STAT; - mc33775_primary_measurement_registers_prmm_app_vc_cnt_t PRMM_APP_VC_CNT; - mc33775_primary_measurement_registers_prmm_app_vc0_t PRMM_APP_VC0; - mc33775_primary_measurement_registers_prmm_app_vc1_t PRMM_APP_VC1; - mc33775_primary_measurement_registers_prmm_app_vc2_t PRMM_APP_VC2; - mc33775_primary_measurement_registers_prmm_app_vc3_t PRMM_APP_VC3; - mc33775_primary_measurement_registers_prmm_app_vc4_t PRMM_APP_VC4; - mc33775_primary_measurement_registers_prmm_app_vc5_t PRMM_APP_VC5; - mc33775_primary_measurement_registers_prmm_app_vc6_t PRMM_APP_VC6; - mc33775_primary_measurement_registers_prmm_app_vc7_t PRMM_APP_VC7; - mc33775_primary_measurement_registers_prmm_app_vc8_t PRMM_APP_VC8; - mc33775_primary_measurement_registers_prmm_app_vc9_t PRMM_APP_VC9; - mc33775_primary_measurement_registers_prmm_app_vc10_t PRMM_APP_VC10; - mc33775_primary_measurement_registers_prmm_app_vc11_t PRMM_APP_VC11; - mc33775_primary_measurement_registers_prmm_app_vc12_t PRMM_APP_VC12; - mc33775_primary_measurement_registers_prmm_app_vc13_t PRMM_APP_VC13; - mc33775_primary_measurement_registers_prmm_app_vmodule_t PRMM_APP_VMODULE; - mc33775_primary_measurement_registers_prmm_app_ain0_t PRMM_APP_AIN0; - mc33775_primary_measurement_registers_prmm_app_ain1_t PRMM_APP_AIN1; - mc33775_primary_measurement_registers_prmm_app_ain2_t PRMM_APP_AIN2; - mc33775_primary_measurement_registers_prmm_app_ain3_t PRMM_APP_AIN3; - uint16_t RESERVED_83_94[12]; - mc33775_primary_measurement_registers_prmm_per_num_t PRMM_PER_NUM; - mc33775_primary_measurement_registers_prmm_per_vc0_t PRMM_PER_VC0; - mc33775_primary_measurement_registers_prmm_per_vc1_t PRMM_PER_VC1; - mc33775_primary_measurement_registers_prmm_per_vc2_t PRMM_PER_VC2; - mc33775_primary_measurement_registers_prmm_per_vc3_t PRMM_PER_VC3; - mc33775_primary_measurement_registers_prmm_per_vc4_t PRMM_PER_VC4; - mc33775_primary_measurement_registers_prmm_per_vc5_t PRMM_PER_VC5; - mc33775_primary_measurement_registers_prmm_per_vc6_t PRMM_PER_VC6; - mc33775_primary_measurement_registers_prmm_per_vc7_t PRMM_PER_VC7; - mc33775_primary_measurement_registers_prmm_per_vc8_t PRMM_PER_VC8; - mc33775_primary_measurement_registers_prmm_per_vc9_t PRMM_PER_VC9; - mc33775_primary_measurement_registers_prmm_per_vc10_t PRMM_PER_VC10; - mc33775_primary_measurement_registers_prmm_per_vc11_t PRMM_PER_VC11; - mc33775_primary_measurement_registers_prmm_per_vc12_t PRMM_PER_VC12; - mc33775_primary_measurement_registers_prmm_per_vc13_t PRMM_PER_VC13; - mc33775_primary_measurement_registers_prmm_per_vmodule_t PRMM_PER_VMODULE; - mc33775_primary_measurement_registers_prmm_per_ain0_t PRMM_PER_AIN0; - mc33775_primary_measurement_registers_prmm_per_ain1_t PRMM_PER_AIN1; - mc33775_primary_measurement_registers_prmm_per_ain2_t PRMM_PER_AIN2; - mc33775_primary_measurement_registers_prmm_per_ain3_t PRMM_PER_AIN3; - mc33775_primary_measurement_registers_prmm_per_prmtemp_t PRMM_PER_PRMTEMP; - mc33775_primary_measurement_registers_prmm_per_secvref_t PRMM_PER_SECVREF; - mc33775_primary_measurement_registers_prmm_per_vaux_t PRMM_PER_VAUX; - mc33775_primary_measurement_registers_prmm_per_vddc_t PRMM_PER_VDDC; - mc33775_primary_measurement_registers_prmm_per_ldovref_t PRMM_PER_LDOVREF; - uint16_t RESERVED_120_126[7]; - mc33775_primary_measurement_registers_prmm_sync_num_t PRMM_SYNC_NUM; - mc33775_primary_measurement_registers_prmm_sync_vc0_t PRMM_SYNC_VC0; - mc33775_primary_measurement_registers_prmm_sync_vc1_t PRMM_SYNC_VC1; - mc33775_primary_measurement_registers_prmm_sync_vc2_t PRMM_SYNC_VC2; - mc33775_primary_measurement_registers_prmm_sync_vc3_t PRMM_SYNC_VC3; - mc33775_primary_measurement_registers_prmm_sync_vc4_t PRMM_SYNC_VC4; - mc33775_primary_measurement_registers_prmm_sync_vc5_t PRMM_SYNC_VC5; - mc33775_primary_measurement_registers_prmm_sync_vc6_t PRMM_SYNC_VC6; - mc33775_primary_measurement_registers_prmm_sync_vc7_t PRMM_SYNC_VC7; - mc33775_primary_measurement_registers_prmm_sync_vc8_t PRMM_SYNC_VC8; - mc33775_primary_measurement_registers_prmm_sync_vc9_t PRMM_SYNC_VC9; - mc33775_primary_measurement_registers_prmm_sync_vc10_t PRMM_SYNC_VC10; - mc33775_primary_measurement_registers_prmm_sync_vc11_t PRMM_SYNC_VC11; - mc33775_primary_measurement_registers_prmm_sync_vc12_t PRMM_SYNC_VC12; - mc33775_primary_measurement_registers_prmm_sync_vc13_t PRMM_SYNC_VC13; - uint16_t RESERVED_142_1023[882]; -} mc33775_primary_measurement_registers_t; - -typedef struct { - mc33775_secondary_measurement_registers_secm_cfg_t SECM_CFG; - mc33775_secondary_measurement_registers_secm_app_ctrl_t SECM_APP_CTRL; - mc33775_secondary_measurement_registers_secm_per_ctrl_t SECM_PER_CTRL; - mc33775_secondary_measurement_registers_secm_sync_ctrl_t SECM_SYNC_CTRL; - uint16_t RESERVED_4_7[4]; - mc33775_secondary_measurement_registers_secm_vb_cfg_t SECM_VB_CFG; - mc33775_secondary_measurement_registers_secm_ain_cfg_t SECM_AIN_CFG; - mc33775_secondary_measurement_registers_secm_ain_ol_cfg_t SECM_AIN_OL_CFG; - mc33775_secondary_measurement_registers_secm_vdiv_cfg_t SECM_VDIV_CFG; - uint16_t RESERVED_12_29[18]; - mc33775_secondary_measurement_registers_secm_cal_crc_t SECM_CAL_CRC; - mc33775_secondary_measurement_registers_secm_cfg_crc_t SECM_CFG_CRC; - uint16_t RESERVED_32_61[30]; - mc33775_secondary_measurement_registers_secm_meas_stat_t SECM_MEAS_STAT; - uint16_t RESERVED_63_78[16]; - mc33775_secondary_measurement_registers_secm_app_ain4_t SECM_APP_AIN4; - mc33775_secondary_measurement_registers_secm_app_ain5_t SECM_APP_AIN5; - mc33775_secondary_measurement_registers_secm_app_ain6_t SECM_APP_AIN6; - mc33775_secondary_measurement_registers_secm_app_ain7_t SECM_APP_AIN7; - uint16_t RESERVED_83_94[12]; - mc33775_secondary_measurement_registers_secm_per_num_t SECM_PER_NUM; - uint16_t RESERVED_96_110[15]; - mc33775_secondary_measurement_registers_secm_per_ain4_t SECM_PER_AIN4; - mc33775_secondary_measurement_registers_secm_per_ain5_t SECM_PER_AIN5; - mc33775_secondary_measurement_registers_secm_per_ain6_t SECM_PER_AIN6; - mc33775_secondary_measurement_registers_secm_per_ain7_t SECM_PER_AIN7; - mc33775_secondary_measurement_registers_secm_per_sectemp_t SECM_PER_SECTEMP; - mc33775_secondary_measurement_registers_secm_per_prmvref_t SECM_PER_PRMVREF; - mc33775_secondary_measurement_registers_secm_per_vaux_t SECM_PER_VAUX; - mc33775_secondary_measurement_registers_secm_per_vbat_t SECM_PER_VBAT; - mc33775_secondary_measurement_registers_secm_per_vdda_t SECM_PER_VDDA; - mc33775_secondary_measurement_registers_secm_per_vddc_t SECM_PER_VDDC; - mc33775_secondary_measurement_registers_secm_per_monvref_t SECM_PER_MONVREF; - mc33775_secondary_measurement_registers_secm_per_npnisense_t SECM_PER_NPNISENSE; - uint16_t RESERVED_123_126[4]; - mc33775_secondary_measurement_registers_secm_sync_num_t SECM_SYNC_NUM; - mc33775_secondary_measurement_registers_secm_sync_vb0_t SECM_SYNC_VB0; - mc33775_secondary_measurement_registers_secm_sync_vb1_t SECM_SYNC_VB1; - mc33775_secondary_measurement_registers_secm_sync_vb2_t SECM_SYNC_VB2; - mc33775_secondary_measurement_registers_secm_sync_vb3_t SECM_SYNC_VB3; - mc33775_secondary_measurement_registers_secm_sync_vb4_t SECM_SYNC_VB4; - mc33775_secondary_measurement_registers_secm_sync_vb5_t SECM_SYNC_VB5; - mc33775_secondary_measurement_registers_secm_sync_vb6_t SECM_SYNC_VB6; - mc33775_secondary_measurement_registers_secm_sync_vb7_t SECM_SYNC_VB7; - mc33775_secondary_measurement_registers_secm_sync_vb8_t SECM_SYNC_VB8; - mc33775_secondary_measurement_registers_secm_sync_vb9_t SECM_SYNC_VB9; - mc33775_secondary_measurement_registers_secm_sync_vb10_t SECM_SYNC_VB10; - mc33775_secondary_measurement_registers_secm_sync_vb11_t SECM_SYNC_VB11; - mc33775_secondary_measurement_registers_secm_sync_vb12_t SECM_SYNC_VB12; - mc33775_secondary_measurement_registers_secm_sync_vb13_t SECM_SYNC_VB13; - uint16_t RESERVED_142_1023[882]; -} mc33775_secondary_measurement_registers_t; - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/app/driver/afe/nxp/common/README.md b/src/app/driver/afe/nxp/common/README.md new file mode 100644 index 00000000..df048947 --- /dev/null +++ b/src/app/driver/afe/nxp/common/README.md @@ -0,0 +1 @@ +# Placeholder for common code diff --git a/src/app/driver/afe/nxp/common/n775.c b/src/app/driver/afe/nxp/common/n775.c deleted file mode 100644 index fbd58fba..00000000 --- a/src/app/driver/afe/nxp/common/n775.c +++ /dev/null @@ -1,776 +0,0 @@ -/** - * - * @copyright © 2010 - 2022, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. - * All rights reserved. - * - * 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®″ - * - */ - -/** - * @file n775.c - * @author foxBMS Team - * @date 2020-05-08 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 - * @ingroup DRIVERS - * @prefix N775 - * - * @brief Driver for the MC33775A monitoring chip. - * - */ - -/*========== Includes =======================================================*/ -#include "n775.h" - -#include "HL_system.h" - -#include "MC33775A.h" -#include "afe_dma.h" -#include "database.h" -#include "diag.h" -#include "os.h" - -/*========== Macros and Definitions =========================================*/ - -/** maximum number of supported cells per slave-module */ -#define N775_MAX_SUPPORTED_CELLS (12u) - -/** - * Saves the last state and the last substate - */ -#define N775_SAVELASTSTATES() \ - n775_state.lastState = n775_state.state; \ - n775_state.lastSubState = n775_state.subState - -/*========== Static Constant and Variable Definitions =======================*/ - -/*========== Extern Constant and Variable Definitions =======================*/ -/** - * PEC buffer for RX and TX - * @{ - */ -/* AXIVION Disable Style MisraC2012-1.2: The Pec buffer must be put in the shared RAM section for performance reasons */ -#pragma SET_DATA_SECTION(".sharedRAM") -uint16_t n775_RXbuffer[N775_MAX_N_BYTES_FOR_DATA_RECEPTION] = {0}; -uint16_t n775_TXbuffer[N775_TX_MESSAGE_LENGTH] = {0}; -#pragma SET_DATA_SECTION() -/* AXIVION Enable Style MisraC2012-1.2: only Pec buffer needed to be in the shared RAM setcion */ -/**@}*/ - -N775_MESSAGE_s n775_sentData = {0}; -N775_MESSAGE_s n775_receivedData = {0}; - -uint8_t n775_enumerateAddress = 1u; - -/* static int16_t n775_voltage_min = INT16_MAX; -static int16_t n775_voltage_max = INT16_MIN; -static int32_t n775_voltage_sum = 0; - -static uint8_t n775_voltage_module_number_min = 0; -static uint8_t n775_voltage_module_number_max = 0; -static uint8_t n775_voltage_cell_number_min = 0; -static uint8_t n775_voltage_cell_number_max = 0; -static uint16_t n775_voltage_nrValidCellVoltages = 0; */ - -/** local copies of database tables */ -/**@{*/ -static DATA_BLOCK_CELL_VOLTAGE_s n775_cellVoltage = {.header.uniqueId = DATA_BLOCK_ID_CELL_VOLTAGE_BASE}; -static DATA_BLOCK_CELL_TEMPERATURE_s n775_cellTemperature = {.header.uniqueId = DATA_BLOCK_ID_CELL_TEMPERATURE_BASE}; -static DATA_BLOCK_MIN_MAX_s n775_minMax = {.header.uniqueId = DATA_BLOCK_ID_MIN_MAX}; -static DATA_BLOCK_BALANCING_CONTROL_s n775_balancingControl = {.header.uniqueId = DATA_BLOCK_ID_BALANCING_CONTROL}; -/**@}*/ - -N775_STATE_s n775_state = { - .timer = 0, - .stateReq = N775_STATE_NO_REQUEST, - .state = N775_STATEMACH_UNINITIALIZED, - .subState = 0, - .lastState = N775_STATEMACH_UNINITIALIZED, - .lastSubState = 0, - .errRequestCounter = 0, - .triggerEntry = 0, - .firstMeasurementMade = STD_NOT_OK, - .checkSpiFlag = STD_NOT_OK, - .balanceControlDone = STD_NOT_OK, - .txTransmitOngoing = false, - .rxTransmitOngoing = false, - .totalMessages = 0u, - .remainingMessages = 0u, -}; - -/*========== Static Function Prototypes =====================================*/ -static void N775_SetFirstMeasurementCycleFinished(N775_STATE_s *n775_state); -static void N775_CopyStructToTxBuffer(N775_MESSAGE_s *message, uint16_t *buffer); -static void N775_WakeUp(uint16_t daisyChainAddress, uint16_t deviceAddress, uint16_t registerAddress); -static void N775_Write(uint16_t daisyChainAddress, uint16_t deviceAddress, uint16_t registerAddress, uint16_t data); -static void N775_Read( - uint16_t daisyChainAddress, - uint16_t deviceAddress, - uint16_t registerAddress, - uint16_t totalNumberOfRequestedRegister); -static void N775_Initialize_Database(void); -/* static void N775_Get_BalancingControlValues(void); */ -static void N775_StateTransition(N775_STATEMACH_e state, uint8_t substate, uint16_t timer_ms); -/* static void N775_CondBasedStateTransition(STD_RETURN_TYPE_e retVal, DIAG_ID_e diagCode, - N775_STATEMACH_e state_ok, uint8_t substate_ok, uint16_t timer_ms_ok, - N775_STATEMACH_e state_nok, uint8_t substate_nok, uint16_t timer_ms_nok); */ - -uint16_t n775_CrcAddItem(uint16_t remainder, uint16_t item); - -static N775_RETURN_TYPE_e N775_CheckStateRequest(N775_STATE_REQUEST_e statereq); -uint16_t n775_CalcCrc(const N775_MESSAGE_s *msg); - -/*========== Static Function Implementations ================================*/ - -/*========== Extern Function Implementations ================================*/ - -/* TODO: use own function */ -/** - * @brief Called to calculate the CRC of a message. NXP function. - * - * @param remainder - * @param item - * - * @return remainder - * - */ -uint16_t n775_CrcAddItem(uint16_t remainder, uint16_t item) { - int i; - uint16_t local_remainder = remainder; - - local_remainder ^= item; - - for (i = 0; i < 16; i++) { - /* - * Try to divide the current data bit. - */ - if ((local_remainder & 0x8000u) > 0u) { - local_remainder = (local_remainder << 1u) ^ ((0x9eb2u << 1u) + 0x1u); - } else { - local_remainder = (local_remainder << 1u); - } - } - - return (local_remainder); -} - -/* TODO: use own function */ -/** - * @brief Calculate the CRC of a message. NXP function. - * - * @param msg - * - * @return crc - * - */ -uint16_t n775_CalcCrc(const N775_MESSAGE_s *msg) { - uint16_t remainder = 0; - int i; - - remainder = n775_CrcAddItem(remainder, msg->head); - remainder = n775_CrcAddItem(remainder, msg->dataHead); - - for (i = 0; i < (msg->dataLength - 3); i++) { - remainder = n775_CrcAddItem(remainder, msg->data[i]); - } - - return (remainder); -} - -/** - * @brief in the database, initializes the fields related to the N775 driver. - * - * This function loops through all the N775-related data fields in the database - * and sets them to 0. It should be called in the initialization or re-initialization - * routine of the N775 driver. - */ -static void N775_Initialize_Database(void) { - uint16_t i = 0; - - for (uint8_t s = 0u; s < BS_NR_OF_STRINGS; s++) { - n775_cellVoltage.state = 0; - n775_minMax.minimumCellVoltage_mV[s] = 0; - n775_minMax.maximumCellVoltage_mV[s] = 0; - n775_minMax.nrModuleMinimumCellVoltage[s] = 0; - n775_minMax.nrModuleMaximumCellVoltage[s] = 0; - n775_minMax.nrCellMinimumCellVoltage[s] = 0; - n775_minMax.nrCellMaximumCellVoltage[s] = 0; - for (i = 0; i < BS_NR_OF_CELL_BLOCKS_PER_STRING; i++) { - n775_cellVoltage.cellVoltage_mV[s][i] = 0; - } - - n775_cellTemperature.state = 0; - n775_minMax.minimumTemperature_ddegC[s] = 0; - n775_minMax.maximumTemperature_ddegC[s] = 0; - n775_minMax.nrModuleMinimumTemperature[s] = 0; - n775_minMax.nrModuleMaximumTemperature[s] = 0; - n775_minMax.nrSensorMinimumTemperature[s] = 0; - n775_minMax.nrSensorMaximumTemperature[s] = 0; - for (i = 0; i < BS_NR_OF_TEMP_SENSORS_PER_STRING; i++) { - n775_cellTemperature.cellTemperature_ddegC[s][i] = 0; - } - - for (i = 0; i < BS_NR_OF_CELL_BLOCKS_PER_STRING; i++) { - n775_balancingControl.balancingState[s][i] = 0; - } - } - - DATA_WRITE_DATA(&n775_cellVoltage); - DATA_WRITE_DATA(&n775_cellTemperature); - DATA_WRITE_DATA(&n775_minMax); - DATA_WRITE_DATA(&n775_balancingControl); -} - -/** - * @brief function for setting N775_Trigger state transitions - * - * @param state: state to transition into - * @param subState: substate to transition into - * @param timer_ms: transition into state, substate after timer elapsed - */ -static void N775_StateTransition(N775_STATEMACH_e state, uint8_t subState, uint16_t timer_ms) { - n775_state.state = state; - n775_state.subState = subState; - n775_state.timer = timer_ms; -} - -/** - * @brief re-entrance check of N775 state machine trigger function - * - * This function is not re-entrant and should only be called time- or event-triggered. - * It increments the triggerentry counter from the state variable n775_state. - * It should never be called by two different processes, so if it is the case, triggerentry - * should never be higher than 0 when this function is called. - * - * - * @return retval 0 if no further instance of the function is active, 0xff else - * - */ -uint8_t N775_CheckReEntrance(void) { - uint8_t retval = 0; - - OS_EnterTaskCritical(); - if (!n775_state.triggerEntry) { - n775_state.triggerEntry++; - } else { - retval = 0xFF; /* multiple calls of function */ - } - OS_ExitTaskCritical(); - - return (retval); -} -uint8_t TEST_N775_CheckReEntrance(void) { - return N775_CheckReEntrance(); -} - -/** - * @brief gets the current state request. - * - * This function is used in the functioning of the N775 state machine. - * - * @return retval current state request, taken from N775_STATE_REQUEST_e - */ -extern N775_STATE_REQUEST_e N775_GetStateRequest(void) { - N775_STATE_REQUEST_e retval = N775_STATE_NO_REQUEST; - - OS_EnterTaskCritical(); - retval = n775_state.stateReq; - OS_ExitTaskCritical(); - - return (retval); -} - -/** - * @brief gets the current state. - * - * This function is used in the functioning of the N775 state machine. - * - * @return current state, taken from N775_STATEMACH_e - */ -extern N775_STATEMACH_e N775_GetState(void) { - return (n775_state.state); -} - -/** - * @brief transfers the current state request to the state machine. - * - * This function takes the current state request from n775_state and transfers it to the state machine. - * It resets the value from n775_state to N775_STATE_NO_REQUEST - * - * @return retVal current state request, taken from N775_STATE_REQUEST_e - * - */ -N775_STATE_REQUEST_e N775_TransferStateRequest() { - N775_STATE_REQUEST_e retval = N775_STATE_NO_REQUEST; - - OS_EnterTaskCritical(); - retval = n775_state.stateReq; - n775_state.stateReq = N775_STATE_NO_REQUEST; - OS_ExitTaskCritical(); - - return (retval); -} - -N775_RETURN_TYPE_e N775_SetStateRequest(N775_STATE_REQUEST_e statereq) { - N775_RETURN_TYPE_e retVal = N775_ERROR; - - OS_EnterTaskCritical(); - retVal = N775_CheckStateRequest(statereq); - - if ((retVal == N775_OK) || (retVal == N775_BUSY_OK) || (retVal == N775_OK_FROM_ERROR)) { - n775_state.stateReq = statereq; - } - OS_ExitTaskCritical(); - - return (retVal); -} - -void N775_Trigger(void) { - N775_STATE_REQUEST_e n775_stateReq = N775_STATE_NO_REQUEST; - bool n775_goToTrigger = true; - - N775_Write(0, 0, 0, 0); /* TODO: just to compile, remove */ - N775_Read(0, 0, 0, 0); /* TODO: just to compile, remove */ - - /* Check re-entrance of function */ - if (N775_CheckReEntrance() > 0u) { - n775_goToTrigger = false; - } - - if (n775_state.checkSpiFlag == STD_NOT_OK) { - if (n775_state.timer > 0u) { - if ((--n775_state.timer) > 0u) { - n775_state.triggerEntry--; - n775_goToTrigger = false; - ; /* handle state machine only if timer has elapsed */ - } - } - } else { - if (AFE_IsTxTransmitOngoing() == true) { - if (n775_state.timer > 0u) { - if ((--n775_state.timer) > 0u) { - n775_state.triggerEntry--; - n775_goToTrigger = false; - ; /* handle state machine only if timer has elapsed */ - } - } - } - if (AFE_IsRxTransmitOngoing() == true) { - if (n775_state.timer > 0u) { - if ((--n775_state.timer) > 0u) { - n775_state.triggerEntry--; - n775_goToTrigger = false; - ; /* handle state machine only if timer has elapsed */ - } - } - } - } - - if (n775_goToTrigger == true) { - switch (n775_state.state) { - /****************************UNINITIALIZED***********************************/ - case N775_STATEMACH_UNINITIALIZED: - /* waiting for Initialization Request */ - n775_stateReq = N775_TransferStateRequest(); - if (n775_stateReq == N775_STATE_INIT_REQUEST) { - N775_SAVELASTSTATES(); - N775_StateTransition( - N775_STATEMACH_INITIALIZATION, N775_ENTRY_UNINITIALIZED, N775_STATEMACH_SHORTTIME); - } else if (n775_stateReq == N775_STATE_NO_REQUEST) { - /* no actual request pending */ - } else { - n775_state.errRequestCounter++; /* illegal request pending */ - } - break; - - /****************************INITIALIZATION**********************************/ - case N775_STATEMACH_INITIALIZATION: - N775_Initialize_Database(); - N775_StateTransition(N775_STATEMACH_INITIALIZED, N775_ENTRY, N775_STATEMACH_SHORTTIME); - break; - - /****************************INITIALIZED*************************************/ - case N775_STATEMACH_INITIALIZED: - N775_SAVELASTSTATES(); - N775_StateTransition(N775_STATEMACH_WAKEUP, N775_ENTRY, N775_STATEMACH_SHORTTIME); - break; - - /****************************START MEASUREMENT*******************************/ - case N775_STATEMACH_WAKEUP: - if (n775_state.subState == N775_ENTRY) { - N775_SAVELASTSTATES(); - /* Send first wake-up command */ - N775_WakeUp(0u, 0u, 0u); - N775_StateTransition(N775_STATEMACH_WAKEUP, N775_SECOND_WAKEUP, N775_TWAKECOM_MS); - } else if (n775_state.subState == N775_SECOND_WAKEUP) { - N775_SAVELASTSTATES(); - /* Send second wake-up command */ - N775_WakeUp(0u, 0u, 0u); - N775_StateTransition(N775_STATEMACH_ENUMERATE, N775_ENTRY, N775_TIME_DAISYCHAIN_WAKEUP_MS); - } - break; - - /****************************START MEASUREMENT*******************************/ - case N775_STATEMACH_ENUMERATE: - if (n775_state.subState == N775_ENTRY) { - N775_SAVELASTSTATES(); - /* Enumerate first slave; first address is 1 and not 0; 0 means unenumerated */ - N775_Write( - 0u, - n775_enumerateAddress, - MC33775_SYS_COM_CFG_OFFSET, - (n775_enumerateAddress << MC33775_SYS_COM_CFG_DADD_POS) | - (MC33775_SYS_COM_CFG_BUSFW_ENABLED_ENUM_VAL << MC33775_SYS_COM_CFG_BUSFW_POS)); - N775_StateTransition( - N775_STATEMACH_ENUMERATE, N775_CHECK_ENUMERATION, N775_TIME_AFTER_ENUMERATION_MS); - n775_enumerateAddress++; - } else if (n775_state.subState == N775_CHECK_ENUMERATION) { - if (n775_enumerateAddress <= N775_N_N775) { - /* Enumerate next slave */ - N775_Write( - 0u, - n775_enumerateAddress, - MC33775_SYS_COM_CFG_OFFSET, - (n775_enumerateAddress << MC33775_SYS_COM_CFG_DADD_POS) | - (MC33775_SYS_COM_CFG_BUSFW_ENABLED_ENUM_VAL << MC33775_SYS_COM_CFG_BUSFW_POS)); - N775_StateTransition( - N775_STATEMACH_ENUMERATE, N775_CHECK_ENUMERATION, N775_TIME_AFTER_ENUMERATION_MS); - n775_enumerateAddress++; - } else { - /* All slave enumerated */ - N775_StateTransition(N775_STATEMACH_STARTMEAS, N775_ENTRY, N775_STATEMACH_SHORTTIME); - } - } - break; - - /****************************START MEASUREMENT*******************************/ - case N775_STATEMACH_STARTMEAS: - - break; - - /****************************READ VOLTAGE************************************/ - case N775_STATEMACH_READVOLTAGE: - - break; - - /****************************BALANCE CONTROL*********************************/ - case N775_STATEMACH_BALANCECONTROL: - - break; - - /****************************DEFAULT**************************/ - default: - /* invalid state */ - FAS_ASSERT(FAS_TRAP); - break; - } - } - - n775_state.triggerEntry--; /* reentrance counter */ -} - -/** - * @brief checks the state requests that are made. - * - * This function checks the validity of the state requests. - * The results of the checked is returned immediately. - * - * @param statereq state request to be checked - * - * @return result of the state request that was made, taken from N775_RETURN_TYPE_e - */ -static N775_RETURN_TYPE_e N775_CheckStateRequest(N775_STATE_REQUEST_e statereq) { - N775_RETURN_TYPE_e retVal = N775_OK; /* Default: request is OK */ - - if (n775_state.stateReq == N775_STATE_NO_REQUEST) { - /* init only allowed from the uninitialized state */ - if (statereq == N775_STATE_INIT_REQUEST) { - if (n775_state.state == N775_STATEMACH_UNINITIALIZED) { - retVal = N775_OK; - } else { - retVal = N775_ALREADY_INITIALIZED; - } - } - - } else { - retVal = N775_REQUEST_PENDING; - } - return retVal; -} - -/** - * @brief gets the measurement initialization status. - * - * @return retval true if a first measurement cycle was made, false otherwise - * - */ -extern bool N775_IsFirstMeasurementCycleFinished(void) { - bool retval = false; - - OS_EnterTaskCritical(); - retval = n775_state.firstMeasurementMade; - OS_ExitTaskCritical(); - - return (retval); -} - -/** - * @brief sets the measurement initialization status. - */ -static void N775_SetFirstMeasurementCycleFinished(N775_STATE_s *n775_state) { - OS_EnterTaskCritical(); - n775_state->firstMeasurementMade = STD_OK; - OS_ExitTaskCritical(); -} - -extern void TEST_N775_SetFirstMeasurementCycleFinished(N775_STATE_s *n775_state) { - N775_SetFirstMeasurementCycleFinished(n775_state); -} - -/** - * @brief sends a write command to the daisy-chain. - * @param message message to be sent - * @param buffer buffer used for SPI - */ -static void N775_CopyStructToTxBuffer(N775_MESSAGE_s *message, uint16_t *buffer) { - uint8_t i = 0; - - buffer[0] = message->head; - buffer[1] = message->dataHead; - if (((message->dataLength) >= 1u) && ((message->dataLength) <= 4u)) { - for (i = 0; i < (message->dataLength); i++) { - buffer[i + 2u] = message->data[i]; - } - buffer[i + 3u] = message->crc; - } else { - /* this should not happen, stay here */ - FAS_ASSERT(FAS_TRAP); - } -} - -/** - * @brief sends a wake-up command to the daisy-chain. - * - * @param daisyChainAddress parameter CADD in the message format - * @param deviceAddress parameter DADD in the message format lies - * between 1 and 62, 63 means all devices - * @param registerAddress address of register to be written to - */ -static void N775_WakeUp(uint16_t daisyChainAddress, uint16_t deviceAddress, uint16_t registerAddress) { - uint16_t messageCounter = 0u; - - /** - * Set Head part or WRITE message - */ - /* Set command field of WRITE message */ - n775_sentData.head = ((N775_CMD_WAKEUP_NOP & 0x3u) << 14u) | ((n775_sentData.head) & 0x3FFFu); - /* Set MADD field of WRITE message */ - n775_sentData.head = ((N775_MADD_MASTER0 & 0x1u) << 13u) | ((n775_sentData.head) & 0xDFFFu); - /* Set CADD field of WRITE message */ - n775_sentData.head = ((daisyChainAddress & 0x7u) << 10u) | ((n775_sentData.head) & 0xE3FFu); - /* Set DADD field of WRITE message; device addresses start at 1 */ - n775_sentData.head = ((deviceAddress & 0x3Fu) << 4u) | ((n775_sentData.head) & 0xFC0Fu); - /* Set message counter; not used for WRITE messages, set to 0 */ - (n775_sentData.head) = (messageCounter & 0xFu) | ((n775_sentData.head) & 0xFFF0u); - - /** - * Set Data head part or WRITE message - */ - /* Set DATLEN field of WRITE message */ - /* Number of registers addressed per message: 1, which is coded by DATLEN as 0 in the frame */ - n775_sentData.dataHead = ((0u & 0x3u) << 14u) | ((n775_sentData.dataHead) & 0x3FFFu); - /* Set REGADD field of WRITE message (address of register to be addressed)) */ - n775_sentData.dataHead = (registerAddress & 0x3FFFu) | ((n775_sentData.dataHead) & 0xC000u); - - /** - * Set Data part or WRITE message - */ - /* Set data fields; only first field is used. */ - /* Set all data fields to 0. */ - n775_sentData.data[0] = 0u; - n775_sentData.data[1] = 0u; - n775_sentData.data[2] = 0u; - n775_sentData.data[3] = 0u; - /* Set data length, used internally in the strcut */ - n775_sentData.dataLength = 4u; - - /** - * Set CRC part or WRITE message - */ - n775_sentData.crc = n775_CalcCrc(&n775_sentData); - - /* Copy strcut data to SPI buffer */ - N775_CopyStructToTxBuffer(&n775_sentData, n775_TXbuffer); - - /* Send WRITE command to daisy-chain */ - N775_SendData(n775_TXbuffer, n775_RXbuffer, N775_TX_MESSAGE_LENGTH); -} - -/** - * @brief sends a write command to the daisy-chain. - * - * @param daisyChainAddress parameter CADD in the message format - * @param deviceAddress parameter DADD in the message format lies - * between 1 and 62, 63 means all devices - * @param registerAddress address of register to be written to - * @param data data to be written in the device register - */ -static void N775_Write(uint16_t daisyChainAddress, uint16_t deviceAddress, uint16_t registerAddress, uint16_t data) { - uint16_t messageCounter = 0u; - - /** - * Set Head part or WRITE message - */ - /* Set command field of WRITE message */ - n775_sentData.head = ((N775_CMD_WRITE & 0x3u) << 14u) | ((n775_sentData.head) & 0x3FFFu); - /* Set MADD field of WRITE message */ - n775_sentData.head = ((N775_MADD_MASTER0 & 0x1u) << 13u) | ((n775_sentData.head) & 0xDFFFu); - /* Set CADD field of WRITE message */ - n775_sentData.head = ((daisyChainAddress & 0x7u) << 10u) | ((n775_sentData.head) & 0xE3FFu); - /* Set DADD field of WRITE message; device addresses start at 1 */ - n775_sentData.head = ((deviceAddress & 0x3Fu) << 4u) | ((n775_sentData.head) & 0xFC0Fu); - /* Set message counter; not used for WRITE messages, set to 0 */ - (n775_sentData.head) = (messageCounter & 0xFu) | ((n775_sentData.head) & 0xFFF0u); - - /** - * Set Data head part or WRITE message - */ - /* Set DATLEN field of WRITE message */ - /* Number of registers addressed per message: 1, which is coded by DATLEN as 0 in the frame */ - n775_sentData.dataHead = ((0u & 0x3u) << 14u) | ((n775_sentData.dataHead) & 0x3FFFu); - /* Set REGADD field of WRITE message (address of register to be addressed)) */ - n775_sentData.dataHead = (registerAddress & 0x3FFFu) | ((n775_sentData.dataHead) & 0xC000u); - - /** - * Set Data part or WRITE message - */ - /* Set data fields; only first field is used. */ - n775_sentData.data[0] = data; - /* Set other data fields to 0. */ - n775_sentData.data[1] = 0u; - n775_sentData.data[2] = 0u; - n775_sentData.data[3] = 0u; - /* Set data length, used internally in the strcut */ - n775_sentData.dataLength = 4u; - - /** - * Set CRC part or WRITE message - */ - n775_sentData.crc = n775_CalcCrc(&n775_sentData); - - /* Copy strcut data to SPI buffer */ - N775_CopyStructToTxBuffer(&n775_sentData, n775_TXbuffer); - - /* Send WRITE command to daisy-chain */ - N775_SendData(n775_TXbuffer, n775_RXbuffer, N775_TX_MESSAGE_LENGTH); -} - -/** - * @brief sends a read command to the daisy-chain. - * @param daisyChainAddress parameter CADD in the message - * format - * @param deviceAddress parameter DADD in the message - * format lies between 1 and 62 - * @param registerAddress address of first consecutive - * register to be read from - * @param totalNumberOfRequestedRegister total number of registers values - * sent by daisy-chain lies between 1 - * and 256 - */ -static void N775_Read( - uint16_t daisyChainAddress, - uint16_t deviceAddress, - uint16_t registerAddress, - uint16_t totalNumberOfRequestedRegister) { - uint16_t messageCounter = 0u; - uint16_t dataLen = 0u; - uint16_t readParameters = 0u; - - /** - * Set Head part or WRITE message - */ - /* Set command field of WRITE message */ - n775_sentData.head = ((N775_CMD_READ & 0x3u) << 14u) | ((n775_sentData.head) & 0x3FFFu); - /* Set MADD field of WRITE message */ - n775_sentData.head = ((N775_MADD_MASTER0 & 0x1u) << 13u) | ((n775_sentData.head) & 0xDFFFu); - /* Set CADD field of WRITE message */ - n775_sentData.head = ((daisyChainAddress & 0x7u) << 10u) | ((n775_sentData.head) & 0xE3FFu); - /* Set DADD field of WRITE message; device addresses start at 1 */ - n775_sentData.head = ((deviceAddress & 0x3Fu) << 4u) | ((n775_sentData.head) & 0xFC0Fu); - /* Set message counter; not used for READ messages, set to 0 */ - (n775_sentData.head) = (messageCounter & 0xFu) | ((n775_sentData.head) & 0xFFF0u); - - /** - * Set Data head part or WRITE message - */ - /* Set DATALEN field of WRITE message; number of registers addressed per mssage: 1 */ - n775_sentData.dataHead = ((dataLen & 0x3u) << 14u) | ((n775_sentData.dataHead) & 0x3FFFu); - /* Set REGADD field of WRITE message (address of register t be addressed)) */ - n775_sentData.dataHead = (registerAddress & 0x3FFFu) | ((n775_sentData.dataHead) & 0xC000u); - - /** - * Set Data part or WRITE message - */ - readParameters = (0u << 11u) + /* First five bits must be written with 0 */ - (0u << 10u) + /* PAD = 0: no padding */ - (0u << 8u) + /* RESPLEN = 0: oneregister per frame */ - ((totalNumberOfRequestedRegister - 1u) << 0); /* NUMREG: number of consecutive registers to read */ - /* 0 means 1 register, therefore 1u is subtracted */ - /* Set data field; only first of the 4 fields is used */ - n775_sentData.data[0] = readParameters; - /* Set other data fields to 0. */ - n775_sentData.data[1] = 0u; - n775_sentData.data[2] = 0u; - n775_sentData.data[3] = 0u; - /* Set data length, used internally in the struct */ - n775_sentData.dataLength = 4u; - - /** - * Set CRC part or WRITE message - */ - n775_sentData.crc = n775_CalcCrc(&n775_sentData); - - /* Copy strcut data to SPI buffer */ - N775_CopyStructToTxBuffer(&n775_sentData, n775_TXbuffer); - - n775_state.totalMessages = totalNumberOfRequestedRegister; - n775_state.remainingMessages = totalNumberOfRequestedRegister; - - /* Send WRITE command to daisy-chain */ - N775_SendData(n775_TXbuffer, n775_RXbuffer, N775_TX_MESSAGE_LENGTH); -} - -/*========== Externalized Static Function Implementations (Unit Test) =======*/ diff --git a/src/app/driver/afe/nxp/common/config/n775_cfg.c b/src/app/driver/afe/nxp/mc33775a/api/nxp_mc33775a_afe.c similarity index 59% rename from src/app/driver/afe/nxp/common/config/n775_cfg.c rename to src/app/driver/afe/nxp/mc33775a/api/nxp_mc33775a_afe.c index a7c30699..b20d907f 100644 --- a/src/app/driver/afe/nxp/common/config/n775_cfg.c +++ b/src/app/driver/afe/nxp/mc33775a/api/nxp_mc33775a_afe.c @@ -40,11 +40,11 @@ */ /** - * @file n775_cfg.c + * @file nxp_mc33775a_afe.c * @author foxBMS Team * @date 2020-05-08 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS_CONFIGURATION * @prefix N775 * @@ -53,45 +53,87 @@ */ /*========== Includes =======================================================*/ -#include "n775_cfg.h" +#include "general.h" +/* clang-format off */ +#include "nxp_afe.h" +/* clang-format on */ +#include "afe_dma.h" +#include "dma.h" +#include "nxp_mc33775a.h" +#include "pex.h" /*========== Macros and Definitions =========================================*/ /*========== Static Constant and Variable Definitions =======================*/ /*========== Extern Constant and Variable Definitions =======================*/ -const uint8_t n775_voltage_input_used[BS_MAX_SUPPORTED_CELLS] = { -#if BS_MAX_SUPPORTED_CELLS == 12 || BS_MAX_SUPPORTED_CELLS == 15 || BS_MAX_SUPPORTED_CELLS == 18 || \ - BS_MAX_SUPPORTED_CELLS == 36 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -#endif -#if BS_MAX_SUPPORTED_CELLS == 15 || BS_MAX_SUPPORTED_CELLS == 18 || BS_MAX_SUPPORTED_CELLS == 36 - 1, 1, 1, -#endif -#if BS_MAX_SUPPORTED_CELLS == 18 || BS_MAX_SUPPORTED_CELLS == 36 - 1, 1, 1, -#endif -#if BS_MAX_SUPPORTED_CELLS == 36 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - -#endif -}; /*========== Static Function Prototypes =====================================*/ /*========== Static Function Implementations ================================*/ /*========== Extern Function Implementations ================================*/ -float N775_Convert_MuxVoltages_to_Temperatures(float v_adc_V) { - float temperature = 0.0; +extern STD_RETURN_TYPE_e NXP_Measure(void) { + N775_Meas(&n775_stateBase); + return STD_OK; +} + +extern STD_RETURN_TYPE_e NXP_Initialize(void) { + PEX_SetPinDirectionOutput(PEX_PORT_EXPANDER3, PEX_PIN10); + PEX_SetPin(PEX_PORT_EXPANDER3, PEX_PIN10); + /* Leave time for the PEX to be triggered in the 10ms task */ + uint32_t current_time = OS_GetTickCount(); + OS_DelayTaskUntil(¤t_time, 10u); + return STD_OK; +} + +extern STD_RETURN_TYPE_e NXP_StartMeasurement(void) { + STD_RETURN_TYPE_e retval = STD_NOT_OK; + + /* if (N775_SetStateRequest(N775_STATE_INITIALIZATION_REQUEST) == N775_OK) { + retval = STD_OK; + } */ - /* Example: 5th grade polynomial for EPCOS B57861S0103F045 NTC-Thermistor, 10 kOhm, Series B57861S, Vref = 3V, R in series 10k */ - /* temperature = TS_Epc01GetTemperatureFromPolynomial(v_adc_V*1000); */ + return retval; +} + +extern bool NXP_IsFirstMeasurementCycleFinished(void) { + return N775_IsFirstMeasurementCycleFinished(&n775_stateBase); +} + +extern STD_RETURN_TYPE_e NXP_RequestIoWrite(uint8_t string) { + STD_RETURN_TYPE_e retval = STD_NOT_OK; + return retval; +} - /* Dummy function, must be adapted to the application */ - temperature = 10.0f * v_adc_V; +extern STD_RETURN_TYPE_e NXP_RequestIoRead(uint8_t string) { + STD_RETURN_TYPE_e retval = STD_NOT_OK; + return retval; +} + +extern STD_RETURN_TYPE_e NXP_RequestTemperatureRead(uint8_t string) { + STD_RETURN_TYPE_e retval = STD_NOT_OK; + return retval; +} + +extern STD_RETURN_TYPE_e NXP_RequestBalancingFeedbackRead(uint8_t string) { + STD_RETURN_TYPE_e retval = STD_NOT_OK; + return retval; +} + +extern STD_RETURN_TYPE_e NXP_RequestEepromRead(uint8_t string) { + STD_RETURN_TYPE_e retval = STD_NOT_OK; + return retval; +} + +extern STD_RETURN_TYPE_e NXP_RequestEepromWrite(uint8_t string) { + STD_RETURN_TYPE_e retVal = STD_NOT_OK; + return retVal; +} - return temperature; +extern STD_RETURN_TYPE_e NXP_RequestOpenWireCheck(uint8_t string) { + STD_RETURN_TYPE_e retVal = STD_NOT_OK; + return retVal; } /*========== Externalized Static Function Implementations (Unit Test) =======*/ diff --git a/src/app/driver/afe/nxp/common/config/nxp_afe_dma_cfg.c b/src/app/driver/afe/nxp/mc33775a/config/nxp_afe_dma_cfg.c similarity index 97% rename from src/app/driver/afe/nxp/common/config/nxp_afe_dma_cfg.c rename to src/app/driver/afe/nxp/mc33775a/config/nxp_afe_dma_cfg.c index be5e36ea..3c3347b6 100644 --- a/src/app/driver/afe/nxp/common/config/nxp_afe_dma_cfg.c +++ b/src/app/driver/afe/nxp/mc33775a/config/nxp_afe_dma_cfg.c @@ -43,21 +43,19 @@ * @file nxp_afe_dma_cfg.c * @author foxBMS Team * @date 2020-03-05 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS_CONFIGURATION * @prefix DMA * * @brief Configuration for the DMA module * - * - * */ /*========== Includes =======================================================*/ #include "nxp_afe_dma_cfg.h" -#include "n775.h" +#include "nxp_mc33775a.h" /*========== Macros and Definitions =========================================*/ diff --git a/src/app/driver/afe/nxp/common/config/nxp_afe_dma_cfg.h b/src/app/driver/afe/nxp/mc33775a/config/nxp_afe_dma_cfg.h similarity index 97% rename from src/app/driver/afe/nxp/common/config/nxp_afe_dma_cfg.h rename to src/app/driver/afe/nxp/mc33775a/config/nxp_afe_dma_cfg.h index 8f6893a4..aa38049d 100644 --- a/src/app/driver/afe/nxp/common/config/nxp_afe_dma_cfg.h +++ b/src/app/driver/afe/nxp/mc33775a/config/nxp_afe_dma_cfg.h @@ -43,8 +43,8 @@ * @file nxp_afe_dma_cfg.h * @author foxBMS Team * @date 2020-03-05 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix DMA * diff --git a/src/app/driver/afe/nxp/mc33775a/config/nxp_mc33775a_cfg.c b/src/app/driver/afe/nxp/mc33775a/config/nxp_mc33775a_cfg.c new file mode 100644 index 00000000..234a7cba --- /dev/null +++ b/src/app/driver/afe/nxp/mc33775a/config/nxp_mc33775a_cfg.c @@ -0,0 +1,190 @@ +/** + * + * @copyright © 2010 - 2022, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. + * All rights reserved. + * + * 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®″ + * + */ + +/** + * @file nxp_mc33775a_cfg.c + * @author foxBMS Team + * @date 2020-05-08 (date of creation) + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 + * @ingroup DRIVERS_CONFIGURATION + * @prefix N775 + * + * @brief Configuration for the MC33775A monitoring chip + * + */ + +/*========== Includes =======================================================*/ +#include "nxp_mc33775a_cfg.h" + +#include "tsi.h" + +/*========== Macros and Definitions =========================================*/ + +/*========== Static Constant and Variable Definitions =======================*/ + +/*========== Extern Constant and Variable Definitions =======================*/ + +/** + * Default multiplexer measurement sequence + * Must be adapted to the application + */ +N775_MUX_CH_CFG_s n775_muxSequence[N775_MUX_SEQUENCE_LENGTH] = { + /* multiplexer 0 measurement */ + { + .muxId = 0, + .muxChannel = 0, + }, + { + .muxId = 0, + .muxChannel = 1, + }, + { + .muxId = 0, + .muxChannel = 2, + }, + { + .muxId = 0, + .muxChannel = 3, + }, + { + .muxId = 0, + .muxChannel = 4, + }, + { + .muxId = 0, + .muxChannel = 5, + }, + { + .muxId = 0, + .muxChannel = 6, + }, + { + .muxId = 0, + .muxChannel = 7, + }, + /* , + multiplexer 2 and 3 measurement + { + .muxId = 0, + .muxChannel = 0xFF, disable enabled mux + }, + { + .muxId = 1, + .muxChannel = 0, + }, + { + .muxId = 1, + .muxChannel = 1, + }, + { + .muxId = 1, + .muxChannel = 2, + }, + { + .muxId = 1, + .muxChannel = 3, + }, + { + .muxId = 1, + .muxChannel = 4, + }, + { + .muxId = 1, + .muxChannel = 5, + }, + { + .muxId = 1, + .muxChannel = 6, + }, + { + .muxId = 1, + .muxChannel = 7, + }, + { + .muxId = 1, + .muxChannel = 0xFF, disable enabled mux + }, + + { + .muxId = 2, + .muxChannel = 0, + }, + { + .muxId = 2, + .muxChannel = 1, + }, + { + .muxId = 2, + .muxChannel = 2, + }, + { + .muxId = 2, + .muxChannel = 3, + }, + { + .muxId = 2, + .muxChannel = 4, + }, + { + .muxId = 2, + .muxChannel = 5, + }, + { + .muxId = 2, + .muxChannel = 6, + }, + { + .muxId = 2, + .muxChannel = 7, + }*/ +}; + +/*========== Static Function Prototypes =====================================*/ + +/*========== Static Function Implementations ================================*/ + +/*========== Extern Function Implementations ================================*/ +int16_t N775_ConvertVoltagesToTemperatures(uint16_t adcVoltage_mV) { + return TSI_GetTemperature(adcVoltage_mV); /* Convert degree celsius to deci degree celsius */ +} + +/*========== Externalized Static Function Implementations (Unit Test) =======*/ diff --git a/src/app/driver/afe/nxp/common/config/n775_cfg.h b/src/app/driver/afe/nxp/mc33775a/config/nxp_mc33775a_cfg.h similarity index 68% rename from src/app/driver/afe/nxp/common/config/n775_cfg.h rename to src/app/driver/afe/nxp/mc33775a/config/nxp_mc33775a_cfg.h index 94b3b29d..375f9687 100644 --- a/src/app/driver/afe/nxp/common/config/n775_cfg.h +++ b/src/app/driver/afe/nxp/mc33775a/config/nxp_mc33775a_cfg.h @@ -40,11 +40,11 @@ */ /** - * @file n775_cfg.h + * @file nxp_mc33775a_cfg.h * @author foxBMS Team * @date 2020-05-08 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS_CONFIGURATION * @prefix N775 * @@ -52,18 +52,61 @@ * */ -#ifndef FOXBMS__N775_CFG_H_ -#define FOXBMS__N775_CFG_H_ +#ifndef FOXBMS__NXP_MC33775A_CFG_H_ +#define FOXBMS__NXP_MC33775A_CFG_H_ /*========== Includes =======================================================*/ #include "battery_system_cfg.h" -#include "n775_defs.h" #include "nxp_afe_dma.h" +#include "nxp_mc33775a_defs.h" #include "spi.h" /*========== Macros and Definitions =========================================*/ +/** Number of bytes to be sent over I2C to write and read I2C mux register in order to choose channel */ +#define N775_I2C_NR_BYTES_FOR_MUX_WRITE (4u) + +/** Number of bytes in I2C transaction after which the I2C bus should change to read*/ +#define N775_I2C_NR_BYTES_TO_SWITCH_TO_READ_FOR_UX_READ (2u) + +/** + * If false, driver runs blocking for SPI transactions + * If true, driver blocks task and waits for notification for SPI transaction + */ +#define N775_USE_NOTIFICATIONS (true) + +/** + * Index used for FreeRTOS notification sent when TX DMA interrupt comes + */ +#define N775_NOTIFICATION_TX_INDEX (1u) +/** + * Index used for FreeRTOS notification sent when RX DMA interrupt comes + */ +#define N775_NOTIFICATION_RX_INDEX (2u) +/** + * Default notification value, signals that no notification was received + */ +#define N775_NO_NOTIFIED_VALUE (0x0u) +/** + * Notification value sent when TX DMA interrupt comes + */ +#define N775_TX_NOTIFIED_VALUE (0x50u) +/** + * Notification value sent when RX DMA interrupt comes + */ +#define N775_RX_NOTIFIED_VALUE (0x60u) +/** + * Time in ms to wait for DMA TX notification, after this delay the transaction + * is considered to have failed + */ +#define N775_NOTIFICATION_TX_TIMEOUT_ms (1u) +/** + * Time in ms to wait for DMA RX notification, after this delay the transaction + * is considered to have failed + */ +#define N775_NOTIFICATION_RX_TIMEOUT_ms (2u) + /** * Number of used N775-ICs */ @@ -95,17 +138,6 @@ */ #define N775_TRANSMISSION_TIMEOUT (10u) -/** - * SPI1 is used for communication with N775 - * @{ - */ -#define N775_SPI_HANDLE &spi_devices[0] - -#define N775_SPI_INSTANCE *N775_SPI_HANDLE.Instance - -#define N775_SPI_PRESCALER *N775_SPI_HANDLE.Init.BaudRatePrescaler -/**@}*/ - /** * N775 statemachine short time definition in ms */ @@ -159,25 +191,24 @@ /*========== Extern Constant and Variable Declarations ======================*/ /** - * Lookup table to indicate which voltage inpus are used + * Multiplexer measurement sequence */ -extern const uint8_t n775_voltage_input_used[BS_MAX_SUPPORTED_CELLS]; +extern N775_MUX_CH_CFG_s n775_muxSequence[N775_MUX_SEQUENCE_LENGTH]; /*========== Extern Function Prototypes =====================================*/ /** - * @brief converts a raw voltage from multiplexer to a temperature value in Celsius. - * - * The temperatures are read from NTC elements via voltage dividers. - * This function implements the look-up table between voltage and temperature, - * taking into account the NTC characteristics and the voltage divider. - * - * @param v_adc_V voltage read from the multiplexer in V - * - * @return temperature temperature value in deci °C + * @brief converts a raw voltage from multiplexer to a temperature value in + * deci °C. + * @details The temperatures are read from NTC elements via voltage dividers. + * This function implements the look-up table between voltage and + * temperature, taking into account the NTC characteristics and the + * voltage divider. + * @param adcVoltage_mV voltage read from the multiplexer in mV + * @return temperature value in deci °C */ -extern float N775_Convert_MuxVoltages_to_Temperatures(float v_adc_V); +extern int16_t N775_ConvertVoltagesToTemperatures(uint16_t adcVoltage_mV); /*========== Externalized Static Functions Prototypes (Unit Test) ===========*/ -#endif /* FOXBMS__N775_CFG_H_ */ +#endif /* FOXBMS__NXP_MC33775A_CFG_H_ */ diff --git a/src/app/driver/afe/nxp/common/nxp_afe_dma.c b/src/app/driver/afe/nxp/mc33775a/nxp_afe_dma.c similarity index 70% rename from src/app/driver/afe/nxp/common/nxp_afe_dma.c rename to src/app/driver/afe/nxp/mc33775a/nxp_afe_dma.c index 0986653e..38e195f2 100644 --- a/src/app/driver/afe/nxp/common/nxp_afe_dma.c +++ b/src/app/driver/afe/nxp/mc33775a/nxp_afe_dma.c @@ -43,8 +43,8 @@ * @file nxp_afe_dma.c * @author foxBMS Team * @date 2020-05-27 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix AFE * @@ -56,8 +56,10 @@ #include "nxp_afe_dma.h" #include "dma.h" +#include "ftask.h" #include "io.h" -#include "n775.h" +#include "nxp_mc33775a.h" +#include "spi.h" /*========== Macros and Definitions =========================================*/ @@ -71,28 +73,42 @@ /*========== Extern Function Implementations ================================*/ -bool AFE_IsTxTransmitOngoing(void) { - bool retval = false; - retval = n775_state.txTransmitOngoing; - return retval; -} - -bool AFE_IsRxTransmitOngoing(void) { - bool retval = false; - retval = n775_state.rxTransmitOngoing; - return retval; -} - -void AFE_SetTxTransmitOngoing(void) { - n775_state.txTransmitOngoing = false; -} - -void AFE_SetRxTransmitOngoing(void) { - n775_state.rxTransmitOngoing = false; -} - /* Function called on DMA complete interrupts (TX and RX). */ void AFE_DmaCallback(uint8_t spiIndex) { + if ((spiIndex == 0u)) { + /* SPI 1 = Master SPI */ + spi_txFinished = true; +#if (N775_USE_NOTIFICATIONS == true) + BaseType_t xHigherPriorityTaskWoken = pdFALSE; + xTaskNotifyIndexedFromISR( + ftsk_taskHandleAfe, + N775_NOTIFICATION_TX_INDEX, + N775_TX_NOTIFIED_VALUE, + eSetValueWithOverwrite, + &xHigherPriorityTaskWoken); + portYIELD_FROM_ISR(xHigherPriorityTaskWoken); +#endif + } else if ((spiIndex == 3u)) { + /* SPI 4 = Slave SPI */ + dma_spiInterfaces[spiIndex]->GCR1 &= ~SPIEN_BIT; + /* Set slave SPI pins as GIO to deactivate them */ + dma_spiInterfaces[spiIndex]->PC0 &= 0xFFFFFF00; + spi_rxFinished = true; +#if (N775_USE_NOTIFICATIONS == true) + BaseType_t xHigherPriorityTaskWoken = pdFALSE; + xTaskNotifyIndexedFromISR( + ftsk_taskHandleAfe, + N775_NOTIFICATION_RX_INDEX, + N775_RX_NOTIFIED_VALUE, + eSetValueWithOverwrite, + &xHigherPriorityTaskWoken); + portYIELD_FROM_ISR(xHigherPriorityTaskWoken); +#endif + } else { + FAS_ASSERT(FAS_TRAP); + } + + return; } /*========== Externalized Static Function Implementations (Unit Test) =======*/ diff --git a/src/app/driver/afe/nxp/common/nxp_afe_dma.h b/src/app/driver/afe/nxp/mc33775a/nxp_afe_dma.h similarity index 98% rename from src/app/driver/afe/nxp/common/nxp_afe_dma.h rename to src/app/driver/afe/nxp/mc33775a/nxp_afe_dma.h index 77952cff..2654dd34 100644 --- a/src/app/driver/afe/nxp/common/nxp_afe_dma.h +++ b/src/app/driver/afe/nxp/mc33775a/nxp_afe_dma.h @@ -43,8 +43,8 @@ * @file nxp_afe_dma.h * @author foxBMS Team * @date 2020-05-27 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix AFE * diff --git a/src/app/driver/afe/nxp/mc33775a/nxp_mc33775a-ll.c b/src/app/driver/afe/nxp/mc33775a/nxp_mc33775a-ll.c new file mode 100644 index 00000000..c5d8bb3f --- /dev/null +++ b/src/app/driver/afe/nxp/mc33775a/nxp_mc33775a-ll.c @@ -0,0 +1,551 @@ +/* Copyright 2019 NXP +* +* Redistribution and use in source and binary forms, with or without modification, are permitted +* provided that the following terms 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. +*/ + +/*========== Includes =======================================================*/ +#include "general.h" + +#include "nxp_mc33775a-ll.h" + +#include "dma.h" +#include "io.h" +#include "mcu.h" +#include "os.h" +#include "spi.h" + +/*========== Macros and Definitions =========================================*/ + +/** Number of words (16 bits) used for write messages */ +#define N775_WRITE_SPI_BUFFER_SIZE (4u) +/** Number of words (16 bits) in read answers that do not contain data */ +#define N775_READ_HEADER_SPI_BUFFER_SIZE (3u) +/** + * Number of words (16 bits) in read answers that contain data. + * Based on maximum payload, which is 4 register per answer frame. + */ +#define N775_READ_PAYLOAD_SPI_BUFFER_SIZE (4u) +/** + * Maximum number of groups of registers that can be read, + * to limit buffer size. + * Groups can be of size 1 to 4 registers. + * One frame = header (e.g., register address) + + * payload (data, 1 to 4 registers) + */ +#define N775_MAX_ANSWER_FRAMES (30u) +/** Time to wait in microseconds after a write command */ +#define N775_WAIT_TIME_AFTER_WRITE_US (5u) +/** Time to wait in microseconds after a read command */ +#define N775_WAIT_TIME_AFTER_READ_US (5u) +/** Timeout to wait in microseconds for SPI send interrupt. */ +#define N775_SPI_WRITE_TIMEOUT_US (500u) +/** + * Timeout to wait in microseconds for reception of a read answer. + * After that time the communication is considered to have failed. + */ +#define N775_SPI_READ_TIMEOUT_US (2000u) + +/*========== Static Constant and Variable Definitions =======================*/ +static uint16_t referenceMessageCounter[BS_NR_OF_STRINGS][512]; /* fits for all possible nodes */ + +#pragma SET_DATA_SECTION(".sharedRAM") +static uint16_t n775ToTplTxBuffer[N775_WRITE_SPI_BUFFER_SIZE] = {0u}; +static uint16_t n775ToTplRxBuffer[N775_WRITE_SPI_BUFFER_SIZE] = {0u}; +static uint16_t n775FromTplTxBuffer + [N775_WRITE_SPI_BUFFER_SIZE + + ((N775_READ_HEADER_SPI_BUFFER_SIZE + N775_READ_PAYLOAD_SPI_BUFFER_SIZE) * N775_MAX_ANSWER_FRAMES)] = {0u}; +static uint16_t n775FromTplRxBuffer + [N775_WRITE_SPI_BUFFER_SIZE + + ((N775_READ_HEADER_SPI_BUFFER_SIZE + N775_READ_PAYLOAD_SPI_BUFFER_SIZE) * N775_MAX_ANSWER_FRAMES)] = {0u}; +#pragma SET_DATA_SECTION() + +/*========== Extern Constant and Variable Definitions =======================*/ + +/*========== Static Function Prototypes =====================================*/ +/** + * @brief Copies a message to the buffer to be passed to the SPI transmit + * functions + * @param pBuffer + * @param message + */ +static void N775_ConvertMessageToBuffer(uint16_t *pBuffer, uc_msg_t message); + +#if (N775_USE_NOTIFICATIONS == false) +/** + * @brief Wait for the SPI transmit communication to complete, blocking + * + * return 0 if transaction completed interrupt did not come, + * non zero value otherwise + */ +static uint16_t N775_WaitForTxCompleted(void); + +/** + * @brief Wait for the SPI receive communication to complete, blocking + * + * return 0 if transaction completed interrupt did not come, + * non zero value otherwise + */ +static uint16_t N775_WaitForRxCompleted(void); +#else +/** + * @brief Clear pending notifications + * + * Used to clear pending Tx notifications made by the read function + * when writing to registers: when reading, commands are sent on SPI1. + * In the SPI1 ISR, a notification is made, but it is not used: the system + * waits for the SPI Rx notification from SPI4. As a consequence, when the + * write function is called after the read function, there is already a + * notification pending. The function waiting for the notification in the + * ISR of SPI1 exits immediately instead of waiting for the end of the + * transmission. + */ +void N775_ClearNotifications(void); + +/** + * @brief Wait for the SPI transmit communication to complete, using notifications + * + * return N775_TX_NOTIFIED_VALUE if notification received, + * N775_NO_NOTIFIED_VALUE if timeout reached + */ +static uint32_t N775_WaitForTxCompletedNotification(void); + +/** + * @brief Wait for the SPI receive communication to complete, using notifications + * + * return N775_RX_NOTIFIED_VALUE if notification received, + * N775_NO_NOTIFIED_VALUE if timeout reached + */ +static uint32_t N775_WaitForRxCompletedNotification(void); +#endif + +/*========== Static Function Implementations ================================*/ + +static void N775_ConvertMessageToBuffer(uint16_t *pBuffer, uc_msg_t message) { + FAS_ASSERT(pBuffer != NULL_PTR); + pBuffer[0u] = message.head; + pBuffer[1u] = message.data.dhead; + pBuffer[2u] = message.data.data[0u]; + pBuffer[3u] = message.crc; +} + +#if (N775_USE_NOTIFICATIONS == false) +static uint16_t N775_WaitForTxCompleted(void) { + uint16_t timeoutTx = N775_SPI_WRITE_TIMEOUT_US; + while (false == spi_txFinished) { + MCU_delay_us(1); + timeoutTx--; + if (timeoutTx == 0u) { + break; + } + } + MCU_delay_us(N775_WAIT_TIME_AFTER_WRITE_US); + return timeoutTx; +} + +static uint16_t N775_WaitForRxCompleted(void) { + uint16_t timeoutRx = N775_SPI_READ_TIMEOUT_US; + while (spi_rxFinished == false) { + MCU_delay_us(1u); + timeoutRx--; + if (timeoutRx == 0u) { + break; + } + } + MCU_delay_us(N775_WAIT_TIME_AFTER_READ_US); + return timeoutRx; +} +#else +void N775_ClearNotifications(void) { + xTaskNotifyStateClearIndexed(NULL, N775_NOTIFICATION_TX_INDEX); +} + +static uint32_t N775_WaitForTxCompletedNotification(void) { + uint32_t notifiedValueTx = N775_NO_NOTIFIED_VALUE; + /** + * Suspend task and wait for SPI send DMA RX finished notification, + * clear notification value on entry and exit + */ + xTaskNotifyWaitIndexed( + N775_NOTIFICATION_TX_INDEX, UINT32_MAX, UINT32_MAX, ¬ifiedValueTx, N775_NOTIFICATION_TX_TIMEOUT_ms); + return notifiedValueTx; +} + +static uint32_t N775_WaitForRxCompletedNotification(void) { + uint32_t notifiedValueRx = N775_NO_NOTIFIED_VALUE; + /** + * Suspend task and wait for DMA RX notification, + * clear notification value on entry and exit + */ + xTaskNotifyWaitIndexed( + N775_NOTIFICATION_RX_INDEX, UINT32_MAX, UINT32_MAX, ¬ifiedValueRx, N775_NOTIFICATION_RX_TIMEOUT_ms); + return notifiedValueRx; +} +#endif + +/*========== Extern Function Implementations ================================*/ + +extern void N775_CommunicationWrite( + uint16_t deviceAddress, + uint16_t registerAddress, + uint16_t value, + SPI_INTERFACE_CONFIG_s *pSpiInterface) { + FAS_ASSERT(pSpiInterface != NULL_PTR); + uc_msg_t message = {0}; /* Message for read command */ + + /** The function gets the device address + * The N775_CommunicationComposeMessage function adds the chain address. + * Chain address = 1 used so (deviceAddress | (1u << 6u)) is used + */ + N775_CommunicationComposeMessage( + BMS1_CMD_WRITE, 0, (deviceAddress | (1u << 6u)), registerAddress, 0, &value, &message); + N775_ConvertMessageToBuffer(n775ToTplTxBuffer, message); + + spi_txFinished = false; +#if (N775_USE_NOTIFICATIONS == true) + N775_ClearNotifications(); +#endif + SPI_TransmitReceiveDataDma(pSpiInterface, n775ToTplTxBuffer, n775ToTplRxBuffer, 4u); +#if (N775_USE_NOTIFICATIONS == false) + (void)N775_WaitForTxCompleted(); +#else + uint32_t notificationTx = N775_WaitForTxCompletedNotification(); + if (notificationTx != N775_TX_NOTIFIED_VALUE) { + /* Tx DMA interrupt has not come, release Tx SPI interface */ + const uint8_t spiIndex = SPI_GetSpiIndex(spiREG1); + OS_EnterTaskCritical(); + spi_busyFlags[spiIndex] = SPI_IDLE; + OS_ExitTaskCritical(); + } +#endif +} + +extern N775_COMMUNICATION_STATUS_e N775_CommunicationRead( + uint16_t deviceAddress, + uint16_t registerAddress, + uint16_t *pValue, + N775_STATE_s *n775_state) { + FAS_ASSERT(pValue != NULL_PTR); + FAS_ASSERT(n775_state != NULL_PTR); + FAS_ASSERT(n775_state->pSpiTxSequence != NULL_PTR); + FAS_ASSERT(n775_state->pSpiRxSequence != NULL_PTR); + return N775_CommunicationReadMultiple(deviceAddress, 1, 1, registerAddress, pValue, n775_state); +} + +extern N775_COMMUNICATION_STATUS_e N775_CommunicationReadMultiple( + uint16_t deviceAddress, + uint16_t numberOfItems, + uint16_t responseLength, + uint16_t registerAddress, + uint16_t *pValues, + N775_STATE_s *n775_state) { + FAS_ASSERT(pValues != NULL_PTR); + FAS_ASSERT(n775_state != NULL_PTR); + FAS_ASSERT(n775_state->pSpiTxSequence != NULL_PTR); + FAS_ASSERT(n775_state->pSpiRxSequence != NULL_PTR); + + /* Number of registers to read */ + uint16_t itemsReadRemaining = numberOfItems; + uint16_t *pReadValues = pValues; + + /** + * numberOfItems = 0 --> corresponds to one frame + * (max_frames - 1): because first frame is for the mirroring of Tx + * So (numberOfItems - 1u) is used in the following + */ + + /** The function gets the device address + * The pack_msg function adds the chain address. + * Chain address = 1 used so (deviceAddress | (1u << 6u)) is used in the following + * */ + /* responseLength = 0 means one data word per answer frame so (responseLength - 1u) is used in the following */ + + uc_msg_t txMessage = {0u}; /* Message for read command */ + uc_msg_t rxMessage = {0u}; /* Message for response */ + + N775_COMMUNICATION_STATUS_e communicationStatus; /* Reception return code */ + uint16_t read_parameter; /* Read parameter (padding_en, responseLength, num_regs) */ + + uint16_t rsp_cmd; /* Response parts */ + uint16_t rsp_mst_addr; + uint16_t rsp_dev_addr; + uint16_t rsp_reg_addr; + uint16_t rsp_length; + uint16_t rsp_values[4]; + + read_parameter = ((uint16_t)1u << 10u) + /* Use padding */ + ((responseLength - 1u) << 8u) + /* responseLength */ + ((numberOfItems - 1u) << 0u); /* (numberOfItems-1u) register to read */ + + N775_CommunicationComposeMessage( + BMS1_CMD_READ, 0, (deviceAddress | (1u << 6u)), registerAddress, 0, &read_parameter, &txMessage); + N775_ConvertMessageToBuffer(n775ToTplTxBuffer, txMessage); + + /** + * After transmission to daisy-chain, daisy-chain will normally answer + * Already prepare SPI slave for reception + */ + + /** + * Compute the number of answer frames needed by the MC33775A. + * Padding is used: always same number of registers in each answer frame + * (1,2,3 or 4 registers). + */ + uint16_t nrAnswerFrames = (((numberOfItems - 1u) + 1u) / ((responseLength - 1u) + 1u)); + /** + * Additional answer frame if number of registers to read and + * number of registers per answer frame are not multiples + * Example: 22 registers to read, 4 registers per answer frame. + * Answer: (5*4 register) + (2 registers + 2 words padded with 0) + */ + if ((((numberOfItems - 1u) + 1u) % ((responseLength - 1u) + 1u)) != 0u) { + nrAnswerFrames++; + } + /** + * N775_WRITE_SPI_BUFFER_SIZE (4u): because of Tx mirroring, the command is received, too + * N775_READ_HEADER_SPI_BUFFER_SIZE + (responseLength - 1u) + 1u: size of one answer frame + * (responseLength - 1u) 0 --> 1 register --> (responseLength - 1u) +1u = 1 + * (responseLength - 1u) 1 --> 2 registers --> (responseLength - 1u) +1u = 2 + * (responseLength - 1u) 2 --> 3 registers --> (responseLength - 1u) +1u = 3 + * (responseLength - 1u) 3 --> 4 registers --> (responseLength - 1u) +1u = 4 + * */ + uint16_t rxBufferLength = N775_WRITE_SPI_BUFFER_SIZE + + ((N775_READ_HEADER_SPI_BUFFER_SIZE + (responseLength - 1u) + 1u) * nrAnswerFrames); + FAS_ASSERT( + rxBufferLength <= + (N775_WRITE_SPI_BUFFER_SIZE + + ((N775_READ_HEADER_SPI_BUFFER_SIZE + N775_READ_PAYLOAD_SPI_BUFFER_SIZE) * N775_MAX_ANSWER_FRAMES))); + SPI_SlaveSetReceiveDataDma(n775_state->pSpiRxSequence, n775FromTplTxBuffer, n775FromTplRxBuffer, rxBufferLength); + + /* send message */ + spi_rxFinished = false; + SPI_TransmitReceiveDataDma(n775_state->pSpiTxSequence, n775ToTplTxBuffer, n775ToTplRxBuffer, 4u); + bool n775_rxCompleted = true; +#if (N775_USE_NOTIFICATIONS == false) + if (0u == N775_WaitForRxCompleted()) { + n775_rxCompleted = false; + } +#else + uint32_t notificationRx = N775_WaitForRxCompletedNotification(); + if (notificationRx != N775_RX_NOTIFIED_VALUE) { + n775_rxCompleted = false; + /* Rx has not come, release Tx SPI interface */ + const uint8_t spiIndex = SPI_GetSpiIndex(spiREG1); + OS_EnterTaskCritical(); + spi_busyFlags[spiIndex] = SPI_IDLE; + OS_ExitTaskCritical(); + } +#endif + + if (n775_rxCompleted == false) { + n775_state->pSpiRxSequence->pNode->INT0 &= ~DMAREQEN_BIT; + n775_state->pSpiRxSequence->pNode->GCR1 &= ~SPIEN_BIT; + communicationStatus = N775_COMMUNICATION_ERROR_TIMEOUT; + } else { + for (uint16_t i = 0; i < nrAnswerFrames; i++) { + /* Currently only support for 64 bit communication */ + rxMessage.message_length = 4u + (responseLength - 1u); + /* +4u: because of Tx mirroring, the command is received, too */ + + rxMessage.head = n775FromTplRxBuffer[4u + (i * (4u + (responseLength - 1u))) + 0u]; + rxMessage.data.dhead = n775FromTplRxBuffer[4u + (i * (4u + (responseLength - 1u))) + 1u]; + rxMessage.data.data[0u] = n775FromTplRxBuffer[4u + (i * (4u + (responseLength - 1u))) + 2u]; + if (rxMessage.message_length <= 4u) { + rxMessage.crc = n775FromTplRxBuffer[4u + (i * 4u) + 3u]; + } else { + if (rxMessage.message_length == 5u) { + rxMessage.data.data[1u] = n775FromTplRxBuffer[4u + (i * (4u + (responseLength - 1u))) + 3u]; + rxMessage.crc = n775FromTplRxBuffer[4u + (i * (4u + (responseLength - 1u))) + 4u]; + } else { + if (rxMessage.message_length == 6u) { + rxMessage.data.data[1u] = n775FromTplRxBuffer[4u + (i * (4u + (responseLength - 1u))) + 3u]; + rxMessage.data.data[2u] = n775FromTplRxBuffer[4u + (i * (4u + (responseLength - 1u))) + 4u]; + rxMessage.crc = n775FromTplRxBuffer[4u + (i * (4u + (responseLength - 1u))) + 5u]; + } else { + rxMessage.data.data[1u] = n775FromTplRxBuffer[4u + (i * (4u + (responseLength - 1u))) + 3u]; + rxMessage.data.data[2u] = n775FromTplRxBuffer[4u + (i * (4u + (responseLength - 1u))) + 4u]; + rxMessage.data.data[3u] = n775FromTplRxBuffer[4u + (i * (4u + (responseLength - 1u))) + 5u]; + rxMessage.crc = n775FromTplRxBuffer[4u + (i * (4u + (responseLength - 1u))) + 6u]; + } + } + } + + communicationStatus = N775_CommunicationDecomposeMessage( + &rxMessage, + &rsp_cmd, + &rsp_mst_addr, + &rsp_dev_addr, + &rsp_reg_addr, + &rsp_length, + rsp_values, + n775_state->currentString); + + if (communicationStatus == N775_COMMUNICATION_OK) { + /* SM.e.30 : Communication - Unique ID */ + if (rsp_dev_addr == (deviceAddress | (1u << 6u))) { + if (rsp_reg_addr == (registerAddress + (i * ((responseLength - 1u) + 1u)))) { + for (uint16_t j = 0u; j < (rsp_length + 1u); j++) { + /* To take padded answer frames into account + * Stop before reaching the words padded with 0s + */ + if (itemsReadRemaining > 0u) { + *pReadValues = rsp_values[j]; + pReadValues++; + itemsReadRemaining--; + } else { + break; + } + } + } else { + communicationStatus = N775_COMMUNICATION_ERROR_NOT_MATCHING_REGISTER_ADDRESS; + } + } else { + communicationStatus = N775_COMMUNICATION_ERROR_NOT_MATCHING_DEVICE_ADDRESS; + } + } + } + } + + return communicationStatus; +} + +/* Reset the message counter for one device */ +extern void N775_ResetMessageCounter(uint16_t deviceAddress, uint8_t string) { + /* Chain address = 1 used so (deviceAddress | (1u << 6u)) is used */ + referenceMessageCounter[string][deviceAddress | (1u << 6u)] = 0u; +} + +/* Low level communication functions */ +/* Pack message */ +extern void N775_CommunicationComposeMessage( + uint16_t cmd, + uint16_t masterAddress, + uint16_t deviceAddress, + uint16_t registerAddress, + uint16_t length, + uint16_t *pValue, + uc_msg_t *pMessage) { + FAS_ASSERT(pValue != NULL_PTR); + FAS_ASSERT(pMessage != NULL_PTR); + /* Create message */ + set_cmd(pMessage, cmd); + set_madd(pMessage, masterAddress); + set_cadd(pMessage, deviceAddress >> 6u); + set_devadd(pMessage, deviceAddress & 0x3Fu); + set_msgcnt(pMessage, 0); /* not used by MCU, therefore fixed 0 */ + set_datalen(pMessage, length); + set_regadd(pMessage, registerAddress); + for (uint16_t i = 0; i <= length; i++) { + set_data(pMessage, pValue[i], i); + } + set_message_length(pMessage, length + 4u); + + /* Create CRC */ + set_crc(pMessage, calc_crc(pMessage)); +} + +/* Unpack a message */ +extern N775_COMMUNICATION_STATUS_e N775_CommunicationDecomposeMessage( + uc_msg_t *pMessage, + uint16_t *pCommand, + uint16_t *pMasterAddress, + uint16_t *pDeviceAddress, + uint16_t *pRegisterAddress, + uint16_t *pLength, + uint16_t *pValue, + uint8_t string) { + FAS_ASSERT(pMessage != NULL_PTR); + FAS_ASSERT(pCommand != NULL_PTR); + FAS_ASSERT(pMasterAddress != NULL_PTR); + FAS_ASSERT(pDeviceAddress != NULL_PTR); + FAS_ASSERT(pRegisterAddress != NULL_PTR); + FAS_ASSERT(pLength != NULL_PTR); + FAS_ASSERT(pValue != NULL_PTR); + uint16_t messageLength; /* length of received message */ + uint16_t messageCount; /* message count from message */ + uint16_t chainAddress; /* chain address */ + uint16_t deviceAddressInChain; /* device address in the chain */ + + bool errorCodeMatch = false; + N775_COMMUNICATION_STATUS_e communicationStatus = N775_COMMUNICATION_OK; + + /* check if we have any content */ + /* SM.e.28 : Communication - Timeout monitoring */ + get_message_length(pMessage, &messageLength); + if (messageLength == 0u) { + errorCodeMatch = true; + communicationStatus = N775_COMMUNICATION_ERROR_TIMEOUT; + } + + if ((errorCodeMatch == false) && (messageLength < 4u)) { + errorCodeMatch = true; + communicationStatus = N775_COMMUNICATION_ERROR_SHORT_MESSAGE; + } + + /* Check CRC */ + /* SM.e.27 : Communication - Information redundancy */ + if ((errorCodeMatch == false) && (!check_crc(pMessage, calc_crc(pMessage)))) { + errorCodeMatch = true; + uint16_t receivedCrc; + get_crc(pMessage, &receivedCrc); + communicationStatus = N775_COMMUNICATION_ERROR_WRONG_CRC; + } + + /* Extract message parts */ + get_cmd(pMessage, pCommand); + get_madd(pMessage, pMasterAddress); + get_cadd(pMessage, &chainAddress); + get_devadd(pMessage, &deviceAddressInChain); + *pDeviceAddress = (chainAddress << 6u) | deviceAddressInChain; + get_msgcnt(pMessage, &messageCount); + get_datalen(pMessage, pLength); + get_regadd(pMessage, pRegisterAddress); + + /* Check message counter */ + /* SM.e.29 : Communication - Message counter */ + if ((errorCodeMatch == false) && (messageCount != referenceMessageCounter[string][*pDeviceAddress])) { + errorCodeMatch = true; + referenceMessageCounter[string][*pDeviceAddress] = (messageCount + 1u) & 0xFu; + communicationStatus = N775_COMMUNICATION_ERROR_WRONG_MESSAGE_COUNT; + } + /* Increment message counter */ + referenceMessageCounter[string][*pDeviceAddress] = (referenceMessageCounter[string][*pDeviceAddress] + 1u) & 0xFu; + + /* Check error address */ + if ((errorCodeMatch == false) && (*pRegisterAddress == N775_ERROR_REGISTER_ADDRESS)) { + communicationStatus = N775_COMMUNICATION_ERROR_NO_ACCESS; + } + + /* return data */ + if (errorCodeMatch == false) { + for (int i = 0u; i <= *pLength; i++) { + get_data(pMessage, &pValue[i], i); + } + if (*pCommand != BMS1_CMD_RESP) { /* Check for response */ + communicationStatus = N775_COMMUNICATION_ERROR_NO_RESPONSE; + } + } + + /* TODO: check for N775_COMMUNICATION_ERROR_NOT_MATCHING_DEVICE_ADDRESS */ + /* TODO: check for N775_COMMUNICATION_ERROR_NOT_MATCHING_REGISTER_ADDRESS */ + + return communicationStatus; +} + +/*========== Externalized Static Function Implementations (Unit Test) =======*/ diff --git a/src/app/driver/afe/nxp/mc33775a/nxp_mc33775a-ll.h b/src/app/driver/afe/nxp/mc33775a/nxp_mc33775a-ll.h new file mode 100644 index 00000000..cd46795f --- /dev/null +++ b/src/app/driver/afe/nxp/mc33775a/nxp_mc33775a-ll.h @@ -0,0 +1,150 @@ +/* Copyright 2019 NXP +* +* Redistribution and use in source and binary forms, with or without modification, are permitted +* provided that the following terms 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. +*/ + +#ifndef FOXBMS__NXP_MC33775A_LL_H_ +#define FOXBMS__NXP_MC33775A_LL_H_ + +/*========== Includes =======================================================*/ +#include "nxp_mc33775a_cfg.h" + +#include "spi.h" +#include "uc_msg_t.h" + +/*========== Macros and Definitions =========================================*/ + +/** defines for addresses */ +#define N775_ALL_CHAINS (0x1C0u) +#define N775_ALL_DEVICES (0x03Fu) + +/** Error register address */ +#define N775_ERROR_REGISTER_ADDRESS 0x3FFF + +typedef enum N775_COMMUNICATION_STATUS { + N775_COMMUNICATION_OK, + N775_COMMUNICATION_ERROR_SHORT_MESSAGE, + N775_COMMUNICATION_ERROR_WRONG_CRC, + N775_COMMUNICATION_ERROR_WRONG_MESSAGE_COUNT, + N775_COMMUNICATION_ERROR_TIMEOUT, + N775_COMMUNICATION_ERROR_NO_ACCESS, + N775_COMMUNICATION_ERROR_NO_RESPONSE, + N775_COMMUNICATION_ERROR_NOT_MATCHING_DEVICE_ADDRESS, + N775_COMMUNICATION_ERROR_NOT_MATCHING_REGISTER_ADDRESS, +} N775_COMMUNICATION_STATUS_e; + +/*========== Extern Constant and Variable Declarations ======================*/ + +/*========== Extern Function Prototypes =====================================*/ +/** + * @brief Write a value into a specific register in a specific device + * @param deviceAddress + * @param registerAddress + * @param value + * @param pSpiInterface + */ +void N775_CommunicationWrite( + uint16_t deviceAddress, + uint16_t registerAddress, + uint16_t value, + SPI_INTERFACE_CONFIG_s *pSpiInterface); + +/** + * @brief Read a value from a specific register in a specific device + * @param deviceAddress + * @param registerAddress + * @param pValue + * @param n775_state + * @return returns 0 on success and >=1 in error case + */ +N775_COMMUNICATION_STATUS_e N775_CommunicationRead( + uint16_t deviceAddress, + uint16_t registerAddress, + uint16_t *pValue, + N775_STATE_s *n775_state); + +/** + * @brief Read multiple values from specific registers in a specific device + * @param deviceAddress + * @param numberOfItems + * @param responseLength + * @param registerAddress + * @param pValues + * @param n775_state + * @return returns 0 on success and >=1 in error case + */ +N775_COMMUNICATION_STATUS_e N775_CommunicationReadMultiple( + uint16_t deviceAddress, + uint16_t numberOfItems, + uint16_t responseLength, + uint16_t registerAddress, + uint16_t *pValues, + N775_STATE_s *n775_state); + +/** + * @brief Reset the message counter for one or all devices + * @param deviceAddress + * @param string + */ +void N775_ResetMessageCounter(uint16_t deviceAddress, uint8_t string); + +/** + * @brief Composes a message + * @param cmd + * @param masterAddress + * @param deviceAddress + * @param registerAddress + * @param length + * @param pValue + * @param pMessage + */ +void N775_CommunicationComposeMessage( + uint16_t cmd, + uint16_t masterAddress, + uint16_t deviceAddress, + uint16_t registerAddress, + uint16_t length, + uint16_t *pValue, + uc_msg_t *pMessage); + +/** + * @brief Decomposes and analysis a message + * @param pMessage + * @param pCommand + * @param pMasterAddress + * @param pDeviceAddress + * @param pRegisterAddress + * @param pLength + * @param pValue + * @param string + */ +N775_COMMUNICATION_STATUS_e N775_CommunicationDecomposeMessage( + uc_msg_t *pMessage, + uint16_t *pCommand, + uint16_t *pMasterAddress, + uint16_t *pDeviceAddress, + uint16_t *pRegisterAddress, + uint16_t *pLength, + uint16_t *pValue, + uint8_t string); + +/*========== Externalized Static Functions Prototypes (Unit Test) ===========*/ + +#endif /* FOXBMS__NXP_MC33775A_LL_H_ */ diff --git a/src/app/driver/afe/nxp/mc33775a/nxp_mc33775a.c b/src/app/driver/afe/nxp/mc33775a/nxp_mc33775a.c new file mode 100644 index 00000000..f9a5bda4 --- /dev/null +++ b/src/app/driver/afe/nxp/mc33775a/nxp_mc33775a.c @@ -0,0 +1,910 @@ +/** + * + * @copyright © 2010 - 2022, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. + * All rights reserved. + * + * 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®″ + * + */ + +/** + * @file nxp_mc33775a.c + * @author foxBMS Team + * @date 2020-05-08 (date of creation) + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 + * @ingroup DRIVERS + * @prefix N775 + * + * @brief Driver for the MC33775A monitoring chip. + * + */ + +/*========== Includes =======================================================*/ +#include "nxp_mc33775a.h" +/* clang-format off */ +#include "nxp_mc33775a-ll.h" +/* clang-format on */ + +#include "HL_gio.h" +#include "HL_system.h" +#pragma diag_push +#pragma diag_suppress 232 +#include "MC33775A.h" +#pragma diag_pop + +#include "afe_dma.h" +#include "database.h" +#include "diag.h" +#include "io.h" +#include "mcu.h" +#include "os.h" +#include "spi.h" + +/*========== Macros and Definitions =========================================*/ + +/*========== Static Constant and Variable Definitions =======================*/ +/** local copies of database tables */ +/**@{*/ +static DATA_BLOCK_CELL_VOLTAGE_s n775_cellVoltage = {.header.uniqueId = DATA_BLOCK_ID_CELL_VOLTAGE_BASE}; +static DATA_BLOCK_CELL_TEMPERATURE_s n775_cellTemperature = {.header.uniqueId = DATA_BLOCK_ID_CELL_TEMPERATURE_BASE}; +static DATA_BLOCK_MIN_MAX_s n775_minMax = {.header.uniqueId = DATA_BLOCK_ID_MIN_MAX}; +static DATA_BLOCK_BALANCING_CONTROL_s n775_balancingControl = {.header.uniqueId = DATA_BLOCK_ID_BALANCING_CONTROL}; +static DATA_BLOCK_ALL_GPIO_VOLTAGES_s n775_allGpioVoltage = {.header.uniqueId = DATA_BLOCK_ID_ALL_GPIO_VOLTAGES_BASE}; +static DATA_BLOCK_BALANCING_FEEDBACK_s n775_balancingFeedback = { + .header.uniqueId = DATA_BLOCK_ID_BALANCING_FEEDBACK_BASE}; +static DATA_BLOCK_SLAVE_CONTROL_s n775_slaveControl = {.header.uniqueId = DATA_BLOCK_ID_SLAVE_CONTROL}; +static DATA_BLOCK_OPEN_WIRE_s n775_openwire = {.header.uniqueId = DATA_BLOCK_ID_OPEN_WIRE_BASE}; +/**@}*/ +static N775_SUPPLY_CURRENT_s n775_supplyCurrent = {0}; +static N775_ERRORTABLE_s n775_errorTable = {0}; + +/*========== Extern Constant and Variable Definitions =======================*/ + +N775_STATE_s n775_stateBase = { + .firstMeasurementMade = false, + .currentString = 0u, + .pSpiTxSequenceStart = NULL_PTR, + .pSpiTxSequence = NULL_PTR, + .pSpiRxSequenceStart = NULL_PTR, + .pSpiRxSequence = NULL_PTR, + .currentMux = {0}, + .pMuxSequenceStart = {0}, + .pMuxSequence = {0}, + .n775Data.cellVoltage = &n775_cellVoltage, + .n775Data.cellTemperature = &n775_cellTemperature, + .n775Data.allGpioVoltage = &n775_allGpioVoltage, + .n775Data.minMax = &n775_minMax, + .n775Data.balancingFeedback = &n775_balancingFeedback, + .n775Data.balancingControl = &n775_balancingControl, + .n775Data.slaveControl = &n775_slaveControl, + .n775Data.openWire = &n775_openwire, + .n775Data.supplyCurrent = &n775_supplyCurrent, + .n775Data.errorTable = &n775_errorTable, +}; + +/*========== Static Function Prototypes =====================================*/ +static void N775_SetFirstMeasurementCycleFinished(N775_STATE_s *n775_state); +uint16_t n775_CrcAddItem(uint16_t remainder, uint16_t item); +uint16_t n775_CalcCrc(const N775_MESSAGE_s *msg); + +static void N775_InitializeDatabase(N775_STATE_s *n775_state); +void N775_ResetStringSequence(N775_STATE_s *n775_state); +void N775_IncrementStringSequence(N775_STATE_s *n775_state); +void N775_ResetMuxIndex(N775_STATE_s *n775_state); +void N775_IncrementMuxIndex(N775_STATE_s *n775_state); +void N775_ErrorHandling(N775_STATE_s *n775_state, N775_COMMUNICATION_STATUS_e returnedValue, uint8_t module); +void N775_Init(N775_STATE_s *n775_state); +STD_RETURN_TYPE_e N775_Enumerate(N775_STATE_s *n775_state); +void N775_I2cInit(N775_STATE_s *n775_state); +void N775_StartMeasurement(N775_STATE_s *n775_state); +void N775_CaptureMeasurement(N775_STATE_s *n775_state); +STD_RETURN_TYPE_e N775_SetMuxChannel(N775_STATE_s *n775_state); +void N775_BalanceSetup(N775_STATE_s *n775_state); +void N775_BalanceControl(N775_STATE_s *n775_state); +void N775_waitTime(uint32_t milliseconds); + +/*========== Static Function Implementations ================================*/ + +/*========== Extern Function Implementations ================================*/ + +/** + * @brief Called to calculate the CRC of a message. + * + * @param remainder + * @param item + * + * @return remainder + * + */ +uint16_t n775_CrcAddItem(uint16_t remainder, uint16_t item) { + uint16_t local_remainder = remainder; + + local_remainder ^= item; + + for (int i = 0; i < 16; i++) { + /* + * Try to divide the current data bit. + */ + if ((local_remainder & 0x8000u) > 0u) { + local_remainder = (local_remainder << 1u) ^ ((0x9eb2u << 1u) + 0x1u); + } else { + local_remainder = (local_remainder << 1u); + } + } + + return (local_remainder); +} + +/** + * @brief Calculate the CRC of a message. + * + * @param msg + * + * @return crc + * + */ +uint16_t n775_CalcCrc(const N775_MESSAGE_s *msg) { + uint16_t remainder = 0; + + remainder = n775_CrcAddItem(remainder, msg->head); + remainder = n775_CrcAddItem(remainder, msg->dataHead); + + for (int i = 0; i < (msg->dataLength - 3); i++) { + remainder = n775_CrcAddItem(remainder, msg->data[i]); + } + + return (remainder); +} + +/** + * @brief in the database, initializes the fields related to the N775 driver. + * + * This function loops through all the N775-related data fields in the database + * and sets them to 0. It should be called in the initialization or re-initialization + * routine of the N775 driver. + * + * @param n775_state state of the N775A driver + * + */ +static void N775_InitializeDatabase(N775_STATE_s *n775_state) { + uint16_t iterator = 0; + + for (uint8_t stringNumber = 0u; stringNumber < BS_NR_OF_STRINGS; stringNumber++) { + n775_state->n775Data.cellVoltage->state = 0; + n775_state->n775Data.minMax->minimumCellVoltage_mV[stringNumber] = 0; + n775_state->n775Data.minMax->maximumCellVoltage_mV[stringNumber] = 0; + n775_state->n775Data.minMax->nrModuleMinimumCellVoltage[stringNumber] = 0; + n775_state->n775Data.minMax->nrModuleMaximumCellVoltage[stringNumber] = 0; + n775_state->n775Data.minMax->nrCellMinimumCellVoltage[stringNumber] = 0; + n775_state->n775Data.minMax->nrCellMaximumCellVoltage[stringNumber] = 0; + for (iterator = 0u; iterator < BS_NR_OF_CELL_BLOCKS_PER_STRING; iterator++) { + n775_state->n775Data.cellVoltage->cellVoltage_mV[stringNumber][iterator] = 0; + } + + n775_state->n775Data.cellTemperature->state = 0; + n775_state->n775Data.minMax->minimumTemperature_ddegC[stringNumber] = 0; + n775_state->n775Data.minMax->maximumTemperature_ddegC[stringNumber] = 0; + n775_state->n775Data.minMax->nrModuleMinimumTemperature[stringNumber] = 0; + n775_state->n775Data.minMax->nrModuleMaximumTemperature[stringNumber] = 0; + n775_state->n775Data.minMax->nrSensorMinimumTemperature[stringNumber] = 0; + n775_state->n775Data.minMax->nrSensorMaximumTemperature[stringNumber] = 0; + for (iterator = 0u; iterator < BS_NR_OF_TEMP_SENSORS_PER_STRING; iterator++) { + n775_state->n775Data.cellTemperature->cellTemperature_ddegC[stringNumber][iterator] = 0; + } + + for (iterator = 0u; iterator < BS_NR_OF_CELL_BLOCKS_PER_STRING; iterator++) { + n775_state->n775Data.balancingControl->balancingState[stringNumber][iterator] = 0; + } + for (iterator = 0u; iterator < BS_NR_OF_MODULES_PER_STRING; iterator++) { + n775_state->n775Data.errorTable->communicationOk[stringNumber][iterator] = false; + n775_state->n775Data.errorTable->noCommunicationTimeout[stringNumber][iterator] = false; + n775_state->n775Data.errorTable->crcIsValid[stringNumber][iterator] = false; + n775_state->n775Data.errorTable->mux0IsOk[stringNumber][iterator] = false; + n775_state->n775Data.errorTable->mux1IsOK[stringNumber][iterator] = false; + n775_state->n775Data.errorTable->mux2IsOK[stringNumber][iterator] = false; + n775_state->n775Data.errorTable->mux3IsOK[stringNumber][iterator] = false; + } + for (iterator = 0u; iterator < BS_NR_OF_MODULES_PER_STRING; iterator++) { + n775_state->n775Data.uid[stringNumber][iterator] = 0; + } + } + + DATA_WRITE_DATA(n775_state->n775Data.cellVoltage); + DATA_WRITE_DATA(n775_state->n775Data.cellTemperature); + DATA_WRITE_DATA(n775_state->n775Data.minMax); + DATA_WRITE_DATA(n775_state->n775Data.balancingControl); +} + +void N775_Meas(N775_STATE_s *n775_state) { + N775_InitializeDatabase(n775_state); + /* Initialize SPI sequence pointers */ + n775_state->pSpiTxSequenceStart = spi_nxp775InterfaceTx; + n775_state->pSpiRxSequenceStart = spi_nxp775InterfaceRx; + + /* Initialize each string */ + N775_ResetStringSequence(n775_state); + while (n775_state->currentString < BS_NR_OF_STRINGS) { + /* Initialize mux sequence pointers */ + n775_state->pMuxSequenceStart[n775_state->currentString] = n775_muxSequence; + N775_Init(n775_state); + N775_IncrementStringSequence(n775_state); + } + + while (1) { + N775_ResetStringSequence(n775_state); + + while (n775_state->currentString < BS_NR_OF_STRINGS) { + if (N775_USE_MUX_FOR_TEMP == true) { + /* Set mux channel according to mux sequence */ + N775_SetMuxChannel(n775_state); + } + N775_CaptureMeasurement(n775_state); + if (N775_USE_MUX_FOR_TEMP == true) { + /* Update index in mux sequence */ + N775_IncrementMuxIndex(n775_state); + } + N775_BalanceControl(n775_state); + + for (uint8_t m = 0u; m < BS_NR_OF_MODULES_PER_STRING; m++) { + if (N775_IsFirstMeasurementCycleFinished(n775_state) == true) { + if (n775_state->n775Data.errorTable->noCommunicationTimeout[n775_state->currentString][m] == 0u) { + /* Daisy-chain does not answer: initialize it again */ + n775_state->pMuxSequenceStart[n775_state->currentString] = n775_muxSequence; + N775_Init(n775_state); + /* Daisy-chain re-initialized: no need to check further slaves */ + break; + } + } + } + + N775_IncrementStringSequence(n775_state); + } + + /* Set flag when all strings have been measured */ + if ((n775_state->currentString == BS_NR_OF_STRINGS) && + (N775_IsFirstMeasurementCycleFinished(n775_state) == 0u)) { + N775_SetFirstMeasurementCycleFinished(n775_state); + } + } +} + +/** + * @brief reset index in string sequence. + * + * @param n775_state state of the N775A driver + * + */ +void N775_ResetStringSequence(N775_STATE_s *n775_state) { + n775_state->currentString = 0u; + n775_state->pSpiTxSequence = n775_state->pSpiTxSequenceStart + n775_state->currentString; + n775_state->pSpiRxSequence = n775_state->pSpiRxSequenceStart + n775_state->currentString; +} + +/** + * @brief updates index in string sequence. + * + * @param n775_state state of the N775A driver + * + */ +void N775_IncrementStringSequence(N775_STATE_s *n775_state) { + n775_state->currentString++; + n775_state->pSpiTxSequence = n775_state->pSpiTxSequenceStart + n775_state->currentString; + n775_state->pSpiRxSequence = n775_state->pSpiRxSequenceStart + n775_state->currentString; +} + +/** + * @brief resets index in mux sequence. + * + * @param n775_state state of the N775A driver + * + */ +void N775_ResetMuxIndex(N775_STATE_s *n775_state) { + n775_state->currentMux[n775_state->currentString] = 0u; + n775_state->pMuxSequence[n775_state->currentString] = n775_state->pMuxSequenceStart[n775_state->currentString]; +} + +/** + * @brief updates index in mux sequence. + * + * @param n775_state state of the N775A driver + * + */ +void N775_IncrementMuxIndex(N775_STATE_s *n775_state) { + n775_state->currentMux[n775_state->currentString]++; + if (n775_state->currentMux[n775_state->currentString] >= N775_MUX_SEQUENCE_LENGTH) { + n775_state->currentMux[n775_state->currentString] = 0u; + } + n775_state->pMuxSequence[n775_state->currentString] = n775_state->pMuxSequenceStart[n775_state->currentString] + + n775_state->currentMux[n775_state->currentString]; +} + +/** + * @brief handles error when doing measurements. + * + * This function is used in the measurement function. It sets the errors flags in + * the error table according to the value returned by the communication function. + * + * @param n775_state state of the N775A driver + * @param returnedValue status of the low-level communication + * @param module number of module addressed + * + */ +void N775_ErrorHandling(N775_STATE_s *n775_state, N775_COMMUNICATION_STATUS_e returnedValue, uint8_t module) { + if (returnedValue == N775_COMMUNICATION_OK) { + n775_state->n775Data.errorTable->communicationOk[n775_state->currentString][module] = true; + n775_state->n775Data.errorTable->noCommunicationTimeout[n775_state->currentString][module] = true; + n775_state->n775Data.errorTable->crcIsValid[n775_state->currentString][module] = true; + } else { + n775_state->n775Data.errorTable->communicationOk[n775_state->currentString][module] = false; + switch (returnedValue) { + case N775_COMMUNICATION_ERROR_TIMEOUT: + n775_state->n775Data.errorTable->noCommunicationTimeout[n775_state->currentString][module] = false; + break; + case N775_COMMUNICATION_ERROR_WRONG_CRC: + n775_state->n775Data.errorTable->crcIsValid[n775_state->currentString][module] = false; + break; + default: + n775_state->n775Data.errorTable->communicationOk[n775_state->currentString][module] = false; + break; + } + } +} + +/** + * @brief initializes the N775 driver. + * + * This function enumerates the slaves and starts the measurement. + * + * @param n775_state state of the N775A driver + * + */ +void N775_Init(N775_STATE_s *n775_state) { + FAS_ASSERT(n775_state != NULL_PTR); + + /* Reset mux sequence */ + N775_ResetMuxIndex(n775_state); + + /* Initialize daisy-chain */ + if (STD_OK != N775_Enumerate(n775_state)) { + /* error handling */} + N775_StartMeasurement(n775_state); + N775_I2cInit(n775_state); + N775_BalanceSetup(n775_state); +} + +/** + * @brief enumerates the N775 slaves. + * + * This function gives the slaves in the daisy-chain an address. + * + * @param n775_state state of the N775A driver + * + */ +STD_RETURN_TYPE_e N775_Enumerate(N775_STATE_s *n775_state) { + FAS_ASSERT(n775_state != NULL_PTR); + uint16_t readValue = 0u; + uint16_t uid[3u] = {0}; + N775_COMMUNICATION_STATUS_e returnedValue = N775_COMMUNICATION_OK; + STD_RETURN_TYPE_e retVal = STD_NOT_OK; + + /** Parse all slaves in the daisy-chain */ + for (uint8_t i = 1; i <= BS_NR_OF_MODULES_PER_STRING; i++) { + /* First send slave to deep sleep to reset message counter */ + N775_CommunicationWrite( + i, + MC33775_SYS_MODE_OFFSET, + (MC33775_SYS_MODE_TARGETMODE_DEEPSLEEP_ENUM_VAL << MC33775_SYS_MODE_TARGETMODE_POS), + n775_state->pSpiTxSequence); + N775_waitTime(1u); + + /* Wake up slave */ + returnedValue = N775_CommunicationRead(i, MC33775_SYS_COM_CFG_OFFSET, &readValue, n775_state); + /* If slave is not enumerated */ + if (returnedValue != N775_COMMUNICATION_OK) { + /* Wait until the slave has woken up */ + N775_waitTime(N775_WAKEUP_TIME_MS); + + returnedValue = N775_CommunicationRead(i, MC33775_SYS_COM_CFG_OFFSET, &readValue, n775_state); + /* If slave is not enumerated */ + if (returnedValue != N775_COMMUNICATION_OK) { + /* Enumerate slave */ + N775_CommunicationWrite( + (0u << 6u) + 0u, + MC33775_SYS_COM_CFG_OFFSET, + i + (N775_DEFAULT_CHAIN_ADDRESS << 6) + + (MC33775_SYS_COM_CFG_BUSFW_ENABLED_ENUM_VAL << MC33775_SYS_COM_CFG_BUSFW_POS), + n775_state->pSpiTxSequence); + } + + /* Reset the message counter of the driver */ + N775_ResetMessageCounter((N775_DEFAULT_CHAIN_ADDRESS << 6) + i, n775_state->currentString); + /* Check that the device has been enumerated */ + returnedValue = N775_CommunicationRead(i, MC33775_SYS_VERSION_OFFSET, &readValue, n775_state); + if (returnedValue == N775_COMMUNICATION_OK) { + retVal = STD_OK; + } + } else { + /* Slave already has an address */ + retVal = STD_OK; + } + + /* Set timeout, enable/disable timeout */ + N775_CommunicationWrite( + i, + MC33775_SYS_COM_TO_CFG_OFFSET, + (N775_TIMEOUT_SWITCH << MC33775_SYS_COM_TO_CFG_COMTODISABLE_POS) | + (N775_TIMEOUT_TO_SLEEP_10MS << MC33775_SYS_COM_TO_CFG_COMTO_POS), + n775_state->pSpiTxSequence); + + /* read uid of each device */ + returnedValue = N775_CommunicationReadMultiple(i, 3u, 3u, MC33775_SYS_UID_LOW_OFFSET, uid, n775_state); + if (returnedValue == N775_COMMUNICATION_OK) { + n775_state->n775Data.uid[n775_state->currentString][i - 1u] = 0u; + for (uint8_t j = 0u; j <= 3u; j++) { + n775_state->n775Data.uid[n775_state->currentString][i - 1u] |= ((uint64_t)uid[j]) << (16u * j); + } + } + } + + return retVal; +} + +/** + * @brief init I2C for the N775 slaves. + * + * This function makes slaves ready for I2C transactions with on-slave devices. + * + * @param n775_state state of the N775A driver + * + */ +void N775_I2cInit(N775_STATE_s *n775_state) { + FAS_ASSERT(n775_state != NULL_PTR); + /* Enable the I2C module and select 400 kHz */ + N775_CommunicationWrite( + N775_BROADCAST_ADDRESS, + MC33775_I2C_CFG_OFFSET, + (MC33775_I2C_CFG_EN_ENABLED_ENUM_VAL << MC33775_I2C_CFG_EN_POS) + + (MC33775_I2C_CFG_CLKSEL_F_400K_ENUM_VAL << MC33775_I2C_CFG_CLKSEL_POS), + n775_state->pSpiTxSequence); +} + +/** + * @brief starts the measurement. + * + * The MC33775A measures continuously. This function + * starts the measurement. + * + * @param n775_state state of the N775A driver + * + */ +void N775_StartMeasurement(N775_STATE_s *n775_state) { + FAS_ASSERT(n775_state != NULL_PTR); + + /* Enable cell voltage measurements */ + N775_CommunicationWrite(N775_BROADCAST_ADDRESS, MC33775_ALLM_VCVB_CFG_OFFSET, 0x3FFF, n775_state->pSpiTxSequence); + /* Enable analog inputs 0-3 and module voltage measurement */ + N775_CommunicationWrite(N775_BROADCAST_ADDRESS, MC33775_PRMM_AIN_CFG_OFFSET, 0x1F, n775_state->pSpiTxSequence); + /* Enable analog inputs 4-7 measurement */ + N775_CommunicationWrite(N775_BROADCAST_ADDRESS, MC33775_SECM_AIN_CFG_OFFSET, 0x0F, n775_state->pSpiTxSequence); + /* Set pause of balancing before measurement start, enable the measurement units simultaneously */ + N775_CommunicationWrite( + N775_BROADCAST_ADDRESS, + MC33775_ALLM_CFG_OFFSET, + (N775_BALPAUSELEN_10US << MC33775_ALLM_CFG_BALPAUSELEN_POS) | (1 << MC33775_ALLM_CFG_MEASEN_POS), + n775_state->pSpiTxSequence); + + N775_waitTime(N775_TIME_AFTER_MEASUREMENT_START_MS); +} + +/** + * @brief captures the measurement. + * + * The MC33775A measures continuously. + * This function takes a snapshot on all slaves in the daisy-chain. + * + * @param n775_state state of the N775A driver + * + */ +void N775_CaptureMeasurement(N775_STATE_s *n775_state) { + FAS_ASSERT(n775_state != NULL_PTR); + + uint16_t primaryRawValues[20] = {0u}; + uint16_t secondaryRawValues[4] = {0u}; + uint16_t currentRawValue = 0u; + int16_t primaryValues[20] = {0u}; + int16_t secondaryValues[4] = {0u}; + int16_t currentValue = 0u; + N775_COMMUNICATION_STATUS_e retValPrimary = N775_COMMUNICATION_OK; + N775_COMMUNICATION_STATUS_e retValSecondary = N775_COMMUNICATION_OK; + N775_COMMUNICATION_STATUS_e retValSupplyCurrent = N775_COMMUNICATION_OK; + uint16_t error = 0u; + bool gpio03Error = false; + bool gpio47Error = false; + + /* Send capture command. This ends the last cycle and starts a new one */ + N775_CommunicationWrite( + N775_BROADCAST_ADDRESS, + MC33775_ALLM_APP_CTRL_OFFSET, + (1u << MC33775_ALLM_APP_CTRL_PAUSEBAL_POS) | (0x3FFu << MC33775_PRMM_APP_CTRL_CAPVC_POS) | + (MC33775_PRMM_APP_CTRL_VCOLNUM_DISABLED_ENUM_VAL << MC33775_PRMM_APP_CTRL_VCOLNUM_POS), + n775_state->pSpiTxSequence); + /* Wait for measurements to take place */ + N775_waitTime(N775_MEASUREMENT_CAPTURE_TIME_MS); + /* Send capture command. This ends the last cycle and starts a new one */ + N775_CommunicationWrite( + N775_BROADCAST_ADDRESS, + MC33775_ALLM_APP_CTRL_OFFSET, + (0u << MC33775_ALLM_APP_CTRL_PAUSEBAL_POS) | (0x3FFu << MC33775_PRMM_APP_CTRL_CAPVC_POS) | + (MC33775_PRMM_APP_CTRL_VCOLNUM_DISABLED_ENUM_VAL << MC33775_PRMM_APP_CTRL_VCOLNUM_POS), + n775_state->pSpiTxSequence); + /* Wait for measurements to be ready */ + N775_waitTime(N775_MEASUREMENT_READY_TIME_MS); + + for (uint8_t m = 0u; m < BS_NR_OF_MODULES_PER_STRING; m++) { + uint8_t deviceAddress = m + 1u; + retValPrimary = N775_CommunicationReadMultiple( + deviceAddress, 20, 4u, MC33775_PRMM_APP_VC_CNT_OFFSET, primaryRawValues, n775_state); + retValSecondary = N775_CommunicationReadMultiple( + deviceAddress, 4, 4u, MC33775_SECM_APP_AIN4_OFFSET, secondaryRawValues, n775_state); + if (N775_CHECK_SUPPLY_CURRENT == true) { + retValSupplyCurrent = + N775_CommunicationRead(deviceAddress, MC33775_SECM_PER_NPNISENSE_OFFSET, ¤tRawValue, n775_state); + } + + N775_ErrorHandling(n775_state, retValPrimary, m); + if (retValPrimary == N775_COMMUNICATION_OK) { + for (uint8_t c = 0u; c < BS_NR_OF_CELL_BLOCKS_PER_MODULE; c++) { + /* Store cell voltages */ + if (N775_INVALID_REGISTER_VALUE != primaryRawValues[c + 1u]) { + primaryValues[c + 1u] = (int16_t)primaryRawValues[c + 1u]; + n775_state->n775Data.cellVoltage + ->cellVoltage_mV[n775_state->currentString][c + (m * BS_NR_OF_CELL_BLOCKS_PER_MODULE)] = + (((float)primaryValues[c + 1u]) * 154.0e-6f * 1000.0f); + } else { + error++; + } + } + for (uint8_t g = 0u; g < 4u; g++) { + /* Store GPIO voltages */ + if (N775_INVALID_REGISTER_VALUE != primaryRawValues[g + 16u]) { + primaryValues[g + 16u] = (int16_t)primaryRawValues[g + 16u]; + n775_state->n775Data.allGpioVoltage + ->gpioVoltages_mV[n775_state->currentString][g + (m * BS_NR_OF_GPIOS_PER_MODULE)] = + (((float)primaryValues[g + 16u]) * 154.0e-6f * 1000.0f); + } else { + gpio03Error = true; + error++; + } + } + /* Store module voltage */ + if (N775_INVALID_REGISTER_VALUE != primaryRawValues[15u]) { + primaryValues[15u] = (int16_t)primaryRawValues[15u]; + n775_state->n775Data.cellVoltage->moduleVoltage_mV[n775_state->currentString][m] = + (((float)primaryValues[15u]) * 2.58e-3f * 1000.0f); + } else { + error++; + } + } + + N775_ErrorHandling(n775_state, retValSecondary, m); + if (retValSecondary == N775_COMMUNICATION_OK) { + for (uint8_t g = 4u; g < 8u; g++) { + if (N775_INVALID_REGISTER_VALUE != secondaryRawValues[g - 4u]) { + secondaryValues[g - 4u] = (int16_t)secondaryRawValues[g - 4u]; + n775_state->n775Data.allGpioVoltage + ->gpioVoltages_mV[n775_state->currentString][g + (m * BS_NR_OF_GPIOS_PER_MODULE)] = + (((float)secondaryValues[g - 4u]) * 154.0e-6f * 1000.0f); + } else { + gpio47Error = true; + error++; + } + } + } + + /* Set temperature values */ + if (N775_USE_MUX_FOR_TEMP == true) { + /* Mux case */ + if (gpio03Error == false) { + n775_state->n775Data.cellTemperature + ->cellTemperature_ddegC[n775_state->currentString] + [n775_state->currentMux[n775_state->currentString] + + (m * BS_NR_OF_TEMP_SENSORS_PER_MODULE)] = + N775_ConvertVoltagesToTemperatures( + n775_state->n775Data.allGpioVoltage + ->gpioVoltages_mV[n775_state->currentString] + [N775_MUXED_TEMP_GPIO_POSITION + (m * BS_NR_OF_GPIOS_PER_MODULE)]); + } + } else if (N775_USE_MUX_FOR_TEMP == false) { + /* No mux case */ + if ((gpio03Error == false) && (gpio47Error == false)) { + for (uint16_t t = 0u; t < BS_NR_OF_TEMP_SENSORS_PER_MODULE; t++) { + n775_state->n775Data.cellTemperature + ->cellTemperature_ddegC[n775_state->currentString][t + (m * BS_NR_OF_TEMP_SENSORS_PER_MODULE)] = + N775_ConvertVoltagesToTemperatures( + n775_state->n775Data.allGpioVoltage + ->gpioVoltages_mV[n775_state->currentString][t + (m * BS_NR_OF_GPIOS_PER_MODULE)]); + } + } + } else { + /* Invalid value for switch case */ + FAS_ASSERT(FAS_TRAP); + } + + if (N775_CHECK_SUPPLY_CURRENT == true) { + N775_ErrorHandling(n775_state, retValSupplyCurrent, m); + if (retValSupplyCurrent == N775_COMMUNICATION_OK) { + if (N775_INVALID_REGISTER_VALUE != currentRawValue) { + currentValue = (int16_t)currentRawValue; + n775_state->n775Data.supplyCurrent->current[n775_state->currentString][m] = + (((float)currentValue) * 7.69e-6f * 1000.0f); + } else { + error++; + } + } + } + } + + DATA_WRITE_DATA( + n775_state->n775Data.cellVoltage, n775_state->n775Data.cellTemperature, n775_state->n775Data.allGpioVoltage); +} + +/** + * @brief sets mux channel. + * + * This function uses I2C to set the mux channel. + * + * @param n775_state state of the N775A driver + * + */ +STD_RETURN_TYPE_e N775_SetMuxChannel(N775_STATE_s *n775_state) { + FAS_ASSERT(n775_state != NULL_PTR); + FAS_ASSERT(n775_state->pMuxSequence[n775_state->currentString]->muxId < 4u); + FAS_ASSERT(n775_state->pMuxSequence[n775_state->currentString]->muxChannel <= 0xFFu); + + uint16_t readValue = 0u; + uint8_t dataI2c = 0u; + uint8_t addressI2c_write = N775_ADG728_ADDRESS_UPPERBITS; + uint8_t addressI2c_read = N775_ADG728_ADDRESS_UPPERBITS; + uint16_t timeout = 0u; + STD_RETURN_TYPE_e retVAL = STD_OK; + N775_COMMUNICATION_STATUS_e returnedValue = N775_COMMUNICATION_OK; + + /* First set channel */ + + /* Set bit1 and bit0 with mux address, write to mux */ + addressI2c_write |= ((n775_state->pMuxSequence[n775_state->currentString]->muxId) << 1u) | N775_I2C_WRITE; + /* Set bit1 and bit0 with mux address, read from mux */ + addressI2c_read |= ((n775_state->pMuxSequence[n775_state->currentString]->muxId) << 1u) | N775_I2C_READ; + + /** + * Set data to send, contains channel bit (8 channels) + * 1 means channel active, 0 means channel inactive + */ + if (n775_state->pMuxSequence[n775_state->currentString]->muxChannel == 0xFF) { + /* 0xFF in mux sequence means disable all channels */ + dataI2c = 0u; + } else { + dataI2c = (uint8_t)(1u << (n775_state->pMuxSequence[n775_state->currentString]->muxChannel)); + } + + /* Write data to send on I2C bus in registers */ + N775_CommunicationWrite( + N775_BROADCAST_ADDRESS, + MC33775_I2C_DATA0_OFFSET, + (addressI2c_write << MC33775_I2C_DATA0_BYTE0_POS) | (dataI2c << MC33775_I2C_DATA0_BYTE1_POS), + n775_state->pSpiTxSequence); + + /* Read with a repeated start directly after write */ + N775_CommunicationWrite( + N775_BROADCAST_ADDRESS, + MC33775_I2C_DATA1_OFFSET, + (addressI2c_read << MC33775_I2C_DATA1_BYTE2_POS) | (N775_I2C_DUMMY_BYTE << MC33775_I2C_DATA1_BYTE3_POS), + n775_state->pSpiTxSequence); + + /* Write into the control register to start transaction */ + N775_CommunicationWrite( + N775_BROADCAST_ADDRESS, + MC33775_I2C_CTRL_OFFSET, + (N775_I2C_NR_BYTES_FOR_MUX_WRITE << MC33775_I2C_CTRL_START_POS) | + ((MC33775_I2C_CTRL_STPAFTER_STOP_ENUM_VAL << MC33775_I2C_CTRL_STPAFTER_POS) + + (N775_I2C_NR_BYTES_TO_SWITCH_TO_READ_FOR_UX_READ << MC33775_I2C_CTRL_RDAFTER_POS)), + n775_state->pSpiTxSequence); + + /** + * Wait util transaction ends, test on last device in daisy-chain + * So device address = number of modules + */ + timeout = N775_FLAG_READY_TIMEOUT; + do { + returnedValue = + N775_CommunicationRead(BS_NR_OF_MODULES_PER_STRING, MC33775_I2C_STAT_OFFSET, &readValue, n775_state); + timeout--; + } while ((readValue & MC33775_I2C_STAT_PENDING_MSK) && (returnedValue == N775_COMMUNICATION_OK) && (timeout > 0u)); + + if (returnedValue == N775_COMMUNICATION_OK) { + /** + * Get I2C read data, on last device in daisy-chain + * Use result to set error state for all slaves to avoid + * reading all slaves in daisy-chain. + */ + returnedValue = + N775_CommunicationRead(BS_NR_OF_MODULES_PER_STRING, MC33775_I2C_DATA1_OFFSET, &readValue, n775_state); + readValue = readValue >> MC33775_I2C_DATA1_BYTE3_POS; + + if (returnedValue == N775_COMMUNICATION_OK) { + if (N775_CHECK_MUX_STATE == true) { + if (readValue == dataI2c) { + /* OK */ + for (uint8_t m = 0u; m < BS_NR_OF_MODULES_PER_STRING; m++) { + n775_state->n775Data.errorTable->mux0IsOk[n775_state->currentString][m] = true; + } + } else { + /* Not OK */ + for (uint8_t m = 0u; m < BS_NR_OF_MODULES_PER_STRING; m++) { + n775_state->n775Data.errorTable->mux0IsOk[n775_state->currentString][m] = false; + } + } + } else { + retVAL = STD_NOT_OK; + } + } + } else { + retVAL = STD_NOT_OK; + } + + return retVAL; +} + +/** + * @brief setups balancing. + * + * Sets all balancing timer to max to allow for software balancing control. + * + * @param n775_state state of the N775A driver + * + */ +void N775_BalanceSetup(N775_STATE_s *n775_state) { + FAS_ASSERT(n775_state != NULL_PTR); + + /* Set global timeout counter to max value */ + N775_CommunicationWrite( + N775_BROADCAST_ADDRESS, + MC33775_BAL_GLOB_TO_TMR_OFFSET, + N775_GLOBAL_BALANCING_TIMER, + n775_state->pSpiTxSequence); + + /* Disable pre-balancing timer by setting it to zero */ + N775_CommunicationWrite( + N775_BROADCAST_ADDRESS, MC33775_BAL_PRE_TMR_OFFSET, N775_PRE_BALANCING_TIMER, n775_state->pSpiTxSequence); + + /* Set PWM value for all channels to 100%, set balancing timer for all channels to maximum value */ + N775_CommunicationWrite( + N775_BROADCAST_ADDRESS, + MC33775_BAL_TMR_CH_ALL_OFFSET, + (MC33775_BAL_TMR_CH_ALL_PWM_PWM100_ENUM_VAL << MC33775_BAL_TMR_CH_ALL_PWM_POS) | + (N775_ALL_CHANNEL_BALANCING_TIMER << MC33775_BAL_TMR_CH_ALL_BALTIME_POS), + n775_state->pSpiTxSequence); + + /* Select timer based balancing and enable balancing */ + N775_CommunicationWrite( + N775_BROADCAST_ADDRESS, + MC33775_BAL_GLOB_CFG_OFFSET, + (MC33775_BAL_GLOB_CFG_BALEN_ENABLED_ENUM_VAL << MC33775_BAL_GLOB_CFG_BALEN_POS) | + (MC33775_BAL_GLOB_CFG_TMRBALEN_STOP_ENUM_VAL << MC33775_BAL_GLOB_CFG_TMRBALEN_POS), + n775_state->pSpiTxSequence); +} + +/** + * @brief manages balancing. + * + * Reads balancing order from database and balances the corresponding cells. + * + * @param n775_state state of the N775A driver + * + */ +void N775_BalanceControl(N775_STATE_s *n775_state) { + FAS_ASSERT(n775_state != NULL_PTR); + + N775_BalanceSetup(n775_state); + + DATA_READ_DATA(n775_state->n775Data.balancingControl); + + for (uint8_t m = 0u; m < BS_NR_OF_MODULES_PER_STRING; m++) { + uint8_t deviceAddress = m + 1u; + uint16_t balancingState = 0u; + for (uint16_t c = 0u; c < BS_NR_OF_CELL_BLOCKS_PER_MODULE; c++) { + if (n775_state->n775Data.balancingControl + ->balancingState[n775_state->currentString][c + (m * BS_NR_OF_CELL_BLOCKS_PER_MODULE)] != 0u) { + balancingState |= 1u << c; + } + } + /* All channels active --> 14 bits set to 1 --> 0x3FFF */ + FAS_ASSERT(balancingState <= 0x3FFFu); + /* Enable channels, one written to a channels means balancing active */ + N775_CommunicationWrite(deviceAddress, MC33775_BAL_CH_CFG_OFFSET, balancingState, n775_state->pSpiTxSequence); + } +} + +/** + * @brief gets the measurement initialization status. + * + * @param n775_state state of the N775A driver + * + * @return retval true if a first measurement cycle was made, false otherwise + * + */ +extern bool N775_IsFirstMeasurementCycleFinished(N775_STATE_s *n775_state) { + bool retval = false; + + OS_EnterTaskCritical(); + retval = n775_state->firstMeasurementMade; + OS_ExitTaskCritical(); + + return retval; +} + +/** + * @brief sets the measurement initialization status. + * + * @param n775_state state of the N775A driver + * + */ +static void N775_SetFirstMeasurementCycleFinished(N775_STATE_s *n775_state) { + OS_EnterTaskCritical(); + n775_state->firstMeasurementMade = true; + OS_ExitTaskCritical(); +} + +extern void TEST_N775_SetFirstMeasurementCycleFinished(N775_STATE_s *n775_state) { + N775_SetFirstMeasurementCycleFinished(n775_state); +} + +/** + * @brief waits for a definite amount of time in ms. + * + * This function uses FreeRTOS. It blocks the tasks for + * the given amount of miliseconds. + * + * @param milliseconds time to wait in ms + * + */ +void N775_waitTime(uint32_t milliseconds) { + uint32_t current_time = OS_GetTickCount(); + /* Block task without possibility to wake up */ + OS_DelayTaskUntil(¤t_time, milliseconds); +} + +/*========== Externalized Static Function Implementations (Unit Test) =======*/ diff --git a/src/app/driver/afe/nxp/common/n775.h b/src/app/driver/afe/nxp/mc33775a/nxp_mc33775a.h similarity index 64% rename from src/app/driver/afe/nxp/common/n775.h rename to src/app/driver/afe/nxp/mc33775a/nxp_mc33775a.h index 32a36dac..7dc96ad1 100644 --- a/src/app/driver/afe/nxp/common/n775.h +++ b/src/app/driver/afe/nxp/mc33775a/nxp_mc33775a.h @@ -40,11 +40,11 @@ */ /** - * @file n775.h + * @file nxp_mc33775a.h * @author foxBMS Team * @date 2020-05-08 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix N775 * @@ -52,37 +52,20 @@ * */ -#ifndef FOXBMS__N775_H_ -#define FOXBMS__N775_H_ +#ifndef FOXBMS__NXP_MC33775A_H_ +#define FOXBMS__NXP_MC33775A_H_ /*========== Includes =======================================================*/ -#include "n775_cfg.h" +#include "nxp_mc33775a_cfg.h" /*========== Macros and Definitions =========================================*/ /*========== Extern Constant and Variable Declarations ======================*/ -/** - * Buffer used for SPI Rx transmissions for the communication with MC33775A. - */ -extern uint16_t n775_RXbuffer[N775_MAX_N_BYTES_FOR_DATA_RECEPTION]; -/** - * Buffer used for SPI Tx transmissions for the communication with MC33775A. - */ -extern uint16_t n775_TXbuffer[N775_TX_MESSAGE_LENGTH]; - -/** - * Struct used for SPI Tx transmissions for the communicaiton with MC33775A. - */ -extern N775_MESSAGE_s n775_sentData; -/** - * Struct used for SPI Rx transmissions for the communicaiton with MC33775A. - */ -extern N775_MESSAGE_s n775_receivedData; /** * Variable containing the state machine state for the MC33775A driver. */ -extern N775_STATE_s n775_state; +extern N775_STATE_s n775_stateBase; /*========== Extern Function Prototypes =====================================*/ @@ -91,30 +74,13 @@ extern N775_STATE_s n775_state; * * This function contains the sequence of events in the N775 state machine. * It must be called time-triggered, every 1ms. - */ -extern void N775_Trigger(void); - -/** - * @brief sets the current state request of the state variable n775_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 N775_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. + * @param n775_state state of the N775A driver * - * @param statereq state request to set - * @return retVal current state request, taken from N775_STATE_REQUEST_e */ -extern N775_RETURN_TYPE_e N775_SetStateRequest(N775_STATE_REQUEST_e statereq); - -extern bool N775_IsFirstMeasurementCycleFinished(void); +extern void N775_Meas(N775_STATE_s *n775_state); -extern void N775_SaveVoltages(void); -extern void N775_SaveTemperatures(void); -extern N775_STATE_REQUEST_e N775_GetStateRequest(void); -extern N775_STATEMACH_e N775_GetState(void); +extern bool N775_IsFirstMeasurementCycleFinished(N775_STATE_s *n775_state); /*========== Externalized Static Functions Prototypes (Unit Test) ===========*/ #ifdef UNITY_UNIT_TEST @@ -124,4 +90,4 @@ extern void TEST_N775_SetFirstMeasurementCycleFinished(N775_STATE_s *n775_state) /* End test functions */ #endif -#endif /* FOXBMS__N775_H_ */ +#endif /* FOXBMS__NXP_MC33775A_H_ */ diff --git a/src/app/driver/afe/nxp/common/nxp_common.json b/src/app/driver/afe/nxp/mc33775a/nxp_mc33775a.json similarity index 100% rename from src/app/driver/afe/nxp/common/nxp_common.json rename to src/app/driver/afe/nxp/mc33775a/nxp_mc33775a.json diff --git a/src/app/driver/afe/nxp/common/n775_defs.h b/src/app/driver/afe/nxp/mc33775a/nxp_mc33775a_defs.h similarity index 57% rename from src/app/driver/afe/nxp/common/n775_defs.h rename to src/app/driver/afe/nxp/mc33775a/nxp_mc33775a_defs.h index 430469ed..79ab445d 100644 --- a/src/app/driver/afe/nxp/common/n775_defs.h +++ b/src/app/driver/afe/nxp/mc33775a/nxp_mc33775a_defs.h @@ -40,11 +40,11 @@ */ /** - * @file n775_defs.h + * @file nxp_mc33775a_defs.h * @author foxBMS Team - * @date 2015-09-01 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @date 2020-09-01 (date of creation) + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix N775 * @@ -52,8 +52,8 @@ * */ -#ifndef FOXBMS__N775_DEFS_H_ -#define FOXBMS__N775_DEFS_H_ +#ifndef FOXBMS__NXP_MC33775A_DEFS_H_ +#define FOXBMS__NXP_MC33775A_DEFS_H_ /*========== Includes =======================================================*/ #include "general.h" @@ -65,19 +65,85 @@ /*========== Extern Constant and Variable Declarations ======================*/ -/** Command types supported by the MC33775A */ -typedef enum { - N775_CMD_WAKEUP_NOP = 0x00, - N775_CMD_READ = 0x01, - N775_CMD_WRITE = 0x02, - N775_CMD_RESPONSE = 0x03, -} N775_COMMAND_e; +/* Use of mux for temperature measurement */ +#define N775_USE_MUX_FOR_TEMP (true) +/* Read mux state after setting it */ +#define N775_CHECK_MUX_STATE (true) +/* Check supply current (part of MC33775A DIAG) */ +#define N775_CHECK_SUPPLY_CURRENT (false) +/* Broadcast address for the N775 slaves */ +#define N775_BROADCAST_ADDRESS (63u) +/* Time to wait between activity on bus and wake up of slave */ +#define N775_WAKEUP_TIME_MS (3u) +/* Timeout in 10ms to go into sleep, max 255 (corresponding to 2550ms) */ +#define N775_TIMEOUT_TO_SLEEP_10MS (200u) +/* Timeout enable, 0u in register = enabled */ +#define N775_TIMEOUT_ENABLED (0u) +/* Timeout enable, 0x5A in register = disabled */ +#define N775_TIMEOUT_DISABLED (0x5Au) +/* Timeout enable switch*/ +#define N775_TIMEOUT_SWITCH (N775_TIMEOUT_ENABLED) +/* Time to wait after measurements started */ +#define N775_TIME_AFTER_MEASUREMENT_START_MS (5u) +/* Default chain address */ +#define N775_DEFAULT_CHAIN_ADDRESS (1u) +/* Measurement capture time */ +/* + 1 to take balancing pause time before measurement into account */ +#define N775_MEASUREMENT_CAPTURE_TIME_MS (5u + 1u) +/* Time to wait after measurement capture for measurements to be ready */ +#define N775_MEASUREMENT_READY_TIME_MS (1u) +/* Value stored in N775A register when not valid */ +#define N775_INVALID_REGISTER_VALUE (0x8000u) +/* Length of the mux measurement sequence */ +#define N775_MUX_SEQUENCE_LENGTH (8u) +/* Time in 10us for pause of balancing before measurement start */ +/* Wait time afer capture must be increased if this value is too high */ +#define N775_BALPAUSELEN_10US (100u) +/** + * Upper bits of ADG728 mux address byte + * Set to 0: bit2, bit1 (address), bit0 (R/W) + */ +#define N775_ADG728_ADDRESS_UPPERBITS (0x98u) +/* I2C R/W bit, read */ +#define N775_I2C_READ (1u) +/* I2C R/W bit, write */ +#define N775_I2C_WRITE (0u) +/* Dummy byte for I2C, replaced by read data */ +#define N775_I2C_DUMMY_BYTE (0x0u) +/* GPIO position (0 to 7) used for multiplexed temperature measurement */ +#define N775_MUXED_TEMP_GPIO_POSITION (0u) +/* Global balancing timer (0x0 - 0xFFFF) */ +#define N775_GLOBAL_BALANCING_TIMER (0xFFFFu) +/* Pre-balancing timer (0x0 - 0xFFFF) */ +#define N775_PRE_BALANCING_TIMER (0x0u) +/* All channel balancing timer (0x0 - 0xFFFF) */ +#define N775_ALL_CHANNEL_BALANCING_TIMER (0xFFFFu) +/* Global balancing timer value to reach to reset it to max */ +#define N775_GLOBAL_BALANCING_TIMER_VALUE_SET_TO_MAX_AGAIN (0x1000u) +/* Timeout used to avoid endless loop when waiting for a flag to be ready */ +#define N775_FLAG_READY_TIMEOUT (2000u) -/** MADD values supported by the MC33775A */ -typedef enum { - N775_MADD_MASTER0 = 0x00, - N775_MADD_MASTER1 = 0x01, -} N775_MADD_e; +/** error table for the LTC driver */ +typedef struct { + bool communicationOk[BS_NR_OF_STRINGS][BS_NR_OF_MODULES_PER_STRING]; /*!< */ + bool noCommunicationTimeout[BS_NR_OF_STRINGS][BS_NR_OF_MODULES_PER_STRING]; /*!< */ + bool crcIsValid[BS_NR_OF_STRINGS][BS_NR_OF_MODULES_PER_STRING]; /*!< */ + bool mux0IsOk[BS_NR_OF_STRINGS][BS_NR_OF_MODULES_PER_STRING]; /*!< */ + bool mux1IsOK[BS_NR_OF_STRINGS][BS_NR_OF_MODULES_PER_STRING]; /*!< */ + bool mux2IsOK[BS_NR_OF_STRINGS][BS_NR_OF_MODULES_PER_STRING]; /*!< */ + bool mux3IsOK[BS_NR_OF_STRINGS][BS_NR_OF_MODULES_PER_STRING]; /*!< */ +} N775_ERRORTABLE_s; + +/** error table for the LTC driver */ +typedef struct { + uint16_t current[BS_NR_OF_STRINGS][BS_NR_OF_MODULES_PER_STRING]; +} N775_SUPPLY_CURRENT_s; + +/** configuration of the mux channels */ +typedef struct { + uint8_t muxId; /*!< multiplexer ID 0 - 3 */ + uint8_t muxChannel; /*!< multiplexer channel 0 - 7 */ +} N775_MUX_CH_CFG_s; /** States of the N775 state machine */ typedef enum { @@ -119,8 +185,8 @@ typedef enum { /** State requests for the N775 statemachine */ typedef enum { - N775_STATE_INIT_REQUEST, /*!< */ - N775_STATE_NO_REQUEST, /*!< */ + N775_STATE_INITIALIZATION_REQUEST, /*!< */ + N775_STATE_NO_REQUEST, /*!< */ } N775_STATE_REQUEST_e; /** @@ -136,38 +202,25 @@ typedef enum { N775_MUX_ERROR = 6, /*!< Error state: Source: MUX */ N775_INIT_ERROR = 7, /*!< Error state: Source: Initialization */ N775_OK_FROM_ERROR = 8, /*!< Return from error --> ok */ - N775_ERROR = 20, /*!< General error state */ + N775_GENERAL_ERROR = 20, /*!< General error state */ N775_ALREADY_INITIALIZED = 30, /*!< Initialization of N775 already finished */ N775_ILLEGAL_TASK_TYPE = 99, /*!< Illegal */ } N775_RETURN_TYPE_e; -/** configuration of the mux channels */ -typedef struct { - uint8_t muxID; /*!< multiplexer ID 0 - 3 */ - uint8_t muxCh; /*!< multiplexer channel 0 - 7 */ -} N775_MUX_CH_CFG_s; - -/** struct that holds the multiplexer sequence */ -typedef struct { - uint8_t nr_of_steps; /*!< number of steps in the multiplexer sequence */ - N775_MUX_CH_CFG_s *seqptr; /*!< pointer to the multiplexer sequence */ -} N775_MUX_SEQUENCE_s; - /** This struct contains pointer to used data buffers */ typedef struct { - DATA_BLOCK_CELL_VOLTAGE_s *cellvoltage; - DATA_BLOCK_CELL_TEMPERATURE_s *celltemperature; - DATA_BLOCK_MIN_MAX_s *minmax; - DATA_BLOCK_BALANCING_FEEDBACK_s *balancing_feedback; - DATA_BLOCK_USER_MUX_s *user_mux; - DATA_BLOCK_BALANCING_CONTROL_s *balancing_control; - DATA_BLOCK_SLAVE_CONTROL_s *user_io_control; - DATA_BLOCK_OPEN_WIRE_s *openWire_check; /* Wie genau open wire check behandeln? Was genau abspeichern? */ - int *openWire_buffer; /* BS_NR_OF_CELL_BLOCKS_PER_STRING */ - uint8_t *spi_TX_withPEC; /* 12 byte */ - uint8_t *spi_RX_withPEC; /* 12 byte */ - uint16_t *GPIOVoltages; /* N7752_NUMBER_OF_GPIOS * NR_OF_N775s */ - uint16_t *valid_GPIOPECs; /* NR_OF_N775s */ + DATA_BLOCK_CELL_VOLTAGE_s *cellVoltage; + DATA_BLOCK_CELL_TEMPERATURE_s *cellTemperature; + DATA_BLOCK_ALL_GPIO_VOLTAGES_s *allGpioVoltage; + DATA_BLOCK_MIN_MAX_s *minMax; + DATA_BLOCK_BALANCING_FEEDBACK_s *balancingFeedback; + DATA_BLOCK_USER_MUX_s *userMux; + DATA_BLOCK_BALANCING_CONTROL_s *balancingControl; + DATA_BLOCK_SLAVE_CONTROL_s *slaveControl; + DATA_BLOCK_OPEN_WIRE_s *openWire; /* Wie genau open wire check behandeln? Was genau abspeichern? */ + N775_SUPPLY_CURRENT_s *supplyCurrent; + N775_ERRORTABLE_s *errorTable; + uint64_t uid[BS_NR_OF_STRINGS][BS_NR_OF_MODULES_PER_STRING]; } N775_DATAPTR_s; /** This struct contains error counter and pointer to used error buffers */ @@ -188,11 +241,11 @@ typedef struct { typedef struct { N775_STATE_REQUEST_e measVoltage; /* activated = N775_STATE_VOLTAGEMEASUREMENT_REQUEST */ N775_STATE_REQUEST_e measVoltage2Cells; /* activated = N775_STATE_VOLTAGEMEASUREMENT_2CELLS_REQUEST */ - N775_STATE_REQUEST_e measVoltageSumofCells; /* activated = N775_STATE_VOLTAGEMEASUREMENT_SC_REQUEST */ + N775_STATE_REQUEST_e measVoltageSumOfCells; /* activated = N775_STATE_VOLTAGEMEASUREMENT_SC_REQUEST */ N775_STATE_REQUEST_e measMux; /* activated = N775_STATE_MUXMEASUREMENT_REQUEST */ N775_STATE_REQUEST_e balancing; /* activated = N775_STATE_BALANCECONTROL_REQUEST */ N775_STATE_REQUEST_e balancing_feedback; /* activated = N775_STATE_BALANCEFEEDBACK_REQUEST */ - N775_STATE_REQUEST_e measAllGPIO; /* activated = N775_STATE_ALLGPIOMEASUREMENT_REQUEST */ + N775_STATE_REQUEST_e measAllGpio; /* activated = N775_STATE_ALL_GPIO_MEASUREMENT_REQUEST */ N775_STATE_REQUEST_e userIO; /* activated = N775_STATE_USER_IO_REQUEST */ N775_STATE_REQUEST_e readEEPROM; /* activated = N775_STATE_EEPROM_READ_UID_REQUEST */ N775_STATE_REQUEST_e measTemperature; /* activated = N775_STATE_TEMP_SENS_READ_REQUEST */ @@ -210,9 +263,9 @@ typedef struct { * */ typedef enum { - N775_NOT_REUSED = 0, - N775_REUSE_READVOLT_FOR_ADOW_PUP = 1, - N775_REUSE_READVOLT_FOR_ADOW_PDOWN = 2, + N775_NOT_REUSED = 0, + N775_REUSE_READ_VOLTAGE_FOR_ADOW_PUP = 1, + N775_REUSE_READ_VOLTAGE_FOR_ADOW_PDOWN = 2, } N775_REUSE_MODE_e; /** TI port expander IO direction (input or output) */ @@ -226,21 +279,18 @@ typedef enum { * The user can get the current state of the N775 state machine with this variable */ typedef struct { - uint16_t timer; /*!< time in ms before the state machine processes the next state, e.g. in counts of 1ms */ - N775_STATE_REQUEST_e stateReq; /*!< current state request made to the state machine */ - N775_STATEMACH_e state; /*!< state of Driver State Machine */ - uint8_t subState; /*!< current substate of the state machine */ - N775_STATEMACH_e lastState; /*!< previous state of the state machine */ - uint8_t lastSubState; /*!< previous substate of the state machine */ - uint32_t errRequestCounter; /*!< counts the number of illegal requests to the N775 state machine */ - uint8_t triggerEntry; /*!< counter for re-entrance protection (function running flag) */ - STD_RETURN_TYPE_e firstMeasurementMade; /*!< flag that indicates if the first measurement cycle was completed */ - STD_RETURN_TYPE_e checkSpiFlag; /*!< indicates if interrupt flag or timer must be considered */ - STD_RETURN_TYPE_e balanceControlDone; /*!< indicates if balance control was done */ - bool txTransmitOngoing; /*!< indicates if a transmission is ongoing with the daisy-chain */ - bool rxTransmitOngoing; /*!< indicates if a transmission is ongoing with the daisy-chain */ - uint16_t totalMessages; /*!< total number of messages to be received from the daisy-chain */ - uint16_t remainingMessages; /*!< counter of number of messages still to be received from the daisy-chain */ + bool firstMeasurementMade; /*!< flag that indicates if the first measurement cycle was completed */ + uint8_t currentString; /*!< string currently being addressed */ + SPI_INTERFACE_CONFIG_s *pSpiTxSequenceStart; /*!< pointer to the start of SPI sequence to be used for Tx */ + SPI_INTERFACE_CONFIG_s *pSpiTxSequence; /*!< pointer to the SPI sequence to be used for Tx */ + SPI_INTERFACE_CONFIG_s *pSpiRxSequenceStart; /*!< pointer to the start of SPI sequence to be used for Rx */ + SPI_INTERFACE_CONFIG_s *pSpiRxSequence; /*!< pointer to the SPI sequence to be used for Rx */ + uint8_t currentMux[BS_NR_OF_STRINGS]; /*!< mux currently being addressed */ + N775_MUX_CH_CFG_s *pMuxSequenceStart + [BS_NR_OF_STRINGS]; /*!< pointer to the multiplexer sequence to be measured (contains a list of elements [multiplexer id, multiplexer channels]) (1,-1)...(3,-1),(0,1),...(0,7) */ + N775_MUX_CH_CFG_s *pMuxSequence + [BS_NR_OF_STRINGS]; /*!< pointer to the multiplexer sequence to be measured (contains a list of elements [multiplexer id, multiplexer channels]) (1,-1)...(3,-1),(0,1),...(0,7) */ + N775_DATAPTR_s n775Data; } N775_STATE_s; /** This structure reflects the messages used by the NXP MC33775A */ @@ -256,4 +306,4 @@ typedef struct { /*========== Externalized Static Functions Prototypes (Unit Test) ===========*/ -#endif /* FOXBMS__N775_DEFS_H_ */ +#endif /* FOXBMS__NXP_MC33775A_DEFS_H_ */ diff --git a/src/app/driver/afe/nxp/mc33775a/vendor/.clang-format b/src/app/driver/afe/nxp/mc33775a/vendor/.clang-format new file mode 100644 index 00000000..9d159247 --- /dev/null +++ b/src/app/driver/afe/nxp/mc33775a/vendor/.clang-format @@ -0,0 +1,2 @@ +DisableFormat: true +SortIncludes: false diff --git a/src/app/driver/afe/nxp/mc33775a/vendor/MC33775A.h b/src/app/driver/afe/nxp/mc33775a/vendor/MC33775A.h new file mode 100644 index 00000000..c89383e1 --- /dev/null +++ b/src/app/driver/afe/nxp/mc33775a/vendor/MC33775A.h @@ -0,0 +1,16560 @@ +/* Copyright 2019 NXP +* +* Redistribution and use in source and binary forms, with or without modification, are permitted +* provided that the following terms 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. +*/ + +/* -------------------------------------------------------------------------- + * Generated by com.nxp.ipxact.generators.vsw.VswComponentRegisterGenerator version 2019.03 + * Magillem Design Services S.A. Magillem Generator Studio. + * Input -remapStates was set to null + * Input -namespace was set to mc33775 + * Input -includeComponentName was set to false + * Input -includeMemoryMapName was set to false + * Input -includeMemoryRemapName was set to false + * Input -includeAddressBlockName was set to false + * Input -includeRegisterFileName was set to false + * Input -increasingBitfieldOffset was set to true + * Input -includeRegisterStructs was set to true + * Input -includeFileStdIntTypes was set to + * Input -includeFilters was set to [PUBLIC] + * Input -excludeFilters was set to null + * -------------------------------------------------------------------------- */ + +#ifndef MC33775MCU_IF_REG_H +#define MC33775MCU_IF_REG_H + + +#ifdef __cplusplus +extern "C" +{ +#endif + +#include + + +/* Overall register macros */ +#define MC33775_MCU_IF_NR_OF_REGISTERS \ + (215U) +#define MC33775_MCU_IF_MAX_OFFSET \ + (0x101DU) + +/* -------------------------------------------------------------------------- + * ALLM_CFG (write-only):General measurement control. + * -------------------------------------------------------------------------- */ +#define MC33775_ALLM_CFG_OFFSET \ + (0x1400U) +#define MC33775_ALLM_CFG_RW_MSK \ + (0x0U) +#define MC33775_ALLM_CFG_RD_MSK \ + (0x0U) +#define MC33775_ALLM_CFG_WR_MSK \ + (0xFFFFU) +#define MC33775_ALLM_CFG_MW_MSK \ + (0x0U) +#define MC33775_ALLM_CFG_RA_MSK \ + (0x0U) +#define MC33775_ALLM_CFG_POR_MSK \ + (0xffffU) +#define MC33775_ALLM_CFG_POR_VAL \ + (0x0U) + +/* Field MEASEN: Writes MEASEN for primary and secondary measurement. */ +#define MC33775_ALLM_CFG_MEASEN_POS \ + (0U) +#define MC33775_ALLM_CFG_MEASEN_MSK \ + (0x1U) + +/* Field BALPAUSECYCMODEN: Writes BALPAUSECYCMODEN for primary and secondary measurement. */ +#define MC33775_ALLM_CFG_BALPAUSECYCMODEN_POS \ + (1U) +#define MC33775_ALLM_CFG_BALPAUSECYCMODEN_MSK \ + (0x2U) + +/* Field BALPAUSELEN: Writes BALPAUSELEN for primary and secondary measurement. */ +#define MC33775_ALLM_CFG_BALPAUSELEN_POS \ + (2U) +#define MC33775_ALLM_CFG_BALPAUSELEN_MSK \ + (0xFFFCU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t MEASEN : 1; + volatile uint16_t BALPAUSECYCMODEN : 1; + volatile uint16_t BALPAUSELEN : 14; + } B; +} mc33775_all_measurement_registers_allm_cfg_t; + +/* -------------------------------------------------------------------------- + * ALLM_APP_CTRL (write-only):Application measurement control. + * -------------------------------------------------------------------------- */ +#define MC33775_ALLM_APP_CTRL_OFFSET \ + (0x1401U) +#define MC33775_ALLM_APP_CTRL_RW_MSK \ + (0x0U) +#define MC33775_ALLM_APP_CTRL_RD_MSK \ + (0x0U) +#define MC33775_ALLM_APP_CTRL_WR_MSK \ + (0xFFFFU) +#define MC33775_ALLM_APP_CTRL_MW_MSK \ + (0x0U) +#define MC33775_ALLM_APP_CTRL_RA_MSK \ + (0x0U) +#define MC33775_ALLM_APP_CTRL_POR_MSK \ + (0xffffU) +#define MC33775_ALLM_APP_CTRL_POR_VAL \ + (0x7c00U) + +/* Field CAPVC: Writes CAPVC for primary measurement. No influence on secondary measurement as long as it is used without the PAUSEBAL bit. */ +#define MC33775_ALLM_APP_CTRL_CAPVC_POS \ + (0U) +#define MC33775_ALLM_APP_CTRL_CAPVC_MSK \ + (0x1U) + +/* Field CAPVMODULE: Writes CAPVMODULE for primary measurement. No influence on secondary measurement as long as it is used without the PAUSEBAL bit. */ +#define MC33775_ALLM_APP_CTRL_CAPVMODULE_POS \ + (1U) +#define MC33775_ALLM_APP_CTRL_CAPVMODULE_MSK \ + (0x2U) + +/* Field CAPAIN0: Writes CAPAIN0 for primary measurement. No influence on secondary measurement as long as it is used without the PAUSEBAL bit. */ +#define MC33775_ALLM_APP_CTRL_CAPAIN0_POS \ + (2U) +#define MC33775_ALLM_APP_CTRL_CAPAIN0_MSK \ + (0x4U) + +/* Field CAPAIN1: Writes CAPAIN1 for primary measurement. No influence on secondary measurement as long as it is used without the PAUSEBAL bit. */ +#define MC33775_ALLM_APP_CTRL_CAPAIN1_POS \ + (3U) +#define MC33775_ALLM_APP_CTRL_CAPAIN1_MSK \ + (0x8U) + +/* Field CAPAIN2: Writes CAPAIN2 for primary measurement. No influence on secondary measurement as long as it is used without the PAUSEBAL bit. */ +#define MC33775_ALLM_APP_CTRL_CAPAIN2_POS \ + (4U) +#define MC33775_ALLM_APP_CTRL_CAPAIN2_MSK \ + (0x10U) + +/* Field CAPAIN3: Writes CAPAIN3 for primary measurement. No influence on secondary measurement as long as it is used without the PAUSEBAL bit. */ +#define MC33775_ALLM_APP_CTRL_CAPAIN3_POS \ + (5U) +#define MC33775_ALLM_APP_CTRL_CAPAIN3_MSK \ + (0x20U) + +/* Field CAPAIN4: No influence on primary measurement as long as it is used without the PAUSEBAL bit. Writes CAPAIN4 for secondary measurement. */ +#define MC33775_ALLM_APP_CTRL_CAPAIN4_POS \ + (6U) +#define MC33775_ALLM_APP_CTRL_CAPAIN4_MSK \ + (0x40U) + +/* Field CAPAIN5: No influence on primary measurement as long as it is used without the PAUSEBAL bit. Writes CAPAIN5 for secondary measurement. */ +#define MC33775_ALLM_APP_CTRL_CAPAIN5_POS \ + (7U) +#define MC33775_ALLM_APP_CTRL_CAPAIN5_MSK \ + (0x80U) + +/* Field CAPAIN6: No influence on primary measurement as long as it is used without the PAUSEBAL bit. Writes CAPAIN6 for secondary measurement. */ +#define MC33775_ALLM_APP_CTRL_CAPAIN6_POS \ + (8U) +#define MC33775_ALLM_APP_CTRL_CAPAIN6_MSK \ + (0x100U) + +/* Field CAPAIN7: No influence on primary measurement as long as it is used without the PAUSEBAL bit. Writes CAPAIN7 for secondary measurement. */ +#define MC33775_ALLM_APP_CTRL_CAPAIN7_POS \ + (9U) +#define MC33775_ALLM_APP_CTRL_CAPAIN7_MSK \ + (0x200U) + +/* Field VCOLNUM: Writes VCOLNUM for primary measurement, if CAPVC is set. No influence on secondary measurement. */ +#define MC33775_ALLM_APP_CTRL_VCOLNUM_POS \ + (10U) +#define MC33775_ALLM_APP_CTRL_VCOLNUM_MSK \ + (0x7C00U) + +/* Field PAUSEBAL: Writes PAUSEBAL for primary and secondary measurement. */ +#define MC33775_ALLM_APP_CTRL_PAUSEBAL_POS \ + (15U) +#define MC33775_ALLM_APP_CTRL_PAUSEBAL_MSK \ + (0x8000U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t CAPVC : 1; + volatile uint16_t CAPVMODULE : 1; + volatile uint16_t CAPAIN0 : 1; + volatile uint16_t CAPAIN1 : 1; + volatile uint16_t CAPAIN2 : 1; + volatile uint16_t CAPAIN3 : 1; + volatile uint16_t CAPAIN4 : 1; + volatile uint16_t CAPAIN5 : 1; + volatile uint16_t CAPAIN6 : 1; + volatile uint16_t CAPAIN7 : 1; + volatile uint16_t VCOLNUM : 5; + volatile uint16_t PAUSEBAL : 1; + } B; +} mc33775_all_measurement_registers_allm_app_ctrl_t; + +/* -------------------------------------------------------------------------- + * ALLM_PER_CTRL (write-only):Periodic measurement control. + * -------------------------------------------------------------------------- */ +#define MC33775_ALLM_PER_CTRL_OFFSET \ + (0x1402U) +#define MC33775_ALLM_PER_CTRL_RW_MSK \ + (0x0U) +#define MC33775_ALLM_PER_CTRL_RD_MSK \ + (0x0U) +#define MC33775_ALLM_PER_CTRL_WR_MSK \ + (0x31FFU) +#define MC33775_ALLM_PER_CTRL_MW_MSK \ + (0x0U) +#define MC33775_ALLM_PER_CTRL_RA_MSK \ + (0x0U) +#define MC33775_ALLM_PER_CTRL_POR_MSK \ + (0xffffU) +#define MC33775_ALLM_PER_CTRL_POR_VAL \ + (0x10U) + +/* Field PERLEN: Writes PERLEN for primary and secondary measurement. */ +#define MC33775_ALLM_PER_CTRL_PERLEN_POS \ + (0U) +#define MC33775_ALLM_PER_CTRL_PERLEN_MSK \ + (0x1FFU) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_ALLM_PER_CTRL_RESERVED0_POS \ + (9U) +#define MC33775_ALLM_PER_CTRL_RESERVED0_MSK \ + (0xE00U) + +/* Field PERCTRL: Writes PERCTRL for primary and secondary measurement. */ +#define MC33775_ALLM_PER_CTRL_PERCTRL_POS \ + (12U) +#define MC33775_ALLM_PER_CTRL_PERCTRL_MSK \ + (0x3000U) + +/* Field reserved1: This read-only field is reserved and always has the value 0. */ +#define MC33775_ALLM_PER_CTRL_RESERVED1_POS \ + (14U) +#define MC33775_ALLM_PER_CTRL_RESERVED1_MSK \ + (0xC000U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t PERLEN : 9; + volatile uint16_t reserved0 : 3; + volatile uint16_t PERCTRL : 2; + volatile uint16_t reserved1 : 2; + } B; +} mc33775_all_measurement_registers_allm_per_ctrl_t; + +/* -------------------------------------------------------------------------- + * ALLM_SYNC_CTRL (write-only):Synchronous measurement control. + * -------------------------------------------------------------------------- */ +#define MC33775_ALLM_SYNC_CTRL_OFFSET \ + (0x1403U) +#define MC33775_ALLM_SYNC_CTRL_RW_MSK \ + (0x0U) +#define MC33775_ALLM_SYNC_CTRL_RD_MSK \ + (0x0U) +#define MC33775_ALLM_SYNC_CTRL_WR_MSK \ + (0xFC03U) +#define MC33775_ALLM_SYNC_CTRL_MW_MSK \ + (0x0U) +#define MC33775_ALLM_SYNC_CTRL_RA_MSK \ + (0x0U) +#define MC33775_ALLM_SYNC_CTRL_POR_MSK \ + (0xffffU) +#define MC33775_ALLM_SYNC_CTRL_POR_VAL \ + (0x7c00U) + +/* Field SYNCCYC: Writes SYNCCYC for primary and secondary measurement. */ +#define MC33775_ALLM_SYNC_CTRL_SYNCCYC_POS \ + (0U) +#define MC33775_ALLM_SYNC_CTRL_SYNCCYC_MSK \ + (0x1U) + +/* Field FASTVB: Dummy fast measurement cycle on primary measurement. Writes FASTVB for secondary measurement. */ +#define MC33775_ALLM_SYNC_CTRL_FASTVB_POS \ + (1U) +#define MC33775_ALLM_SYNC_CTRL_FASTVB_MSK \ + (0x2U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_ALLM_SYNC_CTRL_RESERVED0_POS \ + (2U) +#define MC33775_ALLM_SYNC_CTRL_RESERVED0_MSK \ + (0x3FCU) + +/* Field VBOLNUM: No influence on primary measurement. Writes VBOLNUM for secondary measurement. */ +#define MC33775_ALLM_SYNC_CTRL_VBOLNUM_POS \ + (10U) +#define MC33775_ALLM_SYNC_CTRL_VBOLNUM_MSK \ + (0x7C00U) + +/* Field PAUSEBAL: Writes PAUSEBAL for primary and secondary measurement. */ +#define MC33775_ALLM_SYNC_CTRL_PAUSEBAL_POS \ + (15U) +#define MC33775_ALLM_SYNC_CTRL_PAUSEBAL_MSK \ + (0x8000U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t SYNCCYC : 1; + volatile uint16_t FASTVB : 1; + volatile uint16_t reserved0 : 8; + volatile uint16_t VBOLNUM : 5; + volatile uint16_t PAUSEBAL : 1; + } B; +} mc33775_all_measurement_registers_allm_sync_ctrl_t; + +/* -------------------------------------------------------------------------- + * ALLM_VCVB_CFG (write-only):Cell voltage measurement enable. + * -------------------------------------------------------------------------- */ +#define MC33775_ALLM_VCVB_CFG_OFFSET \ + (0x1408U) +#define MC33775_ALLM_VCVB_CFG_RW_MSK \ + (0x0U) +#define MC33775_ALLM_VCVB_CFG_RD_MSK \ + (0x0U) +#define MC33775_ALLM_VCVB_CFG_WR_MSK \ + (0x3FFFU) +#define MC33775_ALLM_VCVB_CFG_MW_MSK \ + (0x0U) +#define MC33775_ALLM_VCVB_CFG_RA_MSK \ + (0x0U) +#define MC33775_ALLM_VCVB_CFG_POR_MSK \ + (0xffffU) +#define MC33775_ALLM_VCVB_CFG_POR_VAL \ + (0x0U) + +/* Field VCVB0EN: Writes VC0EN for primary and VCVB0EN secondary measurement. */ +#define MC33775_ALLM_VCVB_CFG_VCVB0EN_POS \ + (0U) +#define MC33775_ALLM_VCVB_CFG_VCVB0EN_MSK \ + (0x1U) + +/* Field VCVB1EN: Writes VC1EN for primary and VCVB1EN secondary measurement. */ +#define MC33775_ALLM_VCVB_CFG_VCVB1EN_POS \ + (1U) +#define MC33775_ALLM_VCVB_CFG_VCVB1EN_MSK \ + (0x2U) + +/* Field VCVB2EN: Writes VC2EN for primary and VCVB2EN secondary measurement. */ +#define MC33775_ALLM_VCVB_CFG_VCVB2EN_POS \ + (2U) +#define MC33775_ALLM_VCVB_CFG_VCVB2EN_MSK \ + (0x4U) + +/* Field VCVB3EN: Writes VC3EN for primary and VCVB3EN secondary measurement. */ +#define MC33775_ALLM_VCVB_CFG_VCVB3EN_POS \ + (3U) +#define MC33775_ALLM_VCVB_CFG_VCVB3EN_MSK \ + (0x8U) + +/* Field VCVB4EN: Writes VC4EN for primary and VCVB4EN secondary measurement. */ +#define MC33775_ALLM_VCVB_CFG_VCVB4EN_POS \ + (4U) +#define MC33775_ALLM_VCVB_CFG_VCVB4EN_MSK \ + (0x10U) + +/* Field VCVB5EN: Writes VC5EN for primary and VCVB5EN secondary measurement. */ +#define MC33775_ALLM_VCVB_CFG_VCVB5EN_POS \ + (5U) +#define MC33775_ALLM_VCVB_CFG_VCVB5EN_MSK \ + (0x20U) + +/* Field VCVB6EN: Writes VC6EN for primary and VCVB6EN secondary measurement. */ +#define MC33775_ALLM_VCVB_CFG_VCVB6EN_POS \ + (6U) +#define MC33775_ALLM_VCVB_CFG_VCVB6EN_MSK \ + (0x40U) + +/* Field VCVB7EN: Writes VC7EN for primary and VCVB7EN secondary measurement. */ +#define MC33775_ALLM_VCVB_CFG_VCVB7EN_POS \ + (7U) +#define MC33775_ALLM_VCVB_CFG_VCVB7EN_MSK \ + (0x80U) + +/* Field VCVB8EN: Writes VC8EN for primary and VCVB8EN secondary measurement. */ +#define MC33775_ALLM_VCVB_CFG_VCVB8EN_POS \ + (8U) +#define MC33775_ALLM_VCVB_CFG_VCVB8EN_MSK \ + (0x100U) + +/* Field VCVB9EN: Writes VC9EN for primary and VCVB9EN secondary measurement. */ +#define MC33775_ALLM_VCVB_CFG_VCVB9EN_POS \ + (9U) +#define MC33775_ALLM_VCVB_CFG_VCVB9EN_MSK \ + (0x200U) + +/* Field VCVB10EN: Writes VC10EN for primary and VCVB10EN secondary measurement. */ +#define MC33775_ALLM_VCVB_CFG_VCVB10EN_POS \ + (10U) +#define MC33775_ALLM_VCVB_CFG_VCVB10EN_MSK \ + (0x400U) + +/* Field VCVB11EN: Writes VC11EN for primary and VCVB11EN secondary measurement. */ +#define MC33775_ALLM_VCVB_CFG_VCVB11EN_POS \ + (11U) +#define MC33775_ALLM_VCVB_CFG_VCVB11EN_MSK \ + (0x800U) + +/* Field VCVB12EN: Writes VC12EN for primary and VCVB12EN secondary measurement. */ +#define MC33775_ALLM_VCVB_CFG_VCVB12EN_POS \ + (12U) +#define MC33775_ALLM_VCVB_CFG_VCVB12EN_MSK \ + (0x1000U) + +/* Field VCVB13EN: Writes VC13EN for primary and VCVB13EN secondary measurement. */ +#define MC33775_ALLM_VCVB_CFG_VCVB13EN_POS \ + (13U) +#define MC33775_ALLM_VCVB_CFG_VCVB13EN_MSK \ + (0x2000U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_ALLM_VCVB_CFG_RESERVED0_POS \ + (14U) +#define MC33775_ALLM_VCVB_CFG_RESERVED0_MSK \ + (0xC000U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VCVB0EN : 1; + volatile uint16_t VCVB1EN : 1; + volatile uint16_t VCVB2EN : 1; + volatile uint16_t VCVB3EN : 1; + volatile uint16_t VCVB4EN : 1; + volatile uint16_t VCVB5EN : 1; + volatile uint16_t VCVB6EN : 1; + volatile uint16_t VCVB7EN : 1; + volatile uint16_t VCVB8EN : 1; + volatile uint16_t VCVB9EN : 1; + volatile uint16_t VCVB10EN : 1; + volatile uint16_t VCVB11EN : 1; + volatile uint16_t VCVB12EN : 1; + volatile uint16_t VCVB13EN : 1; + volatile uint16_t reserved0 : 2; + } B; +} mc33775_all_measurement_registers_allm_vcvb_cfg_t; + +/* -------------------------------------------------------------------------- + * SYS_CFG_CRC (read-only):System Configuration CRC + * -------------------------------------------------------------------------- */ +#define MC33775_SYS_CFG_CRC_OFFSET \ + (0x0U) +#define MC33775_SYS_CFG_CRC_RW_MSK \ + (0x0U) +#define MC33775_SYS_CFG_CRC_RD_MSK \ + (0xFFFFU) +#define MC33775_SYS_CFG_CRC_WR_MSK \ + (0x0U) +#define MC33775_SYS_CFG_CRC_MW_MSK \ + (0x0U) +#define MC33775_SYS_CFG_CRC_RA_MSK \ + (0x0U) +#define MC33775_SYS_CFG_CRC_POR_MSK \ + (0xffffU) +#define MC33775_SYS_CFG_CRC_POR_VAL \ + (0x0U) + +/* Field CRC: This CRC value is recalculated with any write to a covered register and with any read to this register. The updated CRC value is available latest 100us after the last write. The CRC value is application specific and must be re-calculated by the MCU. The used polynomial is: 0xD175 (+1) = X^16 + X^15 + X^13 + X^9 + X^7 + X^6 + X^5 + X^3 + X^1 + 1. +Following registers are included: SYS_COM_CFG, SYS_COM_TO_CFG, SYS_SUPPLY_CFG, SYS_CYC_WAKEUP_CFG, SYS_TPL_CFG. */ +#define MC33775_SYS_CFG_CRC_CRC_POS \ + (0U) +#define MC33775_SYS_CFG_CRC_CRC_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t CRC : 16; + } B; +} mc33775_system_control_registers_sys_cfg_crc_t; + +/* -------------------------------------------------------------------------- + * SYS_COM_CFG (read-write):Communication initialization. + * -------------------------------------------------------------------------- */ +#define MC33775_SYS_COM_CFG_OFFSET \ + (0x1U) +#define MC33775_SYS_COM_CFG_RW_MSK \ + (0xFFFFU) +#define MC33775_SYS_COM_CFG_RD_MSK \ + (0xFFFFU) +#define MC33775_SYS_COM_CFG_WR_MSK \ + (0xFFFFU) +#define MC33775_SYS_COM_CFG_MW_MSK \ + (0x0U) +#define MC33775_SYS_COM_CFG_RA_MSK \ + (0x0U) +#define MC33775_SYS_COM_CFG_POR_MSK \ + (0xffffU) +#define MC33775_SYS_COM_CFG_POR_VAL \ + (0x200U) + +/* Field DADD: Defines the device address. */ +#define MC33775_SYS_COM_CFG_DADD_POS \ + (0U) +#define MC33775_SYS_COM_CFG_DADD_MSK \ + (0x3FU) + +/* Enumerated value UNENUMERATED: Device is unenumerated. The bus forwarding is disabled. */ +#define MC33775_SYS_COM_CFG_DADD_UNENUMERATED_ENUM_VAL \ + (0U) + +/* Enumerated value GLOBAL: Used for global read and write Commands. */ +#define MC33775_SYS_COM_CFG_DADD_GLOBAL_ENUM_VAL \ + (63U) + +/* Field CADD: Defines the daisy chain address. Only used for responses to a all chain read request. */ +#define MC33775_SYS_COM_CFG_CADD_POS \ + (6U) +#define MC33775_SYS_COM_CFG_CADD_MSK \ + (0x1C0U) + +/* Enumerated value RESERVED: Reserved for future usage. */ +#define MC33775_SYS_COM_CFG_CADD_RESERVED_ENUM_VAL \ + (0U) + +/* Enumerated value GLOBAL: Reserved for global write commands. */ +#define MC33775_SYS_COM_CFG_CADD_GLOBAL_ENUM_VAL \ + (7U) + +/* Field BUSFW: Bus forwarding */ +#define MC33775_SYS_COM_CFG_BUSFW_POS \ + (9U) +#define MC33775_SYS_COM_CFG_BUSFW_MSK \ + (0x200U) + +/* Enumerated value DISABLED: Disabled. */ +#define MC33775_SYS_COM_CFG_BUSFW_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Enabled if DADD is unequal 00h. */ +#define MC33775_SYS_COM_CFG_BUSFW_ENABLED_ENUM_VAL \ + (1U) + +/* Field NUMNODES: Number of nodes in the Daisy-Chain. Difference of NUMNODES and DADD defines the wait time for global write commands. */ +#define MC33775_SYS_COM_CFG_NUMNODES_POS \ + (10U) +#define MC33775_SYS_COM_CFG_NUMNODES_MSK \ + (0xFC00U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t DADD : 6; + volatile uint16_t CADD : 3; + volatile uint16_t BUSFW : 1; + volatile uint16_t NUMNODES : 6; + } B; +} mc33775_system_control_registers_sys_com_cfg_t; + +/* -------------------------------------------------------------------------- + * SYS_COM_TO_CFG (read-write):System communication timeout. + * -------------------------------------------------------------------------- */ +#define MC33775_SYS_COM_TO_CFG_OFFSET \ + (0x2U) +#define MC33775_SYS_COM_TO_CFG_RW_MSK \ + (0xFFFFU) +#define MC33775_SYS_COM_TO_CFG_RD_MSK \ + (0xFFFFU) +#define MC33775_SYS_COM_TO_CFG_WR_MSK \ + (0xFFFFU) +#define MC33775_SYS_COM_TO_CFG_MW_MSK \ + (0x0U) +#define MC33775_SYS_COM_TO_CFG_RA_MSK \ + (0x0U) +#define MC33775_SYS_COM_TO_CFG_POR_MSK \ + (0xffffU) +#define MC33775_SYS_COM_TO_CFG_POR_VAL \ + (0x1eU) + +/* Field COMTO: Communication timeout time LSB = 10msec. A value of 0 is treated as 10ms. */ +#define MC33775_SYS_COM_TO_CFG_COMTO_POS \ + (0U) +#define MC33775_SYS_COM_TO_CFG_COMTO_MSK \ + (0xFFU) + +/* Enumerated value T_MIN: 10 milliseconds */ +#define MC33775_SYS_COM_TO_CFG_COMTO_T_MIN_ENUM_VAL \ + (0U) + +/* Enumerated value T_10m: 10 milliseconds */ +#define MC33775_SYS_COM_TO_CFG_COMTO_T_10M_ENUM_VAL \ + (1U) + +/* Enumerated value T_MAX: 2550 milliseconds */ +#define MC33775_SYS_COM_TO_CFG_COMTO_T_MAX_ENUM_VAL \ + (255U) + +/* Field COMTODISABLE: Communication timeout disable. Only intendet for software development activities. Must never be used in release software. */ +#define MC33775_SYS_COM_TO_CFG_COMTODISABLE_POS \ + (8U) +#define MC33775_SYS_COM_TO_CFG_COMTODISABLE_MSK \ + (0xFF00U) + +/* Enumerated value DISABLED: Communication timeout disabled. */ +#define MC33775_SYS_COM_TO_CFG_COMTODISABLE_DISABLED_ENUM_VAL \ + (90U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t COMTO : 8; + volatile uint16_t COMTODISABLE : 8; + } B; +} mc33775_system_control_registers_sys_com_to_cfg_t; + +/* -------------------------------------------------------------------------- + * SYS_SUPPLY_CFG (read-write):Supply configuration. + * -------------------------------------------------------------------------- */ +#define MC33775_SYS_SUPPLY_CFG_OFFSET \ + (0x3U) +#define MC33775_SYS_SUPPLY_CFG_RW_MSK \ + (0x8007U) +#define MC33775_SYS_SUPPLY_CFG_RD_MSK \ + (0x8007U) +#define MC33775_SYS_SUPPLY_CFG_WR_MSK \ + (0x8007U) +#define MC33775_SYS_SUPPLY_CFG_MW_MSK \ + (0x0U) +#define MC33775_SYS_SUPPLY_CFG_RA_MSK \ + (0x0U) +#define MC33775_SYS_SUPPLY_CFG_POR_MSK \ + (0xffffU) +#define MC33775_SYS_SUPPLY_CFG_POR_VAL \ + (0x8003U) + +/* Field VAUXACT: Enable VAUX in active mode. */ +#define MC33775_SYS_SUPPLY_CFG_VAUXACT_POS \ + (0U) +#define MC33775_SYS_SUPPLY_CFG_VAUXACT_MSK \ + (0x1U) + +/* Enumerated value DISABLED: VAUX is disabled in active mode */ +#define MC33775_SYS_SUPPLY_CFG_VAUXACT_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: VAUX is enabled in active mode */ +#define MC33775_SYS_SUPPLY_CFG_VAUXACT_ENABLED_ENUM_VAL \ + (1U) + +/* Field VAUXCYC: Enable VAUX in cyclic mode. */ +#define MC33775_SYS_SUPPLY_CFG_VAUXCYC_POS \ + (1U) +#define MC33775_SYS_SUPPLY_CFG_VAUXCYC_MSK \ + (0x2U) + +/* Enumerated value DISABLED: VAUX is disabled in cyclic mode */ +#define MC33775_SYS_SUPPLY_CFG_VAUXCYC_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: VAUX is enabled in cyclic mode */ +#define MC33775_SYS_SUPPLY_CFG_VAUXCYC_ENABLED_ENUM_VAL \ + (1U) + +/* Field VDDCCYC: Enable VDDC in cyclic mode. */ +#define MC33775_SYS_SUPPLY_CFG_VDDCCYC_POS \ + (2U) +#define MC33775_SYS_SUPPLY_CFG_VDDCCYC_MSK \ + (0x4U) + +/* Enumerated value DISABLED: VDDC is disabled in cyclic mode */ +#define MC33775_SYS_SUPPLY_CFG_VDDCCYC_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: VDDC is enabled in cyclic mode */ +#define MC33775_SYS_SUPPLY_CFG_VDDCCYC_ENABLED_ENUM_VAL \ + (1U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_SYS_SUPPLY_CFG_RESERVED0_POS \ + (3U) +#define MC33775_SYS_SUPPLY_CFG_RESERVED0_MSK \ + (0x7FF8U) + +/* Field CURMATCH: Enable IC supply current matching in active mode. */ +#define MC33775_SYS_SUPPLY_CFG_CURMATCH_POS \ + (15U) +#define MC33775_SYS_SUPPLY_CFG_CURMATCH_MSK \ + (0x8000U) + +/* Enumerated value DISABLED: Supply current matching is disabled */ +#define MC33775_SYS_SUPPLY_CFG_CURMATCH_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Supply current matching is enabled */ +#define MC33775_SYS_SUPPLY_CFG_CURMATCH_ENABLED_ENUM_VAL \ + (1U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VAUXACT : 1; + volatile uint16_t VAUXCYC : 1; + volatile uint16_t VDDCCYC : 1; + volatile uint16_t reserved0 : 12; + volatile uint16_t CURMATCH : 1; + } B; +} mc33775_system_control_registers_sys_supply_cfg_t; + +/* -------------------------------------------------------------------------- + * SYS_MODE (read-write):System mode. + * -------------------------------------------------------------------------- */ +#define MC33775_SYS_MODE_OFFSET \ + (0x4U) +#define MC33775_SYS_MODE_RW_MSK \ + (0x0U) +#define MC33775_SYS_MODE_RD_MSK \ + (0x1F00U) +#define MC33775_SYS_MODE_WR_MSK \ + (0x1FU) +#define MC33775_SYS_MODE_MW_MSK \ + (0x0U) +#define MC33775_SYS_MODE_RA_MSK \ + (0x0U) +#define MC33775_SYS_MODE_POR_MSK \ + (0xffffU) +#define MC33775_SYS_MODE_POR_VAL \ + (0x1400U) + +/* Field TARGETMODE: Target_mode. The mode transition starts immediately after writing. 01010 = sleep, 10100 = deep sleep, Undefined values are ignored. */ +#define MC33775_SYS_MODE_TARGETMODE_POS \ + (0U) +#define MC33775_SYS_MODE_TARGETMODE_MSK \ + (0x1FU) + +/* Enumerated value SLEEP: Sleep mode */ +#define MC33775_SYS_MODE_TARGETMODE_SLEEP_ENUM_VAL \ + (10U) + +/* Enumerated value DEEPSLEEP: Deep sleep mode */ +#define MC33775_SYS_MODE_TARGETMODE_DEEPSLEEP_ENUM_VAL \ + (20U) + +/* Enumerated value RESERVED: Cyclic mode (not for customer use) */ +#define MC33775_SYS_MODE_TARGETMODE_RESERVED_ENUM_VAL \ + (31U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_SYS_MODE_RESERVED0_POS \ + (5U) +#define MC33775_SYS_MODE_RESERVED0_MSK \ + (0xE0U) + +/* Field PREVMODE: Previous mode. */ +#define MC33775_SYS_MODE_PREVMODE_POS \ + (8U) +#define MC33775_SYS_MODE_PREVMODE_MSK \ + (0x1F00U) + +/* Enumerated value SLEEP: Sleep mode */ +#define MC33775_SYS_MODE_PREVMODE_SLEEP_ENUM_VAL \ + (10U) + +/* Enumerated value DEEPSLEEP: Deep sleep mode */ +#define MC33775_SYS_MODE_PREVMODE_DEEPSLEEP_ENUM_VAL \ + (20U) + +/* Enumerated value CYCLIC: Cyclic mode */ +#define MC33775_SYS_MODE_PREVMODE_CYCLIC_ENUM_VAL \ + (31U) + +/* Field reserved1: This read-only field is reserved and always has the value 0. */ +#define MC33775_SYS_MODE_RESERVED1_POS \ + (13U) +#define MC33775_SYS_MODE_RESERVED1_MSK \ + (0xE000U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t TARGETMODE : 5; + volatile uint16_t reserved0 : 3; + volatile uint16_t PREVMODE : 5; + volatile uint16_t reserved1 : 3; + } B; +} mc33775_system_control_registers_sys_mode_t; + +/* -------------------------------------------------------------------------- + * SYS_CYC_WAKEUP_CFG (read-write):Interval for cyclic measurements. + * -------------------------------------------------------------------------- */ +#define MC33775_SYS_CYC_WAKEUP_CFG_OFFSET \ + (0x5U) +#define MC33775_SYS_CYC_WAKEUP_CFG_RW_MSK \ + (0xFFFFU) +#define MC33775_SYS_CYC_WAKEUP_CFG_RD_MSK \ + (0xFFFFU) +#define MC33775_SYS_CYC_WAKEUP_CFG_WR_MSK \ + (0xFFFFU) +#define MC33775_SYS_CYC_WAKEUP_CFG_MW_MSK \ + (0x0U) +#define MC33775_SYS_CYC_WAKEUP_CFG_RA_MSK \ + (0x0U) +#define MC33775_SYS_CYC_WAKEUP_CFG_POR_MSK \ + (0xffffU) +#define MC33775_SYS_CYC_WAKEUP_CFG_POR_VAL \ + (0x0U) + +/* Field PERIOD: Time between two cyclic wake-up events. */ +#define MC33775_SYS_CYC_WAKEUP_CFG_PERIOD_POS \ + (0U) +#define MC33775_SYS_CYC_WAKEUP_CFG_PERIOD_MSK \ + (0xFFFFU) + +/* Enumerated value DISABLED: Cyclic wakeup disabled. */ +#define MC33775_SYS_CYC_WAKEUP_CFG_PERIOD_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value PERIOD: PERIOD * 100ms */ +#define MC33775_SYS_CYC_WAKEUP_CFG_PERIOD_PERIOD_ENUM_VAL \ + (1U) + +/* Enumerated value PERIOD_MAX: Maximum period time = 6553500 ms = approximately 1.8h */ +#define MC33775_SYS_CYC_WAKEUP_CFG_PERIOD_PERIOD_MAX_ENUM_VAL \ + (65535U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t PERIOD : 16; + } B; +} mc33775_system_control_registers_sys_cyc_wakeup_cfg_t; + +/* -------------------------------------------------------------------------- + * SYS_TPL_CFG (read-write):TPL configuration (RESERVED for customer) + * -------------------------------------------------------------------------- */ +#define MC33775_SYS_TPL_CFG_OFFSET \ + (0x6U) +#define MC33775_SYS_TPL_CFG_RW_MSK \ + (0x1FU) +#define MC33775_SYS_TPL_CFG_RD_MSK \ + (0x1FU) +#define MC33775_SYS_TPL_CFG_WR_MSK \ + (0x1FU) +#define MC33775_SYS_TPL_CFG_MW_MSK \ + (0x0U) +#define MC33775_SYS_TPL_CFG_RA_MSK \ + (0x0U) +#define MC33775_SYS_TPL_CFG_POR_MSK \ + (0xffffU) +#define MC33775_SYS_TPL_CFG_POR_VAL \ + (0x10U) + +/* Field WAKEUPCOMPL: Defines compatibility for the lower TPL port. (Pin 45 and pin 46) */ +#define MC33775_SYS_TPL_CFG_WAKEUPCOMPL_POS \ + (0U) +#define MC33775_SYS_TPL_CFG_WAKEUPCOMPL_MSK \ + (0x1U) + +/* Enumerated value MC33775A: Wake-up signal is compatible to MC33775A. */ +#define MC33775_SYS_TPL_CFG_WAKEUPCOMPL_MC33775A_ENUM_VAL \ + (0U) + +/* Enumerated value MC33664: Wake-up signal is compatible to MC33664. */ +#define MC33775_SYS_TPL_CFG_WAKEUPCOMPL_MC33664_ENUM_VAL \ + (1U) + +/* Field WAKEUPCOMPH: Defines compatibility for the upper TPL port. (Pin 47 and pin 48) */ +#define MC33775_SYS_TPL_CFG_WAKEUPCOMPH_POS \ + (1U) +#define MC33775_SYS_TPL_CFG_WAKEUPCOMPH_MSK \ + (0x2U) + +/* Enumerated value MC33775A: Wake-up signal is compatible to MC33775A. */ +#define MC33775_SYS_TPL_CFG_WAKEUPCOMPH_MC33775A_ENUM_VAL \ + (0U) + +/* Enumerated value MC33664: Wake-up signal is compatible to MC33664. */ +#define MC33775_SYS_TPL_CFG_WAKEUPCOMPH_MC33664_ENUM_VAL \ + (1U) + +/* Field TXTERML: Termination active while transmit for the lower TPL port. (Pin 45 and pin 46) */ +#define MC33775_SYS_TPL_CFG_TXTERML_POS \ + (2U) +#define MC33775_SYS_TPL_CFG_TXTERML_MSK \ + (0x4U) + +/* Enumerated value DISABLED: Disabled. Termination inactive during transmit. Required for normal TPL operation. */ +#define MC33775_SYS_TPL_CFG_TXTERML_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Enabled. Termination active during transmit. Only needed at final daisy-chain node to have equal power consumption. */ +#define MC33775_SYS_TPL_CFG_TXTERML_ENABLED_ENUM_VAL \ + (1U) + +/* Field TXTERMH: Termination active while transmit for the higher TPL port. (Pin 47 and pin 48) */ +#define MC33775_SYS_TPL_CFG_TXTERMH_POS \ + (3U) +#define MC33775_SYS_TPL_CFG_TXTERMH_MSK \ + (0x8U) + +/* Enumerated value DISABLED: Disabled. Termination inactive during transmit. Required for normal TPL operation. */ +#define MC33775_SYS_TPL_CFG_TXTERMH_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Enabled. Termination active during transmit. Only needed at final daisy-chain node to have equal power consumption. */ +#define MC33775_SYS_TPL_CFG_TXTERMH_ENABLED_ENUM_VAL \ + (1U) + +/* Field DUALRESP: Dual response */ +#define MC33775_SYS_TPL_CFG_DUALRESP_POS \ + (4U) +#define MC33775_SYS_TPL_CFG_DUALRESP_MSK \ + (0x10U) + +/* Enumerated value DISABLED: Disabled. Responses are only transmitted at one side. */ +#define MC33775_SYS_TPL_CFG_DUALRESP_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Enabled.Responses are transmitted on both sides if DADD is unequal 00h. */ +#define MC33775_SYS_TPL_CFG_DUALRESP_ENABLED_ENUM_VAL \ + (1U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_SYS_TPL_CFG_RESERVED0_POS \ + (5U) +#define MC33775_SYS_TPL_CFG_RESERVED0_MSK \ + (0xFFE0U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t WAKEUPCOMPL : 1; + volatile uint16_t WAKEUPCOMPH : 1; + volatile uint16_t TXTERML : 1; + volatile uint16_t TXTERMH : 1; + volatile uint16_t DUALRESP : 1; + volatile uint16_t reserved0 : 11; + } B; +} mc33775_system_control_registers_sys_tpl_cfg_t; + +/* -------------------------------------------------------------------------- + * SYS_CLK_SYNC_CTRL (read-write):Clock Synchronization. + * -------------------------------------------------------------------------- */ +#define MC33775_SYS_CLK_SYNC_CTRL_OFFSET \ + (0x8U) +#define MC33775_SYS_CLK_SYNC_CTRL_RW_MSK \ + (0xFFFFU) +#define MC33775_SYS_CLK_SYNC_CTRL_RD_MSK \ + (0xFFFFU) +#define MC33775_SYS_CLK_SYNC_CTRL_WR_MSK \ + (0xFFFFU) +#define MC33775_SYS_CLK_SYNC_CTRL_MW_MSK \ + (0x0U) +#define MC33775_SYS_CLK_SYNC_CTRL_RA_MSK \ + (0x0U) +#define MC33775_SYS_CLK_SYNC_CTRL_POR_MSK \ + (0xffffU) +#define MC33775_SYS_CLK_SYNC_CTRL_POR_VAL \ + (0x0U) + +/* Field SYNCCNT: Synchronization counter value: Writing a 0x0000 resets the counter with no adjustment. For other values it is checked if the internal counter value is higher, in which case the oscillator frequency is decreased. If it is lower the internal oscillator frequency is increased. Reading the value returns the current internal counter value. 1 LSB = 10us. */ +#define MC33775_SYS_CLK_SYNC_CTRL_SYNCCNT_POS \ + (0U) +#define MC33775_SYS_CLK_SYNC_CTRL_SYNCCNT_MSK \ + (0xFFFFU) + +/* Enumerated value RESET: Counter is reset with no adjustment. */ +#define MC33775_SYS_CLK_SYNC_CTRL_SYNCCNT_RESET_ENUM_VAL \ + (0U) + +/* Enumerated value ADJUST: 10 us. */ +#define MC33775_SYS_CLK_SYNC_CTRL_SYNCCNT_ADJUST_ENUM_VAL \ + (1U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t SYNCCNT : 16; + } B; +} mc33775_system_control_registers_sys_clk_sync_ctrl_t; + +/* -------------------------------------------------------------------------- + * SYS_VERSION (read-only):Device silicon identifier. + * -------------------------------------------------------------------------- */ +#define MC33775_SYS_VERSION_OFFSET \ + (0x10U) +#define MC33775_SYS_VERSION_RW_MSK \ + (0x0U) +#define MC33775_SYS_VERSION_RD_MSK \ + (0xFFFFU) +#define MC33775_SYS_VERSION_WR_MSK \ + (0x0U) +#define MC33775_SYS_VERSION_MW_MSK \ + (0x0U) +#define MC33775_SYS_VERSION_RA_MSK \ + (0x0U) +#define MC33775_SYS_VERSION_POR_MSK \ + (0xffffU) +#define MC33775_SYS_VERSION_POR_VAL \ + (0x0U) + +/* Field MREV: Metal revision ID. */ +#define MC33775_SYS_VERSION_MREV_POS \ + (0U) +#define MC33775_SYS_VERSION_MREV_MSK \ + (0xFU) + +/* Field FREV: Full mask revision ID. */ +#define MC33775_SYS_VERSION_FREV_POS \ + (4U) +#define MC33775_SYS_VERSION_FREV_MSK \ + (0xF0U) + +/* Field TYPE: Type identifier. */ +#define MC33775_SYS_VERSION_TYPE_POS \ + (8U) +#define MC33775_SYS_VERSION_TYPE_MSK \ + (0xFF00U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t MREV : 4; + volatile uint16_t FREV : 4; + volatile uint16_t TYPE : 8; + } B; +} mc33775_system_control_registers_sys_version_t; + +/* -------------------------------------------------------------------------- + * SYS_UID_LOW (read-only):Unique device ID lower part. + * -------------------------------------------------------------------------- */ +#define MC33775_SYS_UID_LOW_OFFSET \ + (0x11U) +#define MC33775_SYS_UID_LOW_RW_MSK \ + (0x0U) +#define MC33775_SYS_UID_LOW_RD_MSK \ + (0xFFFFU) +#define MC33775_SYS_UID_LOW_WR_MSK \ + (0x0U) +#define MC33775_SYS_UID_LOW_MW_MSK \ + (0x0U) +#define MC33775_SYS_UID_LOW_RA_MSK \ + (0x0U) +#define MC33775_SYS_UID_LOW_POR_MSK \ + (0xffffU) +#define MC33775_SYS_UID_LOW_POR_VAL \ + (0x0U) + +/* Field LOW: Lower part of unique device ID (encoded: wafer-lot, wafer-number, device coordinates, testprogram and test-steps). */ +#define MC33775_SYS_UID_LOW_LOW_POS \ + (0U) +#define MC33775_SYS_UID_LOW_LOW_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t LOW : 16; + } B; +} mc33775_system_control_registers_sys_uid_low_t; + +/* -------------------------------------------------------------------------- + * SYS_UID_MID (read-only):Unique device ID middle part. + * -------------------------------------------------------------------------- */ +#define MC33775_SYS_UID_MID_OFFSET \ + (0x12U) +#define MC33775_SYS_UID_MID_RW_MSK \ + (0x0U) +#define MC33775_SYS_UID_MID_RD_MSK \ + (0xFFFFU) +#define MC33775_SYS_UID_MID_WR_MSK \ + (0x0U) +#define MC33775_SYS_UID_MID_MW_MSK \ + (0x0U) +#define MC33775_SYS_UID_MID_RA_MSK \ + (0x0U) +#define MC33775_SYS_UID_MID_POR_MSK \ + (0xffffU) +#define MC33775_SYS_UID_MID_POR_VAL \ + (0x0U) + +/* Field MID: Middle part of unique device ID (encoded: wafer-lot, wafer-number, device coordinates, testprogram and test-steps). */ +#define MC33775_SYS_UID_MID_MID_POS \ + (0U) +#define MC33775_SYS_UID_MID_MID_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t MID : 16; + } B; +} mc33775_system_control_registers_sys_uid_mid_t; + +/* -------------------------------------------------------------------------- + * SYS_UID_HIGH (read-only):Unique device ID higher part. + * -------------------------------------------------------------------------- */ +#define MC33775_SYS_UID_HIGH_OFFSET \ + (0x13U) +#define MC33775_SYS_UID_HIGH_RW_MSK \ + (0x0U) +#define MC33775_SYS_UID_HIGH_RD_MSK \ + (0xFFFFU) +#define MC33775_SYS_UID_HIGH_WR_MSK \ + (0x0U) +#define MC33775_SYS_UID_HIGH_MW_MSK \ + (0x0U) +#define MC33775_SYS_UID_HIGH_RA_MSK \ + (0x0U) +#define MC33775_SYS_UID_HIGH_POR_MSK \ + (0xffffU) +#define MC33775_SYS_UID_HIGH_POR_VAL \ + (0x0U) + +/* Field HIGH: Higher part of unique device ID (encoded: wafer-lot, wafer-number, device coordinates, testprogram and test-steps). */ +#define MC33775_SYS_UID_HIGH_HIGH_POS \ + (0U) +#define MC33775_SYS_UID_HIGH_HIGH_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t HIGH : 16; + } B; +} mc33775_system_control_registers_sys_uid_high_t; + +/* -------------------------------------------------------------------------- + * SYS_DS_STORAGE0 (read-write):Deep Sleep Storage Data0. The value is stored in the ULP domain. + * -------------------------------------------------------------------------- */ +#define MC33775_SYS_DS_STORAGE0_OFFSET \ + (0x80U) +#define MC33775_SYS_DS_STORAGE0_RW_MSK \ + (0xFFFFU) +#define MC33775_SYS_DS_STORAGE0_RD_MSK \ + (0xFFFFU) +#define MC33775_SYS_DS_STORAGE0_WR_MSK \ + (0xFFFFU) +#define MC33775_SYS_DS_STORAGE0_MW_MSK \ + (0x0U) +#define MC33775_SYS_DS_STORAGE0_RA_MSK \ + (0x0U) +#define MC33775_SYS_DS_STORAGE0_POR_MSK \ + (0xffffU) +#define MC33775_SYS_DS_STORAGE0_POR_VAL \ + (0x0U) + +/* Field DATA: Deep Sleep surviving data. This register has no reset. This register allows to store application data and has no influence on the device. */ +#define MC33775_SYS_DS_STORAGE0_DATA_POS \ + (0U) +#define MC33775_SYS_DS_STORAGE0_DATA_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t DATA : 16; + } B; +} mc33775_system_control_registers_sys_ds_storage0_t; + +/* -------------------------------------------------------------------------- + * SYS_DS_STORAGE1 (read-write):Deep Sleep Storage Data1. The value is stored in the ULP domain. + * -------------------------------------------------------------------------- */ +#define MC33775_SYS_DS_STORAGE1_OFFSET \ + (0x81U) +#define MC33775_SYS_DS_STORAGE1_RW_MSK \ + (0xFFFFU) +#define MC33775_SYS_DS_STORAGE1_RD_MSK \ + (0xFFFFU) +#define MC33775_SYS_DS_STORAGE1_WR_MSK \ + (0xFFFFU) +#define MC33775_SYS_DS_STORAGE1_MW_MSK \ + (0x0U) +#define MC33775_SYS_DS_STORAGE1_RA_MSK \ + (0x0U) +#define MC33775_SYS_DS_STORAGE1_POR_MSK \ + (0xffffU) +#define MC33775_SYS_DS_STORAGE1_POR_VAL \ + (0x0U) + +/* Field DATA: Deep Sleep surviving data. This register has no reset. This register allows to store application data and has no influence on the device. */ +#define MC33775_SYS_DS_STORAGE1_DATA_POS \ + (0U) +#define MC33775_SYS_DS_STORAGE1_DATA_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t DATA : 16; + } B; +} mc33775_system_control_registers_sys_ds_storage1_t; + +/* -------------------------------------------------------------------------- + * FEH_CFG_CRC (read-only):Configuration CRC + * -------------------------------------------------------------------------- */ +#define MC33775_FEH_CFG_CRC_OFFSET \ + (0x400U) +#define MC33775_FEH_CFG_CRC_RW_MSK \ + (0x0U) +#define MC33775_FEH_CFG_CRC_RD_MSK \ + (0xFFFFU) +#define MC33775_FEH_CFG_CRC_WR_MSK \ + (0x0U) +#define MC33775_FEH_CFG_CRC_MW_MSK \ + (0x0U) +#define MC33775_FEH_CFG_CRC_RA_MSK \ + (0x0U) +#define MC33775_FEH_CFG_CRC_POR_MSK \ + (0xffffU) +#define MC33775_FEH_CFG_CRC_POR_VAL \ + (0x0U) + +/* Field CRC: This CRC value is recalculated with any write to a covered register and with any read to this register. The updated CRC value is available latest 100us after the last write. The CRC value is application specific and must be re-calculated by the MCU. The used polynomial is: 0xD175 (+1) = X^16 + X^15 + X^13 + X^9 + X^7 + X^6 + X^5 + X^3 + X^1 + 1. +Following registers are included: FEH_ALARM_CFG, FEH_ALARM_OUT_CFG, FEH_WAKEUP_CFG, FEH_SUPPLY_FLT_POR_CFG0, FEH_SUPPLY_FLT_POR_CFG1, FEH_ANA_FLT_POR_CFG, FEH_COM_FLT_POR_CFG, FEH_SUPPLY_FLT_EVT_CFG0, FEH_SUPPLY_FLT_EVT_CFG1, FEH_ANA_FLT_EVT_CFG, FEH_COM_FLT_EVT_CFG, FEH_MEAS_FLT_EVT_CFG. */ +#define MC33775_FEH_CFG_CRC_CRC_POS \ + (0U) +#define MC33775_FEH_CFG_CRC_CRC_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t CRC : 16; + } B; +} mc33775_event_handling_registers_feh_cfg_crc_t; + +/* -------------------------------------------------------------------------- + * FEH_ALARM_CFG (read-write):General alarm configuration. + * -------------------------------------------------------------------------- */ +#define MC33775_FEH_ALARM_CFG_OFFSET \ + (0x401U) +#define MC33775_FEH_ALARM_CFG_RW_MSK \ + (0xFFU) +#define MC33775_FEH_ALARM_CFG_RD_MSK \ + (0xFFU) +#define MC33775_FEH_ALARM_CFG_WR_MSK \ + (0xFFU) +#define MC33775_FEH_ALARM_CFG_MW_MSK \ + (0x0U) +#define MC33775_FEH_ALARM_CFG_RA_MSK \ + (0x0U) +#define MC33775_FEH_ALARM_CFG_POR_MSK \ + (0xffffU) +#define MC33775_FEH_ALARM_CFG_POR_VAL \ + (0x0U) + +/* Field ALARMIN: Enable alarm input Enabling the alarm input automatically enables the digital receiver for the Alarm input pin. */ +#define MC33775_FEH_ALARM_CFG_ALARMIN_POS \ + (0U) +#define MC33775_FEH_ALARM_CFG_ALARMIN_MSK \ + (0x3U) + +/* Enumerated value DISABLED: Alarm input is disabled */ +#define MC33775_FEH_ALARM_CFG_ALARMIN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value HIGH_ACTIVE: Alarm input is enabled, high active */ +#define MC33775_FEH_ALARM_CFG_ALARMIN_HIGH_ACTIVE_ENUM_VAL \ + (1U) + +/* Enumerated value LOW_ACTIVE: Alarm input is enabled, low active */ +#define MC33775_FEH_ALARM_CFG_ALARMIN_LOW_ACTIVE_ENUM_VAL \ + (2U) + +/* Enumerated value HEARTBEAT: Alarm input is enabled, heartbeat configuration */ +#define MC33775_FEH_ALARM_CFG_ALARMIN_HEARTBEAT_ENUM_VAL \ + (3U) + +/* Field ALARMINHB: Input heartbeat low time setting */ +#define MC33775_FEH_ALARM_CFG_ALARMINHB_POS \ + (2U) +#define MC33775_FEH_ALARM_CFG_ALARMINHB_MSK \ + (0xCU) + +/* Enumerated value T_500u: 500 us */ +#define MC33775_FEH_ALARM_CFG_ALARMINHB_T_500U_ENUM_VAL \ + (0U) + +/* Enumerated value T_1ms: 1 ms */ +#define MC33775_FEH_ALARM_CFG_ALARMINHB_T_1MS_ENUM_VAL \ + (1U) + +/* Enumerated value T_10ms: 10 ms */ +#define MC33775_FEH_ALARM_CFG_ALARMINHB_T_10MS_ENUM_VAL \ + (2U) + +/* Enumerated value T_100ms: 100 ms */ +#define MC33775_FEH_ALARM_CFG_ALARMINHB_T_100MS_ENUM_VAL \ + (3U) + +/* Field ALARMOUT: Enable alarm output */ +#define MC33775_FEH_ALARM_CFG_ALARMOUT_POS \ + (4U) +#define MC33775_FEH_ALARM_CFG_ALARMOUT_MSK \ + (0x30U) + +/* Enumerated value DISABLED: disabled. Alarm output is fixed low */ +#define MC33775_FEH_ALARM_CFG_ALARMOUT_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value HIGH_ACTIVE: high active */ +#define MC33775_FEH_ALARM_CFG_ALARMOUT_HIGH_ACTIVE_ENUM_VAL \ + (1U) + +/* Enumerated value LOW_ACTIVE: low active */ +#define MC33775_FEH_ALARM_CFG_ALARMOUT_LOW_ACTIVE_ENUM_VAL \ + (2U) + +/* Enumerated value HEARTBEAT: heartbeat configuration */ +#define MC33775_FEH_ALARM_CFG_ALARMOUT_HEARTBEAT_ENUM_VAL \ + (3U) + +/* Field ALARMOUTHB: Output heartbeat low time setting */ +#define MC33775_FEH_ALARM_CFG_ALARMOUTHB_POS \ + (6U) +#define MC33775_FEH_ALARM_CFG_ALARMOUTHB_MSK \ + (0xC0U) + +/* Enumerated value T_500u: 500 us */ +#define MC33775_FEH_ALARM_CFG_ALARMOUTHB_T_500U_ENUM_VAL \ + (0U) + +/* Enumerated value T_1ms: 1 ms */ +#define MC33775_FEH_ALARM_CFG_ALARMOUTHB_T_1MS_ENUM_VAL \ + (1U) + +/* Enumerated value T_10ms: 10 ms */ +#define MC33775_FEH_ALARM_CFG_ALARMOUTHB_T_10MS_ENUM_VAL \ + (2U) + +/* Enumerated value T_100ms: 100 ms */ +#define MC33775_FEH_ALARM_CFG_ALARMOUTHB_T_100MS_ENUM_VAL \ + (3U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_FEH_ALARM_CFG_RESERVED0_POS \ + (8U) +#define MC33775_FEH_ALARM_CFG_RESERVED0_MSK \ + (0xFF00U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t ALARMIN : 2; + volatile uint16_t ALARMINHB : 2; + volatile uint16_t ALARMOUT : 2; + volatile uint16_t ALARMOUTHB : 2; + volatile uint16_t reserved0 : 8; + } B; +} mc33775_event_handling_registers_feh_alarm_cfg_t; + +/* -------------------------------------------------------------------------- + * FEH_ALARM_OUT_CFG (read-write):Alarm output source selection. + * -------------------------------------------------------------------------- */ +#define MC33775_FEH_ALARM_OUT_CFG_OFFSET \ + (0x402U) +#define MC33775_FEH_ALARM_OUT_CFG_RW_MSK \ + (0x7FFFU) +#define MC33775_FEH_ALARM_OUT_CFG_RD_MSK \ + (0x7FFFU) +#define MC33775_FEH_ALARM_OUT_CFG_WR_MSK \ + (0x7FFFU) +#define MC33775_FEH_ALARM_OUT_CFG_MW_MSK \ + (0x0U) +#define MC33775_FEH_ALARM_OUT_CFG_RA_MSK \ + (0x0U) +#define MC33775_FEH_ALARM_OUT_CFG_POR_MSK \ + (0xffffU) +#define MC33775_FEH_ALARM_OUT_CFG_POR_VAL \ + (0x0U) + +/* Field VCOV: Enable output on alarm output for VC_OV. */ +#define MC33775_FEH_ALARM_OUT_CFG_VCOV_POS \ + (0U) +#define MC33775_FEH_ALARM_OUT_CFG_VCOV_MSK \ + (0x1U) + +/* Enumerated value DISABLED: disabled */ +#define MC33775_FEH_ALARM_OUT_CFG_VCOV_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: enabled */ +#define MC33775_FEH_ALARM_OUT_CFG_VCOV_ENABLED_ENUM_VAL \ + (1U) + +/* Field VCUV0: Enable output on alarm output for VC_UV0. */ +#define MC33775_FEH_ALARM_OUT_CFG_VCUV0_POS \ + (1U) +#define MC33775_FEH_ALARM_OUT_CFG_VCUV0_MSK \ + (0x2U) + +/* Enumerated value DISABLED: disabled */ +#define MC33775_FEH_ALARM_OUT_CFG_VCUV0_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: enabled */ +#define MC33775_FEH_ALARM_OUT_CFG_VCUV0_ENABLED_ENUM_VAL \ + (1U) + +/* Field VCUV1: Enable output on alarm output for VC_UV1. */ +#define MC33775_FEH_ALARM_OUT_CFG_VCUV1_POS \ + (2U) +#define MC33775_FEH_ALARM_OUT_CFG_VCUV1_MSK \ + (0x4U) + +/* Enumerated value DISABLED: disabled */ +#define MC33775_FEH_ALARM_OUT_CFG_VCUV1_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: enabled */ +#define MC33775_FEH_ALARM_OUT_CFG_VCUV1_ENABLED_ENUM_VAL \ + (1U) + +/* Field AIN0OV: Enable output on alarm output for AIN0_OV. */ +#define MC33775_FEH_ALARM_OUT_CFG_AIN0OV_POS \ + (3U) +#define MC33775_FEH_ALARM_OUT_CFG_AIN0OV_MSK \ + (0x8U) + +/* Enumerated value DISABLED: disabled */ +#define MC33775_FEH_ALARM_OUT_CFG_AIN0OV_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: enabled */ +#define MC33775_FEH_ALARM_OUT_CFG_AIN0OV_ENABLED_ENUM_VAL \ + (1U) + +/* Field AIN0UV: Enable output on alarm output for AIN0_UV. */ +#define MC33775_FEH_ALARM_OUT_CFG_AIN0UV_POS \ + (4U) +#define MC33775_FEH_ALARM_OUT_CFG_AIN0UV_MSK \ + (0x10U) + +/* Enumerated value DISABLED: disabled */ +#define MC33775_FEH_ALARM_OUT_CFG_AIN0UV_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: enabled */ +#define MC33775_FEH_ALARM_OUT_CFG_AIN0UV_ENABLED_ENUM_VAL \ + (1U) + +/* Field AIN1OV: Enable output on alarm output for AIN1_OV. */ +#define MC33775_FEH_ALARM_OUT_CFG_AIN1OV_POS \ + (5U) +#define MC33775_FEH_ALARM_OUT_CFG_AIN1OV_MSK \ + (0x20U) + +/* Enumerated value DISABLED: disabled */ +#define MC33775_FEH_ALARM_OUT_CFG_AIN1OV_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: enabled */ +#define MC33775_FEH_ALARM_OUT_CFG_AIN1OV_ENABLED_ENUM_VAL \ + (1U) + +/* Field AIN1UV: Enable output on alarm output for AIN1_UV. */ +#define MC33775_FEH_ALARM_OUT_CFG_AIN1UV_POS \ + (6U) +#define MC33775_FEH_ALARM_OUT_CFG_AIN1UV_MSK \ + (0x40U) + +/* Enumerated value DISABLED: disabled */ +#define MC33775_FEH_ALARM_OUT_CFG_AIN1UV_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: enabled */ +#define MC33775_FEH_ALARM_OUT_CFG_AIN1UV_ENABLED_ENUM_VAL \ + (1U) + +/* Field AIN2OV: Enable output on alarm output for AIN2_OV. */ +#define MC33775_FEH_ALARM_OUT_CFG_AIN2OV_POS \ + (7U) +#define MC33775_FEH_ALARM_OUT_CFG_AIN2OV_MSK \ + (0x80U) + +/* Enumerated value DISABLED: disabled */ +#define MC33775_FEH_ALARM_OUT_CFG_AIN2OV_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: enabled */ +#define MC33775_FEH_ALARM_OUT_CFG_AIN2OV_ENABLED_ENUM_VAL \ + (1U) + +/* Field AIN2UV: Enable output on alarm output for AIN2_UV. */ +#define MC33775_FEH_ALARM_OUT_CFG_AIN2UV_POS \ + (8U) +#define MC33775_FEH_ALARM_OUT_CFG_AIN2UV_MSK \ + (0x100U) + +/* Enumerated value DISABLED: disabled */ +#define MC33775_FEH_ALARM_OUT_CFG_AIN2UV_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: enabled */ +#define MC33775_FEH_ALARM_OUT_CFG_AIN2UV_ENABLED_ENUM_VAL \ + (1U) + +/* Field AIN3OV: Enable output on alarm output for AIN3_OV. */ +#define MC33775_FEH_ALARM_OUT_CFG_AIN3OV_POS \ + (9U) +#define MC33775_FEH_ALARM_OUT_CFG_AIN3OV_MSK \ + (0x200U) + +/* Enumerated value DISABLED: disabled */ +#define MC33775_FEH_ALARM_OUT_CFG_AIN3OV_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: enabled */ +#define MC33775_FEH_ALARM_OUT_CFG_AIN3OV_ENABLED_ENUM_VAL \ + (1U) + +/* Field AIN3UV: Enable output on alarm output for AIN3_UV. */ +#define MC33775_FEH_ALARM_OUT_CFG_AIN3UV_POS \ + (10U) +#define MC33775_FEH_ALARM_OUT_CFG_AIN3UV_MSK \ + (0x400U) + +/* Enumerated value DISABLED: disabled */ +#define MC33775_FEH_ALARM_OUT_CFG_AIN3UV_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: enabled */ +#define MC33775_FEH_ALARM_OUT_CFG_AIN3UV_ENABLED_ENUM_VAL \ + (1U) + +/* Field ALARMIN: Enable output on alarm output for detected alarm input. */ +#define MC33775_FEH_ALARM_OUT_CFG_ALARMIN_POS \ + (11U) +#define MC33775_FEH_ALARM_OUT_CFG_ALARMIN_MSK \ + (0x800U) + +/* Enumerated value DISABLED: disabled */ +#define MC33775_FEH_ALARM_OUT_CFG_ALARMIN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: enabled */ +#define MC33775_FEH_ALARM_OUT_CFG_ALARMIN_ENABLED_ENUM_VAL \ + (1U) + +/* Field WAKEUPIN: Enable output on detected wakeup input. Enabling this bit automatically enables the digital receiver for the wakeup input pin. */ +#define MC33775_FEH_ALARM_OUT_CFG_WAKEUPIN_POS \ + (12U) +#define MC33775_FEH_ALARM_OUT_CFG_WAKEUPIN_MSK \ + (0x1000U) + +/* Enumerated value DISABLED: disabled */ +#define MC33775_FEH_ALARM_OUT_CFG_WAKEUPIN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: enabled */ +#define MC33775_FEH_ALARM_OUT_CFG_WAKEUPIN_ENABLED_ENUM_VAL \ + (1U) + +/* Field BALRDY: Enable output on alarm output for cell voltage balancing ready. */ +#define MC33775_FEH_ALARM_OUT_CFG_BALRDY_POS \ + (13U) +#define MC33775_FEH_ALARM_OUT_CFG_BALRDY_MSK \ + (0x2000U) + +/* Enumerated value DISABLED: disabled */ +#define MC33775_FEH_ALARM_OUT_CFG_BALRDY_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: enabled */ +#define MC33775_FEH_ALARM_OUT_CFG_BALRDY_ENABLED_ENUM_VAL \ + (1U) + +/* Field SYSFLTEVT: Enable output on alarm output for a detected and selected system fault. */ +#define MC33775_FEH_ALARM_OUT_CFG_SYSFLTEVT_POS \ + (14U) +#define MC33775_FEH_ALARM_OUT_CFG_SYSFLTEVT_MSK \ + (0x4000U) + +/* Enumerated value DISABLED: disabled */ +#define MC33775_FEH_ALARM_OUT_CFG_SYSFLTEVT_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: enabled */ +#define MC33775_FEH_ALARM_OUT_CFG_SYSFLTEVT_ENABLED_ENUM_VAL \ + (1U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_FEH_ALARM_OUT_CFG_RESERVED0_POS \ + (15U) +#define MC33775_FEH_ALARM_OUT_CFG_RESERVED0_MSK \ + (0x8000U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VCOV : 1; + volatile uint16_t VCUV0 : 1; + volatile uint16_t VCUV1 : 1; + volatile uint16_t AIN0OV : 1; + volatile uint16_t AIN0UV : 1; + volatile uint16_t AIN1OV : 1; + volatile uint16_t AIN1UV : 1; + volatile uint16_t AIN2OV : 1; + volatile uint16_t AIN2UV : 1; + volatile uint16_t AIN3OV : 1; + volatile uint16_t AIN3UV : 1; + volatile uint16_t ALARMIN : 1; + volatile uint16_t WAKEUPIN : 1; + volatile uint16_t BALRDY : 1; + volatile uint16_t SYSFLTEVT : 1; + volatile uint16_t reserved0 : 1; + } B; +} mc33775_event_handling_registers_feh_alarm_out_cfg_t; + +/* -------------------------------------------------------------------------- + * FEH_ALARM_OUT_REASON (read-only):Alarm output reason. + * -------------------------------------------------------------------------- */ +#define MC33775_FEH_ALARM_OUT_REASON_OFFSET \ + (0x403U) +#define MC33775_FEH_ALARM_OUT_REASON_RW_MSK \ + (0x0U) +#define MC33775_FEH_ALARM_OUT_REASON_RD_MSK \ + (0x7FFFU) +#define MC33775_FEH_ALARM_OUT_REASON_WR_MSK \ + (0x0U) +#define MC33775_FEH_ALARM_OUT_REASON_MW_MSK \ + (0x0U) +#define MC33775_FEH_ALARM_OUT_REASON_RA_MSK \ + (0x7FFFU) +#define MC33775_FEH_ALARM_OUT_REASON_POR_MSK \ + (0xffffU) +#define MC33775_FEH_ALARM_OUT_REASON_POR_VAL \ + (0x0U) + +/* Field VCOV: VC_OV */ +#define MC33775_FEH_ALARM_OUT_REASON_VCOV_POS \ + (0U) +#define MC33775_FEH_ALARM_OUT_REASON_VCOV_MSK \ + (0x1U) + +/* Enumerated value NO_ALARM: Alarm not caused by VC_OV */ +#define MC33775_FEH_ALARM_OUT_REASON_VCOV_NO_ALARM_ENUM_VAL \ + (0U) + +/* Enumerated value ALARM: Alarm caused by VC_OV */ +#define MC33775_FEH_ALARM_OUT_REASON_VCOV_ALARM_ENUM_VAL \ + (1U) + +/* Field VCUV0: VC_UV0 */ +#define MC33775_FEH_ALARM_OUT_REASON_VCUV0_POS \ + (1U) +#define MC33775_FEH_ALARM_OUT_REASON_VCUV0_MSK \ + (0x2U) + +/* Enumerated value NO_ALARM: Alarm not caused by VC_UV0 */ +#define MC33775_FEH_ALARM_OUT_REASON_VCUV0_NO_ALARM_ENUM_VAL \ + (0U) + +/* Enumerated value ALARM: Alarm caused by VC_UV0 */ +#define MC33775_FEH_ALARM_OUT_REASON_VCUV0_ALARM_ENUM_VAL \ + (1U) + +/* Field VCUV1: VC_UV1 */ +#define MC33775_FEH_ALARM_OUT_REASON_VCUV1_POS \ + (2U) +#define MC33775_FEH_ALARM_OUT_REASON_VCUV1_MSK \ + (0x4U) + +/* Enumerated value NO_ALARM: Alarm not caused by VC_UV1 */ +#define MC33775_FEH_ALARM_OUT_REASON_VCUV1_NO_ALARM_ENUM_VAL \ + (0U) + +/* Enumerated value ALARM: Alarm caused by VC_UV1 */ +#define MC33775_FEH_ALARM_OUT_REASON_VCUV1_ALARM_ENUM_VAL \ + (1U) + +/* Field AIN0OV: AIN0_OV */ +#define MC33775_FEH_ALARM_OUT_REASON_AIN0OV_POS \ + (3U) +#define MC33775_FEH_ALARM_OUT_REASON_AIN0OV_MSK \ + (0x8U) + +/* Enumerated value NO_ALARM: Alarm not caused by AIN0_OV */ +#define MC33775_FEH_ALARM_OUT_REASON_AIN0OV_NO_ALARM_ENUM_VAL \ + (0U) + +/* Enumerated value ALARM: Alarm caused by AIN0_OV */ +#define MC33775_FEH_ALARM_OUT_REASON_AIN0OV_ALARM_ENUM_VAL \ + (1U) + +/* Field AIN0UV: AIN0_UV */ +#define MC33775_FEH_ALARM_OUT_REASON_AIN0UV_POS \ + (4U) +#define MC33775_FEH_ALARM_OUT_REASON_AIN0UV_MSK \ + (0x10U) + +/* Enumerated value NO_ALARM: Alarm not caused by AIN0_UV */ +#define MC33775_FEH_ALARM_OUT_REASON_AIN0UV_NO_ALARM_ENUM_VAL \ + (0U) + +/* Enumerated value ALARM: Alarm caused by AIN0_UV */ +#define MC33775_FEH_ALARM_OUT_REASON_AIN0UV_ALARM_ENUM_VAL \ + (1U) + +/* Field AIN1OV: AIN1_OV */ +#define MC33775_FEH_ALARM_OUT_REASON_AIN1OV_POS \ + (5U) +#define MC33775_FEH_ALARM_OUT_REASON_AIN1OV_MSK \ + (0x20U) + +/* Enumerated value NO_ALARM: Alarm not caused by AIN1_OV */ +#define MC33775_FEH_ALARM_OUT_REASON_AIN1OV_NO_ALARM_ENUM_VAL \ + (0U) + +/* Enumerated value ALARM: Alarm caused by AIN1_OV */ +#define MC33775_FEH_ALARM_OUT_REASON_AIN1OV_ALARM_ENUM_VAL \ + (1U) + +/* Field AIN1UV: AIN1_UV */ +#define MC33775_FEH_ALARM_OUT_REASON_AIN1UV_POS \ + (6U) +#define MC33775_FEH_ALARM_OUT_REASON_AIN1UV_MSK \ + (0x40U) + +/* Enumerated value NO_ALARM: Alarm not caused by AIN1_UV */ +#define MC33775_FEH_ALARM_OUT_REASON_AIN1UV_NO_ALARM_ENUM_VAL \ + (0U) + +/* Enumerated value ALARM: Alarm caused by AIN1_UV */ +#define MC33775_FEH_ALARM_OUT_REASON_AIN1UV_ALARM_ENUM_VAL \ + (1U) + +/* Field AIN2OV: AIN2_OV */ +#define MC33775_FEH_ALARM_OUT_REASON_AIN2OV_POS \ + (7U) +#define MC33775_FEH_ALARM_OUT_REASON_AIN2OV_MSK \ + (0x80U) + +/* Enumerated value NO_ALARM: Alarm not caused by AIN2_OV */ +#define MC33775_FEH_ALARM_OUT_REASON_AIN2OV_NO_ALARM_ENUM_VAL \ + (0U) + +/* Enumerated value ALARM: Alarm caused by AIN2_OV */ +#define MC33775_FEH_ALARM_OUT_REASON_AIN2OV_ALARM_ENUM_VAL \ + (1U) + +/* Field AIN2UV: AIN2_UV */ +#define MC33775_FEH_ALARM_OUT_REASON_AIN2UV_POS \ + (8U) +#define MC33775_FEH_ALARM_OUT_REASON_AIN2UV_MSK \ + (0x100U) + +/* Enumerated value NO_ALARM: Alarm not caused by AIN2_UV */ +#define MC33775_FEH_ALARM_OUT_REASON_AIN2UV_NO_ALARM_ENUM_VAL \ + (0U) + +/* Enumerated value ALARM: Alarm caused by AIN2_UV */ +#define MC33775_FEH_ALARM_OUT_REASON_AIN2UV_ALARM_ENUM_VAL \ + (1U) + +/* Field AIN3OV: AIN3_OV */ +#define MC33775_FEH_ALARM_OUT_REASON_AIN3OV_POS \ + (9U) +#define MC33775_FEH_ALARM_OUT_REASON_AIN3OV_MSK \ + (0x200U) + +/* Enumerated value NO_ALARM: Alarm not caused by AIN3_OV */ +#define MC33775_FEH_ALARM_OUT_REASON_AIN3OV_NO_ALARM_ENUM_VAL \ + (0U) + +/* Enumerated value ALARM: Alarm caused by AIN3_OV */ +#define MC33775_FEH_ALARM_OUT_REASON_AIN3OV_ALARM_ENUM_VAL \ + (1U) + +/* Field AIN3UV: AIN3_UV */ +#define MC33775_FEH_ALARM_OUT_REASON_AIN3UV_POS \ + (10U) +#define MC33775_FEH_ALARM_OUT_REASON_AIN3UV_MSK \ + (0x400U) + +/* Enumerated value NO_ALARM: Alarm not caused by AIN3_UV */ +#define MC33775_FEH_ALARM_OUT_REASON_AIN3UV_NO_ALARM_ENUM_VAL \ + (0U) + +/* Enumerated value ALARM: Alarm caused by AIN3_UV */ +#define MC33775_FEH_ALARM_OUT_REASON_AIN3UV_ALARM_ENUM_VAL \ + (1U) + +/* Field ALARMIN: Detected alarm input */ +#define MC33775_FEH_ALARM_OUT_REASON_ALARMIN_POS \ + (11U) +#define MC33775_FEH_ALARM_OUT_REASON_ALARMIN_MSK \ + (0x800U) + +/* Enumerated value NO_ALARM: Alarm not caused by detected alarm input */ +#define MC33775_FEH_ALARM_OUT_REASON_ALARMIN_NO_ALARM_ENUM_VAL \ + (0U) + +/* Enumerated value ALARM: Alarm caused by detected alarm input */ +#define MC33775_FEH_ALARM_OUT_REASON_ALARMIN_ALARM_ENUM_VAL \ + (1U) + +/* Field WAKEUPIN: Detected wakeup input */ +#define MC33775_FEH_ALARM_OUT_REASON_WAKEUPIN_POS \ + (12U) +#define MC33775_FEH_ALARM_OUT_REASON_WAKEUPIN_MSK \ + (0x1000U) + +/* Enumerated value NO_ALARM: Alarm not caused by detected wakeup input */ +#define MC33775_FEH_ALARM_OUT_REASON_WAKEUPIN_NO_ALARM_ENUM_VAL \ + (0U) + +/* Enumerated value ALARM: Alarm caused by detected wakeup input */ +#define MC33775_FEH_ALARM_OUT_REASON_WAKEUPIN_ALARM_ENUM_VAL \ + (1U) + +/* Field BALRDY: Cell voltage balancing ready */ +#define MC33775_FEH_ALARM_OUT_REASON_BALRDY_POS \ + (13U) +#define MC33775_FEH_ALARM_OUT_REASON_BALRDY_MSK \ + (0x2000U) + +/* Enumerated value NO_ALARM: Alarm not caused by cell voltage balancing ready */ +#define MC33775_FEH_ALARM_OUT_REASON_BALRDY_NO_ALARM_ENUM_VAL \ + (0U) + +/* Enumerated value ALARM: Alarm caused by cell voltage balancing ready */ +#define MC33775_FEH_ALARM_OUT_REASON_BALRDY_ALARM_ENUM_VAL \ + (1U) + +/* Field SYSFLTEVT: Detected system fault. */ +#define MC33775_FEH_ALARM_OUT_REASON_SYSFLTEVT_POS \ + (14U) +#define MC33775_FEH_ALARM_OUT_REASON_SYSFLTEVT_MSK \ + (0x4000U) + +/* Enumerated value NO_ALARM: Alarm not caused by detected system fault */ +#define MC33775_FEH_ALARM_OUT_REASON_SYSFLTEVT_NO_ALARM_ENUM_VAL \ + (0U) + +/* Enumerated value ALARM: Alarm caused by detected system fault */ +#define MC33775_FEH_ALARM_OUT_REASON_SYSFLTEVT_ALARM_ENUM_VAL \ + (1U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_FEH_ALARM_OUT_REASON_RESERVED0_POS \ + (15U) +#define MC33775_FEH_ALARM_OUT_REASON_RESERVED0_MSK \ + (0x8000U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VCOV : 1; + volatile uint16_t VCUV0 : 1; + volatile uint16_t VCUV1 : 1; + volatile uint16_t AIN0OV : 1; + volatile uint16_t AIN0UV : 1; + volatile uint16_t AIN1OV : 1; + volatile uint16_t AIN1UV : 1; + volatile uint16_t AIN2OV : 1; + volatile uint16_t AIN2UV : 1; + volatile uint16_t AIN3OV : 1; + volatile uint16_t AIN3UV : 1; + volatile uint16_t ALARMIN : 1; + volatile uint16_t WAKEUPIN : 1; + volatile uint16_t BALRDY : 1; + volatile uint16_t SYSFLTEVT : 1; + volatile uint16_t reserved0 : 1; + } B; +} mc33775_event_handling_registers_feh_alarm_out_reason_t; + +/* -------------------------------------------------------------------------- + * FEH_WAKEUP_CFG (read-write):Wake up source configuration. + * -------------------------------------------------------------------------- */ +#define MC33775_FEH_WAKEUP_CFG_OFFSET \ + (0x408U) +#define MC33775_FEH_WAKEUP_CFG_RW_MSK \ + (0xFFFFU) +#define MC33775_FEH_WAKEUP_CFG_RD_MSK \ + (0xFFFFU) +#define MC33775_FEH_WAKEUP_CFG_WR_MSK \ + (0xFFFFU) +#define MC33775_FEH_WAKEUP_CFG_MW_MSK \ + (0x0U) +#define MC33775_FEH_WAKEUP_CFG_RA_MSK \ + (0x0U) +#define MC33775_FEH_WAKEUP_CFG_POR_MSK \ + (0xffffU) +#define MC33775_FEH_WAKEUP_CFG_POR_VAL \ + (0x0U) + +/* Field VCOV: Enable wakeup on VC_OV. */ +#define MC33775_FEH_WAKEUP_CFG_VCOV_POS \ + (0U) +#define MC33775_FEH_WAKEUP_CFG_VCOV_MSK \ + (0x1U) + +/* Enumerated value DISABLED: disabled */ +#define MC33775_FEH_WAKEUP_CFG_VCOV_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: enabled */ +#define MC33775_FEH_WAKEUP_CFG_VCOV_ENABLED_ENUM_VAL \ + (1U) + +/* Field VCUV0: Enable wakeup on VC_UV0. */ +#define MC33775_FEH_WAKEUP_CFG_VCUV0_POS \ + (1U) +#define MC33775_FEH_WAKEUP_CFG_VCUV0_MSK \ + (0x2U) + +/* Enumerated value DISABLED: disabled */ +#define MC33775_FEH_WAKEUP_CFG_VCUV0_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: enabled */ +#define MC33775_FEH_WAKEUP_CFG_VCUV0_ENABLED_ENUM_VAL \ + (1U) + +/* Field VCUV1: Enable wakeup on VC_UV1. */ +#define MC33775_FEH_WAKEUP_CFG_VCUV1_POS \ + (2U) +#define MC33775_FEH_WAKEUP_CFG_VCUV1_MSK \ + (0x4U) + +/* Enumerated value DISABLED: disabled */ +#define MC33775_FEH_WAKEUP_CFG_VCUV1_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: enabled */ +#define MC33775_FEH_WAKEUP_CFG_VCUV1_ENABLED_ENUM_VAL \ + (1U) + +/* Field AIN0OV: Enable wakeup on AIN0_OV. */ +#define MC33775_FEH_WAKEUP_CFG_AIN0OV_POS \ + (3U) +#define MC33775_FEH_WAKEUP_CFG_AIN0OV_MSK \ + (0x8U) + +/* Enumerated value DISABLED: disabled */ +#define MC33775_FEH_WAKEUP_CFG_AIN0OV_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: enabled */ +#define MC33775_FEH_WAKEUP_CFG_AIN0OV_ENABLED_ENUM_VAL \ + (1U) + +/* Field AIN0UV: Enable wakeup on AIN0_UV. */ +#define MC33775_FEH_WAKEUP_CFG_AIN0UV_POS \ + (4U) +#define MC33775_FEH_WAKEUP_CFG_AIN0UV_MSK \ + (0x10U) + +/* Enumerated value DISABLED: disabled */ +#define MC33775_FEH_WAKEUP_CFG_AIN0UV_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: enabled */ +#define MC33775_FEH_WAKEUP_CFG_AIN0UV_ENABLED_ENUM_VAL \ + (1U) + +/* Field AIN1OV: Enable wakeup on AIN1_OV. */ +#define MC33775_FEH_WAKEUP_CFG_AIN1OV_POS \ + (5U) +#define MC33775_FEH_WAKEUP_CFG_AIN1OV_MSK \ + (0x20U) + +/* Enumerated value DISABLED: disabled */ +#define MC33775_FEH_WAKEUP_CFG_AIN1OV_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: enabled */ +#define MC33775_FEH_WAKEUP_CFG_AIN1OV_ENABLED_ENUM_VAL \ + (1U) + +/* Field AIN1UV: Enable wakeup on AIN1_UV. */ +#define MC33775_FEH_WAKEUP_CFG_AIN1UV_POS \ + (6U) +#define MC33775_FEH_WAKEUP_CFG_AIN1UV_MSK \ + (0x40U) + +/* Enumerated value DISABLED: disabled */ +#define MC33775_FEH_WAKEUP_CFG_AIN1UV_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: enabled */ +#define MC33775_FEH_WAKEUP_CFG_AIN1UV_ENABLED_ENUM_VAL \ + (1U) + +/* Field AIN2OV: Enable wakeup on AIN2_OV. */ +#define MC33775_FEH_WAKEUP_CFG_AIN2OV_POS \ + (7U) +#define MC33775_FEH_WAKEUP_CFG_AIN2OV_MSK \ + (0x80U) + +/* Enumerated value DISABLED: disabled */ +#define MC33775_FEH_WAKEUP_CFG_AIN2OV_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: enabled */ +#define MC33775_FEH_WAKEUP_CFG_AIN2OV_ENABLED_ENUM_VAL \ + (1U) + +/* Field AIN2UV: Enable wakeup on AIN2_UV. */ +#define MC33775_FEH_WAKEUP_CFG_AIN2UV_POS \ + (8U) +#define MC33775_FEH_WAKEUP_CFG_AIN2UV_MSK \ + (0x100U) + +/* Enumerated value DISABLED: disabled */ +#define MC33775_FEH_WAKEUP_CFG_AIN2UV_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: enabled */ +#define MC33775_FEH_WAKEUP_CFG_AIN2UV_ENABLED_ENUM_VAL \ + (1U) + +/* Field AIN3OV: Enable wakeup on AIN3_OV. */ +#define MC33775_FEH_WAKEUP_CFG_AIN3OV_POS \ + (9U) +#define MC33775_FEH_WAKEUP_CFG_AIN3OV_MSK \ + (0x200U) + +/* Enumerated value DISABLED: disabled */ +#define MC33775_FEH_WAKEUP_CFG_AIN3OV_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: enabled */ +#define MC33775_FEH_WAKEUP_CFG_AIN3OV_ENABLED_ENUM_VAL \ + (1U) + +/* Field AIN3UV: Enable wakeup on AIN3_UV. */ +#define MC33775_FEH_WAKEUP_CFG_AIN3UV_POS \ + (10U) +#define MC33775_FEH_WAKEUP_CFG_AIN3UV_MSK \ + (0x400U) + +/* Enumerated value DISABLED: disabled */ +#define MC33775_FEH_WAKEUP_CFG_AIN3UV_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: enabled */ +#define MC33775_FEH_WAKEUP_CFG_AIN3UV_ENABLED_ENUM_VAL \ + (1U) + +/* Field ALARMIN: Enable wakeup on detected alarm input */ +#define MC33775_FEH_WAKEUP_CFG_ALARMIN_POS \ + (11U) +#define MC33775_FEH_WAKEUP_CFG_ALARMIN_MSK \ + (0x800U) + +/* Enumerated value DISABLED: disabled */ +#define MC33775_FEH_WAKEUP_CFG_ALARMIN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: enabled */ +#define MC33775_FEH_WAKEUP_CFG_ALARMIN_ENABLED_ENUM_VAL \ + (1U) + +/* Field WAKEUPIN: Enable wakeup on detected wakeup input. Enabling this bit automatically enables the digital receiver for wake-up input 0. */ +#define MC33775_FEH_WAKEUP_CFG_WAKEUPIN_POS \ + (12U) +#define MC33775_FEH_WAKEUP_CFG_WAKEUPIN_MSK \ + (0x1000U) + +/* Enumerated value DISABLED: disabled */ +#define MC33775_FEH_WAKEUP_CFG_WAKEUPIN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: enabled */ +#define MC33775_FEH_WAKEUP_CFG_WAKEUPIN_ENABLED_ENUM_VAL \ + (1U) + +/* Field BALRDY: Enable wakeup on cell voltage balancing ready. */ +#define MC33775_FEH_WAKEUP_CFG_BALRDY_POS \ + (13U) +#define MC33775_FEH_WAKEUP_CFG_BALRDY_MSK \ + (0x2000U) + +/* Enumerated value DISABLED: disabled */ +#define MC33775_FEH_WAKEUP_CFG_BALRDY_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: enabled */ +#define MC33775_FEH_WAKEUP_CFG_BALRDY_ENABLED_ENUM_VAL \ + (1U) + +/* Field SYSFLTEVT: Enable wakeup on a detected system fault. */ +#define MC33775_FEH_WAKEUP_CFG_SYSFLTEVT_POS \ + (14U) +#define MC33775_FEH_WAKEUP_CFG_SYSFLTEVT_MSK \ + (0x4000U) + +/* Enumerated value DISABLED: disabled */ +#define MC33775_FEH_WAKEUP_CFG_SYSFLTEVT_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: enabled */ +#define MC33775_FEH_WAKEUP_CFG_SYSFLTEVT_ENABLED_ENUM_VAL \ + (1U) + +/* Field TPLWAKEUP: Wake TPL */ +#define MC33775_FEH_WAKEUP_CFG_TPLWAKEUP_POS \ + (15U) +#define MC33775_FEH_WAKEUP_CFG_TPLWAKEUP_MSK \ + (0x8000U) + +/* Enumerated value DISABLED: disabled */ +#define MC33775_FEH_WAKEUP_CFG_TPLWAKEUP_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: enabled. Device sends wake-up frames on TPL if wake-up reason was other than communication */ +#define MC33775_FEH_WAKEUP_CFG_TPLWAKEUP_ENABLED_ENUM_VAL \ + (1U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VCOV : 1; + volatile uint16_t VCUV0 : 1; + volatile uint16_t VCUV1 : 1; + volatile uint16_t AIN0OV : 1; + volatile uint16_t AIN0UV : 1; + volatile uint16_t AIN1OV : 1; + volatile uint16_t AIN1UV : 1; + volatile uint16_t AIN2OV : 1; + volatile uint16_t AIN2UV : 1; + volatile uint16_t AIN3OV : 1; + volatile uint16_t AIN3UV : 1; + volatile uint16_t ALARMIN : 1; + volatile uint16_t WAKEUPIN : 1; + volatile uint16_t BALRDY : 1; + volatile uint16_t SYSFLTEVT : 1; + volatile uint16_t TPLWAKEUP : 1; + } B; +} mc33775_event_handling_registers_feh_wakeup_cfg_t; + +/* -------------------------------------------------------------------------- + * FEH_WAKEUP_REASON (read-only):Wake up reason register. + * -------------------------------------------------------------------------- */ +#define MC33775_FEH_WAKEUP_REASON_OFFSET \ + (0x409U) +#define MC33775_FEH_WAKEUP_REASON_RW_MSK \ + (0x0U) +#define MC33775_FEH_WAKEUP_REASON_RD_MSK \ + (0xFFFFU) +#define MC33775_FEH_WAKEUP_REASON_WR_MSK \ + (0x0U) +#define MC33775_FEH_WAKEUP_REASON_MW_MSK \ + (0x0U) +#define MC33775_FEH_WAKEUP_REASON_RA_MSK \ + (0xFFFFU) +#define MC33775_FEH_WAKEUP_REASON_POR_MSK \ + (0xffffU) +#define MC33775_FEH_WAKEUP_REASON_POR_VAL \ + (0x0U) + +/* Field VCOV: VC_OV */ +#define MC33775_FEH_WAKEUP_REASON_VCOV_POS \ + (0U) +#define MC33775_FEH_WAKEUP_REASON_VCOV_MSK \ + (0x1U) + +/* Enumerated value NO_WAKE: Wakeup not caused by VC_OV */ +#define MC33775_FEH_WAKEUP_REASON_VCOV_NO_WAKE_ENUM_VAL \ + (0U) + +/* Enumerated value WAKE_UP: Wakeup caused by VC_OV */ +#define MC33775_FEH_WAKEUP_REASON_VCOV_WAKE_UP_ENUM_VAL \ + (1U) + +/* Field VCUV0: VC_UV0 */ +#define MC33775_FEH_WAKEUP_REASON_VCUV0_POS \ + (1U) +#define MC33775_FEH_WAKEUP_REASON_VCUV0_MSK \ + (0x2U) + +/* Enumerated value NO_WAKE: Wakeup not caused by VC_UV0 */ +#define MC33775_FEH_WAKEUP_REASON_VCUV0_NO_WAKE_ENUM_VAL \ + (0U) + +/* Enumerated value WAKE_UP: Wakeup caused by VC_UV0 */ +#define MC33775_FEH_WAKEUP_REASON_VCUV0_WAKE_UP_ENUM_VAL \ + (1U) + +/* Field VCUV1: VC_UV1 */ +#define MC33775_FEH_WAKEUP_REASON_VCUV1_POS \ + (2U) +#define MC33775_FEH_WAKEUP_REASON_VCUV1_MSK \ + (0x4U) + +/* Enumerated value NO_WAKE: Wakeup not caused by VC_UV1 */ +#define MC33775_FEH_WAKEUP_REASON_VCUV1_NO_WAKE_ENUM_VAL \ + (0U) + +/* Enumerated value WAKE_UP: Wakeup caused by VC_UV1 */ +#define MC33775_FEH_WAKEUP_REASON_VCUV1_WAKE_UP_ENUM_VAL \ + (1U) + +/* Field AIN0OV: AIN0_OV */ +#define MC33775_FEH_WAKEUP_REASON_AIN0OV_POS \ + (3U) +#define MC33775_FEH_WAKEUP_REASON_AIN0OV_MSK \ + (0x8U) + +/* Enumerated value NO_WAKE: Wakeup not caused by AIN0_OV */ +#define MC33775_FEH_WAKEUP_REASON_AIN0OV_NO_WAKE_ENUM_VAL \ + (0U) + +/* Enumerated value WAKE_UP: Wakeup caused by AIN0_OV */ +#define MC33775_FEH_WAKEUP_REASON_AIN0OV_WAKE_UP_ENUM_VAL \ + (1U) + +/* Field AIN0UV: AIN0_UV */ +#define MC33775_FEH_WAKEUP_REASON_AIN0UV_POS \ + (4U) +#define MC33775_FEH_WAKEUP_REASON_AIN0UV_MSK \ + (0x10U) + +/* Enumerated value NO_WAKE: Wakeup not caused by AIN0_UV */ +#define MC33775_FEH_WAKEUP_REASON_AIN0UV_NO_WAKE_ENUM_VAL \ + (0U) + +/* Enumerated value WAKE_UP: Wakeup caused by AIN0_UV */ +#define MC33775_FEH_WAKEUP_REASON_AIN0UV_WAKE_UP_ENUM_VAL \ + (1U) + +/* Field AIN1OV: AIN1_OV */ +#define MC33775_FEH_WAKEUP_REASON_AIN1OV_POS \ + (5U) +#define MC33775_FEH_WAKEUP_REASON_AIN1OV_MSK \ + (0x20U) + +/* Enumerated value NO_WAKE: Wakeup not caused by AIN1_OV */ +#define MC33775_FEH_WAKEUP_REASON_AIN1OV_NO_WAKE_ENUM_VAL \ + (0U) + +/* Enumerated value WAKE_UP: Wakeup caused by AIN1_OV */ +#define MC33775_FEH_WAKEUP_REASON_AIN1OV_WAKE_UP_ENUM_VAL \ + (1U) + +/* Field AIN1UV: AIN1_UV */ +#define MC33775_FEH_WAKEUP_REASON_AIN1UV_POS \ + (6U) +#define MC33775_FEH_WAKEUP_REASON_AIN1UV_MSK \ + (0x40U) + +/* Enumerated value NO_WAKE: Wakeup not caused by AIN1_UV */ +#define MC33775_FEH_WAKEUP_REASON_AIN1UV_NO_WAKE_ENUM_VAL \ + (0U) + +/* Enumerated value WAKE_UP: Wakeup caused by AIN1_UV */ +#define MC33775_FEH_WAKEUP_REASON_AIN1UV_WAKE_UP_ENUM_VAL \ + (1U) + +/* Field AIN2OV: AIN2_OV */ +#define MC33775_FEH_WAKEUP_REASON_AIN2OV_POS \ + (7U) +#define MC33775_FEH_WAKEUP_REASON_AIN2OV_MSK \ + (0x80U) + +/* Enumerated value NO_WAKE: Wakeup not caused by AIN2_OV */ +#define MC33775_FEH_WAKEUP_REASON_AIN2OV_NO_WAKE_ENUM_VAL \ + (0U) + +/* Enumerated value WAKE_UP: Wakeup caused by AIN2_OV */ +#define MC33775_FEH_WAKEUP_REASON_AIN2OV_WAKE_UP_ENUM_VAL \ + (1U) + +/* Field AIN2UV: AIN2_UV */ +#define MC33775_FEH_WAKEUP_REASON_AIN2UV_POS \ + (8U) +#define MC33775_FEH_WAKEUP_REASON_AIN2UV_MSK \ + (0x100U) + +/* Enumerated value NO_WAKE: Wakeup not caused by AIN2_UV */ +#define MC33775_FEH_WAKEUP_REASON_AIN2UV_NO_WAKE_ENUM_VAL \ + (0U) + +/* Enumerated value WAKE_UP: Wakeup caused by AIN2_UV */ +#define MC33775_FEH_WAKEUP_REASON_AIN2UV_WAKE_UP_ENUM_VAL \ + (1U) + +/* Field AIN3OV: AIN3_OV */ +#define MC33775_FEH_WAKEUP_REASON_AIN3OV_POS \ + (9U) +#define MC33775_FEH_WAKEUP_REASON_AIN3OV_MSK \ + (0x200U) + +/* Enumerated value NO_WAKE: Wakeup not caused by AIN3_OV */ +#define MC33775_FEH_WAKEUP_REASON_AIN3OV_NO_WAKE_ENUM_VAL \ + (0U) + +/* Enumerated value WAKE_UP: Wakeup caused by AIN3_OV */ +#define MC33775_FEH_WAKEUP_REASON_AIN3OV_WAKE_UP_ENUM_VAL \ + (1U) + +/* Field AIN3UV: AIN3_UV */ +#define MC33775_FEH_WAKEUP_REASON_AIN3UV_POS \ + (10U) +#define MC33775_FEH_WAKEUP_REASON_AIN3UV_MSK \ + (0x400U) + +/* Enumerated value NO_WAKE: Wakeup not caused by AIN3_UV */ +#define MC33775_FEH_WAKEUP_REASON_AIN3UV_NO_WAKE_ENUM_VAL \ + (0U) + +/* Enumerated value WAKE_UP: Wakeup caused by AIN3_UV */ +#define MC33775_FEH_WAKEUP_REASON_AIN3UV_WAKE_UP_ENUM_VAL \ + (1U) + +/* Field ALARMIN: Detected alarm input */ +#define MC33775_FEH_WAKEUP_REASON_ALARMIN_POS \ + (11U) +#define MC33775_FEH_WAKEUP_REASON_ALARMIN_MSK \ + (0x800U) + +/* Enumerated value NO_WAKE: Wakeup not caused by detected Wakeup input */ +#define MC33775_FEH_WAKEUP_REASON_ALARMIN_NO_WAKE_ENUM_VAL \ + (0U) + +/* Enumerated value WAKE_UP: Wakeup caused by detected Wakeup input */ +#define MC33775_FEH_WAKEUP_REASON_ALARMIN_WAKE_UP_ENUM_VAL \ + (1U) + +/* Field WAKEUPIN: Detected wakeup input */ +#define MC33775_FEH_WAKEUP_REASON_WAKEUPIN_POS \ + (12U) +#define MC33775_FEH_WAKEUP_REASON_WAKEUPIN_MSK \ + (0x1000U) + +/* Enumerated value NO_WAKE: Wakeup not caused by detected wakeup input */ +#define MC33775_FEH_WAKEUP_REASON_WAKEUPIN_NO_WAKE_ENUM_VAL \ + (0U) + +/* Enumerated value WAKE_UP: Wakeup caused by detected wakeup input */ +#define MC33775_FEH_WAKEUP_REASON_WAKEUPIN_WAKE_UP_ENUM_VAL \ + (1U) + +/* Field BALRDY: Cell voltage balancing ready */ +#define MC33775_FEH_WAKEUP_REASON_BALRDY_POS \ + (13U) +#define MC33775_FEH_WAKEUP_REASON_BALRDY_MSK \ + (0x2000U) + +/* Enumerated value NO_WAKE: Wakeup not caused by cell voltage balancing ready */ +#define MC33775_FEH_WAKEUP_REASON_BALRDY_NO_WAKE_ENUM_VAL \ + (0U) + +/* Enumerated value WAKE_UP: Wakeup caused by cell voltage balancing ready */ +#define MC33775_FEH_WAKEUP_REASON_BALRDY_WAKE_UP_ENUM_VAL \ + (1U) + +/* Field SYSFLTEVT: Detected system fault. */ +#define MC33775_FEH_WAKEUP_REASON_SYSFLTEVT_POS \ + (14U) +#define MC33775_FEH_WAKEUP_REASON_SYSFLTEVT_MSK \ + (0x4000U) + +/* Enumerated value NO_WAKE: Wakeup not caused by detected system fault */ +#define MC33775_FEH_WAKEUP_REASON_SYSFLTEVT_NO_WAKE_ENUM_VAL \ + (0U) + +/* Enumerated value WAKE_UP: Wakeup caused by detected system fault */ +#define MC33775_FEH_WAKEUP_REASON_SYSFLTEVT_WAKE_UP_ENUM_VAL \ + (1U) + +/* Field COMM: Communication detected */ +#define MC33775_FEH_WAKEUP_REASON_COMM_POS \ + (15U) +#define MC33775_FEH_WAKEUP_REASON_COMM_MSK \ + (0x8000U) + +/* Enumerated value NO_WAKE: Wakeup not caused by detected communication */ +#define MC33775_FEH_WAKEUP_REASON_COMM_NO_WAKE_ENUM_VAL \ + (0U) + +/* Enumerated value WAKE_UP: Wakeup caused by detected communication */ +#define MC33775_FEH_WAKEUP_REASON_COMM_WAKE_UP_ENUM_VAL \ + (1U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VCOV : 1; + volatile uint16_t VCUV0 : 1; + volatile uint16_t VCUV1 : 1; + volatile uint16_t AIN0OV : 1; + volatile uint16_t AIN0UV : 1; + volatile uint16_t AIN1OV : 1; + volatile uint16_t AIN1UV : 1; + volatile uint16_t AIN2OV : 1; + volatile uint16_t AIN2UV : 1; + volatile uint16_t AIN3OV : 1; + volatile uint16_t AIN3UV : 1; + volatile uint16_t ALARMIN : 1; + volatile uint16_t WAKEUPIN : 1; + volatile uint16_t BALRDY : 1; + volatile uint16_t SYSFLTEVT : 1; + volatile uint16_t COMM : 1; + } B; +} mc33775_event_handling_registers_feh_wakeup_reason_t; + +/* -------------------------------------------------------------------------- + * FEH_MON_BIST_CTRL (read-write):Monitor BIST control register. + * -------------------------------------------------------------------------- */ +#define MC33775_FEH_MON_BIST_CTRL_OFFSET \ + (0x410U) +#define MC33775_FEH_MON_BIST_CTRL_RW_MSK \ + (0xFFFEU) +#define MC33775_FEH_MON_BIST_CTRL_RD_MSK \ + (0xFFFEU) +#define MC33775_FEH_MON_BIST_CTRL_WR_MSK \ + (0xFFFFU) +#define MC33775_FEH_MON_BIST_CTRL_MW_MSK \ + (0x0U) +#define MC33775_FEH_MON_BIST_CTRL_RA_MSK \ + (0x0U) +#define MC33775_FEH_MON_BIST_CTRL_POR_MSK \ + (0xffffU) +#define MC33775_FEH_MON_BIST_CTRL_POR_VAL \ + (0x0U) + +/* Field STARTBIST: Start BIST of all supply monitors, including VAUXOV, VAUXUV, VDDCOV and VDDCUV, which are not run at start-up. If the BIST is executed while measurements are running, some created secondary measurement results might be invalid. Read as zero. */ +#define MC33775_FEH_MON_BIST_CTRL_STARTBIST_POS \ + (0U) +#define MC33775_FEH_MON_BIST_CTRL_STARTBIST_MSK \ + (0x1U) + +/* Enumerated value NO_START: Do not start BIST */ +#define MC33775_FEH_MON_BIST_CTRL_STARTBIST_NO_START_ENUM_VAL \ + (0U) + +/* Enumerated value STATUS: Read as zero. */ +#define MC33775_FEH_MON_BIST_CTRL_STARTBIST_STATUS_ENUM_VAL \ + (0U) + +/* Enumerated value START: Start BIST */ +#define MC33775_FEH_MON_BIST_CTRL_STARTBIST_START_ENUM_VAL \ + (1U) + +/* Field BISTCRC: CRC of the sequential BIST results. The value is different for the automatic BIST after start-up and a manual started BIST, as more monitors are then included. */ +#define MC33775_FEH_MON_BIST_CTRL_BISTCRC_POS \ + (1U) +#define MC33775_FEH_MON_BIST_CTRL_BISTCRC_MSK \ + (0xFFFEU) + +/* Enumerated value STARTUP: Value TBD represents correct CRC value for start-up BIST */ +#define MC33775_FEH_MON_BIST_CTRL_BISTCRC_STARTUP_ENUM_VAL \ + (0U) + +/* Enumerated value MANUAL: Value TBD represents correct CRC value for manual started BIST */ +#define MC33775_FEH_MON_BIST_CTRL_BISTCRC_MANUAL_ENUM_VAL \ + (1U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t STARTBIST : 1; + volatile uint16_t BISTCRC : 15; + } B; +} mc33775_event_handling_registers_feh_mon_bist_ctrl_t; + +/* -------------------------------------------------------------------------- + * FEH_MON_BIST_RES (read-only):Monitor BIST result register. Note: value will change at start-up, if everything is fine to 0x0000. + * -------------------------------------------------------------------------- */ +#define MC33775_FEH_MON_BIST_RES_OFFSET \ + (0x411U) +#define MC33775_FEH_MON_BIST_RES_RW_MSK \ + (0x0U) +#define MC33775_FEH_MON_BIST_RES_RD_MSK \ + (0x3FFFU) +#define MC33775_FEH_MON_BIST_RES_WR_MSK \ + (0x0U) +#define MC33775_FEH_MON_BIST_RES_MW_MSK \ + (0x0U) +#define MC33775_FEH_MON_BIST_RES_RA_MSK \ + (0x0U) +#define MC33775_FEH_MON_BIST_RES_POR_MSK \ + (0xffffU) +#define MC33775_FEH_MON_BIST_RES_POR_VAL \ + (0x3ffU) + +/* Field VBATOV: VBAT Supply over-voltage BIST failed. */ +#define MC33775_FEH_MON_BIST_RES_VBATOV_POS \ + (0U) +#define MC33775_FEH_MON_BIST_RES_VBATOV_MSK \ + (0x1U) + +/* Enumerated value PASS: BIST passed */ +#define MC33775_FEH_MON_BIST_RES_VBATOV_PASS_ENUM_VAL \ + (0U) + +/* Enumerated value FAIL: BIST failed */ +#define MC33775_FEH_MON_BIST_RES_VBATOV_FAIL_ENUM_VAL \ + (1U) + +/* Field VDDAOV: VDDA Supply over-voltage BIST failed. */ +#define MC33775_FEH_MON_BIST_RES_VDDAOV_POS \ + (1U) +#define MC33775_FEH_MON_BIST_RES_VDDAOV_MSK \ + (0x2U) + +/* Enumerated value PASS: BIST passed */ +#define MC33775_FEH_MON_BIST_RES_VDDAOV_PASS_ENUM_VAL \ + (0U) + +/* Enumerated value FAIL: BIST failed */ +#define MC33775_FEH_MON_BIST_RES_VDDAOV_FAIL_ENUM_VAL \ + (1U) + +/* Field VDDAUV: VDDA Supply under-voltage BIST failed. */ +#define MC33775_FEH_MON_BIST_RES_VDDAUV_POS \ + (2U) +#define MC33775_FEH_MON_BIST_RES_VDDAUV_MSK \ + (0x4U) + +/* Enumerated value PASS: BIST passed */ +#define MC33775_FEH_MON_BIST_RES_VDDAUV_PASS_ENUM_VAL \ + (0U) + +/* Enumerated value FAIL: BIST failed */ +#define MC33775_FEH_MON_BIST_RES_VDDAUV_FAIL_ENUM_VAL \ + (1U) + +/* Field V2P5AOV: V2P5A over-voltage BIST failed. */ +#define MC33775_FEH_MON_BIST_RES_V2P5AOV_POS \ + (3U) +#define MC33775_FEH_MON_BIST_RES_V2P5AOV_MSK \ + (0x8U) + +/* Enumerated value PASS: BIST passed */ +#define MC33775_FEH_MON_BIST_RES_V2P5AOV_PASS_ENUM_VAL \ + (0U) + +/* Enumerated value FAIL: BIST failed */ +#define MC33775_FEH_MON_BIST_RES_V2P5AOV_FAIL_ENUM_VAL \ + (1U) + +/* Field V2P5AUV: V2P5A under-voltage BIST failed. */ +#define MC33775_FEH_MON_BIST_RES_V2P5AUV_POS \ + (4U) +#define MC33775_FEH_MON_BIST_RES_V2P5AUV_MSK \ + (0x10U) + +/* Enumerated value PASS: BIST passed */ +#define MC33775_FEH_MON_BIST_RES_V2P5AUV_PASS_ENUM_VAL \ + (0U) + +/* Enumerated value FAIL: BIST failed */ +#define MC33775_FEH_MON_BIST_RES_V2P5AUV_FAIL_ENUM_VAL \ + (1U) + +/* Field AFECPOV: Analog Frontend Charge Pump over-voltage BIST failed. */ +#define MC33775_FEH_MON_BIST_RES_AFECPOV_POS \ + (5U) +#define MC33775_FEH_MON_BIST_RES_AFECPOV_MSK \ + (0x20U) + +/* Enumerated value PASS: BIST passed */ +#define MC33775_FEH_MON_BIST_RES_AFECPOV_PASS_ENUM_VAL \ + (0U) + +/* Enumerated value FAIL: BIST failed */ +#define MC33775_FEH_MON_BIST_RES_AFECPOV_FAIL_ENUM_VAL \ + (1U) + +/* Field AFECPUV: Analog Frontend Charge Pump under-voltage BIST failed. */ +#define MC33775_FEH_MON_BIST_RES_AFECPUV_POS \ + (6U) +#define MC33775_FEH_MON_BIST_RES_AFECPUV_MSK \ + (0x40U) + +/* Enumerated value PASS: BIST passed */ +#define MC33775_FEH_MON_BIST_RES_AFECPUV_PASS_ENUM_VAL \ + (0U) + +/* Enumerated value FAIL: BIST failed */ +#define MC33775_FEH_MON_BIST_RES_AFECPUV_FAIL_ENUM_VAL \ + (1U) + +/* Field IBIASPERMOC: IBIAS_PERM over-current BIST failed. */ +#define MC33775_FEH_MON_BIST_RES_IBIASPERMOC_POS \ + (7U) +#define MC33775_FEH_MON_BIST_RES_IBIASPERMOC_MSK \ + (0x80U) + +/* Enumerated value PASS: BIST passed */ +#define MC33775_FEH_MON_BIST_RES_IBIASPERMOC_PASS_ENUM_VAL \ + (0U) + +/* Enumerated value FAIL: BIST failed */ +#define MC33775_FEH_MON_BIST_RES_IBIASPERMOC_FAIL_ENUM_VAL \ + (1U) + +/* Field IBIASPERMUC: IBIAS_PERM under-current BIST failed. */ +#define MC33775_FEH_MON_BIST_RES_IBIASPERMUC_POS \ + (8U) +#define MC33775_FEH_MON_BIST_RES_IBIASPERMUC_MSK \ + (0x100U) + +/* Enumerated value PASS: BIST passed */ +#define MC33775_FEH_MON_BIST_RES_IBIASPERMUC_PASS_ENUM_VAL \ + (0U) + +/* Enumerated value FAIL: BIST failed */ +#define MC33775_FEH_MON_BIST_RES_IBIASPERMUC_FAIL_ENUM_VAL \ + (1U) + +/* Field VPREREFSUV: VPREREFSUV Supply under-voltage BIST failed. */ +#define MC33775_FEH_MON_BIST_RES_VPREREFSUV_POS \ + (9U) +#define MC33775_FEH_MON_BIST_RES_VPREREFSUV_MSK \ + (0x200U) + +/* Enumerated value PASS: BIST passed */ +#define MC33775_FEH_MON_BIST_RES_VPREREFSUV_PASS_ENUM_VAL \ + (0U) + +/* Enumerated value FAIL: BIST failed */ +#define MC33775_FEH_MON_BIST_RES_VPREREFSUV_FAIL_ENUM_VAL \ + (1U) + +/* Field VAUXOV: VAUX Supply over-voltage BIST failed. Not part of start-up BIST, only executed for manual BIST execution. */ +#define MC33775_FEH_MON_BIST_RES_VAUXOV_POS \ + (10U) +#define MC33775_FEH_MON_BIST_RES_VAUXOV_MSK \ + (0x400U) + +/* Enumerated value PASS: BIST passed */ +#define MC33775_FEH_MON_BIST_RES_VAUXOV_PASS_ENUM_VAL \ + (0U) + +/* Enumerated value FAIL: BIST failed */ +#define MC33775_FEH_MON_BIST_RES_VAUXOV_FAIL_ENUM_VAL \ + (1U) + +/* Field VAUXUV: VAUX Supply under-voltage BIST failed. Not part of start-up BIST, only executed for manual BIST execution. */ +#define MC33775_FEH_MON_BIST_RES_VAUXUV_POS \ + (11U) +#define MC33775_FEH_MON_BIST_RES_VAUXUV_MSK \ + (0x800U) + +/* Enumerated value PASS: BIST passed */ +#define MC33775_FEH_MON_BIST_RES_VAUXUV_PASS_ENUM_VAL \ + (0U) + +/* Enumerated value FAIL: BIST failed */ +#define MC33775_FEH_MON_BIST_RES_VAUXUV_FAIL_ENUM_VAL \ + (1U) + +/* Field VDDCOV: VDDC Supply over-voltage BIST failed. Not part of start-up BIST, only executed for manual BIST execution. */ +#define MC33775_FEH_MON_BIST_RES_VDDCOV_POS \ + (12U) +#define MC33775_FEH_MON_BIST_RES_VDDCOV_MSK \ + (0x1000U) + +/* Enumerated value PASS: BIST passed */ +#define MC33775_FEH_MON_BIST_RES_VDDCOV_PASS_ENUM_VAL \ + (0U) + +/* Enumerated value FAIL: BIST failed */ +#define MC33775_FEH_MON_BIST_RES_VDDCOV_FAIL_ENUM_VAL \ + (1U) + +/* Field VDDCUV: VDDC Supply under-voltage BIST failed. Not part of start-up BIST, only executed for manual BIST execution. */ +#define MC33775_FEH_MON_BIST_RES_VDDCUV_POS \ + (13U) +#define MC33775_FEH_MON_BIST_RES_VDDCUV_MSK \ + (0x2000U) + +/* Enumerated value PASS: BIST passed */ +#define MC33775_FEH_MON_BIST_RES_VDDCUV_PASS_ENUM_VAL \ + (0U) + +/* Enumerated value FAIL: BIST failed */ +#define MC33775_FEH_MON_BIST_RES_VDDCUV_FAIL_ENUM_VAL \ + (1U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_FEH_MON_BIST_RES_RESERVED0_POS \ + (14U) +#define MC33775_FEH_MON_BIST_RES_RESERVED0_MSK \ + (0xC000U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VBATOV : 1; + volatile uint16_t VDDAOV : 1; + volatile uint16_t VDDAUV : 1; + volatile uint16_t V2P5AOV : 1; + volatile uint16_t V2P5AUV : 1; + volatile uint16_t AFECPOV : 1; + volatile uint16_t AFECPUV : 1; + volatile uint16_t IBIASPERMOC : 1; + volatile uint16_t IBIASPERMUC : 1; + volatile uint16_t VPREREFSUV : 1; + volatile uint16_t VAUXOV : 1; + volatile uint16_t VAUXUV : 1; + volatile uint16_t VDDCOV : 1; + volatile uint16_t VDDCUV : 1; + volatile uint16_t reserved0 : 2; + } B; +} mc33775_event_handling_registers_feh_mon_bist_res_t; + +/* -------------------------------------------------------------------------- + * FEH_ACC_ERR (read-only):Access error status register + * -------------------------------------------------------------------------- */ +#define MC33775_FEH_ACC_ERR_OFFSET \ + (0x41EU) +#define MC33775_FEH_ACC_ERR_RW_MSK \ + (0x0U) +#define MC33775_FEH_ACC_ERR_RD_MSK \ + (0xFFFFU) +#define MC33775_FEH_ACC_ERR_WR_MSK \ + (0x0U) +#define MC33775_FEH_ACC_ERR_MW_MSK \ + (0x0U) +#define MC33775_FEH_ACC_ERR_RA_MSK \ + (0xFFFFU) +#define MC33775_FEH_ACC_ERR_POR_MSK \ + (0xffffU) +#define MC33775_FEH_ACC_ERR_POR_VAL \ + (0x0U) + +/* Field ERRADD: Address of the last access which created an access error */ +#define MC33775_FEH_ACC_ERR_ERRADD_POS \ + (0U) +#define MC33775_FEH_ACC_ERR_ERRADD_MSK \ + (0x3FFFU) + +/* Field ERRACC: Access type of the last access error */ +#define MC33775_FEH_ACC_ERR_ERRACC_POS \ + (14U) +#define MC33775_FEH_ACC_ERR_ERRACC_MSK \ + (0x4000U) + +/* Enumerated value READ: Last error occurred during a read access */ +#define MC33775_FEH_ACC_ERR_ERRACC_READ_ENUM_VAL \ + (0U) + +/* Enumerated value WRITE: Last error occurred during a write access */ +#define MC33775_FEH_ACC_ERR_ERRACC_WRITE_ENUM_VAL \ + (1U) + +/* Field ERRSTAT: Access error status */ +#define MC33775_FEH_ACC_ERR_ERRSTAT_POS \ + (15U) +#define MC33775_FEH_ACC_ERR_ERRSTAT_MSK \ + (0x8000U) + +/* Enumerated value NO_ERROR: No error occurred */ +#define MC33775_FEH_ACC_ERR_ERRSTAT_NO_ERROR_ENUM_VAL \ + (0U) + +/* Enumerated value ERROR: Access error has occurred */ +#define MC33775_FEH_ACC_ERR_ERRSTAT_ERROR_ENUM_VAL \ + (1U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t ERRADD : 14; + volatile uint16_t ERRACC : 1; + volatile uint16_t ERRSTAT : 1; + } B; +} mc33775_event_handling_registers_feh_acc_err_t; + +/* -------------------------------------------------------------------------- + * FEH_GRP_FLT_STAT (read-only):Main system fault status register. this register holds one bit per fault group. For each fault group a separate status register exists. The bit here is cleared if all its sources are cleared. + * -------------------------------------------------------------------------- */ +#define MC33775_FEH_GRP_FLT_STAT_OFFSET \ + (0x41FU) +#define MC33775_FEH_GRP_FLT_STAT_RW_MSK \ + (0x0U) +#define MC33775_FEH_GRP_FLT_STAT_RD_MSK \ + (0xFU) +#define MC33775_FEH_GRP_FLT_STAT_WR_MSK \ + (0x0U) +#define MC33775_FEH_GRP_FLT_STAT_MW_MSK \ + (0x0U) +#define MC33775_FEH_GRP_FLT_STAT_RA_MSK \ + (0x0U) +#define MC33775_FEH_GRP_FLT_STAT_POR_MSK \ + (0xffffU) +#define MC33775_FEH_GRP_FLT_STAT_POR_VAL \ + (0x0U) + +/* Field SUPPLYFLT: Internal/external supply fault status */ +#define MC33775_FEH_GRP_FLT_STAT_SUPPLYFLT_POS \ + (0U) +#define MC33775_FEH_GRP_FLT_STAT_SUPPLYFLT_MSK \ + (0x1U) + +/* Enumerated value NO_ERROR: No supply error detected */ +#define MC33775_FEH_GRP_FLT_STAT_SUPPLYFLT_NO_ERROR_ENUM_VAL \ + (0U) + +/* Enumerated value ERROR: Supply error detected */ +#define MC33775_FEH_GRP_FLT_STAT_SUPPLYFLT_ERROR_ENUM_VAL \ + (1U) + +/* Field ANAFLT: Analog fault status */ +#define MC33775_FEH_GRP_FLT_STAT_ANAFLT_POS \ + (1U) +#define MC33775_FEH_GRP_FLT_STAT_ANAFLT_MSK \ + (0x2U) + +/* Enumerated value NO_ERROR: No analog fault detected */ +#define MC33775_FEH_GRP_FLT_STAT_ANAFLT_NO_ERROR_ENUM_VAL \ + (0U) + +/* Enumerated value ERROR: Analog fault detected */ +#define MC33775_FEH_GRP_FLT_STAT_ANAFLT_ERROR_ENUM_VAL \ + (1U) + +/* Field COMFLT: Communication fault status */ +#define MC33775_FEH_GRP_FLT_STAT_COMFLT_POS \ + (2U) +#define MC33775_FEH_GRP_FLT_STAT_COMFLT_MSK \ + (0x4U) + +/* Enumerated value NO_ERROR: No communication fault detected */ +#define MC33775_FEH_GRP_FLT_STAT_COMFLT_NO_ERROR_ENUM_VAL \ + (0U) + +/* Enumerated value ERROR: Communication fault detected. */ +#define MC33775_FEH_GRP_FLT_STAT_COMFLT_ERROR_ENUM_VAL \ + (1U) + +/* Field MEASFLT: Measurement fault status */ +#define MC33775_FEH_GRP_FLT_STAT_MEASFLT_POS \ + (3U) +#define MC33775_FEH_GRP_FLT_STAT_MEASFLT_MSK \ + (0x8U) + +/* Enumerated value NO_ERROR: No measurement fault detected */ +#define MC33775_FEH_GRP_FLT_STAT_MEASFLT_NO_ERROR_ENUM_VAL \ + (0U) + +/* Enumerated value ERROR: Measurement fault detected */ +#define MC33775_FEH_GRP_FLT_STAT_MEASFLT_ERROR_ENUM_VAL \ + (1U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_FEH_GRP_FLT_STAT_RESERVED0_POS \ + (4U) +#define MC33775_FEH_GRP_FLT_STAT_RESERVED0_MSK \ + (0xFFF0U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t SUPPLYFLT : 1; + volatile uint16_t ANAFLT : 1; + volatile uint16_t COMFLT : 1; + volatile uint16_t MEASFLT : 1; + volatile uint16_t reserved0 : 12; + } B; +} mc33775_event_handling_registers_feh_grp_flt_stat_t; + +/* -------------------------------------------------------------------------- + * FEH_SUPPLY_FLT_STAT0 (read-write):Supply fault status register 0 (these monitors are part of the BIST). + * -------------------------------------------------------------------------- */ +#define MC33775_FEH_SUPPLY_FLT_STAT0_OFFSET \ + (0x420U) +#define MC33775_FEH_SUPPLY_FLT_STAT0_RW_MSK \ + (0x3FFFU) +#define MC33775_FEH_SUPPLY_FLT_STAT0_RD_MSK \ + (0x3FFFU) +#define MC33775_FEH_SUPPLY_FLT_STAT0_WR_MSK \ + (0x3FFFU) +#define MC33775_FEH_SUPPLY_FLT_STAT0_MW_MSK \ + (0x3FFFU) +#define MC33775_FEH_SUPPLY_FLT_STAT0_RA_MSK \ + (0x0U) +#define MC33775_FEH_SUPPLY_FLT_STAT0_POR_MSK \ + (0xffffU) +#define MC33775_FEH_SUPPLY_FLT_STAT0_POR_VAL \ + (0x0U) + +/* Field VBATOV: VBAT Supply over-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_STAT0_VBATOV_POS \ + (0U) +#define MC33775_FEH_SUPPLY_FLT_STAT0_VBATOV_MSK \ + (0x1U) + +/* Enumerated value NO_OV: No VBAT Supply over-voltage detected. */ +#define MC33775_FEH_SUPPLY_FLT_STAT0_VBATOV_NO_OV_ENUM_VAL \ + (0U) + +/* Enumerated value OV: VBAT Supply over-voltage detected. */ +#define MC33775_FEH_SUPPLY_FLT_STAT0_VBATOV_OV_ENUM_VAL \ + (1U) + +/* Field VDDAOV: VDDA Supply over-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_STAT0_VDDAOV_POS \ + (1U) +#define MC33775_FEH_SUPPLY_FLT_STAT0_VDDAOV_MSK \ + (0x2U) + +/* Enumerated value NO_OV: No VDDA Supply over-voltage detected. */ +#define MC33775_FEH_SUPPLY_FLT_STAT0_VDDAOV_NO_OV_ENUM_VAL \ + (0U) + +/* Enumerated value OV: VDDA Supply over-voltage detected. */ +#define MC33775_FEH_SUPPLY_FLT_STAT0_VDDAOV_OV_ENUM_VAL \ + (1U) + +/* Field VDDAUV: VDDA Supply under-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_STAT0_VDDAUV_POS \ + (2U) +#define MC33775_FEH_SUPPLY_FLT_STAT0_VDDAUV_MSK \ + (0x4U) + +/* Enumerated value NO_UV: No VDDA Supply under-voltage detected. */ +#define MC33775_FEH_SUPPLY_FLT_STAT0_VDDAUV_NO_UV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: VDDA Supply under-voltage detected. */ +#define MC33775_FEH_SUPPLY_FLT_STAT0_VDDAUV_UV_ENUM_VAL \ + (1U) + +/* Field V2P5AOV: V2P5A Supply over-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_STAT0_V2P5AOV_POS \ + (3U) +#define MC33775_FEH_SUPPLY_FLT_STAT0_V2P5AOV_MSK \ + (0x8U) + +/* Enumerated value NO_OV: No V2P5A Supply over-voltage detected. */ +#define MC33775_FEH_SUPPLY_FLT_STAT0_V2P5AOV_NO_OV_ENUM_VAL \ + (0U) + +/* Enumerated value OV: V2P5A Supply over-voltage detected. */ +#define MC33775_FEH_SUPPLY_FLT_STAT0_V2P5AOV_OV_ENUM_VAL \ + (1U) + +/* Field V2P5AUV: V2P5A Supply under-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_STAT0_V2P5AUV_POS \ + (4U) +#define MC33775_FEH_SUPPLY_FLT_STAT0_V2P5AUV_MSK \ + (0x10U) + +/* Enumerated value NO_UV: No V2P5A Supply under-voltage detected. */ +#define MC33775_FEH_SUPPLY_FLT_STAT0_V2P5AUV_NO_UV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: V2P5A Supply under-voltage detected. */ +#define MC33775_FEH_SUPPLY_FLT_STAT0_V2P5AUV_UV_ENUM_VAL \ + (1U) + +/* Field AFECPOV: AFE Charge Pump over-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_STAT0_AFECPOV_POS \ + (5U) +#define MC33775_FEH_SUPPLY_FLT_STAT0_AFECPOV_MSK \ + (0x20U) + +/* Enumerated value NO_OV: No AFE Charge Pump over-voltage detected. */ +#define MC33775_FEH_SUPPLY_FLT_STAT0_AFECPOV_NO_OV_ENUM_VAL \ + (0U) + +/* Enumerated value OV: AFE Charge Pump over-voltage detected. */ +#define MC33775_FEH_SUPPLY_FLT_STAT0_AFECPOV_OV_ENUM_VAL \ + (1U) + +/* Field AFECPUV: AFE Charge Pump under-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_STAT0_AFECPUV_POS \ + (6U) +#define MC33775_FEH_SUPPLY_FLT_STAT0_AFECPUV_MSK \ + (0x40U) + +/* Enumerated value NO_UV: No AFE Charge Pump under-voltage detected. */ +#define MC33775_FEH_SUPPLY_FLT_STAT0_AFECPUV_NO_UV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: AFE Charge Pump under-voltage detected. */ +#define MC33775_FEH_SUPPLY_FLT_STAT0_AFECPUV_UV_ENUM_VAL \ + (1U) + +/* Field IBIASPERMOC: IBIAS_PERM over-current fault. */ +#define MC33775_FEH_SUPPLY_FLT_STAT0_IBIASPERMOC_POS \ + (7U) +#define MC33775_FEH_SUPPLY_FLT_STAT0_IBIASPERMOC_MSK \ + (0x80U) + +/* Enumerated value NO_OC: No IBIAS_PERM over-current detected. */ +#define MC33775_FEH_SUPPLY_FLT_STAT0_IBIASPERMOC_NO_OC_ENUM_VAL \ + (0U) + +/* Enumerated value OC: IBIAS_PERM over-current detected. */ +#define MC33775_FEH_SUPPLY_FLT_STAT0_IBIASPERMOC_OC_ENUM_VAL \ + (1U) + +/* Field IBIASPERMUC: IBIAS_PERM under-current fault. */ +#define MC33775_FEH_SUPPLY_FLT_STAT0_IBIASPERMUC_POS \ + (8U) +#define MC33775_FEH_SUPPLY_FLT_STAT0_IBIASPERMUC_MSK \ + (0x100U) + +/* Enumerated value NO_UC: No IBIAS_PERM under-current detected. */ +#define MC33775_FEH_SUPPLY_FLT_STAT0_IBIASPERMUC_NO_UC_ENUM_VAL \ + (0U) + +/* Enumerated value UC: IBIAS_PERM under-current detected. */ +#define MC33775_FEH_SUPPLY_FLT_STAT0_IBIASPERMUC_UC_ENUM_VAL \ + (1U) + +/* Field VPREREFSUV: VPREREFS Supply under-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_STAT0_VPREREFSUV_POS \ + (9U) +#define MC33775_FEH_SUPPLY_FLT_STAT0_VPREREFSUV_MSK \ + (0x200U) + +/* Enumerated value NO_UV: No VPREREFS Supply under-voltage detected. */ +#define MC33775_FEH_SUPPLY_FLT_STAT0_VPREREFSUV_NO_UV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: VPREREFS Supply under-voltage detected. */ +#define MC33775_FEH_SUPPLY_FLT_STAT0_VPREREFSUV_UV_ENUM_VAL \ + (1U) + +/* Field VAUXOV: VAUX Supply over-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_STAT0_VAUXOV_POS \ + (10U) +#define MC33775_FEH_SUPPLY_FLT_STAT0_VAUXOV_MSK \ + (0x400U) + +/* Enumerated value NO_OV: No VAUX Supply over-voltage detected. */ +#define MC33775_FEH_SUPPLY_FLT_STAT0_VAUXOV_NO_OV_ENUM_VAL \ + (0U) + +/* Enumerated value OV: VAUX Supply over-voltage detected. */ +#define MC33775_FEH_SUPPLY_FLT_STAT0_VAUXOV_OV_ENUM_VAL \ + (1U) + +/* Field VAUXUV: VAUX Supply under-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_STAT0_VAUXUV_POS \ + (11U) +#define MC33775_FEH_SUPPLY_FLT_STAT0_VAUXUV_MSK \ + (0x800U) + +/* Enumerated value NO_UV: No VAUX Supply under-voltage detected. */ +#define MC33775_FEH_SUPPLY_FLT_STAT0_VAUXUV_NO_UV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: VAUX Supply under-voltage detected. */ +#define MC33775_FEH_SUPPLY_FLT_STAT0_VAUXUV_UV_ENUM_VAL \ + (1U) + +/* Field VDDCOV: VDDC Supply over-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_STAT0_VDDCOV_POS \ + (12U) +#define MC33775_FEH_SUPPLY_FLT_STAT0_VDDCOV_MSK \ + (0x1000U) + +/* Enumerated value NO_OV: No VDDC Supply over-voltage detected. */ +#define MC33775_FEH_SUPPLY_FLT_STAT0_VDDCOV_NO_OV_ENUM_VAL \ + (0U) + +/* Enumerated value OV: VDDC Supply over-voltage detected. */ +#define MC33775_FEH_SUPPLY_FLT_STAT0_VDDCOV_OV_ENUM_VAL \ + (1U) + +/* Field VDDCUV: VDDC Supply under-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_STAT0_VDDCUV_POS \ + (13U) +#define MC33775_FEH_SUPPLY_FLT_STAT0_VDDCUV_MSK \ + (0x2000U) + +/* Enumerated value NO_UV: No VDDC Supply under-voltage detected. */ +#define MC33775_FEH_SUPPLY_FLT_STAT0_VDDCUV_NO_UV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: VDDC Supply under-voltage detected. */ +#define MC33775_FEH_SUPPLY_FLT_STAT0_VDDCUV_UV_ENUM_VAL \ + (1U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_FEH_SUPPLY_FLT_STAT0_RESERVED0_POS \ + (14U) +#define MC33775_FEH_SUPPLY_FLT_STAT0_RESERVED0_MSK \ + (0xC000U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VBATOV : 1; + volatile uint16_t VDDAOV : 1; + volatile uint16_t VDDAUV : 1; + volatile uint16_t V2P5AOV : 1; + volatile uint16_t V2P5AUV : 1; + volatile uint16_t AFECPOV : 1; + volatile uint16_t AFECPUV : 1; + volatile uint16_t IBIASPERMOC : 1; + volatile uint16_t IBIASPERMUC : 1; + volatile uint16_t VPREREFSUV : 1; + volatile uint16_t VAUXOV : 1; + volatile uint16_t VAUXUV : 1; + volatile uint16_t VDDCOV : 1; + volatile uint16_t VDDCUV : 1; + volatile uint16_t reserved0 : 2; + } B; +} mc33775_event_handling_registers_feh_supply_flt_stat0_t; + +/* -------------------------------------------------------------------------- + * FEH_SUPPLY_FLT_STAT1 (read-write):Supply fault status register 1 (these monitors are not part of the BIST). + * -------------------------------------------------------------------------- */ +#define MC33775_FEH_SUPPLY_FLT_STAT1_OFFSET \ + (0x421U) +#define MC33775_FEH_SUPPLY_FLT_STAT1_RW_MSK \ + (0x3FU) +#define MC33775_FEH_SUPPLY_FLT_STAT1_RD_MSK \ + (0x3FU) +#define MC33775_FEH_SUPPLY_FLT_STAT1_WR_MSK \ + (0x3FU) +#define MC33775_FEH_SUPPLY_FLT_STAT1_MW_MSK \ + (0x3FU) +#define MC33775_FEH_SUPPLY_FLT_STAT1_RA_MSK \ + (0x0U) +#define MC33775_FEH_SUPPLY_FLT_STAT1_POR_MSK \ + (0xffffU) +#define MC33775_FEH_SUPPLY_FLT_STAT1_POR_VAL \ + (0x0U) + +/* Field VBATLV: VBAT Supply low-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_STAT1_VBATLV_POS \ + (0U) +#define MC33775_FEH_SUPPLY_FLT_STAT1_VBATLV_MSK \ + (0x1U) + +/* Enumerated value NO_LV: No VBAT Supply low-voltage detected. */ +#define MC33775_FEH_SUPPLY_FLT_STAT1_VBATLV_NO_LV_ENUM_VAL \ + (0U) + +/* Enumerated value LV: VBAT Supply low-voltage detected. */ +#define MC33775_FEH_SUPPLY_FLT_STAT1_VBATLV_LV_ENUM_VAL \ + (1U) + +/* Field VPREREFSOV: VPREREFS Supply over-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_STAT1_VPREREFSOV_POS \ + (1U) +#define MC33775_FEH_SUPPLY_FLT_STAT1_VPREREFSOV_MSK \ + (0x2U) + +/* Enumerated value NO_OV: No VPREREFS Supply over-voltage detected. */ +#define MC33775_FEH_SUPPLY_FLT_STAT1_VPREREFSOV_NO_OV_ENUM_VAL \ + (0U) + +/* Enumerated value OV: VPREREFS Supply over-voltage detected. */ +#define MC33775_FEH_SUPPLY_FLT_STAT1_VPREREFSOV_OV_ENUM_VAL \ + (1U) + +/* Field VDDCHC: VDDC high-current fault. */ +#define MC33775_FEH_SUPPLY_FLT_STAT1_VDDCHC_POS \ + (2U) +#define MC33775_FEH_SUPPLY_FLT_STAT1_VDDCHC_MSK \ + (0x4U) + +/* Enumerated value NO_HC: No VDDC high-current detected. */ +#define MC33775_FEH_SUPPLY_FLT_STAT1_VDDCHC_NO_HC_ENUM_VAL \ + (0U) + +/* Enumerated value HC: VDDC high-current detected. */ +#define MC33775_FEH_SUPPLY_FLT_STAT1_VDDCHC_HC_ENUM_VAL \ + (1U) + +/* Field VDDIOOV: VDDIO Supply over-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_STAT1_VDDIOOV_POS \ + (3U) +#define MC33775_FEH_SUPPLY_FLT_STAT1_VDDIOOV_MSK \ + (0x8U) + +/* Enumerated value NO_OV: No VDDIO Supply over-voltage detected. */ +#define MC33775_FEH_SUPPLY_FLT_STAT1_VDDIOOV_NO_OV_ENUM_VAL \ + (0U) + +/* Enumerated value OV: VDDIO Supply over-voltage detected. */ +#define MC33775_FEH_SUPPLY_FLT_STAT1_VDDIOOV_OV_ENUM_VAL \ + (1U) + +/* Field VDDIOUV: VDDIO Supply under-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_STAT1_VDDIOUV_POS \ + (4U) +#define MC33775_FEH_SUPPLY_FLT_STAT1_VDDIOUV_MSK \ + (0x10U) + +/* Enumerated value NO_UV: No VDDIO Supply under-voltage detected. */ +#define MC33775_FEH_SUPPLY_FLT_STAT1_VDDIOUV_NO_UV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: VDDIO Supply under-voltage detected. */ +#define MC33775_FEH_SUPPLY_FLT_STAT1_VDDIOUV_UV_ENUM_VAL \ + (1U) + +/* Field VPREOV: VPRE Supply over-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_STAT1_VPREOV_POS \ + (5U) +#define MC33775_FEH_SUPPLY_FLT_STAT1_VPREOV_MSK \ + (0x20U) + +/* Enumerated value NO_OV: No VPRE Supply over-voltage detected. */ +#define MC33775_FEH_SUPPLY_FLT_STAT1_VPREOV_NO_OV_ENUM_VAL \ + (0U) + +/* Enumerated value OV: VPRE Supply over-voltage detected. */ +#define MC33775_FEH_SUPPLY_FLT_STAT1_VPREOV_OV_ENUM_VAL \ + (1U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_FEH_SUPPLY_FLT_STAT1_RESERVED0_POS \ + (6U) +#define MC33775_FEH_SUPPLY_FLT_STAT1_RESERVED0_MSK \ + (0xFFC0U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VBATLV : 1; + volatile uint16_t VPREREFSOV : 1; + volatile uint16_t VDDCHC : 1; + volatile uint16_t VDDIOOV : 1; + volatile uint16_t VDDIOUV : 1; + volatile uint16_t VPREOV : 1; + volatile uint16_t reserved0 : 10; + } B; +} mc33775_event_handling_registers_feh_supply_flt_stat1_t; + +/* -------------------------------------------------------------------------- + * FEH_ANA_FLT_STAT (read-write):Analog fault status register. + * -------------------------------------------------------------------------- */ +#define MC33775_FEH_ANA_FLT_STAT_OFFSET \ + (0x422U) +#define MC33775_FEH_ANA_FLT_STAT_RW_MSK \ + (0x7U) +#define MC33775_FEH_ANA_FLT_STAT_RD_MSK \ + (0x7U) +#define MC33775_FEH_ANA_FLT_STAT_WR_MSK \ + (0x7U) +#define MC33775_FEH_ANA_FLT_STAT_MW_MSK \ + (0x7U) +#define MC33775_FEH_ANA_FLT_STAT_RA_MSK \ + (0x0U) +#define MC33775_FEH_ANA_FLT_STAT_POR_MSK \ + (0xffffU) +#define MC33775_FEH_ANA_FLT_STAT_POR_VAL \ + (0x0U) + +/* Field MONBIST: Monitor BIST failure fault. */ +#define MC33775_FEH_ANA_FLT_STAT_MONBIST_POS \ + (0U) +#define MC33775_FEH_ANA_FLT_STAT_MONBIST_MSK \ + (0x1U) + +/* Enumerated value NO_FLT: No monitor BIST failure detected. */ +#define MC33775_FEH_ANA_FLT_STAT_MONBIST_NO_FLT_ENUM_VAL \ + (0U) + +/* Enumerated value FAILURE: Monitor BIST failure detected. */ +#define MC33775_FEH_ANA_FLT_STAT_MONBIST_FAILURE_ENUM_VAL \ + (1U) + +/* Field BALFLT: Cell balance function fault. */ +#define MC33775_FEH_ANA_FLT_STAT_BALFLT_POS \ + (1U) +#define MC33775_FEH_ANA_FLT_STAT_BALFLT_MSK \ + (0x2U) + +/* Enumerated value NO_FLT: No cell balancing fault detected */ +#define MC33775_FEH_ANA_FLT_STAT_BALFLT_NO_FLT_ENUM_VAL \ + (0U) + +/* Enumerated value FAULT: Cell balancing fault detected */ +#define MC33775_FEH_ANA_FLT_STAT_BALFLT_FAULT_ENUM_VAL \ + (1U) + +/* Field FUSEFLT: A correctable ECC error of the fuse data has been detected. */ +#define MC33775_FEH_ANA_FLT_STAT_FUSEFLT_POS \ + (2U) +#define MC33775_FEH_ANA_FLT_STAT_FUSEFLT_MSK \ + (0x4U) + +/* Enumerated value NO_ECC: No correctable ECC error detected */ +#define MC33775_FEH_ANA_FLT_STAT_FUSEFLT_NO_ECC_ENUM_VAL \ + (0U) + +/* Enumerated value ECC: An error was corrected by using the ECC */ +#define MC33775_FEH_ANA_FLT_STAT_FUSEFLT_ECC_ENUM_VAL \ + (1U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_FEH_ANA_FLT_STAT_RESERVED0_POS \ + (3U) +#define MC33775_FEH_ANA_FLT_STAT_RESERVED0_MSK \ + (0xFFF8U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t MONBIST : 1; + volatile uint16_t BALFLT : 1; + volatile uint16_t FUSEFLT : 1; + volatile uint16_t reserved0 : 13; + } B; +} mc33775_event_handling_registers_feh_ana_flt_stat_t; + +/* -------------------------------------------------------------------------- + * FEH_COM_FLT_STAT (read-write):Communication fault status register. + * -------------------------------------------------------------------------- */ +#define MC33775_FEH_COM_FLT_STAT_OFFSET \ + (0x423U) +#define MC33775_FEH_COM_FLT_STAT_RW_MSK \ + (0xFF1FU) +#define MC33775_FEH_COM_FLT_STAT_RD_MSK \ + (0xFF1FU) +#define MC33775_FEH_COM_FLT_STAT_WR_MSK \ + (0xFF1FU) +#define MC33775_FEH_COM_FLT_STAT_MW_MSK \ + (0xFF1FU) +#define MC33775_FEH_COM_FLT_STAT_RA_MSK \ + (0x0U) +#define MC33775_FEH_COM_FLT_STAT_POR_MSK \ + (0xffffU) +#define MC33775_FEH_COM_FLT_STAT_POR_VAL \ + (0x0U) + +/* Field FRAMEERR: Communication frame error (Wrong number of bits or bit-length error) */ +#define MC33775_FEH_COM_FLT_STAT_FRAMEERR_POS \ + (0U) +#define MC33775_FEH_COM_FLT_STAT_FRAMEERR_MSK \ + (0x1U) + +/* Enumerated value NO_ERROR: No communication frame error detected. */ +#define MC33775_FEH_COM_FLT_STAT_FRAMEERR_NO_ERROR_ENUM_VAL \ + (0U) + +/* Enumerated value ERROR: Communication frame error detected. */ +#define MC33775_FEH_COM_FLT_STAT_FRAMEERR_ERROR_ENUM_VAL \ + (1U) + +/* Field CRCERR: Communication CRC error */ +#define MC33775_FEH_COM_FLT_STAT_CRCERR_POS \ + (1U) +#define MC33775_FEH_COM_FLT_STAT_CRCERR_MSK \ + (0x2U) + +/* Enumerated value NO_ERROR: No communication CRC error detected. */ +#define MC33775_FEH_COM_FLT_STAT_CRCERR_NO_ERROR_ENUM_VAL \ + (0U) + +/* Enumerated value ERROR: Communication CRC error detected. */ +#define MC33775_FEH_COM_FLT_STAT_CRCERR_ERROR_ENUM_VAL \ + (1U) + +/* Field ERRCNTOF: Communication error counter overflow */ +#define MC33775_FEH_COM_FLT_STAT_ERRCNTOF_POS \ + (2U) +#define MC33775_FEH_COM_FLT_STAT_ERRCNTOF_MSK \ + (0x4U) + +/* Enumerated value NO_MAX: Communication error counter has not reached max value. */ +#define MC33775_FEH_COM_FLT_STAT_ERRCNTOF_NO_MAX_ENUM_VAL \ + (0U) + +/* Enumerated value MAX: Communication error counter has reached max value. */ +#define MC33775_FEH_COM_FLT_STAT_ERRCNTOF_MAX_ENUM_VAL \ + (1U) + +/* Field COMTO: Communication timeout fault status */ +#define MC33775_FEH_COM_FLT_STAT_COMTO_POS \ + (3U) +#define MC33775_FEH_COM_FLT_STAT_COMTO_MSK \ + (0x8U) + +/* Enumerated value NO_TIMEOUT: No communication timeout has happened. */ +#define MC33775_FEH_COM_FLT_STAT_COMTO_NO_TIMEOUT_ENUM_VAL \ + (0U) + +/* Enumerated value TIMEMOUT: Communication timeout has happened. */ +#define MC33775_FEH_COM_FLT_STAT_COMTO_TIMEMOUT_ENUM_VAL \ + (1U) + +/* Field RSPLENERR: Response length error */ +#define MC33775_FEH_COM_FLT_STAT_RSPLENERR_POS \ + (4U) +#define MC33775_FEH_COM_FLT_STAT_RSPLENERR_MSK \ + (0x10U) + +/* Enumerated value NO_ERROR: No response length error occurred */ +#define MC33775_FEH_COM_FLT_STAT_RSPLENERR_NO_ERROR_ENUM_VAL \ + (0U) + +/* Enumerated value ERROR: The number of SPI clocks did not fit to the length of a requested response */ +#define MC33775_FEH_COM_FLT_STAT_RSPLENERR_ERROR_ENUM_VAL \ + (1U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_FEH_COM_FLT_STAT_RESERVED0_POS \ + (5U) +#define MC33775_FEH_COM_FLT_STAT_RESERVED0_MSK \ + (0xE0U) + +/* Field COMERRCNT: Number of communication errors (frame errors, CRC errors) since last clear, counter saturates at 0xFF. Write with any data unequal 0 clears the counter. */ +#define MC33775_FEH_COM_FLT_STAT_COMERRCNT_POS \ + (8U) +#define MC33775_FEH_COM_FLT_STAT_COMERRCNT_MSK \ + (0xFF00U) + +/* Enumerated value NO_ERROR: No communication error occurred */ +#define MC33775_FEH_COM_FLT_STAT_COMERRCNT_NO_ERROR_ENUM_VAL \ + (0U) + +/* Enumerated value CNT: CNT errors occurred */ +#define MC33775_FEH_COM_FLT_STAT_COMERRCNT_CNT_ENUM_VAL \ + (1U) + +/* Enumerated value MAX: Maximum communication error counter = 255 communication errors occurred. */ +#define MC33775_FEH_COM_FLT_STAT_COMERRCNT_MAX_ENUM_VAL \ + (255U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t FRAMEERR : 1; + volatile uint16_t CRCERR : 1; + volatile uint16_t ERRCNTOF : 1; + volatile uint16_t COMTO : 1; + volatile uint16_t RSPLENERR : 1; + volatile uint16_t reserved0 : 3; + volatile uint16_t COMERRCNT : 8; + } B; +} mc33775_event_handling_registers_feh_com_flt_stat_t; + +/* -------------------------------------------------------------------------- + * FEH_MEAS_FLT_STAT (read-write):Other fault status register. + * -------------------------------------------------------------------------- */ +#define MC33775_FEH_MEAS_FLT_STAT_OFFSET \ + (0x424U) +#define MC33775_FEH_MEAS_FLT_STAT_RW_MSK \ + (0x7U) +#define MC33775_FEH_MEAS_FLT_STAT_RD_MSK \ + (0x7U) +#define MC33775_FEH_MEAS_FLT_STAT_WR_MSK \ + (0x7U) +#define MC33775_FEH_MEAS_FLT_STAT_MW_MSK \ + (0x7U) +#define MC33775_FEH_MEAS_FLT_STAT_RA_MSK \ + (0x0U) +#define MC33775_FEH_MEAS_FLT_STAT_POR_MSK \ + (0xffffU) +#define MC33775_FEH_MEAS_FLT_STAT_POR_VAL \ + (0x0U) + +/* Field PRIMCALCRCFLT: A fault in the primary measurement chain calibration data */ +#define MC33775_FEH_MEAS_FLT_STAT_PRIMCALCRCFLT_POS \ + (0U) +#define MC33775_FEH_MEAS_FLT_STAT_PRIMCALCRCFLT_MSK \ + (0x1U) + +/* Enumerated value NO_FLT: No fault in primary measurement chain calibration data detected. */ +#define MC33775_FEH_MEAS_FLT_STAT_PRIMCALCRCFLT_NO_FLT_ENUM_VAL \ + (0U) + +/* Enumerated value FAULT: A fault in the primary measurement chain calibration data has been detected. */ +#define MC33775_FEH_MEAS_FLT_STAT_PRIMCALCRCFLT_FAULT_ENUM_VAL \ + (1U) + +/* Field SECCALCCRCFLT: A fault in the secondary measurement chain calibration data */ +#define MC33775_FEH_MEAS_FLT_STAT_SECCALCCRCFLT_POS \ + (1U) +#define MC33775_FEH_MEAS_FLT_STAT_SECCALCCRCFLT_MSK \ + (0x2U) + +/* Enumerated value NO_FLT: No fault in secondary measurement chain calibration data detected. */ +#define MC33775_FEH_MEAS_FLT_STAT_SECCALCCRCFLT_NO_FLT_ENUM_VAL \ + (0U) + +/* Enumerated value FAULT: A fault in the secondary measurement chain calibration data has been detected. */ +#define MC33775_FEH_MEAS_FLT_STAT_SECCALCCRCFLT_FAULT_ENUM_VAL \ + (1U) + +/* Field SYNCMEASFLT: Synchronization fault between the measurement units */ +#define MC33775_FEH_MEAS_FLT_STAT_SYNCMEASFLT_POS \ + (2U) +#define MC33775_FEH_MEAS_FLT_STAT_SYNCMEASFLT_MSK \ + (0x4U) + +/* Enumerated value NO_FLT: No synchronization fault between the measurement units for a Sync cycle has been detected.. */ +#define MC33775_FEH_MEAS_FLT_STAT_SYNCMEASFLT_NO_FLT_ENUM_VAL \ + (0U) + +/* Enumerated value FAULT: Synchronization fault between the measurement units for a Sync cycle has been detected.. */ +#define MC33775_FEH_MEAS_FLT_STAT_SYNCMEASFLT_FAULT_ENUM_VAL \ + (1U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_FEH_MEAS_FLT_STAT_RESERVED0_POS \ + (3U) +#define MC33775_FEH_MEAS_FLT_STAT_RESERVED0_MSK \ + (0xFFF8U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t PRIMCALCRCFLT : 1; + volatile uint16_t SECCALCCRCFLT : 1; + volatile uint16_t SYNCMEASFLT : 1; + volatile uint16_t reserved0 : 13; + } B; +} mc33775_event_handling_registers_feh_meas_flt_stat_t; + +/* -------------------------------------------------------------------------- + * FEH_SUPPLY_FLT_POR_CFG0 (read-write):Supply fault POR selection 0. + * -------------------------------------------------------------------------- */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_OFFSET \ + (0x428U) +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_RW_MSK \ + (0x3FFFU) +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_RD_MSK \ + (0x3FFFU) +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_WR_MSK \ + (0x3FFFU) +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_MW_MSK \ + (0x0U) +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_RA_MSK \ + (0x0U) +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_POR_MSK \ + (0xffffU) +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_POR_VAL \ + (0x0U) + +/* Field VBATOVEN: POR on VBAT Supply over-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VBATOVEN_POS \ + (0U) +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VBATOVEN_MSK \ + (0x1U) + +/* Enumerated value NO_POR: No POR in case of VBAT supply over-voltage */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VBATOVEN_NO_POR_ENUM_VAL \ + (0U) + +/* Enumerated value POR: VBAT supply over-voltage error leads to POR */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VBATOVEN_POR_ENUM_VAL \ + (1U) + +/* Field VDDAOVEN: POR on VDDA Supply over-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VDDAOVEN_POS \ + (1U) +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VDDAOVEN_MSK \ + (0x2U) + +/* Enumerated value NO_POR: No POR in case of VDDA supply over-voltage */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VDDAOVEN_NO_POR_ENUM_VAL \ + (0U) + +/* Enumerated value POR: VDDA supply over-voltage error leads to POR */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VDDAOVEN_POR_ENUM_VAL \ + (1U) + +/* Field VDDAUVEN: POR on VDDA Supply under-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VDDAUVEN_POS \ + (2U) +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VDDAUVEN_MSK \ + (0x4U) + +/* Enumerated value NO_POR: No POR in case of VDDA supply under-voltage */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VDDAUVEN_NO_POR_ENUM_VAL \ + (0U) + +/* Enumerated value POR: VDDA supply under-voltage error leads to POR */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VDDAUVEN_POR_ENUM_VAL \ + (1U) + +/* Field V2P5AOVEN: POR on V2P5A Supply over-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_V2P5AOVEN_POS \ + (3U) +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_V2P5AOVEN_MSK \ + (0x8U) + +/* Enumerated value NO_POR: No POR in case of V2P5A supply over-voltage */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_V2P5AOVEN_NO_POR_ENUM_VAL \ + (0U) + +/* Enumerated value POR: V2P5A supply over-voltage error leads to POR */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_V2P5AOVEN_POR_ENUM_VAL \ + (1U) + +/* Field V2P5AUVEN: POR on V2P5A Supply under-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_V2P5AUVEN_POS \ + (4U) +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_V2P5AUVEN_MSK \ + (0x10U) + +/* Enumerated value NO_POR: No POR in case of V2P5A supply under-voltage */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_V2P5AUVEN_NO_POR_ENUM_VAL \ + (0U) + +/* Enumerated value POR: V2P5A supply under-voltage error leads to POR */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_V2P5AUVEN_POR_ENUM_VAL \ + (1U) + +/* Field AFECPOVEN: POR on AFE Charge Pump over-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_AFECPOVEN_POS \ + (5U) +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_AFECPOVEN_MSK \ + (0x20U) + +/* Enumerated value NO_POR: No POR in case of AFE Charge Pump over-voltage */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_AFECPOVEN_NO_POR_ENUM_VAL \ + (0U) + +/* Enumerated value POR: AFE Charge Pump over-voltage error leads to POR */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_AFECPOVEN_POR_ENUM_VAL \ + (1U) + +/* Field AFECPUVEN: POR on AFE Charge Pump under-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_AFECPUVEN_POS \ + (6U) +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_AFECPUVEN_MSK \ + (0x40U) + +/* Enumerated value NO_POR: No POR in case of AFE Charge Pump under-voltage */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_AFECPUVEN_NO_POR_ENUM_VAL \ + (0U) + +/* Enumerated value POR: AFE Charge Pump under-voltage error leads to POR */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_AFECPUVEN_POR_ENUM_VAL \ + (1U) + +/* Field IBIASPERMOCEN: POR on IBIAS_PERM over-current fault. */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_IBIASPERMOCEN_POS \ + (7U) +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_IBIASPERMOCEN_MSK \ + (0x80U) + +/* Enumerated value NO_POR: No POR in case of IBIAS_PERM over-current */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_IBIASPERMOCEN_NO_POR_ENUM_VAL \ + (0U) + +/* Enumerated value POR: IBIAS_PERM over-current error leads to POR */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_IBIASPERMOCEN_POR_ENUM_VAL \ + (1U) + +/* Field IBIASPERMUCEN: POR on IBIAS_PERM under-current fault. */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_IBIASPERMUCEN_POS \ + (8U) +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_IBIASPERMUCEN_MSK \ + (0x100U) + +/* Enumerated value NO_POR: No POR in case of IBIAS_PERM under-current */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_IBIASPERMUCEN_NO_POR_ENUM_VAL \ + (0U) + +/* Enumerated value POR: IBIAS_PERM under-current error leads to POR */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_IBIASPERMUCEN_POR_ENUM_VAL \ + (1U) + +/* Field VPREREFSUVEN: POR on VPREREFS Supply under-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VPREREFSUVEN_POS \ + (9U) +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VPREREFSUVEN_MSK \ + (0x200U) + +/* Enumerated value NO_POR: No POR in case of VPREREFS supply under-voltage */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VPREREFSUVEN_NO_POR_ENUM_VAL \ + (0U) + +/* Enumerated value POR: VPREREFS supply under-voltage error leads to POR */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VPREREFSUVEN_POR_ENUM_VAL \ + (1U) + +/* Field VAUXOVEN: POR on VAUX over-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VAUXOVEN_POS \ + (10U) +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VAUXOVEN_MSK \ + (0x400U) + +/* Enumerated value NO_POR: No POR in case of VAUX supply over-voltage */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VAUXOVEN_NO_POR_ENUM_VAL \ + (0U) + +/* Enumerated value POR: VAUX supply over-voltage error leads to POR */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VAUXOVEN_POR_ENUM_VAL \ + (1U) + +/* Field VAUXUVEN: POR on VAUX under-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VAUXUVEN_POS \ + (11U) +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VAUXUVEN_MSK \ + (0x800U) + +/* Enumerated value NO_POR: No POR in case of VAUX supply under-voltage */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VAUXUVEN_NO_POR_ENUM_VAL \ + (0U) + +/* Enumerated value POR: VAUX supply under-voltage error leads to POR */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VAUXUVEN_POR_ENUM_VAL \ + (1U) + +/* Field VDDCOVEN: POR on VDDC over-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VDDCOVEN_POS \ + (12U) +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VDDCOVEN_MSK \ + (0x1000U) + +/* Enumerated value NO_POR: No POR in case of VDDC over-voltage */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VDDCOVEN_NO_POR_ENUM_VAL \ + (0U) + +/* Enumerated value POR: VDDC over-voltage error leads to POR */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VDDCOVEN_POR_ENUM_VAL \ + (1U) + +/* Field VDDCUVEN: POR on VDDC under-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VDDCUVEN_POS \ + (13U) +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VDDCUVEN_MSK \ + (0x2000U) + +/* Enumerated value NO_POR: No POR in case of VDDC under-voltage */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VDDCUVEN_NO_POR_ENUM_VAL \ + (0U) + +/* Enumerated value POR: VDDC under-voltage error leads to POR */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_VDDCUVEN_POR_ENUM_VAL \ + (1U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_RESERVED0_POS \ + (14U) +#define MC33775_FEH_SUPPLY_FLT_POR_CFG0_RESERVED0_MSK \ + (0xC000U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VBATOVEN : 1; + volatile uint16_t VDDAOVEN : 1; + volatile uint16_t VDDAUVEN : 1; + volatile uint16_t V2P5AOVEN : 1; + volatile uint16_t V2P5AUVEN : 1; + volatile uint16_t AFECPOVEN : 1; + volatile uint16_t AFECPUVEN : 1; + volatile uint16_t IBIASPERMOCEN : 1; + volatile uint16_t IBIASPERMUCEN : 1; + volatile uint16_t VPREREFSUVEN : 1; + volatile uint16_t VAUXOVEN : 1; + volatile uint16_t VAUXUVEN : 1; + volatile uint16_t VDDCOVEN : 1; + volatile uint16_t VDDCUVEN : 1; + volatile uint16_t reserved0 : 2; + } B; +} mc33775_event_handling_registers_feh_supply_flt_por_cfg0_t; + +/* -------------------------------------------------------------------------- + * FEH_SUPPLY_FLT_POR_CFG1 (read-write):Supply fault POR selection 1. + * -------------------------------------------------------------------------- */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_OFFSET \ + (0x429U) +#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_RW_MSK \ + (0x3FU) +#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_RD_MSK \ + (0x3FU) +#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_WR_MSK \ + (0x3FU) +#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_MW_MSK \ + (0x0U) +#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_RA_MSK \ + (0x0U) +#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_POR_MSK \ + (0xffffU) +#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_POR_VAL \ + (0x0U) + +/* Field VBATLVEN: POR on VBAT Supply low-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_VBATLVEN_POS \ + (0U) +#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_VBATLVEN_MSK \ + (0x1U) + +/* Enumerated value NO_POR: No POR in case of VBAT supply low-voltage */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_VBATLVEN_NO_POR_ENUM_VAL \ + (0U) + +/* Enumerated value POR: VBAT supply low-voltage error leads to POR */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_VBATLVEN_POR_ENUM_VAL \ + (1U) + +/* Field VPREREFSOVEN: POR on VPREREFS Supply over-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_VPREREFSOVEN_POS \ + (1U) +#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_VPREREFSOVEN_MSK \ + (0x2U) + +/* Enumerated value NO_POR: No POR in case of VPREREFS over-voltage */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_VPREREFSOVEN_NO_POR_ENUM_VAL \ + (0U) + +/* Enumerated value POR: VPREREFS over-voltage error leads to POR */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_VPREREFSOVEN_POR_ENUM_VAL \ + (1U) + +/* Field VDDCHCEN: POR on VDDC high-current fault. */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_VDDCHCEN_POS \ + (2U) +#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_VDDCHCEN_MSK \ + (0x4U) + +/* Enumerated value NO_POR: No POR in case of VDDC high-current */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_VDDCHCEN_NO_POR_ENUM_VAL \ + (0U) + +/* Enumerated value POR: VDDC high-current error leads to POR */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_VDDCHCEN_POR_ENUM_VAL \ + (1U) + +/* Field VDDIOOVEN: POR on VDDIO Supply over-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_VDDIOOVEN_POS \ + (3U) +#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_VDDIOOVEN_MSK \ + (0x8U) + +/* Enumerated value NO_POR: No POR in case of VDDIO supply over-voltage */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_VDDIOOVEN_NO_POR_ENUM_VAL \ + (0U) + +/* Enumerated value POR: VDDIO supply over-voltage error leads to POR */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_VDDIOOVEN_POR_ENUM_VAL \ + (1U) + +/* Field VDDIOUVEN: POR on VDDIO Supply under-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_VDDIOUVEN_POS \ + (4U) +#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_VDDIOUVEN_MSK \ + (0x10U) + +/* Enumerated value NO_POR: No POR in case of VDDIO supply under-voltage */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_VDDIOUVEN_NO_POR_ENUM_VAL \ + (0U) + +/* Enumerated value POR: VDDIO supply under-voltage error leads to POR */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_VDDIOUVEN_POR_ENUM_VAL \ + (1U) + +/* Field VPREOVEN: POR on VPRE Supply over-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_VPREOVEN_POS \ + (5U) +#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_VPREOVEN_MSK \ + (0x20U) + +/* Enumerated value NO_POR: No POR in case of VPRE over-voltage */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_VPREOVEN_NO_POR_ENUM_VAL \ + (0U) + +/* Enumerated value POR: VPRE over-voltage error leads to POR */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_VPREOVEN_POR_ENUM_VAL \ + (1U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_RESERVED0_POS \ + (6U) +#define MC33775_FEH_SUPPLY_FLT_POR_CFG1_RESERVED0_MSK \ + (0xFFC0U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VBATLVEN : 1; + volatile uint16_t VPREREFSOVEN : 1; + volatile uint16_t VDDCHCEN : 1; + volatile uint16_t VDDIOOVEN : 1; + volatile uint16_t VDDIOUVEN : 1; + volatile uint16_t VPREOVEN : 1; + volatile uint16_t reserved0 : 10; + } B; +} mc33775_event_handling_registers_feh_supply_flt_por_cfg1_t; + +/* -------------------------------------------------------------------------- + * FEH_ANA_FLT_POR_CFG (read-only):Analog fault POR selection. + * -------------------------------------------------------------------------- */ +#define MC33775_FEH_ANA_FLT_POR_CFG_OFFSET \ + (0x42AU) +#define MC33775_FEH_ANA_FLT_POR_CFG_RW_MSK \ + (0x0U) +#define MC33775_FEH_ANA_FLT_POR_CFG_RD_MSK \ + (0x0U) +#define MC33775_FEH_ANA_FLT_POR_CFG_WR_MSK \ + (0x0U) +#define MC33775_FEH_ANA_FLT_POR_CFG_MW_MSK \ + (0x0U) +#define MC33775_FEH_ANA_FLT_POR_CFG_RA_MSK \ + (0x0U) +#define MC33775_FEH_ANA_FLT_POR_CFG_POR_MSK \ + (0xffffU) +#define MC33775_FEH_ANA_FLT_POR_CFG_POR_VAL \ + (0x0U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_FEH_ANA_FLT_POR_CFG_RESERVED0_POS \ + (0U) +#define MC33775_FEH_ANA_FLT_POR_CFG_RESERVED0_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t reserved0 : 16; + } B; +} mc33775_event_handling_registers_feh_ana_flt_por_cfg_t; + +/* -------------------------------------------------------------------------- + * FEH_COM_FLT_POR_CFG (read-write):Communication fault POR enable register. + * -------------------------------------------------------------------------- */ +#define MC33775_FEH_COM_FLT_POR_CFG_OFFSET \ + (0x42BU) +#define MC33775_FEH_COM_FLT_POR_CFG_RW_MSK \ + (0xCU) +#define MC33775_FEH_COM_FLT_POR_CFG_RD_MSK \ + (0xCU) +#define MC33775_FEH_COM_FLT_POR_CFG_WR_MSK \ + (0xCU) +#define MC33775_FEH_COM_FLT_POR_CFG_MW_MSK \ + (0x0U) +#define MC33775_FEH_COM_FLT_POR_CFG_RA_MSK \ + (0x0U) +#define MC33775_FEH_COM_FLT_POR_CFG_POR_MSK \ + (0xffffU) +#define MC33775_FEH_COM_FLT_POR_CFG_POR_VAL \ + (0x8U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_FEH_COM_FLT_POR_CFG_RESERVED0_POS \ + (0U) +#define MC33775_FEH_COM_FLT_POR_CFG_RESERVED0_MSK \ + (0x3U) + +/* Field ERRCNTOFEN: Communication error counter max value leads to POR */ +#define MC33775_FEH_COM_FLT_POR_CFG_ERRCNTOFEN_POS \ + (2U) +#define MC33775_FEH_COM_FLT_POR_CFG_ERRCNTOFEN_MSK \ + (0x4U) + +/* Enumerated value NO_POR: Communication error counter has reached max value. */ +#define MC33775_FEH_COM_FLT_POR_CFG_ERRCNTOFEN_NO_POR_ENUM_VAL \ + (0U) + +/* Enumerated value POR: Communication error counter max value leads to POR */ +#define MC33775_FEH_COM_FLT_POR_CFG_ERRCNTOFEN_POR_ENUM_VAL \ + (1U) + +/* Field COMTOEN: Create a POR if a communication timeout happens. */ +#define MC33775_FEH_COM_FLT_POR_CFG_COMTOEN_POS \ + (3U) +#define MC33775_FEH_COM_FLT_POR_CFG_COMTOEN_MSK \ + (0x8U) + +/* Enumerated value PREV_MOD: Device fallbacks to prev. Mode in case of communication timeout */ +#define MC33775_FEH_COM_FLT_POR_CFG_COMTOEN_PREV_MOD_ENUM_VAL \ + (0U) + +/* Enumerated value POR: POR in case of communication timeout */ +#define MC33775_FEH_COM_FLT_POR_CFG_COMTOEN_POR_ENUM_VAL \ + (1U) + +/* Field reserved1: This read-only field is reserved and always has the value 0. */ +#define MC33775_FEH_COM_FLT_POR_CFG_RESERVED1_POS \ + (4U) +#define MC33775_FEH_COM_FLT_POR_CFG_RESERVED1_MSK \ + (0xFFF0U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t reserved0 : 2; + volatile uint16_t ERRCNTOFEN : 1; + volatile uint16_t COMTOEN : 1; + volatile uint16_t reserved1 : 12; + } B; +} mc33775_event_handling_registers_feh_com_flt_por_cfg_t; + +/* -------------------------------------------------------------------------- + * FEH_SUPPLY_FLT_EVT_CFG0 (read-write):Supply fault event selection register 0. + * -------------------------------------------------------------------------- */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_OFFSET \ + (0x430U) +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_RW_MSK \ + (0x3FFFU) +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_RD_MSK \ + (0x3FFFU) +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_WR_MSK \ + (0x3FFFU) +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_MW_MSK \ + (0x0U) +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_RA_MSK \ + (0x0U) +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_POR_MSK \ + (0xffffU) +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_POR_VAL \ + (0x0U) + +/* Field VBATOVEN: Event on VBAT Supply over-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VBATOVEN_POS \ + (0U) +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VBATOVEN_MSK \ + (0x1U) + +/* Enumerated value NO_EV: No event on VBAT Supply over-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VBATOVEN_NO_EV_ENUM_VAL \ + (0U) + +/* Enumerated value EVENT: Event on VBAT Supply over-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VBATOVEN_EVENT_ENUM_VAL \ + (1U) + +/* Field VDDAOVEN: Event on VDDA Supply over-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VDDAOVEN_POS \ + (1U) +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VDDAOVEN_MSK \ + (0x2U) + +/* Enumerated value NO_EV: No event on VDDA Supply over-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VDDAOVEN_NO_EV_ENUM_VAL \ + (0U) + +/* Enumerated value EVENT: Event on VDDA Supply over-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VDDAOVEN_EVENT_ENUM_VAL \ + (1U) + +/* Field VDDAUVEN: Event on VDDA Supply under-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VDDAUVEN_POS \ + (2U) +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VDDAUVEN_MSK \ + (0x4U) + +/* Enumerated value NO_EV: No event on VDDA Supply under-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VDDAUVEN_NO_EV_ENUM_VAL \ + (0U) + +/* Enumerated value EVENT: Event on VDDA Supply under-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VDDAUVEN_EVENT_ENUM_VAL \ + (1U) + +/* Field V2P5AOVEN: Event on V2P5A Supply over-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_V2P5AOVEN_POS \ + (3U) +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_V2P5AOVEN_MSK \ + (0x8U) + +/* Enumerated value NO_EV: No event on V2P5A Supply over-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_V2P5AOVEN_NO_EV_ENUM_VAL \ + (0U) + +/* Enumerated value EVENT: Event on V2P5A Supply over-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_V2P5AOVEN_EVENT_ENUM_VAL \ + (1U) + +/* Field V2P5AUVEN: Event on V2P5A Supply under-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_V2P5AUVEN_POS \ + (4U) +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_V2P5AUVEN_MSK \ + (0x10U) + +/* Enumerated value NO_EV: No event on V2P5A Supply under-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_V2P5AUVEN_NO_EV_ENUM_VAL \ + (0U) + +/* Enumerated value EVENT: Event on V2P5A Supply under-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_V2P5AUVEN_EVENT_ENUM_VAL \ + (1U) + +/* Field AFECPOVEN: Event on AFE Charge Pump over-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_AFECPOVEN_POS \ + (5U) +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_AFECPOVEN_MSK \ + (0x20U) + +/* Enumerated value NO_EV: No event on AFE Charge Pump over-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_AFECPOVEN_NO_EV_ENUM_VAL \ + (0U) + +/* Enumerated value EVENT: Event on AFE Charge Pump over-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_AFECPOVEN_EVENT_ENUM_VAL \ + (1U) + +/* Field AFECPUVEN: Event on AFE Charge Pump under-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_AFECPUVEN_POS \ + (6U) +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_AFECPUVEN_MSK \ + (0x40U) + +/* Enumerated value NO_EV: No event on AFE Charge Pump under-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_AFECPUVEN_NO_EV_ENUM_VAL \ + (0U) + +/* Enumerated value EVENT: Event on AFE Charge Pump under-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_AFECPUVEN_EVENT_ENUM_VAL \ + (1U) + +/* Field IBIASPERMOCEN: Event on IBIAS_PERM over-current fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_IBIASPERMOCEN_POS \ + (7U) +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_IBIASPERMOCEN_MSK \ + (0x80U) + +/* Enumerated value NO_EV: No event on IBIAS_PERM over-current fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_IBIASPERMOCEN_NO_EV_ENUM_VAL \ + (0U) + +/* Enumerated value EVENT: Event on IBIAS_PERM over-current fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_IBIASPERMOCEN_EVENT_ENUM_VAL \ + (1U) + +/* Field IBIASPERMUCEN: Event on IBIAS_PERM under-current fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_IBIASPERMUCEN_POS \ + (8U) +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_IBIASPERMUCEN_MSK \ + (0x100U) + +/* Enumerated value NO_EV: No event on IBIAS_PERM under-current fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_IBIASPERMUCEN_NO_EV_ENUM_VAL \ + (0U) + +/* Enumerated value EVENT: Event on IBIAS_PERM under-current fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_IBIASPERMUCEN_EVENT_ENUM_VAL \ + (1U) + +/* Field VPREREFSUVEN: Event on VPREREFS Supply under-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VPREREFSUVEN_POS \ + (9U) +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VPREREFSUVEN_MSK \ + (0x200U) + +/* Enumerated value NO_EV: No event on VPREREFS Supply under-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VPREREFSUVEN_NO_EV_ENUM_VAL \ + (0U) + +/* Enumerated value EVENT: Event on VPREREFS Supply under-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VPREREFSUVEN_EVENT_ENUM_VAL \ + (1U) + +/* Field VAUXOVEN: Event on VAUX over-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VAUXOVEN_POS \ + (10U) +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VAUXOVEN_MSK \ + (0x400U) + +/* Enumerated value NO_EV: No event on VAUX over-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VAUXOVEN_NO_EV_ENUM_VAL \ + (0U) + +/* Enumerated value EVENT: Event on VAUX over-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VAUXOVEN_EVENT_ENUM_VAL \ + (1U) + +/* Field VAUXUVEN: Event on VAUX under-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VAUXUVEN_POS \ + (11U) +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VAUXUVEN_MSK \ + (0x800U) + +/* Enumerated value NO_EV: No event on VAUX under-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VAUXUVEN_NO_EV_ENUM_VAL \ + (0U) + +/* Enumerated value EVENT: Event on VAUX under-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VAUXUVEN_EVENT_ENUM_VAL \ + (1U) + +/* Field VDDCOVEN: Event on VDDC over-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VDDCOVEN_POS \ + (12U) +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VDDCOVEN_MSK \ + (0x1000U) + +/* Enumerated value NO_EV: No event on VDDC over-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VDDCOVEN_NO_EV_ENUM_VAL \ + (0U) + +/* Enumerated value EVENT: Event on VDDC over-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VDDCOVEN_EVENT_ENUM_VAL \ + (1U) + +/* Field VDDCUVEN: Event on VDDC under-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VDDCUVEN_POS \ + (13U) +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VDDCUVEN_MSK \ + (0x2000U) + +/* Enumerated value NO_EV: No event on VDDC under-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VDDCUVEN_NO_EV_ENUM_VAL \ + (0U) + +/* Enumerated value EVENT: Event on VDDC under-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_VDDCUVEN_EVENT_ENUM_VAL \ + (1U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_RESERVED0_POS \ + (14U) +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG0_RESERVED0_MSK \ + (0xC000U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VBATOVEN : 1; + volatile uint16_t VDDAOVEN : 1; + volatile uint16_t VDDAUVEN : 1; + volatile uint16_t V2P5AOVEN : 1; + volatile uint16_t V2P5AUVEN : 1; + volatile uint16_t AFECPOVEN : 1; + volatile uint16_t AFECPUVEN : 1; + volatile uint16_t IBIASPERMOCEN : 1; + volatile uint16_t IBIASPERMUCEN : 1; + volatile uint16_t VPREREFSUVEN : 1; + volatile uint16_t VAUXOVEN : 1; + volatile uint16_t VAUXUVEN : 1; + volatile uint16_t VDDCOVEN : 1; + volatile uint16_t VDDCUVEN : 1; + volatile uint16_t reserved0 : 2; + } B; +} mc33775_event_handling_registers_feh_supply_flt_evt_cfg0_t; + +/* -------------------------------------------------------------------------- + * FEH_SUPPLY_FLT_EVT_CFG1 (read-write):Supply fault event selection register 1. + * -------------------------------------------------------------------------- */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_OFFSET \ + (0x431U) +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_RW_MSK \ + (0x3FU) +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_RD_MSK \ + (0x3FU) +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_WR_MSK \ + (0x3FU) +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_MW_MSK \ + (0x0U) +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_RA_MSK \ + (0x0U) +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_POR_MSK \ + (0xffffU) +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_POR_VAL \ + (0x0U) + +/* Field VBATLVEN: Event on VBAT Supply low-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_VBATLVEN_POS \ + (0U) +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_VBATLVEN_MSK \ + (0x1U) + +/* Enumerated value NO_EV: No event on VBAT Supply low-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_VBATLVEN_NO_EV_ENUM_VAL \ + (0U) + +/* Enumerated value EVENT: Event on VBAT Supply low-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_VBATLVEN_EVENT_ENUM_VAL \ + (1U) + +/* Field VPREREFSOVEN: Event on VPREREFS Supply over-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_VPREREFSOVEN_POS \ + (1U) +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_VPREREFSOVEN_MSK \ + (0x2U) + +/* Enumerated value NO_EV: No event on VPREREFS Supply over-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_VPREREFSOVEN_NO_EV_ENUM_VAL \ + (0U) + +/* Enumerated value EVENT: Event on VPREREFS Supply over-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_VPREREFSOVEN_EVENT_ENUM_VAL \ + (1U) + +/* Field VDDCHCEN: Event on VDDC high-current fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_VDDCHCEN_POS \ + (2U) +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_VDDCHCEN_MSK \ + (0x4U) + +/* Enumerated value NO_EV: No event on VDDC high-current fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_VDDCHCEN_NO_EV_ENUM_VAL \ + (0U) + +/* Enumerated value EVENT: Event on VDDC high-current fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_VDDCHCEN_EVENT_ENUM_VAL \ + (1U) + +/* Field VDDIOOVEN: Event on VDDIO Supply over-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_VDDIOOVEN_POS \ + (3U) +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_VDDIOOVEN_MSK \ + (0x8U) + +/* Enumerated value NO_EV: No event on VDDIO Supply over-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_VDDIOOVEN_NO_EV_ENUM_VAL \ + (0U) + +/* Enumerated value EVENT: Event on VDDIO Supply over-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_VDDIOOVEN_EVENT_ENUM_VAL \ + (1U) + +/* Field VDDIOUVEN: Event on VDDIO Supply under-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_VDDIOUVEN_POS \ + (4U) +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_VDDIOUVEN_MSK \ + (0x10U) + +/* Enumerated value NO_EV: No event on VDDIO Supply under-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_VDDIOUVEN_NO_EV_ENUM_VAL \ + (0U) + +/* Enumerated value EVENT: Event on VDDIO Supply under-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_VDDIOUVEN_EVENT_ENUM_VAL \ + (1U) + +/* Field VPREOVEN: Event on VPRE Supply over-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_VPREOVEN_POS \ + (5U) +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_VPREOVEN_MSK \ + (0x20U) + +/* Enumerated value NO_EV: No event on VPRE Supply over-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_VPREOVEN_NO_EV_ENUM_VAL \ + (0U) + +/* Enumerated value EVENT: Event on VPRE Supply over-voltage fault. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_VPREOVEN_EVENT_ENUM_VAL \ + (1U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_RESERVED0_POS \ + (6U) +#define MC33775_FEH_SUPPLY_FLT_EVT_CFG1_RESERVED0_MSK \ + (0xFFC0U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VBATLVEN : 1; + volatile uint16_t VPREREFSOVEN : 1; + volatile uint16_t VDDCHCEN : 1; + volatile uint16_t VDDIOOVEN : 1; + volatile uint16_t VDDIOUVEN : 1; + volatile uint16_t VPREOVEN : 1; + volatile uint16_t reserved0 : 10; + } B; +} mc33775_event_handling_registers_feh_supply_flt_evt_cfg1_t; + +/* -------------------------------------------------------------------------- + * FEH_ANA_FLT_EVT_CFG (read-write):Analog fault event enable register. + * -------------------------------------------------------------------------- */ +#define MC33775_FEH_ANA_FLT_EVT_CFG_OFFSET \ + (0x432U) +#define MC33775_FEH_ANA_FLT_EVT_CFG_RW_MSK \ + (0x7U) +#define MC33775_FEH_ANA_FLT_EVT_CFG_RD_MSK \ + (0x7U) +#define MC33775_FEH_ANA_FLT_EVT_CFG_WR_MSK \ + (0x7U) +#define MC33775_FEH_ANA_FLT_EVT_CFG_MW_MSK \ + (0x0U) +#define MC33775_FEH_ANA_FLT_EVT_CFG_RA_MSK \ + (0x0U) +#define MC33775_FEH_ANA_FLT_EVT_CFG_POR_MSK \ + (0xffffU) +#define MC33775_FEH_ANA_FLT_EVT_CFG_POR_VAL \ + (0x0U) + +/* Field MONBISTEN: Event on Monitor BIST fault. */ +#define MC33775_FEH_ANA_FLT_EVT_CFG_MONBISTEN_POS \ + (0U) +#define MC33775_FEH_ANA_FLT_EVT_CFG_MONBISTEN_MSK \ + (0x1U) + +/* Enumerated value NO_EV: No event on Monitor BIST fault. */ +#define MC33775_FEH_ANA_FLT_EVT_CFG_MONBISTEN_NO_EV_ENUM_VAL \ + (0U) + +/* Enumerated value EVENT: Event on Monitor BIST fault. */ +#define MC33775_FEH_ANA_FLT_EVT_CFG_MONBISTEN_EVENT_ENUM_VAL \ + (1U) + +/* Field BALFLTEN: Event on cell balance function fault. */ +#define MC33775_FEH_ANA_FLT_EVT_CFG_BALFLTEN_POS \ + (1U) +#define MC33775_FEH_ANA_FLT_EVT_CFG_BALFLTEN_MSK \ + (0x2U) + +/* Enumerated value NO_EV: No event on cell balance function fault. */ +#define MC33775_FEH_ANA_FLT_EVT_CFG_BALFLTEN_NO_EV_ENUM_VAL \ + (0U) + +/* Enumerated value EVENT: Event on cell balance function fault. */ +#define MC33775_FEH_ANA_FLT_EVT_CFG_BALFLTEN_EVENT_ENUM_VAL \ + (1U) + +/* Field FUSEFLTEN: Event on a corrected bit error in the fuse data has been detected. */ +#define MC33775_FEH_ANA_FLT_EVT_CFG_FUSEFLTEN_POS \ + (2U) +#define MC33775_FEH_ANA_FLT_EVT_CFG_FUSEFLTEN_MSK \ + (0x4U) + +/* Enumerated value NO_EV: No event on a corrected bit error in the fuse data has been detected. */ +#define MC33775_FEH_ANA_FLT_EVT_CFG_FUSEFLTEN_NO_EV_ENUM_VAL \ + (0U) + +/* Enumerated value EVENT: Event on a corrected bit error in the fuse data has been detected. */ +#define MC33775_FEH_ANA_FLT_EVT_CFG_FUSEFLTEN_EVENT_ENUM_VAL \ + (1U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_FEH_ANA_FLT_EVT_CFG_RESERVED0_POS \ + (3U) +#define MC33775_FEH_ANA_FLT_EVT_CFG_RESERVED0_MSK \ + (0xFFF8U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t MONBISTEN : 1; + volatile uint16_t BALFLTEN : 1; + volatile uint16_t FUSEFLTEN : 1; + volatile uint16_t reserved0 : 13; + } B; +} mc33775_event_handling_registers_feh_ana_flt_evt_cfg_t; + +/* -------------------------------------------------------------------------- + * FEH_COM_FLT_EVT_CFG (read-write):Communication fault event enable register. + * -------------------------------------------------------------------------- */ +#define MC33775_FEH_COM_FLT_EVT_CFG_OFFSET \ + (0x433U) +#define MC33775_FEH_COM_FLT_EVT_CFG_RW_MSK \ + (0x17U) +#define MC33775_FEH_COM_FLT_EVT_CFG_RD_MSK \ + (0x17U) +#define MC33775_FEH_COM_FLT_EVT_CFG_WR_MSK \ + (0x17U) +#define MC33775_FEH_COM_FLT_EVT_CFG_MW_MSK \ + (0x0U) +#define MC33775_FEH_COM_FLT_EVT_CFG_RA_MSK \ + (0x0U) +#define MC33775_FEH_COM_FLT_EVT_CFG_POR_MSK \ + (0xffffU) +#define MC33775_FEH_COM_FLT_EVT_CFG_POR_VAL \ + (0x0U) + +/* Field FRAMEERREN: Event on communication error detected. Wrong number of bits, bit-length error. */ +#define MC33775_FEH_COM_FLT_EVT_CFG_FRAMEERREN_POS \ + (0U) +#define MC33775_FEH_COM_FLT_EVT_CFG_FRAMEERREN_MSK \ + (0x1U) + +/* Enumerated value NO_EV: No event on communication error detected. */ +#define MC33775_FEH_COM_FLT_EVT_CFG_FRAMEERREN_NO_EV_ENUM_VAL \ + (0U) + +/* Enumerated value EVENT: Event on communication error detected. */ +#define MC33775_FEH_COM_FLT_EVT_CFG_FRAMEERREN_EVENT_ENUM_VAL \ + (1U) + +/* Field CRCERREN: Event on communication CRC error detected. */ +#define MC33775_FEH_COM_FLT_EVT_CFG_CRCERREN_POS \ + (1U) +#define MC33775_FEH_COM_FLT_EVT_CFG_CRCERREN_MSK \ + (0x2U) + +/* Enumerated value NO_EV: No event on communication CRC error detected. */ +#define MC33775_FEH_COM_FLT_EVT_CFG_CRCERREN_NO_EV_ENUM_VAL \ + (0U) + +/* Enumerated value EVENT: Event on communication CRC error detected. */ +#define MC33775_FEH_COM_FLT_EVT_CFG_CRCERREN_EVENT_ENUM_VAL \ + (1U) + +/* Field ERRCNTOFEN: Event on communication error counter has reached max value. */ +#define MC33775_FEH_COM_FLT_EVT_CFG_ERRCNTOFEN_POS \ + (2U) +#define MC33775_FEH_COM_FLT_EVT_CFG_ERRCNTOFEN_MSK \ + (0x4U) + +/* Enumerated value NO_EV: No event on communication error counter has reached max value. */ +#define MC33775_FEH_COM_FLT_EVT_CFG_ERRCNTOFEN_NO_EV_ENUM_VAL \ + (0U) + +/* Enumerated value EVENT: Event on communication error counter has reached max value. */ +#define MC33775_FEH_COM_FLT_EVT_CFG_ERRCNTOFEN_EVENT_ENUM_VAL \ + (1U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_FEH_COM_FLT_EVT_CFG_RESERVED0_POS \ + (3U) +#define MC33775_FEH_COM_FLT_EVT_CFG_RESERVED0_MSK \ + (0x8U) + +/* Field RSPLENERREN: Event on number of SPI clocks did not fit to the length of a requested response */ +#define MC33775_FEH_COM_FLT_EVT_CFG_RSPLENERREN_POS \ + (4U) +#define MC33775_FEH_COM_FLT_EVT_CFG_RSPLENERREN_MSK \ + (0x10U) + +/* Enumerated value NO_EV: No event on number of SPI clocks did not fit to the length of a requested response */ +#define MC33775_FEH_COM_FLT_EVT_CFG_RSPLENERREN_NO_EV_ENUM_VAL \ + (0U) + +/* Enumerated value EVENT: Event on number of SPI clocks did not fit to the length of a requested response */ +#define MC33775_FEH_COM_FLT_EVT_CFG_RSPLENERREN_EVENT_ENUM_VAL \ + (1U) + +/* Field reserved1: This read-only field is reserved and always has the value 0. */ +#define MC33775_FEH_COM_FLT_EVT_CFG_RESERVED1_POS \ + (5U) +#define MC33775_FEH_COM_FLT_EVT_CFG_RESERVED1_MSK \ + (0xFFE0U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t FRAMEERREN : 1; + volatile uint16_t CRCERREN : 1; + volatile uint16_t ERRCNTOFEN : 1; + volatile uint16_t reserved0 : 1; + volatile uint16_t RSPLENERREN : 1; + volatile uint16_t reserved1 : 11; + } B; +} mc33775_event_handling_registers_feh_com_flt_evt_cfg_t; + +/* -------------------------------------------------------------------------- + * FEH_MEAS_FLT_EVT_CFG (read-write):Measurement fault event enable register. + * -------------------------------------------------------------------------- */ +#define MC33775_FEH_MEAS_FLT_EVT_CFG_OFFSET \ + (0x434U) +#define MC33775_FEH_MEAS_FLT_EVT_CFG_RW_MSK \ + (0x7U) +#define MC33775_FEH_MEAS_FLT_EVT_CFG_RD_MSK \ + (0x7U) +#define MC33775_FEH_MEAS_FLT_EVT_CFG_WR_MSK \ + (0x7U) +#define MC33775_FEH_MEAS_FLT_EVT_CFG_MW_MSK \ + (0x0U) +#define MC33775_FEH_MEAS_FLT_EVT_CFG_RA_MSK \ + (0x0U) +#define MC33775_FEH_MEAS_FLT_EVT_CFG_POR_MSK \ + (0xffffU) +#define MC33775_FEH_MEAS_FLT_EVT_CFG_POR_VAL \ + (0x0U) + +/* Field PRIMCALCRCFLTEN: Event on primary calibration CRC fault. */ +#define MC33775_FEH_MEAS_FLT_EVT_CFG_PRIMCALCRCFLTEN_POS \ + (0U) +#define MC33775_FEH_MEAS_FLT_EVT_CFG_PRIMCALCRCFLTEN_MSK \ + (0x1U) + +/* Enumerated value NO_EV: No event on primary calibration CRC fault. */ +#define MC33775_FEH_MEAS_FLT_EVT_CFG_PRIMCALCRCFLTEN_NO_EV_ENUM_VAL \ + (0U) + +/* Enumerated value EVENT: Event on primary calibration CRC fault. */ +#define MC33775_FEH_MEAS_FLT_EVT_CFG_PRIMCALCRCFLTEN_EVENT_ENUM_VAL \ + (1U) + +/* Field SECCALCRCFLTEN: Event on secondary calibration CRC fault. */ +#define MC33775_FEH_MEAS_FLT_EVT_CFG_SECCALCRCFLTEN_POS \ + (1U) +#define MC33775_FEH_MEAS_FLT_EVT_CFG_SECCALCRCFLTEN_MSK \ + (0x2U) + +/* Enumerated value NO_EV: No event on secondary calibration CRC fault. */ +#define MC33775_FEH_MEAS_FLT_EVT_CFG_SECCALCRCFLTEN_NO_EV_ENUM_VAL \ + (0U) + +/* Enumerated value EVENT: Event on secondary calibration CRC fault. */ +#define MC33775_FEH_MEAS_FLT_EVT_CFG_SECCALCRCFLTEN_EVENT_ENUM_VAL \ + (1U) + +/* Field SYNCMEASFLTEN: Event on synchronization fault between the measurement units for a Sync cycle. */ +#define MC33775_FEH_MEAS_FLT_EVT_CFG_SYNCMEASFLTEN_POS \ + (2U) +#define MC33775_FEH_MEAS_FLT_EVT_CFG_SYNCMEASFLTEN_MSK \ + (0x4U) + +/* Enumerated value NO_EV: No event on synchronization fault. */ +#define MC33775_FEH_MEAS_FLT_EVT_CFG_SYNCMEASFLTEN_NO_EV_ENUM_VAL \ + (0U) + +/* Enumerated value EVENT: Event on synchronization fault. */ +#define MC33775_FEH_MEAS_FLT_EVT_CFG_SYNCMEASFLTEN_EVENT_ENUM_VAL \ + (1U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_FEH_MEAS_FLT_EVT_CFG_RESERVED0_POS \ + (3U) +#define MC33775_FEH_MEAS_FLT_EVT_CFG_RESERVED0_MSK \ + (0xFFF8U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t PRIMCALCRCFLTEN : 1; + volatile uint16_t SECCALCRCFLTEN : 1; + volatile uint16_t SYNCMEASFLTEN : 1; + volatile uint16_t reserved0 : 13; + } B; +} mc33775_event_handling_registers_feh_meas_flt_evt_cfg_t; + +/* -------------------------------------------------------------------------- + * FEH_POR_REASON (read-only):Last power on reset reason. The value is stored in the ULP domain. + * -------------------------------------------------------------------------- */ +#define MC33775_FEH_POR_REASON_OFFSET \ + (0x480U) +#define MC33775_FEH_POR_REASON_RW_MSK \ + (0x0U) +#define MC33775_FEH_POR_REASON_RD_MSK \ + (0x3FFU) +#define MC33775_FEH_POR_REASON_WR_MSK \ + (0x0U) +#define MC33775_FEH_POR_REASON_MW_MSK \ + (0x0U) +#define MC33775_FEH_POR_REASON_RA_MSK \ + (0x0U) +#define MC33775_FEH_POR_REASON_POR_MSK \ + (0xffffU) +#define MC33775_FEH_POR_REASON_POR_VAL \ + (0x0U) + +/* Field SOURCE: Reason for last POR: Binary coded and protected by an EDC. */ +#define MC33775_FEH_POR_REASON_SOURCE_POS \ + (0U) +#define MC33775_FEH_POR_REASON_SOURCE_MSK \ + (0x3FFU) + +/* Enumerated value VDDDLPPERMUV: POR caused by VDDDLPPERMUV */ +#define MC33775_FEH_POR_REASON_SOURCE_VDDDLPPERMUV_ENUM_VAL \ + (0U) + +/* Enumerated value VDDDLPUV: POR caused by VDDDLPUV */ +#define MC33775_FEH_POR_REASON_SOURCE_VDDDLPUV_ENUM_VAL \ + (15U) + +/* Enumerated value RESET: POR caused by RESET */ +#define MC33775_FEH_POR_REASON_SOURCE_RESET_ENUM_VAL \ + (65U) + +/* Enumerated value VDDDUV: POR caused by VDDDUV */ +#define MC33775_FEH_POR_REASON_SOURCE_VDDDUV_ENUM_VAL \ + (78U) + +/* Enumerated value VBATLV: POR caused by VBATLV */ +#define MC33775_FEH_POR_REASON_SOURCE_VBATLV_ENUM_VAL \ + (131U) + +/* Enumerated value VDDIOUV: POR caused by VDDIOUV */ +#define MC33775_FEH_POR_REASON_SOURCE_VDDIOUV_ENUM_VAL \ + (140U) + +/* Enumerated value SWRESET: POR caused by software Deep Sleep request */ +#define MC33775_FEH_POR_REASON_SOURCE_SWRESET_ENUM_VAL \ + (191U) + +/* Enumerated value VBATOV: POR caused by VBATOV */ +#define MC33775_FEH_POR_REASON_SOURCE_VBATOV_ENUM_VAL \ + (194U) + +/* Enumerated value VDDDOV: POR caused by VDDDOV */ +#define MC33775_FEH_POR_REASON_SOURCE_VDDDOV_ENUM_VAL \ + (205U) + +/* Enumerated value VDDCOV: POR caused by VDDCOV */ +#define MC33775_FEH_POR_REASON_SOURCE_VDDCOV_ENUM_VAL \ + (261U) + +/* Enumerated value VAUXUV: POR caused by VAUXUV */ +#define MC33775_FEH_POR_REASON_SOURCE_VAUXUV_ENUM_VAL \ + (266U) + +/* Enumerated value VBATUV: POR caused by VBATUV */ +#define MC33775_FEH_POR_REASON_SOURCE_VBATUV_ENUM_VAL \ + (324U) + +/* Enumerated value VDDIOOV: POR caused by VDDIOOV */ +#define MC33775_FEH_POR_REASON_SOURCE_VDDIOOV_ENUM_VAL \ + (331U) + +/* Enumerated value VDDCUV: POR caused by VDDCUV */ +#define MC33775_FEH_POR_REASON_SOURCE_VDDCUV_ENUM_VAL \ + (390U) + +/* Enumerated value VAUXOV: POR caused by VAUXOV */ +#define MC33775_FEH_POR_REASON_SOURCE_VAUXOV_ENUM_VAL \ + (393U) + +/* Enumerated value VDDCOC: POR caused by VDDCOC */ +#define MC33775_FEH_POR_REASON_SOURCE_VDDCOC_ENUM_VAL \ + (455U) + +/* Enumerated value VDDCHC: POR caused by VDDCHC */ +#define MC33775_FEH_POR_REASON_SOURCE_VDDCHC_ENUM_VAL \ + (456U) + +/* Enumerated value VDDAUV: POR caused by VDDAUV */ +#define MC33775_FEH_POR_REASON_SOURCE_VDDAUV_ENUM_VAL \ + (529U) + +/* Enumerated value SLEEPOSC: POR caused by SLEEPOSC */ +#define MC33775_FEH_POR_REASON_SOURCE_SLEEPOSC_ENUM_VAL \ + (542U) + +/* Enumerated value VDDAOV: POR caused by VDDAOV */ +#define MC33775_FEH_POR_REASON_SOURCE_VDDAOV_ENUM_VAL \ + (592U) + +/* Enumerated value COMTO: POR caused by COMTO */ +#define MC33775_FEH_POR_REASON_SOURCE_COMTO_ENUM_VAL \ + (607U) + +/* Enumerated value VPREOV: POR caused by VPREOV */ +#define MC33775_FEH_POR_REASON_SOURCE_VPREOV_ENUM_VAL \ + (658U) + +/* Enumerated value SECCLK: POR caused by SECCLK */ +#define MC33775_FEH_POR_REASON_SOURCE_SECCLK_ENUM_VAL \ + (669U) + +/* Enumerated value LOGICERR: POR caused by LOGICERR */ +#define MC33775_FEH_POR_REASON_SOURCE_LOGICERR_ENUM_VAL \ + (673U) + +/* Enumerated value VPREREFSOV: POR caused by VPREREFSOV */ +#define MC33775_FEH_POR_REASON_SOURCE_VPREREFSOV_ENUM_VAL \ + (723U) + +/* Enumerated value PRMCLK: POR caused by PRMCLK */ +#define MC33775_FEH_POR_REASON_SOURCE_PRMCLK_ENUM_VAL \ + (732U) + +/* Enumerated value COMERRORS: POR caused by COMERRORS */ +#define MC33775_FEH_POR_REASON_SOURCE_COMERRORS_ENUM_VAL \ + (736U) + +/* Enumerated value VPREREFSUV: POR caused by VPREREFSUV */ +#define MC33775_FEH_POR_REASON_SOURCE_VPREREFSUV_ENUM_VAL \ + (788U) + +/* Enumerated value OTEMPSHUTDOWN: POR caused by OTEMPSHUTDOWN */ +#define MC33775_FEH_POR_REASON_SOURCE_OTEMPSHUTDOWN_ENUM_VAL \ + (795U) + +/* Enumerated value V2P5AOV: POR caused by V2P5AOV */ +#define MC33775_FEH_POR_REASON_SOURCE_V2P5AOV_ENUM_VAL \ + (853U) + +/* Enumerated value IBIASPERMUC: POR caused by IBIASPERMUC */ +#define MC33775_FEH_POR_REASON_SOURCE_IBIASPERMUC_ENUM_VAL \ + (858U) + +/* Enumerated value AFECPOV: POR caused by AFECPOV */ +#define MC33775_FEH_POR_REASON_SOURCE_AFECPOV_ENUM_VAL \ + (919U) + +/* Enumerated value AFECPUV: POR caused by AFECPUV */ +#define MC33775_FEH_POR_REASON_SOURCE_AFECPUV_ENUM_VAL \ + (920U) + +/* Enumerated value V2P5AUV: POR caused by V2P5AUV */ +#define MC33775_FEH_POR_REASON_SOURCE_V2P5AUV_ENUM_VAL \ + (982U) + +/* Enumerated value IBIASPERMOC: POR caused by IBIASPERMOC */ +#define MC33775_FEH_POR_REASON_SOURCE_IBIASPERMOC_ENUM_VAL \ + (985U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_FEH_POR_REASON_RESERVED0_POS \ + (10U) +#define MC33775_FEH_POR_REASON_RESERVED0_MSK \ + (0xFC00U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t SOURCE : 10; + volatile uint16_t reserved0 : 6; + } B; +} mc33775_event_handling_registers_feh_por_reason_t; + +/* -------------------------------------------------------------------------- + * GPIO_CFG0 (read-write):GPIO configuration 0 + * -------------------------------------------------------------------------- */ +#define MC33775_GPIO_CFG0_OFFSET \ + (0x800U) +#define MC33775_GPIO_CFG0_RW_MSK \ + (0xFFFFU) +#define MC33775_GPIO_CFG0_RD_MSK \ + (0xFFFFU) +#define MC33775_GPIO_CFG0_WR_MSK \ + (0xFFFFU) +#define MC33775_GPIO_CFG0_MW_MSK \ + (0x0U) +#define MC33775_GPIO_CFG0_RA_MSK \ + (0x0U) +#define MC33775_GPIO_CFG0_POR_MSK \ + (0xffffU) +#define MC33775_GPIO_CFG0_POR_VAL \ + (0x0U) + +/* Field INPEN0: Enable the input for GPIO0. If a special function requires digital input, the according receiver is enabled automatically. This is not reflected in this bit. */ +#define MC33775_GPIO_CFG0_INPEN0_POS \ + (0U) +#define MC33775_GPIO_CFG0_INPEN0_MSK \ + (0x1U) + +/* Enumerated value DISABLED: Input is disabled */ +#define MC33775_GPIO_CFG0_INPEN0_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Input is enabled */ +#define MC33775_GPIO_CFG0_INPEN0_ENABLED_ENUM_VAL \ + (1U) + +/* Field INPEN1: Enable the input for GPIO1. If a special function requires digital input, the according receiver is enabled automatically. This is not reflected in this bit. */ +#define MC33775_GPIO_CFG0_INPEN1_POS \ + (1U) +#define MC33775_GPIO_CFG0_INPEN1_MSK \ + (0x2U) + +/* Enumerated value DISABLED: Input is disabled */ +#define MC33775_GPIO_CFG0_INPEN1_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Input is enabled */ +#define MC33775_GPIO_CFG0_INPEN1_ENABLED_ENUM_VAL \ + (1U) + +/* Field INPEN2: Enable the input for GPIO2. If a special function requires digital input, the according receiver is enabled automatically. This is not reflected in this bit. */ +#define MC33775_GPIO_CFG0_INPEN2_POS \ + (2U) +#define MC33775_GPIO_CFG0_INPEN2_MSK \ + (0x4U) + +/* Enumerated value DISABLED: Input is disabled */ +#define MC33775_GPIO_CFG0_INPEN2_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Input is enabled */ +#define MC33775_GPIO_CFG0_INPEN2_ENABLED_ENUM_VAL \ + (1U) + +/* Field INPEN3: Enable the input for GPIO3. If a special function requires digital input, the according receiver is enabled automatically. This is not reflected in this bit. */ +#define MC33775_GPIO_CFG0_INPEN3_POS \ + (3U) +#define MC33775_GPIO_CFG0_INPEN3_MSK \ + (0x8U) + +/* Enumerated value DISABLED: Input is disabled */ +#define MC33775_GPIO_CFG0_INPEN3_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Input is enabled */ +#define MC33775_GPIO_CFG0_INPEN3_ENABLED_ENUM_VAL \ + (1U) + +/* Field INPEN4: Enable the input for GPIO4. If a special function requires digital input, the according receiver is enabled automatically. This is not reflected in this bit. */ +#define MC33775_GPIO_CFG0_INPEN4_POS \ + (4U) +#define MC33775_GPIO_CFG0_INPEN4_MSK \ + (0x10U) + +/* Enumerated value DISABLED: Input is disabled */ +#define MC33775_GPIO_CFG0_INPEN4_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Input is enabled */ +#define MC33775_GPIO_CFG0_INPEN4_ENABLED_ENUM_VAL \ + (1U) + +/* Field INPEN5: Enable the input for GPIO5. If a special function requires digital input, the according receiver is enabled automatically. This is not reflected in this bit. */ +#define MC33775_GPIO_CFG0_INPEN5_POS \ + (5U) +#define MC33775_GPIO_CFG0_INPEN5_MSK \ + (0x20U) + +/* Enumerated value DISABLED: Input is disabled */ +#define MC33775_GPIO_CFG0_INPEN5_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Input is enabled */ +#define MC33775_GPIO_CFG0_INPEN5_ENABLED_ENUM_VAL \ + (1U) + +/* Field INPEN6: Enable the input for GPIO6. If a special function requires digital input, the according receiver is enabled automatically. This is not reflected in this bit. */ +#define MC33775_GPIO_CFG0_INPEN6_POS \ + (6U) +#define MC33775_GPIO_CFG0_INPEN6_MSK \ + (0x40U) + +/* Enumerated value DISABLED: Input is disabled */ +#define MC33775_GPIO_CFG0_INPEN6_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Input is enabled */ +#define MC33775_GPIO_CFG0_INPEN6_ENABLED_ENUM_VAL \ + (1U) + +/* Field INPEN7: Enable the input for GPIO7. If a special function requires digital input, the according receiver is enabled automatically. This is not reflected in this bit. */ +#define MC33775_GPIO_CFG0_INPEN7_POS \ + (7U) +#define MC33775_GPIO_CFG0_INPEN7_MSK \ + (0x80U) + +/* Enumerated value DISABLED: Input is disabled */ +#define MC33775_GPIO_CFG0_INPEN7_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Input is enabled */ +#define MC33775_GPIO_CFG0_INPEN7_ENABLED_ENUM_VAL \ + (1U) + +/* Field OUTEN0: Enable the output of the GPIO0. */ +#define MC33775_GPIO_CFG0_OUTEN0_POS \ + (8U) +#define MC33775_GPIO_CFG0_OUTEN0_MSK \ + (0x100U) + +/* Enumerated value DISABLED: Output is disabled */ +#define MC33775_GPIO_CFG0_OUTEN0_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Output is enabled */ +#define MC33775_GPIO_CFG0_OUTEN0_ENABLED_ENUM_VAL \ + (1U) + +/* Field OUTEN1: Enable the output of the GPIO1. */ +#define MC33775_GPIO_CFG0_OUTEN1_POS \ + (9U) +#define MC33775_GPIO_CFG0_OUTEN1_MSK \ + (0x200U) + +/* Enumerated value DISABLED: Output is disabled */ +#define MC33775_GPIO_CFG0_OUTEN1_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Output is enabled */ +#define MC33775_GPIO_CFG0_OUTEN1_ENABLED_ENUM_VAL \ + (1U) + +/* Field OUTEN2: Enable the output of the GPIO2. */ +#define MC33775_GPIO_CFG0_OUTEN2_POS \ + (10U) +#define MC33775_GPIO_CFG0_OUTEN2_MSK \ + (0x400U) + +/* Enumerated value DISABLED: Output is disabled */ +#define MC33775_GPIO_CFG0_OUTEN2_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Output is enabled */ +#define MC33775_GPIO_CFG0_OUTEN2_ENABLED_ENUM_VAL \ + (1U) + +/* Field OUTEN3: Enable the output of the GPIO3. */ +#define MC33775_GPIO_CFG0_OUTEN3_POS \ + (11U) +#define MC33775_GPIO_CFG0_OUTEN3_MSK \ + (0x800U) + +/* Enumerated value DISABLED: Output is disabled */ +#define MC33775_GPIO_CFG0_OUTEN3_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Output is enabled */ +#define MC33775_GPIO_CFG0_OUTEN3_ENABLED_ENUM_VAL \ + (1U) + +/* Field OUTEN4: Enable the output of the GPIO4. */ +#define MC33775_GPIO_CFG0_OUTEN4_POS \ + (12U) +#define MC33775_GPIO_CFG0_OUTEN4_MSK \ + (0x1000U) + +/* Enumerated value DISABLED: Output is disabled */ +#define MC33775_GPIO_CFG0_OUTEN4_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Output is enabled */ +#define MC33775_GPIO_CFG0_OUTEN4_ENABLED_ENUM_VAL \ + (1U) + +/* Field OUTEN5: Enable the output of the GPIO5. */ +#define MC33775_GPIO_CFG0_OUTEN5_POS \ + (13U) +#define MC33775_GPIO_CFG0_OUTEN5_MSK \ + (0x2000U) + +/* Enumerated value DISABLED: Output is disabled */ +#define MC33775_GPIO_CFG0_OUTEN5_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Output is enabled */ +#define MC33775_GPIO_CFG0_OUTEN5_ENABLED_ENUM_VAL \ + (1U) + +/* Field OUTEN6: Enable the output of the GPIO6. */ +#define MC33775_GPIO_CFG0_OUTEN6_POS \ + (14U) +#define MC33775_GPIO_CFG0_OUTEN6_MSK \ + (0x4000U) + +/* Enumerated value DISABLED: Output is disabled */ +#define MC33775_GPIO_CFG0_OUTEN6_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Output is enabled */ +#define MC33775_GPIO_CFG0_OUTEN6_ENABLED_ENUM_VAL \ + (1U) + +/* Field OUTEN7: Enable the output of the GPIO7. */ +#define MC33775_GPIO_CFG0_OUTEN7_POS \ + (15U) +#define MC33775_GPIO_CFG0_OUTEN7_MSK \ + (0x8000U) + +/* Enumerated value DISABLED: Output is disabled */ +#define MC33775_GPIO_CFG0_OUTEN7_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Output is enabled */ +#define MC33775_GPIO_CFG0_OUTEN7_ENABLED_ENUM_VAL \ + (1U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t INPEN0 : 1; + volatile uint16_t INPEN1 : 1; + volatile uint16_t INPEN2 : 1; + volatile uint16_t INPEN3 : 1; + volatile uint16_t INPEN4 : 1; + volatile uint16_t INPEN5 : 1; + volatile uint16_t INPEN6 : 1; + volatile uint16_t INPEN7 : 1; + volatile uint16_t OUTEN0 : 1; + volatile uint16_t OUTEN1 : 1; + volatile uint16_t OUTEN2 : 1; + volatile uint16_t OUTEN3 : 1; + volatile uint16_t OUTEN4 : 1; + volatile uint16_t OUTEN5 : 1; + volatile uint16_t OUTEN6 : 1; + volatile uint16_t OUTEN7 : 1; + } B; +} mc33775_gpio_registers_gpio_cfg0_t; + +/* -------------------------------------------------------------------------- + * GPIO_CFG1 (read-write):GPIO configuration 1 + * -------------------------------------------------------------------------- */ +#define MC33775_GPIO_CFG1_OFFSET \ + (0x801U) +#define MC33775_GPIO_CFG1_RW_MSK \ + (0xFFU) +#define MC33775_GPIO_CFG1_RD_MSK \ + (0xFFU) +#define MC33775_GPIO_CFG1_WR_MSK \ + (0xFFU) +#define MC33775_GPIO_CFG1_MW_MSK \ + (0x0U) +#define MC33775_GPIO_CFG1_RA_MSK \ + (0x0U) +#define MC33775_GPIO_CFG1_POR_MSK \ + (0xffffU) +#define MC33775_GPIO_CFG1_POR_VAL \ + (0x0U) + +/* Field ODEN0: Open Drain enable, GPIO0. */ +#define MC33775_GPIO_CFG1_ODEN0_POS \ + (0U) +#define MC33775_GPIO_CFG1_ODEN0_MSK \ + (0x1U) + +/* Enumerated value DISABLED: Open Drain disabled */ +#define MC33775_GPIO_CFG1_ODEN0_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Open Drain enabled */ +#define MC33775_GPIO_CFG1_ODEN0_ENABLED_ENUM_VAL \ + (1U) + +/* Field ODEN1: Open Drain enable, GPIO1. */ +#define MC33775_GPIO_CFG1_ODEN1_POS \ + (1U) +#define MC33775_GPIO_CFG1_ODEN1_MSK \ + (0x2U) + +/* Enumerated value DISABLED: Open Drain disabled */ +#define MC33775_GPIO_CFG1_ODEN1_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Open Drain enabled */ +#define MC33775_GPIO_CFG1_ODEN1_ENABLED_ENUM_VAL \ + (1U) + +/* Field ODEN2: Open Drain enable, GPIO2. */ +#define MC33775_GPIO_CFG1_ODEN2_POS \ + (2U) +#define MC33775_GPIO_CFG1_ODEN2_MSK \ + (0x4U) + +/* Enumerated value DISABLED: Open Drain disabled */ +#define MC33775_GPIO_CFG1_ODEN2_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Open Drain enabled */ +#define MC33775_GPIO_CFG1_ODEN2_ENABLED_ENUM_VAL \ + (1U) + +/* Field ODEN3: Open Drain enable, GPIO3. */ +#define MC33775_GPIO_CFG1_ODEN3_POS \ + (3U) +#define MC33775_GPIO_CFG1_ODEN3_MSK \ + (0x8U) + +/* Enumerated value DISABLED: Open Drain disabled */ +#define MC33775_GPIO_CFG1_ODEN3_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Open Drain enabled */ +#define MC33775_GPIO_CFG1_ODEN3_ENABLED_ENUM_VAL \ + (1U) + +/* Field ODEN4: Open Drain enable, GPIO4. */ +#define MC33775_GPIO_CFG1_ODEN4_POS \ + (4U) +#define MC33775_GPIO_CFG1_ODEN4_MSK \ + (0x10U) + +/* Enumerated value DISABLED: Open Drain disabled */ +#define MC33775_GPIO_CFG1_ODEN4_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Open Drain enabled */ +#define MC33775_GPIO_CFG1_ODEN4_ENABLED_ENUM_VAL \ + (1U) + +/* Field ODEN5: Open Drain enable, GPIO5. */ +#define MC33775_GPIO_CFG1_ODEN5_POS \ + (5U) +#define MC33775_GPIO_CFG1_ODEN5_MSK \ + (0x20U) + +/* Enumerated value DISABLED: Open Drain disabled */ +#define MC33775_GPIO_CFG1_ODEN5_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Open Drain enabled */ +#define MC33775_GPIO_CFG1_ODEN5_ENABLED_ENUM_VAL \ + (1U) + +/* Field ODEN6: Open Drain enable, GPIO6. */ +#define MC33775_GPIO_CFG1_ODEN6_POS \ + (6U) +#define MC33775_GPIO_CFG1_ODEN6_MSK \ + (0x40U) + +/* Enumerated value DISABLED: Open Drain disabled */ +#define MC33775_GPIO_CFG1_ODEN6_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Open Drain enabled */ +#define MC33775_GPIO_CFG1_ODEN6_ENABLED_ENUM_VAL \ + (1U) + +/* Field ODEN7: Open Drain enable, GPIO7. */ +#define MC33775_GPIO_CFG1_ODEN7_POS \ + (7U) +#define MC33775_GPIO_CFG1_ODEN7_MSK \ + (0x80U) + +/* Enumerated value DISABLED: Open Drain disabled */ +#define MC33775_GPIO_CFG1_ODEN7_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Open Drain enabled */ +#define MC33775_GPIO_CFG1_ODEN7_ENABLED_ENUM_VAL \ + (1U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_GPIO_CFG1_RESERVED0_POS \ + (8U) +#define MC33775_GPIO_CFG1_RESERVED0_MSK \ + (0xFF00U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t ODEN0 : 1; + volatile uint16_t ODEN1 : 1; + volatile uint16_t ODEN2 : 1; + volatile uint16_t ODEN3 : 1; + volatile uint16_t ODEN4 : 1; + volatile uint16_t ODEN5 : 1; + volatile uint16_t ODEN6 : 1; + volatile uint16_t ODEN7 : 1; + volatile uint16_t reserved0 : 8; + } B; +} mc33775_gpio_registers_gpio_cfg1_t; + +/* -------------------------------------------------------------------------- + * GPIO_OUT (read-write):GPIO output + * -------------------------------------------------------------------------- */ +#define MC33775_GPIO_OUT_OFFSET \ + (0x802U) +#define MC33775_GPIO_OUT_RW_MSK \ + (0xFFU) +#define MC33775_GPIO_OUT_RD_MSK \ + (0xFFU) +#define MC33775_GPIO_OUT_WR_MSK \ + (0xFFU) +#define MC33775_GPIO_OUT_MW_MSK \ + (0x0U) +#define MC33775_GPIO_OUT_RA_MSK \ + (0x0U) +#define MC33775_GPIO_OUT_POR_MSK \ + (0xffffU) +#define MC33775_GPIO_OUT_POR_VAL \ + (0x0U) + +/* Field OUT0: Set the output level of the gpio function for GPIO0. */ +#define MC33775_GPIO_OUT_OUT0_POS \ + (0U) +#define MC33775_GPIO_OUT_OUT0_MSK \ + (0x1U) + +/* Enumerated value LOW: GPIO is low */ +#define MC33775_GPIO_OUT_OUT0_LOW_ENUM_VAL \ + (0U) + +/* Enumerated value HIGH: GPIO is high */ +#define MC33775_GPIO_OUT_OUT0_HIGH_ENUM_VAL \ + (1U) + +/* Field OUT1: Set the output level of the gpio function for GPIO1. */ +#define MC33775_GPIO_OUT_OUT1_POS \ + (1U) +#define MC33775_GPIO_OUT_OUT1_MSK \ + (0x2U) + +/* Enumerated value LOW: GPIO is low */ +#define MC33775_GPIO_OUT_OUT1_LOW_ENUM_VAL \ + (0U) + +/* Enumerated value HIGH: GPIO is high */ +#define MC33775_GPIO_OUT_OUT1_HIGH_ENUM_VAL \ + (1U) + +/* Field OUT2: Set the output level of the gpio function for GPIO2. */ +#define MC33775_GPIO_OUT_OUT2_POS \ + (2U) +#define MC33775_GPIO_OUT_OUT2_MSK \ + (0x4U) + +/* Enumerated value LOW: GPIO is low */ +#define MC33775_GPIO_OUT_OUT2_LOW_ENUM_VAL \ + (0U) + +/* Enumerated value HIGH: GPIO is high */ +#define MC33775_GPIO_OUT_OUT2_HIGH_ENUM_VAL \ + (1U) + +/* Field OUT3: Set the output level of the gpio function for GPIO3. */ +#define MC33775_GPIO_OUT_OUT3_POS \ + (3U) +#define MC33775_GPIO_OUT_OUT3_MSK \ + (0x8U) + +/* Enumerated value LOW: GPIO is low */ +#define MC33775_GPIO_OUT_OUT3_LOW_ENUM_VAL \ + (0U) + +/* Enumerated value HIGH: GPIO is high */ +#define MC33775_GPIO_OUT_OUT3_HIGH_ENUM_VAL \ + (1U) + +/* Field OUT4: Set the output level of the gpio function for GPIO4. */ +#define MC33775_GPIO_OUT_OUT4_POS \ + (4U) +#define MC33775_GPIO_OUT_OUT4_MSK \ + (0x10U) + +/* Enumerated value LOW: GPIO is low */ +#define MC33775_GPIO_OUT_OUT4_LOW_ENUM_VAL \ + (0U) + +/* Enumerated value HIGH: GPIO is high */ +#define MC33775_GPIO_OUT_OUT4_HIGH_ENUM_VAL \ + (1U) + +/* Field OUT5: Set the output level of the gpio function for GPIO5. */ +#define MC33775_GPIO_OUT_OUT5_POS \ + (5U) +#define MC33775_GPIO_OUT_OUT5_MSK \ + (0x20U) + +/* Enumerated value LOW: GPIO is low */ +#define MC33775_GPIO_OUT_OUT5_LOW_ENUM_VAL \ + (0U) + +/* Enumerated value HIGH: GPIO is high */ +#define MC33775_GPIO_OUT_OUT5_HIGH_ENUM_VAL \ + (1U) + +/* Field OUT6: Set the output level of the gpio function for GPIO6. */ +#define MC33775_GPIO_OUT_OUT6_POS \ + (6U) +#define MC33775_GPIO_OUT_OUT6_MSK \ + (0x40U) + +/* Enumerated value LOW: GPIO is low */ +#define MC33775_GPIO_OUT_OUT6_LOW_ENUM_VAL \ + (0U) + +/* Enumerated value HIGH: GPIO is high */ +#define MC33775_GPIO_OUT_OUT6_HIGH_ENUM_VAL \ + (1U) + +/* Field OUT7: Set the output level of the gpio function for GPIO7. */ +#define MC33775_GPIO_OUT_OUT7_POS \ + (7U) +#define MC33775_GPIO_OUT_OUT7_MSK \ + (0x80U) + +/* Enumerated value LOW: GPIO is low */ +#define MC33775_GPIO_OUT_OUT7_LOW_ENUM_VAL \ + (0U) + +/* Enumerated value HIGH: GPIO is high */ +#define MC33775_GPIO_OUT_OUT7_HIGH_ENUM_VAL \ + (1U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_GPIO_OUT_RESERVED0_POS \ + (8U) +#define MC33775_GPIO_OUT_RESERVED0_MSK \ + (0xFF00U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t OUT0 : 1; + volatile uint16_t OUT1 : 1; + volatile uint16_t OUT2 : 1; + volatile uint16_t OUT3 : 1; + volatile uint16_t OUT4 : 1; + volatile uint16_t OUT5 : 1; + volatile uint16_t OUT6 : 1; + volatile uint16_t OUT7 : 1; + volatile uint16_t reserved0 : 8; + } B; +} mc33775_gpio_registers_gpio_out_t; + +/* -------------------------------------------------------------------------- + * GPIO_IN (read-only):GPIO input + * -------------------------------------------------------------------------- */ +#define MC33775_GPIO_IN_OFFSET \ + (0x804U) +#define MC33775_GPIO_IN_RW_MSK \ + (0x0U) +#define MC33775_GPIO_IN_RD_MSK \ + (0xFFFFU) +#define MC33775_GPIO_IN_WR_MSK \ + (0x0U) +#define MC33775_GPIO_IN_MW_MSK \ + (0x0U) +#define MC33775_GPIO_IN_RA_MSK \ + (0xFF00U) +#define MC33775_GPIO_IN_POR_MSK \ + (0xffffU) +#define MC33775_GPIO_IN_POR_VAL \ + (0x0U) + +/* Field IN0: Read the level of the gpio function of GPIO0. */ +#define MC33775_GPIO_IN_IN0_POS \ + (0U) +#define MC33775_GPIO_IN_IN0_MSK \ + (0x1U) + +/* Enumerated value LOW: GPIO is low */ +#define MC33775_GPIO_IN_IN0_LOW_ENUM_VAL \ + (0U) + +/* Enumerated value HIGH: GPIO is high */ +#define MC33775_GPIO_IN_IN0_HIGH_ENUM_VAL \ + (1U) + +/* Field IN1: Read the level of the gpio function of GPIO1. */ +#define MC33775_GPIO_IN_IN1_POS \ + (1U) +#define MC33775_GPIO_IN_IN1_MSK \ + (0x2U) + +/* Enumerated value LOW: GPIO is low */ +#define MC33775_GPIO_IN_IN1_LOW_ENUM_VAL \ + (0U) + +/* Enumerated value HIGH: GPIO is high */ +#define MC33775_GPIO_IN_IN1_HIGH_ENUM_VAL \ + (1U) + +/* Field IN2: Read the level of the gpio function of GPIO2. */ +#define MC33775_GPIO_IN_IN2_POS \ + (2U) +#define MC33775_GPIO_IN_IN2_MSK \ + (0x4U) + +/* Enumerated value LOW: GPIO is low */ +#define MC33775_GPIO_IN_IN2_LOW_ENUM_VAL \ + (0U) + +/* Enumerated value HIGH: GPIO is high */ +#define MC33775_GPIO_IN_IN2_HIGH_ENUM_VAL \ + (1U) + +/* Field IN3: Read the level of the gpio function of GPIO3. */ +#define MC33775_GPIO_IN_IN3_POS \ + (3U) +#define MC33775_GPIO_IN_IN3_MSK \ + (0x8U) + +/* Enumerated value LOW: GPIO is low */ +#define MC33775_GPIO_IN_IN3_LOW_ENUM_VAL \ + (0U) + +/* Enumerated value HIGH: GPIO is high */ +#define MC33775_GPIO_IN_IN3_HIGH_ENUM_VAL \ + (1U) + +/* Field IN4: Read the level of the gpio function of GPIO4. */ +#define MC33775_GPIO_IN_IN4_POS \ + (4U) +#define MC33775_GPIO_IN_IN4_MSK \ + (0x10U) + +/* Enumerated value LOW: GPIO is low */ +#define MC33775_GPIO_IN_IN4_LOW_ENUM_VAL \ + (0U) + +/* Enumerated value HIGH: GPIO is high */ +#define MC33775_GPIO_IN_IN4_HIGH_ENUM_VAL \ + (1U) + +/* Field IN5: Read the level of the gpio function of GPIO5. */ +#define MC33775_GPIO_IN_IN5_POS \ + (5U) +#define MC33775_GPIO_IN_IN5_MSK \ + (0x20U) + +/* Enumerated value LOW: GPIO is low */ +#define MC33775_GPIO_IN_IN5_LOW_ENUM_VAL \ + (0U) + +/* Enumerated value HIGH: GPIO is high */ +#define MC33775_GPIO_IN_IN5_HIGH_ENUM_VAL \ + (1U) + +/* Field IN6: Read the level of the gpio function of GPIO6. */ +#define MC33775_GPIO_IN_IN6_POS \ + (6U) +#define MC33775_GPIO_IN_IN6_MSK \ + (0x40U) + +/* Enumerated value LOW: GPIO is low */ +#define MC33775_GPIO_IN_IN6_LOW_ENUM_VAL \ + (0U) + +/* Enumerated value HIGH: GPIO is high */ +#define MC33775_GPIO_IN_IN6_HIGH_ENUM_VAL \ + (1U) + +/* Field IN7: Read the level of the gpio function of GPIO7. */ +#define MC33775_GPIO_IN_IN7_POS \ + (7U) +#define MC33775_GPIO_IN_IN7_MSK \ + (0x80U) + +/* Enumerated value LOW: GPIO is low */ +#define MC33775_GPIO_IN_IN7_LOW_ENUM_VAL \ + (0U) + +/* Enumerated value HIGH: GPIO is high */ +#define MC33775_GPIO_IN_IN7_HIGH_ENUM_VAL \ + (1U) + +/* Field HIGHDET0: High value on GPIO0. */ +#define MC33775_GPIO_IN_HIGHDET0_POS \ + (8U) +#define MC33775_GPIO_IN_HIGHDET0_MSK \ + (0x100U) + +/* Enumerated value NO_HIGH: No high level observed */ +#define MC33775_GPIO_IN_HIGHDET0_NO_HIGH_ENUM_VAL \ + (0U) + +/* Enumerated value HIGH: High level observed. */ +#define MC33775_GPIO_IN_HIGHDET0_HIGH_ENUM_VAL \ + (1U) + +/* Field HIGHDET1: High value on GPIO1. */ +#define MC33775_GPIO_IN_HIGHDET1_POS \ + (9U) +#define MC33775_GPIO_IN_HIGHDET1_MSK \ + (0x200U) + +/* Enumerated value NO_HIGH: No high level observed */ +#define MC33775_GPIO_IN_HIGHDET1_NO_HIGH_ENUM_VAL \ + (0U) + +/* Enumerated value HIGH: High level observed. */ +#define MC33775_GPIO_IN_HIGHDET1_HIGH_ENUM_VAL \ + (1U) + +/* Field HIGHDET2: High value on GPIO2. */ +#define MC33775_GPIO_IN_HIGHDET2_POS \ + (10U) +#define MC33775_GPIO_IN_HIGHDET2_MSK \ + (0x400U) + +/* Enumerated value NO_HIGH: No high level observed */ +#define MC33775_GPIO_IN_HIGHDET2_NO_HIGH_ENUM_VAL \ + (0U) + +/* Enumerated value HIGH: High level observed. */ +#define MC33775_GPIO_IN_HIGHDET2_HIGH_ENUM_VAL \ + (1U) + +/* Field HIGHDET3: High value on GPIO3. */ +#define MC33775_GPIO_IN_HIGHDET3_POS \ + (11U) +#define MC33775_GPIO_IN_HIGHDET3_MSK \ + (0x800U) + +/* Enumerated value NO_HIGH: No high level observed */ +#define MC33775_GPIO_IN_HIGHDET3_NO_HIGH_ENUM_VAL \ + (0U) + +/* Enumerated value HIGH: High level observed. */ +#define MC33775_GPIO_IN_HIGHDET3_HIGH_ENUM_VAL \ + (1U) + +/* Field HIGHDET4: High value on GPIO4. */ +#define MC33775_GPIO_IN_HIGHDET4_POS \ + (12U) +#define MC33775_GPIO_IN_HIGHDET4_MSK \ + (0x1000U) + +/* Enumerated value NO_HIGH: No high level observed */ +#define MC33775_GPIO_IN_HIGHDET4_NO_HIGH_ENUM_VAL \ + (0U) + +/* Enumerated value HIGH: High level observed. */ +#define MC33775_GPIO_IN_HIGHDET4_HIGH_ENUM_VAL \ + (1U) + +/* Field HIGHDET5: High value on GPIO5. */ +#define MC33775_GPIO_IN_HIGHDET5_POS \ + (13U) +#define MC33775_GPIO_IN_HIGHDET5_MSK \ + (0x2000U) + +/* Enumerated value NO_HIGH: No high level observed */ +#define MC33775_GPIO_IN_HIGHDET5_NO_HIGH_ENUM_VAL \ + (0U) + +/* Enumerated value HIGH: High level observed. */ +#define MC33775_GPIO_IN_HIGHDET5_HIGH_ENUM_VAL \ + (1U) + +/* Field HIGHDET6: High value on GPIO6. */ +#define MC33775_GPIO_IN_HIGHDET6_POS \ + (14U) +#define MC33775_GPIO_IN_HIGHDET6_MSK \ + (0x4000U) + +/* Enumerated value NO_HIGH: No high level observed */ +#define MC33775_GPIO_IN_HIGHDET6_NO_HIGH_ENUM_VAL \ + (0U) + +/* Enumerated value HIGH: High level observed. */ +#define MC33775_GPIO_IN_HIGHDET6_HIGH_ENUM_VAL \ + (1U) + +/* Field HIGHDET7: High value on GPIO7. */ +#define MC33775_GPIO_IN_HIGHDET7_POS \ + (15U) +#define MC33775_GPIO_IN_HIGHDET7_MSK \ + (0x8000U) + +/* Enumerated value NO_HIGH: No high level observed */ +#define MC33775_GPIO_IN_HIGHDET7_NO_HIGH_ENUM_VAL \ + (0U) + +/* Enumerated value HIGH: High level observed. */ +#define MC33775_GPIO_IN_HIGHDET7_HIGH_ENUM_VAL \ + (1U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t IN0 : 1; + volatile uint16_t IN1 : 1; + volatile uint16_t IN2 : 1; + volatile uint16_t IN3 : 1; + volatile uint16_t IN4 : 1; + volatile uint16_t IN5 : 1; + volatile uint16_t IN6 : 1; + volatile uint16_t IN7 : 1; + volatile uint16_t HIGHDET0 : 1; + volatile uint16_t HIGHDET1 : 1; + volatile uint16_t HIGHDET2 : 1; + volatile uint16_t HIGHDET3 : 1; + volatile uint16_t HIGHDET4 : 1; + volatile uint16_t HIGHDET5 : 1; + volatile uint16_t HIGHDET6 : 1; + volatile uint16_t HIGHDET7 : 1; + } B; +} mc33775_gpio_registers_gpio_in_t; + +/* -------------------------------------------------------------------------- + * I2C_CFG (read-write):I2C configuration + * -------------------------------------------------------------------------- */ +#define MC33775_I2C_CFG_OFFSET \ + (0xC00U) +#define MC33775_I2C_CFG_RW_MSK \ + (0x3U) +#define MC33775_I2C_CFG_RD_MSK \ + (0x3U) +#define MC33775_I2C_CFG_WR_MSK \ + (0x3U) +#define MC33775_I2C_CFG_MW_MSK \ + (0x0U) +#define MC33775_I2C_CFG_RA_MSK \ + (0x0U) +#define MC33775_I2C_CFG_POR_MSK \ + (0xffffU) +#define MC33775_I2C_CFG_POR_VAL \ + (0x0U) + +/* Field EN: Enable I2C interface. If the I2C interface is disabled while it is active, a stop condition is created and the bus is released. When enabling this bit the GPIO to which the I2C lines are connected are switched to the I2C function (input receiver active and open-drain output function). */ +#define MC33775_I2C_CFG_EN_POS \ + (0U) +#define MC33775_I2C_CFG_EN_MSK \ + (0x1U) + +/* Enumerated value DISABLED: I2C interface disabled */ +#define MC33775_I2C_CFG_EN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: I2C interface enabled */ +#define MC33775_I2C_CFG_EN_ENABLED_ENUM_VAL \ + (1U) + +/* Field CLKSEL: I2C clock selection */ +#define MC33775_I2C_CFG_CLKSEL_POS \ + (1U) +#define MC33775_I2C_CFG_CLKSEL_MSK \ + (0x2U) + +/* Enumerated value F_100k: I2C clock is 100 kHz */ +#define MC33775_I2C_CFG_CLKSEL_F_100K_ENUM_VAL \ + (0U) + +/* Enumerated value F_400k: I2C clock is 400 kHz */ +#define MC33775_I2C_CFG_CLKSEL_F_400K_ENUM_VAL \ + (1U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_I2C_CFG_RESERVED0_POS \ + (2U) +#define MC33775_I2C_CFG_RESERVED0_MSK \ + (0xFFFCU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t EN : 1; + volatile uint16_t CLKSEL : 1; + volatile uint16_t reserved0 : 14; + } B; +} mc33775_i2c_registers_i2c_cfg_t; + +/* -------------------------------------------------------------------------- + * I2C_CTRL (read-write):I2C control + * -------------------------------------------------------------------------- */ +#define MC33775_I2C_CTRL_OFFSET \ + (0xC01U) +#define MC33775_I2C_CTRL_RW_MSK \ + (0xF1FU) +#define MC33775_I2C_CTRL_RD_MSK \ + (0xF1FU) +#define MC33775_I2C_CTRL_WR_MSK \ + (0xF1FU) +#define MC33775_I2C_CTRL_MW_MSK \ + (0x0U) +#define MC33775_I2C_CTRL_RA_MSK \ + (0x0U) +#define MC33775_I2C_CTRL_POR_MSK \ + (0xffffU) +#define MC33775_I2C_CTRL_POR_VAL \ + (0x0U) + +/* Field START: Start the I2C transmission, by setting the number of bytes (including Dev. Address to be transmitted/read) */ +#define MC33775_I2C_CTRL_START_POS \ + (0U) +#define MC33775_I2C_CTRL_START_MSK \ + (0xFU) + +/* Enumerated value SEND_1: Send one byte */ +#define MC33775_I2C_CTRL_START_SEND_1_ENUM_VAL \ + (1U) + +/* Enumerated value SEND_14: Send 14 bytes */ +#define MC33775_I2C_CTRL_START_SEND_14_ENUM_VAL \ + (14U) + +/* Enumerated value SEND_MAX: Send 14 bytes */ +#define MC33775_I2C_CTRL_START_SEND_MAX_ENUM_VAL \ + (15U) + +/* Field STPAFTER: Send a stop condition after the last byte. */ +#define MC33775_I2C_CTRL_STPAFTER_POS \ + (4U) +#define MC33775_I2C_CTRL_STPAFTER_MSK \ + (0x10U) + +/* Enumerated value NO_STOP: No stop condition sent after last byte */ +#define MC33775_I2C_CTRL_STPAFTER_NO_STOP_ENUM_VAL \ + (0U) + +/* Enumerated value STOP: Stop condition sent after last byte */ +#define MC33775_I2C_CTRL_STPAFTER_STOP_ENUM_VAL \ + (1U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_I2C_CTRL_RESERVED0_POS \ + (5U) +#define MC33775_I2C_CTRL_RESERVED0_MSK \ + (0xE0U) + +/* Field RDAFTER: Switch to read (Repeated Start Condition after byte) 0 = off */ +#define MC33775_I2C_CTRL_RDAFTER_POS \ + (8U) +#define MC33775_I2C_CTRL_RDAFTER_MSK \ + (0xF00U) + +/* Enumerated value NO_READ: No switch to read. */ +#define MC33775_I2C_CTRL_RDAFTER_NO_READ_ENUM_VAL \ + (0U) + +/* Enumerated value READ_1: Switch to read after 1 byte */ +#define MC33775_I2C_CTRL_RDAFTER_READ_1_ENUM_VAL \ + (1U) + +/* Enumerated value READ_14: Switch to read after 14 bytes */ +#define MC33775_I2C_CTRL_RDAFTER_READ_14_ENUM_VAL \ + (14U) + +/* Enumerated value RESERVED: Reserved. Do not use. */ +#define MC33775_I2C_CTRL_RDAFTER_RESERVED_ENUM_VAL \ + (15U) + +/* Field reserved1: This read-only field is reserved and always has the value 0. */ +#define MC33775_I2C_CTRL_RESERVED1_POS \ + (12U) +#define MC33775_I2C_CTRL_RESERVED1_MSK \ + (0xF000U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t START : 4; + volatile uint16_t STPAFTER : 1; + volatile uint16_t reserved0 : 3; + volatile uint16_t RDAFTER : 4; + volatile uint16_t reserved1 : 4; + } B; +} mc33775_i2c_registers_i2c_ctrl_t; + +/* -------------------------------------------------------------------------- + * I2C_STAT (read-only):I2C status + * -------------------------------------------------------------------------- */ +#define MC33775_I2C_STAT_OFFSET \ + (0xC02U) +#define MC33775_I2C_STAT_RW_MSK \ + (0x0U) +#define MC33775_I2C_STAT_RD_MSK \ + (0xF0FU) +#define MC33775_I2C_STAT_WR_MSK \ + (0x0U) +#define MC33775_I2C_STAT_MW_MSK \ + (0x0U) +#define MC33775_I2C_STAT_RA_MSK \ + (0x0U) +#define MC33775_I2C_STAT_POR_MSK \ + (0xffffU) +#define MC33775_I2C_STAT_POR_VAL \ + (0x0U) + +/* Field PENDING: I2C execution pending */ +#define MC33775_I2C_STAT_PENDING_POS \ + (0U) +#define MC33775_I2C_STAT_PENDING_MSK \ + (0x1U) + +/* Enumerated value NO_TRX: No transfer is in execution, data registers can be accessed */ +#define MC33775_I2C_STAT_PENDING_NO_TRX_ENUM_VAL \ + (0U) + +/* Enumerated value TRX: A transfer is in execution, no access to the data registers is allowed */ +#define MC33775_I2C_STAT_PENDING_TRX_ENUM_VAL \ + (1U) + +/* Field ACTIVE: I2C transmission active */ +#define MC33775_I2C_STAT_ACTIVE_POS \ + (1U) +#define MC33775_I2C_STAT_ACTIVE_MSK \ + (0x2U) + +/* Enumerated value NO_TRX: No transaction is ongoing. */ +#define MC33775_I2C_STAT_ACTIVE_NO_TRX_ENUM_VAL \ + (0U) + +/* Enumerated value TRX: A transaction is ongoing (no STOP condition so far), bus is held with SCL low */ +#define MC33775_I2C_STAT_ACTIVE_TRX_ENUM_VAL \ + (1U) + +/* Field NACKRCV: NACK received */ +#define MC33775_I2C_STAT_NACKRCV_POS \ + (2U) +#define MC33775_I2C_STAT_NACKRCV_MSK \ + (0x4U) + +/* Enumerated value NO_NACK: No NACK was received */ +#define MC33775_I2C_STAT_NACKRCV_NO_NACK_ENUM_VAL \ + (0U) + +/* Enumerated value NACK: A NACK was received */ +#define MC33775_I2C_STAT_NACKRCV_NACK_ENUM_VAL \ + (1U) + +/* Field ARBLOST: Wrong data bit */ +#define MC33775_I2C_STAT_ARBLOST_POS \ + (3U) +#define MC33775_I2C_STAT_ARBLOST_MSK \ + (0x8U) + +/* Enumerated value NO_FLT: No wrong data bits detected */ +#define MC33775_I2C_STAT_ARBLOST_NO_FLT_ENUM_VAL \ + (0U) + +/* Enumerated value FAULT: A wrong data bit was detected */ +#define MC33775_I2C_STAT_ARBLOST_FAULT_ENUM_VAL \ + (1U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_I2C_STAT_RESERVED0_POS \ + (4U) +#define MC33775_I2C_STAT_RESERVED0_MSK \ + (0xF0U) + +/* Field LEN: number of bytes transferred until NACK received */ +#define MC33775_I2C_STAT_LEN_POS \ + (8U) +#define MC33775_I2C_STAT_LEN_MSK \ + (0xF00U) + +/* Enumerated value NACK_0: No bytes transmitted until NACK was received */ +#define MC33775_I2C_STAT_LEN_NACK_0_ENUM_VAL \ + (0U) + +/* Enumerated value NACK_1: 1 byte transmitted until NACK was received */ +#define MC33775_I2C_STAT_LEN_NACK_1_ENUM_VAL \ + (1U) + +/* Enumerated value NACK_14: 14 bytes transmitted until NACK was received */ +#define MC33775_I2C_STAT_LEN_NACK_14_ENUM_VAL \ + (14U) + +/* Enumerated value RESERVED: Reserved. Not used. */ +#define MC33775_I2C_STAT_LEN_RESERVED_ENUM_VAL \ + (15U) + +/* Field reserved1: This read-only field is reserved and always has the value 0. */ +#define MC33775_I2C_STAT_RESERVED1_POS \ + (12U) +#define MC33775_I2C_STAT_RESERVED1_MSK \ + (0xF000U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t PENDING : 1; + volatile uint16_t ACTIVE : 1; + volatile uint16_t NACKRCV : 1; + volatile uint16_t ARBLOST : 1; + volatile uint16_t reserved0 : 4; + volatile uint16_t LEN : 4; + volatile uint16_t reserved1 : 4; + } B; +} mc33775_i2c_registers_i2c_stat_t; + +/* -------------------------------------------------------------------------- + * I2C_DATA0 (read-write):I2C data register 0 + * -------------------------------------------------------------------------- */ +#define MC33775_I2C_DATA0_OFFSET \ + (0xC04U) +#define MC33775_I2C_DATA0_RW_MSK \ + (0xFFFFU) +#define MC33775_I2C_DATA0_RD_MSK \ + (0xFFFFU) +#define MC33775_I2C_DATA0_WR_MSK \ + (0xFFFFU) +#define MC33775_I2C_DATA0_MW_MSK \ + (0x0U) +#define MC33775_I2C_DATA0_RA_MSK \ + (0x0U) +#define MC33775_I2C_DATA0_POR_MSK \ + (0xffffU) +#define MC33775_I2C_DATA0_POR_VAL \ + (0x0U) + +/* Field BYTE0: I2C data byte 0 (e.g. device address) */ +#define MC33775_I2C_DATA0_BYTE0_POS \ + (0U) +#define MC33775_I2C_DATA0_BYTE0_MSK \ + (0xFFU) + +/* Field BYTE1: I2C data byte 1 (e.g. data or sub address) */ +#define MC33775_I2C_DATA0_BYTE1_POS \ + (8U) +#define MC33775_I2C_DATA0_BYTE1_MSK \ + (0xFF00U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t BYTE0 : 8; + volatile uint16_t BYTE1 : 8; + } B; +} mc33775_i2c_registers_i2c_data0_t; + +/* -------------------------------------------------------------------------- + * I2C_DATA1 (read-write):I2C data register 1 + * -------------------------------------------------------------------------- */ +#define MC33775_I2C_DATA1_OFFSET \ + (0xC05U) +#define MC33775_I2C_DATA1_RW_MSK \ + (0xFFFFU) +#define MC33775_I2C_DATA1_RD_MSK \ + (0xFFFFU) +#define MC33775_I2C_DATA1_WR_MSK \ + (0xFFFFU) +#define MC33775_I2C_DATA1_MW_MSK \ + (0x0U) +#define MC33775_I2C_DATA1_RA_MSK \ + (0x0U) +#define MC33775_I2C_DATA1_POR_MSK \ + (0xffffU) +#define MC33775_I2C_DATA1_POR_VAL \ + (0x0U) + +/* Field BYTE2: I2C data byte 2 */ +#define MC33775_I2C_DATA1_BYTE2_POS \ + (0U) +#define MC33775_I2C_DATA1_BYTE2_MSK \ + (0xFFU) + +/* Field BYTE3: I2C data byte 3 */ +#define MC33775_I2C_DATA1_BYTE3_POS \ + (8U) +#define MC33775_I2C_DATA1_BYTE3_MSK \ + (0xFF00U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t BYTE2 : 8; + volatile uint16_t BYTE3 : 8; + } B; +} mc33775_i2c_registers_i2c_data1_t; + +/* -------------------------------------------------------------------------- + * I2C_DATA2 (read-write):I2C data register 2 + * -------------------------------------------------------------------------- */ +#define MC33775_I2C_DATA2_OFFSET \ + (0xC06U) +#define MC33775_I2C_DATA2_RW_MSK \ + (0xFFFFU) +#define MC33775_I2C_DATA2_RD_MSK \ + (0xFFFFU) +#define MC33775_I2C_DATA2_WR_MSK \ + (0xFFFFU) +#define MC33775_I2C_DATA2_MW_MSK \ + (0x0U) +#define MC33775_I2C_DATA2_RA_MSK \ + (0x0U) +#define MC33775_I2C_DATA2_POR_MSK \ + (0xffffU) +#define MC33775_I2C_DATA2_POR_VAL \ + (0x0U) + +/* Field BYTE4: I2C data byte 4 */ +#define MC33775_I2C_DATA2_BYTE4_POS \ + (0U) +#define MC33775_I2C_DATA2_BYTE4_MSK \ + (0xFFU) + +/* Field BYTE5: I2C data byte 5 */ +#define MC33775_I2C_DATA2_BYTE5_POS \ + (8U) +#define MC33775_I2C_DATA2_BYTE5_MSK \ + (0xFF00U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t BYTE4 : 8; + volatile uint16_t BYTE5 : 8; + } B; +} mc33775_i2c_registers_i2c_data2_t; + +/* -------------------------------------------------------------------------- + * I2C_DATA3 (read-write):I2C data register 3 + * -------------------------------------------------------------------------- */ +#define MC33775_I2C_DATA3_OFFSET \ + (0xC07U) +#define MC33775_I2C_DATA3_RW_MSK \ + (0xFFFFU) +#define MC33775_I2C_DATA3_RD_MSK \ + (0xFFFFU) +#define MC33775_I2C_DATA3_WR_MSK \ + (0xFFFFU) +#define MC33775_I2C_DATA3_MW_MSK \ + (0x0U) +#define MC33775_I2C_DATA3_RA_MSK \ + (0x0U) +#define MC33775_I2C_DATA3_POR_MSK \ + (0xffffU) +#define MC33775_I2C_DATA3_POR_VAL \ + (0x0U) + +/* Field BYTE6: I2C data byte 6 */ +#define MC33775_I2C_DATA3_BYTE6_POS \ + (0U) +#define MC33775_I2C_DATA3_BYTE6_MSK \ + (0xFFU) + +/* Field BYTE7: I2C data byte 7 */ +#define MC33775_I2C_DATA3_BYTE7_POS \ + (8U) +#define MC33775_I2C_DATA3_BYTE7_MSK \ + (0xFF00U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t BYTE6 : 8; + volatile uint16_t BYTE7 : 8; + } B; +} mc33775_i2c_registers_i2c_data3_t; + +/* -------------------------------------------------------------------------- + * I2C_DATA4 (read-write):I2C data register 4 + * -------------------------------------------------------------------------- */ +#define MC33775_I2C_DATA4_OFFSET \ + (0xC08U) +#define MC33775_I2C_DATA4_RW_MSK \ + (0xFFFFU) +#define MC33775_I2C_DATA4_RD_MSK \ + (0xFFFFU) +#define MC33775_I2C_DATA4_WR_MSK \ + (0xFFFFU) +#define MC33775_I2C_DATA4_MW_MSK \ + (0x0U) +#define MC33775_I2C_DATA4_RA_MSK \ + (0x0U) +#define MC33775_I2C_DATA4_POR_MSK \ + (0xffffU) +#define MC33775_I2C_DATA4_POR_VAL \ + (0x0U) + +/* Field BYTE8: I2C data byte 8 */ +#define MC33775_I2C_DATA4_BYTE8_POS \ + (0U) +#define MC33775_I2C_DATA4_BYTE8_MSK \ + (0xFFU) + +/* Field BYTE9: I2C data byte 9 */ +#define MC33775_I2C_DATA4_BYTE9_POS \ + (8U) +#define MC33775_I2C_DATA4_BYTE9_MSK \ + (0xFF00U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t BYTE8 : 8; + volatile uint16_t BYTE9 : 8; + } B; +} mc33775_i2c_registers_i2c_data4_t; + +/* -------------------------------------------------------------------------- + * I2C_DATA5 (read-write):I2C data register 5 + * -------------------------------------------------------------------------- */ +#define MC33775_I2C_DATA5_OFFSET \ + (0xC09U) +#define MC33775_I2C_DATA5_RW_MSK \ + (0xFFFFU) +#define MC33775_I2C_DATA5_RD_MSK \ + (0xFFFFU) +#define MC33775_I2C_DATA5_WR_MSK \ + (0xFFFFU) +#define MC33775_I2C_DATA5_MW_MSK \ + (0x0U) +#define MC33775_I2C_DATA5_RA_MSK \ + (0x0U) +#define MC33775_I2C_DATA5_POR_MSK \ + (0xffffU) +#define MC33775_I2C_DATA5_POR_VAL \ + (0x0U) + +/* Field BYTE10: I2C data byte 10 */ +#define MC33775_I2C_DATA5_BYTE10_POS \ + (0U) +#define MC33775_I2C_DATA5_BYTE10_MSK \ + (0xFFU) + +/* Field BYTE11: I2C data byte 11 */ +#define MC33775_I2C_DATA5_BYTE11_POS \ + (8U) +#define MC33775_I2C_DATA5_BYTE11_MSK \ + (0xFF00U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t BYTE10 : 8; + volatile uint16_t BYTE11 : 8; + } B; +} mc33775_i2c_registers_i2c_data5_t; + +/* -------------------------------------------------------------------------- + * I2C_DATA6 (read-write):I2C data register 6 + * -------------------------------------------------------------------------- */ +#define MC33775_I2C_DATA6_OFFSET \ + (0xC0AU) +#define MC33775_I2C_DATA6_RW_MSK \ + (0xFFFFU) +#define MC33775_I2C_DATA6_RD_MSK \ + (0xFFFFU) +#define MC33775_I2C_DATA6_WR_MSK \ + (0xFFFFU) +#define MC33775_I2C_DATA6_MW_MSK \ + (0x0U) +#define MC33775_I2C_DATA6_RA_MSK \ + (0x0U) +#define MC33775_I2C_DATA6_POR_MSK \ + (0xffffU) +#define MC33775_I2C_DATA6_POR_VAL \ + (0x0U) + +/* Field BYTE12: I2C data byte 12 */ +#define MC33775_I2C_DATA6_BYTE12_POS \ + (0U) +#define MC33775_I2C_DATA6_BYTE12_MSK \ + (0xFFU) + +/* Field BYTE13: I2C data byte 13 */ +#define MC33775_I2C_DATA6_BYTE13_POS \ + (8U) +#define MC33775_I2C_DATA6_BYTE13_MSK \ + (0xFF00U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t BYTE12 : 8; + volatile uint16_t BYTE13 : 8; + } B; +} mc33775_i2c_registers_i2c_data6_t; + +/* -------------------------------------------------------------------------- + * PRMM_CFG (read-write):General measurement control. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_CFG_OFFSET \ + (0x1800U) +#define MC33775_PRMM_CFG_RW_MSK \ + (0xFFFFU) +#define MC33775_PRMM_CFG_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_CFG_WR_MSK \ + (0xFFFFU) +#define MC33775_PRMM_CFG_MW_MSK \ + (0x0U) +#define MC33775_PRMM_CFG_RA_MSK \ + (0x0U) +#define MC33775_PRMM_CFG_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_CFG_POR_VAL \ + (0x0U) + +/* Field MEASEN: Enable the data acquisition. Setting this bit to zero initiates a result clear and invalidate action (this includes resetting all ready bits). The bit can only be set xxx us after it has been cleared. This bit is cleared when entering Sleep mode. Cyclic measurements are always executed, regardless of the value of this bit. Balancing is not stopped automatically (if in Active mode), as it would be permanently inhibited while measurement is active. If balancing shall be paused, please do so via the balancing control. */ +#define MC33775_PRMM_CFG_MEASEN_POS \ + (0U) +#define MC33775_PRMM_CFG_MEASEN_MSK \ + (0x1U) + +/* Enumerated value DISABLED: Data acquisition disabled */ +#define MC33775_PRMM_CFG_MEASEN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Data acquisition enabled */ +#define MC33775_PRMM_CFG_MEASEN_ENABLED_ENUM_VAL \ + (1U) + +/* Field BALPAUSECYCMODEN: Enable balancing autopause. This delays the start of measurements after entering Cyclic mode until the autopause counter has elapsed. */ +#define MC33775_PRMM_CFG_BALPAUSECYCMODEN_POS \ + (1U) +#define MC33775_PRMM_CFG_BALPAUSECYCMODEN_MSK \ + (0x2U) + +/* Enumerated value DISABLED: Autopause for balancing is disabled. */ +#define MC33775_PRMM_CFG_BALPAUSECYCMODEN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Autopause for balancing is enabled. Measurements are started when the autopause counter is elapsed. */ +#define MC33775_PRMM_CFG_BALPAUSECYCMODEN_ENABLED_ENUM_VAL \ + (1U) + +/* Field BALPAUSELEN: Pause of balancing before measurement cycle is executed. An on-going balancing pause operation is not influenced by a change of this value. 1 LSB = 10us. */ +#define MC33775_PRMM_CFG_BALPAUSELEN_POS \ + (2U) +#define MC33775_PRMM_CFG_BALPAUSELEN_MSK \ + (0xFFFCU) + +/* Enumerated value NO_PAUSE: No Pause. */ +#define MC33775_PRMM_CFG_BALPAUSELEN_NO_PAUSE_ENUM_VAL \ + (0U) + +/* Enumerated value PAUSE_10u: Pause = 10 us */ +#define MC33775_PRMM_CFG_BALPAUSELEN_PAUSE_10U_ENUM_VAL \ + (1U) + +/* Enumerated value MAX: Maximum pause = 163830 us = 163 ms */ +#define MC33775_PRMM_CFG_BALPAUSELEN_MAX_ENUM_VAL \ + (16383U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t MEASEN : 1; + volatile uint16_t BALPAUSECYCMODEN : 1; + volatile uint16_t BALPAUSELEN : 14; + } B; +} mc33775_primary_measurement_registers_prmm_cfg_t; + +/* -------------------------------------------------------------------------- + * PRMM_APP_CTRL (read-write):Application measurement control. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_APP_CTRL_OFFSET \ + (0x1801U) +#define MC33775_PRMM_APP_CTRL_RW_MSK \ + (0x7C00U) +#define MC33775_PRMM_APP_CTRL_RD_MSK \ + (0x7C00U) +#define MC33775_PRMM_APP_CTRL_WR_MSK \ + (0xFFFFU) +#define MC33775_PRMM_APP_CTRL_MW_MSK \ + (0x0U) +#define MC33775_PRMM_APP_CTRL_RA_MSK \ + (0x0U) +#define MC33775_PRMM_APP_CTRL_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_APP_CTRL_POR_VAL \ + (0x7c00U) + +/* Field CAPVC: Capture the application measurement values of the cell terminal measurements. The values are now readable via the app_result register. This bit is only available in the primary measurement chain. */ +#define MC33775_PRMM_APP_CTRL_CAPVC_POS \ + (0U) +#define MC33775_PRMM_APP_CTRL_CAPVC_MSK \ + (0x1U) + +/* Enumerated value NO_CAP: Measurements are not captured. */ +#define MC33775_PRMM_APP_CTRL_CAPVC_NO_CAP_ENUM_VAL \ + (0U) + +/* Enumerated value CAP: Measurements are captured. */ +#define MC33775_PRMM_APP_CTRL_CAPVC_CAP_ENUM_VAL \ + (1U) + +/* Field CAPVMODULE: Capture the application measurement value of the module voltage measurement. The values are now readable via the app_result register. This bit is only available in the primary measurement chain. */ +#define MC33775_PRMM_APP_CTRL_CAPVMODULE_POS \ + (1U) +#define MC33775_PRMM_APP_CTRL_CAPVMODULE_MSK \ + (0x2U) + +/* Enumerated value NO_CAP: Measurements are not captured. */ +#define MC33775_PRMM_APP_CTRL_CAPVMODULE_NO_CAP_ENUM_VAL \ + (0U) + +/* Enumerated value CAP: Measurements are captured. */ +#define MC33775_PRMM_APP_CTRL_CAPVMODULE_CAP_ENUM_VAL \ + (1U) + +/* Field CAPAIN0: Capture the application measurement value of the aux0 terminal measurement. The values are now readable via the app_result register. This bit is only available in the primary measurement chain. */ +#define MC33775_PRMM_APP_CTRL_CAPAIN0_POS \ + (2U) +#define MC33775_PRMM_APP_CTRL_CAPAIN0_MSK \ + (0x4U) + +/* Enumerated value NO_CAP: Measurements are not captured. */ +#define MC33775_PRMM_APP_CTRL_CAPAIN0_NO_CAP_ENUM_VAL \ + (0U) + +/* Enumerated value CAP: Measurements are captured. */ +#define MC33775_PRMM_APP_CTRL_CAPAIN0_CAP_ENUM_VAL \ + (1U) + +/* Field CAPAIN1: Capture the application measurement value of the aux1 terminal measurement. The values are now readable via the app_result register. This bit is only available in the primary measurement chain. */ +#define MC33775_PRMM_APP_CTRL_CAPAIN1_POS \ + (3U) +#define MC33775_PRMM_APP_CTRL_CAPAIN1_MSK \ + (0x8U) + +/* Enumerated value NO_CAP: Measurements are not captured. */ +#define MC33775_PRMM_APP_CTRL_CAPAIN1_NO_CAP_ENUM_VAL \ + (0U) + +/* Enumerated value CAP: Measurements are captured. */ +#define MC33775_PRMM_APP_CTRL_CAPAIN1_CAP_ENUM_VAL \ + (1U) + +/* Field CAPAIN2: Capture the application measurement value of the aux2 terminal measurement. The values are now readable via the app_result register. This bit is only available in the primary measurement chain. */ +#define MC33775_PRMM_APP_CTRL_CAPAIN2_POS \ + (4U) +#define MC33775_PRMM_APP_CTRL_CAPAIN2_MSK \ + (0x10U) + +/* Enumerated value NO_CAP: Measurements are not captured. */ +#define MC33775_PRMM_APP_CTRL_CAPAIN2_NO_CAP_ENUM_VAL \ + (0U) + +/* Enumerated value CAP: Measurements are captured. */ +#define MC33775_PRMM_APP_CTRL_CAPAIN2_CAP_ENUM_VAL \ + (1U) + +/* Field CAPAIN3: Capture the application measurement value of the aux3 terminal measurement. The values are now readable via the app_result register. This bit is only available in the primary measurement chain. */ +#define MC33775_PRMM_APP_CTRL_CAPAIN3_POS \ + (5U) +#define MC33775_PRMM_APP_CTRL_CAPAIN3_MSK \ + (0x20U) + +/* Enumerated value NO_CAP: Measurements are not captured. */ +#define MC33775_PRMM_APP_CTRL_CAPAIN3_NO_CAP_ENUM_VAL \ + (0U) + +/* Enumerated value CAP: Measurements are captured. */ +#define MC33775_PRMM_APP_CTRL_CAPAIN3_CAP_ENUM_VAL \ + (1U) + +/* Field CAPAIN4: Trigger the balancing autopause if set in combination with the PAUSEBAL bit. Needed to keep primary and secondary measurement synchron when used via the ALLM access. In secondary: Capture the application measurement value of the aux4 terminal measurement. */ +#define MC33775_PRMM_APP_CTRL_CAPAIN4_POS \ + (6U) +#define MC33775_PRMM_APP_CTRL_CAPAIN4_MSK \ + (0x40U) + +/* Enumerated value NO_CAP: Measurements are not captured. */ +#define MC33775_PRMM_APP_CTRL_CAPAIN4_NO_CAP_ENUM_VAL \ + (0U) + +/* Enumerated value CAP: Measurements are captured. */ +#define MC33775_PRMM_APP_CTRL_CAPAIN4_CAP_ENUM_VAL \ + (1U) + +/* Field CAPAIN5: Trigger the balancing autopause if set in combination with the PAUSEBAL bit. Needed to keep primary and secondary measurement synchron when used via the ALLM access. In primary: Capture the application measurement value of the aux5 terminal measurement. */ +#define MC33775_PRMM_APP_CTRL_CAPAIN5_POS \ + (7U) +#define MC33775_PRMM_APP_CTRL_CAPAIN5_MSK \ + (0x80U) + +/* Enumerated value NO_CAP: Measurements are not captured. */ +#define MC33775_PRMM_APP_CTRL_CAPAIN5_NO_CAP_ENUM_VAL \ + (0U) + +/* Enumerated value CAP: Measurements are captured. */ +#define MC33775_PRMM_APP_CTRL_CAPAIN5_CAP_ENUM_VAL \ + (1U) + +/* Field CAPAIN6: Trigger the balancing autopause if set in combination with the PAUSEBAL bit. Needed to keep primary and secondary measurement synchron when used via the ALLM access. In primary: Capture the application measurement value of the aux6 terminal measurement. */ +#define MC33775_PRMM_APP_CTRL_CAPAIN6_POS \ + (8U) +#define MC33775_PRMM_APP_CTRL_CAPAIN6_MSK \ + (0x100U) + +/* Enumerated value NO_CAP: Measurements are not captured. */ +#define MC33775_PRMM_APP_CTRL_CAPAIN6_NO_CAP_ENUM_VAL \ + (0U) + +/* Enumerated value CAP: Measurements are captured. */ +#define MC33775_PRMM_APP_CTRL_CAPAIN6_CAP_ENUM_VAL \ + (1U) + +/* Field CAPAIN7: Trigger the balancing autopause if set in combination with the PAUSEBAL bit. Needed to keep primary and secondary measurement synchron when used via the ALLM access. In primary: Capture the application measurement value of the aux7 terminal measurement. */ +#define MC33775_PRMM_APP_CTRL_CAPAIN7_POS \ + (9U) +#define MC33775_PRMM_APP_CTRL_CAPAIN7_MSK \ + (0x200U) + +/* Enumerated value NO_CAP: Measurements are not captured. */ +#define MC33775_PRMM_APP_CTRL_CAPAIN7_NO_CAP_ENUM_VAL \ + (0U) + +/* Enumerated value CAP: Measurements are captured. */ +#define MC33775_PRMM_APP_CTRL_CAPAIN7_CAP_ENUM_VAL \ + (1U) + +/* Field VCOLNUM: VC number for which the open load detection is enabled. 0 - 13 = channel for which the open load detection is enabled. 14 - 30 = reserved (no open load detection mechanism is enabled). Writing this bitfield is only possible if CAPVC is set as well. */ +#define MC33775_PRMM_APP_CTRL_VCOLNUM_POS \ + (10U) +#define MC33775_PRMM_APP_CTRL_VCOLNUM_MSK \ + (0x7C00U) + +/* Enumerated value DISABLED: Open load detection is disabled */ +#define MC33775_PRMM_APP_CTRL_VCOLNUM_DISABLED_ENUM_VAL \ + (31U) + +/* Field PAUSEBAL: Pause the balancing during this capture cycle. If balancing was not paused before, the start of data capture is delayed until the autopause timer has elapsed. If no CAPxxx is set this bit is ignored. */ +#define MC33775_PRMM_APP_CTRL_PAUSEBAL_POS \ + (15U) +#define MC33775_PRMM_APP_CTRL_PAUSEBAL_MSK \ + (0x8000U) + +/* Enumerated value NO_PAUSE: Continue with balancing. */ +#define MC33775_PRMM_APP_CTRL_PAUSEBAL_NO_PAUSE_ENUM_VAL \ + (0U) + +/* Enumerated value PAUSE: Pause the balancing during this capture cycle. */ +#define MC33775_PRMM_APP_CTRL_PAUSEBAL_PAUSE_ENUM_VAL \ + (1U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t CAPVC : 1; + volatile uint16_t CAPVMODULE : 1; + volatile uint16_t CAPAIN0 : 1; + volatile uint16_t CAPAIN1 : 1; + volatile uint16_t CAPAIN2 : 1; + volatile uint16_t CAPAIN3 : 1; + volatile uint16_t CAPAIN4 : 1; + volatile uint16_t CAPAIN5 : 1; + volatile uint16_t CAPAIN6 : 1; + volatile uint16_t CAPAIN7 : 1; + volatile uint16_t VCOLNUM : 5; + volatile uint16_t PAUSEBAL : 1; + } B; +} mc33775_primary_measurement_registers_prmm_app_ctrl_t; + +/* -------------------------------------------------------------------------- + * PRMM_PER_CTRL (read-write):Periodic measurement control. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_PER_CTRL_OFFSET \ + (0x1802U) +#define MC33775_PRMM_PER_CTRL_RW_MSK \ + (0x31FFU) +#define MC33775_PRMM_PER_CTRL_RD_MSK \ + (0x31FFU) +#define MC33775_PRMM_PER_CTRL_WR_MSK \ + (0x31FFU) +#define MC33775_PRMM_PER_CTRL_MW_MSK \ + (0x0U) +#define MC33775_PRMM_PER_CTRL_RA_MSK \ + (0x0U) +#define MC33775_PRMM_PER_CTRL_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_PER_CTRL_POR_VAL \ + (0x10U) + +/* Field PERLEN: Number of measurements for one periodic measurement. The minimum is 16. Writing a value lower than 16 leads to a 16 in the register. */ +#define MC33775_PRMM_PER_CTRL_PERLEN_POS \ + (0U) +#define MC33775_PRMM_PER_CTRL_PERLEN_MSK \ + (0x1FFU) + +/* Enumerated value PER_16: minimum value = 16 measurements per period */ +#define MC33775_PRMM_PER_CTRL_PERLEN_PER_16_ENUM_VAL \ + (16U) + +/* Enumerated value PER_17: 17 measurements per period */ +#define MC33775_PRMM_PER_CTRL_PERLEN_PER_17_ENUM_VAL \ + (17U) + +/* Enumerated value PER_MAX: maximum value = 511 measurements per period */ +#define MC33775_PRMM_PER_CTRL_PERLEN_PER_MAX_ENUM_VAL \ + (511U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_PRMM_PER_CTRL_RESERVED0_POS \ + (9U) +#define MC33775_PRMM_PER_CTRL_RESERVED0_MSK \ + (0xE00U) + +/* Field PERCTRL: Control the periodic result behavior. */ +#define MC33775_PRMM_PER_CTRL_PERCTRL_POS \ + (12U) +#define MC33775_PRMM_PER_CTRL_PERCTRL_MSK \ + (0x3000U) + +/* Enumerated value AUTO: Periodic results are automatically updated */ +#define MC33775_PRMM_PER_CTRL_PERCTRL_AUTO_ENUM_VAL \ + (0U) + +/* Enumerated value RESERVED: reserved */ +#define MC33775_PRMM_PER_CTRL_PERCTRL_RESERVED_ENUM_VAL \ + (1U) + +/* Enumerated value HOLD: Periodic results are held */ +#define MC33775_PRMM_PER_CTRL_PERCTRL_HOLD_ENUM_VAL \ + (2U) + +/* Enumerated value ONCE: Periodic results are updated once with the last results. (each write updates the results). */ +#define MC33775_PRMM_PER_CTRL_PERCTRL_ONCE_ENUM_VAL \ + (3U) + +/* Field reserved1: This read-only field is reserved and always has the value 0. */ +#define MC33775_PRMM_PER_CTRL_RESERVED1_POS \ + (14U) +#define MC33775_PRMM_PER_CTRL_RESERVED1_MSK \ + (0xC000U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t PERLEN : 9; + volatile uint16_t reserved0 : 3; + volatile uint16_t PERCTRL : 2; + volatile uint16_t reserved1 : 2; + } B; +} mc33775_primary_measurement_registers_prmm_per_ctrl_t; + +/* -------------------------------------------------------------------------- + * PRMM_SYNC_CTRL (write-only):Synchronous measurement control. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_SYNC_CTRL_OFFSET \ + (0x1803U) +#define MC33775_PRMM_SYNC_CTRL_RW_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_CTRL_RD_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_CTRL_WR_MSK \ + (0x8003U) +#define MC33775_PRMM_SYNC_CTRL_MW_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_CTRL_RA_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_CTRL_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_SYNC_CTRL_POR_VAL \ + (0x0U) + +/* Field SYNCCYC: Start a synchronous measurement cycle. In this cycle the CT and CB voltages are measured and stored as matching pairs. If no VC channel is enabled or if set during a running synchronous measurement cycle the set is ignored. Read as zero. */ +#define MC33775_PRMM_SYNC_CTRL_SYNCCYC_POS \ + (0U) +#define MC33775_PRMM_SYNC_CTRL_SYNCCYC_MSK \ + (0x1U) + +/* Enumerated value NO_START: No new start a synchronous measurement cycle. */ +#define MC33775_PRMM_SYNC_CTRL_SYNCCYC_NO_START_ENUM_VAL \ + (0U) + +/* Enumerated value STATUS: Read a zero */ +#define MC33775_PRMM_SYNC_CTRL_SYNCCYC_STATUS_ENUM_VAL \ + (0U) + +/* Enumerated value START: Start a synchronous measurement cycle. */ +#define MC33775_PRMM_SYNC_CTRL_SYNCCYC_START_ENUM_VAL \ + (1U) + +/* Field FASTCYC: Start of a dummy Fast measurement cycle. In this cycle nothing is actually measured and stored. The bit is only implemented to keep the balancing autopause synchronous between primary and secondary measurement. If set together with SYNCCYC or during an active synchronous measurement cycle, this bit is ignored. Read as zero. */ +#define MC33775_PRMM_SYNC_CTRL_FASTCYC_POS \ + (1U) +#define MC33775_PRMM_SYNC_CTRL_FASTCYC_MSK \ + (0x2U) + +/* Enumerated value NO_FAST: No new start of a dummy fast measurement cycle. */ +#define MC33775_PRMM_SYNC_CTRL_FASTCYC_NO_FAST_ENUM_VAL \ + (0U) + +/* Enumerated value STATUS: Read as zero. */ +#define MC33775_PRMM_SYNC_CTRL_FASTCYC_STATUS_ENUM_VAL \ + (0U) + +/* Enumerated value FAST: Start a new dummy fast measurement cycle. */ +#define MC33775_PRMM_SYNC_CTRL_FASTCYC_FAST_ENUM_VAL \ + (1U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_PRMM_SYNC_CTRL_RESERVED0_POS \ + (2U) +#define MC33775_PRMM_SYNC_CTRL_RESERVED0_MSK \ + (0x7FFCU) + +/* Field PAUSEBAL: Pause the balancing during this capture cycle. If balancing was not paused before, the start of data capture is delayed until the autopause timer has elapsed. If no capture cycle is started this bit is ignored. */ +#define MC33775_PRMM_SYNC_CTRL_PAUSEBAL_POS \ + (15U) +#define MC33775_PRMM_SYNC_CTRL_PAUSEBAL_MSK \ + (0x8000U) + +/* Enumerated value NO_PAUSE: Continue with balancing. */ +#define MC33775_PRMM_SYNC_CTRL_PAUSEBAL_NO_PAUSE_ENUM_VAL \ + (0U) + +/* Enumerated value PAUSE: Pause the balancing during this capture cycle. */ +#define MC33775_PRMM_SYNC_CTRL_PAUSEBAL_PAUSE_ENUM_VAL \ + (1U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t SYNCCYC : 1; + volatile uint16_t FASTCYC : 1; + volatile uint16_t reserved0 : 13; + volatile uint16_t PAUSEBAL : 1; + } B; +} mc33775_primary_measurement_registers_prmm_sync_ctrl_t; + +/* -------------------------------------------------------------------------- + * PRMM_VC_CFG (read-write):Cell voltage measurement enable. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_VC_CFG_OFFSET \ + (0x1808U) +#define MC33775_PRMM_VC_CFG_RW_MSK \ + (0x3FFFU) +#define MC33775_PRMM_VC_CFG_RD_MSK \ + (0x3FFFU) +#define MC33775_PRMM_VC_CFG_WR_MSK \ + (0x3FFFU) +#define MC33775_PRMM_VC_CFG_MW_MSK \ + (0x0U) +#define MC33775_PRMM_VC_CFG_RA_MSK \ + (0x0U) +#define MC33775_PRMM_VC_CFG_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_VC_CFG_POR_VAL \ + (0x0U) + +/* Field VC0EN: Enable measurement of cell voltage 0. Changes to this bit during active measurement can lead to undefined results. */ +#define MC33775_PRMM_VC_CFG_VC0EN_POS \ + (0U) +#define MC33775_PRMM_VC_CFG_VC0EN_MSK \ + (0x1U) + +/* Enumerated value DISABLED: Measurement disabled */ +#define MC33775_PRMM_VC_CFG_VC0EN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Measurement enabled */ +#define MC33775_PRMM_VC_CFG_VC0EN_ENABLED_ENUM_VAL \ + (1U) + +/* Field VC1EN: Enable measurement of cell voltage 1. Changes to this bit during active measurement can lead to undefined results. */ +#define MC33775_PRMM_VC_CFG_VC1EN_POS \ + (1U) +#define MC33775_PRMM_VC_CFG_VC1EN_MSK \ + (0x2U) + +/* Enumerated value DISABLED: Measurement disabled */ +#define MC33775_PRMM_VC_CFG_VC1EN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Measurement enabled */ +#define MC33775_PRMM_VC_CFG_VC1EN_ENABLED_ENUM_VAL \ + (1U) + +/* Field VC2EN: Enable measurement of cell voltage 2. Changes to this bit during active measurement can lead to undefined results. */ +#define MC33775_PRMM_VC_CFG_VC2EN_POS \ + (2U) +#define MC33775_PRMM_VC_CFG_VC2EN_MSK \ + (0x4U) + +/* Enumerated value DISABLED: Measurement disabled */ +#define MC33775_PRMM_VC_CFG_VC2EN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Measurement enabled */ +#define MC33775_PRMM_VC_CFG_VC2EN_ENABLED_ENUM_VAL \ + (1U) + +/* Field VC3EN: Enable measurement of cell voltage 3. Changes to this bit during active measurement can lead to undefined results. */ +#define MC33775_PRMM_VC_CFG_VC3EN_POS \ + (3U) +#define MC33775_PRMM_VC_CFG_VC3EN_MSK \ + (0x8U) + +/* Enumerated value DISABLED: Measurement disabled */ +#define MC33775_PRMM_VC_CFG_VC3EN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Measurement enabled */ +#define MC33775_PRMM_VC_CFG_VC3EN_ENABLED_ENUM_VAL \ + (1U) + +/* Field VC4EN: Enable measurement of cell voltage 4. Changes to this bit during active measurement can lead to undefined results. */ +#define MC33775_PRMM_VC_CFG_VC4EN_POS \ + (4U) +#define MC33775_PRMM_VC_CFG_VC4EN_MSK \ + (0x10U) + +/* Enumerated value DISABLED: Measurement disabled */ +#define MC33775_PRMM_VC_CFG_VC4EN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Measurement enabled */ +#define MC33775_PRMM_VC_CFG_VC4EN_ENABLED_ENUM_VAL \ + (1U) + +/* Field VC5EN: Enable measurement of cell voltage 5. Changes to this bit during active measurement can lead to undefined results. */ +#define MC33775_PRMM_VC_CFG_VC5EN_POS \ + (5U) +#define MC33775_PRMM_VC_CFG_VC5EN_MSK \ + (0x20U) + +/* Enumerated value DISABLED: Measurement disabled */ +#define MC33775_PRMM_VC_CFG_VC5EN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Measurement enabled */ +#define MC33775_PRMM_VC_CFG_VC5EN_ENABLED_ENUM_VAL \ + (1U) + +/* Field VC6EN: Enable measurement of cell voltage 6. Changes to this bit during active measurement can lead to undefined results. */ +#define MC33775_PRMM_VC_CFG_VC6EN_POS \ + (6U) +#define MC33775_PRMM_VC_CFG_VC6EN_MSK \ + (0x40U) + +/* Enumerated value DISABLED: Measurement disabled */ +#define MC33775_PRMM_VC_CFG_VC6EN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Measurement enabled */ +#define MC33775_PRMM_VC_CFG_VC6EN_ENABLED_ENUM_VAL \ + (1U) + +/* Field VC7EN: Enable measurement of cell voltage 7. Changes to this bit during active measurement can lead to undefined results. */ +#define MC33775_PRMM_VC_CFG_VC7EN_POS \ + (7U) +#define MC33775_PRMM_VC_CFG_VC7EN_MSK \ + (0x80U) + +/* Enumerated value DISABLED: Measurement disabled */ +#define MC33775_PRMM_VC_CFG_VC7EN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Measurement enabled */ +#define MC33775_PRMM_VC_CFG_VC7EN_ENABLED_ENUM_VAL \ + (1U) + +/* Field VC8EN: Enable measurement of cell voltage 8. Changes to this bit during active measurement can lead to undefined results. */ +#define MC33775_PRMM_VC_CFG_VC8EN_POS \ + (8U) +#define MC33775_PRMM_VC_CFG_VC8EN_MSK \ + (0x100U) + +/* Enumerated value DISABLED: Measurement disabled */ +#define MC33775_PRMM_VC_CFG_VC8EN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Measurement enabled */ +#define MC33775_PRMM_VC_CFG_VC8EN_ENABLED_ENUM_VAL \ + (1U) + +/* Field VC9EN: Enable measurement of cell voltage 9. Changes to this bit during active measurement can lead to undefined results. */ +#define MC33775_PRMM_VC_CFG_VC9EN_POS \ + (9U) +#define MC33775_PRMM_VC_CFG_VC9EN_MSK \ + (0x200U) + +/* Enumerated value DISABLED: Measurement disabled */ +#define MC33775_PRMM_VC_CFG_VC9EN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Measurement enabled */ +#define MC33775_PRMM_VC_CFG_VC9EN_ENABLED_ENUM_VAL \ + (1U) + +/* Field VC10EN: Enable measurement of cell voltage 10. Changes to this bit during active measurement can lead to undefined results. */ +#define MC33775_PRMM_VC_CFG_VC10EN_POS \ + (10U) +#define MC33775_PRMM_VC_CFG_VC10EN_MSK \ + (0x400U) + +/* Enumerated value DISABLED: Measurement disabled */ +#define MC33775_PRMM_VC_CFG_VC10EN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Measurement enabled */ +#define MC33775_PRMM_VC_CFG_VC10EN_ENABLED_ENUM_VAL \ + (1U) + +/* Field VC11EN: Enable measurement of cell voltage 11. Changes to this bit during active measurement can lead to undefined results. */ +#define MC33775_PRMM_VC_CFG_VC11EN_POS \ + (11U) +#define MC33775_PRMM_VC_CFG_VC11EN_MSK \ + (0x800U) + +/* Enumerated value DISABLED: Measurement disabled */ +#define MC33775_PRMM_VC_CFG_VC11EN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Measurement enabled */ +#define MC33775_PRMM_VC_CFG_VC11EN_ENABLED_ENUM_VAL \ + (1U) + +/* Field VC12EN: Enable measurement of cell voltage 12. Changes to this bit during active measurement can lead to undefined results. */ +#define MC33775_PRMM_VC_CFG_VC12EN_POS \ + (12U) +#define MC33775_PRMM_VC_CFG_VC12EN_MSK \ + (0x1000U) + +/* Enumerated value DISABLED: Measurement disabled */ +#define MC33775_PRMM_VC_CFG_VC12EN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Measurement enabled */ +#define MC33775_PRMM_VC_CFG_VC12EN_ENABLED_ENUM_VAL \ + (1U) + +/* Field VC13EN: Enable measurement of cell voltage 13. Changes to this bit during active measurement can lead to undefined results. */ +#define MC33775_PRMM_VC_CFG_VC13EN_POS \ + (13U) +#define MC33775_PRMM_VC_CFG_VC13EN_MSK \ + (0x2000U) + +/* Enumerated value DISABLED: Measurement disabled */ +#define MC33775_PRMM_VC_CFG_VC13EN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Measurement enabled */ +#define MC33775_PRMM_VC_CFG_VC13EN_ENABLED_ENUM_VAL \ + (1U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_PRMM_VC_CFG_RESERVED0_POS \ + (14U) +#define MC33775_PRMM_VC_CFG_RESERVED0_MSK \ + (0xC000U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VC0EN : 1; + volatile uint16_t VC1EN : 1; + volatile uint16_t VC2EN : 1; + volatile uint16_t VC3EN : 1; + volatile uint16_t VC4EN : 1; + volatile uint16_t VC5EN : 1; + volatile uint16_t VC6EN : 1; + volatile uint16_t VC7EN : 1; + volatile uint16_t VC8EN : 1; + volatile uint16_t VC9EN : 1; + volatile uint16_t VC10EN : 1; + volatile uint16_t VC11EN : 1; + volatile uint16_t VC12EN : 1; + volatile uint16_t VC13EN : 1; + volatile uint16_t reserved0 : 2; + } B; +} mc33775_primary_measurement_registers_prmm_vc_cfg_t; + +/* -------------------------------------------------------------------------- + * PRMM_AIN_CFG (read-write):AINx and VMODULE measurement enables. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_AIN_CFG_OFFSET \ + (0x1809U) +#define MC33775_PRMM_AIN_CFG_RW_MSK \ + (0xFF9FU) +#define MC33775_PRMM_AIN_CFG_RD_MSK \ + (0xFF9FU) +#define MC33775_PRMM_AIN_CFG_WR_MSK \ + (0xFF9FU) +#define MC33775_PRMM_AIN_CFG_MW_MSK \ + (0x0U) +#define MC33775_PRMM_AIN_CFG_RA_MSK \ + (0x0U) +#define MC33775_PRMM_AIN_CFG_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_AIN_CFG_POR_VAL \ + (0x80U) + +/* Field AIN0EN: Enable measurement of AIN0. Changes to this bit during active measurement can lead to undefined results. Note: TBC Switches the GPIO0/AIN0 to the analog measurement function. */ +#define MC33775_PRMM_AIN_CFG_AIN0EN_POS \ + (0U) +#define MC33775_PRMM_AIN_CFG_AIN0EN_MSK \ + (0x1U) + +/* Enumerated value DISABLED: Measurement disabled */ +#define MC33775_PRMM_AIN_CFG_AIN0EN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Measurement enabled */ +#define MC33775_PRMM_AIN_CFG_AIN0EN_ENABLED_ENUM_VAL \ + (1U) + +/* Field AIN1EN: Enable measurement of AIN1. Changes to this bit during active measurement can lead to undefined results. */ +#define MC33775_PRMM_AIN_CFG_AIN1EN_POS \ + (1U) +#define MC33775_PRMM_AIN_CFG_AIN1EN_MSK \ + (0x2U) + +/* Enumerated value DISABLED: Measurement disabled */ +#define MC33775_PRMM_AIN_CFG_AIN1EN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Measurement enabled */ +#define MC33775_PRMM_AIN_CFG_AIN1EN_ENABLED_ENUM_VAL \ + (1U) + +/* Field AIN2EN: Enable measurement of AIN2. Changes to this bit during active measurement can lead to undefined results. */ +#define MC33775_PRMM_AIN_CFG_AIN2EN_POS \ + (2U) +#define MC33775_PRMM_AIN_CFG_AIN2EN_MSK \ + (0x4U) + +/* Enumerated value DISABLED: Measurement disabled */ +#define MC33775_PRMM_AIN_CFG_AIN2EN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Measurement enabled */ +#define MC33775_PRMM_AIN_CFG_AIN2EN_ENABLED_ENUM_VAL \ + (1U) + +/* Field AIN3EN: Enable measurement of AIN3. Changes to this bit during active measurement can lead to undefined results. */ +#define MC33775_PRMM_AIN_CFG_AIN3EN_POS \ + (3U) +#define MC33775_PRMM_AIN_CFG_AIN3EN_MSK \ + (0x8U) + +/* Enumerated value DISABLED: Measurement disabled */ +#define MC33775_PRMM_AIN_CFG_AIN3EN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Measurement enabled */ +#define MC33775_PRMM_AIN_CFG_AIN3EN_ENABLED_ENUM_VAL \ + (1U) + +/* Field VMODULEEN: Enable measurement of VMODULE. Changes to this bit during active measurement can lead to undefined results. Note: VMODULE is measured in parallel to AIN4. */ +#define MC33775_PRMM_AIN_CFG_VMODULEEN_POS \ + (4U) +#define MC33775_PRMM_AIN_CFG_VMODULEEN_MSK \ + (0x10U) + +/* Enumerated value DISABLED: Measurement disabled */ +#define MC33775_PRMM_AIN_CFG_VMODULEEN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Measurement enabled */ +#define MC33775_PRMM_AIN_CFG_VMODULEEN_ENABLED_ENUM_VAL \ + (1U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_PRMM_AIN_CFG_RESERVED0_POS \ + (5U) +#define MC33775_PRMM_AIN_CFG_RESERVED0_MSK \ + (0x60U) + +/* Field FLTAPPINV: Invalidate AINx application results in case of fault. */ +#define MC33775_PRMM_AIN_CFG_FLTAPPINV_POS \ + (7U) +#define MC33775_PRMM_AIN_CFG_FLTAPPINV_MSK \ + (0x80U) + +/* Enumerated value VALID: AINx application results are not invalidated in case of a fault */ +#define MC33775_PRMM_AIN_CFG_FLTAPPINV_VALID_ENUM_VAL \ + (0U) + +/* Enumerated value INVALID: AINx application results are invalidated when a fault is detected. */ +#define MC33775_PRMM_AIN_CFG_FLTAPPINV_INVALID_ENUM_VAL \ + (1U) + +/* Field RATIOMETRICAIN0: Reference selection for AIN0. Changes to these bits during active measurement can lead to undefined results. */ +#define MC33775_PRMM_AIN_CFG_RATIOMETRICAIN0_POS \ + (8U) +#define MC33775_PRMM_AIN_CFG_RATIOMETRICAIN0_MSK \ + (0x300U) + +/* Enumerated value PRMVREF: Absolute (PRMVREF) */ +#define MC33775_PRMM_AIN_CFG_RATIOMETRICAIN0_PRMVREF_ENUM_VAL \ + (0U) + +/* Enumerated value RESERVED: reserved */ +#define MC33775_PRMM_AIN_CFG_RATIOMETRICAIN0_RESERVED_ENUM_VAL \ + (1U) + +/* Enumerated value VAUX: Ratiometric (VAUX) */ +#define MC33775_PRMM_AIN_CFG_RATIOMETRICAIN0_VAUX_ENUM_VAL \ + (2U) + +/* Enumerated value VDDC: Ratiometric (VDDC) */ +#define MC33775_PRMM_AIN_CFG_RATIOMETRICAIN0_VDDC_ENUM_VAL \ + (3U) + +/* Field RATIOMETRICAIN1: Reference selection for AIN1. Changes to these bits during active measurement can lead to undefined results. */ +#define MC33775_PRMM_AIN_CFG_RATIOMETRICAIN1_POS \ + (10U) +#define MC33775_PRMM_AIN_CFG_RATIOMETRICAIN1_MSK \ + (0xC00U) + +/* Enumerated value PRMVREF: Absolute (PRMVREF) */ +#define MC33775_PRMM_AIN_CFG_RATIOMETRICAIN1_PRMVREF_ENUM_VAL \ + (0U) + +/* Enumerated value RESERVED: reserved */ +#define MC33775_PRMM_AIN_CFG_RATIOMETRICAIN1_RESERVED_ENUM_VAL \ + (1U) + +/* Enumerated value VAUX: Ratiometric (VAUX) */ +#define MC33775_PRMM_AIN_CFG_RATIOMETRICAIN1_VAUX_ENUM_VAL \ + (2U) + +/* Enumerated value VDDC: Ratiometric (VDDC) */ +#define MC33775_PRMM_AIN_CFG_RATIOMETRICAIN1_VDDC_ENUM_VAL \ + (3U) + +/* Field RATIOMETRICAIN2: Reference selection for AIN2. Changes to these bits during active measurement can lead to undefined results. */ +#define MC33775_PRMM_AIN_CFG_RATIOMETRICAIN2_POS \ + (12U) +#define MC33775_PRMM_AIN_CFG_RATIOMETRICAIN2_MSK \ + (0x3000U) + +/* Enumerated value PRMVREF: Absolute (PRMVREF) */ +#define MC33775_PRMM_AIN_CFG_RATIOMETRICAIN2_PRMVREF_ENUM_VAL \ + (0U) + +/* Enumerated value RESERVED: reserved */ +#define MC33775_PRMM_AIN_CFG_RATIOMETRICAIN2_RESERVED_ENUM_VAL \ + (1U) + +/* Enumerated value VAUX: Ratiometric (VAUX) */ +#define MC33775_PRMM_AIN_CFG_RATIOMETRICAIN2_VAUX_ENUM_VAL \ + (2U) + +/* Enumerated value VDDC: Ratiometric (VDDC) */ +#define MC33775_PRMM_AIN_CFG_RATIOMETRICAIN2_VDDC_ENUM_VAL \ + (3U) + +/* Field RATIOMETRICAIN3: Reference selection for AIN3. Changes to these bits during active measurement can lead to undefined results. */ +#define MC33775_PRMM_AIN_CFG_RATIOMETRICAIN3_POS \ + (14U) +#define MC33775_PRMM_AIN_CFG_RATIOMETRICAIN3_MSK \ + (0xC000U) + +/* Enumerated value PRMVREF: Absolute (PRMVREF) */ +#define MC33775_PRMM_AIN_CFG_RATIOMETRICAIN3_PRMVREF_ENUM_VAL \ + (0U) + +/* Enumerated value RESERVED: reserved */ +#define MC33775_PRMM_AIN_CFG_RATIOMETRICAIN3_RESERVED_ENUM_VAL \ + (1U) + +/* Enumerated value VAUX: Ratiometric (VAUX) */ +#define MC33775_PRMM_AIN_CFG_RATIOMETRICAIN3_VAUX_ENUM_VAL \ + (2U) + +/* Enumerated value VDDC: Ratiometric (VDDC) */ +#define MC33775_PRMM_AIN_CFG_RATIOMETRICAIN3_VDDC_ENUM_VAL \ + (3U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t AIN0EN : 1; + volatile uint16_t AIN1EN : 1; + volatile uint16_t AIN2EN : 1; + volatile uint16_t AIN3EN : 1; + volatile uint16_t VMODULEEN : 1; + volatile uint16_t reserved0 : 2; + volatile uint16_t FLTAPPINV : 1; + volatile uint16_t RATIOMETRICAIN0 : 2; + volatile uint16_t RATIOMETRICAIN1 : 2; + volatile uint16_t RATIOMETRICAIN2 : 2; + volatile uint16_t RATIOMETRICAIN3 : 2; + } B; +} mc33775_primary_measurement_registers_prmm_ain_cfg_t; + +/* -------------------------------------------------------------------------- + * PRMM_AIN_OL_CFG (read-write):AINx open_load detection enable. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_AIN_OL_CFG_OFFSET \ + (0x180AU) +#define MC33775_PRMM_AIN_OL_CFG_RW_MSK \ + (0xFU) +#define MC33775_PRMM_AIN_OL_CFG_RD_MSK \ + (0xFU) +#define MC33775_PRMM_AIN_OL_CFG_WR_MSK \ + (0xFU) +#define MC33775_PRMM_AIN_OL_CFG_MW_MSK \ + (0x0U) +#define MC33775_PRMM_AIN_OL_CFG_RA_MSK \ + (0x0U) +#define MC33775_PRMM_AIN_OL_CFG_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_AIN_OL_CFG_POR_VAL \ + (0x0U) + +/* Field AIN0EN: Open load detection circuit for AIN0 */ +#define MC33775_PRMM_AIN_OL_CFG_AIN0EN_POS \ + (0U) +#define MC33775_PRMM_AIN_OL_CFG_AIN0EN_MSK \ + (0x1U) + +/* Enumerated value DISABLED: Disable the open load detection circuit. */ +#define MC33775_PRMM_AIN_OL_CFG_AIN0EN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Enable the open load detection circuit. */ +#define MC33775_PRMM_AIN_OL_CFG_AIN0EN_ENABLED_ENUM_VAL \ + (1U) + +/* Field AIN1EN: Open load detection circuit for AIN1 */ +#define MC33775_PRMM_AIN_OL_CFG_AIN1EN_POS \ + (1U) +#define MC33775_PRMM_AIN_OL_CFG_AIN1EN_MSK \ + (0x2U) + +/* Enumerated value DISABLED: Disable the open load detection circuit. */ +#define MC33775_PRMM_AIN_OL_CFG_AIN1EN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Enable the open load detection circuit. */ +#define MC33775_PRMM_AIN_OL_CFG_AIN1EN_ENABLED_ENUM_VAL \ + (1U) + +/* Field AIN2EN: Open load detection circuit for AIN2 */ +#define MC33775_PRMM_AIN_OL_CFG_AIN2EN_POS \ + (2U) +#define MC33775_PRMM_AIN_OL_CFG_AIN2EN_MSK \ + (0x4U) + +/* Enumerated value DISABLED: Disable the open load detection circuit. */ +#define MC33775_PRMM_AIN_OL_CFG_AIN2EN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Enable the open load detection circuit. */ +#define MC33775_PRMM_AIN_OL_CFG_AIN2EN_ENABLED_ENUM_VAL \ + (1U) + +/* Field AIN3EN: Open load detection circuit for AIN3 */ +#define MC33775_PRMM_AIN_OL_CFG_AIN3EN_POS \ + (3U) +#define MC33775_PRMM_AIN_OL_CFG_AIN3EN_MSK \ + (0x8U) + +/* Enumerated value DISABLED: Disable the open load detection circuit. */ +#define MC33775_PRMM_AIN_OL_CFG_AIN3EN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Enable the open load detection circuit. */ +#define MC33775_PRMM_AIN_OL_CFG_AIN3EN_ENABLED_ENUM_VAL \ + (1U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_PRMM_AIN_OL_CFG_RESERVED0_POS \ + (4U) +#define MC33775_PRMM_AIN_OL_CFG_RESERVED0_MSK \ + (0xFFF0U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t AIN0EN : 1; + volatile uint16_t AIN1EN : 1; + volatile uint16_t AIN2EN : 1; + volatile uint16_t AIN3EN : 1; + volatile uint16_t reserved0 : 12; + } B; +} mc33775_primary_measurement_registers_prmm_ain_ol_cfg_t; + +/* -------------------------------------------------------------------------- + * PRMM_VDIV_CFG (read-write):Voltage divider enable. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_VDIV_CFG_OFFSET \ + (0x180BU) +#define MC33775_PRMM_VDIV_CFG_RW_MSK \ + (0x7U) +#define MC33775_PRMM_VDIV_CFG_RD_MSK \ + (0x7U) +#define MC33775_PRMM_VDIV_CFG_WR_MSK \ + (0x7U) +#define MC33775_PRMM_VDIV_CFG_MW_MSK \ + (0x0U) +#define MC33775_PRMM_VDIV_CFG_RA_MSK \ + (0x0U) +#define MC33775_PRMM_VDIV_CFG_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_VDIV_CFG_POR_VAL \ + (0x7U) + +/* Field VAUXEN: Voltage divider for primary VAUX measurement */ +#define MC33775_PRMM_VDIV_CFG_VAUXEN_POS \ + (0U) +#define MC33775_PRMM_VDIV_CFG_VAUXEN_MSK \ + (0x1U) + +/* Enumerated value DISABLED: Voltage divider for primary VAUX measurement is disabled. */ +#define MC33775_PRMM_VDIV_CFG_VAUXEN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Voltage divider for primary VAUX measurement is enabled. */ +#define MC33775_PRMM_VDIV_CFG_VAUXEN_ENABLED_ENUM_VAL \ + (1U) + +/* Field VDDCEN: Voltage divider for primary VDDC measurement */ +#define MC33775_PRMM_VDIV_CFG_VDDCEN_POS \ + (1U) +#define MC33775_PRMM_VDIV_CFG_VDDCEN_MSK \ + (0x2U) + +/* Enumerated value DISABLED: Voltage divider for primary VDDC measurement is disabled. */ +#define MC33775_PRMM_VDIV_CFG_VDDCEN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Voltage divider for primary VDDC measurement is enabled. */ +#define MC33775_PRMM_VDIV_CFG_VDDCEN_ENABLED_ENUM_VAL \ + (1U) + +/* Field VMODULEEN: Voltage divider for VMODULE. */ +#define MC33775_PRMM_VDIV_CFG_VMODULEEN_POS \ + (2U) +#define MC33775_PRMM_VDIV_CFG_VMODULEEN_MSK \ + (0x4U) + +/* Enumerated value DISABLED: Voltage divider for VMODULE is disabled. */ +#define MC33775_PRMM_VDIV_CFG_VMODULEEN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Voltage divider for VMODULE is enabled. */ +#define MC33775_PRMM_VDIV_CFG_VMODULEEN_ENABLED_ENUM_VAL \ + (1U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_PRMM_VDIV_CFG_RESERVED0_POS \ + (3U) +#define MC33775_PRMM_VDIV_CFG_RESERVED0_MSK \ + (0xFFF8U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VAUXEN : 1; + volatile uint16_t VDDCEN : 1; + volatile uint16_t VMODULEEN : 1; + volatile uint16_t reserved0 : 13; + } B; +} mc33775_primary_measurement_registers_prmm_vdiv_cfg_t; + +/* -------------------------------------------------------------------------- + * PRMM_VC_OV_UV_CFG (read-write):Cell voltage over- and undervoltage check enable. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_VC_OV_UV_CFG_OFFSET \ + (0x1810U) +#define MC33775_PRMM_VC_OV_UV_CFG_RW_MSK \ + (0x3FFFU) +#define MC33775_PRMM_VC_OV_UV_CFG_RD_MSK \ + (0x3FFFU) +#define MC33775_PRMM_VC_OV_UV_CFG_WR_MSK \ + (0x3FFFU) +#define MC33775_PRMM_VC_OV_UV_CFG_MW_MSK \ + (0x0U) +#define MC33775_PRMM_VC_OV_UV_CFG_RA_MSK \ + (0x0U) +#define MC33775_PRMM_VC_OV_UV_CFG_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_VC_OV_UV_CFG_POR_VAL \ + (0x0U) + +/* Field VC0EN: Include VC0 in VC over- and under-voltage checks */ +#define MC33775_PRMM_VC_OV_UV_CFG_VC0EN_POS \ + (0U) +#define MC33775_PRMM_VC_OV_UV_CFG_VC0EN_MSK \ + (0x1U) + +/* Enumerated value NO_CHECK: VC0 is not included in VC over- and under-voltage checks. */ +#define MC33775_PRMM_VC_OV_UV_CFG_VC0EN_NO_CHECK_ENUM_VAL \ + (0U) + +/* Enumerated value UV_OV: VC0 is included in VC over- and under-voltage checks. */ +#define MC33775_PRMM_VC_OV_UV_CFG_VC0EN_UV_OV_ENUM_VAL \ + (1U) + +/* Field VC1EN: Include VC1 in VC over- and under-voltage checks */ +#define MC33775_PRMM_VC_OV_UV_CFG_VC1EN_POS \ + (1U) +#define MC33775_PRMM_VC_OV_UV_CFG_VC1EN_MSK \ + (0x2U) + +/* Enumerated value NO_CHECK: VC1 is not included in VC over- and under-voltage checks. */ +#define MC33775_PRMM_VC_OV_UV_CFG_VC1EN_NO_CHECK_ENUM_VAL \ + (0U) + +/* Enumerated value UV_OV: VC1 is included in VC over- and under-voltage checks. */ +#define MC33775_PRMM_VC_OV_UV_CFG_VC1EN_UV_OV_ENUM_VAL \ + (1U) + +/* Field VC2EN: Include VC2 in VC over- and under-voltage checks */ +#define MC33775_PRMM_VC_OV_UV_CFG_VC2EN_POS \ + (2U) +#define MC33775_PRMM_VC_OV_UV_CFG_VC2EN_MSK \ + (0x4U) + +/* Enumerated value NO_CHECK: VC2 is not included in VC over- and under-voltage checks. */ +#define MC33775_PRMM_VC_OV_UV_CFG_VC2EN_NO_CHECK_ENUM_VAL \ + (0U) + +/* Enumerated value UV_OV: VC2 is included in VC over- and under-voltage checks. */ +#define MC33775_PRMM_VC_OV_UV_CFG_VC2EN_UV_OV_ENUM_VAL \ + (1U) + +/* Field VC3EN: Include VC3 in VC over- and under-voltage checks */ +#define MC33775_PRMM_VC_OV_UV_CFG_VC3EN_POS \ + (3U) +#define MC33775_PRMM_VC_OV_UV_CFG_VC3EN_MSK \ + (0x8U) + +/* Enumerated value NO_CHECK: VC3 is not included in VC over- and under-voltage checks. */ +#define MC33775_PRMM_VC_OV_UV_CFG_VC3EN_NO_CHECK_ENUM_VAL \ + (0U) + +/* Enumerated value UV_OV: VC3 is included in VC over- and under-voltage checks. */ +#define MC33775_PRMM_VC_OV_UV_CFG_VC3EN_UV_OV_ENUM_VAL \ + (1U) + +/* Field VC4EN: Include VC4 in VC over- and under-voltage checks */ +#define MC33775_PRMM_VC_OV_UV_CFG_VC4EN_POS \ + (4U) +#define MC33775_PRMM_VC_OV_UV_CFG_VC4EN_MSK \ + (0x10U) + +/* Enumerated value NO_CHECK: VC4 is not included in VC over- and under-voltage checks. */ +#define MC33775_PRMM_VC_OV_UV_CFG_VC4EN_NO_CHECK_ENUM_VAL \ + (0U) + +/* Enumerated value UV_OV: VC4 is included in VC over- and under-voltage checks. */ +#define MC33775_PRMM_VC_OV_UV_CFG_VC4EN_UV_OV_ENUM_VAL \ + (1U) + +/* Field VC5EN: Include VC5 in VC over- and under-voltage checks */ +#define MC33775_PRMM_VC_OV_UV_CFG_VC5EN_POS \ + (5U) +#define MC33775_PRMM_VC_OV_UV_CFG_VC5EN_MSK \ + (0x20U) + +/* Enumerated value NO_CHECK: VC5 is not included in VC over- and under-voltage checks. */ +#define MC33775_PRMM_VC_OV_UV_CFG_VC5EN_NO_CHECK_ENUM_VAL \ + (0U) + +/* Enumerated value UV_OV: VC5 is included in VC over- and under-voltage checks. */ +#define MC33775_PRMM_VC_OV_UV_CFG_VC5EN_UV_OV_ENUM_VAL \ + (1U) + +/* Field VC6EN: Include VC6 in VC over- and under-voltage checks */ +#define MC33775_PRMM_VC_OV_UV_CFG_VC6EN_POS \ + (6U) +#define MC33775_PRMM_VC_OV_UV_CFG_VC6EN_MSK \ + (0x40U) + +/* Enumerated value NO_CHECK: VC6 is not included in VC over- and under-voltage checks. */ +#define MC33775_PRMM_VC_OV_UV_CFG_VC6EN_NO_CHECK_ENUM_VAL \ + (0U) + +/* Enumerated value UV_OV: VC6 is included in VC over- and under-voltage checks. */ +#define MC33775_PRMM_VC_OV_UV_CFG_VC6EN_UV_OV_ENUM_VAL \ + (1U) + +/* Field VC7EN: Include VC7 in VC over- and under-voltage checks */ +#define MC33775_PRMM_VC_OV_UV_CFG_VC7EN_POS \ + (7U) +#define MC33775_PRMM_VC_OV_UV_CFG_VC7EN_MSK \ + (0x80U) + +/* Enumerated value NO_CHECK: VC7 is not included in VC over- and under-voltage checks. */ +#define MC33775_PRMM_VC_OV_UV_CFG_VC7EN_NO_CHECK_ENUM_VAL \ + (0U) + +/* Enumerated value UV_OV: VC7 is included in VC over- and under-voltage checks. */ +#define MC33775_PRMM_VC_OV_UV_CFG_VC7EN_UV_OV_ENUM_VAL \ + (1U) + +/* Field VC8EN: Include VC8 in VC over- and under-voltage checks */ +#define MC33775_PRMM_VC_OV_UV_CFG_VC8EN_POS \ + (8U) +#define MC33775_PRMM_VC_OV_UV_CFG_VC8EN_MSK \ + (0x100U) + +/* Enumerated value NO_CHECK: VC8 is not included in VC over- and under-voltage checks. */ +#define MC33775_PRMM_VC_OV_UV_CFG_VC8EN_NO_CHECK_ENUM_VAL \ + (0U) + +/* Enumerated value UV_OV: VC8 is included in VC over- and under-voltage checks. */ +#define MC33775_PRMM_VC_OV_UV_CFG_VC8EN_UV_OV_ENUM_VAL \ + (1U) + +/* Field VC9EN: Include VC9 in VC over- and under-voltage checks */ +#define MC33775_PRMM_VC_OV_UV_CFG_VC9EN_POS \ + (9U) +#define MC33775_PRMM_VC_OV_UV_CFG_VC9EN_MSK \ + (0x200U) + +/* Enumerated value NO_CHECK: VC9 is not included in VC over- and under-voltage checks. */ +#define MC33775_PRMM_VC_OV_UV_CFG_VC9EN_NO_CHECK_ENUM_VAL \ + (0U) + +/* Enumerated value UV_OV: VC9 is included in VC over- and under-voltage checks. */ +#define MC33775_PRMM_VC_OV_UV_CFG_VC9EN_UV_OV_ENUM_VAL \ + (1U) + +/* Field VC10EN: Include VC10 in VC over- and under-voltage checks */ +#define MC33775_PRMM_VC_OV_UV_CFG_VC10EN_POS \ + (10U) +#define MC33775_PRMM_VC_OV_UV_CFG_VC10EN_MSK \ + (0x400U) + +/* Enumerated value NO_CHECK: VC10 is not included in VC over- and under-voltage checks. */ +#define MC33775_PRMM_VC_OV_UV_CFG_VC10EN_NO_CHECK_ENUM_VAL \ + (0U) + +/* Enumerated value UV_OV: VC10 is included in VC over- and under-voltage checks. */ +#define MC33775_PRMM_VC_OV_UV_CFG_VC10EN_UV_OV_ENUM_VAL \ + (1U) + +/* Field VC11EN: Include VC11 in VC over- and under-voltage checks */ +#define MC33775_PRMM_VC_OV_UV_CFG_VC11EN_POS \ + (11U) +#define MC33775_PRMM_VC_OV_UV_CFG_VC11EN_MSK \ + (0x800U) + +/* Enumerated value NO_CHECK: VC11 is not included in VC over- and under-voltage checks. */ +#define MC33775_PRMM_VC_OV_UV_CFG_VC11EN_NO_CHECK_ENUM_VAL \ + (0U) + +/* Enumerated value UV_OV: VC11 is included in VC over- and under-voltage checks. */ +#define MC33775_PRMM_VC_OV_UV_CFG_VC11EN_UV_OV_ENUM_VAL \ + (1U) + +/* Field VC12EN: Include VC12 in VC over- and under-voltage checks */ +#define MC33775_PRMM_VC_OV_UV_CFG_VC12EN_POS \ + (12U) +#define MC33775_PRMM_VC_OV_UV_CFG_VC12EN_MSK \ + (0x1000U) + +/* Enumerated value NO_CHECK: VC12 is not included in VC over- and under-voltage checks. */ +#define MC33775_PRMM_VC_OV_UV_CFG_VC12EN_NO_CHECK_ENUM_VAL \ + (0U) + +/* Enumerated value UV_OV: VC12 is included in VC over- and under-voltage checks. */ +#define MC33775_PRMM_VC_OV_UV_CFG_VC12EN_UV_OV_ENUM_VAL \ + (1U) + +/* Field VC13EN: Include VC13 in VC over- and under-voltage checks */ +#define MC33775_PRMM_VC_OV_UV_CFG_VC13EN_POS \ + (13U) +#define MC33775_PRMM_VC_OV_UV_CFG_VC13EN_MSK \ + (0x2000U) + +/* Enumerated value NO_CHECK: VC13 is not included in VC over- and under-voltage checks. */ +#define MC33775_PRMM_VC_OV_UV_CFG_VC13EN_NO_CHECK_ENUM_VAL \ + (0U) + +/* Enumerated value UV_OV: VC13 is included in VC over- and under-voltage checks. */ +#define MC33775_PRMM_VC_OV_UV_CFG_VC13EN_UV_OV_ENUM_VAL \ + (1U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_PRMM_VC_OV_UV_CFG_RESERVED0_POS \ + (14U) +#define MC33775_PRMM_VC_OV_UV_CFG_RESERVED0_MSK \ + (0xC000U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VC0EN : 1; + volatile uint16_t VC1EN : 1; + volatile uint16_t VC2EN : 1; + volatile uint16_t VC3EN : 1; + volatile uint16_t VC4EN : 1; + volatile uint16_t VC5EN : 1; + volatile uint16_t VC6EN : 1; + volatile uint16_t VC7EN : 1; + volatile uint16_t VC8EN : 1; + volatile uint16_t VC9EN : 1; + volatile uint16_t VC10EN : 1; + volatile uint16_t VC11EN : 1; + volatile uint16_t VC12EN : 1; + volatile uint16_t VC13EN : 1; + volatile uint16_t reserved0 : 2; + } B; +} mc33775_primary_measurement_registers_prmm_vc_ov_uv_cfg_t; + +/* -------------------------------------------------------------------------- + * PRMM_VC_OV_TH_CFG (read-write):Upper comparator limit for VC0..13. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_VC_OV_TH_CFG_OFFSET \ + (0x1811U) +#define MC33775_PRMM_VC_OV_TH_CFG_RW_MSK \ + (0xFFFFU) +#define MC33775_PRMM_VC_OV_TH_CFG_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_VC_OV_TH_CFG_WR_MSK \ + (0xFFFFU) +#define MC33775_PRMM_VC_OV_TH_CFG_MW_MSK \ + (0x0U) +#define MC33775_PRMM_VC_OV_TH_CFG_RA_MSK \ + (0x0U) +#define MC33775_PRMM_VC_OV_TH_CFG_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_VC_OV_TH_CFG_POR_VAL \ + (0x7fffU) + +/* Field LIMIT: Limit value. If this limit is reached, the OV fault is activated. */ +#define MC33775_PRMM_VC_OV_TH_CFG_LIMIT_POS \ + (0U) +#define MC33775_PRMM_VC_OV_TH_CFG_LIMIT_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t LIMIT : 16; + } B; +} mc33775_primary_measurement_registers_prmm_vc_ov_th_cfg_t; + +/* -------------------------------------------------------------------------- + * PRMM_VC_UV0_TH_CFG (read-write):Lower comparator limit 0 for VC0..13. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_VC_UV0_TH_CFG_OFFSET \ + (0x1812U) +#define MC33775_PRMM_VC_UV0_TH_CFG_RW_MSK \ + (0xFFFFU) +#define MC33775_PRMM_VC_UV0_TH_CFG_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_VC_UV0_TH_CFG_WR_MSK \ + (0xFFFFU) +#define MC33775_PRMM_VC_UV0_TH_CFG_MW_MSK \ + (0x0U) +#define MC33775_PRMM_VC_UV0_TH_CFG_RA_MSK \ + (0x0U) +#define MC33775_PRMM_VC_UV0_TH_CFG_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_VC_UV0_TH_CFG_POR_VAL \ + (0x0U) + +/* Field LIMIT: Limit value. If this limit is reached, the channel individual UV fault is activated. Note: This limit is used for the channel individual balancing disable. */ +#define MC33775_PRMM_VC_UV0_TH_CFG_LIMIT_POS \ + (0U) +#define MC33775_PRMM_VC_UV0_TH_CFG_LIMIT_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t LIMIT : 16; + } B; +} mc33775_primary_measurement_registers_prmm_vc_uv0_th_cfg_t; + +/* -------------------------------------------------------------------------- + * PRMM_VC_UV1_TH_CFG (read-write):Lower comparator limit 1 for VC0..13. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_VC_UV1_TH_CFG_OFFSET \ + (0x1813U) +#define MC33775_PRMM_VC_UV1_TH_CFG_RW_MSK \ + (0xFFFFU) +#define MC33775_PRMM_VC_UV1_TH_CFG_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_VC_UV1_TH_CFG_WR_MSK \ + (0xFFFFU) +#define MC33775_PRMM_VC_UV1_TH_CFG_MW_MSK \ + (0x0U) +#define MC33775_PRMM_VC_UV1_TH_CFG_RA_MSK \ + (0x0U) +#define MC33775_PRMM_VC_UV1_TH_CFG_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_VC_UV1_TH_CFG_POR_VAL \ + (0x0U) + +/* Field LIMIT: Limit value. If this limit is reached, the global UV fault is activated. Note: This limit is used for the global balancing disable. */ +#define MC33775_PRMM_VC_UV1_TH_CFG_LIMIT_POS \ + (0U) +#define MC33775_PRMM_VC_UV1_TH_CFG_LIMIT_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t LIMIT : 16; + } B; +} mc33775_primary_measurement_registers_prmm_vc_uv1_th_cfg_t; + +/* -------------------------------------------------------------------------- + * PRMM_AIN0_OV_TH_CFG (read-write):Upper comparator limit forAIN0. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_AIN0_OV_TH_CFG_OFFSET \ + (0x1814U) +#define MC33775_PRMM_AIN0_OV_TH_CFG_RW_MSK \ + (0xFFFFU) +#define MC33775_PRMM_AIN0_OV_TH_CFG_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_AIN0_OV_TH_CFG_WR_MSK \ + (0xFFFFU) +#define MC33775_PRMM_AIN0_OV_TH_CFG_MW_MSK \ + (0x0U) +#define MC33775_PRMM_AIN0_OV_TH_CFG_RA_MSK \ + (0x0U) +#define MC33775_PRMM_AIN0_OV_TH_CFG_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_AIN0_OV_TH_CFG_POR_VAL \ + (0x7fffU) + +/* Field LIMIT: Limit value. If this limit is reached, the OV fault is activated. Note: Signed value (two's complement). */ +#define MC33775_PRMM_AIN0_OV_TH_CFG_LIMIT_POS \ + (0U) +#define MC33775_PRMM_AIN0_OV_TH_CFG_LIMIT_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t LIMIT : 16; + } B; +} mc33775_primary_measurement_registers_prmm_ain0_ov_th_cfg_t; + +/* -------------------------------------------------------------------------- + * PRMM_AIN1_OV_TH_CFG (read-write):Upper comparator limit forAIN1. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_AIN1_OV_TH_CFG_OFFSET \ + (0x1815U) +#define MC33775_PRMM_AIN1_OV_TH_CFG_RW_MSK \ + (0xFFFFU) +#define MC33775_PRMM_AIN1_OV_TH_CFG_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_AIN1_OV_TH_CFG_WR_MSK \ + (0xFFFFU) +#define MC33775_PRMM_AIN1_OV_TH_CFG_MW_MSK \ + (0x0U) +#define MC33775_PRMM_AIN1_OV_TH_CFG_RA_MSK \ + (0x0U) +#define MC33775_PRMM_AIN1_OV_TH_CFG_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_AIN1_OV_TH_CFG_POR_VAL \ + (0x7fffU) + +/* Field LIMIT: Limit value. If this limit is reached, the OV fault is activated. */ +#define MC33775_PRMM_AIN1_OV_TH_CFG_LIMIT_POS \ + (0U) +#define MC33775_PRMM_AIN1_OV_TH_CFG_LIMIT_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t LIMIT : 16; + } B; +} mc33775_primary_measurement_registers_prmm_ain1_ov_th_cfg_t; + +/* -------------------------------------------------------------------------- + * PRMM_AIN2_OV_TH_CFG (read-write):Upper comparator limit forAIN2. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_AIN2_OV_TH_CFG_OFFSET \ + (0x1816U) +#define MC33775_PRMM_AIN2_OV_TH_CFG_RW_MSK \ + (0xFFFFU) +#define MC33775_PRMM_AIN2_OV_TH_CFG_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_AIN2_OV_TH_CFG_WR_MSK \ + (0xFFFFU) +#define MC33775_PRMM_AIN2_OV_TH_CFG_MW_MSK \ + (0x0U) +#define MC33775_PRMM_AIN2_OV_TH_CFG_RA_MSK \ + (0x0U) +#define MC33775_PRMM_AIN2_OV_TH_CFG_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_AIN2_OV_TH_CFG_POR_VAL \ + (0x7fffU) + +/* Field LIMIT: Limit value. If this limit is reached, the OV fault is activated. */ +#define MC33775_PRMM_AIN2_OV_TH_CFG_LIMIT_POS \ + (0U) +#define MC33775_PRMM_AIN2_OV_TH_CFG_LIMIT_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t LIMIT : 16; + } B; +} mc33775_primary_measurement_registers_prmm_ain2_ov_th_cfg_t; + +/* -------------------------------------------------------------------------- + * PRMM_AIN3_OV_TH_CFG (read-write):Upper comparator limit forAIN3. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_AIN3_OV_TH_CFG_OFFSET \ + (0x1817U) +#define MC33775_PRMM_AIN3_OV_TH_CFG_RW_MSK \ + (0xFFFFU) +#define MC33775_PRMM_AIN3_OV_TH_CFG_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_AIN3_OV_TH_CFG_WR_MSK \ + (0xFFFFU) +#define MC33775_PRMM_AIN3_OV_TH_CFG_MW_MSK \ + (0x0U) +#define MC33775_PRMM_AIN3_OV_TH_CFG_RA_MSK \ + (0x0U) +#define MC33775_PRMM_AIN3_OV_TH_CFG_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_AIN3_OV_TH_CFG_POR_VAL \ + (0x7fffU) + +/* Field LIMIT: Limit value. If this limit is reached, the OV fault is activated. */ +#define MC33775_PRMM_AIN3_OV_TH_CFG_LIMIT_POS \ + (0U) +#define MC33775_PRMM_AIN3_OV_TH_CFG_LIMIT_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t LIMIT : 16; + } B; +} mc33775_primary_measurement_registers_prmm_ain3_ov_th_cfg_t; + +/* -------------------------------------------------------------------------- + * PRMM_AIN0_UV_TH_CFG (read-write):Lower comparator limit forAIN0. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_AIN0_UV_TH_CFG_OFFSET \ + (0x1818U) +#define MC33775_PRMM_AIN0_UV_TH_CFG_RW_MSK \ + (0xFFFFU) +#define MC33775_PRMM_AIN0_UV_TH_CFG_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_AIN0_UV_TH_CFG_WR_MSK \ + (0xFFFFU) +#define MC33775_PRMM_AIN0_UV_TH_CFG_MW_MSK \ + (0x0U) +#define MC33775_PRMM_AIN0_UV_TH_CFG_RA_MSK \ + (0x0U) +#define MC33775_PRMM_AIN0_UV_TH_CFG_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_AIN0_UV_TH_CFG_POR_VAL \ + (0x8001U) + +/* Field LIMIT: Limit value. If this limit is reached, the UV fault is activated. */ +#define MC33775_PRMM_AIN0_UV_TH_CFG_LIMIT_POS \ + (0U) +#define MC33775_PRMM_AIN0_UV_TH_CFG_LIMIT_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t LIMIT : 16; + } B; +} mc33775_primary_measurement_registers_prmm_ain0_uv_th_cfg_t; + +/* -------------------------------------------------------------------------- + * PRMM_AIN1_UV_TH_CFG (read-write):Lower comparator limit forAIN1. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_AIN1_UV_TH_CFG_OFFSET \ + (0x1819U) +#define MC33775_PRMM_AIN1_UV_TH_CFG_RW_MSK \ + (0xFFFFU) +#define MC33775_PRMM_AIN1_UV_TH_CFG_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_AIN1_UV_TH_CFG_WR_MSK \ + (0xFFFFU) +#define MC33775_PRMM_AIN1_UV_TH_CFG_MW_MSK \ + (0x0U) +#define MC33775_PRMM_AIN1_UV_TH_CFG_RA_MSK \ + (0x0U) +#define MC33775_PRMM_AIN1_UV_TH_CFG_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_AIN1_UV_TH_CFG_POR_VAL \ + (0x8001U) + +/* Field LIMIT: Limit value. If this limit is reached, the UV fault is activated. */ +#define MC33775_PRMM_AIN1_UV_TH_CFG_LIMIT_POS \ + (0U) +#define MC33775_PRMM_AIN1_UV_TH_CFG_LIMIT_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t LIMIT : 16; + } B; +} mc33775_primary_measurement_registers_prmm_ain1_uv_th_cfg_t; + +/* -------------------------------------------------------------------------- + * PRMM_AIN2_UV_TH_CFG (read-write):Lower comparator limit forAIN2. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_AIN2_UV_TH_CFG_OFFSET \ + (0x181AU) +#define MC33775_PRMM_AIN2_UV_TH_CFG_RW_MSK \ + (0xFFFFU) +#define MC33775_PRMM_AIN2_UV_TH_CFG_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_AIN2_UV_TH_CFG_WR_MSK \ + (0xFFFFU) +#define MC33775_PRMM_AIN2_UV_TH_CFG_MW_MSK \ + (0x0U) +#define MC33775_PRMM_AIN2_UV_TH_CFG_RA_MSK \ + (0x0U) +#define MC33775_PRMM_AIN2_UV_TH_CFG_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_AIN2_UV_TH_CFG_POR_VAL \ + (0x8001U) + +/* Field LIMIT: Limit value. If this limit is reached, the UV fault is activated. */ +#define MC33775_PRMM_AIN2_UV_TH_CFG_LIMIT_POS \ + (0U) +#define MC33775_PRMM_AIN2_UV_TH_CFG_LIMIT_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t LIMIT : 16; + } B; +} mc33775_primary_measurement_registers_prmm_ain2_uv_th_cfg_t; + +/* -------------------------------------------------------------------------- + * PRMM_AIN3_UV_TH_CFG (read-write):Lower comparator limit forAIN3. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_AIN3_UV_TH_CFG_OFFSET \ + (0x181BU) +#define MC33775_PRMM_AIN3_UV_TH_CFG_RW_MSK \ + (0xFFFFU) +#define MC33775_PRMM_AIN3_UV_TH_CFG_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_AIN3_UV_TH_CFG_WR_MSK \ + (0xFFFFU) +#define MC33775_PRMM_AIN3_UV_TH_CFG_MW_MSK \ + (0x0U) +#define MC33775_PRMM_AIN3_UV_TH_CFG_RA_MSK \ + (0x0U) +#define MC33775_PRMM_AIN3_UV_TH_CFG_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_AIN3_UV_TH_CFG_POR_VAL \ + (0x8001U) + +/* Field LIMIT: Limit value. If this limit is reached, the UV fault is activated. */ +#define MC33775_PRMM_AIN3_UV_TH_CFG_LIMIT_POS \ + (0U) +#define MC33775_PRMM_AIN3_UV_TH_CFG_LIMIT_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t LIMIT : 16; + } B; +} mc33775_primary_measurement_registers_prmm_ain3_uv_th_cfg_t; + +/* -------------------------------------------------------------------------- + * PRMM_CAL_CRC (read-write):CRC over calibration data. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_CAL_CRC_OFFSET \ + (0x181EU) +#define MC33775_PRMM_CAL_CRC_RW_MSK \ + (0xFFFFU) +#define MC33775_PRMM_CAL_CRC_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_CAL_CRC_WR_MSK \ + (0xFFFFU) +#define MC33775_PRMM_CAL_CRC_MW_MSK \ + (0x0U) +#define MC33775_PRMM_CAL_CRC_RA_MSK \ + (0x0U) +#define MC33775_PRMM_CAL_CRC_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_CAL_CRC_POR_VAL \ + (0x0U) + +/* Field CRC: CRC over calibration data. The CRC calculation runs automatically every time when a synchronous measurement cycle is started and when the calibration data is read from the NVM. */ +#define MC33775_PRMM_CAL_CRC_CRC_POS \ + (0U) +#define MC33775_PRMM_CAL_CRC_CRC_MSK \ + (0xFFFFU) + +/* Enumerated value CALIBCRC: The expected value of the calibration CRC. */ +#define MC33775_PRMM_CAL_CRC_CRC_CALIBCRC_ENUM_VAL \ + (48879U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t CRC : 16; + } B; +} mc33775_primary_measurement_registers_prmm_cal_crc_t; + +/* -------------------------------------------------------------------------- + * PRMM_CFG_CRC (read-only):CRC over configuration values. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_CFG_CRC_OFFSET \ + (0x181FU) +#define MC33775_PRMM_CFG_CRC_RW_MSK \ + (0x0U) +#define MC33775_PRMM_CFG_CRC_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_CFG_CRC_WR_MSK \ + (0x0U) +#define MC33775_PRMM_CFG_CRC_MW_MSK \ + (0x0U) +#define MC33775_PRMM_CFG_CRC_RA_MSK \ + (0x0U) +#define MC33775_PRMM_CFG_CRC_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_CFG_CRC_POR_VAL \ + (0x0U) + +/* Field CRC: This CRC value is recalculated with any transition into Active mode, with any write to a covered register and with any read to this register. The updated CRC value is available latest 100us after the last write. The CRC value is application specific and must be re-calculated by the MCU. The used polynomial is: 0xD175 (+1) = X^16 + X^15 + X^13 + X^9 + X^7 + X^6 + X^5 + X^3 + X^1 + 1. +Following registers are included: PRMM_CFG, PRMM_PER_CTRL, PRMM_VC_CFG, PRMM_AIN_CFG, PRMM_VDIV_CFG, PRMM_VC_OV_UV_CFG, PRMM_VC_OV_TH_CFG, PRMM_VC_UV0_TH_CFG, PRMM_VC_UV1_TH_CFG, PRMM_AIN0_OV_TH_CFG, PRMM_AIN1_OV_TH_CFG, PRMM_AIN2_OV_TH_CFG, PRMM_AIN3_OV_TH_CFG, PRMM_AIN0_UV_TH_CFG, PRMM_AIN1_UV_TH_CFG, PRMM_AIN2_UV_TH_CFG, PRMM_AIN3_UV_TH_CFG. */ +#define MC33775_PRMM_CFG_CRC_CRC_POS \ + (0U) +#define MC33775_PRMM_CFG_CRC_CRC_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t CRC : 16; + } B; +} mc33775_primary_measurement_registers_prmm_cfg_crc_t; + +/* -------------------------------------------------------------------------- + * PRMM_VC_OV_FLT_STAT (read-only):Cell voltage over-voltage faults + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_VC_OV_FLT_STAT_OFFSET \ + (0x1820U) +#define MC33775_PRMM_VC_OV_FLT_STAT_RW_MSK \ + (0x0U) +#define MC33775_PRMM_VC_OV_FLT_STAT_RD_MSK \ + (0x3FFFU) +#define MC33775_PRMM_VC_OV_FLT_STAT_WR_MSK \ + (0x0U) +#define MC33775_PRMM_VC_OV_FLT_STAT_MW_MSK \ + (0x0U) +#define MC33775_PRMM_VC_OV_FLT_STAT_RA_MSK \ + (0x3FFFU) +#define MC33775_PRMM_VC_OV_FLT_STAT_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_VC_OV_FLT_STAT_POR_VAL \ + (0x0U) + +/* Field VC0: Over-voltage status VC0 */ +#define MC33775_PRMM_VC_OV_FLT_STAT_VC0_POS \ + (0U) +#define MC33775_PRMM_VC_OV_FLT_STAT_VC0_MSK \ + (0x1U) + +/* Enumerated value NO_OV: No over-voltage detected */ +#define MC33775_PRMM_VC_OV_FLT_STAT_VC0_NO_OV_ENUM_VAL \ + (0U) + +/* Enumerated value OV: Over-voltage detected */ +#define MC33775_PRMM_VC_OV_FLT_STAT_VC0_OV_ENUM_VAL \ + (1U) + +/* Field VC1: Over-voltage status VC1 */ +#define MC33775_PRMM_VC_OV_FLT_STAT_VC1_POS \ + (1U) +#define MC33775_PRMM_VC_OV_FLT_STAT_VC1_MSK \ + (0x2U) + +/* Enumerated value NO_OV: No over-voltage detected */ +#define MC33775_PRMM_VC_OV_FLT_STAT_VC1_NO_OV_ENUM_VAL \ + (0U) + +/* Enumerated value OV: Over-voltage detected */ +#define MC33775_PRMM_VC_OV_FLT_STAT_VC1_OV_ENUM_VAL \ + (1U) + +/* Field VC2: Over-voltage status VC2 */ +#define MC33775_PRMM_VC_OV_FLT_STAT_VC2_POS \ + (2U) +#define MC33775_PRMM_VC_OV_FLT_STAT_VC2_MSK \ + (0x4U) + +/* Enumerated value NO_OV: No over-voltage detected */ +#define MC33775_PRMM_VC_OV_FLT_STAT_VC2_NO_OV_ENUM_VAL \ + (0U) + +/* Enumerated value OV: Over-voltage detected */ +#define MC33775_PRMM_VC_OV_FLT_STAT_VC2_OV_ENUM_VAL \ + (1U) + +/* Field VC3: Over-voltage status VC3 */ +#define MC33775_PRMM_VC_OV_FLT_STAT_VC3_POS \ + (3U) +#define MC33775_PRMM_VC_OV_FLT_STAT_VC3_MSK \ + (0x8U) + +/* Enumerated value NO_OV: No over-voltage detected */ +#define MC33775_PRMM_VC_OV_FLT_STAT_VC3_NO_OV_ENUM_VAL \ + (0U) + +/* Enumerated value OV: Over-voltage detected */ +#define MC33775_PRMM_VC_OV_FLT_STAT_VC3_OV_ENUM_VAL \ + (1U) + +/* Field VC4: Over-voltage status VC4 */ +#define MC33775_PRMM_VC_OV_FLT_STAT_VC4_POS \ + (4U) +#define MC33775_PRMM_VC_OV_FLT_STAT_VC4_MSK \ + (0x10U) + +/* Enumerated value NO_OV: No over-voltage detected */ +#define MC33775_PRMM_VC_OV_FLT_STAT_VC4_NO_OV_ENUM_VAL \ + (0U) + +/* Enumerated value OV: Over-voltage detected */ +#define MC33775_PRMM_VC_OV_FLT_STAT_VC4_OV_ENUM_VAL \ + (1U) + +/* Field VC5: Over-voltage status VC5 */ +#define MC33775_PRMM_VC_OV_FLT_STAT_VC5_POS \ + (5U) +#define MC33775_PRMM_VC_OV_FLT_STAT_VC5_MSK \ + (0x20U) + +/* Enumerated value NO_OV: No over-voltage detected */ +#define MC33775_PRMM_VC_OV_FLT_STAT_VC5_NO_OV_ENUM_VAL \ + (0U) + +/* Enumerated value OV: Over-voltage detected */ +#define MC33775_PRMM_VC_OV_FLT_STAT_VC5_OV_ENUM_VAL \ + (1U) + +/* Field VC6: Over-voltage status VC6 */ +#define MC33775_PRMM_VC_OV_FLT_STAT_VC6_POS \ + (6U) +#define MC33775_PRMM_VC_OV_FLT_STAT_VC6_MSK \ + (0x40U) + +/* Enumerated value NO_OV: No over-voltage detected */ +#define MC33775_PRMM_VC_OV_FLT_STAT_VC6_NO_OV_ENUM_VAL \ + (0U) + +/* Enumerated value OV: Over-voltage detected */ +#define MC33775_PRMM_VC_OV_FLT_STAT_VC6_OV_ENUM_VAL \ + (1U) + +/* Field VC7: Over-voltage status VC7 */ +#define MC33775_PRMM_VC_OV_FLT_STAT_VC7_POS \ + (7U) +#define MC33775_PRMM_VC_OV_FLT_STAT_VC7_MSK \ + (0x80U) + +/* Enumerated value NO_OV: No over-voltage detected */ +#define MC33775_PRMM_VC_OV_FLT_STAT_VC7_NO_OV_ENUM_VAL \ + (0U) + +/* Enumerated value OV: Over-voltage detected */ +#define MC33775_PRMM_VC_OV_FLT_STAT_VC7_OV_ENUM_VAL \ + (1U) + +/* Field VC8: Over-voltage status VC8 */ +#define MC33775_PRMM_VC_OV_FLT_STAT_VC8_POS \ + (8U) +#define MC33775_PRMM_VC_OV_FLT_STAT_VC8_MSK \ + (0x100U) + +/* Enumerated value NO_OV: No over-voltage detected */ +#define MC33775_PRMM_VC_OV_FLT_STAT_VC8_NO_OV_ENUM_VAL \ + (0U) + +/* Enumerated value OV: Over-voltage detected */ +#define MC33775_PRMM_VC_OV_FLT_STAT_VC8_OV_ENUM_VAL \ + (1U) + +/* Field VC9: Over-voltage status VC9 */ +#define MC33775_PRMM_VC_OV_FLT_STAT_VC9_POS \ + (9U) +#define MC33775_PRMM_VC_OV_FLT_STAT_VC9_MSK \ + (0x200U) + +/* Enumerated value NO_OV: No over-voltage detected */ +#define MC33775_PRMM_VC_OV_FLT_STAT_VC9_NO_OV_ENUM_VAL \ + (0U) + +/* Enumerated value OV: Over-voltage detected */ +#define MC33775_PRMM_VC_OV_FLT_STAT_VC9_OV_ENUM_VAL \ + (1U) + +/* Field VC10: Over-voltage status VC10 */ +#define MC33775_PRMM_VC_OV_FLT_STAT_VC10_POS \ + (10U) +#define MC33775_PRMM_VC_OV_FLT_STAT_VC10_MSK \ + (0x400U) + +/* Enumerated value NO_OV: No over-voltage detected */ +#define MC33775_PRMM_VC_OV_FLT_STAT_VC10_NO_OV_ENUM_VAL \ + (0U) + +/* Enumerated value OV: Over-voltage detected */ +#define MC33775_PRMM_VC_OV_FLT_STAT_VC10_OV_ENUM_VAL \ + (1U) + +/* Field VC11: Over-voltage status VC11 */ +#define MC33775_PRMM_VC_OV_FLT_STAT_VC11_POS \ + (11U) +#define MC33775_PRMM_VC_OV_FLT_STAT_VC11_MSK \ + (0x800U) + +/* Enumerated value NO_OV: No over-voltage detected */ +#define MC33775_PRMM_VC_OV_FLT_STAT_VC11_NO_OV_ENUM_VAL \ + (0U) + +/* Enumerated value OV: Over-voltage detected */ +#define MC33775_PRMM_VC_OV_FLT_STAT_VC11_OV_ENUM_VAL \ + (1U) + +/* Field VC12: Over-voltage status VC12 */ +#define MC33775_PRMM_VC_OV_FLT_STAT_VC12_POS \ + (12U) +#define MC33775_PRMM_VC_OV_FLT_STAT_VC12_MSK \ + (0x1000U) + +/* Enumerated value NO_OV: No over-voltage detected */ +#define MC33775_PRMM_VC_OV_FLT_STAT_VC12_NO_OV_ENUM_VAL \ + (0U) + +/* Enumerated value OV: Over-voltage detected */ +#define MC33775_PRMM_VC_OV_FLT_STAT_VC12_OV_ENUM_VAL \ + (1U) + +/* Field VC13: Over-voltage status VC13 */ +#define MC33775_PRMM_VC_OV_FLT_STAT_VC13_POS \ + (13U) +#define MC33775_PRMM_VC_OV_FLT_STAT_VC13_MSK \ + (0x2000U) + +/* Enumerated value NO_OV: No over-voltage detected */ +#define MC33775_PRMM_VC_OV_FLT_STAT_VC13_NO_OV_ENUM_VAL \ + (0U) + +/* Enumerated value OV: Over-voltage detected */ +#define MC33775_PRMM_VC_OV_FLT_STAT_VC13_OV_ENUM_VAL \ + (1U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_PRMM_VC_OV_FLT_STAT_RESERVED0_POS \ + (14U) +#define MC33775_PRMM_VC_OV_FLT_STAT_RESERVED0_MSK \ + (0xC000U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VC0 : 1; + volatile uint16_t VC1 : 1; + volatile uint16_t VC2 : 1; + volatile uint16_t VC3 : 1; + volatile uint16_t VC4 : 1; + volatile uint16_t VC5 : 1; + volatile uint16_t VC6 : 1; + volatile uint16_t VC7 : 1; + volatile uint16_t VC8 : 1; + volatile uint16_t VC9 : 1; + volatile uint16_t VC10 : 1; + volatile uint16_t VC11 : 1; + volatile uint16_t VC12 : 1; + volatile uint16_t VC13 : 1; + volatile uint16_t reserved0 : 2; + } B; +} mc33775_primary_measurement_registers_prmm_vc_ov_flt_stat_t; + +/* -------------------------------------------------------------------------- + * PRMM_VC_UV0_FLT_STAT (read-only):Cell voltage under-value faults with respect to limit 0. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_VC_UV0_FLT_STAT_OFFSET \ + (0x1821U) +#define MC33775_PRMM_VC_UV0_FLT_STAT_RW_MSK \ + (0x0U) +#define MC33775_PRMM_VC_UV0_FLT_STAT_RD_MSK \ + (0x3FFFU) +#define MC33775_PRMM_VC_UV0_FLT_STAT_WR_MSK \ + (0x0U) +#define MC33775_PRMM_VC_UV0_FLT_STAT_MW_MSK \ + (0x0U) +#define MC33775_PRMM_VC_UV0_FLT_STAT_RA_MSK \ + (0x3FFFU) +#define MC33775_PRMM_VC_UV0_FLT_STAT_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_VC_UV0_FLT_STAT_POR_VAL \ + (0x0U) + +/* Field VC0: Under-voltage status VC0 */ +#define MC33775_PRMM_VC_UV0_FLT_STAT_VC0_POS \ + (0U) +#define MC33775_PRMM_VC_UV0_FLT_STAT_VC0_MSK \ + (0x1U) + +/* Enumerated value NO_UV: No under-voltage detected */ +#define MC33775_PRMM_VC_UV0_FLT_STAT_VC0_NO_UV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Under-voltage detected */ +#define MC33775_PRMM_VC_UV0_FLT_STAT_VC0_UV_ENUM_VAL \ + (1U) + +/* Field VC1: Under-voltage status VC1 */ +#define MC33775_PRMM_VC_UV0_FLT_STAT_VC1_POS \ + (1U) +#define MC33775_PRMM_VC_UV0_FLT_STAT_VC1_MSK \ + (0x2U) + +/* Enumerated value NO_UV: No under-voltage detected */ +#define MC33775_PRMM_VC_UV0_FLT_STAT_VC1_NO_UV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Under-voltage detected */ +#define MC33775_PRMM_VC_UV0_FLT_STAT_VC1_UV_ENUM_VAL \ + (1U) + +/* Field VC2: Under-voltage status VC2 */ +#define MC33775_PRMM_VC_UV0_FLT_STAT_VC2_POS \ + (2U) +#define MC33775_PRMM_VC_UV0_FLT_STAT_VC2_MSK \ + (0x4U) + +/* Enumerated value NO_UV: No under-voltage detected */ +#define MC33775_PRMM_VC_UV0_FLT_STAT_VC2_NO_UV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Under-voltage detected */ +#define MC33775_PRMM_VC_UV0_FLT_STAT_VC2_UV_ENUM_VAL \ + (1U) + +/* Field VC3: Under-voltage status VC3 */ +#define MC33775_PRMM_VC_UV0_FLT_STAT_VC3_POS \ + (3U) +#define MC33775_PRMM_VC_UV0_FLT_STAT_VC3_MSK \ + (0x8U) + +/* Enumerated value NO_UV: No under-voltage detected */ +#define MC33775_PRMM_VC_UV0_FLT_STAT_VC3_NO_UV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Under-voltage detected */ +#define MC33775_PRMM_VC_UV0_FLT_STAT_VC3_UV_ENUM_VAL \ + (1U) + +/* Field VC4: Under-voltage status VC4 */ +#define MC33775_PRMM_VC_UV0_FLT_STAT_VC4_POS \ + (4U) +#define MC33775_PRMM_VC_UV0_FLT_STAT_VC4_MSK \ + (0x10U) + +/* Enumerated value NO_UV: No under-voltage detected */ +#define MC33775_PRMM_VC_UV0_FLT_STAT_VC4_NO_UV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Under-voltage detected */ +#define MC33775_PRMM_VC_UV0_FLT_STAT_VC4_UV_ENUM_VAL \ + (1U) + +/* Field VC5: Under-voltage status VC5 */ +#define MC33775_PRMM_VC_UV0_FLT_STAT_VC5_POS \ + (5U) +#define MC33775_PRMM_VC_UV0_FLT_STAT_VC5_MSK \ + (0x20U) + +/* Enumerated value NO_UV: No under-voltage detected */ +#define MC33775_PRMM_VC_UV0_FLT_STAT_VC5_NO_UV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Under-voltage detected */ +#define MC33775_PRMM_VC_UV0_FLT_STAT_VC5_UV_ENUM_VAL \ + (1U) + +/* Field VC6: Under-voltage status VC6 */ +#define MC33775_PRMM_VC_UV0_FLT_STAT_VC6_POS \ + (6U) +#define MC33775_PRMM_VC_UV0_FLT_STAT_VC6_MSK \ + (0x40U) + +/* Enumerated value NO_UV: No under-voltage detected */ +#define MC33775_PRMM_VC_UV0_FLT_STAT_VC6_NO_UV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Under-voltage detected */ +#define MC33775_PRMM_VC_UV0_FLT_STAT_VC6_UV_ENUM_VAL \ + (1U) + +/* Field VC7: Under-voltage status VC7 */ +#define MC33775_PRMM_VC_UV0_FLT_STAT_VC7_POS \ + (7U) +#define MC33775_PRMM_VC_UV0_FLT_STAT_VC7_MSK \ + (0x80U) + +/* Enumerated value NO_UV: No under-voltage detected */ +#define MC33775_PRMM_VC_UV0_FLT_STAT_VC7_NO_UV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Under-voltage detected */ +#define MC33775_PRMM_VC_UV0_FLT_STAT_VC7_UV_ENUM_VAL \ + (1U) + +/* Field VC8: Under-voltage status VC8 */ +#define MC33775_PRMM_VC_UV0_FLT_STAT_VC8_POS \ + (8U) +#define MC33775_PRMM_VC_UV0_FLT_STAT_VC8_MSK \ + (0x100U) + +/* Enumerated value NO_UV: No under-voltage detected */ +#define MC33775_PRMM_VC_UV0_FLT_STAT_VC8_NO_UV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Under-voltage detected */ +#define MC33775_PRMM_VC_UV0_FLT_STAT_VC8_UV_ENUM_VAL \ + (1U) + +/* Field VC9: Under-voltage status VC9 */ +#define MC33775_PRMM_VC_UV0_FLT_STAT_VC9_POS \ + (9U) +#define MC33775_PRMM_VC_UV0_FLT_STAT_VC9_MSK \ + (0x200U) + +/* Enumerated value NO_UV: No under-voltage detected */ +#define MC33775_PRMM_VC_UV0_FLT_STAT_VC9_NO_UV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Under-voltage detected */ +#define MC33775_PRMM_VC_UV0_FLT_STAT_VC9_UV_ENUM_VAL \ + (1U) + +/* Field VC10: Under-voltage status VC10 */ +#define MC33775_PRMM_VC_UV0_FLT_STAT_VC10_POS \ + (10U) +#define MC33775_PRMM_VC_UV0_FLT_STAT_VC10_MSK \ + (0x400U) + +/* Enumerated value NO_UV: No under-voltage detected */ +#define MC33775_PRMM_VC_UV0_FLT_STAT_VC10_NO_UV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Under-voltage detected */ +#define MC33775_PRMM_VC_UV0_FLT_STAT_VC10_UV_ENUM_VAL \ + (1U) + +/* Field VC11: Under-voltage status VC11 */ +#define MC33775_PRMM_VC_UV0_FLT_STAT_VC11_POS \ + (11U) +#define MC33775_PRMM_VC_UV0_FLT_STAT_VC11_MSK \ + (0x800U) + +/* Enumerated value NO_UV: No under-voltage detected */ +#define MC33775_PRMM_VC_UV0_FLT_STAT_VC11_NO_UV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Under-voltage detected */ +#define MC33775_PRMM_VC_UV0_FLT_STAT_VC11_UV_ENUM_VAL \ + (1U) + +/* Field VC12: Under-voltage status VC12 */ +#define MC33775_PRMM_VC_UV0_FLT_STAT_VC12_POS \ + (12U) +#define MC33775_PRMM_VC_UV0_FLT_STAT_VC12_MSK \ + (0x1000U) + +/* Enumerated value NO_UV: No under-voltage detected */ +#define MC33775_PRMM_VC_UV0_FLT_STAT_VC12_NO_UV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Under-voltage detected */ +#define MC33775_PRMM_VC_UV0_FLT_STAT_VC12_UV_ENUM_VAL \ + (1U) + +/* Field VC13: Under-voltage status VC13 */ +#define MC33775_PRMM_VC_UV0_FLT_STAT_VC13_POS \ + (13U) +#define MC33775_PRMM_VC_UV0_FLT_STAT_VC13_MSK \ + (0x2000U) + +/* Enumerated value NO_UV: No under-voltage detected */ +#define MC33775_PRMM_VC_UV0_FLT_STAT_VC13_NO_UV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Under-voltage detected */ +#define MC33775_PRMM_VC_UV0_FLT_STAT_VC13_UV_ENUM_VAL \ + (1U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_PRMM_VC_UV0_FLT_STAT_RESERVED0_POS \ + (14U) +#define MC33775_PRMM_VC_UV0_FLT_STAT_RESERVED0_MSK \ + (0xC000U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VC0 : 1; + volatile uint16_t VC1 : 1; + volatile uint16_t VC2 : 1; + volatile uint16_t VC3 : 1; + volatile uint16_t VC4 : 1; + volatile uint16_t VC5 : 1; + volatile uint16_t VC6 : 1; + volatile uint16_t VC7 : 1; + volatile uint16_t VC8 : 1; + volatile uint16_t VC9 : 1; + volatile uint16_t VC10 : 1; + volatile uint16_t VC11 : 1; + volatile uint16_t VC12 : 1; + volatile uint16_t VC13 : 1; + volatile uint16_t reserved0 : 2; + } B; +} mc33775_primary_measurement_registers_prmm_vc_uv0_flt_stat_t; + +/* -------------------------------------------------------------------------- + * PRMM_VC_UV1_FLT_STAT (read-only):Cell voltage under-value faults with respect to limit 1. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_VC_UV1_FLT_STAT_OFFSET \ + (0x1822U) +#define MC33775_PRMM_VC_UV1_FLT_STAT_RW_MSK \ + (0x0U) +#define MC33775_PRMM_VC_UV1_FLT_STAT_RD_MSK \ + (0x3FFFU) +#define MC33775_PRMM_VC_UV1_FLT_STAT_WR_MSK \ + (0x0U) +#define MC33775_PRMM_VC_UV1_FLT_STAT_MW_MSK \ + (0x0U) +#define MC33775_PRMM_VC_UV1_FLT_STAT_RA_MSK \ + (0x3FFFU) +#define MC33775_PRMM_VC_UV1_FLT_STAT_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_VC_UV1_FLT_STAT_POR_VAL \ + (0x0U) + +/* Field VC0: Under-voltage status VC0 */ +#define MC33775_PRMM_VC_UV1_FLT_STAT_VC0_POS \ + (0U) +#define MC33775_PRMM_VC_UV1_FLT_STAT_VC0_MSK \ + (0x1U) + +/* Enumerated value NO_UV: No under-voltage detected */ +#define MC33775_PRMM_VC_UV1_FLT_STAT_VC0_NO_UV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Under-voltage detected */ +#define MC33775_PRMM_VC_UV1_FLT_STAT_VC0_UV_ENUM_VAL \ + (1U) + +/* Field VC1: Under-voltage status VC1 */ +#define MC33775_PRMM_VC_UV1_FLT_STAT_VC1_POS \ + (1U) +#define MC33775_PRMM_VC_UV1_FLT_STAT_VC1_MSK \ + (0x2U) + +/* Enumerated value NO_UV: No under-voltage detected */ +#define MC33775_PRMM_VC_UV1_FLT_STAT_VC1_NO_UV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Under-voltage detected */ +#define MC33775_PRMM_VC_UV1_FLT_STAT_VC1_UV_ENUM_VAL \ + (1U) + +/* Field VC2: Under-voltage status VC2 */ +#define MC33775_PRMM_VC_UV1_FLT_STAT_VC2_POS \ + (2U) +#define MC33775_PRMM_VC_UV1_FLT_STAT_VC2_MSK \ + (0x4U) + +/* Enumerated value NO_UV: No under-voltage detected */ +#define MC33775_PRMM_VC_UV1_FLT_STAT_VC2_NO_UV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Under-voltage detected */ +#define MC33775_PRMM_VC_UV1_FLT_STAT_VC2_UV_ENUM_VAL \ + (1U) + +/* Field VC3: Under-voltage status VC3 */ +#define MC33775_PRMM_VC_UV1_FLT_STAT_VC3_POS \ + (3U) +#define MC33775_PRMM_VC_UV1_FLT_STAT_VC3_MSK \ + (0x8U) + +/* Enumerated value NO_UV: No under-voltage detected */ +#define MC33775_PRMM_VC_UV1_FLT_STAT_VC3_NO_UV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Under-voltage detected */ +#define MC33775_PRMM_VC_UV1_FLT_STAT_VC3_UV_ENUM_VAL \ + (1U) + +/* Field VC4: Under-voltage status VC4 */ +#define MC33775_PRMM_VC_UV1_FLT_STAT_VC4_POS \ + (4U) +#define MC33775_PRMM_VC_UV1_FLT_STAT_VC4_MSK \ + (0x10U) + +/* Enumerated value NO_UV: No under-voltage detected */ +#define MC33775_PRMM_VC_UV1_FLT_STAT_VC4_NO_UV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Under-voltage detected */ +#define MC33775_PRMM_VC_UV1_FLT_STAT_VC4_UV_ENUM_VAL \ + (1U) + +/* Field VC5: Under-voltage status VC5 */ +#define MC33775_PRMM_VC_UV1_FLT_STAT_VC5_POS \ + (5U) +#define MC33775_PRMM_VC_UV1_FLT_STAT_VC5_MSK \ + (0x20U) + +/* Enumerated value NO_UV: No under-voltage detected */ +#define MC33775_PRMM_VC_UV1_FLT_STAT_VC5_NO_UV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Under-voltage detected */ +#define MC33775_PRMM_VC_UV1_FLT_STAT_VC5_UV_ENUM_VAL \ + (1U) + +/* Field VC6: Under-voltage status VC6 */ +#define MC33775_PRMM_VC_UV1_FLT_STAT_VC6_POS \ + (6U) +#define MC33775_PRMM_VC_UV1_FLT_STAT_VC6_MSK \ + (0x40U) + +/* Enumerated value NO_UV: No under-voltage detected */ +#define MC33775_PRMM_VC_UV1_FLT_STAT_VC6_NO_UV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Under-voltage detected */ +#define MC33775_PRMM_VC_UV1_FLT_STAT_VC6_UV_ENUM_VAL \ + (1U) + +/* Field VC7: Under-voltage status VC7 */ +#define MC33775_PRMM_VC_UV1_FLT_STAT_VC7_POS \ + (7U) +#define MC33775_PRMM_VC_UV1_FLT_STAT_VC7_MSK \ + (0x80U) + +/* Enumerated value NO_UV: No under-voltage detected */ +#define MC33775_PRMM_VC_UV1_FLT_STAT_VC7_NO_UV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Under-voltage detected */ +#define MC33775_PRMM_VC_UV1_FLT_STAT_VC7_UV_ENUM_VAL \ + (1U) + +/* Field VC8: Under-voltage status VC8 */ +#define MC33775_PRMM_VC_UV1_FLT_STAT_VC8_POS \ + (8U) +#define MC33775_PRMM_VC_UV1_FLT_STAT_VC8_MSK \ + (0x100U) + +/* Enumerated value NO_UV: No under-voltage detected */ +#define MC33775_PRMM_VC_UV1_FLT_STAT_VC8_NO_UV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Under-voltage detected */ +#define MC33775_PRMM_VC_UV1_FLT_STAT_VC8_UV_ENUM_VAL \ + (1U) + +/* Field VC9: Under-voltage status VC9 */ +#define MC33775_PRMM_VC_UV1_FLT_STAT_VC9_POS \ + (9U) +#define MC33775_PRMM_VC_UV1_FLT_STAT_VC9_MSK \ + (0x200U) + +/* Enumerated value NO_UV: No under-voltage detected */ +#define MC33775_PRMM_VC_UV1_FLT_STAT_VC9_NO_UV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Under-voltage detected */ +#define MC33775_PRMM_VC_UV1_FLT_STAT_VC9_UV_ENUM_VAL \ + (1U) + +/* Field VC10: Under-voltage status VC10 */ +#define MC33775_PRMM_VC_UV1_FLT_STAT_VC10_POS \ + (10U) +#define MC33775_PRMM_VC_UV1_FLT_STAT_VC10_MSK \ + (0x400U) + +/* Enumerated value NO_UV: No under-voltage detected */ +#define MC33775_PRMM_VC_UV1_FLT_STAT_VC10_NO_UV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Under-voltage detected */ +#define MC33775_PRMM_VC_UV1_FLT_STAT_VC10_UV_ENUM_VAL \ + (1U) + +/* Field VC11: Under-voltage status VC11 */ +#define MC33775_PRMM_VC_UV1_FLT_STAT_VC11_POS \ + (11U) +#define MC33775_PRMM_VC_UV1_FLT_STAT_VC11_MSK \ + (0x800U) + +/* Enumerated value NO_UV: No under-voltage detected */ +#define MC33775_PRMM_VC_UV1_FLT_STAT_VC11_NO_UV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Under-voltage detected */ +#define MC33775_PRMM_VC_UV1_FLT_STAT_VC11_UV_ENUM_VAL \ + (1U) + +/* Field VC12: Under-voltage status VC12 */ +#define MC33775_PRMM_VC_UV1_FLT_STAT_VC12_POS \ + (12U) +#define MC33775_PRMM_VC_UV1_FLT_STAT_VC12_MSK \ + (0x1000U) + +/* Enumerated value NO_UV: No under-voltage detected */ +#define MC33775_PRMM_VC_UV1_FLT_STAT_VC12_NO_UV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Under-voltage detected */ +#define MC33775_PRMM_VC_UV1_FLT_STAT_VC12_UV_ENUM_VAL \ + (1U) + +/* Field VC13: Under-voltage status VC13 */ +#define MC33775_PRMM_VC_UV1_FLT_STAT_VC13_POS \ + (13U) +#define MC33775_PRMM_VC_UV1_FLT_STAT_VC13_MSK \ + (0x2000U) + +/* Enumerated value NO_UV: No under-voltage detected */ +#define MC33775_PRMM_VC_UV1_FLT_STAT_VC13_NO_UV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Under-voltage detected */ +#define MC33775_PRMM_VC_UV1_FLT_STAT_VC13_UV_ENUM_VAL \ + (1U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_PRMM_VC_UV1_FLT_STAT_RESERVED0_POS \ + (14U) +#define MC33775_PRMM_VC_UV1_FLT_STAT_RESERVED0_MSK \ + (0xC000U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VC0 : 1; + volatile uint16_t VC1 : 1; + volatile uint16_t VC2 : 1; + volatile uint16_t VC3 : 1; + volatile uint16_t VC4 : 1; + volatile uint16_t VC5 : 1; + volatile uint16_t VC6 : 1; + volatile uint16_t VC7 : 1; + volatile uint16_t VC8 : 1; + volatile uint16_t VC9 : 1; + volatile uint16_t VC10 : 1; + volatile uint16_t VC11 : 1; + volatile uint16_t VC12 : 1; + volatile uint16_t VC13 : 1; + volatile uint16_t reserved0 : 2; + } B; +} mc33775_primary_measurement_registers_prmm_vc_uv1_flt_stat_t; + +/* -------------------------------------------------------------------------- + * PRMM_AIN_OV_FLT_STAT (read-only):AINx over-value faults. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_AIN_OV_FLT_STAT_OFFSET \ + (0x1823U) +#define MC33775_PRMM_AIN_OV_FLT_STAT_RW_MSK \ + (0x0U) +#define MC33775_PRMM_AIN_OV_FLT_STAT_RD_MSK \ + (0xFU) +#define MC33775_PRMM_AIN_OV_FLT_STAT_WR_MSK \ + (0x0U) +#define MC33775_PRMM_AIN_OV_FLT_STAT_MW_MSK \ + (0x0U) +#define MC33775_PRMM_AIN_OV_FLT_STAT_RA_MSK \ + (0xFU) +#define MC33775_PRMM_AIN_OV_FLT_STAT_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_AIN_OV_FLT_STAT_POR_VAL \ + (0x0U) + +/* Field AIN0: Over-voltage status AIN0 */ +#define MC33775_PRMM_AIN_OV_FLT_STAT_AIN0_POS \ + (0U) +#define MC33775_PRMM_AIN_OV_FLT_STAT_AIN0_MSK \ + (0x1U) + +/* Enumerated value NO_OV: No over-voltage detected */ +#define MC33775_PRMM_AIN_OV_FLT_STAT_AIN0_NO_OV_ENUM_VAL \ + (0U) + +/* Enumerated value OV: Over-voltage detected */ +#define MC33775_PRMM_AIN_OV_FLT_STAT_AIN0_OV_ENUM_VAL \ + (1U) + +/* Field AIN1: Over-voltage status AIN1 */ +#define MC33775_PRMM_AIN_OV_FLT_STAT_AIN1_POS \ + (1U) +#define MC33775_PRMM_AIN_OV_FLT_STAT_AIN1_MSK \ + (0x2U) + +/* Enumerated value NO_OV: No over-voltage detected */ +#define MC33775_PRMM_AIN_OV_FLT_STAT_AIN1_NO_OV_ENUM_VAL \ + (0U) + +/* Enumerated value OV: Over-voltage detected */ +#define MC33775_PRMM_AIN_OV_FLT_STAT_AIN1_OV_ENUM_VAL \ + (1U) + +/* Field AIN2: Over-voltage status AIN2 */ +#define MC33775_PRMM_AIN_OV_FLT_STAT_AIN2_POS \ + (2U) +#define MC33775_PRMM_AIN_OV_FLT_STAT_AIN2_MSK \ + (0x4U) + +/* Enumerated value NO_OV: No over-voltage detected */ +#define MC33775_PRMM_AIN_OV_FLT_STAT_AIN2_NO_OV_ENUM_VAL \ + (0U) + +/* Enumerated value OV: Over-voltage detected */ +#define MC33775_PRMM_AIN_OV_FLT_STAT_AIN2_OV_ENUM_VAL \ + (1U) + +/* Field AIN3: Over-voltage status AIN3 */ +#define MC33775_PRMM_AIN_OV_FLT_STAT_AIN3_POS \ + (3U) +#define MC33775_PRMM_AIN_OV_FLT_STAT_AIN3_MSK \ + (0x8U) + +/* Enumerated value NO_OV: No over-voltage detected */ +#define MC33775_PRMM_AIN_OV_FLT_STAT_AIN3_NO_OV_ENUM_VAL \ + (0U) + +/* Enumerated value OV: Over-voltage detected */ +#define MC33775_PRMM_AIN_OV_FLT_STAT_AIN3_OV_ENUM_VAL \ + (1U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_PRMM_AIN_OV_FLT_STAT_RESERVED0_POS \ + (4U) +#define MC33775_PRMM_AIN_OV_FLT_STAT_RESERVED0_MSK \ + (0xFFF0U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t AIN0 : 1; + volatile uint16_t AIN1 : 1; + volatile uint16_t AIN2 : 1; + volatile uint16_t AIN3 : 1; + volatile uint16_t reserved0 : 12; + } B; +} mc33775_primary_measurement_registers_prmm_ain_ov_flt_stat_t; + +/* -------------------------------------------------------------------------- + * PRMM_AIN_UV_FLT_STAT (read-only):AINx under-value faults. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_AIN_UV_FLT_STAT_OFFSET \ + (0x1824U) +#define MC33775_PRMM_AIN_UV_FLT_STAT_RW_MSK \ + (0x0U) +#define MC33775_PRMM_AIN_UV_FLT_STAT_RD_MSK \ + (0xFU) +#define MC33775_PRMM_AIN_UV_FLT_STAT_WR_MSK \ + (0x0U) +#define MC33775_PRMM_AIN_UV_FLT_STAT_MW_MSK \ + (0x0U) +#define MC33775_PRMM_AIN_UV_FLT_STAT_RA_MSK \ + (0xFU) +#define MC33775_PRMM_AIN_UV_FLT_STAT_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_AIN_UV_FLT_STAT_POR_VAL \ + (0x0U) + +/* Field AIN0: Under-voltage status AIN0 */ +#define MC33775_PRMM_AIN_UV_FLT_STAT_AIN0_POS \ + (0U) +#define MC33775_PRMM_AIN_UV_FLT_STAT_AIN0_MSK \ + (0x1U) + +/* Enumerated value NO_UV: No under-voltage detected */ +#define MC33775_PRMM_AIN_UV_FLT_STAT_AIN0_NO_UV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Under-voltage detected */ +#define MC33775_PRMM_AIN_UV_FLT_STAT_AIN0_UV_ENUM_VAL \ + (1U) + +/* Field AIN1: Under-voltage status AIN1 */ +#define MC33775_PRMM_AIN_UV_FLT_STAT_AIN1_POS \ + (1U) +#define MC33775_PRMM_AIN_UV_FLT_STAT_AIN1_MSK \ + (0x2U) + +/* Enumerated value NO_UV: No under-voltage detected */ +#define MC33775_PRMM_AIN_UV_FLT_STAT_AIN1_NO_UV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Under-voltage detected */ +#define MC33775_PRMM_AIN_UV_FLT_STAT_AIN1_UV_ENUM_VAL \ + (1U) + +/* Field AIN2: Under-voltage status AIN2 */ +#define MC33775_PRMM_AIN_UV_FLT_STAT_AIN2_POS \ + (2U) +#define MC33775_PRMM_AIN_UV_FLT_STAT_AIN2_MSK \ + (0x4U) + +/* Enumerated value NO_UV: No under-voltage detected */ +#define MC33775_PRMM_AIN_UV_FLT_STAT_AIN2_NO_UV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Under-voltage detected */ +#define MC33775_PRMM_AIN_UV_FLT_STAT_AIN2_UV_ENUM_VAL \ + (1U) + +/* Field AIN3: Under-voltage status AIN3 */ +#define MC33775_PRMM_AIN_UV_FLT_STAT_AIN3_POS \ + (3U) +#define MC33775_PRMM_AIN_UV_FLT_STAT_AIN3_MSK \ + (0x8U) + +/* Enumerated value NO_UV: No under-voltage detected */ +#define MC33775_PRMM_AIN_UV_FLT_STAT_AIN3_NO_UV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Under-voltage detected */ +#define MC33775_PRMM_AIN_UV_FLT_STAT_AIN3_UV_ENUM_VAL \ + (1U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_PRMM_AIN_UV_FLT_STAT_RESERVED0_POS \ + (4U) +#define MC33775_PRMM_AIN_UV_FLT_STAT_RESERVED0_MSK \ + (0xFFF0U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t AIN0 : 1; + volatile uint16_t AIN1 : 1; + volatile uint16_t AIN2 : 1; + volatile uint16_t AIN3 : 1; + volatile uint16_t reserved0 : 12; + } B; +} mc33775_primary_measurement_registers_prmm_ain_uv_flt_stat_t; + +/* -------------------------------------------------------------------------- + * PRMM_MEAS_STAT (read-only):Measurement status. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_MEAS_STAT_OFFSET \ + (0x183EU) +#define MC33775_PRMM_MEAS_STAT_RW_MSK \ + (0x0U) +#define MC33775_PRMM_MEAS_STAT_RD_MSK \ + (0xF33FU) +#define MC33775_PRMM_MEAS_STAT_WR_MSK \ + (0x0U) +#define MC33775_PRMM_MEAS_STAT_MW_MSK \ + (0x0U) +#define MC33775_PRMM_MEAS_STAT_RA_MSK \ + (0x0U) +#define MC33775_PRMM_MEAS_STAT_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_MEAS_STAT_POR_VAL \ + (0x0U) + +/* Field APPRDYVC: A new VC application result can be requested / captured. */ +#define MC33775_PRMM_MEAS_STAT_APPRDYVC_POS \ + (0U) +#define MC33775_PRMM_MEAS_STAT_APPRDYVC_MSK \ + (0x1U) + +/* Enumerated value NO_DATA: No data available (<16 sample) */ +#define MC33775_PRMM_MEAS_STAT_APPRDYVC_NO_DATA_ENUM_VAL \ + (0U) + +/* Enumerated value DATA: Data can be captured (>=16 samples are captured). */ +#define MC33775_PRMM_MEAS_STAT_APPRDYVC_DATA_ENUM_VAL \ + (1U) + +/* Field APPRDYVMODULE: A new VMODULE application result can be requested / captured. */ +#define MC33775_PRMM_MEAS_STAT_APPRDYVMODULE_POS \ + (1U) +#define MC33775_PRMM_MEAS_STAT_APPRDYVMODULE_MSK \ + (0x2U) + +/* Enumerated value NO_DATA: No data available (<16 sample) */ +#define MC33775_PRMM_MEAS_STAT_APPRDYVMODULE_NO_DATA_ENUM_VAL \ + (0U) + +/* Enumerated value DATA: Data can be captured (>=16 samples are captured). */ +#define MC33775_PRMM_MEAS_STAT_APPRDYVMODULE_DATA_ENUM_VAL \ + (1U) + +/* Field APPRDYAIN0: A new AIN0 application result can be requested / captured. */ +#define MC33775_PRMM_MEAS_STAT_APPRDYAIN0_POS \ + (2U) +#define MC33775_PRMM_MEAS_STAT_APPRDYAIN0_MSK \ + (0x4U) + +/* Enumerated value NO_DATA: No data available (<16 sample) */ +#define MC33775_PRMM_MEAS_STAT_APPRDYAIN0_NO_DATA_ENUM_VAL \ + (0U) + +/* Enumerated value DATA: Data can be captured (>=16 samples are captured). */ +#define MC33775_PRMM_MEAS_STAT_APPRDYAIN0_DATA_ENUM_VAL \ + (1U) + +/* Field APPRDYAIN1: A new AIN1 application result can be requested / captured. */ +#define MC33775_PRMM_MEAS_STAT_APPRDYAIN1_POS \ + (3U) +#define MC33775_PRMM_MEAS_STAT_APPRDYAIN1_MSK \ + (0x8U) + +/* Enumerated value NO_DATA: No data available (<16 sample) */ +#define MC33775_PRMM_MEAS_STAT_APPRDYAIN1_NO_DATA_ENUM_VAL \ + (0U) + +/* Enumerated value DATA: Data can be captured (>=16 samples are captured). */ +#define MC33775_PRMM_MEAS_STAT_APPRDYAIN1_DATA_ENUM_VAL \ + (1U) + +/* Field APPRDYAIN2: A new AIN2 application result can be requested / captured. */ +#define MC33775_PRMM_MEAS_STAT_APPRDYAIN2_POS \ + (4U) +#define MC33775_PRMM_MEAS_STAT_APPRDYAIN2_MSK \ + (0x10U) + +/* Enumerated value NO_DATA: No data available (<16 sample) */ +#define MC33775_PRMM_MEAS_STAT_APPRDYAIN2_NO_DATA_ENUM_VAL \ + (0U) + +/* Enumerated value DATA: Data can be captured (>=16 samples are captured). */ +#define MC33775_PRMM_MEAS_STAT_APPRDYAIN2_DATA_ENUM_VAL \ + (1U) + +/* Field APPRDYAIN3: A new AIN3 application result can be requested / captured. */ +#define MC33775_PRMM_MEAS_STAT_APPRDYAIN3_POS \ + (5U) +#define MC33775_PRMM_MEAS_STAT_APPRDYAIN3_MSK \ + (0x20U) + +/* Enumerated value NO_DATA: No data available (<16 sample) */ +#define MC33775_PRMM_MEAS_STAT_APPRDYAIN3_NO_DATA_ENUM_VAL \ + (0U) + +/* Enumerated value DATA: Data can be captured (>=16 samples are captured). */ +#define MC33775_PRMM_MEAS_STAT_APPRDYAIN3_DATA_ENUM_VAL \ + (1U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_PRMM_MEAS_STAT_RESERVED0_POS \ + (6U) +#define MC33775_PRMM_MEAS_STAT_RESERVED0_MSK \ + (0xC0U) + +/* Field PERRDY: New periodic result data has been created (depending on the periodic update mode, they might need to be requested) , the bit is cleared by a read into the periodic result range. */ +#define MC33775_PRMM_MEAS_STAT_PERRDY_POS \ + (8U) +#define MC33775_PRMM_MEAS_STAT_PERRDY_MSK \ + (0x100U) + +/* Enumerated value NO_DATA: No data available */ +#define MC33775_PRMM_MEAS_STAT_PERRDY_NO_DATA_ENUM_VAL \ + (0U) + +/* Enumerated value DATA: Sample data available. */ +#define MC33775_PRMM_MEAS_STAT_PERRDY_DATA_ENUM_VAL \ + (1U) + +/* Field SYNCRDY: Synchronous measurement data is ready for readout, the bit is cleared by a read into the safety result range. */ +#define MC33775_PRMM_MEAS_STAT_SYNCRDY_POS \ + (9U) +#define MC33775_PRMM_MEAS_STAT_SYNCRDY_MSK \ + (0x200U) + +/* Enumerated value NO_DATA: No data available */ +#define MC33775_PRMM_MEAS_STAT_SYNCRDY_NO_DATA_ENUM_VAL \ + (0U) + +/* Enumerated value DATA: Sample data available. */ +#define MC33775_PRMM_MEAS_STAT_SYNCRDY_DATA_ENUM_VAL \ + (1U) + +/* Field reserved1: This read-only field is reserved and always has the value 0. */ +#define MC33775_PRMM_MEAS_STAT_RESERVED1_POS \ + (10U) +#define MC33775_PRMM_MEAS_STAT_RESERVED1_MSK \ + (0xC00U) + +/* Field SUPPLYFLT: Internal/external supply fault status */ +#define MC33775_PRMM_MEAS_STAT_SUPPLYFLT_POS \ + (12U) +#define MC33775_PRMM_MEAS_STAT_SUPPLYFLT_MSK \ + (0x1000U) + +/* Enumerated value NO_FLT: No supply error detected */ +#define MC33775_PRMM_MEAS_STAT_SUPPLYFLT_NO_FLT_ENUM_VAL \ + (0U) + +/* Enumerated value FAULT: Supply error detected */ +#define MC33775_PRMM_MEAS_STAT_SUPPLYFLT_FAULT_ENUM_VAL \ + (1U) + +/* Field ANAFLT: Analog fault status */ +#define MC33775_PRMM_MEAS_STAT_ANAFLT_POS \ + (13U) +#define MC33775_PRMM_MEAS_STAT_ANAFLT_MSK \ + (0x2000U) + +/* Enumerated value NO_FLT: No analog fault detected */ +#define MC33775_PRMM_MEAS_STAT_ANAFLT_NO_FLT_ENUM_VAL \ + (0U) + +/* Enumerated value FAULT: Analog fault detected */ +#define MC33775_PRMM_MEAS_STAT_ANAFLT_FAULT_ENUM_VAL \ + (1U) + +/* Field COMFLT: Communication fault status */ +#define MC33775_PRMM_MEAS_STAT_COMFLT_POS \ + (14U) +#define MC33775_PRMM_MEAS_STAT_COMFLT_MSK \ + (0x4000U) + +/* Enumerated value NO_FLT: No communication fault detected */ +#define MC33775_PRMM_MEAS_STAT_COMFLT_NO_FLT_ENUM_VAL \ + (0U) + +/* Enumerated value FAULT: Communication fault detected. */ +#define MC33775_PRMM_MEAS_STAT_COMFLT_FAULT_ENUM_VAL \ + (1U) + +/* Field MEASFLT: Measurement fault status */ +#define MC33775_PRMM_MEAS_STAT_MEASFLT_POS \ + (15U) +#define MC33775_PRMM_MEAS_STAT_MEASFLT_MSK \ + (0x8000U) + +/* Enumerated value NO_FLT: No measurement fault detected */ +#define MC33775_PRMM_MEAS_STAT_MEASFLT_NO_FLT_ENUM_VAL \ + (0U) + +/* Enumerated value FAULT: Measurement fault detected */ +#define MC33775_PRMM_MEAS_STAT_MEASFLT_FAULT_ENUM_VAL \ + (1U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t APPRDYVC : 1; + volatile uint16_t APPRDYVMODULE : 1; + volatile uint16_t APPRDYAIN0 : 1; + volatile uint16_t APPRDYAIN1 : 1; + volatile uint16_t APPRDYAIN2 : 1; + volatile uint16_t APPRDYAIN3 : 1; + volatile uint16_t reserved0 : 2; + volatile uint16_t PERRDY : 1; + volatile uint16_t SYNCRDY : 1; + volatile uint16_t reserved1 : 2; + volatile uint16_t SUPPLYFLT : 1; + volatile uint16_t ANAFLT : 1; + volatile uint16_t COMFLT : 1; + volatile uint16_t MEASFLT : 1; + } B; +} mc33775_primary_measurement_registers_prmm_meas_stat_t; + +/* -------------------------------------------------------------------------- + * PRMM_APP_VC_CNT (read-only):Application measurement VC sample count number. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_APP_VC_CNT_OFFSET \ + (0x183FU) +#define MC33775_PRMM_APP_VC_CNT_RW_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC_CNT_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_APP_VC_CNT_WR_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC_CNT_MW_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC_CNT_RA_MSK \ + (0xFFFFU) +#define MC33775_PRMM_APP_VC_CNT_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_APP_VC_CNT_POR_VAL \ + (0x0U) + +/* Field NUM: Number of samples used for Application result. */ +#define MC33775_PRMM_APP_VC_CNT_NUM_POS \ + (0U) +#define MC33775_PRMM_APP_VC_CNT_NUM_MSK \ + (0xFFFFU) + +/* Enumerated value LOW: Zero or insufficient samples, VC Application results are invalid. */ +#define MC33775_PRMM_APP_VC_CNT_NUM_LOW_ENUM_VAL \ + (0U) + +/* Enumerated value OVERRUN: Sample counter overrun, VC Application results are invalid. */ +#define MC33775_PRMM_APP_VC_CNT_NUM_OVERRUN_ENUM_VAL \ + (65535U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t NUM : 16; + } B; +} mc33775_primary_measurement_registers_prmm_app_vc_cnt_t; + +/* -------------------------------------------------------------------------- + * PRMM_APP_VC0 (read-only):Application measurement result cell 0. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_APP_VC0_OFFSET \ + (0x1840U) +#define MC33775_PRMM_APP_VC0_RW_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC0_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_APP_VC0_WR_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC0_MW_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC0_RA_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC0_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_APP_VC0_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of cell 0 at the last application capture as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_APP_VC0_VALUE_POS \ + (0U) +#define MC33775_PRMM_APP_VC0_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_app_vc0_t; + +/* -------------------------------------------------------------------------- + * PRMM_APP_VC1 (read-only):Application measurement result cell 1. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_APP_VC1_OFFSET \ + (0x1841U) +#define MC33775_PRMM_APP_VC1_RW_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC1_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_APP_VC1_WR_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC1_MW_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC1_RA_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC1_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_APP_VC1_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of cell 1 at the last application capture as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_APP_VC1_VALUE_POS \ + (0U) +#define MC33775_PRMM_APP_VC1_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_app_vc1_t; + +/* -------------------------------------------------------------------------- + * PRMM_APP_VC2 (read-only):Application measurement result cell 2. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_APP_VC2_OFFSET \ + (0x1842U) +#define MC33775_PRMM_APP_VC2_RW_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC2_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_APP_VC2_WR_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC2_MW_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC2_RA_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC2_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_APP_VC2_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of cell 2 at the last application capture as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_APP_VC2_VALUE_POS \ + (0U) +#define MC33775_PRMM_APP_VC2_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_app_vc2_t; + +/* -------------------------------------------------------------------------- + * PRMM_APP_VC3 (read-only):Application measurement result cell 3. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_APP_VC3_OFFSET \ + (0x1843U) +#define MC33775_PRMM_APP_VC3_RW_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC3_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_APP_VC3_WR_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC3_MW_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC3_RA_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC3_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_APP_VC3_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of cell 3 at the last application capture as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_APP_VC3_VALUE_POS \ + (0U) +#define MC33775_PRMM_APP_VC3_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_app_vc3_t; + +/* -------------------------------------------------------------------------- + * PRMM_APP_VC4 (read-only):Application measurement result cell 4. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_APP_VC4_OFFSET \ + (0x1844U) +#define MC33775_PRMM_APP_VC4_RW_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC4_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_APP_VC4_WR_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC4_MW_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC4_RA_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC4_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_APP_VC4_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of cell 4 at the last application capture as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_APP_VC4_VALUE_POS \ + (0U) +#define MC33775_PRMM_APP_VC4_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_app_vc4_t; + +/* -------------------------------------------------------------------------- + * PRMM_APP_VC5 (read-only):Application measurement result cell 5. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_APP_VC5_OFFSET \ + (0x1845U) +#define MC33775_PRMM_APP_VC5_RW_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC5_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_APP_VC5_WR_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC5_MW_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC5_RA_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC5_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_APP_VC5_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of cell 5 at the last application capture as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_APP_VC5_VALUE_POS \ + (0U) +#define MC33775_PRMM_APP_VC5_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_app_vc5_t; + +/* -------------------------------------------------------------------------- + * PRMM_APP_VC6 (read-only):Application measurement result cell 6. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_APP_VC6_OFFSET \ + (0x1846U) +#define MC33775_PRMM_APP_VC6_RW_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC6_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_APP_VC6_WR_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC6_MW_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC6_RA_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC6_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_APP_VC6_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of cell 6 at the last application capture as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_APP_VC6_VALUE_POS \ + (0U) +#define MC33775_PRMM_APP_VC6_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_app_vc6_t; + +/* -------------------------------------------------------------------------- + * PRMM_APP_VC7 (read-only):Application measurement result cell 7. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_APP_VC7_OFFSET \ + (0x1847U) +#define MC33775_PRMM_APP_VC7_RW_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC7_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_APP_VC7_WR_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC7_MW_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC7_RA_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC7_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_APP_VC7_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of cell 7 at the last application capture as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_APP_VC7_VALUE_POS \ + (0U) +#define MC33775_PRMM_APP_VC7_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_app_vc7_t; + +/* -------------------------------------------------------------------------- + * PRMM_APP_VC8 (read-only):Application measurement result cell 8. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_APP_VC8_OFFSET \ + (0x1848U) +#define MC33775_PRMM_APP_VC8_RW_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC8_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_APP_VC8_WR_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC8_MW_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC8_RA_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC8_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_APP_VC8_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of cell 8 at the last application capture as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_APP_VC8_VALUE_POS \ + (0U) +#define MC33775_PRMM_APP_VC8_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_app_vc8_t; + +/* -------------------------------------------------------------------------- + * PRMM_APP_VC9 (read-only):Application measurement result cell 9. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_APP_VC9_OFFSET \ + (0x1849U) +#define MC33775_PRMM_APP_VC9_RW_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC9_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_APP_VC9_WR_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC9_MW_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC9_RA_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC9_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_APP_VC9_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of cell 9 at the last application capture as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_APP_VC9_VALUE_POS \ + (0U) +#define MC33775_PRMM_APP_VC9_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_app_vc9_t; + +/* -------------------------------------------------------------------------- + * PRMM_APP_VC10 (read-only):Application measurement result cell 10. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_APP_VC10_OFFSET \ + (0x184AU) +#define MC33775_PRMM_APP_VC10_RW_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC10_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_APP_VC10_WR_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC10_MW_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC10_RA_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC10_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_APP_VC10_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of cell 10 at the last application capture as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_APP_VC10_VALUE_POS \ + (0U) +#define MC33775_PRMM_APP_VC10_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_app_vc10_t; + +/* -------------------------------------------------------------------------- + * PRMM_APP_VC11 (read-only):Application measurement result cell 11. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_APP_VC11_OFFSET \ + (0x184BU) +#define MC33775_PRMM_APP_VC11_RW_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC11_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_APP_VC11_WR_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC11_MW_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC11_RA_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC11_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_APP_VC11_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of cell 11 at the last application capture as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_APP_VC11_VALUE_POS \ + (0U) +#define MC33775_PRMM_APP_VC11_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_app_vc11_t; + +/* -------------------------------------------------------------------------- + * PRMM_APP_VC12 (read-only):Application measurement result cell 12. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_APP_VC12_OFFSET \ + (0x184CU) +#define MC33775_PRMM_APP_VC12_RW_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC12_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_APP_VC12_WR_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC12_MW_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC12_RA_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC12_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_APP_VC12_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of cell 12 at the last application capture as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_APP_VC12_VALUE_POS \ + (0U) +#define MC33775_PRMM_APP_VC12_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_app_vc12_t; + +/* -------------------------------------------------------------------------- + * PRMM_APP_VC13 (read-only):Application measurement result cell 13. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_APP_VC13_OFFSET \ + (0x184DU) +#define MC33775_PRMM_APP_VC13_RW_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC13_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_APP_VC13_WR_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC13_MW_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC13_RA_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VC13_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_APP_VC13_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of cell 13 at the last application capture as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_APP_VC13_VALUE_POS \ + (0U) +#define MC33775_PRMM_APP_VC13_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_app_vc13_t; + +/* -------------------------------------------------------------------------- + * PRMM_APP_VMODULE (read-only):Application measurement result module voltage. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_APP_VMODULE_OFFSET \ + (0x184EU) +#define MC33775_PRMM_APP_VMODULE_RW_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VMODULE_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_APP_VMODULE_WR_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VMODULE_MW_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VMODULE_RA_MSK \ + (0x0U) +#define MC33775_PRMM_APP_VMODULE_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_APP_VMODULE_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of VMODULE at the last application capture as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_APP_VMODULE_VALUE_POS \ + (0U) +#define MC33775_PRMM_APP_VMODULE_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_app_vmodule_t; + +/* -------------------------------------------------------------------------- + * PRMM_APP_AIN0 (read-only):Application measurement result AIN0. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_APP_AIN0_OFFSET \ + (0x184FU) +#define MC33775_PRMM_APP_AIN0_RW_MSK \ + (0x0U) +#define MC33775_PRMM_APP_AIN0_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_APP_AIN0_WR_MSK \ + (0x0U) +#define MC33775_PRMM_APP_AIN0_MW_MSK \ + (0x0U) +#define MC33775_PRMM_APP_AIN0_RA_MSK \ + (0x0U) +#define MC33775_PRMM_APP_AIN0_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_APP_AIN0_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of AIN0 at the last application capture as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_APP_AIN0_VALUE_POS \ + (0U) +#define MC33775_PRMM_APP_AIN0_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_app_ain0_t; + +/* -------------------------------------------------------------------------- + * PRMM_APP_AIN1 (read-only):Application measurement result AIN1. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_APP_AIN1_OFFSET \ + (0x1850U) +#define MC33775_PRMM_APP_AIN1_RW_MSK \ + (0x0U) +#define MC33775_PRMM_APP_AIN1_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_APP_AIN1_WR_MSK \ + (0x0U) +#define MC33775_PRMM_APP_AIN1_MW_MSK \ + (0x0U) +#define MC33775_PRMM_APP_AIN1_RA_MSK \ + (0x0U) +#define MC33775_PRMM_APP_AIN1_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_APP_AIN1_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of AIN1 at the last application capture as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_APP_AIN1_VALUE_POS \ + (0U) +#define MC33775_PRMM_APP_AIN1_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_app_ain1_t; + +/* -------------------------------------------------------------------------- + * PRMM_APP_AIN2 (read-only):Application measurement result AIN2. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_APP_AIN2_OFFSET \ + (0x1851U) +#define MC33775_PRMM_APP_AIN2_RW_MSK \ + (0x0U) +#define MC33775_PRMM_APP_AIN2_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_APP_AIN2_WR_MSK \ + (0x0U) +#define MC33775_PRMM_APP_AIN2_MW_MSK \ + (0x0U) +#define MC33775_PRMM_APP_AIN2_RA_MSK \ + (0x0U) +#define MC33775_PRMM_APP_AIN2_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_APP_AIN2_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of AIN2 at the last application capture as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_APP_AIN2_VALUE_POS \ + (0U) +#define MC33775_PRMM_APP_AIN2_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_app_ain2_t; + +/* -------------------------------------------------------------------------- + * PRMM_APP_AIN3 (read-only):Application measurement result AIN3. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_APP_AIN3_OFFSET \ + (0x1852U) +#define MC33775_PRMM_APP_AIN3_RW_MSK \ + (0x0U) +#define MC33775_PRMM_APP_AIN3_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_APP_AIN3_WR_MSK \ + (0x0U) +#define MC33775_PRMM_APP_AIN3_MW_MSK \ + (0x0U) +#define MC33775_PRMM_APP_AIN3_RA_MSK \ + (0x0U) +#define MC33775_PRMM_APP_AIN3_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_APP_AIN3_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of AIN3 at the last application capture as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_APP_AIN3_VALUE_POS \ + (0U) +#define MC33775_PRMM_APP_AIN3_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_app_ain3_t; + +/* -------------------------------------------------------------------------- + * PRMM_PER_NUM (read-only):Measurement period number of the primary periodic results. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_PER_NUM_OFFSET \ + (0x185FU) +#define MC33775_PRMM_PER_NUM_RW_MSK \ + (0x0U) +#define MC33775_PRMM_PER_NUM_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_PER_NUM_WR_MSK \ + (0x0U) +#define MC33775_PRMM_PER_NUM_MW_MSK \ + (0x0U) +#define MC33775_PRMM_PER_NUM_RA_MSK \ + (0x0U) +#define MC33775_PRMM_PER_NUM_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_PER_NUM_POR_VAL \ + (0x0U) + +/* Field NUM: Number of the periodic cycle in which the primary periodic results have been created. The value is incremented for each periodic cycle executed. The counting wraps at its limit. */ +#define MC33775_PRMM_PER_NUM_NUM_POS \ + (0U) +#define MC33775_PRMM_PER_NUM_NUM_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t NUM : 16; + } B; +} mc33775_primary_measurement_registers_prmm_per_num_t; + +/* -------------------------------------------------------------------------- + * PRMM_PER_VC0 (read-only):Periodic measurement result cell0. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_PER_VC0_OFFSET \ + (0x1860U) +#define MC33775_PRMM_PER_VC0_RW_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VC0_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_PER_VC0_WR_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VC0_MW_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VC0_RA_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VC0_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_PER_VC0_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of cell 0 of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_PER_VC0_VALUE_POS \ + (0U) +#define MC33775_PRMM_PER_VC0_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_per_vc0_t; + +/* -------------------------------------------------------------------------- + * PRMM_PER_VC1 (read-only):Periodic measurement result cell1. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_PER_VC1_OFFSET \ + (0x1861U) +#define MC33775_PRMM_PER_VC1_RW_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VC1_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_PER_VC1_WR_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VC1_MW_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VC1_RA_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VC1_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_PER_VC1_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of cell 1 of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_PER_VC1_VALUE_POS \ + (0U) +#define MC33775_PRMM_PER_VC1_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_per_vc1_t; + +/* -------------------------------------------------------------------------- + * PRMM_PER_VC2 (read-only):Periodic measurement result cell2. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_PER_VC2_OFFSET \ + (0x1862U) +#define MC33775_PRMM_PER_VC2_RW_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VC2_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_PER_VC2_WR_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VC2_MW_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VC2_RA_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VC2_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_PER_VC2_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of cell 2 of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_PER_VC2_VALUE_POS \ + (0U) +#define MC33775_PRMM_PER_VC2_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_per_vc2_t; + +/* -------------------------------------------------------------------------- + * PRMM_PER_VC3 (read-only):Periodic measurement result cell3. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_PER_VC3_OFFSET \ + (0x1863U) +#define MC33775_PRMM_PER_VC3_RW_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VC3_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_PER_VC3_WR_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VC3_MW_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VC3_RA_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VC3_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_PER_VC3_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of cell 3 of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_PER_VC3_VALUE_POS \ + (0U) +#define MC33775_PRMM_PER_VC3_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_per_vc3_t; + +/* -------------------------------------------------------------------------- + * PRMM_PER_VC4 (read-only):Periodic measurement result cell4. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_PER_VC4_OFFSET \ + (0x1864U) +#define MC33775_PRMM_PER_VC4_RW_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VC4_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_PER_VC4_WR_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VC4_MW_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VC4_RA_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VC4_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_PER_VC4_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of cell 4 of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_PER_VC4_VALUE_POS \ + (0U) +#define MC33775_PRMM_PER_VC4_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_per_vc4_t; + +/* -------------------------------------------------------------------------- + * PRMM_PER_VC5 (read-only):Periodic measurement result cell5. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_PER_VC5_OFFSET \ + (0x1865U) +#define MC33775_PRMM_PER_VC5_RW_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VC5_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_PER_VC5_WR_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VC5_MW_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VC5_RA_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VC5_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_PER_VC5_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of cell 5 of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_PER_VC5_VALUE_POS \ + (0U) +#define MC33775_PRMM_PER_VC5_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_per_vc5_t; + +/* -------------------------------------------------------------------------- + * PRMM_PER_VC6 (read-only):Periodic measurement result cell6. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_PER_VC6_OFFSET \ + (0x1866U) +#define MC33775_PRMM_PER_VC6_RW_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VC6_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_PER_VC6_WR_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VC6_MW_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VC6_RA_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VC6_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_PER_VC6_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of cell 6 of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_PER_VC6_VALUE_POS \ + (0U) +#define MC33775_PRMM_PER_VC6_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_per_vc6_t; + +/* -------------------------------------------------------------------------- + * PRMM_PER_VC7 (read-only):Periodic measurement result cell7. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_PER_VC7_OFFSET \ + (0x1867U) +#define MC33775_PRMM_PER_VC7_RW_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VC7_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_PER_VC7_WR_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VC7_MW_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VC7_RA_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VC7_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_PER_VC7_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of cell 7 of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_PER_VC7_VALUE_POS \ + (0U) +#define MC33775_PRMM_PER_VC7_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_per_vc7_t; + +/* -------------------------------------------------------------------------- + * PRMM_PER_VC8 (read-only):Periodic measurement result cell8. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_PER_VC8_OFFSET \ + (0x1868U) +#define MC33775_PRMM_PER_VC8_RW_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VC8_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_PER_VC8_WR_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VC8_MW_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VC8_RA_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VC8_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_PER_VC8_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of cell 8 of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_PER_VC8_VALUE_POS \ + (0U) +#define MC33775_PRMM_PER_VC8_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_per_vc8_t; + +/* -------------------------------------------------------------------------- + * PRMM_PER_VC9 (read-only):Periodic measurement result cell9. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_PER_VC9_OFFSET \ + (0x1869U) +#define MC33775_PRMM_PER_VC9_RW_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VC9_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_PER_VC9_WR_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VC9_MW_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VC9_RA_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VC9_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_PER_VC9_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of cell 9 of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_PER_VC9_VALUE_POS \ + (0U) +#define MC33775_PRMM_PER_VC9_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_per_vc9_t; + +/* -------------------------------------------------------------------------- + * PRMM_PER_VC10 (read-only):Periodic measurement result cell10. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_PER_VC10_OFFSET \ + (0x186AU) +#define MC33775_PRMM_PER_VC10_RW_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VC10_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_PER_VC10_WR_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VC10_MW_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VC10_RA_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VC10_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_PER_VC10_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of cell 10 of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_PER_VC10_VALUE_POS \ + (0U) +#define MC33775_PRMM_PER_VC10_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_per_vc10_t; + +/* -------------------------------------------------------------------------- + * PRMM_PER_VC11 (read-only):Periodic measurement result cell11. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_PER_VC11_OFFSET \ + (0x186BU) +#define MC33775_PRMM_PER_VC11_RW_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VC11_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_PER_VC11_WR_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VC11_MW_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VC11_RA_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VC11_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_PER_VC11_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of cell 11 of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_PER_VC11_VALUE_POS \ + (0U) +#define MC33775_PRMM_PER_VC11_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_per_vc11_t; + +/* -------------------------------------------------------------------------- + * PRMM_PER_VC12 (read-only):Periodic measurement result cell12. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_PER_VC12_OFFSET \ + (0x186CU) +#define MC33775_PRMM_PER_VC12_RW_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VC12_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_PER_VC12_WR_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VC12_MW_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VC12_RA_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VC12_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_PER_VC12_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of cell 12 of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_PER_VC12_VALUE_POS \ + (0U) +#define MC33775_PRMM_PER_VC12_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_per_vc12_t; + +/* -------------------------------------------------------------------------- + * PRMM_PER_VC13 (read-only):Periodic measurement result cell13. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_PER_VC13_OFFSET \ + (0x186DU) +#define MC33775_PRMM_PER_VC13_RW_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VC13_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_PER_VC13_WR_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VC13_MW_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VC13_RA_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VC13_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_PER_VC13_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of cell 13 of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_PER_VC13_VALUE_POS \ + (0U) +#define MC33775_PRMM_PER_VC13_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_per_vc13_t; + +/* -------------------------------------------------------------------------- + * PRMM_PER_VMODULE (read-only):Periodic measurement result module voltage. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_PER_VMODULE_OFFSET \ + (0x186EU) +#define MC33775_PRMM_PER_VMODULE_RW_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VMODULE_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_PER_VMODULE_WR_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VMODULE_MW_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VMODULE_RA_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VMODULE_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_PER_VMODULE_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of VMODULE of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_PER_VMODULE_VALUE_POS \ + (0U) +#define MC33775_PRMM_PER_VMODULE_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_per_vmodule_t; + +/* -------------------------------------------------------------------------- + * PRMM_PER_AIN0 (read-only):Periodic measurement result AIN0. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_PER_AIN0_OFFSET \ + (0x186FU) +#define MC33775_PRMM_PER_AIN0_RW_MSK \ + (0x0U) +#define MC33775_PRMM_PER_AIN0_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_PER_AIN0_WR_MSK \ + (0x0U) +#define MC33775_PRMM_PER_AIN0_MW_MSK \ + (0x0U) +#define MC33775_PRMM_PER_AIN0_RA_MSK \ + (0x0U) +#define MC33775_PRMM_PER_AIN0_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_PER_AIN0_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of AIN0 of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_PER_AIN0_VALUE_POS \ + (0U) +#define MC33775_PRMM_PER_AIN0_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_per_ain0_t; + +/* -------------------------------------------------------------------------- + * PRMM_PER_AIN1 (read-only):Periodic measurement result AIN1. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_PER_AIN1_OFFSET \ + (0x1870U) +#define MC33775_PRMM_PER_AIN1_RW_MSK \ + (0x0U) +#define MC33775_PRMM_PER_AIN1_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_PER_AIN1_WR_MSK \ + (0x0U) +#define MC33775_PRMM_PER_AIN1_MW_MSK \ + (0x0U) +#define MC33775_PRMM_PER_AIN1_RA_MSK \ + (0x0U) +#define MC33775_PRMM_PER_AIN1_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_PER_AIN1_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of AIN1 of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_PER_AIN1_VALUE_POS \ + (0U) +#define MC33775_PRMM_PER_AIN1_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_per_ain1_t; + +/* -------------------------------------------------------------------------- + * PRMM_PER_AIN2 (read-only):Periodic measurement result AIN2. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_PER_AIN2_OFFSET \ + (0x1871U) +#define MC33775_PRMM_PER_AIN2_RW_MSK \ + (0x0U) +#define MC33775_PRMM_PER_AIN2_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_PER_AIN2_WR_MSK \ + (0x0U) +#define MC33775_PRMM_PER_AIN2_MW_MSK \ + (0x0U) +#define MC33775_PRMM_PER_AIN2_RA_MSK \ + (0x0U) +#define MC33775_PRMM_PER_AIN2_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_PER_AIN2_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of AIN2 of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_PER_AIN2_VALUE_POS \ + (0U) +#define MC33775_PRMM_PER_AIN2_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_per_ain2_t; + +/* -------------------------------------------------------------------------- + * PRMM_PER_AIN3 (read-only):Periodic measurement result AIN3. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_PER_AIN3_OFFSET \ + (0x1872U) +#define MC33775_PRMM_PER_AIN3_RW_MSK \ + (0x0U) +#define MC33775_PRMM_PER_AIN3_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_PER_AIN3_WR_MSK \ + (0x0U) +#define MC33775_PRMM_PER_AIN3_MW_MSK \ + (0x0U) +#define MC33775_PRMM_PER_AIN3_RA_MSK \ + (0x0U) +#define MC33775_PRMM_PER_AIN3_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_PER_AIN3_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of AIN3 of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_PER_AIN3_VALUE_POS \ + (0U) +#define MC33775_PRMM_PER_AIN3_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_per_ain3_t; + +/* -------------------------------------------------------------------------- + * PRMM_PER_PRMTEMP (read-only):Periodic measurement result primary device temperature. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_PER_PRMTEMP_OFFSET \ + (0x1873U) +#define MC33775_PRMM_PER_PRMTEMP_RW_MSK \ + (0x0U) +#define MC33775_PRMM_PER_PRMTEMP_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_PER_PRMTEMP_WR_MSK \ + (0x0U) +#define MC33775_PRMM_PER_PRMTEMP_MW_MSK \ + (0x0U) +#define MC33775_PRMM_PER_PRMTEMP_RA_MSK \ + (0x0U) +#define MC33775_PRMM_PER_PRMTEMP_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_PER_PRMTEMP_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured value of primary temperature sensor of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_PER_PRMTEMP_VALUE_POS \ + (0U) +#define MC33775_PRMM_PER_PRMTEMP_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_per_prmtemp_t; + +/* -------------------------------------------------------------------------- + * PRMM_PER_SECVREF (read-only):Periodic measurement result secondary voltage reference. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_PER_SECVREF_OFFSET \ + (0x1874U) +#define MC33775_PRMM_PER_SECVREF_RW_MSK \ + (0x0U) +#define MC33775_PRMM_PER_SECVREF_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_PER_SECVREF_WR_MSK \ + (0x0U) +#define MC33775_PRMM_PER_SECVREF_MW_MSK \ + (0x0U) +#define MC33775_PRMM_PER_SECVREF_RA_MSK \ + (0x0U) +#define MC33775_PRMM_PER_SECVREF_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_PER_SECVREF_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of secondary reference voltage of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_PER_SECVREF_VALUE_POS \ + (0U) +#define MC33775_PRMM_PER_SECVREF_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_per_secvref_t; + +/* -------------------------------------------------------------------------- + * PRMM_PER_VAUX (read-only):Periodic measurement result auxiliary supply voltage. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_PER_VAUX_OFFSET \ + (0x1875U) +#define MC33775_PRMM_PER_VAUX_RW_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VAUX_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_PER_VAUX_WR_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VAUX_MW_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VAUX_RA_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VAUX_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_PER_VAUX_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of VAUX of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_PER_VAUX_VALUE_POS \ + (0U) +#define MC33775_PRMM_PER_VAUX_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_per_vaux_t; + +/* -------------------------------------------------------------------------- + * PRMM_PER_VDDC (read-only):Periodic measurement result VDDC. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_PER_VDDC_OFFSET \ + (0x1876U) +#define MC33775_PRMM_PER_VDDC_RW_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VDDC_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_PER_VDDC_WR_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VDDC_MW_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VDDC_RA_MSK \ + (0x0U) +#define MC33775_PRMM_PER_VDDC_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_PER_VDDC_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of VDDC of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_PER_VDDC_VALUE_POS \ + (0U) +#define MC33775_PRMM_PER_VDDC_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_per_vddc_t; + +/* -------------------------------------------------------------------------- + * PRMM_PER_LDOVREF (read-only):Periodic measurement result LDO reference voltage. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_PER_LDOVREF_OFFSET \ + (0x1877U) +#define MC33775_PRMM_PER_LDOVREF_RW_MSK \ + (0x0U) +#define MC33775_PRMM_PER_LDOVREF_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_PER_LDOVREF_WR_MSK \ + (0x0U) +#define MC33775_PRMM_PER_LDOVREF_MW_MSK \ + (0x0U) +#define MC33775_PRMM_PER_LDOVREF_RA_MSK \ + (0x0U) +#define MC33775_PRMM_PER_LDOVREF_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_PER_LDOVREF_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of the LDO reference of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_PER_LDOVREF_VALUE_POS \ + (0U) +#define MC33775_PRMM_PER_LDOVREF_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_per_ldovref_t; + +/* -------------------------------------------------------------------------- + * PRMM_SYNC_NUM (read-only):Measurement period number of the synchronous results. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_SYNC_NUM_OFFSET \ + (0x187FU) +#define MC33775_PRMM_SYNC_NUM_RW_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_NUM_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_SYNC_NUM_WR_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_NUM_MW_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_NUM_RA_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_NUM_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_SYNC_NUM_POR_VAL \ + (0x0U) + +/* Field NUM: Number of the synchronous cycle in which the synchronous results have been created. The value is incremented for each synchronous cycle executed. The counting wraps at its limit. */ +#define MC33775_PRMM_SYNC_NUM_NUM_POS \ + (0U) +#define MC33775_PRMM_SYNC_NUM_NUM_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t NUM : 16; + } B; +} mc33775_primary_measurement_registers_prmm_sync_num_t; + +/* -------------------------------------------------------------------------- + * PRMM_SYNC_VC0 (read-only):Synchronous measurement result cell 0. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_SYNC_VC0_OFFSET \ + (0x1880U) +#define MC33775_PRMM_SYNC_VC0_RW_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_VC0_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_SYNC_VC0_WR_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_VC0_MW_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_VC0_RA_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_VC0_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_SYNC_VC0_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of cell 0 of the last synchronous cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_SYNC_VC0_VALUE_POS \ + (0U) +#define MC33775_PRMM_SYNC_VC0_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_sync_vc0_t; + +/* -------------------------------------------------------------------------- + * PRMM_SYNC_VC1 (read-only):Synchronous measurement result cell 1. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_SYNC_VC1_OFFSET \ + (0x1881U) +#define MC33775_PRMM_SYNC_VC1_RW_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_VC1_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_SYNC_VC1_WR_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_VC1_MW_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_VC1_RA_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_VC1_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_SYNC_VC1_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of cell 1 of the last synchronous cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_SYNC_VC1_VALUE_POS \ + (0U) +#define MC33775_PRMM_SYNC_VC1_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_sync_vc1_t; + +/* -------------------------------------------------------------------------- + * PRMM_SYNC_VC2 (read-only):Synchronous measurement result cell 2. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_SYNC_VC2_OFFSET \ + (0x1882U) +#define MC33775_PRMM_SYNC_VC2_RW_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_VC2_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_SYNC_VC2_WR_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_VC2_MW_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_VC2_RA_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_VC2_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_SYNC_VC2_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of cell 2 of the last synchronous cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_SYNC_VC2_VALUE_POS \ + (0U) +#define MC33775_PRMM_SYNC_VC2_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_sync_vc2_t; + +/* -------------------------------------------------------------------------- + * PRMM_SYNC_VC3 (read-only):Synchronous measurement result cell 3. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_SYNC_VC3_OFFSET \ + (0x1883U) +#define MC33775_PRMM_SYNC_VC3_RW_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_VC3_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_SYNC_VC3_WR_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_VC3_MW_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_VC3_RA_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_VC3_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_SYNC_VC3_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of cell 3 of the last synchronous cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_SYNC_VC3_VALUE_POS \ + (0U) +#define MC33775_PRMM_SYNC_VC3_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_sync_vc3_t; + +/* -------------------------------------------------------------------------- + * PRMM_SYNC_VC4 (read-only):Synchronous measurement result cell 4. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_SYNC_VC4_OFFSET \ + (0x1884U) +#define MC33775_PRMM_SYNC_VC4_RW_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_VC4_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_SYNC_VC4_WR_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_VC4_MW_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_VC4_RA_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_VC4_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_SYNC_VC4_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of cell 4 of the last synchronous cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_SYNC_VC4_VALUE_POS \ + (0U) +#define MC33775_PRMM_SYNC_VC4_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_sync_vc4_t; + +/* -------------------------------------------------------------------------- + * PRMM_SYNC_VC5 (read-only):Synchronous measurement result cell 5. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_SYNC_VC5_OFFSET \ + (0x1885U) +#define MC33775_PRMM_SYNC_VC5_RW_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_VC5_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_SYNC_VC5_WR_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_VC5_MW_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_VC5_RA_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_VC5_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_SYNC_VC5_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of cell 5 of the last synchronous cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_SYNC_VC5_VALUE_POS \ + (0U) +#define MC33775_PRMM_SYNC_VC5_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_sync_vc5_t; + +/* -------------------------------------------------------------------------- + * PRMM_SYNC_VC6 (read-only):Synchronous measurement result cell 6. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_SYNC_VC6_OFFSET \ + (0x1886U) +#define MC33775_PRMM_SYNC_VC6_RW_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_VC6_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_SYNC_VC6_WR_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_VC6_MW_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_VC6_RA_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_VC6_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_SYNC_VC6_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of cell 6 of the last synchronous cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_SYNC_VC6_VALUE_POS \ + (0U) +#define MC33775_PRMM_SYNC_VC6_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_sync_vc6_t; + +/* -------------------------------------------------------------------------- + * PRMM_SYNC_VC7 (read-only):Synchronous measurement result cell 7. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_SYNC_VC7_OFFSET \ + (0x1887U) +#define MC33775_PRMM_SYNC_VC7_RW_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_VC7_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_SYNC_VC7_WR_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_VC7_MW_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_VC7_RA_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_VC7_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_SYNC_VC7_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of cell 7 of the last synchronous cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_SYNC_VC7_VALUE_POS \ + (0U) +#define MC33775_PRMM_SYNC_VC7_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_sync_vc7_t; + +/* -------------------------------------------------------------------------- + * PRMM_SYNC_VC8 (read-only):Synchronous measurement result cell 8. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_SYNC_VC8_OFFSET \ + (0x1888U) +#define MC33775_PRMM_SYNC_VC8_RW_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_VC8_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_SYNC_VC8_WR_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_VC8_MW_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_VC8_RA_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_VC8_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_SYNC_VC8_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of cell 8 of the last synchronous cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_SYNC_VC8_VALUE_POS \ + (0U) +#define MC33775_PRMM_SYNC_VC8_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_sync_vc8_t; + +/* -------------------------------------------------------------------------- + * PRMM_SYNC_VC9 (read-only):Synchronous measurement result cell 9. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_SYNC_VC9_OFFSET \ + (0x1889U) +#define MC33775_PRMM_SYNC_VC9_RW_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_VC9_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_SYNC_VC9_WR_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_VC9_MW_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_VC9_RA_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_VC9_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_SYNC_VC9_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of cell 9 of the last synchronous cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_SYNC_VC9_VALUE_POS \ + (0U) +#define MC33775_PRMM_SYNC_VC9_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_sync_vc9_t; + +/* -------------------------------------------------------------------------- + * PRMM_SYNC_VC10 (read-only):Synchronous measurement result cell 10. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_SYNC_VC10_OFFSET \ + (0x188AU) +#define MC33775_PRMM_SYNC_VC10_RW_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_VC10_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_SYNC_VC10_WR_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_VC10_MW_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_VC10_RA_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_VC10_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_SYNC_VC10_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of cell 10 of the last synchronous cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_SYNC_VC10_VALUE_POS \ + (0U) +#define MC33775_PRMM_SYNC_VC10_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_sync_vc10_t; + +/* -------------------------------------------------------------------------- + * PRMM_SYNC_VC11 (read-only):Synchronous measurement result cell 11. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_SYNC_VC11_OFFSET \ + (0x188BU) +#define MC33775_PRMM_SYNC_VC11_RW_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_VC11_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_SYNC_VC11_WR_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_VC11_MW_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_VC11_RA_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_VC11_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_SYNC_VC11_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of cell 11 of the last synchronous cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_SYNC_VC11_VALUE_POS \ + (0U) +#define MC33775_PRMM_SYNC_VC11_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_sync_vc11_t; + +/* -------------------------------------------------------------------------- + * PRMM_SYNC_VC12 (read-only):Synchronous measurement result cell 12. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_SYNC_VC12_OFFSET \ + (0x188CU) +#define MC33775_PRMM_SYNC_VC12_RW_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_VC12_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_SYNC_VC12_WR_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_VC12_MW_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_VC12_RA_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_VC12_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_SYNC_VC12_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of cell 12 of the last synchronous cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_SYNC_VC12_VALUE_POS \ + (0U) +#define MC33775_PRMM_SYNC_VC12_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_sync_vc12_t; + +/* -------------------------------------------------------------------------- + * PRMM_SYNC_VC13 (read-only):Synchronous measurement result cell 13. + * -------------------------------------------------------------------------- */ +#define MC33775_PRMM_SYNC_VC13_OFFSET \ + (0x188DU) +#define MC33775_PRMM_SYNC_VC13_RW_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_VC13_RD_MSK \ + (0xFFFFU) +#define MC33775_PRMM_SYNC_VC13_WR_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_VC13_MW_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_VC13_RA_MSK \ + (0x0U) +#define MC33775_PRMM_SYNC_VC13_POR_MSK \ + (0xffffU) +#define MC33775_PRMM_SYNC_VC13_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of cell 13 of the last synchronous cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_PRMM_SYNC_VC13_VALUE_POS \ + (0U) +#define MC33775_PRMM_SYNC_VC13_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_primary_measurement_registers_prmm_sync_vc13_t; + +/* -------------------------------------------------------------------------- + * SECM_CFG (read-write):General measurement control. + * -------------------------------------------------------------------------- */ +#define MC33775_SECM_CFG_OFFSET \ + (0x1C00U) +#define MC33775_SECM_CFG_RW_MSK \ + (0xFFFFU) +#define MC33775_SECM_CFG_RD_MSK \ + (0xFFFFU) +#define MC33775_SECM_CFG_WR_MSK \ + (0xFFFFU) +#define MC33775_SECM_CFG_MW_MSK \ + (0x0U) +#define MC33775_SECM_CFG_RA_MSK \ + (0x0U) +#define MC33775_SECM_CFG_POR_MSK \ + (0xffffU) +#define MC33775_SECM_CFG_POR_VAL \ + (0x0U) + +/* Field MEASEN: Enable the data acquisition. Setting this bit to zero initiates a result clear and invalidate action (this includes resetting all ready bits). The bit can only be set xxx us after it has been cleared. This bit is cleared when entering Sleep mode. Cyclic measurements are always executed, regardless of the value of this bit. Balancing is not stopped automatically (if in Active mode), as it would be permanently inhibited while measurement is active. If balancing shall be paused, please do so via the balancing control. */ +#define MC33775_SECM_CFG_MEASEN_POS \ + (0U) +#define MC33775_SECM_CFG_MEASEN_MSK \ + (0x1U) + +/* Enumerated value DISABLED: Data acquisition disabled */ +#define MC33775_SECM_CFG_MEASEN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Data acquisition enabled */ +#define MC33775_SECM_CFG_MEASEN_ENABLED_ENUM_VAL \ + (1U) + +/* Field BALPAUSECYCMODEN: Enable balancing autopause. This delays the start of measurements after entering Cyclic mode until the autopause counter has elapsed. This field has no effect in secondary measurement. */ +#define MC33775_SECM_CFG_BALPAUSECYCMODEN_POS \ + (1U) +#define MC33775_SECM_CFG_BALPAUSECYCMODEN_MSK \ + (0x2U) + +/* Enumerated value DISABLED: Autopause for balancing is disabled. */ +#define MC33775_SECM_CFG_BALPAUSECYCMODEN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Autopause for balancing is enabled. Measurements are started when the autopause counter is elapsed. */ +#define MC33775_SECM_CFG_BALPAUSECYCMODEN_ENABLED_ENUM_VAL \ + (1U) + +/* Field BALPAUSELEN: Pause of balancing before measurement cycle is executed. An on-going balancing pause operation is not influenced by a change of this value. 1 LSB = 10us. */ +#define MC33775_SECM_CFG_BALPAUSELEN_POS \ + (2U) +#define MC33775_SECM_CFG_BALPAUSELEN_MSK \ + (0xFFFCU) + +/* Enumerated value NO_PAUSE: No Pause. */ +#define MC33775_SECM_CFG_BALPAUSELEN_NO_PAUSE_ENUM_VAL \ + (0U) + +/* Enumerated value PAUSE_10u: Pause = 10 us */ +#define MC33775_SECM_CFG_BALPAUSELEN_PAUSE_10U_ENUM_VAL \ + (1U) + +/* Enumerated value MAX: Maximum pause = 163830 us = 163 ms */ +#define MC33775_SECM_CFG_BALPAUSELEN_MAX_ENUM_VAL \ + (16383U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t MEASEN : 1; + volatile uint16_t BALPAUSECYCMODEN : 1; + volatile uint16_t BALPAUSELEN : 14; + } B; +} mc33775_secondary_measurement_registers_secm_cfg_t; + +/* -------------------------------------------------------------------------- + * SECM_APP_CTRL (write-only):Application measurement control. + * -------------------------------------------------------------------------- */ +#define MC33775_SECM_APP_CTRL_OFFSET \ + (0x1C01U) +#define MC33775_SECM_APP_CTRL_RW_MSK \ + (0x0U) +#define MC33775_SECM_APP_CTRL_RD_MSK \ + (0x0U) +#define MC33775_SECM_APP_CTRL_WR_MSK \ + (0x83FFU) +#define MC33775_SECM_APP_CTRL_MW_MSK \ + (0x0U) +#define MC33775_SECM_APP_CTRL_RA_MSK \ + (0x0U) +#define MC33775_SECM_APP_CTRL_POR_MSK \ + (0xffffU) +#define MC33775_SECM_APP_CTRL_POR_VAL \ + (0x0U) + +/* Field CAPVC: Trigger the balancing autopause if set in combination with the PAUSEBAL bit. Needed to keep primary and secondary measurement synchron when used via the ALLM access. In primary: Capture the application measurement value of the cell terminal measurements. */ +#define MC33775_SECM_APP_CTRL_CAPVC_POS \ + (0U) +#define MC33775_SECM_APP_CTRL_CAPVC_MSK \ + (0x1U) + +/* Enumerated value NO_CAP: Measurements are not captured. */ +#define MC33775_SECM_APP_CTRL_CAPVC_NO_CAP_ENUM_VAL \ + (0U) + +/* Enumerated value CAP: Measurements are captured. */ +#define MC33775_SECM_APP_CTRL_CAPVC_CAP_ENUM_VAL \ + (1U) + +/* Field CAPVMODULE: Trigger the balancing autopause if set in combination with the PAUSEBAL bit. Needed to keep primary and secondary measurement synchron when used via the ALLM access. In primary: Capture the application measurement value of the module voltage measurement. */ +#define MC33775_SECM_APP_CTRL_CAPVMODULE_POS \ + (1U) +#define MC33775_SECM_APP_CTRL_CAPVMODULE_MSK \ + (0x2U) + +/* Enumerated value NO_CAP: Measurements are not captured. */ +#define MC33775_SECM_APP_CTRL_CAPVMODULE_NO_CAP_ENUM_VAL \ + (0U) + +/* Enumerated value CAP: Measurements are captured. */ +#define MC33775_SECM_APP_CTRL_CAPVMODULE_CAP_ENUM_VAL \ + (1U) + +/* Field CAPAIN0: Trigger the balancing autopause if set in combination with the PAUSEBAL bit. Needed to keep primary and secondary measurement synchron when used via the ALLM access. In primary: Capture the application measurement value of the aux0 terminal measurement. */ +#define MC33775_SECM_APP_CTRL_CAPAIN0_POS \ + (2U) +#define MC33775_SECM_APP_CTRL_CAPAIN0_MSK \ + (0x4U) + +/* Enumerated value NO_CAP: Measurements are not captured. */ +#define MC33775_SECM_APP_CTRL_CAPAIN0_NO_CAP_ENUM_VAL \ + (0U) + +/* Enumerated value CAP: Measurements are captured. */ +#define MC33775_SECM_APP_CTRL_CAPAIN0_CAP_ENUM_VAL \ + (1U) + +/* Field CAPAIN1: Trigger the balancing autopause if set in combination with the PAUSEBAL bit. Needed to keep primary and secondary measurement synchron when used via the ALLM access. In primary: Capture the application measurement value of the aux1 terminal measurement. */ +#define MC33775_SECM_APP_CTRL_CAPAIN1_POS \ + (3U) +#define MC33775_SECM_APP_CTRL_CAPAIN1_MSK \ + (0x8U) + +/* Enumerated value NO_CAP: Measurements are not captured. */ +#define MC33775_SECM_APP_CTRL_CAPAIN1_NO_CAP_ENUM_VAL \ + (0U) + +/* Enumerated value CAP: Measurements are captured. */ +#define MC33775_SECM_APP_CTRL_CAPAIN1_CAP_ENUM_VAL \ + (1U) + +/* Field CAPAIN2: Trigger the balancing autopause if set in combination with the PAUSEBAL bit. Needed to keep primary and secondary measurement synchron when used via the ALLM access. In primary: Capture the application measurement value of the aux2 terminal measurement. */ +#define MC33775_SECM_APP_CTRL_CAPAIN2_POS \ + (4U) +#define MC33775_SECM_APP_CTRL_CAPAIN2_MSK \ + (0x10U) + +/* Enumerated value NO_CAP: Measurements are not captured. */ +#define MC33775_SECM_APP_CTRL_CAPAIN2_NO_CAP_ENUM_VAL \ + (0U) + +/* Enumerated value CAP: Measurements are captured. */ +#define MC33775_SECM_APP_CTRL_CAPAIN2_CAP_ENUM_VAL \ + (1U) + +/* Field CAPAIN3: Trigger the balancing autopause if set in combination with the PAUSEBAL bit. Needed to keep primary and secondary measurement synchron when used via the ALLM access. In primary: Capture the application measurement value of the aux3 terminal measurement. */ +#define MC33775_SECM_APP_CTRL_CAPAIN3_POS \ + (5U) +#define MC33775_SECM_APP_CTRL_CAPAIN3_MSK \ + (0x20U) + +/* Enumerated value NO_CAP: Measurements are not captured. */ +#define MC33775_SECM_APP_CTRL_CAPAIN3_NO_CAP_ENUM_VAL \ + (0U) + +/* Enumerated value CAP: Measurements are captured. */ +#define MC33775_SECM_APP_CTRL_CAPAIN3_CAP_ENUM_VAL \ + (1U) + +/* Field CAPAIN4: Capture the application measurement value of the aux4 terminal measurement. The values are now readable via the app_result register. This bit is only available in the secondary measurement chain. */ +#define MC33775_SECM_APP_CTRL_CAPAIN4_POS \ + (6U) +#define MC33775_SECM_APP_CTRL_CAPAIN4_MSK \ + (0x40U) + +/* Enumerated value NO_CAP: Measurements are not captured. */ +#define MC33775_SECM_APP_CTRL_CAPAIN4_NO_CAP_ENUM_VAL \ + (0U) + +/* Enumerated value CAP: Measurements are captured. */ +#define MC33775_SECM_APP_CTRL_CAPAIN4_CAP_ENUM_VAL \ + (1U) + +/* Field CAPAIN5: Capture the application measurement value of the aux5 terminal measurement. The values are now readable via the app_result register. This bit is only available in the secondary measurement chain. */ +#define MC33775_SECM_APP_CTRL_CAPAIN5_POS \ + (7U) +#define MC33775_SECM_APP_CTRL_CAPAIN5_MSK \ + (0x80U) + +/* Enumerated value NO_CAP: Measurements are not captured. */ +#define MC33775_SECM_APP_CTRL_CAPAIN5_NO_CAP_ENUM_VAL \ + (0U) + +/* Enumerated value CAP: Measurements are captured. */ +#define MC33775_SECM_APP_CTRL_CAPAIN5_CAP_ENUM_VAL \ + (1U) + +/* Field CAPAIN6: Capture the application measurement value of the aux6 terminal measurement. The values are now readable via the app_result register. This bit is only available in the secondary measurement chain. */ +#define MC33775_SECM_APP_CTRL_CAPAIN6_POS \ + (8U) +#define MC33775_SECM_APP_CTRL_CAPAIN6_MSK \ + (0x100U) + +/* Enumerated value NO_CAP: Measurements are not captured. */ +#define MC33775_SECM_APP_CTRL_CAPAIN6_NO_CAP_ENUM_VAL \ + (0U) + +/* Enumerated value CAP: Measurements are captured. */ +#define MC33775_SECM_APP_CTRL_CAPAIN6_CAP_ENUM_VAL \ + (1U) + +/* Field CAPAIN7: Capture the application measurement value of the aux7 terminal measurement. The values are now readable via the app_result register. This bit is only available in the secondary measurement chain. */ +#define MC33775_SECM_APP_CTRL_CAPAIN7_POS \ + (9U) +#define MC33775_SECM_APP_CTRL_CAPAIN7_MSK \ + (0x200U) + +/* Enumerated value NO_CAP: Measurements are not captured. */ +#define MC33775_SECM_APP_CTRL_CAPAIN7_NO_CAP_ENUM_VAL \ + (0U) + +/* Enumerated value CAP: Measurements are captured. */ +#define MC33775_SECM_APP_CTRL_CAPAIN7_CAP_ENUM_VAL \ + (1U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_SECM_APP_CTRL_RESERVED0_POS \ + (10U) +#define MC33775_SECM_APP_CTRL_RESERVED0_MSK \ + (0x7C00U) + +/* Field PAUSEBAL: Pause the balancing during this capture cycle. If balancing was not paused before, the start of data capture is delayed until the autopause timer has elapsed. This field has no effect in secondary measurement. */ +#define MC33775_SECM_APP_CTRL_PAUSEBAL_POS \ + (15U) +#define MC33775_SECM_APP_CTRL_PAUSEBAL_MSK \ + (0x8000U) + +/* Enumerated value NO_PAUSE: Continue with balancing. */ +#define MC33775_SECM_APP_CTRL_PAUSEBAL_NO_PAUSE_ENUM_VAL \ + (0U) + +/* Enumerated value PAUSE: Pause the balancing during this capture cycle. */ +#define MC33775_SECM_APP_CTRL_PAUSEBAL_PAUSE_ENUM_VAL \ + (1U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t CAPVC : 1; + volatile uint16_t CAPVMODULE : 1; + volatile uint16_t CAPAIN0 : 1; + volatile uint16_t CAPAIN1 : 1; + volatile uint16_t CAPAIN2 : 1; + volatile uint16_t CAPAIN3 : 1; + volatile uint16_t CAPAIN4 : 1; + volatile uint16_t CAPAIN5 : 1; + volatile uint16_t CAPAIN6 : 1; + volatile uint16_t CAPAIN7 : 1; + volatile uint16_t reserved0 : 5; + volatile uint16_t PAUSEBAL : 1; + } B; +} mc33775_secondary_measurement_registers_secm_app_ctrl_t; + +/* -------------------------------------------------------------------------- + * SECM_PER_CTRL (read-write):Periodic measurement control. + * -------------------------------------------------------------------------- */ +#define MC33775_SECM_PER_CTRL_OFFSET \ + (0x1C02U) +#define MC33775_SECM_PER_CTRL_RW_MSK \ + (0x31FFU) +#define MC33775_SECM_PER_CTRL_RD_MSK \ + (0x31FFU) +#define MC33775_SECM_PER_CTRL_WR_MSK \ + (0x31FFU) +#define MC33775_SECM_PER_CTRL_MW_MSK \ + (0x0U) +#define MC33775_SECM_PER_CTRL_RA_MSK \ + (0x0U) +#define MC33775_SECM_PER_CTRL_POR_MSK \ + (0xffffU) +#define MC33775_SECM_PER_CTRL_POR_VAL \ + (0x10U) + +/* Field PERLEN: Number of measurements for one periodic measurement. The minimum is 16. Writing a value lower than 16 leads to a 16 in the register. */ +#define MC33775_SECM_PER_CTRL_PERLEN_POS \ + (0U) +#define MC33775_SECM_PER_CTRL_PERLEN_MSK \ + (0x1FFU) + +/* Enumerated value PER_16: minimum value = 16 measurements per period */ +#define MC33775_SECM_PER_CTRL_PERLEN_PER_16_ENUM_VAL \ + (16U) + +/* Enumerated value PER_17: 17 measurements per period */ +#define MC33775_SECM_PER_CTRL_PERLEN_PER_17_ENUM_VAL \ + (17U) + +/* Enumerated value PER_MAX: maximum value = 511 measurements per period */ +#define MC33775_SECM_PER_CTRL_PERLEN_PER_MAX_ENUM_VAL \ + (511U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_SECM_PER_CTRL_RESERVED0_POS \ + (9U) +#define MC33775_SECM_PER_CTRL_RESERVED0_MSK \ + (0xE00U) + +/* Field PERCTRL: Control the periodic result behavior. */ +#define MC33775_SECM_PER_CTRL_PERCTRL_POS \ + (12U) +#define MC33775_SECM_PER_CTRL_PERCTRL_MSK \ + (0x3000U) + +/* Enumerated value AUTO: Periodic results are automatically updated */ +#define MC33775_SECM_PER_CTRL_PERCTRL_AUTO_ENUM_VAL \ + (0U) + +/* Enumerated value RESERVED: reserved */ +#define MC33775_SECM_PER_CTRL_PERCTRL_RESERVED_ENUM_VAL \ + (1U) + +/* Enumerated value HOLD: Periodic results are held */ +#define MC33775_SECM_PER_CTRL_PERCTRL_HOLD_ENUM_VAL \ + (2U) + +/* Enumerated value ONCE: Periodic results are updated once with the last results. (each write updates the results). */ +#define MC33775_SECM_PER_CTRL_PERCTRL_ONCE_ENUM_VAL \ + (3U) + +/* Field reserved1: This read-only field is reserved and always has the value 0. */ +#define MC33775_SECM_PER_CTRL_RESERVED1_POS \ + (14U) +#define MC33775_SECM_PER_CTRL_RESERVED1_MSK \ + (0xC000U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t PERLEN : 9; + volatile uint16_t reserved0 : 3; + volatile uint16_t PERCTRL : 2; + volatile uint16_t reserved1 : 2; + } B; +} mc33775_secondary_measurement_registers_secm_per_ctrl_t; + +/* -------------------------------------------------------------------------- + * SECM_SYNC_CTRL (read-write):Synchronous measurement control. + * -------------------------------------------------------------------------- */ +#define MC33775_SECM_SYNC_CTRL_OFFSET \ + (0x1C03U) +#define MC33775_SECM_SYNC_CTRL_RW_MSK \ + (0x7C00U) +#define MC33775_SECM_SYNC_CTRL_RD_MSK \ + (0x7C00U) +#define MC33775_SECM_SYNC_CTRL_WR_MSK \ + (0xFC03U) +#define MC33775_SECM_SYNC_CTRL_MW_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_CTRL_RA_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_CTRL_POR_MSK \ + (0xffffU) +#define MC33775_SECM_SYNC_CTRL_POR_VAL \ + (0x7c00U) + +/* Field SYNCCYC: Start a synchronous measurement cycle. In this cycle the CT and CB voltages are measured and stored as matching pairs. If no VB channel is enabled or if set during a running synchronous measurement cycle or a running Fast VB cycle, the set is ignored. Read as zero. */ +#define MC33775_SECM_SYNC_CTRL_SYNCCYC_POS \ + (0U) +#define MC33775_SECM_SYNC_CTRL_SYNCCYC_MSK \ + (0x1U) + +/* Enumerated value NO_START: No new start a synchronous measurement cycle. */ +#define MC33775_SECM_SYNC_CTRL_SYNCCYC_NO_START_ENUM_VAL \ + (0U) + +/* Enumerated value STATUS: Read as zero. */ +#define MC33775_SECM_SYNC_CTRL_SYNCCYC_STATUS_ENUM_VAL \ + (0U) + +/* Enumerated value START: Start a synchronous measurement cycle. */ +#define MC33775_SECM_SYNC_CTRL_SYNCCYC_START_ENUM_VAL \ + (1U) + +/* Field FASTVB: Start a Fast VB measurement cycle. In this cycle the CB voltages are measured (with 24 chopped cycles each) and stored in the Sync result registers. If set together with SYNCCYC or during an active synchronous measurement cycle, this bit is ignored. Read as zero. */ +#define MC33775_SECM_SYNC_CTRL_FASTVB_POS \ + (1U) +#define MC33775_SECM_SYNC_CTRL_FASTVB_MSK \ + (0x2U) + +/* Enumerated value NO_FAST: No new start of a fast VB measurement cycle. */ +#define MC33775_SECM_SYNC_CTRL_FASTVB_NO_FAST_ENUM_VAL \ + (0U) + +/* Enumerated value STATUS: Read as zero. */ +#define MC33775_SECM_SYNC_CTRL_FASTVB_STATUS_ENUM_VAL \ + (0U) + +/* Enumerated value FAST: Start a new fast VB measurement cycle. */ +#define MC33775_SECM_SYNC_CTRL_FASTVB_FAST_ENUM_VAL \ + (1U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_SECM_SYNC_CTRL_RESERVED0_POS \ + (2U) +#define MC33775_SECM_SYNC_CTRL_RESERVED0_MSK \ + (0x3FCU) + +/* Field VBOLNUM: VB number for which the open load detection is enabled. 0 - 13 = channel for which the open load detection is enabled. 14 - 29 = reserved (no open load detection mechanism is enabled). 30 = the open load detection is enabled for the currently measured channel. */ +#define MC33775_SECM_SYNC_CTRL_VBOLNUM_POS \ + (10U) +#define MC33775_SECM_SYNC_CTRL_VBOLNUM_MSK \ + (0x7C00U) + +/* Enumerated value DISABLED: Open load detection is disabled */ +#define MC33775_SECM_SYNC_CTRL_VBOLNUM_DISABLED_ENUM_VAL \ + (31U) + +/* Field PAUSEBAL: Pause the balancing during this capture cycle. If balancing was not paused before, the start of data capture is delayed until the autopause timer has elapsed. If no capture cycle is started this bit is ignored. */ +#define MC33775_SECM_SYNC_CTRL_PAUSEBAL_POS \ + (15U) +#define MC33775_SECM_SYNC_CTRL_PAUSEBAL_MSK \ + (0x8000U) + +/* Enumerated value NO_PAUSE: Continue with balancing. */ +#define MC33775_SECM_SYNC_CTRL_PAUSEBAL_NO_PAUSE_ENUM_VAL \ + (0U) + +/* Enumerated value PAUSE: Pause the balancing during this capture cycle. */ +#define MC33775_SECM_SYNC_CTRL_PAUSEBAL_PAUSE_ENUM_VAL \ + (1U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t SYNCCYC : 1; + volatile uint16_t FASTVB : 1; + volatile uint16_t reserved0 : 8; + volatile uint16_t VBOLNUM : 5; + volatile uint16_t PAUSEBAL : 1; + } B; +} mc33775_secondary_measurement_registers_secm_sync_ctrl_t; + +/* -------------------------------------------------------------------------- + * SECM_VB_CFG (read-write):Balance voltage measurement enable. + * -------------------------------------------------------------------------- */ +#define MC33775_SECM_VB_CFG_OFFSET \ + (0x1C08U) +#define MC33775_SECM_VB_CFG_RW_MSK \ + (0x3FFFU) +#define MC33775_SECM_VB_CFG_RD_MSK \ + (0x3FFFU) +#define MC33775_SECM_VB_CFG_WR_MSK \ + (0x3FFFU) +#define MC33775_SECM_VB_CFG_MW_MSK \ + (0x0U) +#define MC33775_SECM_VB_CFG_RA_MSK \ + (0x0U) +#define MC33775_SECM_VB_CFG_POR_MSK \ + (0xffffU) +#define MC33775_SECM_VB_CFG_POR_VAL \ + (0x0U) + +/* Field VB0EN: Enable measurement of balance voltage 0. Changes to this bit during active measurement can lead to undefined results. */ +#define MC33775_SECM_VB_CFG_VB0EN_POS \ + (0U) +#define MC33775_SECM_VB_CFG_VB0EN_MSK \ + (0x1U) + +/* Enumerated value DISABLED: Measurement disabled */ +#define MC33775_SECM_VB_CFG_VB0EN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Measurement enabled */ +#define MC33775_SECM_VB_CFG_VB0EN_ENABLED_ENUM_VAL \ + (1U) + +/* Field VB1EN: Enable measurement of balance voltage 1. Changes to this bit during active measurement can lead to undefined results. */ +#define MC33775_SECM_VB_CFG_VB1EN_POS \ + (1U) +#define MC33775_SECM_VB_CFG_VB1EN_MSK \ + (0x2U) + +/* Enumerated value DISABLED: Measurement disabled */ +#define MC33775_SECM_VB_CFG_VB1EN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Measurement enabled */ +#define MC33775_SECM_VB_CFG_VB1EN_ENABLED_ENUM_VAL \ + (1U) + +/* Field VB2EN: Enable measurement of balance voltage 2. Changes to this bit during active measurement can lead to undefined results. */ +#define MC33775_SECM_VB_CFG_VB2EN_POS \ + (2U) +#define MC33775_SECM_VB_CFG_VB2EN_MSK \ + (0x4U) + +/* Enumerated value DISABLED: Measurement disabled */ +#define MC33775_SECM_VB_CFG_VB2EN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Measurement enabled */ +#define MC33775_SECM_VB_CFG_VB2EN_ENABLED_ENUM_VAL \ + (1U) + +/* Field VB3EN: Enable measurement of balance voltage 3. Changes to this bit during active measurement can lead to undefined results. */ +#define MC33775_SECM_VB_CFG_VB3EN_POS \ + (3U) +#define MC33775_SECM_VB_CFG_VB3EN_MSK \ + (0x8U) + +/* Enumerated value DISABLED: Measurement disabled */ +#define MC33775_SECM_VB_CFG_VB3EN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Measurement enabled */ +#define MC33775_SECM_VB_CFG_VB3EN_ENABLED_ENUM_VAL \ + (1U) + +/* Field VB4EN: Enable measurement of balance voltage 4. Changes to this bit during active measurement can lead to undefined results. */ +#define MC33775_SECM_VB_CFG_VB4EN_POS \ + (4U) +#define MC33775_SECM_VB_CFG_VB4EN_MSK \ + (0x10U) + +/* Enumerated value DISABLED: Measurement disabled */ +#define MC33775_SECM_VB_CFG_VB4EN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Measurement enabled */ +#define MC33775_SECM_VB_CFG_VB4EN_ENABLED_ENUM_VAL \ + (1U) + +/* Field VB5EN: Enable measurement of balance voltage 5. Changes to this bit during active measurement can lead to undefined results. */ +#define MC33775_SECM_VB_CFG_VB5EN_POS \ + (5U) +#define MC33775_SECM_VB_CFG_VB5EN_MSK \ + (0x20U) + +/* Enumerated value DISABLED: Measurement disabled */ +#define MC33775_SECM_VB_CFG_VB5EN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Measurement enabled */ +#define MC33775_SECM_VB_CFG_VB5EN_ENABLED_ENUM_VAL \ + (1U) + +/* Field VB6EN: Enable measurement of balance voltage 6. Changes to this bit during active measurement can lead to undefined results. */ +#define MC33775_SECM_VB_CFG_VB6EN_POS \ + (6U) +#define MC33775_SECM_VB_CFG_VB6EN_MSK \ + (0x40U) + +/* Enumerated value DISABLED: Measurement disabled */ +#define MC33775_SECM_VB_CFG_VB6EN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Measurement enabled */ +#define MC33775_SECM_VB_CFG_VB6EN_ENABLED_ENUM_VAL \ + (1U) + +/* Field VB7EN: Enable measurement of balance voltage 7. Changes to this bit during active measurement can lead to undefined results. */ +#define MC33775_SECM_VB_CFG_VB7EN_POS \ + (7U) +#define MC33775_SECM_VB_CFG_VB7EN_MSK \ + (0x80U) + +/* Enumerated value DISABLED: Measurement disabled */ +#define MC33775_SECM_VB_CFG_VB7EN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Measurement enabled */ +#define MC33775_SECM_VB_CFG_VB7EN_ENABLED_ENUM_VAL \ + (1U) + +/* Field VB8EN: Enable measurement of balance voltage 8. Changes to this bit during active measurement can lead to undefined results. */ +#define MC33775_SECM_VB_CFG_VB8EN_POS \ + (8U) +#define MC33775_SECM_VB_CFG_VB8EN_MSK \ + (0x100U) + +/* Enumerated value DISABLED: Measurement disabled */ +#define MC33775_SECM_VB_CFG_VB8EN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Measurement enabled */ +#define MC33775_SECM_VB_CFG_VB8EN_ENABLED_ENUM_VAL \ + (1U) + +/* Field VB9EN: Enable measurement of balance voltage 9. Changes to this bit during active measurement can lead to undefined results. */ +#define MC33775_SECM_VB_CFG_VB9EN_POS \ + (9U) +#define MC33775_SECM_VB_CFG_VB9EN_MSK \ + (0x200U) + +/* Enumerated value DISABLED: Measurement disabled */ +#define MC33775_SECM_VB_CFG_VB9EN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Measurement enabled */ +#define MC33775_SECM_VB_CFG_VB9EN_ENABLED_ENUM_VAL \ + (1U) + +/* Field VB10EN: Enable measurement of balance voltage 10. Changes to this bit during active measurement can lead to undefined results. */ +#define MC33775_SECM_VB_CFG_VB10EN_POS \ + (10U) +#define MC33775_SECM_VB_CFG_VB10EN_MSK \ + (0x400U) + +/* Enumerated value DISABLED: Measurement disabled */ +#define MC33775_SECM_VB_CFG_VB10EN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Measurement enabled */ +#define MC33775_SECM_VB_CFG_VB10EN_ENABLED_ENUM_VAL \ + (1U) + +/* Field VB11EN: Enable measurement of balance voltage 11. Changes to this bit during active measurement can lead to undefined results. */ +#define MC33775_SECM_VB_CFG_VB11EN_POS \ + (11U) +#define MC33775_SECM_VB_CFG_VB11EN_MSK \ + (0x800U) + +/* Enumerated value DISABLED: Measurement disabled */ +#define MC33775_SECM_VB_CFG_VB11EN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Measurement enabled */ +#define MC33775_SECM_VB_CFG_VB11EN_ENABLED_ENUM_VAL \ + (1U) + +/* Field VB12EN: Enable measurement of balance voltage 12. Changes to this bit during active measurement can lead to undefined results. */ +#define MC33775_SECM_VB_CFG_VB12EN_POS \ + (12U) +#define MC33775_SECM_VB_CFG_VB12EN_MSK \ + (0x1000U) + +/* Enumerated value DISABLED: Measurement disabled */ +#define MC33775_SECM_VB_CFG_VB12EN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Measurement enabled */ +#define MC33775_SECM_VB_CFG_VB12EN_ENABLED_ENUM_VAL \ + (1U) + +/* Field VB13EN: Enable measurement of balance voltage 13. Changes to this bit during active measurement can lead to undefined results. */ +#define MC33775_SECM_VB_CFG_VB13EN_POS \ + (13U) +#define MC33775_SECM_VB_CFG_VB13EN_MSK \ + (0x2000U) + +/* Enumerated value DISABLED: Measurement disabled */ +#define MC33775_SECM_VB_CFG_VB13EN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Measurement enabled */ +#define MC33775_SECM_VB_CFG_VB13EN_ENABLED_ENUM_VAL \ + (1U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_SECM_VB_CFG_RESERVED0_POS \ + (14U) +#define MC33775_SECM_VB_CFG_RESERVED0_MSK \ + (0xC000U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VB0EN : 1; + volatile uint16_t VB1EN : 1; + volatile uint16_t VB2EN : 1; + volatile uint16_t VB3EN : 1; + volatile uint16_t VB4EN : 1; + volatile uint16_t VB5EN : 1; + volatile uint16_t VB6EN : 1; + volatile uint16_t VB7EN : 1; + volatile uint16_t VB8EN : 1; + volatile uint16_t VB9EN : 1; + volatile uint16_t VB10EN : 1; + volatile uint16_t VB11EN : 1; + volatile uint16_t VB12EN : 1; + volatile uint16_t VB13EN : 1; + volatile uint16_t reserved0 : 2; + } B; +} mc33775_secondary_measurement_registers_secm_vb_cfg_t; + +/* -------------------------------------------------------------------------- + * SECM_AIN_CFG (read-write):Measurement enables for extra channel. + * -------------------------------------------------------------------------- */ +#define MC33775_SECM_AIN_CFG_OFFSET \ + (0x1C09U) +#define MC33775_SECM_AIN_CFG_RW_MSK \ + (0xFF8FU) +#define MC33775_SECM_AIN_CFG_RD_MSK \ + (0xFF8FU) +#define MC33775_SECM_AIN_CFG_WR_MSK \ + (0xFF8FU) +#define MC33775_SECM_AIN_CFG_MW_MSK \ + (0x0U) +#define MC33775_SECM_AIN_CFG_RA_MSK \ + (0x0U) +#define MC33775_SECM_AIN_CFG_POR_MSK \ + (0xffffU) +#define MC33775_SECM_AIN_CFG_POR_VAL \ + (0x80U) + +/* Field AIN4EN: Enable measurement of AIN4. Changes to this bit during active measurement can lead to undefined results. Note: TBC Switches the GPIO4/AIN4 to the analog measurement function. */ +#define MC33775_SECM_AIN_CFG_AIN4EN_POS \ + (0U) +#define MC33775_SECM_AIN_CFG_AIN4EN_MSK \ + (0x1U) + +/* Enumerated value DISABLED: Measurement disabled */ +#define MC33775_SECM_AIN_CFG_AIN4EN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Measurement enabled */ +#define MC33775_SECM_AIN_CFG_AIN4EN_ENABLED_ENUM_VAL \ + (1U) + +/* Field AIN5EN: Enable measurement of AIN5. Changes to this bit during active measurement can lead to undefined results. */ +#define MC33775_SECM_AIN_CFG_AIN5EN_POS \ + (1U) +#define MC33775_SECM_AIN_CFG_AIN5EN_MSK \ + (0x2U) + +/* Enumerated value DISABLED: Measurement disabled */ +#define MC33775_SECM_AIN_CFG_AIN5EN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Measurement enabled */ +#define MC33775_SECM_AIN_CFG_AIN5EN_ENABLED_ENUM_VAL \ + (1U) + +/* Field AIN6EN: Enable measurement of AIN6. Changes to this bit during active measurement can lead to undefined results. */ +#define MC33775_SECM_AIN_CFG_AIN6EN_POS \ + (2U) +#define MC33775_SECM_AIN_CFG_AIN6EN_MSK \ + (0x4U) + +/* Enumerated value DISABLED: Measurement disabled */ +#define MC33775_SECM_AIN_CFG_AIN6EN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Measurement enabled */ +#define MC33775_SECM_AIN_CFG_AIN6EN_ENABLED_ENUM_VAL \ + (1U) + +/* Field AIN7EN: Enable measurement of AIN7. Changes to this bit during active measurement can lead to undefined results. */ +#define MC33775_SECM_AIN_CFG_AIN7EN_POS \ + (3U) +#define MC33775_SECM_AIN_CFG_AIN7EN_MSK \ + (0x8U) + +/* Enumerated value DISABLED: Measurement disabled */ +#define MC33775_SECM_AIN_CFG_AIN7EN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Measurement enabled */ +#define MC33775_SECM_AIN_CFG_AIN7EN_ENABLED_ENUM_VAL \ + (1U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_SECM_AIN_CFG_RESERVED0_POS \ + (4U) +#define MC33775_SECM_AIN_CFG_RESERVED0_MSK \ + (0x70U) + +/* Field FLTAPPINV: Invalidate AINx application results in case of fault. */ +#define MC33775_SECM_AIN_CFG_FLTAPPINV_POS \ + (7U) +#define MC33775_SECM_AIN_CFG_FLTAPPINV_MSK \ + (0x80U) + +/* Enumerated value VAILD: AINx application results are not invalidated in case of a fault */ +#define MC33775_SECM_AIN_CFG_FLTAPPINV_VAILD_ENUM_VAL \ + (0U) + +/* Enumerated value INVALID: AINx application results are invalidated when a fault is detected. */ +#define MC33775_SECM_AIN_CFG_FLTAPPINV_INVALID_ENUM_VAL \ + (1U) + +/* Field RATIOMETRICAIN4: Reference selection for AIN4. Changes to these bits during active measurement can lead to undefined results. */ +#define MC33775_SECM_AIN_CFG_RATIOMETRICAIN4_POS \ + (8U) +#define MC33775_SECM_AIN_CFG_RATIOMETRICAIN4_MSK \ + (0x300U) + +/* Enumerated value SECVREF: Absolute (SECVREF) */ +#define MC33775_SECM_AIN_CFG_RATIOMETRICAIN4_SECVREF_ENUM_VAL \ + (0U) + +/* Enumerated value RESERVED: reserved */ +#define MC33775_SECM_AIN_CFG_RATIOMETRICAIN4_RESERVED_ENUM_VAL \ + (1U) + +/* Enumerated value VAUX: Ratiometric (VAUX) */ +#define MC33775_SECM_AIN_CFG_RATIOMETRICAIN4_VAUX_ENUM_VAL \ + (2U) + +/* Enumerated value VDDC: Ratiometric (VDDC) */ +#define MC33775_SECM_AIN_CFG_RATIOMETRICAIN4_VDDC_ENUM_VAL \ + (3U) + +/* Field RATIOMETRICAIN5: Reference selection for AIN5. Changes to these bits during active measurement can lead to undefined results. */ +#define MC33775_SECM_AIN_CFG_RATIOMETRICAIN5_POS \ + (10U) +#define MC33775_SECM_AIN_CFG_RATIOMETRICAIN5_MSK \ + (0xC00U) + +/* Enumerated value SECVREF: Absolute (SECVREF) */ +#define MC33775_SECM_AIN_CFG_RATIOMETRICAIN5_SECVREF_ENUM_VAL \ + (0U) + +/* Enumerated value RESERVED: reserved */ +#define MC33775_SECM_AIN_CFG_RATIOMETRICAIN5_RESERVED_ENUM_VAL \ + (1U) + +/* Enumerated value VAUX: Ratiometric (VAUX) */ +#define MC33775_SECM_AIN_CFG_RATIOMETRICAIN5_VAUX_ENUM_VAL \ + (2U) + +/* Enumerated value VDDC: Ratiometric (VDDC) */ +#define MC33775_SECM_AIN_CFG_RATIOMETRICAIN5_VDDC_ENUM_VAL \ + (3U) + +/* Field RATIOMETRICAIN6: Reference selection for AIN6. Changes to these bits during active measurement can lead to undefined results. */ +#define MC33775_SECM_AIN_CFG_RATIOMETRICAIN6_POS \ + (12U) +#define MC33775_SECM_AIN_CFG_RATIOMETRICAIN6_MSK \ + (0x3000U) + +/* Enumerated value SECVREF: Absolute (SECVREF) */ +#define MC33775_SECM_AIN_CFG_RATIOMETRICAIN6_SECVREF_ENUM_VAL \ + (0U) + +/* Enumerated value RESERVED: reserved */ +#define MC33775_SECM_AIN_CFG_RATIOMETRICAIN6_RESERVED_ENUM_VAL \ + (1U) + +/* Enumerated value VAUX: Ratiometric (VAUX) */ +#define MC33775_SECM_AIN_CFG_RATIOMETRICAIN6_VAUX_ENUM_VAL \ + (2U) + +/* Enumerated value VDDC: Ratiometric (VDDC) */ +#define MC33775_SECM_AIN_CFG_RATIOMETRICAIN6_VDDC_ENUM_VAL \ + (3U) + +/* Field RATIOMETRICAIN7: Reference selection for AIN7. Changes to these bits during active measurement can lead to undefined results. */ +#define MC33775_SECM_AIN_CFG_RATIOMETRICAIN7_POS \ + (14U) +#define MC33775_SECM_AIN_CFG_RATIOMETRICAIN7_MSK \ + (0xC000U) + +/* Enumerated value SECVREF: Absolute (SECVREF) */ +#define MC33775_SECM_AIN_CFG_RATIOMETRICAIN7_SECVREF_ENUM_VAL \ + (0U) + +/* Enumerated value RESERVED: reserved */ +#define MC33775_SECM_AIN_CFG_RATIOMETRICAIN7_RESERVED_ENUM_VAL \ + (1U) + +/* Enumerated value VAUX: Ratiometric (VAUX) */ +#define MC33775_SECM_AIN_CFG_RATIOMETRICAIN7_VAUX_ENUM_VAL \ + (2U) + +/* Enumerated value VDDC: Ratiometric (VDDC) */ +#define MC33775_SECM_AIN_CFG_RATIOMETRICAIN7_VDDC_ENUM_VAL \ + (3U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t AIN4EN : 1; + volatile uint16_t AIN5EN : 1; + volatile uint16_t AIN6EN : 1; + volatile uint16_t AIN7EN : 1; + volatile uint16_t reserved0 : 3; + volatile uint16_t FLTAPPINV : 1; + volatile uint16_t RATIOMETRICAIN4 : 2; + volatile uint16_t RATIOMETRICAIN5 : 2; + volatile uint16_t RATIOMETRICAIN6 : 2; + volatile uint16_t RATIOMETRICAIN7 : 2; + } B; +} mc33775_secondary_measurement_registers_secm_ain_cfg_t; + +/* -------------------------------------------------------------------------- + * SECM_AIN_OL_CFG (read-write):AINx open_load detection enable. + * -------------------------------------------------------------------------- */ +#define MC33775_SECM_AIN_OL_CFG_OFFSET \ + (0x1C0AU) +#define MC33775_SECM_AIN_OL_CFG_RW_MSK \ + (0xFU) +#define MC33775_SECM_AIN_OL_CFG_RD_MSK \ + (0xFU) +#define MC33775_SECM_AIN_OL_CFG_WR_MSK \ + (0xFU) +#define MC33775_SECM_AIN_OL_CFG_MW_MSK \ + (0x0U) +#define MC33775_SECM_AIN_OL_CFG_RA_MSK \ + (0x0U) +#define MC33775_SECM_AIN_OL_CFG_POR_MSK \ + (0xffffU) +#define MC33775_SECM_AIN_OL_CFG_POR_VAL \ + (0x0U) + +/* Field AIN4EN: Open load detection circuit for AIN4 */ +#define MC33775_SECM_AIN_OL_CFG_AIN4EN_POS \ + (0U) +#define MC33775_SECM_AIN_OL_CFG_AIN4EN_MSK \ + (0x1U) + +/* Enumerated value DISABLED: Disable the open load detection circuit. */ +#define MC33775_SECM_AIN_OL_CFG_AIN4EN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Enable the open load detection circuit. */ +#define MC33775_SECM_AIN_OL_CFG_AIN4EN_ENABLED_ENUM_VAL \ + (1U) + +/* Field AIN5EN: Open load detection circuit for AIN5 */ +#define MC33775_SECM_AIN_OL_CFG_AIN5EN_POS \ + (1U) +#define MC33775_SECM_AIN_OL_CFG_AIN5EN_MSK \ + (0x2U) + +/* Enumerated value DISABLED: Disable the open load detection circuit. */ +#define MC33775_SECM_AIN_OL_CFG_AIN5EN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Enable the open load detection circuit. */ +#define MC33775_SECM_AIN_OL_CFG_AIN5EN_ENABLED_ENUM_VAL \ + (1U) + +/* Field AIN6EN: Open load detection circuit for AIN6 */ +#define MC33775_SECM_AIN_OL_CFG_AIN6EN_POS \ + (2U) +#define MC33775_SECM_AIN_OL_CFG_AIN6EN_MSK \ + (0x4U) + +/* Enumerated value DISABLED: Disable the open load detection circuit. */ +#define MC33775_SECM_AIN_OL_CFG_AIN6EN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Enable the open load detection circuit. */ +#define MC33775_SECM_AIN_OL_CFG_AIN6EN_ENABLED_ENUM_VAL \ + (1U) + +/* Field AIN7EN: Open load detection circuit for AIN7 */ +#define MC33775_SECM_AIN_OL_CFG_AIN7EN_POS \ + (3U) +#define MC33775_SECM_AIN_OL_CFG_AIN7EN_MSK \ + (0x8U) + +/* Enumerated value DISABLED: Disable the open load detection circuit. */ +#define MC33775_SECM_AIN_OL_CFG_AIN7EN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Enable the open load detection circuit. */ +#define MC33775_SECM_AIN_OL_CFG_AIN7EN_ENABLED_ENUM_VAL \ + (1U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_SECM_AIN_OL_CFG_RESERVED0_POS \ + (4U) +#define MC33775_SECM_AIN_OL_CFG_RESERVED0_MSK \ + (0xFFF0U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t AIN4EN : 1; + volatile uint16_t AIN5EN : 1; + volatile uint16_t AIN6EN : 1; + volatile uint16_t AIN7EN : 1; + volatile uint16_t reserved0 : 12; + } B; +} mc33775_secondary_measurement_registers_secm_ain_ol_cfg_t; + +/* -------------------------------------------------------------------------- + * SECM_VDIV_CFG (read-write):Voltage divider enable. + * -------------------------------------------------------------------------- */ +#define MC33775_SECM_VDIV_CFG_OFFSET \ + (0x1C0BU) +#define MC33775_SECM_VDIV_CFG_RW_MSK \ + (0x3U) +#define MC33775_SECM_VDIV_CFG_RD_MSK \ + (0x3U) +#define MC33775_SECM_VDIV_CFG_WR_MSK \ + (0x3U) +#define MC33775_SECM_VDIV_CFG_MW_MSK \ + (0x0U) +#define MC33775_SECM_VDIV_CFG_RA_MSK \ + (0x0U) +#define MC33775_SECM_VDIV_CFG_POR_MSK \ + (0xffffU) +#define MC33775_SECM_VDIV_CFG_POR_VAL \ + (0x3U) + +/* Field VAUXEN: Enable the voltage divider for secondary VAUX measurement. */ +#define MC33775_SECM_VDIV_CFG_VAUXEN_POS \ + (0U) +#define MC33775_SECM_VDIV_CFG_VAUXEN_MSK \ + (0x1U) + +/* Enumerated value DISABLED: Voltage divider for VAUX is disabled. */ +#define MC33775_SECM_VDIV_CFG_VAUXEN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Voltage divider for VAUX is enabled. */ +#define MC33775_SECM_VDIV_CFG_VAUXEN_ENABLED_ENUM_VAL \ + (1U) + +/* Field VDDCEN: Enable the voltage divider for secondary VDDC measurement. */ +#define MC33775_SECM_VDIV_CFG_VDDCEN_POS \ + (1U) +#define MC33775_SECM_VDIV_CFG_VDDCEN_MSK \ + (0x2U) + +/* Enumerated value DISABLED: Voltage divider for VDDC is disabled. */ +#define MC33775_SECM_VDIV_CFG_VDDCEN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Voltage divider for VDDC is enabled. */ +#define MC33775_SECM_VDIV_CFG_VDDCEN_ENABLED_ENUM_VAL \ + (1U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_SECM_VDIV_CFG_RESERVED0_POS \ + (2U) +#define MC33775_SECM_VDIV_CFG_RESERVED0_MSK \ + (0xFFFCU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VAUXEN : 1; + volatile uint16_t VDDCEN : 1; + volatile uint16_t reserved0 : 14; + } B; +} mc33775_secondary_measurement_registers_secm_vdiv_cfg_t; + +/* -------------------------------------------------------------------------- + * SECM_CAL_CRC (read-write):CRC over calibration data. + * -------------------------------------------------------------------------- */ +#define MC33775_SECM_CAL_CRC_OFFSET \ + (0x1C1EU) +#define MC33775_SECM_CAL_CRC_RW_MSK \ + (0xFFFFU) +#define MC33775_SECM_CAL_CRC_RD_MSK \ + (0xFFFFU) +#define MC33775_SECM_CAL_CRC_WR_MSK \ + (0xFFFFU) +#define MC33775_SECM_CAL_CRC_MW_MSK \ + (0x0U) +#define MC33775_SECM_CAL_CRC_RA_MSK \ + (0x0U) +#define MC33775_SECM_CAL_CRC_POR_MSK \ + (0xffffU) +#define MC33775_SECM_CAL_CRC_POR_VAL \ + (0x0U) + +/* Field CRC: CRC over calibration data. The CRC calculation runs automatically every time when a synchronous measurement cycle is started and when the calibration data is read from the NVM. */ +#define MC33775_SECM_CAL_CRC_CRC_POS \ + (0U) +#define MC33775_SECM_CAL_CRC_CRC_MSK \ + (0xFFFFU) + +/* Enumerated value CALIBCRC: The expected value of the calibration CRC. */ +#define MC33775_SECM_CAL_CRC_CRC_CALIBCRC_ENUM_VAL \ + (48879U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t CRC : 16; + } B; +} mc33775_secondary_measurement_registers_secm_cal_crc_t; + +/* -------------------------------------------------------------------------- + * SECM_CFG_CRC (read-only):CRC over configuration values. + * -------------------------------------------------------------------------- */ +#define MC33775_SECM_CFG_CRC_OFFSET \ + (0x1C1FU) +#define MC33775_SECM_CFG_CRC_RW_MSK \ + (0x0U) +#define MC33775_SECM_CFG_CRC_RD_MSK \ + (0xFFFFU) +#define MC33775_SECM_CFG_CRC_WR_MSK \ + (0x0U) +#define MC33775_SECM_CFG_CRC_MW_MSK \ + (0x0U) +#define MC33775_SECM_CFG_CRC_RA_MSK \ + (0x0U) +#define MC33775_SECM_CFG_CRC_POR_MSK \ + (0xffffU) +#define MC33775_SECM_CFG_CRC_POR_VAL \ + (0x0U) + +/* Field CRC: This CRC value is recalculated with any write to a covered register. The updated CRC value is available latest 100us after the last write. The CRC value is application specific and must be re-calculated by the MCU. The used polynomial is: 0xD175 (+1) = X^16 + X^15 + X^13 + X^9 + X^7 + X^6 + X^5 + X^3 + X^1 + 1. +Following registers are included: SECM_CFG, SECM_PER_CTRL, SECM_VB_CFG, SECM_AIN_CFG, SECM_VDIV_CFG. */ +#define MC33775_SECM_CFG_CRC_CRC_POS \ + (0U) +#define MC33775_SECM_CFG_CRC_CRC_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t CRC : 16; + } B; +} mc33775_secondary_measurement_registers_secm_cfg_crc_t; + +/* -------------------------------------------------------------------------- + * SECM_MEAS_STAT (read-only):Measurement status. + * -------------------------------------------------------------------------- */ +#define MC33775_SECM_MEAS_STAT_OFFSET \ + (0x1C3EU) +#define MC33775_SECM_MEAS_STAT_RW_MSK \ + (0x0U) +#define MC33775_SECM_MEAS_STAT_RD_MSK \ + (0xF30FU) +#define MC33775_SECM_MEAS_STAT_WR_MSK \ + (0x0U) +#define MC33775_SECM_MEAS_STAT_MW_MSK \ + (0x0U) +#define MC33775_SECM_MEAS_STAT_RA_MSK \ + (0x0U) +#define MC33775_SECM_MEAS_STAT_POR_MSK \ + (0xffffU) +#define MC33775_SECM_MEAS_STAT_POR_VAL \ + (0x0U) + +/* Field APPRDYAIN4: A new AIN4 application result can be requested / captured. */ +#define MC33775_SECM_MEAS_STAT_APPRDYAIN4_POS \ + (0U) +#define MC33775_SECM_MEAS_STAT_APPRDYAIN4_MSK \ + (0x1U) + +/* Enumerated value NO_DATA: No data available (<16 sample) */ +#define MC33775_SECM_MEAS_STAT_APPRDYAIN4_NO_DATA_ENUM_VAL \ + (0U) + +/* Enumerated value DATA: Data can be captured (>=16 samples are captured). */ +#define MC33775_SECM_MEAS_STAT_APPRDYAIN4_DATA_ENUM_VAL \ + (1U) + +/* Field APPRDYAIN5: A new AIN5 application result can be requested / captured. */ +#define MC33775_SECM_MEAS_STAT_APPRDYAIN5_POS \ + (1U) +#define MC33775_SECM_MEAS_STAT_APPRDYAIN5_MSK \ + (0x2U) + +/* Enumerated value NO_DATA: No data available (<16 sample) */ +#define MC33775_SECM_MEAS_STAT_APPRDYAIN5_NO_DATA_ENUM_VAL \ + (0U) + +/* Enumerated value DATA: Data can be captured (>=16 samples are captured). */ +#define MC33775_SECM_MEAS_STAT_APPRDYAIN5_DATA_ENUM_VAL \ + (1U) + +/* Field APPRDYAIN6: A new AIN6 application result can be requested / captured. */ +#define MC33775_SECM_MEAS_STAT_APPRDYAIN6_POS \ + (2U) +#define MC33775_SECM_MEAS_STAT_APPRDYAIN6_MSK \ + (0x4U) + +/* Enumerated value NO_DATA: No data available (<16 sample) */ +#define MC33775_SECM_MEAS_STAT_APPRDYAIN6_NO_DATA_ENUM_VAL \ + (0U) + +/* Enumerated value DATA: Data can be captured (>=16 samples are captured). */ +#define MC33775_SECM_MEAS_STAT_APPRDYAIN6_DATA_ENUM_VAL \ + (1U) + +/* Field APPRDYAIN7: A new AIN7 application result can be requested / captured. */ +#define MC33775_SECM_MEAS_STAT_APPRDYAIN7_POS \ + (3U) +#define MC33775_SECM_MEAS_STAT_APPRDYAIN7_MSK \ + (0x8U) + +/* Enumerated value NO_DATA: No data available (<16 sample) */ +#define MC33775_SECM_MEAS_STAT_APPRDYAIN7_NO_DATA_ENUM_VAL \ + (0U) + +/* Enumerated value DATA: Data can be captured (>=16 samples are captured). */ +#define MC33775_SECM_MEAS_STAT_APPRDYAIN7_DATA_ENUM_VAL \ + (1U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_SECM_MEAS_STAT_RESERVED0_POS \ + (4U) +#define MC33775_SECM_MEAS_STAT_RESERVED0_MSK \ + (0xF0U) + +/* Field PERRDY: New periodic result data has been created (depending on the periodic update mode, they might need to be requested) , the bit is cleared by a read into the periodic result range. */ +#define MC33775_SECM_MEAS_STAT_PERRDY_POS \ + (8U) +#define MC33775_SECM_MEAS_STAT_PERRDY_MSK \ + (0x100U) + +/* Enumerated value NO_DATA: No data available */ +#define MC33775_SECM_MEAS_STAT_PERRDY_NO_DATA_ENUM_VAL \ + (0U) + +/* Enumerated value DATA: Sample data available. */ +#define MC33775_SECM_MEAS_STAT_PERRDY_DATA_ENUM_VAL \ + (1U) + +/* Field SYNCRDY: Synchronous measurement data is ready for readout, the bit is cleared by a read into the safety result range. */ +#define MC33775_SECM_MEAS_STAT_SYNCRDY_POS \ + (9U) +#define MC33775_SECM_MEAS_STAT_SYNCRDY_MSK \ + (0x200U) + +/* Enumerated value NO_DATA: No data available */ +#define MC33775_SECM_MEAS_STAT_SYNCRDY_NO_DATA_ENUM_VAL \ + (0U) + +/* Enumerated value DATA: Sample data available. */ +#define MC33775_SECM_MEAS_STAT_SYNCRDY_DATA_ENUM_VAL \ + (1U) + +/* Field reserved1: This read-only field is reserved and always has the value 0. */ +#define MC33775_SECM_MEAS_STAT_RESERVED1_POS \ + (10U) +#define MC33775_SECM_MEAS_STAT_RESERVED1_MSK \ + (0xC00U) + +/* Field SUPPLYFLT: Internal/external supply fault status */ +#define MC33775_SECM_MEAS_STAT_SUPPLYFLT_POS \ + (12U) +#define MC33775_SECM_MEAS_STAT_SUPPLYFLT_MSK \ + (0x1000U) + +/* Enumerated value NO_FLT: No supply error detected */ +#define MC33775_SECM_MEAS_STAT_SUPPLYFLT_NO_FLT_ENUM_VAL \ + (0U) + +/* Enumerated value FAULT: Supply error detected */ +#define MC33775_SECM_MEAS_STAT_SUPPLYFLT_FAULT_ENUM_VAL \ + (1U) + +/* Field ANAFLT: Analog fault status */ +#define MC33775_SECM_MEAS_STAT_ANAFLT_POS \ + (13U) +#define MC33775_SECM_MEAS_STAT_ANAFLT_MSK \ + (0x2000U) + +/* Enumerated value NO_FLT: No analog fault detected */ +#define MC33775_SECM_MEAS_STAT_ANAFLT_NO_FLT_ENUM_VAL \ + (0U) + +/* Enumerated value FAULT: Analog fault detected */ +#define MC33775_SECM_MEAS_STAT_ANAFLT_FAULT_ENUM_VAL \ + (1U) + +/* Field COMFLT: Communication fault status */ +#define MC33775_SECM_MEAS_STAT_COMFLT_POS \ + (14U) +#define MC33775_SECM_MEAS_STAT_COMFLT_MSK \ + (0x4000U) + +/* Enumerated value NO_FLT: No communication fault detected */ +#define MC33775_SECM_MEAS_STAT_COMFLT_NO_FLT_ENUM_VAL \ + (0U) + +/* Enumerated value FAULT: Communication fault detected. */ +#define MC33775_SECM_MEAS_STAT_COMFLT_FAULT_ENUM_VAL \ + (1U) + +/* Field MEASFLT: Measurement fault status */ +#define MC33775_SECM_MEAS_STAT_MEASFLT_POS \ + (15U) +#define MC33775_SECM_MEAS_STAT_MEASFLT_MSK \ + (0x8000U) + +/* Enumerated value NO_FLT: No measurement fault detected */ +#define MC33775_SECM_MEAS_STAT_MEASFLT_NO_FLT_ENUM_VAL \ + (0U) + +/* Enumerated value FAULT: Measurement fault detected */ +#define MC33775_SECM_MEAS_STAT_MEASFLT_FAULT_ENUM_VAL \ + (1U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t APPRDYAIN4 : 1; + volatile uint16_t APPRDYAIN5 : 1; + volatile uint16_t APPRDYAIN6 : 1; + volatile uint16_t APPRDYAIN7 : 1; + volatile uint16_t reserved0 : 4; + volatile uint16_t PERRDY : 1; + volatile uint16_t SYNCRDY : 1; + volatile uint16_t reserved1 : 2; + volatile uint16_t SUPPLYFLT : 1; + volatile uint16_t ANAFLT : 1; + volatile uint16_t COMFLT : 1; + volatile uint16_t MEASFLT : 1; + } B; +} mc33775_secondary_measurement_registers_secm_meas_stat_t; + +/* -------------------------------------------------------------------------- + * SECM_APP_AIN4 (read-only):Application measurement result AIN4. + * -------------------------------------------------------------------------- */ +#define MC33775_SECM_APP_AIN4_OFFSET \ + (0x1C4FU) +#define MC33775_SECM_APP_AIN4_RW_MSK \ + (0x0U) +#define MC33775_SECM_APP_AIN4_RD_MSK \ + (0xFFFFU) +#define MC33775_SECM_APP_AIN4_WR_MSK \ + (0x0U) +#define MC33775_SECM_APP_AIN4_MW_MSK \ + (0x0U) +#define MC33775_SECM_APP_AIN4_RA_MSK \ + (0x0U) +#define MC33775_SECM_APP_AIN4_POR_MSK \ + (0xffffU) +#define MC33775_SECM_APP_AIN4_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of AIN4 at the last application capture as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_SECM_APP_AIN4_VALUE_POS \ + (0U) +#define MC33775_SECM_APP_AIN4_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_secondary_measurement_registers_secm_app_ain4_t; + +/* -------------------------------------------------------------------------- + * SECM_APP_AIN5 (read-only):Application measurement result AIN5. + * -------------------------------------------------------------------------- */ +#define MC33775_SECM_APP_AIN5_OFFSET \ + (0x1C50U) +#define MC33775_SECM_APP_AIN5_RW_MSK \ + (0x0U) +#define MC33775_SECM_APP_AIN5_RD_MSK \ + (0xFFFFU) +#define MC33775_SECM_APP_AIN5_WR_MSK \ + (0x0U) +#define MC33775_SECM_APP_AIN5_MW_MSK \ + (0x0U) +#define MC33775_SECM_APP_AIN5_RA_MSK \ + (0x0U) +#define MC33775_SECM_APP_AIN5_POR_MSK \ + (0xffffU) +#define MC33775_SECM_APP_AIN5_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of AIN5 at the last application capture as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_SECM_APP_AIN5_VALUE_POS \ + (0U) +#define MC33775_SECM_APP_AIN5_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_secondary_measurement_registers_secm_app_ain5_t; + +/* -------------------------------------------------------------------------- + * SECM_APP_AIN6 (read-only):Application measurement result AIN6. + * -------------------------------------------------------------------------- */ +#define MC33775_SECM_APP_AIN6_OFFSET \ + (0x1C51U) +#define MC33775_SECM_APP_AIN6_RW_MSK \ + (0x0U) +#define MC33775_SECM_APP_AIN6_RD_MSK \ + (0xFFFFU) +#define MC33775_SECM_APP_AIN6_WR_MSK \ + (0x0U) +#define MC33775_SECM_APP_AIN6_MW_MSK \ + (0x0U) +#define MC33775_SECM_APP_AIN6_RA_MSK \ + (0x0U) +#define MC33775_SECM_APP_AIN6_POR_MSK \ + (0xffffU) +#define MC33775_SECM_APP_AIN6_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of AIN6 at the last application capture as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_SECM_APP_AIN6_VALUE_POS \ + (0U) +#define MC33775_SECM_APP_AIN6_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_secondary_measurement_registers_secm_app_ain6_t; + +/* -------------------------------------------------------------------------- + * SECM_APP_AIN7 (read-only):Application measurement result AIN7. + * -------------------------------------------------------------------------- */ +#define MC33775_SECM_APP_AIN7_OFFSET \ + (0x1C52U) +#define MC33775_SECM_APP_AIN7_RW_MSK \ + (0x0U) +#define MC33775_SECM_APP_AIN7_RD_MSK \ + (0xFFFFU) +#define MC33775_SECM_APP_AIN7_WR_MSK \ + (0x0U) +#define MC33775_SECM_APP_AIN7_MW_MSK \ + (0x0U) +#define MC33775_SECM_APP_AIN7_RA_MSK \ + (0x0U) +#define MC33775_SECM_APP_AIN7_POR_MSK \ + (0xffffU) +#define MC33775_SECM_APP_AIN7_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of AIN7 at the last application capture as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_SECM_APP_AIN7_VALUE_POS \ + (0U) +#define MC33775_SECM_APP_AIN7_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_secondary_measurement_registers_secm_app_ain7_t; + +/* -------------------------------------------------------------------------- + * SECM_PER_NUM (read-only):Measurement period number of the secondary periodic results. + * -------------------------------------------------------------------------- */ +#define MC33775_SECM_PER_NUM_OFFSET \ + (0x1C5FU) +#define MC33775_SECM_PER_NUM_RW_MSK \ + (0x0U) +#define MC33775_SECM_PER_NUM_RD_MSK \ + (0xFFFFU) +#define MC33775_SECM_PER_NUM_WR_MSK \ + (0x0U) +#define MC33775_SECM_PER_NUM_MW_MSK \ + (0x0U) +#define MC33775_SECM_PER_NUM_RA_MSK \ + (0x0U) +#define MC33775_SECM_PER_NUM_POR_MSK \ + (0xffffU) +#define MC33775_SECM_PER_NUM_POR_VAL \ + (0x0U) + +/* Field NUM: Number of the periodic cycle in which the secondary periodic results have been created. The value is incremented for each periodic cycle executed. The counting wraps at its limit. */ +#define MC33775_SECM_PER_NUM_NUM_POS \ + (0U) +#define MC33775_SECM_PER_NUM_NUM_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t NUM : 16; + } B; +} mc33775_secondary_measurement_registers_secm_per_num_t; + +/* -------------------------------------------------------------------------- + * SECM_PER_AIN4 (read-only):Periodic measurement result AIN4. + * -------------------------------------------------------------------------- */ +#define MC33775_SECM_PER_AIN4_OFFSET \ + (0x1C6FU) +#define MC33775_SECM_PER_AIN4_RW_MSK \ + (0x0U) +#define MC33775_SECM_PER_AIN4_RD_MSK \ + (0xFFFFU) +#define MC33775_SECM_PER_AIN4_WR_MSK \ + (0x0U) +#define MC33775_SECM_PER_AIN4_MW_MSK \ + (0x0U) +#define MC33775_SECM_PER_AIN4_RA_MSK \ + (0x0U) +#define MC33775_SECM_PER_AIN4_POR_MSK \ + (0xffffU) +#define MC33775_SECM_PER_AIN4_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of AIN4 of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_SECM_PER_AIN4_VALUE_POS \ + (0U) +#define MC33775_SECM_PER_AIN4_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_secondary_measurement_registers_secm_per_ain4_t; + +/* -------------------------------------------------------------------------- + * SECM_PER_AIN5 (read-only):Periodic measurement result AIN5. + * -------------------------------------------------------------------------- */ +#define MC33775_SECM_PER_AIN5_OFFSET \ + (0x1C70U) +#define MC33775_SECM_PER_AIN5_RW_MSK \ + (0x0U) +#define MC33775_SECM_PER_AIN5_RD_MSK \ + (0xFFFFU) +#define MC33775_SECM_PER_AIN5_WR_MSK \ + (0x0U) +#define MC33775_SECM_PER_AIN5_MW_MSK \ + (0x0U) +#define MC33775_SECM_PER_AIN5_RA_MSK \ + (0x0U) +#define MC33775_SECM_PER_AIN5_POR_MSK \ + (0xffffU) +#define MC33775_SECM_PER_AIN5_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of AIN5 of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_SECM_PER_AIN5_VALUE_POS \ + (0U) +#define MC33775_SECM_PER_AIN5_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_secondary_measurement_registers_secm_per_ain5_t; + +/* -------------------------------------------------------------------------- + * SECM_PER_AIN6 (read-only):Periodic measurement result AIN6. + * -------------------------------------------------------------------------- */ +#define MC33775_SECM_PER_AIN6_OFFSET \ + (0x1C71U) +#define MC33775_SECM_PER_AIN6_RW_MSK \ + (0x0U) +#define MC33775_SECM_PER_AIN6_RD_MSK \ + (0xFFFFU) +#define MC33775_SECM_PER_AIN6_WR_MSK \ + (0x0U) +#define MC33775_SECM_PER_AIN6_MW_MSK \ + (0x0U) +#define MC33775_SECM_PER_AIN6_RA_MSK \ + (0x0U) +#define MC33775_SECM_PER_AIN6_POR_MSK \ + (0xffffU) +#define MC33775_SECM_PER_AIN6_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of AIN6 of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_SECM_PER_AIN6_VALUE_POS \ + (0U) +#define MC33775_SECM_PER_AIN6_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_secondary_measurement_registers_secm_per_ain6_t; + +/* -------------------------------------------------------------------------- + * SECM_PER_AIN7 (read-only):Periodic measurement result AIN7. + * -------------------------------------------------------------------------- */ +#define MC33775_SECM_PER_AIN7_OFFSET \ + (0x1C72U) +#define MC33775_SECM_PER_AIN7_RW_MSK \ + (0x0U) +#define MC33775_SECM_PER_AIN7_RD_MSK \ + (0xFFFFU) +#define MC33775_SECM_PER_AIN7_WR_MSK \ + (0x0U) +#define MC33775_SECM_PER_AIN7_MW_MSK \ + (0x0U) +#define MC33775_SECM_PER_AIN7_RA_MSK \ + (0x0U) +#define MC33775_SECM_PER_AIN7_POR_MSK \ + (0xffffU) +#define MC33775_SECM_PER_AIN7_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of AIN7 of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_SECM_PER_AIN7_VALUE_POS \ + (0U) +#define MC33775_SECM_PER_AIN7_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_secondary_measurement_registers_secm_per_ain7_t; + +/* -------------------------------------------------------------------------- + * SECM_PER_SECTEMP (read-only):Periodic measurement result secondary device temperature. + * -------------------------------------------------------------------------- */ +#define MC33775_SECM_PER_SECTEMP_OFFSET \ + (0x1C73U) +#define MC33775_SECM_PER_SECTEMP_RW_MSK \ + (0x0U) +#define MC33775_SECM_PER_SECTEMP_RD_MSK \ + (0xFFFFU) +#define MC33775_SECM_PER_SECTEMP_WR_MSK \ + (0x0U) +#define MC33775_SECM_PER_SECTEMP_MW_MSK \ + (0x0U) +#define MC33775_SECM_PER_SECTEMP_RA_MSK \ + (0x0U) +#define MC33775_SECM_PER_SECTEMP_POR_MSK \ + (0xffffU) +#define MC33775_SECM_PER_SECTEMP_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured temperature of secondary temperature sensor of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_SECM_PER_SECTEMP_VALUE_POS \ + (0U) +#define MC33775_SECM_PER_SECTEMP_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_secondary_measurement_registers_secm_per_sectemp_t; + +/* -------------------------------------------------------------------------- + * SECM_PER_PRMVREF (read-only):Periodic measurement result primary voltage reference. + * -------------------------------------------------------------------------- */ +#define MC33775_SECM_PER_PRMVREF_OFFSET \ + (0x1C74U) +#define MC33775_SECM_PER_PRMVREF_RW_MSK \ + (0x0U) +#define MC33775_SECM_PER_PRMVREF_RD_MSK \ + (0xFFFFU) +#define MC33775_SECM_PER_PRMVREF_WR_MSK \ + (0x0U) +#define MC33775_SECM_PER_PRMVREF_MW_MSK \ + (0x0U) +#define MC33775_SECM_PER_PRMVREF_RA_MSK \ + (0x0U) +#define MC33775_SECM_PER_PRMVREF_POR_MSK \ + (0xffffU) +#define MC33775_SECM_PER_PRMVREF_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of the primary voltage reference of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_SECM_PER_PRMVREF_VALUE_POS \ + (0U) +#define MC33775_SECM_PER_PRMVREF_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_secondary_measurement_registers_secm_per_prmvref_t; + +/* -------------------------------------------------------------------------- + * SECM_PER_VAUX (read-only):Periodic measurement result auxiliary supply voltage. + * -------------------------------------------------------------------------- */ +#define MC33775_SECM_PER_VAUX_OFFSET \ + (0x1C75U) +#define MC33775_SECM_PER_VAUX_RW_MSK \ + (0x0U) +#define MC33775_SECM_PER_VAUX_RD_MSK \ + (0xFFFFU) +#define MC33775_SECM_PER_VAUX_WR_MSK \ + (0x0U) +#define MC33775_SECM_PER_VAUX_MW_MSK \ + (0x0U) +#define MC33775_SECM_PER_VAUX_RA_MSK \ + (0x0U) +#define MC33775_SECM_PER_VAUX_POR_MSK \ + (0xffffU) +#define MC33775_SECM_PER_VAUX_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of VAUX of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_SECM_PER_VAUX_VALUE_POS \ + (0U) +#define MC33775_SECM_PER_VAUX_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_secondary_measurement_registers_secm_per_vaux_t; + +/* -------------------------------------------------------------------------- + * SECM_PER_VBAT (read-only):Periodic measurement result VBAT. + * -------------------------------------------------------------------------- */ +#define MC33775_SECM_PER_VBAT_OFFSET \ + (0x1C76U) +#define MC33775_SECM_PER_VBAT_RW_MSK \ + (0x0U) +#define MC33775_SECM_PER_VBAT_RD_MSK \ + (0xFFFFU) +#define MC33775_SECM_PER_VBAT_WR_MSK \ + (0x0U) +#define MC33775_SECM_PER_VBAT_MW_MSK \ + (0x0U) +#define MC33775_SECM_PER_VBAT_RA_MSK \ + (0x0U) +#define MC33775_SECM_PER_VBAT_POR_MSK \ + (0xffffU) +#define MC33775_SECM_PER_VBAT_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of VBAT of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_SECM_PER_VBAT_VALUE_POS \ + (0U) +#define MC33775_SECM_PER_VBAT_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_secondary_measurement_registers_secm_per_vbat_t; + +/* -------------------------------------------------------------------------- + * SECM_PER_VDDA (read-only):Periodic measurement result VDDA. + * -------------------------------------------------------------------------- */ +#define MC33775_SECM_PER_VDDA_OFFSET \ + (0x1C77U) +#define MC33775_SECM_PER_VDDA_RW_MSK \ + (0x0U) +#define MC33775_SECM_PER_VDDA_RD_MSK \ + (0xFFFFU) +#define MC33775_SECM_PER_VDDA_WR_MSK \ + (0x0U) +#define MC33775_SECM_PER_VDDA_MW_MSK \ + (0x0U) +#define MC33775_SECM_PER_VDDA_RA_MSK \ + (0x0U) +#define MC33775_SECM_PER_VDDA_POR_MSK \ + (0xffffU) +#define MC33775_SECM_PER_VDDA_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of VDDA of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_SECM_PER_VDDA_VALUE_POS \ + (0U) +#define MC33775_SECM_PER_VDDA_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_secondary_measurement_registers_secm_per_vdda_t; + +/* -------------------------------------------------------------------------- + * SECM_PER_VDDC (read-only):Periodic measurement result VDDC. + * -------------------------------------------------------------------------- */ +#define MC33775_SECM_PER_VDDC_OFFSET \ + (0x1C78U) +#define MC33775_SECM_PER_VDDC_RW_MSK \ + (0x0U) +#define MC33775_SECM_PER_VDDC_RD_MSK \ + (0xFFFFU) +#define MC33775_SECM_PER_VDDC_WR_MSK \ + (0x0U) +#define MC33775_SECM_PER_VDDC_MW_MSK \ + (0x0U) +#define MC33775_SECM_PER_VDDC_RA_MSK \ + (0x0U) +#define MC33775_SECM_PER_VDDC_POR_MSK \ + (0xffffU) +#define MC33775_SECM_PER_VDDC_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of VDDC of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_SECM_PER_VDDC_VALUE_POS \ + (0U) +#define MC33775_SECM_PER_VDDC_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_secondary_measurement_registers_secm_per_vddc_t; + +/* -------------------------------------------------------------------------- + * SECM_PER_MONVREF (read-only):Periodic measurement result voltage monitor reference. + * -------------------------------------------------------------------------- */ +#define MC33775_SECM_PER_MONVREF_OFFSET \ + (0x1C79U) +#define MC33775_SECM_PER_MONVREF_RW_MSK \ + (0x0U) +#define MC33775_SECM_PER_MONVREF_RD_MSK \ + (0xFFFFU) +#define MC33775_SECM_PER_MONVREF_WR_MSK \ + (0x0U) +#define MC33775_SECM_PER_MONVREF_MW_MSK \ + (0x0U) +#define MC33775_SECM_PER_MONVREF_RA_MSK \ + (0x0U) +#define MC33775_SECM_PER_MONVREF_POR_MSK \ + (0xffffU) +#define MC33775_SECM_PER_MONVREF_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of the monitor reference of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_SECM_PER_MONVREF_VALUE_POS \ + (0U) +#define MC33775_SECM_PER_MONVREF_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_secondary_measurement_registers_secm_per_monvref_t; + +/* -------------------------------------------------------------------------- + * SECM_PER_NPNISENSE (read-only):Periodic measurement result NPN current sensor. + * -------------------------------------------------------------------------- */ +#define MC33775_SECM_PER_NPNISENSE_OFFSET \ + (0x1C7AU) +#define MC33775_SECM_PER_NPNISENSE_RW_MSK \ + (0x0U) +#define MC33775_SECM_PER_NPNISENSE_RD_MSK \ + (0xFFFFU) +#define MC33775_SECM_PER_NPNISENSE_WR_MSK \ + (0x0U) +#define MC33775_SECM_PER_NPNISENSE_MW_MSK \ + (0x0U) +#define MC33775_SECM_PER_NPNISENSE_RA_MSK \ + (0x0U) +#define MC33775_SECM_PER_NPNISENSE_POR_MSK \ + (0xffffU) +#define MC33775_SECM_PER_NPNISENSE_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of NPN current sensor of the periodic cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_SECM_PER_NPNISENSE_VALUE_POS \ + (0U) +#define MC33775_SECM_PER_NPNISENSE_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_secondary_measurement_registers_secm_per_npnisense_t; + +/* -------------------------------------------------------------------------- + * SECM_SYNC_NUM (read-only):Measurement number of the secondary synchronous results. + * -------------------------------------------------------------------------- */ +#define MC33775_SECM_SYNC_NUM_OFFSET \ + (0x1C7FU) +#define MC33775_SECM_SYNC_NUM_RW_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_NUM_RD_MSK \ + (0xFFFFU) +#define MC33775_SECM_SYNC_NUM_WR_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_NUM_MW_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_NUM_RA_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_NUM_POR_MSK \ + (0xffffU) +#define MC33775_SECM_SYNC_NUM_POR_VAL \ + (0x0U) + +/* Field NUM: Number of the synchronous cycle in which the secondary results have been created. The value is incremented for each synchronous cycle executed. The counting wraps at its limit. The value is not incremented for FASTVB cycle. */ +#define MC33775_SECM_SYNC_NUM_NUM_POS \ + (0U) +#define MC33775_SECM_SYNC_NUM_NUM_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t NUM : 16; + } B; +} mc33775_secondary_measurement_registers_secm_sync_num_t; + +/* -------------------------------------------------------------------------- + * SECM_SYNC_VB0 (read-only):Synchronous measurement result from balancing pins cell 0. + * -------------------------------------------------------------------------- */ +#define MC33775_SECM_SYNC_VB0_OFFSET \ + (0x1C80U) +#define MC33775_SECM_SYNC_VB0_RW_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_VB0_RD_MSK \ + (0xFFFFU) +#define MC33775_SECM_SYNC_VB0_WR_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_VB0_MW_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_VB0_RA_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_VB0_POR_MSK \ + (0xffffU) +#define MC33775_SECM_SYNC_VB0_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of cell 0 of the last synchronous cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_SECM_SYNC_VB0_VALUE_POS \ + (0U) +#define MC33775_SECM_SYNC_VB0_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_secondary_measurement_registers_secm_sync_vb0_t; + +/* -------------------------------------------------------------------------- + * SECM_SYNC_VB1 (read-only):Synchronous measurement result from balancing pins cell 1. + * -------------------------------------------------------------------------- */ +#define MC33775_SECM_SYNC_VB1_OFFSET \ + (0x1C81U) +#define MC33775_SECM_SYNC_VB1_RW_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_VB1_RD_MSK \ + (0xFFFFU) +#define MC33775_SECM_SYNC_VB1_WR_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_VB1_MW_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_VB1_RA_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_VB1_POR_MSK \ + (0xffffU) +#define MC33775_SECM_SYNC_VB1_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of cell 1 of the last synchronous cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_SECM_SYNC_VB1_VALUE_POS \ + (0U) +#define MC33775_SECM_SYNC_VB1_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_secondary_measurement_registers_secm_sync_vb1_t; + +/* -------------------------------------------------------------------------- + * SECM_SYNC_VB2 (read-only):Synchronous measurement result from balancing pins cell 2. + * -------------------------------------------------------------------------- */ +#define MC33775_SECM_SYNC_VB2_OFFSET \ + (0x1C82U) +#define MC33775_SECM_SYNC_VB2_RW_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_VB2_RD_MSK \ + (0xFFFFU) +#define MC33775_SECM_SYNC_VB2_WR_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_VB2_MW_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_VB2_RA_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_VB2_POR_MSK \ + (0xffffU) +#define MC33775_SECM_SYNC_VB2_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of cell 2 of the last synchronous cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_SECM_SYNC_VB2_VALUE_POS \ + (0U) +#define MC33775_SECM_SYNC_VB2_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_secondary_measurement_registers_secm_sync_vb2_t; + +/* -------------------------------------------------------------------------- + * SECM_SYNC_VB3 (read-only):Synchronous measurement result from balancing pins cell 3. + * -------------------------------------------------------------------------- */ +#define MC33775_SECM_SYNC_VB3_OFFSET \ + (0x1C83U) +#define MC33775_SECM_SYNC_VB3_RW_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_VB3_RD_MSK \ + (0xFFFFU) +#define MC33775_SECM_SYNC_VB3_WR_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_VB3_MW_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_VB3_RA_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_VB3_POR_MSK \ + (0xffffU) +#define MC33775_SECM_SYNC_VB3_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of cell 3 of the last synchronous cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_SECM_SYNC_VB3_VALUE_POS \ + (0U) +#define MC33775_SECM_SYNC_VB3_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_secondary_measurement_registers_secm_sync_vb3_t; + +/* -------------------------------------------------------------------------- + * SECM_SYNC_VB4 (read-only):Synchronous measurement result from balancing pins cell 4. + * -------------------------------------------------------------------------- */ +#define MC33775_SECM_SYNC_VB4_OFFSET \ + (0x1C84U) +#define MC33775_SECM_SYNC_VB4_RW_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_VB4_RD_MSK \ + (0xFFFFU) +#define MC33775_SECM_SYNC_VB4_WR_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_VB4_MW_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_VB4_RA_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_VB4_POR_MSK \ + (0xffffU) +#define MC33775_SECM_SYNC_VB4_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of cell 4 of the last synchronous cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_SECM_SYNC_VB4_VALUE_POS \ + (0U) +#define MC33775_SECM_SYNC_VB4_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_secondary_measurement_registers_secm_sync_vb4_t; + +/* -------------------------------------------------------------------------- + * SECM_SYNC_VB5 (read-only):Synchronous measurement result from balancing pins cell 5. + * -------------------------------------------------------------------------- */ +#define MC33775_SECM_SYNC_VB5_OFFSET \ + (0x1C85U) +#define MC33775_SECM_SYNC_VB5_RW_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_VB5_RD_MSK \ + (0xFFFFU) +#define MC33775_SECM_SYNC_VB5_WR_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_VB5_MW_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_VB5_RA_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_VB5_POR_MSK \ + (0xffffU) +#define MC33775_SECM_SYNC_VB5_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of cell 5 of the last synchronous cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_SECM_SYNC_VB5_VALUE_POS \ + (0U) +#define MC33775_SECM_SYNC_VB5_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_secondary_measurement_registers_secm_sync_vb5_t; + +/* -------------------------------------------------------------------------- + * SECM_SYNC_VB6 (read-only):Synchronous measurement result from balancing pins cell 6. + * -------------------------------------------------------------------------- */ +#define MC33775_SECM_SYNC_VB6_OFFSET \ + (0x1C86U) +#define MC33775_SECM_SYNC_VB6_RW_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_VB6_RD_MSK \ + (0xFFFFU) +#define MC33775_SECM_SYNC_VB6_WR_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_VB6_MW_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_VB6_RA_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_VB6_POR_MSK \ + (0xffffU) +#define MC33775_SECM_SYNC_VB6_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of cell 6 of the last synchronous cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_SECM_SYNC_VB6_VALUE_POS \ + (0U) +#define MC33775_SECM_SYNC_VB6_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_secondary_measurement_registers_secm_sync_vb6_t; + +/* -------------------------------------------------------------------------- + * SECM_SYNC_VB7 (read-only):Synchronous measurement result from balancing pins cell 7. + * -------------------------------------------------------------------------- */ +#define MC33775_SECM_SYNC_VB7_OFFSET \ + (0x1C87U) +#define MC33775_SECM_SYNC_VB7_RW_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_VB7_RD_MSK \ + (0xFFFFU) +#define MC33775_SECM_SYNC_VB7_WR_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_VB7_MW_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_VB7_RA_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_VB7_POR_MSK \ + (0xffffU) +#define MC33775_SECM_SYNC_VB7_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of cell 7 of the last synchronous cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_SECM_SYNC_VB7_VALUE_POS \ + (0U) +#define MC33775_SECM_SYNC_VB7_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_secondary_measurement_registers_secm_sync_vb7_t; + +/* -------------------------------------------------------------------------- + * SECM_SYNC_VB8 (read-only):Synchronous measurement result from balancing pins cell 8. + * -------------------------------------------------------------------------- */ +#define MC33775_SECM_SYNC_VB8_OFFSET \ + (0x1C88U) +#define MC33775_SECM_SYNC_VB8_RW_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_VB8_RD_MSK \ + (0xFFFFU) +#define MC33775_SECM_SYNC_VB8_WR_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_VB8_MW_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_VB8_RA_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_VB8_POR_MSK \ + (0xffffU) +#define MC33775_SECM_SYNC_VB8_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of cell 8 of the last synchronous cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_SECM_SYNC_VB8_VALUE_POS \ + (0U) +#define MC33775_SECM_SYNC_VB8_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_secondary_measurement_registers_secm_sync_vb8_t; + +/* -------------------------------------------------------------------------- + * SECM_SYNC_VB9 (read-only):Synchronous measurement result from balancing pins cell 9. + * -------------------------------------------------------------------------- */ +#define MC33775_SECM_SYNC_VB9_OFFSET \ + (0x1C89U) +#define MC33775_SECM_SYNC_VB9_RW_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_VB9_RD_MSK \ + (0xFFFFU) +#define MC33775_SECM_SYNC_VB9_WR_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_VB9_MW_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_VB9_RA_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_VB9_POR_MSK \ + (0xffffU) +#define MC33775_SECM_SYNC_VB9_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of cell 9 of the last synchronous cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_SECM_SYNC_VB9_VALUE_POS \ + (0U) +#define MC33775_SECM_SYNC_VB9_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_secondary_measurement_registers_secm_sync_vb9_t; + +/* -------------------------------------------------------------------------- + * SECM_SYNC_VB10 (read-only):Synchronous measurement result from balancing pins cell 10. + * -------------------------------------------------------------------------- */ +#define MC33775_SECM_SYNC_VB10_OFFSET \ + (0x1C8AU) +#define MC33775_SECM_SYNC_VB10_RW_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_VB10_RD_MSK \ + (0xFFFFU) +#define MC33775_SECM_SYNC_VB10_WR_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_VB10_MW_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_VB10_RA_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_VB10_POR_MSK \ + (0xffffU) +#define MC33775_SECM_SYNC_VB10_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of cell 10 of the last synchronous cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_SECM_SYNC_VB10_VALUE_POS \ + (0U) +#define MC33775_SECM_SYNC_VB10_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_secondary_measurement_registers_secm_sync_vb10_t; + +/* -------------------------------------------------------------------------- + * SECM_SYNC_VB11 (read-only):Synchronous measurement result from balancing pins cell 11. + * -------------------------------------------------------------------------- */ +#define MC33775_SECM_SYNC_VB11_OFFSET \ + (0x1C8BU) +#define MC33775_SECM_SYNC_VB11_RW_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_VB11_RD_MSK \ + (0xFFFFU) +#define MC33775_SECM_SYNC_VB11_WR_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_VB11_MW_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_VB11_RA_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_VB11_POR_MSK \ + (0xffffU) +#define MC33775_SECM_SYNC_VB11_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of cell 11 of the last synchronous cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_SECM_SYNC_VB11_VALUE_POS \ + (0U) +#define MC33775_SECM_SYNC_VB11_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_secondary_measurement_registers_secm_sync_vb11_t; + +/* -------------------------------------------------------------------------- + * SECM_SYNC_VB12 (read-only):Synchronous measurement result from balancing pins cell 12. + * -------------------------------------------------------------------------- */ +#define MC33775_SECM_SYNC_VB12_OFFSET \ + (0x1C8CU) +#define MC33775_SECM_SYNC_VB12_RW_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_VB12_RD_MSK \ + (0xFFFFU) +#define MC33775_SECM_SYNC_VB12_WR_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_VB12_MW_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_VB12_RA_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_VB12_POR_MSK \ + (0xffffU) +#define MC33775_SECM_SYNC_VB12_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of cell 12 of the last synchronous cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_SECM_SYNC_VB12_VALUE_POS \ + (0U) +#define MC33775_SECM_SYNC_VB12_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_secondary_measurement_registers_secm_sync_vb12_t; + +/* -------------------------------------------------------------------------- + * SECM_SYNC_VB13 (read-only):Synchronous measurement result from balancing pins cell 13. + * -------------------------------------------------------------------------- */ +#define MC33775_SECM_SYNC_VB13_OFFSET \ + (0x1C8DU) +#define MC33775_SECM_SYNC_VB13_RW_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_VB13_RD_MSK \ + (0xFFFFU) +#define MC33775_SECM_SYNC_VB13_WR_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_VB13_MW_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_VB13_RA_MSK \ + (0x0U) +#define MC33775_SECM_SYNC_VB13_POR_MSK \ + (0xffffU) +#define MC33775_SECM_SYNC_VB13_POR_VAL \ + (0x8000U) + +/* Field VALUE: Measured voltage of cell 13 of the last synchronous cycle as signed integer. A read to this register sets its content to invalid (0x8000). */ +#define MC33775_SECM_SYNC_VB13_VALUE_POS \ + (0U) +#define MC33775_SECM_SYNC_VB13_VALUE_MSK \ + (0xFFFFU) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t VALUE : 16; + } B; +} mc33775_secondary_measurement_registers_secm_sync_vb13_t; + +/* -------------------------------------------------------------------------- + * BAL_GLOB_CFG (read-write):The global balancing configuration register is used to configure the balancing modes. + * -------------------------------------------------------------------------- */ +#define MC33775_BAL_GLOB_CFG_OFFSET \ + (0x1000U) +#define MC33775_BAL_GLOB_CFG_RW_MSK \ + (0x31FU) +#define MC33775_BAL_GLOB_CFG_RD_MSK \ + (0x31FU) +#define MC33775_BAL_GLOB_CFG_WR_MSK \ + (0x31FU) +#define MC33775_BAL_GLOB_CFG_MW_MSK \ + (0x0U) +#define MC33775_BAL_GLOB_CFG_RA_MSK \ + (0x0U) +#define MC33775_BAL_GLOB_CFG_POR_MSK \ + (0xffffU) +#define MC33775_BAL_GLOB_CFG_POR_VAL \ + (0x0U) + +/* Field BALEN: Enables the balancing activity. This bit is cleared in case of a balancing timeout or if an enabled global under-voltage condition is reached. All channel individual counters are stopped if zero. The emergency discharge works without setting this bit. */ +#define MC33775_BAL_GLOB_CFG_BALEN_POS \ + (0U) +#define MC33775_BAL_GLOB_CFG_BALEN_MSK \ + (0x1U) + +/* Enumerated value DISABLED: Balancing is disabled. */ +#define MC33775_BAL_GLOB_CFG_BALEN_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Balancing is enabled. */ +#define MC33775_BAL_GLOB_CFG_BALEN_ENABLED_ENUM_VAL \ + (1U) + +/* Field TMRBALEN: Enables the timer based balancing feature. All channel individual counters are stopped if zero. */ +#define MC33775_BAL_GLOB_CFG_TMRBALEN_POS \ + (1U) +#define MC33775_BAL_GLOB_CFG_TMRBALEN_MSK \ + (0x2U) + +/* Enumerated value INDEPENDENT: Balancing is independent of the cell balancing timer. */ +#define MC33775_BAL_GLOB_CFG_TMRBALEN_INDEPENDENT_ENUM_VAL \ + (0U) + +/* Enumerated value STOP: Balancing for all cells will be stopped when cell balancing timer expires. */ +#define MC33775_BAL_GLOB_CFG_TMRBALEN_STOP_ENUM_VAL \ + (1U) + +/* Field CHUV0BALEN: Enables the voltage based balancing for the individual channel. Balancing stops once each individual channel reaches the under-voltage threshold. */ +#define MC33775_BAL_GLOB_CFG_CHUV0BALEN_POS \ + (2U) +#define MC33775_BAL_GLOB_CFG_CHUV0BALEN_MSK \ + (0x4U) + +/* Enumerated value INDEPENDENT: Balancing is independent of the cell undervoltage threshold. */ +#define MC33775_BAL_GLOB_CFG_CHUV0BALEN_INDEPENDENT_ENUM_VAL \ + (0U) + +/* Enumerated value STOP: Balancing for the individual cells stops once the cell undervoltage threshold is reached. */ +#define MC33775_BAL_GLOB_CFG_CHUV0BALEN_STOP_ENUM_VAL \ + (1U) + +/* Field GLOBUV1BALEN: Enables the Global undervoltage based balancing feature. */ +#define MC33775_BAL_GLOB_CFG_GLOBUV1BALEN_POS \ + (3U) +#define MC33775_BAL_GLOB_CFG_GLOBUV1BALEN_MSK \ + (0x8U) + +/* Enumerated value INDEPENDENT: Balancing is independent of the global undervoltage threshold. */ +#define MC33775_BAL_GLOB_CFG_GLOBUV1BALEN_INDEPENDENT_ENUM_VAL \ + (0U) + +/* Enumerated value STOP: Balancing for all cells stops once the global undervoltage threshold is reached by any cell. */ +#define MC33775_BAL_GLOB_CFG_GLOBUV1BALEN_STOP_ENUM_VAL \ + (1U) + +/* Field TEMPMODBALEN: Enables the temperature modulated balancing. After an over-temperature condition the balancing is halted until an under-temperature condition is detected. */ +#define MC33775_BAL_GLOB_CFG_TEMPMODBALEN_POS \ + (4U) +#define MC33775_BAL_GLOB_CFG_TEMPMODBALEN_MSK \ + (0x10U) + +/* Enumerated value NOTEMPMOD: Balancing is not temperature modulated. */ +#define MC33775_BAL_GLOB_CFG_TEMPMODBALEN_NOTEMPMOD_ENUM_VAL \ + (0U) + +/* Enumerated value TEMPMOD: Balancing is temperature modulated. */ +#define MC33775_BAL_GLOB_CFG_TEMPMODBALEN_TEMPMOD_ENUM_VAL \ + (1U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_BAL_GLOB_CFG_RESERVED0_POS \ + (5U) +#define MC33775_BAL_GLOB_CFG_RESERVED0_MSK \ + (0xE0U) + +/* Field TEMPSRC: Selects the source channel (AINx) for temperature modulated balancing. */ +#define MC33775_BAL_GLOB_CFG_TEMPSRC_POS \ + (8U) +#define MC33775_BAL_GLOB_CFG_TEMPSRC_MSK \ + (0x300U) + +/* Enumerated value AIN0: Selects AIN0 as source for temperature measurement. */ +#define MC33775_BAL_GLOB_CFG_TEMPSRC_AIN0_ENUM_VAL \ + (0U) + +/* Enumerated value AIN1: Selects AIN1 as source for temperature measurement. */ +#define MC33775_BAL_GLOB_CFG_TEMPSRC_AIN1_ENUM_VAL \ + (1U) + +/* Enumerated value AIN2: Selects AIN2 as source for temperature measurement. */ +#define MC33775_BAL_GLOB_CFG_TEMPSRC_AIN2_ENUM_VAL \ + (2U) + +/* Enumerated value AIN3: Selects AIN3 as source for temperature measurement. */ +#define MC33775_BAL_GLOB_CFG_TEMPSRC_AIN3_ENUM_VAL \ + (3U) + +/* Field reserved1: This read-only field is reserved and always has the value 0. */ +#define MC33775_BAL_GLOB_CFG_RESERVED1_POS \ + (10U) +#define MC33775_BAL_GLOB_CFG_RESERVED1_MSK \ + (0xFC00U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t BALEN : 1; + volatile uint16_t TMRBALEN : 1; + volatile uint16_t CHUV0BALEN : 1; + volatile uint16_t GLOBUV1BALEN : 1; + volatile uint16_t TEMPMODBALEN : 1; + volatile uint16_t reserved0 : 3; + volatile uint16_t TEMPSRC : 2; + volatile uint16_t reserved1 : 6; + } B; +} mc33775_balancing_registers_bal_glob_cfg_t; + +/* -------------------------------------------------------------------------- + * BAL_GLOB_TO_TMR (read-write):The Global Balancing timeout timer register is used to configure the maximum balancing time for all balancing activities to make sure that in case of fault the balancing switches are switched OFF. + * -------------------------------------------------------------------------- */ +#define MC33775_BAL_GLOB_TO_TMR_OFFSET \ + (0x1001U) +#define MC33775_BAL_GLOB_TO_TMR_RW_MSK \ + (0xFFFFU) +#define MC33775_BAL_GLOB_TO_TMR_RD_MSK \ + (0xFFFFU) +#define MC33775_BAL_GLOB_TO_TMR_WR_MSK \ + (0xFFFFU) +#define MC33775_BAL_GLOB_TO_TMR_MW_MSK \ + (0x0U) +#define MC33775_BAL_GLOB_TO_TMR_RA_MSK \ + (0x0U) +#define MC33775_BAL_GLOB_TO_TMR_POR_MSK \ + (0xffffU) +#define MC33775_BAL_GLOB_TO_TMR_POR_VAL \ + (0x0U) + +/* Field TOTIME: Balancing timeout value, used for normal balancing. The value of this field represents the current counter value when read. The BAL_GLOB_CFG.BALEN is cleared when zero is reached. The counter saturates at zero. It counts down regardless of the balancing enable state as long as its value is non-zero. */ +#define MC33775_BAL_GLOB_TO_TMR_TOTIME_POS \ + (0U) +#define MC33775_BAL_GLOB_TO_TMR_TOTIME_MSK \ + (0xFFFFU) + +/* Enumerated value EXPIRED: Balancing time is expired */ +#define MC33775_BAL_GLOB_TO_TMR_TOTIME_EXPIRED_ENUM_VAL \ + (0U) + +/* Enumerated value BALTIME: Balancing time is set to BALTIME * 10 seconds */ +#define MC33775_BAL_GLOB_TO_TMR_TOTIME_BALTIME_ENUM_VAL \ + (1U) + +/* Enumerated value MAX: Maximum balancing time = 655350 seconds = approximately 182 hours = approximately 7.6 days */ +#define MC33775_BAL_GLOB_TO_TMR_TOTIME_MAX_ENUM_VAL \ + (65535U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t TOTIME : 16; + } B; +} mc33775_balancing_registers_bal_glob_to_tmr_t; + +/* -------------------------------------------------------------------------- + * BAL_CH_CFG (read-write):Balancing channel individual enable + * -------------------------------------------------------------------------- */ +#define MC33775_BAL_CH_CFG_OFFSET \ + (0x1002U) +#define MC33775_BAL_CH_CFG_RW_MSK \ + (0x3FFFU) +#define MC33775_BAL_CH_CFG_RD_MSK \ + (0x3FFFU) +#define MC33775_BAL_CH_CFG_WR_MSK \ + (0x3FFFU) +#define MC33775_BAL_CH_CFG_MW_MSK \ + (0x0U) +#define MC33775_BAL_CH_CFG_RA_MSK \ + (0x0U) +#define MC33775_BAL_CH_CFG_POR_MSK \ + (0xffffU) +#define MC33775_BAL_CH_CFG_POR_VAL \ + (0x0U) + +/* Field CHEN0: Enable balancing for channel 0. The bit is cleared by the device in case of: a) a detected over-current condition on channel 0. b) a detected and enabled individual under-voltage condition for channel 0. c) the channel timer of channel 0 (BAL_TMR_CH0) is zero. */ +#define MC33775_BAL_CH_CFG_CHEN0_POS \ + (0U) +#define MC33775_BAL_CH_CFG_CHEN0_MSK \ + (0x1U) + +/* Enumerated value DISABLED: Balancing for Channel 0 is disabled. The balancing timer for Channel 0 is stopped. */ +#define MC33775_BAL_CH_CFG_CHEN0_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Balancing for Channel 0 is enabled. */ +#define MC33775_BAL_CH_CFG_CHEN0_ENABLED_ENUM_VAL \ + (1U) + +/* Field CHEN1: Enable balancing for channel 1. The bit is cleared by the device in case of: a) a detected over-current condition on channel 1. b) a detected and enabled individual under-voltage condition for channel 1. c) the channel timer of channel 0 (BAL_TMR_CH1) is zero. */ +#define MC33775_BAL_CH_CFG_CHEN1_POS \ + (1U) +#define MC33775_BAL_CH_CFG_CHEN1_MSK \ + (0x2U) + +/* Enumerated value DISABLED: Balancing for Channel 1 is disabled. The balancing timer for Channel 1 is stopped. */ +#define MC33775_BAL_CH_CFG_CHEN1_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Balancing for Channel 1 is enabled. */ +#define MC33775_BAL_CH_CFG_CHEN1_ENABLED_ENUM_VAL \ + (1U) + +/* Field CHEN2: Enable balancing for channel 2. The bit is cleared by the device in case of: a) a detected over-current condition on channel 2. b) a detected and enabled individual under-voltage condition for channel 2. c) the channel timer of channel 0 (BAL_TMR_CH2) is zero. */ +#define MC33775_BAL_CH_CFG_CHEN2_POS \ + (2U) +#define MC33775_BAL_CH_CFG_CHEN2_MSK \ + (0x4U) + +/* Enumerated value DISABLED: Balancing for Channel 2 is disabled. The balancing timer for Channel 2 is stopped. */ +#define MC33775_BAL_CH_CFG_CHEN2_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Balancing for Channel 2 is enabled. */ +#define MC33775_BAL_CH_CFG_CHEN2_ENABLED_ENUM_VAL \ + (1U) + +/* Field CHEN3: Enable balancing for channel 3. The bit is cleared by the device in case of: a) a detected over-current condition on channel 3. b) a detected and enabled individual under-voltage condition for channel 3. c) the channel timer of channel 0 (BAL_TMR_CH3) is zero. */ +#define MC33775_BAL_CH_CFG_CHEN3_POS \ + (3U) +#define MC33775_BAL_CH_CFG_CHEN3_MSK \ + (0x8U) + +/* Enumerated value DISABLED: Balancing for Channel 3 is disabled. The balancing timer for Channel 3 is stopped. */ +#define MC33775_BAL_CH_CFG_CHEN3_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Balancing for Channel 3 is enabled. */ +#define MC33775_BAL_CH_CFG_CHEN3_ENABLED_ENUM_VAL \ + (1U) + +/* Field CHEN4: Enable balancing for channel 4. The bit is cleared by the device in case of: a) a detected over-current condition on channel 4. b) a detected and enabled individual under-voltage condition for channel 4. c) the channel timer of channel 0 (BAL_TMR_CH4) is zero. */ +#define MC33775_BAL_CH_CFG_CHEN4_POS \ + (4U) +#define MC33775_BAL_CH_CFG_CHEN4_MSK \ + (0x10U) + +/* Enumerated value DISABLED: Balancing for Channel 4 is disabled. The balancing timer for Channel 4 is stopped. */ +#define MC33775_BAL_CH_CFG_CHEN4_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Balancing for Channel 4 is enabled. */ +#define MC33775_BAL_CH_CFG_CHEN4_ENABLED_ENUM_VAL \ + (1U) + +/* Field CHEN5: Enable balancing for channel 5. The bit is cleared by the device in case of: a) a detected over-current condition on channel 5. b) a detected and enabled individual under-voltage condition for channel 5. c) the channel timer of channel 0 (BAL_TMR_CH5) is zero. */ +#define MC33775_BAL_CH_CFG_CHEN5_POS \ + (5U) +#define MC33775_BAL_CH_CFG_CHEN5_MSK \ + (0x20U) + +/* Enumerated value DISABLED: Balancing for Channel 5 is disabled. The balancing timer for Channel 5 is stopped. */ +#define MC33775_BAL_CH_CFG_CHEN5_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Balancing for Channel 5 is enabled. */ +#define MC33775_BAL_CH_CFG_CHEN5_ENABLED_ENUM_VAL \ + (1U) + +/* Field CHEN6: Enable balancing for channel 6. The bit is cleared by the device in case of: a) a detected over-current condition on channel 6. b) a detected and enabled individual under-voltage condition for channel 6. c) the channel timer of channel 0 (BAL_TMR_CH6) is zero. */ +#define MC33775_BAL_CH_CFG_CHEN6_POS \ + (6U) +#define MC33775_BAL_CH_CFG_CHEN6_MSK \ + (0x40U) + +/* Enumerated value DISABLED: Balancing for Channel 6 is disabled. The balancing timer for Channel 6 is stopped. */ +#define MC33775_BAL_CH_CFG_CHEN6_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Balancing for Channel 6 is enabled. */ +#define MC33775_BAL_CH_CFG_CHEN6_ENABLED_ENUM_VAL \ + (1U) + +/* Field CHEN7: Enable balancing for channel 7. The bit is cleared by the device in case of: a) a detected over-current condition on channel 7. b) a detected and enabled individual under-voltage condition for channel 7. c) the channel timer of channel 0 (BAL_TMR_CH7) is zero. */ +#define MC33775_BAL_CH_CFG_CHEN7_POS \ + (7U) +#define MC33775_BAL_CH_CFG_CHEN7_MSK \ + (0x80U) + +/* Enumerated value DISABLED: Balancing for Channel 7 is disabled. The balancing timer for Channel 7 is stopped. */ +#define MC33775_BAL_CH_CFG_CHEN7_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Balancing for Channel 7 is enabled. */ +#define MC33775_BAL_CH_CFG_CHEN7_ENABLED_ENUM_VAL \ + (1U) + +/* Field CHEN8: Enable balancing for channel 8. The bit is cleared by the device in case of: a) a detected over-current condition on channel 8. b) a detected and enabled individual under-voltage condition for channel 8. c) the channel timer of channel 0 (BAL_TMR_CH8) is zero. */ +#define MC33775_BAL_CH_CFG_CHEN8_POS \ + (8U) +#define MC33775_BAL_CH_CFG_CHEN8_MSK \ + (0x100U) + +/* Enumerated value DISABLED: Balancing for Channel 8 is disabled. The balancing timer for Channel 8 is stopped. */ +#define MC33775_BAL_CH_CFG_CHEN8_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Balancing for Channel 8 is enabled. */ +#define MC33775_BAL_CH_CFG_CHEN8_ENABLED_ENUM_VAL \ + (1U) + +/* Field CHEN9: Enable balancing for channel 9. The bit is cleared by the device in case of: a) a detected over-current condition on channel 9. b) a detected and enabled individual under-voltage condition for channel 9. c) the channel timer of channel 0 (BAL_TMR_CH9) is zero. */ +#define MC33775_BAL_CH_CFG_CHEN9_POS \ + (9U) +#define MC33775_BAL_CH_CFG_CHEN9_MSK \ + (0x200U) + +/* Enumerated value DISABLED: Balancing for Channel 9 is disabled. The balancing timer for Channel 9 is stopped. */ +#define MC33775_BAL_CH_CFG_CHEN9_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Balancing for Channel 9 is enabled. */ +#define MC33775_BAL_CH_CFG_CHEN9_ENABLED_ENUM_VAL \ + (1U) + +/* Field CHEN10: Enable balancing for channel 10. The bit is cleared by the device in case of: a) a detected over-current condition on channel 10. b) a detected and enabled individual under-voltage condition for channel 10. c) the channel timer of channel 0 (BAL_TMR_CH10) is zero. */ +#define MC33775_BAL_CH_CFG_CHEN10_POS \ + (10U) +#define MC33775_BAL_CH_CFG_CHEN10_MSK \ + (0x400U) + +/* Enumerated value DISABLED: Balancing for Channel 10 is disabled. The balancing timer for Channel 10 is stopped. */ +#define MC33775_BAL_CH_CFG_CHEN10_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Balancing for Channel 10 is enabled. */ +#define MC33775_BAL_CH_CFG_CHEN10_ENABLED_ENUM_VAL \ + (1U) + +/* Field CHEN11: Enable balancing for channel 11. The bit is cleared by the device in case of: a) a detected over-current condition on channel 11. b) a detected and enabled individual under-voltage condition for channel 11. c) the channel timer of channel 0 (BAL_TMR_CH11) is zero. */ +#define MC33775_BAL_CH_CFG_CHEN11_POS \ + (11U) +#define MC33775_BAL_CH_CFG_CHEN11_MSK \ + (0x800U) + +/* Enumerated value DISABLED: Balancing for Channel 11 is disabled. The balancing timer for Channel 11 is stopped. */ +#define MC33775_BAL_CH_CFG_CHEN11_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Balancing for Channel 11 is enabled. */ +#define MC33775_BAL_CH_CFG_CHEN11_ENABLED_ENUM_VAL \ + (1U) + +/* Field CHEN12: Enable balancing for channel 12. The bit is cleared by the device in case of: a) a detected over-current condition on channel 12. b) a detected and enabled individual under-voltage condition for channel 12. c) the channel timer of channel 0 (BAL_TMR_CH12) is zero. */ +#define MC33775_BAL_CH_CFG_CHEN12_POS \ + (12U) +#define MC33775_BAL_CH_CFG_CHEN12_MSK \ + (0x1000U) + +/* Enumerated value DISABLED: Balancing for Channel 12 is disabled. The balancing timer for Channel 12 is stopped. */ +#define MC33775_BAL_CH_CFG_CHEN12_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Balancing for Channel 12 is enabled. */ +#define MC33775_BAL_CH_CFG_CHEN12_ENABLED_ENUM_VAL \ + (1U) + +/* Field CHEN13: Enable balancing for channel 13. The bit is cleared by the device in case of: a) a detected over-current condition on channel 13. b) a detected and enabled individual under-voltage condition for channel 13. c) the channel timer of channel 0 (BAL_TMR_CH13) is zero. */ +#define MC33775_BAL_CH_CFG_CHEN13_POS \ + (13U) +#define MC33775_BAL_CH_CFG_CHEN13_MSK \ + (0x2000U) + +/* Enumerated value DISABLED: Balancing for Channel 13 is disabled. The balancing timer for Channel 13 is stopped. */ +#define MC33775_BAL_CH_CFG_CHEN13_DISABLED_ENUM_VAL \ + (0U) + +/* Enumerated value ENABLED: Balancing for Channel 13 is enabled. */ +#define MC33775_BAL_CH_CFG_CHEN13_ENABLED_ENUM_VAL \ + (1U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_BAL_CH_CFG_RESERVED0_POS \ + (14U) +#define MC33775_BAL_CH_CFG_RESERVED0_MSK \ + (0xC000U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t CHEN0 : 1; + volatile uint16_t CHEN1 : 1; + volatile uint16_t CHEN2 : 1; + volatile uint16_t CHEN3 : 1; + volatile uint16_t CHEN4 : 1; + volatile uint16_t CHEN5 : 1; + volatile uint16_t CHEN6 : 1; + volatile uint16_t CHEN7 : 1; + volatile uint16_t CHEN8 : 1; + volatile uint16_t CHEN9 : 1; + volatile uint16_t CHEN10 : 1; + volatile uint16_t CHEN11 : 1; + volatile uint16_t CHEN12 : 1; + volatile uint16_t CHEN13 : 1; + volatile uint16_t reserved0 : 2; + } B; +} mc33775_balancing_registers_bal_ch_cfg_t; + +/* -------------------------------------------------------------------------- + * BAL_PRE_TMR (read-write):Pre-balancing timer + * -------------------------------------------------------------------------- */ +#define MC33775_BAL_PRE_TMR_OFFSET \ + (0x1003U) +#define MC33775_BAL_PRE_TMR_RW_MSK \ + (0xFFFFU) +#define MC33775_BAL_PRE_TMR_RD_MSK \ + (0xFFFFU) +#define MC33775_BAL_PRE_TMR_WR_MSK \ + (0xFFFFU) +#define MC33775_BAL_PRE_TMR_MW_MSK \ + (0x0U) +#define MC33775_BAL_PRE_TMR_RA_MSK \ + (0x0U) +#define MC33775_BAL_PRE_TMR_POR_MSK \ + (0xffffU) +#define MC33775_BAL_PRE_TMR_POR_VAL \ + (0x0U) + +/* Field PREBALTIME: Downcounter which runs if BALEN is set. Inhibits the balancing and holds the individual channel timer. The value of this field represents the current counter value when read. The counting saturates at 0 and activates the balancing. The BAL_GLOB_TO_TMR is not influenced by this timer. */ +#define MC33775_BAL_PRE_TMR_PREBALTIME_POS \ + (0U) +#define MC33775_BAL_PRE_TMR_PREBALTIME_MSK \ + (0xFFFFU) + +/* Enumerated value EXPIRED: Pre-balancing time is expired. */ +#define MC33775_BAL_PRE_TMR_PREBALTIME_EXPIRED_ENUM_VAL \ + (0U) + +/* Enumerated value PREBAL: Pre-balancing time is set to PREBAL * 10 seconds */ +#define MC33775_BAL_PRE_TMR_PREBALTIME_PREBAL_ENUM_VAL \ + (1U) + +/* Enumerated value MAX: Maximum pre-balancing time = 655350 seconds = approximately 182 hours = approximately 7.6 days */ +#define MC33775_BAL_PRE_TMR_PREBALTIME_MAX_ENUM_VAL \ + (65535U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t PREBALTIME : 16; + } B; +} mc33775_balancing_registers_bal_pre_tmr_t; + +/* -------------------------------------------------------------------------- + * BAL_AUTO_DISCHRG_CTRL (read-write):Emergency discharge enable + * -------------------------------------------------------------------------- */ +#define MC33775_BAL_AUTO_DISCHRG_CTRL_OFFSET \ + (0x1004U) +#define MC33775_BAL_AUTO_DISCHRG_CTRL_RW_MSK \ + (0xFFFFU) +#define MC33775_BAL_AUTO_DISCHRG_CTRL_RD_MSK \ + (0xFFFFU) +#define MC33775_BAL_AUTO_DISCHRG_CTRL_WR_MSK \ + (0xFFFFU) +#define MC33775_BAL_AUTO_DISCHRG_CTRL_MW_MSK \ + (0x0U) +#define MC33775_BAL_AUTO_DISCHRG_CTRL_RA_MSK \ + (0x0U) +#define MC33775_BAL_AUTO_DISCHRG_CTRL_POR_MSK \ + (0xffffU) +#define MC33775_BAL_AUTO_DISCHRG_CTRL_POR_VAL \ + (0x2152U) + +/* Field KEY: Key for enabling auto discharge. After enabling, discharge will continue until disable key is received. Other values than DEADh or 2152h have no influence on the device functionality. */ +#define MC33775_BAL_AUTO_DISCHRG_CTRL_KEY_POS \ + (0U) +#define MC33775_BAL_AUTO_DISCHRG_CTRL_KEY_MSK \ + (0xFFFFU) + +/* Enumerated value OTHERS: Other values will be ignored. */ +#define MC33775_BAL_AUTO_DISCHRG_CTRL_KEY_OTHERS_ENUM_VAL \ + (1U) + +/* Enumerated value DISABLED: Disable key for auto discharge. */ +#define MC33775_BAL_AUTO_DISCHRG_CTRL_KEY_DISABLED_ENUM_VAL \ + (8530U) + +/* Enumerated value ENABLED: Enable key for auto discharge. */ +#define MC33775_BAL_AUTO_DISCHRG_CTRL_KEY_ENABLED_ENUM_VAL \ + (57005U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t KEY : 16; + } B; +} mc33775_balancing_registers_bal_auto_dischrg_ctrl_t; + +/* -------------------------------------------------------------------------- + * BAL_CH_UV0_STAT (read-only):Channel under-voltage balancing status + * -------------------------------------------------------------------------- */ +#define MC33775_BAL_CH_UV0_STAT_OFFSET \ + (0x1009U) +#define MC33775_BAL_CH_UV0_STAT_RW_MSK \ + (0x0U) +#define MC33775_BAL_CH_UV0_STAT_RD_MSK \ + (0x3FFFU) +#define MC33775_BAL_CH_UV0_STAT_WR_MSK \ + (0x0U) +#define MC33775_BAL_CH_UV0_STAT_MW_MSK \ + (0x0U) +#define MC33775_BAL_CH_UV0_STAT_RA_MSK \ + (0x3FFFU) +#define MC33775_BAL_CH_UV0_STAT_POR_MSK \ + (0xffffU) +#define MC33775_BAL_CH_UV0_STAT_POR_VAL \ + (0x0U) + +/* Field CH0: Status bit, if a channel under-voltage condition was the reason for disabling individual balancing of channel 0. */ +#define MC33775_BAL_CH_UV0_STAT_CH0_POS \ + (0U) +#define MC33775_BAL_CH_UV0_STAT_CH0_MSK \ + (0x1U) + +/* Enumerated value NOUV: Balancing of channel 0 was not disabled due to under-voltage condition. */ +#define MC33775_BAL_CH_UV0_STAT_CH0_NOUV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Balancing of channel 0 was disabled due to under-voltage condition. */ +#define MC33775_BAL_CH_UV0_STAT_CH0_UV_ENUM_VAL \ + (1U) + +/* Field CH1: Status bit, if a channel under-voltage condition was the reason for disabling individual balancing of channel 1. */ +#define MC33775_BAL_CH_UV0_STAT_CH1_POS \ + (1U) +#define MC33775_BAL_CH_UV0_STAT_CH1_MSK \ + (0x2U) + +/* Enumerated value NOUV: Balancing of channel 1 was not disabled due to under-voltage condition. */ +#define MC33775_BAL_CH_UV0_STAT_CH1_NOUV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Balancing of channel 1 was disabled due to under-voltage condition. */ +#define MC33775_BAL_CH_UV0_STAT_CH1_UV_ENUM_VAL \ + (1U) + +/* Field CH2: Status bit, if a channel under-voltage condition was the reason for disabling individual balancing of channel 2. */ +#define MC33775_BAL_CH_UV0_STAT_CH2_POS \ + (2U) +#define MC33775_BAL_CH_UV0_STAT_CH2_MSK \ + (0x4U) + +/* Enumerated value NOUV: Balancing of channel 2 was not disabled due to under-voltage condition. */ +#define MC33775_BAL_CH_UV0_STAT_CH2_NOUV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Balancing of channel 2 was disabled due to under-voltage condition. */ +#define MC33775_BAL_CH_UV0_STAT_CH2_UV_ENUM_VAL \ + (1U) + +/* Field CH3: Status bit, if a channel under-voltage condition was the reason for disabling individual balancing of channel 3. */ +#define MC33775_BAL_CH_UV0_STAT_CH3_POS \ + (3U) +#define MC33775_BAL_CH_UV0_STAT_CH3_MSK \ + (0x8U) + +/* Enumerated value NOUV: Balancing of channel 3 was not disabled due to under-voltage condition. */ +#define MC33775_BAL_CH_UV0_STAT_CH3_NOUV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Balancing of channel 3 was disabled due to under-voltage condition. */ +#define MC33775_BAL_CH_UV0_STAT_CH3_UV_ENUM_VAL \ + (1U) + +/* Field CH4: Status bit, if a channel under-voltage condition was the reason for disabling individual balancing of channel 4. */ +#define MC33775_BAL_CH_UV0_STAT_CH4_POS \ + (4U) +#define MC33775_BAL_CH_UV0_STAT_CH4_MSK \ + (0x10U) + +/* Enumerated value NOUV: Balancing of channel 4 was not disabled due to under-voltage condition. */ +#define MC33775_BAL_CH_UV0_STAT_CH4_NOUV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Balancing of channel 4 was disabled due to under-voltage condition. */ +#define MC33775_BAL_CH_UV0_STAT_CH4_UV_ENUM_VAL \ + (1U) + +/* Field CH5: Status bit, if a channel under-voltage condition was the reason for disabling individual balancing of channel 5. */ +#define MC33775_BAL_CH_UV0_STAT_CH5_POS \ + (5U) +#define MC33775_BAL_CH_UV0_STAT_CH5_MSK \ + (0x20U) + +/* Enumerated value NOUV: Balancing of channel 5 was not disabled due to under-voltage condition. */ +#define MC33775_BAL_CH_UV0_STAT_CH5_NOUV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Balancing of channel 5 was disabled due to under-voltage condition. */ +#define MC33775_BAL_CH_UV0_STAT_CH5_UV_ENUM_VAL \ + (1U) + +/* Field CH6: Status bit, if a channel under-voltage condition was the reason for disabling individual balancing of channel 6. */ +#define MC33775_BAL_CH_UV0_STAT_CH6_POS \ + (6U) +#define MC33775_BAL_CH_UV0_STAT_CH6_MSK \ + (0x40U) + +/* Enumerated value NOUV: Balancing of channel 6 was not disabled due to under-voltage condition. */ +#define MC33775_BAL_CH_UV0_STAT_CH6_NOUV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Balancing of channel 6 was disabled due to under-voltage condition. */ +#define MC33775_BAL_CH_UV0_STAT_CH6_UV_ENUM_VAL \ + (1U) + +/* Field CH7: Status bit, if a channel under-voltage condition was the reason for disabling individual balancing of channel 7. */ +#define MC33775_BAL_CH_UV0_STAT_CH7_POS \ + (7U) +#define MC33775_BAL_CH_UV0_STAT_CH7_MSK \ + (0x80U) + +/* Enumerated value NOUV: Balancing of channel 7 was not disabled due to under-voltage condition. */ +#define MC33775_BAL_CH_UV0_STAT_CH7_NOUV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Balancing of channel 7 was disabled due to under-voltage condition. */ +#define MC33775_BAL_CH_UV0_STAT_CH7_UV_ENUM_VAL \ + (1U) + +/* Field CH8: Status bit, if a channel under-voltage condition was the reason for disabling individual balancing of channel 8. */ +#define MC33775_BAL_CH_UV0_STAT_CH8_POS \ + (8U) +#define MC33775_BAL_CH_UV0_STAT_CH8_MSK \ + (0x100U) + +/* Enumerated value NOUV: Balancing of channel 8 was not disabled due to under-voltage condition. */ +#define MC33775_BAL_CH_UV0_STAT_CH8_NOUV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Balancing of channel 8 was disabled due to under-voltage condition. */ +#define MC33775_BAL_CH_UV0_STAT_CH8_UV_ENUM_VAL \ + (1U) + +/* Field CH9: Status bit, if a channel under-voltage condition was the reason for disabling individual balancing of channel 9. */ +#define MC33775_BAL_CH_UV0_STAT_CH9_POS \ + (9U) +#define MC33775_BAL_CH_UV0_STAT_CH9_MSK \ + (0x200U) + +/* Enumerated value NOUV: Balancing of channel 9 was not disabled due to under-voltage condition. */ +#define MC33775_BAL_CH_UV0_STAT_CH9_NOUV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Balancing of channel 9 was disabled due to under-voltage condition. */ +#define MC33775_BAL_CH_UV0_STAT_CH9_UV_ENUM_VAL \ + (1U) + +/* Field CH10: Status bit, if a channel under-voltage condition was the reason for disabling individual balancing of channel 10. */ +#define MC33775_BAL_CH_UV0_STAT_CH10_POS \ + (10U) +#define MC33775_BAL_CH_UV0_STAT_CH10_MSK \ + (0x400U) + +/* Enumerated value NOUV: Balancing of channel 10 was not disabled due to under-voltage condition. */ +#define MC33775_BAL_CH_UV0_STAT_CH10_NOUV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Balancing of channel 10 was disabled due to under-voltage condition. */ +#define MC33775_BAL_CH_UV0_STAT_CH10_UV_ENUM_VAL \ + (1U) + +/* Field CH11: Status bit, if a channel under-voltage condition was the reason for disabling individual balancing of channel 11. */ +#define MC33775_BAL_CH_UV0_STAT_CH11_POS \ + (11U) +#define MC33775_BAL_CH_UV0_STAT_CH11_MSK \ + (0x800U) + +/* Enumerated value NOUV: Balancing of channel 11 was not disabled due to under-voltage condition. */ +#define MC33775_BAL_CH_UV0_STAT_CH11_NOUV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Balancing of channel 11 was disabled due to under-voltage condition. */ +#define MC33775_BAL_CH_UV0_STAT_CH11_UV_ENUM_VAL \ + (1U) + +/* Field CH12: Status bit, if a channel under-voltage condition was the reason for disabling individual balancing of channel 12. */ +#define MC33775_BAL_CH_UV0_STAT_CH12_POS \ + (12U) +#define MC33775_BAL_CH_UV0_STAT_CH12_MSK \ + (0x1000U) + +/* Enumerated value NOUV: Balancing of channel 12 was not disabled due to under-voltage condition. */ +#define MC33775_BAL_CH_UV0_STAT_CH12_NOUV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Balancing of channel 12 was disabled due to under-voltage condition. */ +#define MC33775_BAL_CH_UV0_STAT_CH12_UV_ENUM_VAL \ + (1U) + +/* Field CH13: Status bit, if a channel under-voltage condition was the reason for disabling individual balancing of channel 13. */ +#define MC33775_BAL_CH_UV0_STAT_CH13_POS \ + (13U) +#define MC33775_BAL_CH_UV0_STAT_CH13_MSK \ + (0x2000U) + +/* Enumerated value NOUV: Balancing of channel 13 was not disabled due to under-voltage condition. */ +#define MC33775_BAL_CH_UV0_STAT_CH13_NOUV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Balancing of channel 13 was disabled due to under-voltage condition. */ +#define MC33775_BAL_CH_UV0_STAT_CH13_UV_ENUM_VAL \ + (1U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_BAL_CH_UV0_STAT_RESERVED0_POS \ + (14U) +#define MC33775_BAL_CH_UV0_STAT_RESERVED0_MSK \ + (0xC000U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t CH0 : 1; + volatile uint16_t CH1 : 1; + volatile uint16_t CH2 : 1; + volatile uint16_t CH3 : 1; + volatile uint16_t CH4 : 1; + volatile uint16_t CH5 : 1; + volatile uint16_t CH6 : 1; + volatile uint16_t CH7 : 1; + volatile uint16_t CH8 : 1; + volatile uint16_t CH9 : 1; + volatile uint16_t CH10 : 1; + volatile uint16_t CH11 : 1; + volatile uint16_t CH12 : 1; + volatile uint16_t CH13 : 1; + volatile uint16_t reserved0 : 2; + } B; +} mc33775_balancing_registers_bal_ch_uv0_stat_t; + +/* -------------------------------------------------------------------------- + * BAL_GLOB_UV1_STAT (read-only):Global under-voltage balancing status + * -------------------------------------------------------------------------- */ +#define MC33775_BAL_GLOB_UV1_STAT_OFFSET \ + (0x100AU) +#define MC33775_BAL_GLOB_UV1_STAT_RW_MSK \ + (0x0U) +#define MC33775_BAL_GLOB_UV1_STAT_RD_MSK \ + (0x3FFFU) +#define MC33775_BAL_GLOB_UV1_STAT_WR_MSK \ + (0x0U) +#define MC33775_BAL_GLOB_UV1_STAT_MW_MSK \ + (0x0U) +#define MC33775_BAL_GLOB_UV1_STAT_RA_MSK \ + (0x3FFFU) +#define MC33775_BAL_GLOB_UV1_STAT_POR_MSK \ + (0xffffU) +#define MC33775_BAL_GLOB_UV1_STAT_POR_VAL \ + (0x0U) + +/* Field CH0: Status bit, if a global under-voltage of channel 0 condition was the reason for disabling the global balancing: */ +#define MC33775_BAL_GLOB_UV1_STAT_CH0_POS \ + (0U) +#define MC33775_BAL_GLOB_UV1_STAT_CH0_MSK \ + (0x1U) + +/* Enumerated value NOUV: Balancing of channel 0 was not disabled due to global under-voltage condition. */ +#define MC33775_BAL_GLOB_UV1_STAT_CH0_NOUV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Balancing of channel 0 was disabled due to global under-voltage condition. */ +#define MC33775_BAL_GLOB_UV1_STAT_CH0_UV_ENUM_VAL \ + (1U) + +/* Field CH1: Status bit, if a global under-voltage of channel 1 condition was the reason for disabling the global balancing: */ +#define MC33775_BAL_GLOB_UV1_STAT_CH1_POS \ + (1U) +#define MC33775_BAL_GLOB_UV1_STAT_CH1_MSK \ + (0x2U) + +/* Enumerated value NOUV: Balancing of channel 1 was not disabled due to global under-voltage condition. */ +#define MC33775_BAL_GLOB_UV1_STAT_CH1_NOUV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Balancing of channel 1 was disabled due to global under-voltage condition. */ +#define MC33775_BAL_GLOB_UV1_STAT_CH1_UV_ENUM_VAL \ + (1U) + +/* Field CH2: Status bit, if a global under-voltage of channel 2 condition was the reason for disabling the global balancing: */ +#define MC33775_BAL_GLOB_UV1_STAT_CH2_POS \ + (2U) +#define MC33775_BAL_GLOB_UV1_STAT_CH2_MSK \ + (0x4U) + +/* Enumerated value NOUV: Balancing of channel 2 was not disabled due to global under-voltage condition. */ +#define MC33775_BAL_GLOB_UV1_STAT_CH2_NOUV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Balancing of channel 2 was disabled due to global under-voltage condition. */ +#define MC33775_BAL_GLOB_UV1_STAT_CH2_UV_ENUM_VAL \ + (1U) + +/* Field CH3: Status bit, if a global under-voltage of channel 3 condition was the reason for disabling the global balancing: */ +#define MC33775_BAL_GLOB_UV1_STAT_CH3_POS \ + (3U) +#define MC33775_BAL_GLOB_UV1_STAT_CH3_MSK \ + (0x8U) + +/* Enumerated value NOUV: Balancing of channel 3 was not disabled due to global under-voltage condition. */ +#define MC33775_BAL_GLOB_UV1_STAT_CH3_NOUV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Balancing of channel 3 was disabled due to global under-voltage condition. */ +#define MC33775_BAL_GLOB_UV1_STAT_CH3_UV_ENUM_VAL \ + (1U) + +/* Field CH4: Status bit, if a global under-voltage of channel 4 condition was the reason for disabling the global balancing: */ +#define MC33775_BAL_GLOB_UV1_STAT_CH4_POS \ + (4U) +#define MC33775_BAL_GLOB_UV1_STAT_CH4_MSK \ + (0x10U) + +/* Enumerated value NOUV: Balancing of channel 4 was not disabled due to global under-voltage condition. */ +#define MC33775_BAL_GLOB_UV1_STAT_CH4_NOUV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Balancing of channel 4 was disabled due to global under-voltage condition. */ +#define MC33775_BAL_GLOB_UV1_STAT_CH4_UV_ENUM_VAL \ + (1U) + +/* Field CH5: Status bit, if a global under-voltage of channel 5 condition was the reason for disabling the global balancing: */ +#define MC33775_BAL_GLOB_UV1_STAT_CH5_POS \ + (5U) +#define MC33775_BAL_GLOB_UV1_STAT_CH5_MSK \ + (0x20U) + +/* Enumerated value NOUV: Balancing of channel 5 was not disabled due to global under-voltage condition. */ +#define MC33775_BAL_GLOB_UV1_STAT_CH5_NOUV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Balancing of channel 5 was disabled due to global under-voltage condition. */ +#define MC33775_BAL_GLOB_UV1_STAT_CH5_UV_ENUM_VAL \ + (1U) + +/* Field CH6: Status bit, if a global under-voltage of channel 6 condition was the reason for disabling the global balancing: */ +#define MC33775_BAL_GLOB_UV1_STAT_CH6_POS \ + (6U) +#define MC33775_BAL_GLOB_UV1_STAT_CH6_MSK \ + (0x40U) + +/* Enumerated value NOUV: Balancing of channel 6 was not disabled due to global under-voltage condition. */ +#define MC33775_BAL_GLOB_UV1_STAT_CH6_NOUV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Balancing of channel 6 was disabled due to global under-voltage condition. */ +#define MC33775_BAL_GLOB_UV1_STAT_CH6_UV_ENUM_VAL \ + (1U) + +/* Field CH7: Status bit, if a global under-voltage of channel 7 condition was the reason for disabling the global balancing: */ +#define MC33775_BAL_GLOB_UV1_STAT_CH7_POS \ + (7U) +#define MC33775_BAL_GLOB_UV1_STAT_CH7_MSK \ + (0x80U) + +/* Enumerated value NOUV: Balancing of channel 7 was not disabled due to global under-voltage condition. */ +#define MC33775_BAL_GLOB_UV1_STAT_CH7_NOUV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Balancing of channel 7 was disabled due to global under-voltage condition. */ +#define MC33775_BAL_GLOB_UV1_STAT_CH7_UV_ENUM_VAL \ + (1U) + +/* Field CH8: Status bit, if a global under-voltage of channel 8 condition was the reason for disabling the global balancing: */ +#define MC33775_BAL_GLOB_UV1_STAT_CH8_POS \ + (8U) +#define MC33775_BAL_GLOB_UV1_STAT_CH8_MSK \ + (0x100U) + +/* Enumerated value NOUV: Balancing of channel 8 was not disabled due to global under-voltage condition. */ +#define MC33775_BAL_GLOB_UV1_STAT_CH8_NOUV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Balancing of channel 8 was disabled due to global under-voltage condition. */ +#define MC33775_BAL_GLOB_UV1_STAT_CH8_UV_ENUM_VAL \ + (1U) + +/* Field CH9: Status bit, if a global under-voltage of channel 9 condition was the reason for disabling the global balancing: */ +#define MC33775_BAL_GLOB_UV1_STAT_CH9_POS \ + (9U) +#define MC33775_BAL_GLOB_UV1_STAT_CH9_MSK \ + (0x200U) + +/* Enumerated value NOUV: Balancing of channel 9 was not disabled due to global under-voltage condition. */ +#define MC33775_BAL_GLOB_UV1_STAT_CH9_NOUV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Balancing of channel 9 was disabled due to global under-voltage condition. */ +#define MC33775_BAL_GLOB_UV1_STAT_CH9_UV_ENUM_VAL \ + (1U) + +/* Field CH10: Status bit, if a global under-voltage of channel 10 condition was the reason for disabling the global balancing: */ +#define MC33775_BAL_GLOB_UV1_STAT_CH10_POS \ + (10U) +#define MC33775_BAL_GLOB_UV1_STAT_CH10_MSK \ + (0x400U) + +/* Enumerated value NOUV: Balancing of channel 10 was not disabled due to global under-voltage condition. */ +#define MC33775_BAL_GLOB_UV1_STAT_CH10_NOUV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Balancing of channel 10 was disabled due to global under-voltage condition. */ +#define MC33775_BAL_GLOB_UV1_STAT_CH10_UV_ENUM_VAL \ + (1U) + +/* Field CH11: Status bit, if a global under-voltage of channel 11 condition was the reason for disabling the global balancing: */ +#define MC33775_BAL_GLOB_UV1_STAT_CH11_POS \ + (11U) +#define MC33775_BAL_GLOB_UV1_STAT_CH11_MSK \ + (0x800U) + +/* Enumerated value NOUV: Balancing of channel 11 was not disabled due to global under-voltage condition. */ +#define MC33775_BAL_GLOB_UV1_STAT_CH11_NOUV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Balancing of channel 11 was disabled due to global under-voltage condition. */ +#define MC33775_BAL_GLOB_UV1_STAT_CH11_UV_ENUM_VAL \ + (1U) + +/* Field CH12: Status bit, if a global under-voltage of channel 12 condition was the reason for disabling the global balancing: */ +#define MC33775_BAL_GLOB_UV1_STAT_CH12_POS \ + (12U) +#define MC33775_BAL_GLOB_UV1_STAT_CH12_MSK \ + (0x1000U) + +/* Enumerated value NOUV: Balancing of channel 12 was not disabled due to global under-voltage condition. */ +#define MC33775_BAL_GLOB_UV1_STAT_CH12_NOUV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Balancing of channel 12 was disabled due to global under-voltage condition. */ +#define MC33775_BAL_GLOB_UV1_STAT_CH12_UV_ENUM_VAL \ + (1U) + +/* Field CH13: Status bit, if a global under-voltage of channel 13 condition was the reason for disabling the global balancing: */ +#define MC33775_BAL_GLOB_UV1_STAT_CH13_POS \ + (13U) +#define MC33775_BAL_GLOB_UV1_STAT_CH13_MSK \ + (0x2000U) + +/* Enumerated value NOUV: Balancing of channel 13 was not disabled due to global under-voltage condition. */ +#define MC33775_BAL_GLOB_UV1_STAT_CH13_NOUV_ENUM_VAL \ + (0U) + +/* Enumerated value UV: Balancing of channel 13 was disabled due to global under-voltage condition. */ +#define MC33775_BAL_GLOB_UV1_STAT_CH13_UV_ENUM_VAL \ + (1U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_BAL_GLOB_UV1_STAT_RESERVED0_POS \ + (14U) +#define MC33775_BAL_GLOB_UV1_STAT_RESERVED0_MSK \ + (0xC000U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t CH0 : 1; + volatile uint16_t CH1 : 1; + volatile uint16_t CH2 : 1; + volatile uint16_t CH3 : 1; + volatile uint16_t CH4 : 1; + volatile uint16_t CH5 : 1; + volatile uint16_t CH6 : 1; + volatile uint16_t CH7 : 1; + volatile uint16_t CH8 : 1; + volatile uint16_t CH9 : 1; + volatile uint16_t CH10 : 1; + volatile uint16_t CH11 : 1; + volatile uint16_t CH12 : 1; + volatile uint16_t CH13 : 1; + volatile uint16_t reserved0 : 2; + } B; +} mc33775_balancing_registers_bal_glob_uv1_stat_t; + +/* -------------------------------------------------------------------------- + * BAL_STAT0 (read-only):Logical balancing channel status + * -------------------------------------------------------------------------- */ +#define MC33775_BAL_STAT0_OFFSET \ + (0x100BU) +#define MC33775_BAL_STAT0_RW_MSK \ + (0x0U) +#define MC33775_BAL_STAT0_RD_MSK \ + (0x3FFFU) +#define MC33775_BAL_STAT0_WR_MSK \ + (0x0U) +#define MC33775_BAL_STAT0_MW_MSK \ + (0x0U) +#define MC33775_BAL_STAT0_RA_MSK \ + (0x0U) +#define MC33775_BAL_STAT0_POR_MSK \ + (0xffffU) +#define MC33775_BAL_STAT0_POR_VAL \ + (0x0U) + +/* Field CH0: Balancing channel 0 status (without PWM) */ +#define MC33775_BAL_STAT0_CH0_POS \ + (0U) +#define MC33775_BAL_STAT0_CH0_MSK \ + (0x1U) + +/* Enumerated value INACTIVE: Balancing for channel 0 inactive. */ +#define MC33775_BAL_STAT0_CH0_INACTIVE_ENUM_VAL \ + (0U) + +/* Enumerated value ACTIVE: Balancing for channel 0 active. */ +#define MC33775_BAL_STAT0_CH0_ACTIVE_ENUM_VAL \ + (1U) + +/* Field CH1: Balancing channel 1 status (without PWM) */ +#define MC33775_BAL_STAT0_CH1_POS \ + (1U) +#define MC33775_BAL_STAT0_CH1_MSK \ + (0x2U) + +/* Enumerated value INACTIVE: Balancing for channel 1 inactive. */ +#define MC33775_BAL_STAT0_CH1_INACTIVE_ENUM_VAL \ + (0U) + +/* Enumerated value ACTIVE: Balancing for channel 1 active. */ +#define MC33775_BAL_STAT0_CH1_ACTIVE_ENUM_VAL \ + (1U) + +/* Field CH2: Balancing channel 2 status (without PWM) */ +#define MC33775_BAL_STAT0_CH2_POS \ + (2U) +#define MC33775_BAL_STAT0_CH2_MSK \ + (0x4U) + +/* Enumerated value INACTIVE: Balancing for channel 2 inactive. */ +#define MC33775_BAL_STAT0_CH2_INACTIVE_ENUM_VAL \ + (0U) + +/* Enumerated value ACTIVE: Balancing for channel 2 active. */ +#define MC33775_BAL_STAT0_CH2_ACTIVE_ENUM_VAL \ + (1U) + +/* Field CH3: Balancing channel 3 status (without PWM) */ +#define MC33775_BAL_STAT0_CH3_POS \ + (3U) +#define MC33775_BAL_STAT0_CH3_MSK \ + (0x8U) + +/* Enumerated value INACTIVE: Balancing for channel 3 inactive. */ +#define MC33775_BAL_STAT0_CH3_INACTIVE_ENUM_VAL \ + (0U) + +/* Enumerated value ACTIVE: Balancing for channel 3 active. */ +#define MC33775_BAL_STAT0_CH3_ACTIVE_ENUM_VAL \ + (1U) + +/* Field CH4: Balancing channel 4 status (without PWM) */ +#define MC33775_BAL_STAT0_CH4_POS \ + (4U) +#define MC33775_BAL_STAT0_CH4_MSK \ + (0x10U) + +/* Enumerated value INACTIVE: Balancing for channel 4 inactive. */ +#define MC33775_BAL_STAT0_CH4_INACTIVE_ENUM_VAL \ + (0U) + +/* Enumerated value ACTIVE: Balancing for channel 4 active. */ +#define MC33775_BAL_STAT0_CH4_ACTIVE_ENUM_VAL \ + (1U) + +/* Field CH5: Balancing channel 5 status (without PWM) */ +#define MC33775_BAL_STAT0_CH5_POS \ + (5U) +#define MC33775_BAL_STAT0_CH5_MSK \ + (0x20U) + +/* Enumerated value INACTIVE: Balancing for channel 5 inactive. */ +#define MC33775_BAL_STAT0_CH5_INACTIVE_ENUM_VAL \ + (0U) + +/* Enumerated value ACTIVE: Balancing for channel 5 active. */ +#define MC33775_BAL_STAT0_CH5_ACTIVE_ENUM_VAL \ + (1U) + +/* Field CH6: Balancing channel 6 status (without PWM) */ +#define MC33775_BAL_STAT0_CH6_POS \ + (6U) +#define MC33775_BAL_STAT0_CH6_MSK \ + (0x40U) + +/* Enumerated value INACTIVE: Balancing for channel 6 inactive. */ +#define MC33775_BAL_STAT0_CH6_INACTIVE_ENUM_VAL \ + (0U) + +/* Enumerated value ACTIVE: Balancing for channel 6 active. */ +#define MC33775_BAL_STAT0_CH6_ACTIVE_ENUM_VAL \ + (1U) + +/* Field CH7: Balancing channel 7 status (without PWM) */ +#define MC33775_BAL_STAT0_CH7_POS \ + (7U) +#define MC33775_BAL_STAT0_CH7_MSK \ + (0x80U) + +/* Enumerated value INACTIVE: Balancing for channel 7 inactive. */ +#define MC33775_BAL_STAT0_CH7_INACTIVE_ENUM_VAL \ + (0U) + +/* Enumerated value ACTIVE: Balancing for channel 7 active. */ +#define MC33775_BAL_STAT0_CH7_ACTIVE_ENUM_VAL \ + (1U) + +/* Field CH8: Balancing channel 8 status (without PWM) */ +#define MC33775_BAL_STAT0_CH8_POS \ + (8U) +#define MC33775_BAL_STAT0_CH8_MSK \ + (0x100U) + +/* Enumerated value INACTIVE: Balancing for channel 8 inactive. */ +#define MC33775_BAL_STAT0_CH8_INACTIVE_ENUM_VAL \ + (0U) + +/* Enumerated value ACTIVE: Balancing for channel 8 active. */ +#define MC33775_BAL_STAT0_CH8_ACTIVE_ENUM_VAL \ + (1U) + +/* Field CH9: Balancing channel 9 status (without PWM) */ +#define MC33775_BAL_STAT0_CH9_POS \ + (9U) +#define MC33775_BAL_STAT0_CH9_MSK \ + (0x200U) + +/* Enumerated value INACTIVE: Balancing for channel 9 inactive. */ +#define MC33775_BAL_STAT0_CH9_INACTIVE_ENUM_VAL \ + (0U) + +/* Enumerated value ACTIVE: Balancing for channel 9 active. */ +#define MC33775_BAL_STAT0_CH9_ACTIVE_ENUM_VAL \ + (1U) + +/* Field CH10: Balancing channel 10 status (without PWM) */ +#define MC33775_BAL_STAT0_CH10_POS \ + (10U) +#define MC33775_BAL_STAT0_CH10_MSK \ + (0x400U) + +/* Enumerated value INACTIVE: Balancing for channel 10 inactive. */ +#define MC33775_BAL_STAT0_CH10_INACTIVE_ENUM_VAL \ + (0U) + +/* Enumerated value ACTIVE: Balancing for channel 10 active. */ +#define MC33775_BAL_STAT0_CH10_ACTIVE_ENUM_VAL \ + (1U) + +/* Field CH11: Balancing channel 11 status (without PWM) */ +#define MC33775_BAL_STAT0_CH11_POS \ + (11U) +#define MC33775_BAL_STAT0_CH11_MSK \ + (0x800U) + +/* Enumerated value INACTIVE: Balancing for channel 11 inactive. */ +#define MC33775_BAL_STAT0_CH11_INACTIVE_ENUM_VAL \ + (0U) + +/* Enumerated value ACTIVE: Balancing for channel 11 active. */ +#define MC33775_BAL_STAT0_CH11_ACTIVE_ENUM_VAL \ + (1U) + +/* Field CH12: Balancing channel 12 status (without PWM) */ +#define MC33775_BAL_STAT0_CH12_POS \ + (12U) +#define MC33775_BAL_STAT0_CH12_MSK \ + (0x1000U) + +/* Enumerated value INACTIVE: Balancing for channel 12 inactive. */ +#define MC33775_BAL_STAT0_CH12_INACTIVE_ENUM_VAL \ + (0U) + +/* Enumerated value ACTIVE: Balancing for channel 12 active. */ +#define MC33775_BAL_STAT0_CH12_ACTIVE_ENUM_VAL \ + (1U) + +/* Field CH13: Balancing channel 13 status (without PWM) */ +#define MC33775_BAL_STAT0_CH13_POS \ + (13U) +#define MC33775_BAL_STAT0_CH13_MSK \ + (0x2000U) + +/* Enumerated value INACTIVE: Balancing for channel 13 inactive. */ +#define MC33775_BAL_STAT0_CH13_INACTIVE_ENUM_VAL \ + (0U) + +/* Enumerated value ACTIVE: Balancing for channel 13 active. */ +#define MC33775_BAL_STAT0_CH13_ACTIVE_ENUM_VAL \ + (1U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_BAL_STAT0_RESERVED0_POS \ + (14U) +#define MC33775_BAL_STAT0_RESERVED0_MSK \ + (0xC000U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t CH0 : 1; + volatile uint16_t CH1 : 1; + volatile uint16_t CH2 : 1; + volatile uint16_t CH3 : 1; + volatile uint16_t CH4 : 1; + volatile uint16_t CH5 : 1; + volatile uint16_t CH6 : 1; + volatile uint16_t CH7 : 1; + volatile uint16_t CH8 : 1; + volatile uint16_t CH9 : 1; + volatile uint16_t CH10 : 1; + volatile uint16_t CH11 : 1; + volatile uint16_t CH12 : 1; + volatile uint16_t CH13 : 1; + volatile uint16_t reserved0 : 2; + } B; +} mc33775_balancing_registers_bal_stat0_t; + +/* -------------------------------------------------------------------------- + * BAL_STAT1 (read-only):Balancing status + * -------------------------------------------------------------------------- */ +#define MC33775_BAL_STAT1_OFFSET \ + (0x100CU) +#define MC33775_BAL_STAT1_RW_MSK \ + (0x0U) +#define MC33775_BAL_STAT1_RD_MSK \ + (0x8007U) +#define MC33775_BAL_STAT1_WR_MSK \ + (0x0U) +#define MC33775_BAL_STAT1_MW_MSK \ + (0x0U) +#define MC33775_BAL_STAT1_RA_MSK \ + (0x8000U) +#define MC33775_BAL_STAT1_POR_MSK \ + (0xffffU) +#define MC33775_BAL_STAT1_POR_VAL \ + (0x0U) + +/* Field PREBALTMR: Pre-Balancing status */ +#define MC33775_BAL_STAT1_PREBALTMR_POS \ + (0U) +#define MC33775_BAL_STAT1_PREBALTMR_MSK \ + (0x1U) + +/* Enumerated value INACTIVE: No pre-balancing timer active. */ +#define MC33775_BAL_STAT1_PREBALTMR_INACTIVE_ENUM_VAL \ + (0U) + +/* Enumerated value ACTIVE: Pre-balancing timer active (Balancing is inhibited). */ +#define MC33775_BAL_STAT1_PREBALTMR_ACTIVE_ENUM_VAL \ + (1U) + +/* Field TEMPBALINHIBIT: Temperature balancing status */ +#define MC33775_BAL_STAT1_TEMPBALINHIBIT_POS \ + (1U) +#define MC33775_BAL_STAT1_TEMPBALINHIBIT_MSK \ + (0x2U) + +/* Enumerated value INACTIVE: Temperature based balancing control allows balancing. */ +#define MC33775_BAL_STAT1_TEMPBALINHIBIT_INACTIVE_ENUM_VAL \ + (0U) + +/* Enumerated value ACTIVE: Temperature based balancing control inhibits balancing. */ +#define MC33775_BAL_STAT1_TEMPBALINHIBIT_ACTIVE_ENUM_VAL \ + (1U) + +/* Field AUTODISCHRG: Auto discharge status */ +#define MC33775_BAL_STAT1_AUTODISCHRG_POS \ + (2U) +#define MC33775_BAL_STAT1_AUTODISCHRG_MSK \ + (0x4U) + +/* Enumerated value INACTIVE: Auto discharge inactive */ +#define MC33775_BAL_STAT1_AUTODISCHRG_INACTIVE_ENUM_VAL \ + (0U) + +/* Enumerated value ACTIVE: Auto discharge active */ +#define MC33775_BAL_STAT1_AUTODISCHRG_ACTIVE_ENUM_VAL \ + (1U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_BAL_STAT1_RESERVED0_POS \ + (3U) +#define MC33775_BAL_STAT1_RESERVED0_MSK \ + (0x7FF8U) + +/* Field RDY: The ready bit is set after the cell balancing operation is finished. Reasons for this are that the last BAL_CH_EN.CHx has been cleared by hardware or the BAL_GLOB_CFG.BALEN has been cleared by hardware. With setting of BAL_GLOB_CFG.BALEN this bit is cleared. */ +#define MC33775_BAL_STAT1_RDY_POS \ + (15U) +#define MC33775_BAL_STAT1_RDY_MSK \ + (0x8000U) + +/* Enumerated value ONGOING: Balancing operation in progress. */ +#define MC33775_BAL_STAT1_RDY_ONGOING_ENUM_VAL \ + (0U) + +/* Enumerated value FINISHED: Balancing operation finished. */ +#define MC33775_BAL_STAT1_RDY_FINISHED_ENUM_VAL \ + (1U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t PREBALTMR : 1; + volatile uint16_t TEMPBALINHIBIT : 1; + volatile uint16_t AUTODISCHRG : 1; + volatile uint16_t reserved0 : 12; + volatile uint16_t RDY : 1; + } B; +} mc33775_balancing_registers_bal_stat1_t; + +/* -------------------------------------------------------------------------- + * BAL_SWITCH_STAT (read-only):Physical balancing channel status + * -------------------------------------------------------------------------- */ +#define MC33775_BAL_SWITCH_STAT_OFFSET \ + (0x100DU) +#define MC33775_BAL_SWITCH_STAT_RW_MSK \ + (0x0U) +#define MC33775_BAL_SWITCH_STAT_RD_MSK \ + (0x3FFFU) +#define MC33775_BAL_SWITCH_STAT_WR_MSK \ + (0x0U) +#define MC33775_BAL_SWITCH_STAT_MW_MSK \ + (0x0U) +#define MC33775_BAL_SWITCH_STAT_RA_MSK \ + (0x0U) +#define MC33775_BAL_SWITCH_STAT_POR_MSK \ + (0xffffU) +#define MC33775_BAL_SWITCH_STAT_POR_VAL \ + (0x0U) + +/* Field CH0: Balancing FET status channel 0 This is the actual status (including PWM modulation) from the switch monitor circuit. */ +#define MC33775_BAL_SWITCH_STAT_CH0_POS \ + (0U) +#define MC33775_BAL_SWITCH_STAT_CH0_MSK \ + (0x1U) + +/* Enumerated value OPEN: Balancing FET is open. */ +#define MC33775_BAL_SWITCH_STAT_CH0_OPEN_ENUM_VAL \ + (0U) + +/* Enumerated value CLOSED: Balancing FET is closed. */ +#define MC33775_BAL_SWITCH_STAT_CH0_CLOSED_ENUM_VAL \ + (1U) + +/* Field CH1: Balancing FET status channel 1 This is the actual status (including PWM modulation) from the switch monitor circuit. */ +#define MC33775_BAL_SWITCH_STAT_CH1_POS \ + (1U) +#define MC33775_BAL_SWITCH_STAT_CH1_MSK \ + (0x2U) + +/* Enumerated value OPEN: Balancing FET is open. */ +#define MC33775_BAL_SWITCH_STAT_CH1_OPEN_ENUM_VAL \ + (0U) + +/* Enumerated value CLOSED: Balancing FET is closed. */ +#define MC33775_BAL_SWITCH_STAT_CH1_CLOSED_ENUM_VAL \ + (1U) + +/* Field CH2: Balancing FET status channel 2 This is the actual status (including PWM modulation) from the switch monitor circuit. */ +#define MC33775_BAL_SWITCH_STAT_CH2_POS \ + (2U) +#define MC33775_BAL_SWITCH_STAT_CH2_MSK \ + (0x4U) + +/* Enumerated value OPEN: Balancing FET is open. */ +#define MC33775_BAL_SWITCH_STAT_CH2_OPEN_ENUM_VAL \ + (0U) + +/* Enumerated value CLOSED: Balancing FET is closed. */ +#define MC33775_BAL_SWITCH_STAT_CH2_CLOSED_ENUM_VAL \ + (1U) + +/* Field CH3: Balancing FET status channel 3 This is the actual status (including PWM modulation) from the switch monitor circuit. */ +#define MC33775_BAL_SWITCH_STAT_CH3_POS \ + (3U) +#define MC33775_BAL_SWITCH_STAT_CH3_MSK \ + (0x8U) + +/* Enumerated value OPEN: Balancing FET is open. */ +#define MC33775_BAL_SWITCH_STAT_CH3_OPEN_ENUM_VAL \ + (0U) + +/* Enumerated value CLOSED: Balancing FET is closed. */ +#define MC33775_BAL_SWITCH_STAT_CH3_CLOSED_ENUM_VAL \ + (1U) + +/* Field CH4: Balancing FET status channel 4 This is the actual status (including PWM modulation) from the switch monitor circuit. */ +#define MC33775_BAL_SWITCH_STAT_CH4_POS \ + (4U) +#define MC33775_BAL_SWITCH_STAT_CH4_MSK \ + (0x10U) + +/* Enumerated value OPEN: Balancing FET is open. */ +#define MC33775_BAL_SWITCH_STAT_CH4_OPEN_ENUM_VAL \ + (0U) + +/* Enumerated value CLOSED: Balancing FET is closed. */ +#define MC33775_BAL_SWITCH_STAT_CH4_CLOSED_ENUM_VAL \ + (1U) + +/* Field CH5: Balancing FET status channel 5 This is the actual status (including PWM modulation) from the switch monitor circuit. */ +#define MC33775_BAL_SWITCH_STAT_CH5_POS \ + (5U) +#define MC33775_BAL_SWITCH_STAT_CH5_MSK \ + (0x20U) + +/* Enumerated value OPEN: Balancing FET is open. */ +#define MC33775_BAL_SWITCH_STAT_CH5_OPEN_ENUM_VAL \ + (0U) + +/* Enumerated value CLOSED: Balancing FET is closed. */ +#define MC33775_BAL_SWITCH_STAT_CH5_CLOSED_ENUM_VAL \ + (1U) + +/* Field CH6: Balancing FET status channel 6 This is the actual status (including PWM modulation) from the switch monitor circuit. */ +#define MC33775_BAL_SWITCH_STAT_CH6_POS \ + (6U) +#define MC33775_BAL_SWITCH_STAT_CH6_MSK \ + (0x40U) + +/* Enumerated value OPEN: Balancing FET is open. */ +#define MC33775_BAL_SWITCH_STAT_CH6_OPEN_ENUM_VAL \ + (0U) + +/* Enumerated value CLOSED: Balancing FET is closed. */ +#define MC33775_BAL_SWITCH_STAT_CH6_CLOSED_ENUM_VAL \ + (1U) + +/* Field CH7: Balancing FET status channel 7 This is the actual status (including PWM modulation) from the switch monitor circuit. */ +#define MC33775_BAL_SWITCH_STAT_CH7_POS \ + (7U) +#define MC33775_BAL_SWITCH_STAT_CH7_MSK \ + (0x80U) + +/* Enumerated value OPEN: Balancing FET is open. */ +#define MC33775_BAL_SWITCH_STAT_CH7_OPEN_ENUM_VAL \ + (0U) + +/* Enumerated value CLOSED: Balancing FET is closed. */ +#define MC33775_BAL_SWITCH_STAT_CH7_CLOSED_ENUM_VAL \ + (1U) + +/* Field CH8: Balancing FET status channel 8 This is the actual status (including PWM modulation) from the switch monitor circuit. */ +#define MC33775_BAL_SWITCH_STAT_CH8_POS \ + (8U) +#define MC33775_BAL_SWITCH_STAT_CH8_MSK \ + (0x100U) + +/* Enumerated value OPEN: Balancing FET is open. */ +#define MC33775_BAL_SWITCH_STAT_CH8_OPEN_ENUM_VAL \ + (0U) + +/* Enumerated value CLOSED: Balancing FET is closed. */ +#define MC33775_BAL_SWITCH_STAT_CH8_CLOSED_ENUM_VAL \ + (1U) + +/* Field CH9: Balancing FET status channel 9 This is the actual status (including PWM modulation) from the switch monitor circuit. */ +#define MC33775_BAL_SWITCH_STAT_CH9_POS \ + (9U) +#define MC33775_BAL_SWITCH_STAT_CH9_MSK \ + (0x200U) + +/* Enumerated value OPEN: Balancing FET is open. */ +#define MC33775_BAL_SWITCH_STAT_CH9_OPEN_ENUM_VAL \ + (0U) + +/* Enumerated value CLOSED: Balancing FET is closed. */ +#define MC33775_BAL_SWITCH_STAT_CH9_CLOSED_ENUM_VAL \ + (1U) + +/* Field CH10: Balancing FET status channel 10 This is the actual status (including PWM modulation) from the switch monitor circuit. */ +#define MC33775_BAL_SWITCH_STAT_CH10_POS \ + (10U) +#define MC33775_BAL_SWITCH_STAT_CH10_MSK \ + (0x400U) + +/* Enumerated value OPEN: Balancing FET is open. */ +#define MC33775_BAL_SWITCH_STAT_CH10_OPEN_ENUM_VAL \ + (0U) + +/* Enumerated value CLOSED: Balancing FET is closed. */ +#define MC33775_BAL_SWITCH_STAT_CH10_CLOSED_ENUM_VAL \ + (1U) + +/* Field CH11: Balancing FET status channel 11 This is the actual status (including PWM modulation) from the switch monitor circuit. */ +#define MC33775_BAL_SWITCH_STAT_CH11_POS \ + (11U) +#define MC33775_BAL_SWITCH_STAT_CH11_MSK \ + (0x800U) + +/* Enumerated value OPEN: Balancing FET is open. */ +#define MC33775_BAL_SWITCH_STAT_CH11_OPEN_ENUM_VAL \ + (0U) + +/* Enumerated value CLOSED: Balancing FET is closed. */ +#define MC33775_BAL_SWITCH_STAT_CH11_CLOSED_ENUM_VAL \ + (1U) + +/* Field CH12: Balancing FET status channel 12 This is the actual status (including PWM modulation) from the switch monitor circuit. */ +#define MC33775_BAL_SWITCH_STAT_CH12_POS \ + (12U) +#define MC33775_BAL_SWITCH_STAT_CH12_MSK \ + (0x1000U) + +/* Enumerated value OPEN: Balancing FET is open. */ +#define MC33775_BAL_SWITCH_STAT_CH12_OPEN_ENUM_VAL \ + (0U) + +/* Enumerated value CLOSED: Balancing FET is closed. */ +#define MC33775_BAL_SWITCH_STAT_CH12_CLOSED_ENUM_VAL \ + (1U) + +/* Field CH13: Balancing FET status channel 13 This is the actual status (including PWM modulation) from the switch monitor circuit. */ +#define MC33775_BAL_SWITCH_STAT_CH13_POS \ + (13U) +#define MC33775_BAL_SWITCH_STAT_CH13_MSK \ + (0x2000U) + +/* Enumerated value OPEN: Balancing FET is open. */ +#define MC33775_BAL_SWITCH_STAT_CH13_OPEN_ENUM_VAL \ + (0U) + +/* Enumerated value CLOSED: Balancing FET is closed. */ +#define MC33775_BAL_SWITCH_STAT_CH13_CLOSED_ENUM_VAL \ + (1U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_BAL_SWITCH_STAT_RESERVED0_POS \ + (14U) +#define MC33775_BAL_SWITCH_STAT_RESERVED0_MSK \ + (0xC000U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t CH0 : 1; + volatile uint16_t CH1 : 1; + volatile uint16_t CH2 : 1; + volatile uint16_t CH3 : 1; + volatile uint16_t CH4 : 1; + volatile uint16_t CH5 : 1; + volatile uint16_t CH6 : 1; + volatile uint16_t CH7 : 1; + volatile uint16_t CH8 : 1; + volatile uint16_t CH9 : 1; + volatile uint16_t CH10 : 1; + volatile uint16_t CH11 : 1; + volatile uint16_t CH12 : 1; + volatile uint16_t CH13 : 1; + volatile uint16_t reserved0 : 2; + } B; +} mc33775_balancing_registers_bal_switch_stat_t; + +/* -------------------------------------------------------------------------- + * BAL_SWITCH_FLT_STAT (read-only):Balancing switch fault + * -------------------------------------------------------------------------- */ +#define MC33775_BAL_SWITCH_FLT_STAT_OFFSET \ + (0x100EU) +#define MC33775_BAL_SWITCH_FLT_STAT_RW_MSK \ + (0x0U) +#define MC33775_BAL_SWITCH_FLT_STAT_RD_MSK \ + (0x3FFFU) +#define MC33775_BAL_SWITCH_FLT_STAT_WR_MSK \ + (0x0U) +#define MC33775_BAL_SWITCH_FLT_STAT_MW_MSK \ + (0x0U) +#define MC33775_BAL_SWITCH_FLT_STAT_RA_MSK \ + (0x3FFFU) +#define MC33775_BAL_SWITCH_FLT_STAT_POR_MSK \ + (0xffffU) +#define MC33775_BAL_SWITCH_FLT_STAT_POR_VAL \ + (0x0U) + +/* Field CH0: Balancing switch fault channel 0. Physical state of the Balancing circuit has differed from the expected one. This could be due to a broken switch, leakages or over current. */ +#define MC33775_BAL_SWITCH_FLT_STAT_CH0_POS \ + (0U) +#define MC33775_BAL_SWITCH_FLT_STAT_CH0_MSK \ + (0x1U) + +/* Enumerated value NOFLT: No fault detected. */ +#define MC33775_BAL_SWITCH_FLT_STAT_CH0_NOFLT_ENUM_VAL \ + (0U) + +/* Enumerated value FAULT: Wrong switch state has been detected. */ +#define MC33775_BAL_SWITCH_FLT_STAT_CH0_FAULT_ENUM_VAL \ + (1U) + +/* Field CH1: Balancing switch fault channel 1. Physical state of the Balancing circuit has differed from the expected one. This could be due to a broken switch, leakages or over current. */ +#define MC33775_BAL_SWITCH_FLT_STAT_CH1_POS \ + (1U) +#define MC33775_BAL_SWITCH_FLT_STAT_CH1_MSK \ + (0x2U) + +/* Enumerated value NOFLT: No fault detected. */ +#define MC33775_BAL_SWITCH_FLT_STAT_CH1_NOFLT_ENUM_VAL \ + (0U) + +/* Enumerated value FAULT: Wrong switch state has been detected. */ +#define MC33775_BAL_SWITCH_FLT_STAT_CH1_FAULT_ENUM_VAL \ + (1U) + +/* Field CH2: Balancing switch fault channel 2. Physical state of the Balancing circuit has differed from the expected one. This could be due to a broken switch, leakages or over current. */ +#define MC33775_BAL_SWITCH_FLT_STAT_CH2_POS \ + (2U) +#define MC33775_BAL_SWITCH_FLT_STAT_CH2_MSK \ + (0x4U) + +/* Enumerated value NOFLT: No fault detected. */ +#define MC33775_BAL_SWITCH_FLT_STAT_CH2_NOFLT_ENUM_VAL \ + (0U) + +/* Enumerated value FAULT: Wrong switch state has been detected. */ +#define MC33775_BAL_SWITCH_FLT_STAT_CH2_FAULT_ENUM_VAL \ + (1U) + +/* Field CH3: Balancing switch fault channel 3. Physical state of the Balancing circuit has differed from the expected one. This could be due to a broken switch, leakages or over current. */ +#define MC33775_BAL_SWITCH_FLT_STAT_CH3_POS \ + (3U) +#define MC33775_BAL_SWITCH_FLT_STAT_CH3_MSK \ + (0x8U) + +/* Enumerated value NOFLT: No fault detected. */ +#define MC33775_BAL_SWITCH_FLT_STAT_CH3_NOFLT_ENUM_VAL \ + (0U) + +/* Enumerated value FAULT: Wrong switch state has been detected. */ +#define MC33775_BAL_SWITCH_FLT_STAT_CH3_FAULT_ENUM_VAL \ + (1U) + +/* Field CH4: Balancing switch fault channel 4. Physical state of the Balancing circuit has differed from the expected one. This could be due to a broken switch, leakages or over current. */ +#define MC33775_BAL_SWITCH_FLT_STAT_CH4_POS \ + (4U) +#define MC33775_BAL_SWITCH_FLT_STAT_CH4_MSK \ + (0x10U) + +/* Enumerated value NOFLT: No fault detected. */ +#define MC33775_BAL_SWITCH_FLT_STAT_CH4_NOFLT_ENUM_VAL \ + (0U) + +/* Enumerated value FAULT: Wrong switch state has been detected. */ +#define MC33775_BAL_SWITCH_FLT_STAT_CH4_FAULT_ENUM_VAL \ + (1U) + +/* Field CH5: Balancing switch fault channel 5. Physical state of the Balancing circuit has differed from the expected one. This could be due to a broken switch, leakages or over current. */ +#define MC33775_BAL_SWITCH_FLT_STAT_CH5_POS \ + (5U) +#define MC33775_BAL_SWITCH_FLT_STAT_CH5_MSK \ + (0x20U) + +/* Enumerated value NOFLT: No fault detected. */ +#define MC33775_BAL_SWITCH_FLT_STAT_CH5_NOFLT_ENUM_VAL \ + (0U) + +/* Enumerated value FAULT: Wrong switch state has been detected. */ +#define MC33775_BAL_SWITCH_FLT_STAT_CH5_FAULT_ENUM_VAL \ + (1U) + +/* Field CH6: Balancing switch fault channel 6. Physical state of the Balancing circuit has differed from the expected one. This could be due to a broken switch, leakages or over current. */ +#define MC33775_BAL_SWITCH_FLT_STAT_CH6_POS \ + (6U) +#define MC33775_BAL_SWITCH_FLT_STAT_CH6_MSK \ + (0x40U) + +/* Enumerated value NOFLT: No fault detected. */ +#define MC33775_BAL_SWITCH_FLT_STAT_CH6_NOFLT_ENUM_VAL \ + (0U) + +/* Enumerated value FAULT: Wrong switch state has been detected. */ +#define MC33775_BAL_SWITCH_FLT_STAT_CH6_FAULT_ENUM_VAL \ + (1U) + +/* Field CH7: Balancing switch fault channel 7. Physical state of the Balancing circuit has differed from the expected one. This could be due to a broken switch, leakages or over current. */ +#define MC33775_BAL_SWITCH_FLT_STAT_CH7_POS \ + (7U) +#define MC33775_BAL_SWITCH_FLT_STAT_CH7_MSK \ + (0x80U) + +/* Enumerated value NOFLT: No fault detected. */ +#define MC33775_BAL_SWITCH_FLT_STAT_CH7_NOFLT_ENUM_VAL \ + (0U) + +/* Enumerated value FAULT: Wrong switch state has been detected. */ +#define MC33775_BAL_SWITCH_FLT_STAT_CH7_FAULT_ENUM_VAL \ + (1U) + +/* Field CH8: Balancing switch fault channel 8. Physical state of the Balancing circuit has differed from the expected one. This could be due to a broken switch, leakages or over current. */ +#define MC33775_BAL_SWITCH_FLT_STAT_CH8_POS \ + (8U) +#define MC33775_BAL_SWITCH_FLT_STAT_CH8_MSK \ + (0x100U) + +/* Enumerated value NOFLT: No fault detected. */ +#define MC33775_BAL_SWITCH_FLT_STAT_CH8_NOFLT_ENUM_VAL \ + (0U) + +/* Enumerated value FAULT: Wrong switch state has been detected. */ +#define MC33775_BAL_SWITCH_FLT_STAT_CH8_FAULT_ENUM_VAL \ + (1U) + +/* Field CH9: Balancing switch fault channel 9. Physical state of the Balancing circuit has differed from the expected one. This could be due to a broken switch, leakages or over current. */ +#define MC33775_BAL_SWITCH_FLT_STAT_CH9_POS \ + (9U) +#define MC33775_BAL_SWITCH_FLT_STAT_CH9_MSK \ + (0x200U) + +/* Enumerated value NOFLT: No fault detected. */ +#define MC33775_BAL_SWITCH_FLT_STAT_CH9_NOFLT_ENUM_VAL \ + (0U) + +/* Enumerated value FAULT: Wrong switch state has been detected. */ +#define MC33775_BAL_SWITCH_FLT_STAT_CH9_FAULT_ENUM_VAL \ + (1U) + +/* Field CH10: Balancing switch fault channel 10. Physical state of the Balancing circuit has differed from the expected one. This could be due to a broken switch, leakages or over current. */ +#define MC33775_BAL_SWITCH_FLT_STAT_CH10_POS \ + (10U) +#define MC33775_BAL_SWITCH_FLT_STAT_CH10_MSK \ + (0x400U) + +/* Enumerated value NOFLT: No fault detected. */ +#define MC33775_BAL_SWITCH_FLT_STAT_CH10_NOFLT_ENUM_VAL \ + (0U) + +/* Enumerated value FAULT: Wrong switch state has been detected. */ +#define MC33775_BAL_SWITCH_FLT_STAT_CH10_FAULT_ENUM_VAL \ + (1U) + +/* Field CH11: Balancing switch fault channel 11. Physical state of the Balancing circuit has differed from the expected one. This could be due to a broken switch, leakages or over current. */ +#define MC33775_BAL_SWITCH_FLT_STAT_CH11_POS \ + (11U) +#define MC33775_BAL_SWITCH_FLT_STAT_CH11_MSK \ + (0x800U) + +/* Enumerated value NOFLT: No fault detected. */ +#define MC33775_BAL_SWITCH_FLT_STAT_CH11_NOFLT_ENUM_VAL \ + (0U) + +/* Enumerated value FAULT: Wrong switch state has been detected. */ +#define MC33775_BAL_SWITCH_FLT_STAT_CH11_FAULT_ENUM_VAL \ + (1U) + +/* Field CH12: Balancing switch fault channel 12. Physical state of the Balancing circuit has differed from the expected one. This could be due to a broken switch, leakages or over current. */ +#define MC33775_BAL_SWITCH_FLT_STAT_CH12_POS \ + (12U) +#define MC33775_BAL_SWITCH_FLT_STAT_CH12_MSK \ + (0x1000U) + +/* Enumerated value NOFLT: No fault detected. */ +#define MC33775_BAL_SWITCH_FLT_STAT_CH12_NOFLT_ENUM_VAL \ + (0U) + +/* Enumerated value FAULT: Wrong switch state has been detected. */ +#define MC33775_BAL_SWITCH_FLT_STAT_CH12_FAULT_ENUM_VAL \ + (1U) + +/* Field CH13: Balancing switch fault channel 13. Physical state of the Balancing circuit has differed from the expected one. This could be due to a broken switch, leakages or over current. */ +#define MC33775_BAL_SWITCH_FLT_STAT_CH13_POS \ + (13U) +#define MC33775_BAL_SWITCH_FLT_STAT_CH13_MSK \ + (0x2000U) + +/* Enumerated value NOFLT: No fault detected. */ +#define MC33775_BAL_SWITCH_FLT_STAT_CH13_NOFLT_ENUM_VAL \ + (0U) + +/* Enumerated value FAULT: Wrong switch state has been detected. */ +#define MC33775_BAL_SWITCH_FLT_STAT_CH13_FAULT_ENUM_VAL \ + (1U) + +/* Field reserved0: This read-only field is reserved and always has the value 0. */ +#define MC33775_BAL_SWITCH_FLT_STAT_RESERVED0_POS \ + (14U) +#define MC33775_BAL_SWITCH_FLT_STAT_RESERVED0_MSK \ + (0xC000U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t CH0 : 1; + volatile uint16_t CH1 : 1; + volatile uint16_t CH2 : 1; + volatile uint16_t CH3 : 1; + volatile uint16_t CH4 : 1; + volatile uint16_t CH5 : 1; + volatile uint16_t CH6 : 1; + volatile uint16_t CH7 : 1; + volatile uint16_t CH8 : 1; + volatile uint16_t CH9 : 1; + volatile uint16_t CH10 : 1; + volatile uint16_t CH11 : 1; + volatile uint16_t CH12 : 1; + volatile uint16_t CH13 : 1; + volatile uint16_t reserved0 : 2; + } B; +} mc33775_balancing_registers_bal_switch_flt_stat_t; + +/* -------------------------------------------------------------------------- + * BAL_TMR_CH_ALL (write-only):Virtual register, writes in parallel into BAL_TMR_CH0 up to BAL_TMR_CH13 + * -------------------------------------------------------------------------- */ +#define MC33775_BAL_TMR_CH_ALL_OFFSET \ + (0x100FU) +#define MC33775_BAL_TMR_CH_ALL_RW_MSK \ + (0x0U) +#define MC33775_BAL_TMR_CH_ALL_RD_MSK \ + (0x0U) +#define MC33775_BAL_TMR_CH_ALL_WR_MSK \ + (0xFFFFU) +#define MC33775_BAL_TMR_CH_ALL_MW_MSK \ + (0x0U) +#define MC33775_BAL_TMR_CH_ALL_RA_MSK \ + (0x0U) +#define MC33775_BAL_TMR_CH_ALL_POR_MSK \ + (0xffffU) +#define MC33775_BAL_TMR_CH_ALL_POR_VAL \ + (0x0U) + +/* Field BALTIME: Sets the balancing time for all channels. */ +#define MC33775_BAL_TMR_CH_ALL_BALTIME_POS \ + (0U) +#define MC33775_BAL_TMR_CH_ALL_BALTIME_MSK \ + (0x3FFFU) + +/* Enumerated value EXPIRED: Balancing time is set to 0. */ +#define MC33775_BAL_TMR_CH_ALL_BALTIME_EXPIRED_ENUM_VAL \ + (0U) + +/* Enumerated value BALTIME: Balancing time is set to BALTIME * 10 seconds */ +#define MC33775_BAL_TMR_CH_ALL_BALTIME_BALTIME_ENUM_VAL \ + (1U) + +/* Enumerated value MAX: Sets maximum balancing time of 163830 seconds = approximately 45.5 hours. */ +#define MC33775_BAL_TMR_CH_ALL_BALTIME_MAX_ENUM_VAL \ + (16383U) + +/* Field PWM: Sets the PWM duty cycle for all channels. PWM cycle time is 0.5 seconds. */ +#define MC33775_BAL_TMR_CH_ALL_PWM_POS \ + (14U) +#define MC33775_BAL_TMR_CH_ALL_PWM_MSK \ + (0xC000U) + +/* Enumerated value PWM25: PWM duty cycle set to 25%. */ +#define MC33775_BAL_TMR_CH_ALL_PWM_PWM25_ENUM_VAL \ + (0U) + +/* Enumerated value PWM50: PWM duty cycle set to 50%. */ +#define MC33775_BAL_TMR_CH_ALL_PWM_PWM50_ENUM_VAL \ + (1U) + +/* Enumerated value PWM75: PWM duty cycle set to 75%. */ +#define MC33775_BAL_TMR_CH_ALL_PWM_PWM75_ENUM_VAL \ + (2U) + +/* Enumerated value PWM100: PWM duty cycle set to 100%. */ +#define MC33775_BAL_TMR_CH_ALL_PWM_PWM100_ENUM_VAL \ + (3U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t BALTIME : 14; + volatile uint16_t PWM : 2; + } B; +} mc33775_balancing_registers_bal_tmr_ch_all_t; + +/* -------------------------------------------------------------------------- + * BAL_TMR_CH0 (read-write):Balancing timer channel 0 + * -------------------------------------------------------------------------- */ +#define MC33775_BAL_TMR_CH0_OFFSET \ + (0x1010U) +#define MC33775_BAL_TMR_CH0_RW_MSK \ + (0xFFFFU) +#define MC33775_BAL_TMR_CH0_RD_MSK \ + (0xFFFFU) +#define MC33775_BAL_TMR_CH0_WR_MSK \ + (0xFFFFU) +#define MC33775_BAL_TMR_CH0_MW_MSK \ + (0x0U) +#define MC33775_BAL_TMR_CH0_RA_MSK \ + (0x0U) +#define MC33775_BAL_TMR_CH0_POR_MSK \ + (0xffffU) +#define MC33775_BAL_TMR_CH0_POR_VAL \ + (0x0U) + +/* Field BALTIME: Balancing time for channel 0 The value of this field represents the current counter value when read. The counting saturates at 0. If the value is zero, the balancing for this channel is stopped. The counting is only active if balancing is enabled, timer based balancing is enabled and the channel enable is set. */ +#define MC33775_BAL_TMR_CH0_BALTIME_POS \ + (0U) +#define MC33775_BAL_TMR_CH0_BALTIME_MSK \ + (0x3FFFU) + +/* Enumerated value EXPIRED: Balancing time is set to 0. */ +#define MC33775_BAL_TMR_CH0_BALTIME_EXPIRED_ENUM_VAL \ + (0U) + +/* Enumerated value BALTIME: Balancing time is set to BALTIME * 10 seconds */ +#define MC33775_BAL_TMR_CH0_BALTIME_BALTIME_ENUM_VAL \ + (1U) + +/* Enumerated value MAX: Sets maximum balancing time of 163830 seconds = approximately 45.5 hours. */ +#define MC33775_BAL_TMR_CH0_BALTIME_MAX_ENUM_VAL \ + (16383U) + +/* Field PWM: PWM duty cycle for channel 0. */ +#define MC33775_BAL_TMR_CH0_PWM_POS \ + (14U) +#define MC33775_BAL_TMR_CH0_PWM_MSK \ + (0xC000U) + +/* Enumerated value PWM25: PWM duty cycle set to 25%. */ +#define MC33775_BAL_TMR_CH0_PWM_PWM25_ENUM_VAL \ + (0U) + +/* Enumerated value PWM50: PWM duty cycle set to 50%. */ +#define MC33775_BAL_TMR_CH0_PWM_PWM50_ENUM_VAL \ + (1U) + +/* Enumerated value PWM75: PWM duty cycle set to 75%. */ +#define MC33775_BAL_TMR_CH0_PWM_PWM75_ENUM_VAL \ + (2U) + +/* Enumerated value PWM100: PWM duty cycle set to 100%. */ +#define MC33775_BAL_TMR_CH0_PWM_PWM100_ENUM_VAL \ + (3U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t BALTIME : 14; + volatile uint16_t PWM : 2; + } B; +} mc33775_balancing_registers_bal_tmr_ch0_t; + +/* -------------------------------------------------------------------------- + * BAL_TMR_CH1 (read-write):Balancing timer channel 1 + * -------------------------------------------------------------------------- */ +#define MC33775_BAL_TMR_CH1_OFFSET \ + (0x1011U) +#define MC33775_BAL_TMR_CH1_RW_MSK \ + (0xFFFFU) +#define MC33775_BAL_TMR_CH1_RD_MSK \ + (0xFFFFU) +#define MC33775_BAL_TMR_CH1_WR_MSK \ + (0xFFFFU) +#define MC33775_BAL_TMR_CH1_MW_MSK \ + (0x0U) +#define MC33775_BAL_TMR_CH1_RA_MSK \ + (0x0U) +#define MC33775_BAL_TMR_CH1_POR_MSK \ + (0xffffU) +#define MC33775_BAL_TMR_CH1_POR_VAL \ + (0x0U) + +/* Field BALTIME: Balancing time for channel 1 The value of this field represents the current counter value when read. The counting saturates at 0. If the value is zero, the balancing for this channel is stopped. The counting is only active if balancing is enabled, timer based balancing is enabled and the channel enable is set. */ +#define MC33775_BAL_TMR_CH1_BALTIME_POS \ + (0U) +#define MC33775_BAL_TMR_CH1_BALTIME_MSK \ + (0x3FFFU) + +/* Enumerated value EXPIRED: Balancing time is set to 0. */ +#define MC33775_BAL_TMR_CH1_BALTIME_EXPIRED_ENUM_VAL \ + (0U) + +/* Enumerated value BALTIME: Balancing time is set to BALTIME * 10 seconds */ +#define MC33775_BAL_TMR_CH1_BALTIME_BALTIME_ENUM_VAL \ + (1U) + +/* Enumerated value MAX: Sets maximum balancing time of 163830 seconds = approximately 45.5 hours. */ +#define MC33775_BAL_TMR_CH1_BALTIME_MAX_ENUM_VAL \ + (16383U) + +/* Field PWM: PWM duty cycle for channel 1. */ +#define MC33775_BAL_TMR_CH1_PWM_POS \ + (14U) +#define MC33775_BAL_TMR_CH1_PWM_MSK \ + (0xC000U) + +/* Enumerated value PWM25: PWM duty cycle set to 25%. */ +#define MC33775_BAL_TMR_CH1_PWM_PWM25_ENUM_VAL \ + (0U) + +/* Enumerated value PWM50: PWM duty cycle set to 50%. */ +#define MC33775_BAL_TMR_CH1_PWM_PWM50_ENUM_VAL \ + (1U) + +/* Enumerated value PWM75: PWM duty cycle set to 75%. */ +#define MC33775_BAL_TMR_CH1_PWM_PWM75_ENUM_VAL \ + (2U) + +/* Enumerated value PWM100: PWM duty cycle set to 100%. */ +#define MC33775_BAL_TMR_CH1_PWM_PWM100_ENUM_VAL \ + (3U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t BALTIME : 14; + volatile uint16_t PWM : 2; + } B; +} mc33775_balancing_registers_bal_tmr_ch1_t; + +/* -------------------------------------------------------------------------- + * BAL_TMR_CH2 (read-write):Balancing timer channel 2 + * -------------------------------------------------------------------------- */ +#define MC33775_BAL_TMR_CH2_OFFSET \ + (0x1012U) +#define MC33775_BAL_TMR_CH2_RW_MSK \ + (0xFFFFU) +#define MC33775_BAL_TMR_CH2_RD_MSK \ + (0xFFFFU) +#define MC33775_BAL_TMR_CH2_WR_MSK \ + (0xFFFFU) +#define MC33775_BAL_TMR_CH2_MW_MSK \ + (0x0U) +#define MC33775_BAL_TMR_CH2_RA_MSK \ + (0x0U) +#define MC33775_BAL_TMR_CH2_POR_MSK \ + (0xffffU) +#define MC33775_BAL_TMR_CH2_POR_VAL \ + (0x0U) + +/* Field BALTIME: Balancing time for channel 2 The value of this field represents the current counter value when read. The counting saturates at 0. If the value is zero, the balancing for this channel is stopped. The counting is only active if balancing is enabled, timer based balancing is enabled and the channel enable is set. */ +#define MC33775_BAL_TMR_CH2_BALTIME_POS \ + (0U) +#define MC33775_BAL_TMR_CH2_BALTIME_MSK \ + (0x3FFFU) + +/* Enumerated value EXPIRED: Balancing time is set to 0. */ +#define MC33775_BAL_TMR_CH2_BALTIME_EXPIRED_ENUM_VAL \ + (0U) + +/* Enumerated value BALTIME: Balancing time is set to BALTIME * 10 seconds */ +#define MC33775_BAL_TMR_CH2_BALTIME_BALTIME_ENUM_VAL \ + (1U) + +/* Enumerated value MAX: Sets maximum balancing time of 163830 seconds = approximately 45.5 hours. */ +#define MC33775_BAL_TMR_CH2_BALTIME_MAX_ENUM_VAL \ + (16383U) + +/* Field PWM: PWM duty cycle for channel 2. */ +#define MC33775_BAL_TMR_CH2_PWM_POS \ + (14U) +#define MC33775_BAL_TMR_CH2_PWM_MSK \ + (0xC000U) + +/* Enumerated value PWM25: PWM duty cycle set to 25%. */ +#define MC33775_BAL_TMR_CH2_PWM_PWM25_ENUM_VAL \ + (0U) + +/* Enumerated value PWM50: PWM duty cycle set to 50%. */ +#define MC33775_BAL_TMR_CH2_PWM_PWM50_ENUM_VAL \ + (1U) + +/* Enumerated value PWM75: PWM duty cycle set to 75%. */ +#define MC33775_BAL_TMR_CH2_PWM_PWM75_ENUM_VAL \ + (2U) + +/* Enumerated value PWM100: PWM duty cycle set to 100%. */ +#define MC33775_BAL_TMR_CH2_PWM_PWM100_ENUM_VAL \ + (3U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t BALTIME : 14; + volatile uint16_t PWM : 2; + } B; +} mc33775_balancing_registers_bal_tmr_ch2_t; + +/* -------------------------------------------------------------------------- + * BAL_TMR_CH3 (read-write):Balancing timer channel 3 + * -------------------------------------------------------------------------- */ +#define MC33775_BAL_TMR_CH3_OFFSET \ + (0x1013U) +#define MC33775_BAL_TMR_CH3_RW_MSK \ + (0xFFFFU) +#define MC33775_BAL_TMR_CH3_RD_MSK \ + (0xFFFFU) +#define MC33775_BAL_TMR_CH3_WR_MSK \ + (0xFFFFU) +#define MC33775_BAL_TMR_CH3_MW_MSK \ + (0x0U) +#define MC33775_BAL_TMR_CH3_RA_MSK \ + (0x0U) +#define MC33775_BAL_TMR_CH3_POR_MSK \ + (0xffffU) +#define MC33775_BAL_TMR_CH3_POR_VAL \ + (0x0U) + +/* Field BALTIME: Balancing time for channel 3 The value of this field represents the current counter value when read. The counting saturates at 0. If the value is zero, the balancing for this channel is stopped. The counting is only active if balancing is enabled, timer based balancing is enabled and the channel enable is set. */ +#define MC33775_BAL_TMR_CH3_BALTIME_POS \ + (0U) +#define MC33775_BAL_TMR_CH3_BALTIME_MSK \ + (0x3FFFU) + +/* Enumerated value EXPIRED: Balancing time is set to 0. */ +#define MC33775_BAL_TMR_CH3_BALTIME_EXPIRED_ENUM_VAL \ + (0U) + +/* Enumerated value BALTIME: Balancing time is set to BALTIME * 10 seconds */ +#define MC33775_BAL_TMR_CH3_BALTIME_BALTIME_ENUM_VAL \ + (1U) + +/* Enumerated value MAX: Sets maximum balancing time of 163830 seconds = approximately 45.5 hours. */ +#define MC33775_BAL_TMR_CH3_BALTIME_MAX_ENUM_VAL \ + (16383U) + +/* Field PWM: PWM duty cycle for channel 3 */ +#define MC33775_BAL_TMR_CH3_PWM_POS \ + (14U) +#define MC33775_BAL_TMR_CH3_PWM_MSK \ + (0xC000U) + +/* Enumerated value PWM25: PWM duty cycle set to 25%. */ +#define MC33775_BAL_TMR_CH3_PWM_PWM25_ENUM_VAL \ + (0U) + +/* Enumerated value PWM50: PWM duty cycle set to 50%. */ +#define MC33775_BAL_TMR_CH3_PWM_PWM50_ENUM_VAL \ + (1U) + +/* Enumerated value PWM75: PWM duty cycle set to 75%. */ +#define MC33775_BAL_TMR_CH3_PWM_PWM75_ENUM_VAL \ + (2U) + +/* Enumerated value PWM100: PWM duty cycle set to 100%. */ +#define MC33775_BAL_TMR_CH3_PWM_PWM100_ENUM_VAL \ + (3U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t BALTIME : 14; + volatile uint16_t PWM : 2; + } B; +} mc33775_balancing_registers_bal_tmr_ch3_t; + +/* -------------------------------------------------------------------------- + * BAL_TMR_CH4 (read-write):Balancing timer channel 4 + * -------------------------------------------------------------------------- */ +#define MC33775_BAL_TMR_CH4_OFFSET \ + (0x1014U) +#define MC33775_BAL_TMR_CH4_RW_MSK \ + (0xFFFFU) +#define MC33775_BAL_TMR_CH4_RD_MSK \ + (0xFFFFU) +#define MC33775_BAL_TMR_CH4_WR_MSK \ + (0xFFFFU) +#define MC33775_BAL_TMR_CH4_MW_MSK \ + (0x0U) +#define MC33775_BAL_TMR_CH4_RA_MSK \ + (0x0U) +#define MC33775_BAL_TMR_CH4_POR_MSK \ + (0xffffU) +#define MC33775_BAL_TMR_CH4_POR_VAL \ + (0x0U) + +/* Field BALTIME: Balancing time for channel 4 The value of this field represents the current counter value when read. The counting saturates at 0. If the value is zero, the balancing for this channel is stopped. The counting is only active if balancing is enabled, timer based balancing is enabled and the channel enable is set. */ +#define MC33775_BAL_TMR_CH4_BALTIME_POS \ + (0U) +#define MC33775_BAL_TMR_CH4_BALTIME_MSK \ + (0x3FFFU) + +/* Enumerated value EXPIRED: Balancing time is set to 0. */ +#define MC33775_BAL_TMR_CH4_BALTIME_EXPIRED_ENUM_VAL \ + (0U) + +/* Enumerated value BALTIME: Balancing time is set to BALTIME * 10 seconds */ +#define MC33775_BAL_TMR_CH4_BALTIME_BALTIME_ENUM_VAL \ + (1U) + +/* Enumerated value MAX: Sets maximum balancing time of 163830 seconds = approximately 45.5 hours. */ +#define MC33775_BAL_TMR_CH4_BALTIME_MAX_ENUM_VAL \ + (16383U) + +/* Field PWM: PWM duty cycle for channel 4. */ +#define MC33775_BAL_TMR_CH4_PWM_POS \ + (14U) +#define MC33775_BAL_TMR_CH4_PWM_MSK \ + (0xC000U) + +/* Enumerated value PWM25: PWM duty cycle set to 25%. */ +#define MC33775_BAL_TMR_CH4_PWM_PWM25_ENUM_VAL \ + (0U) + +/* Enumerated value PWM50: PWM duty cycle set to 50%. */ +#define MC33775_BAL_TMR_CH4_PWM_PWM50_ENUM_VAL \ + (1U) + +/* Enumerated value PWM75: PWM duty cycle set to 75%. */ +#define MC33775_BAL_TMR_CH4_PWM_PWM75_ENUM_VAL \ + (2U) + +/* Enumerated value PWM100: PWM duty cycle set to 100%. */ +#define MC33775_BAL_TMR_CH4_PWM_PWM100_ENUM_VAL \ + (3U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t BALTIME : 14; + volatile uint16_t PWM : 2; + } B; +} mc33775_balancing_registers_bal_tmr_ch4_t; + +/* -------------------------------------------------------------------------- + * BAL_TMR_CH5 (read-write):Balancing timer channel 5 + * -------------------------------------------------------------------------- */ +#define MC33775_BAL_TMR_CH5_OFFSET \ + (0x1015U) +#define MC33775_BAL_TMR_CH5_RW_MSK \ + (0xFFFFU) +#define MC33775_BAL_TMR_CH5_RD_MSK \ + (0xFFFFU) +#define MC33775_BAL_TMR_CH5_WR_MSK \ + (0xFFFFU) +#define MC33775_BAL_TMR_CH5_MW_MSK \ + (0x0U) +#define MC33775_BAL_TMR_CH5_RA_MSK \ + (0x0U) +#define MC33775_BAL_TMR_CH5_POR_MSK \ + (0xffffU) +#define MC33775_BAL_TMR_CH5_POR_VAL \ + (0x0U) + +/* Field BALTIME: Balancing time for channel 5 The value of this field represents the current counter value when read. The counting saturates at 0. If the value is zero, the balancing for this channel is stopped. The counting is only active if balancing is enabled, timer based balancing is enabled and the channel enable is set. */ +#define MC33775_BAL_TMR_CH5_BALTIME_POS \ + (0U) +#define MC33775_BAL_TMR_CH5_BALTIME_MSK \ + (0x3FFFU) + +/* Enumerated value EXPIRED: Balancing time is set to 0. */ +#define MC33775_BAL_TMR_CH5_BALTIME_EXPIRED_ENUM_VAL \ + (0U) + +/* Enumerated value BALTIME: Balancing time is set to BALTIME * 10 seconds */ +#define MC33775_BAL_TMR_CH5_BALTIME_BALTIME_ENUM_VAL \ + (1U) + +/* Enumerated value MAX: Sets maximum balancing time of 163830 seconds = approximately 45.5 hours. */ +#define MC33775_BAL_TMR_CH5_BALTIME_MAX_ENUM_VAL \ + (16383U) + +/* Field PWM: PWM duty cycle for channel 5. */ +#define MC33775_BAL_TMR_CH5_PWM_POS \ + (14U) +#define MC33775_BAL_TMR_CH5_PWM_MSK \ + (0xC000U) + +/* Enumerated value PWM25: PWM duty cycle set to 25%. */ +#define MC33775_BAL_TMR_CH5_PWM_PWM25_ENUM_VAL \ + (0U) + +/* Enumerated value PWM50: PWM duty cycle set to 50%. */ +#define MC33775_BAL_TMR_CH5_PWM_PWM50_ENUM_VAL \ + (1U) + +/* Enumerated value PWM75: PWM duty cycle set to 75%. */ +#define MC33775_BAL_TMR_CH5_PWM_PWM75_ENUM_VAL \ + (2U) + +/* Enumerated value PWM100: PWM duty cycle set to 100%. */ +#define MC33775_BAL_TMR_CH5_PWM_PWM100_ENUM_VAL \ + (3U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t BALTIME : 14; + volatile uint16_t PWM : 2; + } B; +} mc33775_balancing_registers_bal_tmr_ch5_t; + +/* -------------------------------------------------------------------------- + * BAL_TMR_CH6 (read-write):Balancing timer channel 6 + * -------------------------------------------------------------------------- */ +#define MC33775_BAL_TMR_CH6_OFFSET \ + (0x1016U) +#define MC33775_BAL_TMR_CH6_RW_MSK \ + (0xFFFFU) +#define MC33775_BAL_TMR_CH6_RD_MSK \ + (0xFFFFU) +#define MC33775_BAL_TMR_CH6_WR_MSK \ + (0xFFFFU) +#define MC33775_BAL_TMR_CH6_MW_MSK \ + (0x0U) +#define MC33775_BAL_TMR_CH6_RA_MSK \ + (0x0U) +#define MC33775_BAL_TMR_CH6_POR_MSK \ + (0xffffU) +#define MC33775_BAL_TMR_CH6_POR_VAL \ + (0x0U) + +/* Field BALTIME: Balancing time for channel 6 The value of this field represents the current counter value when read. The counting saturates at 0. If the value is zero, the balancing for this channel is stopped. The counting is only active if balancing is enabled, timer based balancing is enabled and the channel enable is set. */ +#define MC33775_BAL_TMR_CH6_BALTIME_POS \ + (0U) +#define MC33775_BAL_TMR_CH6_BALTIME_MSK \ + (0x3FFFU) + +/* Enumerated value EXPIRED: Balancing time is set to 0. */ +#define MC33775_BAL_TMR_CH6_BALTIME_EXPIRED_ENUM_VAL \ + (0U) + +/* Enumerated value BALTIME: Balancing time is set to BALTIME * 10 seconds */ +#define MC33775_BAL_TMR_CH6_BALTIME_BALTIME_ENUM_VAL \ + (1U) + +/* Enumerated value MAX: Sets maximum balancing time of 163830 seconds = approximately 45.5 hours. */ +#define MC33775_BAL_TMR_CH6_BALTIME_MAX_ENUM_VAL \ + (16383U) + +/* Field PWM: PWM duty cycle for channel 6. */ +#define MC33775_BAL_TMR_CH6_PWM_POS \ + (14U) +#define MC33775_BAL_TMR_CH6_PWM_MSK \ + (0xC000U) + +/* Enumerated value PWM25: PWM duty cycle set to 25%. */ +#define MC33775_BAL_TMR_CH6_PWM_PWM25_ENUM_VAL \ + (0U) + +/* Enumerated value PWM50: PWM duty cycle set to 50%. */ +#define MC33775_BAL_TMR_CH6_PWM_PWM50_ENUM_VAL \ + (1U) + +/* Enumerated value PWM75: PWM duty cycle set to 75%. */ +#define MC33775_BAL_TMR_CH6_PWM_PWM75_ENUM_VAL \ + (2U) + +/* Enumerated value PWM100: PWM duty cycle set to 100%. */ +#define MC33775_BAL_TMR_CH6_PWM_PWM100_ENUM_VAL \ + (3U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t BALTIME : 14; + volatile uint16_t PWM : 2; + } B; +} mc33775_balancing_registers_bal_tmr_ch6_t; + +/* -------------------------------------------------------------------------- + * BAL_TMR_CH7 (read-write):Balancing timer channel 7 + * -------------------------------------------------------------------------- */ +#define MC33775_BAL_TMR_CH7_OFFSET \ + (0x1017U) +#define MC33775_BAL_TMR_CH7_RW_MSK \ + (0xFFFFU) +#define MC33775_BAL_TMR_CH7_RD_MSK \ + (0xFFFFU) +#define MC33775_BAL_TMR_CH7_WR_MSK \ + (0xFFFFU) +#define MC33775_BAL_TMR_CH7_MW_MSK \ + (0x0U) +#define MC33775_BAL_TMR_CH7_RA_MSK \ + (0x0U) +#define MC33775_BAL_TMR_CH7_POR_MSK \ + (0xffffU) +#define MC33775_BAL_TMR_CH7_POR_VAL \ + (0x0U) + +/* Field BALTIME: Balancing time for channel 7 The value of this field represents the current counter value when read. The counting saturates at 0. If the value is zero, the balancing for this channel is stopped. The counting is only active if balancing is enabled, timer based balancing is enabled and the channel enable is set. */ +#define MC33775_BAL_TMR_CH7_BALTIME_POS \ + (0U) +#define MC33775_BAL_TMR_CH7_BALTIME_MSK \ + (0x3FFFU) + +/* Enumerated value EXPIRED: Balancing time is set to 0. */ +#define MC33775_BAL_TMR_CH7_BALTIME_EXPIRED_ENUM_VAL \ + (0U) + +/* Enumerated value BALTIME: Balancing time is set to BALTIME * 10 seconds */ +#define MC33775_BAL_TMR_CH7_BALTIME_BALTIME_ENUM_VAL \ + (1U) + +/* Enumerated value MAX: Sets maximum balancing time of 163830 seconds = approximately 45.5 hours. */ +#define MC33775_BAL_TMR_CH7_BALTIME_MAX_ENUM_VAL \ + (16383U) + +/* Field PWM: PWM duty cycle for channel 7. */ +#define MC33775_BAL_TMR_CH7_PWM_POS \ + (14U) +#define MC33775_BAL_TMR_CH7_PWM_MSK \ + (0xC000U) + +/* Enumerated value PWM25: PWM duty cycle set to 25%. */ +#define MC33775_BAL_TMR_CH7_PWM_PWM25_ENUM_VAL \ + (0U) + +/* Enumerated value PWM50: PWM duty cycle set to 50%. */ +#define MC33775_BAL_TMR_CH7_PWM_PWM50_ENUM_VAL \ + (1U) + +/* Enumerated value PWM75: PWM duty cycle set to 75%. */ +#define MC33775_BAL_TMR_CH7_PWM_PWM75_ENUM_VAL \ + (2U) + +/* Enumerated value PWM100: PWM duty cycle set to 100%. */ +#define MC33775_BAL_TMR_CH7_PWM_PWM100_ENUM_VAL \ + (3U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t BALTIME : 14; + volatile uint16_t PWM : 2; + } B; +} mc33775_balancing_registers_bal_tmr_ch7_t; + +/* -------------------------------------------------------------------------- + * BAL_TMR_CH8 (read-write):Balancing timer channel 8 + * -------------------------------------------------------------------------- */ +#define MC33775_BAL_TMR_CH8_OFFSET \ + (0x1018U) +#define MC33775_BAL_TMR_CH8_RW_MSK \ + (0xFFFFU) +#define MC33775_BAL_TMR_CH8_RD_MSK \ + (0xFFFFU) +#define MC33775_BAL_TMR_CH8_WR_MSK \ + (0xFFFFU) +#define MC33775_BAL_TMR_CH8_MW_MSK \ + (0x0U) +#define MC33775_BAL_TMR_CH8_RA_MSK \ + (0x0U) +#define MC33775_BAL_TMR_CH8_POR_MSK \ + (0xffffU) +#define MC33775_BAL_TMR_CH8_POR_VAL \ + (0x0U) + +/* Field BALTIME: Balancing time for channel 8 The value of this field represents the current counter value when read. The counting saturates at 0. If the value is zero, the balancing for this channel is stopped. The counting is only active if balancing is enabled, timer based balancing is enabled and the channel enable is set. */ +#define MC33775_BAL_TMR_CH8_BALTIME_POS \ + (0U) +#define MC33775_BAL_TMR_CH8_BALTIME_MSK \ + (0x3FFFU) + +/* Enumerated value EXPIRED: Balancing time is set to 0. */ +#define MC33775_BAL_TMR_CH8_BALTIME_EXPIRED_ENUM_VAL \ + (0U) + +/* Enumerated value BALTIME: Balancing time is set to BALTIME * 10 seconds */ +#define MC33775_BAL_TMR_CH8_BALTIME_BALTIME_ENUM_VAL \ + (1U) + +/* Enumerated value MAX: Sets maximum balancing time of 163830 seconds = approximately 45.5 hours. */ +#define MC33775_BAL_TMR_CH8_BALTIME_MAX_ENUM_VAL \ + (16383U) + +/* Field PWM: PWM duty cycle for channel 8. */ +#define MC33775_BAL_TMR_CH8_PWM_POS \ + (14U) +#define MC33775_BAL_TMR_CH8_PWM_MSK \ + (0xC000U) + +/* Enumerated value PWM25: PWM duty cycle set to 25%. */ +#define MC33775_BAL_TMR_CH8_PWM_PWM25_ENUM_VAL \ + (0U) + +/* Enumerated value PWM50: PWM duty cycle set to 50%. */ +#define MC33775_BAL_TMR_CH8_PWM_PWM50_ENUM_VAL \ + (1U) + +/* Enumerated value PWM75: PWM duty cycle set to 75%. */ +#define MC33775_BAL_TMR_CH8_PWM_PWM75_ENUM_VAL \ + (2U) + +/* Enumerated value PWM100: PWM duty cycle set to 100%. */ +#define MC33775_BAL_TMR_CH8_PWM_PWM100_ENUM_VAL \ + (3U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t BALTIME : 14; + volatile uint16_t PWM : 2; + } B; +} mc33775_balancing_registers_bal_tmr_ch8_t; + +/* -------------------------------------------------------------------------- + * BAL_TMR_CH9 (read-write):Balancing timer channel 9 + * -------------------------------------------------------------------------- */ +#define MC33775_BAL_TMR_CH9_OFFSET \ + (0x1019U) +#define MC33775_BAL_TMR_CH9_RW_MSK \ + (0xFFFFU) +#define MC33775_BAL_TMR_CH9_RD_MSK \ + (0xFFFFU) +#define MC33775_BAL_TMR_CH9_WR_MSK \ + (0xFFFFU) +#define MC33775_BAL_TMR_CH9_MW_MSK \ + (0x0U) +#define MC33775_BAL_TMR_CH9_RA_MSK \ + (0x0U) +#define MC33775_BAL_TMR_CH9_POR_MSK \ + (0xffffU) +#define MC33775_BAL_TMR_CH9_POR_VAL \ + (0x0U) + +/* Field BALTIME: Balancing time for channel 9 The value of this field represents the current counter value when read. The counting saturates at 0. If the value is zero, the balancing for this channel is stopped. The counting is only active if balancing is enabled, timer based balancing is enabled and the channel enable is set. */ +#define MC33775_BAL_TMR_CH9_BALTIME_POS \ + (0U) +#define MC33775_BAL_TMR_CH9_BALTIME_MSK \ + (0x3FFFU) + +/* Enumerated value EXPIRED: Balancing time is set to 0. */ +#define MC33775_BAL_TMR_CH9_BALTIME_EXPIRED_ENUM_VAL \ + (0U) + +/* Enumerated value BALTIME: Balancing time is set to BALTIME * 10 seconds */ +#define MC33775_BAL_TMR_CH9_BALTIME_BALTIME_ENUM_VAL \ + (1U) + +/* Enumerated value MAX: Sets maximum balancing time of 163830 seconds = approximately 45.5 hours. */ +#define MC33775_BAL_TMR_CH9_BALTIME_MAX_ENUM_VAL \ + (16383U) + +/* Field PWM: PWM duty cycle for channel 9. */ +#define MC33775_BAL_TMR_CH9_PWM_POS \ + (14U) +#define MC33775_BAL_TMR_CH9_PWM_MSK \ + (0xC000U) + +/* Enumerated value PWM25: PWM duty cycle set to 25%. */ +#define MC33775_BAL_TMR_CH9_PWM_PWM25_ENUM_VAL \ + (0U) + +/* Enumerated value PWM50: PWM duty cycle set to 50%. */ +#define MC33775_BAL_TMR_CH9_PWM_PWM50_ENUM_VAL \ + (1U) + +/* Enumerated value PWM75: PWM duty cycle set to 75%. */ +#define MC33775_BAL_TMR_CH9_PWM_PWM75_ENUM_VAL \ + (2U) + +/* Enumerated value PWM100: PWM duty cycle set to 100%. */ +#define MC33775_BAL_TMR_CH9_PWM_PWM100_ENUM_VAL \ + (3U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t BALTIME : 14; + volatile uint16_t PWM : 2; + } B; +} mc33775_balancing_registers_bal_tmr_ch9_t; + +/* -------------------------------------------------------------------------- + * BAL_TMR_CH10 (read-write):Balancing timer channel 10 + * -------------------------------------------------------------------------- */ +#define MC33775_BAL_TMR_CH10_OFFSET \ + (0x101AU) +#define MC33775_BAL_TMR_CH10_RW_MSK \ + (0xFFFFU) +#define MC33775_BAL_TMR_CH10_RD_MSK \ + (0xFFFFU) +#define MC33775_BAL_TMR_CH10_WR_MSK \ + (0xFFFFU) +#define MC33775_BAL_TMR_CH10_MW_MSK \ + (0x0U) +#define MC33775_BAL_TMR_CH10_RA_MSK \ + (0x0U) +#define MC33775_BAL_TMR_CH10_POR_MSK \ + (0xffffU) +#define MC33775_BAL_TMR_CH10_POR_VAL \ + (0x0U) + +/* Field BALTIME: Balancing time for channel 10 The value of this field represents the current counter value when read. The counting saturates at 0. If the value is zero, the balancing for this channel is stopped. The counting is only active if balancing is enabled, timer based balancing is enabled and the channel enable is set. */ +#define MC33775_BAL_TMR_CH10_BALTIME_POS \ + (0U) +#define MC33775_BAL_TMR_CH10_BALTIME_MSK \ + (0x3FFFU) + +/* Enumerated value EXPIRED: Balancing time is set to 0. */ +#define MC33775_BAL_TMR_CH10_BALTIME_EXPIRED_ENUM_VAL \ + (0U) + +/* Enumerated value BALTIME: Balancing time is set to BALTIME * 10 seconds */ +#define MC33775_BAL_TMR_CH10_BALTIME_BALTIME_ENUM_VAL \ + (1U) + +/* Enumerated value MAX: Sets maximum balancing time of 163830 seconds = approximately 45.5 hours. */ +#define MC33775_BAL_TMR_CH10_BALTIME_MAX_ENUM_VAL \ + (16383U) + +/* Field PWM: PWM duty cycle for channel 10. */ +#define MC33775_BAL_TMR_CH10_PWM_POS \ + (14U) +#define MC33775_BAL_TMR_CH10_PWM_MSK \ + (0xC000U) + +/* Enumerated value PWM25: PWM duty cycle set to 25%. */ +#define MC33775_BAL_TMR_CH10_PWM_PWM25_ENUM_VAL \ + (0U) + +/* Enumerated value PWM50: PWM duty cycle set to 50%. */ +#define MC33775_BAL_TMR_CH10_PWM_PWM50_ENUM_VAL \ + (1U) + +/* Enumerated value PWM75: PWM duty cycle set to 75%. */ +#define MC33775_BAL_TMR_CH10_PWM_PWM75_ENUM_VAL \ + (2U) + +/* Enumerated value PWM100: PWM duty cycle set to 100%. */ +#define MC33775_BAL_TMR_CH10_PWM_PWM100_ENUM_VAL \ + (3U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t BALTIME : 14; + volatile uint16_t PWM : 2; + } B; +} mc33775_balancing_registers_bal_tmr_ch10_t; + +/* -------------------------------------------------------------------------- + * BAL_TMR_CH11 (read-write):Balancing timer channel 11 + * -------------------------------------------------------------------------- */ +#define MC33775_BAL_TMR_CH11_OFFSET \ + (0x101BU) +#define MC33775_BAL_TMR_CH11_RW_MSK \ + (0xFFFFU) +#define MC33775_BAL_TMR_CH11_RD_MSK \ + (0xFFFFU) +#define MC33775_BAL_TMR_CH11_WR_MSK \ + (0xFFFFU) +#define MC33775_BAL_TMR_CH11_MW_MSK \ + (0x0U) +#define MC33775_BAL_TMR_CH11_RA_MSK \ + (0x0U) +#define MC33775_BAL_TMR_CH11_POR_MSK \ + (0xffffU) +#define MC33775_BAL_TMR_CH11_POR_VAL \ + (0x0U) + +/* Field BALTIME: Balancing time for channel 11 The value of this field represents the current counter value when read. The counting saturates at 0. If the value is zero, the balancing for this channel is stopped. The counting is only active if balancing is enabled, timer based balancing is enabled and the channel enable is set. */ +#define MC33775_BAL_TMR_CH11_BALTIME_POS \ + (0U) +#define MC33775_BAL_TMR_CH11_BALTIME_MSK \ + (0x3FFFU) + +/* Enumerated value EXPIRED: Balancing time is set to 0. */ +#define MC33775_BAL_TMR_CH11_BALTIME_EXPIRED_ENUM_VAL \ + (0U) + +/* Enumerated value BALTIME: Balancing time is set to BALTIME * 10 seconds */ +#define MC33775_BAL_TMR_CH11_BALTIME_BALTIME_ENUM_VAL \ + (1U) + +/* Enumerated value MAX: Sets maximum balancing time of 163830 seconds = approximately 45.5 hours. */ +#define MC33775_BAL_TMR_CH11_BALTIME_MAX_ENUM_VAL \ + (16383U) + +/* Field PWM: PWM duty cycle for channel 11. */ +#define MC33775_BAL_TMR_CH11_PWM_POS \ + (14U) +#define MC33775_BAL_TMR_CH11_PWM_MSK \ + (0xC000U) + +/* Enumerated value PWM25: PWM duty cycle set to 25%. */ +#define MC33775_BAL_TMR_CH11_PWM_PWM25_ENUM_VAL \ + (0U) + +/* Enumerated value PWM50: PWM duty cycle set to 50%. */ +#define MC33775_BAL_TMR_CH11_PWM_PWM50_ENUM_VAL \ + (1U) + +/* Enumerated value PWM75: PWM duty cycle set to 75%. */ +#define MC33775_BAL_TMR_CH11_PWM_PWM75_ENUM_VAL \ + (2U) + +/* Enumerated value PWM100: PWM duty cycle set to 100%. */ +#define MC33775_BAL_TMR_CH11_PWM_PWM100_ENUM_VAL \ + (3U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t BALTIME : 14; + volatile uint16_t PWM : 2; + } B; +} mc33775_balancing_registers_bal_tmr_ch11_t; + +/* -------------------------------------------------------------------------- + * BAL_TMR_CH12 (read-write):Balancing timer channel 12 + * -------------------------------------------------------------------------- */ +#define MC33775_BAL_TMR_CH12_OFFSET \ + (0x101CU) +#define MC33775_BAL_TMR_CH12_RW_MSK \ + (0xFFFFU) +#define MC33775_BAL_TMR_CH12_RD_MSK \ + (0xFFFFU) +#define MC33775_BAL_TMR_CH12_WR_MSK \ + (0xFFFFU) +#define MC33775_BAL_TMR_CH12_MW_MSK \ + (0x0U) +#define MC33775_BAL_TMR_CH12_RA_MSK \ + (0x0U) +#define MC33775_BAL_TMR_CH12_POR_MSK \ + (0xffffU) +#define MC33775_BAL_TMR_CH12_POR_VAL \ + (0x0U) + +/* Field BALTIME: Balancing time for channel 12 The value of this field represents the current counter value when read. The counting saturates at 0. If the value is zero, the balancing for this channel is stopped. The counting is only active if balancing is enabled, timer based balancing is enabled and the channel enable is set. */ +#define MC33775_BAL_TMR_CH12_BALTIME_POS \ + (0U) +#define MC33775_BAL_TMR_CH12_BALTIME_MSK \ + (0x3FFFU) + +/* Enumerated value EXPIRED: Balancing time is set to 0. */ +#define MC33775_BAL_TMR_CH12_BALTIME_EXPIRED_ENUM_VAL \ + (0U) + +/* Enumerated value BALTIME: Balancing time is set to BALTIME * 10 seconds */ +#define MC33775_BAL_TMR_CH12_BALTIME_BALTIME_ENUM_VAL \ + (1U) + +/* Enumerated value MAX: Sets maximum balancing time of 163830 seconds = approximately 45.5 hours. */ +#define MC33775_BAL_TMR_CH12_BALTIME_MAX_ENUM_VAL \ + (16383U) + +/* Field PWM: PWM duty cycle for channel 12 */ +#define MC33775_BAL_TMR_CH12_PWM_POS \ + (14U) +#define MC33775_BAL_TMR_CH12_PWM_MSK \ + (0xC000U) + +/* Enumerated value PWM25: PWM duty cycle set to 25%. */ +#define MC33775_BAL_TMR_CH12_PWM_PWM25_ENUM_VAL \ + (0U) + +/* Enumerated value PWM50: PWM duty cycle set to 50%. */ +#define MC33775_BAL_TMR_CH12_PWM_PWM50_ENUM_VAL \ + (1U) + +/* Enumerated value PWM75: PWM duty cycle set to 75%. */ +#define MC33775_BAL_TMR_CH12_PWM_PWM75_ENUM_VAL \ + (2U) + +/* Enumerated value PWM100: PWM duty cycle set to 100%. */ +#define MC33775_BAL_TMR_CH12_PWM_PWM100_ENUM_VAL \ + (3U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t BALTIME : 14; + volatile uint16_t PWM : 2; + } B; +} mc33775_balancing_registers_bal_tmr_ch12_t; + +/* -------------------------------------------------------------------------- + * BAL_TMR_CH13 (read-write):Balancing timer channel 13 + * -------------------------------------------------------------------------- */ +#define MC33775_BAL_TMR_CH13_OFFSET \ + (0x101DU) +#define MC33775_BAL_TMR_CH13_RW_MSK \ + (0xFFFFU) +#define MC33775_BAL_TMR_CH13_RD_MSK \ + (0xFFFFU) +#define MC33775_BAL_TMR_CH13_WR_MSK \ + (0xFFFFU) +#define MC33775_BAL_TMR_CH13_MW_MSK \ + (0x0U) +#define MC33775_BAL_TMR_CH13_RA_MSK \ + (0x0U) +#define MC33775_BAL_TMR_CH13_POR_MSK \ + (0xffffU) +#define MC33775_BAL_TMR_CH13_POR_VAL \ + (0x0U) + +/* Field BALTIME: Balancing time for channel 13 The value of this field represents the current counter value when read. The counting saturates at 0. If the value is zero, the balancing for this channel is stopped. The counting is only active if balancing is enabled, timer based balancing is enabled and the channel enable is set. */ +#define MC33775_BAL_TMR_CH13_BALTIME_POS \ + (0U) +#define MC33775_BAL_TMR_CH13_BALTIME_MSK \ + (0x3FFFU) + +/* Enumerated value EXPIRED: Balancing time is set to 0. */ +#define MC33775_BAL_TMR_CH13_BALTIME_EXPIRED_ENUM_VAL \ + (0U) + +/* Enumerated value BALTIME: Balancing time is set to BALTIME * 10 seconds */ +#define MC33775_BAL_TMR_CH13_BALTIME_BALTIME_ENUM_VAL \ + (1U) + +/* Enumerated value MAX: Sets maximum balancing time of 163830 seconds = approximately 45.5 hours. */ +#define MC33775_BAL_TMR_CH13_BALTIME_MAX_ENUM_VAL \ + (16383U) + +/* Field PWM: PWM duty cycle for channel 13. */ +#define MC33775_BAL_TMR_CH13_PWM_POS \ + (14U) +#define MC33775_BAL_TMR_CH13_PWM_MSK \ + (0xC000U) + +/* Enumerated value PWM25: PWM duty cycle set to 25%. */ +#define MC33775_BAL_TMR_CH13_PWM_PWM25_ENUM_VAL \ + (0U) + +/* Enumerated value PWM50: PWM duty cycle set to 50%. */ +#define MC33775_BAL_TMR_CH13_PWM_PWM50_ENUM_VAL \ + (1U) + +/* Enumerated value PWM75: PWM duty cycle set to 75%. */ +#define MC33775_BAL_TMR_CH13_PWM_PWM75_ENUM_VAL \ + (2U) + +/* Enumerated value PWM100: PWM duty cycle set to 100%. */ +#define MC33775_BAL_TMR_CH13_PWM_PWM100_ENUM_VAL \ + (3U) + +typedef union { + volatile uint16_t R; + struct { + volatile uint16_t BALTIME : 14; + volatile uint16_t PWM : 2; + } B; +} mc33775_balancing_registers_bal_tmr_ch13_t; + +/* Overall register structs */ +typedef struct { + mc33775_system_control_registers_sys_cfg_crc_t SYS_CFG_CRC; + mc33775_system_control_registers_sys_com_cfg_t SYS_COM_CFG; + mc33775_system_control_registers_sys_com_to_cfg_t SYS_COM_TO_CFG; + mc33775_system_control_registers_sys_supply_cfg_t SYS_SUPPLY_CFG; + mc33775_system_control_registers_sys_mode_t SYS_MODE; + mc33775_system_control_registers_sys_cyc_wakeup_cfg_t SYS_CYC_WAKEUP_CFG; + mc33775_system_control_registers_sys_tpl_cfg_t SYS_TPL_CFG; + uint16_t RESERVED_7_7[1]; + mc33775_system_control_registers_sys_clk_sync_ctrl_t SYS_CLK_SYNC_CTRL; + uint16_t RESERVED_9_14[6]; + /* mc33775_system_control_registers_sys_dbg_ctrl_t SYS_DBG_CTRL; */ /* check with NXP */ + mc33775_system_control_registers_sys_version_t SYS_VERSION; + mc33775_system_control_registers_sys_uid_low_t SYS_UID_LOW; + mc33775_system_control_registers_sys_uid_mid_t SYS_UID_MID; + mc33775_system_control_registers_sys_uid_high_t SYS_UID_HIGH; + uint16_t RESERVED_20_127[108]; + mc33775_system_control_registers_sys_ds_storage0_t SYS_DS_STORAGE0; + mc33775_system_control_registers_sys_ds_storage1_t SYS_DS_STORAGE1; + uint16_t RESERVED_130_255[126]; + /* mc33775_system_control_registers_sys_com_tpl_cfg_t SYS_COM_TPL_CFG; */ /* check with NXP */ + uint16_t RESERVED_257_1023[767]; +} mc33775_system_control_registers_t; + +typedef struct { + mc33775_event_handling_registers_feh_cfg_crc_t FEH_CFG_CRC; + mc33775_event_handling_registers_feh_alarm_cfg_t FEH_ALARM_CFG; + mc33775_event_handling_registers_feh_alarm_out_cfg_t FEH_ALARM_OUT_CFG; + mc33775_event_handling_registers_feh_alarm_out_reason_t FEH_ALARM_OUT_REASON; + uint16_t RESERVED_4_7[4]; + mc33775_event_handling_registers_feh_wakeup_cfg_t FEH_WAKEUP_CFG; + mc33775_event_handling_registers_feh_wakeup_reason_t FEH_WAKEUP_REASON; + uint16_t RESERVED_10_15[6]; + mc33775_event_handling_registers_feh_mon_bist_ctrl_t FEH_MON_BIST_CTRL; + mc33775_event_handling_registers_feh_mon_bist_res_t FEH_MON_BIST_RES; + uint16_t RESERVED_18_29[12]; + mc33775_event_handling_registers_feh_acc_err_t FEH_ACC_ERR; + mc33775_event_handling_registers_feh_grp_flt_stat_t FEH_GRP_FLT_STAT; + mc33775_event_handling_registers_feh_supply_flt_stat0_t FEH_SUPPLY_FLT_STAT0; + mc33775_event_handling_registers_feh_supply_flt_stat1_t FEH_SUPPLY_FLT_STAT1; + mc33775_event_handling_registers_feh_ana_flt_stat_t FEH_ANA_FLT_STAT; + mc33775_event_handling_registers_feh_com_flt_stat_t FEH_COM_FLT_STAT; + mc33775_event_handling_registers_feh_meas_flt_stat_t FEH_MEAS_FLT_STAT; + uint16_t RESERVED_37_39[3]; + mc33775_event_handling_registers_feh_supply_flt_por_cfg0_t FEH_SUPPLY_FLT_POR_CFG0; + mc33775_event_handling_registers_feh_supply_flt_por_cfg1_t FEH_SUPPLY_FLT_POR_CFG1; + mc33775_event_handling_registers_feh_ana_flt_por_cfg_t FEH_ANA_FLT_POR_CFG; + mc33775_event_handling_registers_feh_com_flt_por_cfg_t FEH_COM_FLT_POR_CFG; + uint16_t RESERVED_44_47[4]; + mc33775_event_handling_registers_feh_supply_flt_evt_cfg0_t FEH_SUPPLY_FLT_EVT_CFG0; + mc33775_event_handling_registers_feh_supply_flt_evt_cfg1_t FEH_SUPPLY_FLT_EVT_CFG1; + mc33775_event_handling_registers_feh_ana_flt_evt_cfg_t FEH_ANA_FLT_EVT_CFG; + mc33775_event_handling_registers_feh_com_flt_evt_cfg_t FEH_COM_FLT_EVT_CFG; + mc33775_event_handling_registers_feh_meas_flt_evt_cfg_t FEH_MEAS_FLT_EVT_CFG; + uint16_t RESERVED_53_127[75]; + mc33775_event_handling_registers_feh_por_reason_t FEH_POR_REASON; + uint16_t RESERVED_129_1023[895]; +} mc33775_event_handling_registers_t; + +typedef struct { + mc33775_gpio_registers_gpio_cfg0_t GPIO_CFG0; + mc33775_gpio_registers_gpio_cfg1_t GPIO_CFG1; + mc33775_gpio_registers_gpio_out_t GPIO_OUT; + uint16_t RESERVED_3_3[1]; + mc33775_gpio_registers_gpio_in_t GPIO_IN; + uint16_t RESERVED_5_1023[1019]; +} mc33775_gpio_registers_t; + +typedef struct { + mc33775_i2c_registers_i2c_cfg_t I2C_CFG; + mc33775_i2c_registers_i2c_ctrl_t I2C_CTRL; + mc33775_i2c_registers_i2c_stat_t I2C_STAT; + uint16_t RESERVED_3_3[1]; + mc33775_i2c_registers_i2c_data0_t I2C_DATA0; + mc33775_i2c_registers_i2c_data1_t I2C_DATA1; + mc33775_i2c_registers_i2c_data2_t I2C_DATA2; + mc33775_i2c_registers_i2c_data3_t I2C_DATA3; + mc33775_i2c_registers_i2c_data4_t I2C_DATA4; + mc33775_i2c_registers_i2c_data5_t I2C_DATA5; + mc33775_i2c_registers_i2c_data6_t I2C_DATA6; + uint16_t RESERVED_11_1023[1013]; +} mc33775_i2c_registers_t; + +typedef struct { + mc33775_balancing_registers_bal_glob_cfg_t BAL_GLOB_CFG; + mc33775_balancing_registers_bal_glob_to_tmr_t BAL_GLOB_TO_TMR; + mc33775_balancing_registers_bal_ch_cfg_t BAL_CH_CFG; + mc33775_balancing_registers_bal_pre_tmr_t BAL_PRE_TMR; + mc33775_balancing_registers_bal_auto_dischrg_ctrl_t BAL_AUTO_DISCHRG_CTRL; + uint16_t RESERVED_5_8[4]; + mc33775_balancing_registers_bal_ch_uv0_stat_t BAL_CH_UV0_STAT; + mc33775_balancing_registers_bal_glob_uv1_stat_t BAL_GLOB_UV1_STAT; + mc33775_balancing_registers_bal_stat0_t BAL_STAT0; + mc33775_balancing_registers_bal_stat1_t BAL_STAT1; + mc33775_balancing_registers_bal_switch_stat_t BAL_SWITCH_STAT; + mc33775_balancing_registers_bal_switch_flt_stat_t BAL_SWITCH_FLT_STAT; + mc33775_balancing_registers_bal_tmr_ch_all_t BAL_TMR_CH_ALL; + mc33775_balancing_registers_bal_tmr_ch0_t BAL_TMR_CH0; + mc33775_balancing_registers_bal_tmr_ch1_t BAL_TMR_CH1; + mc33775_balancing_registers_bal_tmr_ch2_t BAL_TMR_CH2; + mc33775_balancing_registers_bal_tmr_ch3_t BAL_TMR_CH3; + mc33775_balancing_registers_bal_tmr_ch4_t BAL_TMR_CH4; + mc33775_balancing_registers_bal_tmr_ch5_t BAL_TMR_CH5; + mc33775_balancing_registers_bal_tmr_ch6_t BAL_TMR_CH6; + mc33775_balancing_registers_bal_tmr_ch7_t BAL_TMR_CH7; + mc33775_balancing_registers_bal_tmr_ch8_t BAL_TMR_CH8; + mc33775_balancing_registers_bal_tmr_ch9_t BAL_TMR_CH9; + mc33775_balancing_registers_bal_tmr_ch10_t BAL_TMR_CH10; + mc33775_balancing_registers_bal_tmr_ch11_t BAL_TMR_CH11; + mc33775_balancing_registers_bal_tmr_ch12_t BAL_TMR_CH12; + mc33775_balancing_registers_bal_tmr_ch13_t BAL_TMR_CH13; + uint16_t RESERVED_30_1023[994]; +} mc33775_balancing_registers_t; + +typedef struct { + mc33775_all_measurement_registers_allm_cfg_t ALLM_CFG; + mc33775_all_measurement_registers_allm_app_ctrl_t ALLM_APP_CTRL; + mc33775_all_measurement_registers_allm_per_ctrl_t ALLM_PER_CTRL; + mc33775_all_measurement_registers_allm_sync_ctrl_t ALLM_SYNC_CTRL; + uint16_t RESERVED_4_7[4]; + mc33775_all_measurement_registers_allm_vcvb_cfg_t ALLM_VCVB_CFG; + uint16_t RESERVED_9_1023[1015]; +} mc33775_all_measurement_registers_t; + +typedef struct { + mc33775_primary_measurement_registers_prmm_cfg_t PRMM_CFG; + mc33775_primary_measurement_registers_prmm_app_ctrl_t PRMM_APP_CTRL; + mc33775_primary_measurement_registers_prmm_per_ctrl_t PRMM_PER_CTRL; + mc33775_primary_measurement_registers_prmm_sync_ctrl_t PRMM_SYNC_CTRL; + uint16_t RESERVED_4_7[4]; + mc33775_primary_measurement_registers_prmm_vc_cfg_t PRMM_VC_CFG; + mc33775_primary_measurement_registers_prmm_ain_cfg_t PRMM_AIN_CFG; + mc33775_primary_measurement_registers_prmm_ain_ol_cfg_t PRMM_AIN_OL_CFG; + mc33775_primary_measurement_registers_prmm_vdiv_cfg_t PRMM_VDIV_CFG; + uint16_t RESERVED_12_15[4]; + mc33775_primary_measurement_registers_prmm_vc_ov_uv_cfg_t PRMM_VC_OV_UV_CFG; + mc33775_primary_measurement_registers_prmm_vc_ov_th_cfg_t PRMM_VC_OV_TH_CFG; + mc33775_primary_measurement_registers_prmm_vc_uv0_th_cfg_t PRMM_VC_UV0_TH_CFG; + mc33775_primary_measurement_registers_prmm_vc_uv1_th_cfg_t PRMM_VC_UV1_TH_CFG; + mc33775_primary_measurement_registers_prmm_ain0_ov_th_cfg_t PRMM_AIN0_OV_TH_CFG; + mc33775_primary_measurement_registers_prmm_ain1_ov_th_cfg_t PRMM_AIN1_OV_TH_CFG; + mc33775_primary_measurement_registers_prmm_ain2_ov_th_cfg_t PRMM_AIN2_OV_TH_CFG; + mc33775_primary_measurement_registers_prmm_ain3_ov_th_cfg_t PRMM_AIN3_OV_TH_CFG; + mc33775_primary_measurement_registers_prmm_ain0_uv_th_cfg_t PRMM_AIN0_UV_TH_CFG; + mc33775_primary_measurement_registers_prmm_ain1_uv_th_cfg_t PRMM_AIN1_UV_TH_CFG; + mc33775_primary_measurement_registers_prmm_ain2_uv_th_cfg_t PRMM_AIN2_UV_TH_CFG; + mc33775_primary_measurement_registers_prmm_ain3_uv_th_cfg_t PRMM_AIN3_UV_TH_CFG; + uint16_t RESERVED_28_29[2]; + mc33775_primary_measurement_registers_prmm_cal_crc_t PRMM_CAL_CRC; + mc33775_primary_measurement_registers_prmm_cfg_crc_t PRMM_CFG_CRC; + mc33775_primary_measurement_registers_prmm_vc_ov_flt_stat_t PRMM_VC_OV_FLT_STAT; + mc33775_primary_measurement_registers_prmm_vc_uv0_flt_stat_t PRMM_VC_UV0_FLT_STAT; + mc33775_primary_measurement_registers_prmm_vc_uv1_flt_stat_t PRMM_VC_UV1_FLT_STAT; + mc33775_primary_measurement_registers_prmm_ain_ov_flt_stat_t PRMM_AIN_OV_FLT_STAT; + mc33775_primary_measurement_registers_prmm_ain_uv_flt_stat_t PRMM_AIN_UV_FLT_STAT; + uint16_t RESERVED_37_61[25]; + mc33775_primary_measurement_registers_prmm_meas_stat_t PRMM_MEAS_STAT; + mc33775_primary_measurement_registers_prmm_app_vc_cnt_t PRMM_APP_VC_CNT; + mc33775_primary_measurement_registers_prmm_app_vc0_t PRMM_APP_VC0; + mc33775_primary_measurement_registers_prmm_app_vc1_t PRMM_APP_VC1; + mc33775_primary_measurement_registers_prmm_app_vc2_t PRMM_APP_VC2; + mc33775_primary_measurement_registers_prmm_app_vc3_t PRMM_APP_VC3; + mc33775_primary_measurement_registers_prmm_app_vc4_t PRMM_APP_VC4; + mc33775_primary_measurement_registers_prmm_app_vc5_t PRMM_APP_VC5; + mc33775_primary_measurement_registers_prmm_app_vc6_t PRMM_APP_VC6; + mc33775_primary_measurement_registers_prmm_app_vc7_t PRMM_APP_VC7; + mc33775_primary_measurement_registers_prmm_app_vc8_t PRMM_APP_VC8; + mc33775_primary_measurement_registers_prmm_app_vc9_t PRMM_APP_VC9; + mc33775_primary_measurement_registers_prmm_app_vc10_t PRMM_APP_VC10; + mc33775_primary_measurement_registers_prmm_app_vc11_t PRMM_APP_VC11; + mc33775_primary_measurement_registers_prmm_app_vc12_t PRMM_APP_VC12; + mc33775_primary_measurement_registers_prmm_app_vc13_t PRMM_APP_VC13; + mc33775_primary_measurement_registers_prmm_app_vmodule_t PRMM_APP_VMODULE; + mc33775_primary_measurement_registers_prmm_app_ain0_t PRMM_APP_AIN0; + mc33775_primary_measurement_registers_prmm_app_ain1_t PRMM_APP_AIN1; + mc33775_primary_measurement_registers_prmm_app_ain2_t PRMM_APP_AIN2; + mc33775_primary_measurement_registers_prmm_app_ain3_t PRMM_APP_AIN3; + uint16_t RESERVED_83_94[12]; + mc33775_primary_measurement_registers_prmm_per_num_t PRMM_PER_NUM; + mc33775_primary_measurement_registers_prmm_per_vc0_t PRMM_PER_VC0; + mc33775_primary_measurement_registers_prmm_per_vc1_t PRMM_PER_VC1; + mc33775_primary_measurement_registers_prmm_per_vc2_t PRMM_PER_VC2; + mc33775_primary_measurement_registers_prmm_per_vc3_t PRMM_PER_VC3; + mc33775_primary_measurement_registers_prmm_per_vc4_t PRMM_PER_VC4; + mc33775_primary_measurement_registers_prmm_per_vc5_t PRMM_PER_VC5; + mc33775_primary_measurement_registers_prmm_per_vc6_t PRMM_PER_VC6; + mc33775_primary_measurement_registers_prmm_per_vc7_t PRMM_PER_VC7; + mc33775_primary_measurement_registers_prmm_per_vc8_t PRMM_PER_VC8; + mc33775_primary_measurement_registers_prmm_per_vc9_t PRMM_PER_VC9; + mc33775_primary_measurement_registers_prmm_per_vc10_t PRMM_PER_VC10; + mc33775_primary_measurement_registers_prmm_per_vc11_t PRMM_PER_VC11; + mc33775_primary_measurement_registers_prmm_per_vc12_t PRMM_PER_VC12; + mc33775_primary_measurement_registers_prmm_per_vc13_t PRMM_PER_VC13; + mc33775_primary_measurement_registers_prmm_per_vmodule_t PRMM_PER_VMODULE; + mc33775_primary_measurement_registers_prmm_per_ain0_t PRMM_PER_AIN0; + mc33775_primary_measurement_registers_prmm_per_ain1_t PRMM_PER_AIN1; + mc33775_primary_measurement_registers_prmm_per_ain2_t PRMM_PER_AIN2; + mc33775_primary_measurement_registers_prmm_per_ain3_t PRMM_PER_AIN3; + mc33775_primary_measurement_registers_prmm_per_prmtemp_t PRMM_PER_PRMTEMP; + mc33775_primary_measurement_registers_prmm_per_secvref_t PRMM_PER_SECVREF; + mc33775_primary_measurement_registers_prmm_per_vaux_t PRMM_PER_VAUX; + mc33775_primary_measurement_registers_prmm_per_vddc_t PRMM_PER_VDDC; + mc33775_primary_measurement_registers_prmm_per_ldovref_t PRMM_PER_LDOVREF; + uint16_t RESERVED_120_126[7]; + mc33775_primary_measurement_registers_prmm_sync_num_t PRMM_SYNC_NUM; + mc33775_primary_measurement_registers_prmm_sync_vc0_t PRMM_SYNC_VC0; + mc33775_primary_measurement_registers_prmm_sync_vc1_t PRMM_SYNC_VC1; + mc33775_primary_measurement_registers_prmm_sync_vc2_t PRMM_SYNC_VC2; + mc33775_primary_measurement_registers_prmm_sync_vc3_t PRMM_SYNC_VC3; + mc33775_primary_measurement_registers_prmm_sync_vc4_t PRMM_SYNC_VC4; + mc33775_primary_measurement_registers_prmm_sync_vc5_t PRMM_SYNC_VC5; + mc33775_primary_measurement_registers_prmm_sync_vc6_t PRMM_SYNC_VC6; + mc33775_primary_measurement_registers_prmm_sync_vc7_t PRMM_SYNC_VC7; + mc33775_primary_measurement_registers_prmm_sync_vc8_t PRMM_SYNC_VC8; + mc33775_primary_measurement_registers_prmm_sync_vc9_t PRMM_SYNC_VC9; + mc33775_primary_measurement_registers_prmm_sync_vc10_t PRMM_SYNC_VC10; + mc33775_primary_measurement_registers_prmm_sync_vc11_t PRMM_SYNC_VC11; + mc33775_primary_measurement_registers_prmm_sync_vc12_t PRMM_SYNC_VC12; + mc33775_primary_measurement_registers_prmm_sync_vc13_t PRMM_SYNC_VC13; + uint16_t RESERVED_142_1023[882]; +} mc33775_primary_measurement_registers_t; + +typedef struct { + mc33775_secondary_measurement_registers_secm_cfg_t SECM_CFG; + mc33775_secondary_measurement_registers_secm_app_ctrl_t SECM_APP_CTRL; + mc33775_secondary_measurement_registers_secm_per_ctrl_t SECM_PER_CTRL; + mc33775_secondary_measurement_registers_secm_sync_ctrl_t SECM_SYNC_CTRL; + uint16_t RESERVED_4_7[4]; + mc33775_secondary_measurement_registers_secm_vb_cfg_t SECM_VB_CFG; + mc33775_secondary_measurement_registers_secm_ain_cfg_t SECM_AIN_CFG; + mc33775_secondary_measurement_registers_secm_ain_ol_cfg_t SECM_AIN_OL_CFG; + mc33775_secondary_measurement_registers_secm_vdiv_cfg_t SECM_VDIV_CFG; + uint16_t RESERVED_12_29[18]; + mc33775_secondary_measurement_registers_secm_cal_crc_t SECM_CAL_CRC; + mc33775_secondary_measurement_registers_secm_cfg_crc_t SECM_CFG_CRC; + uint16_t RESERVED_32_61[30]; + mc33775_secondary_measurement_registers_secm_meas_stat_t SECM_MEAS_STAT; + uint16_t RESERVED_63_78[16]; + mc33775_secondary_measurement_registers_secm_app_ain4_t SECM_APP_AIN4; + mc33775_secondary_measurement_registers_secm_app_ain5_t SECM_APP_AIN5; + mc33775_secondary_measurement_registers_secm_app_ain6_t SECM_APP_AIN6; + mc33775_secondary_measurement_registers_secm_app_ain7_t SECM_APP_AIN7; + uint16_t RESERVED_83_94[12]; + mc33775_secondary_measurement_registers_secm_per_num_t SECM_PER_NUM; + uint16_t RESERVED_96_110[15]; + mc33775_secondary_measurement_registers_secm_per_ain4_t SECM_PER_AIN4; + mc33775_secondary_measurement_registers_secm_per_ain5_t SECM_PER_AIN5; + mc33775_secondary_measurement_registers_secm_per_ain6_t SECM_PER_AIN6; + mc33775_secondary_measurement_registers_secm_per_ain7_t SECM_PER_AIN7; + mc33775_secondary_measurement_registers_secm_per_sectemp_t SECM_PER_SECTEMP; + mc33775_secondary_measurement_registers_secm_per_prmvref_t SECM_PER_PRMVREF; + mc33775_secondary_measurement_registers_secm_per_vaux_t SECM_PER_VAUX; + mc33775_secondary_measurement_registers_secm_per_vbat_t SECM_PER_VBAT; + mc33775_secondary_measurement_registers_secm_per_vdda_t SECM_PER_VDDA; + mc33775_secondary_measurement_registers_secm_per_vddc_t SECM_PER_VDDC; + mc33775_secondary_measurement_registers_secm_per_monvref_t SECM_PER_MONVREF; + mc33775_secondary_measurement_registers_secm_per_npnisense_t SECM_PER_NPNISENSE; + uint16_t RESERVED_123_126[4]; + mc33775_secondary_measurement_registers_secm_sync_num_t SECM_SYNC_NUM; + mc33775_secondary_measurement_registers_secm_sync_vb0_t SECM_SYNC_VB0; + mc33775_secondary_measurement_registers_secm_sync_vb1_t SECM_SYNC_VB1; + mc33775_secondary_measurement_registers_secm_sync_vb2_t SECM_SYNC_VB2; + mc33775_secondary_measurement_registers_secm_sync_vb3_t SECM_SYNC_VB3; + mc33775_secondary_measurement_registers_secm_sync_vb4_t SECM_SYNC_VB4; + mc33775_secondary_measurement_registers_secm_sync_vb5_t SECM_SYNC_VB5; + mc33775_secondary_measurement_registers_secm_sync_vb6_t SECM_SYNC_VB6; + mc33775_secondary_measurement_registers_secm_sync_vb7_t SECM_SYNC_VB7; + mc33775_secondary_measurement_registers_secm_sync_vb8_t SECM_SYNC_VB8; + mc33775_secondary_measurement_registers_secm_sync_vb9_t SECM_SYNC_VB9; + mc33775_secondary_measurement_registers_secm_sync_vb10_t SECM_SYNC_VB10; + mc33775_secondary_measurement_registers_secm_sync_vb11_t SECM_SYNC_VB11; + mc33775_secondary_measurement_registers_secm_sync_vb12_t SECM_SYNC_VB12; + mc33775_secondary_measurement_registers_secm_sync_vb13_t SECM_SYNC_VB13; + uint16_t RESERVED_142_1023[882]; +} mc33775_secondary_measurement_registers_t; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/app/driver/afe/nxp/mc33775a/vendor/README.md b/src/app/driver/afe/nxp/mc33775a/vendor/README.md new file mode 100644 index 00000000..e7c82cfa --- /dev/null +++ b/src/app/driver/afe/nxp/mc33775a/vendor/README.md @@ -0,0 +1,9 @@ +# Vendored Sources and Headers for the NXP MC33775A Driver + +This directory contains vendored (i.e. unmodified) source and header files +from NXP ([NXP Semiconductors N.V.](https://www.nxp.com)) which are needed to +build the *Analog Front-End* (AFE)for the NXP MC33775A driver for foxBMS 2. + +These files, their content and their formatting (auto-formatting is disabled +for ``clang-format``, see the ``.clang-format`` file in this directory) should +not be modified within in the foxBMS 2 project. diff --git a/src/app/driver/afe/nxp/mc33775a/vendor/uc_msg_t.c b/src/app/driver/afe/nxp/mc33775a/vendor/uc_msg_t.c new file mode 100644 index 00000000..66953cb1 --- /dev/null +++ b/src/app/driver/afe/nxp/mc33775a/vendor/uc_msg_t.c @@ -0,0 +1,154 @@ +/* Copyright 2019 NXP +* +* Redistribution and use in source and binary forms, with or without modification, are permitted +* provided that the following terms 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. +*/ + +/* + * uc_msg_t implementation + * + * Created on: 27.03.2019 + * Author: dep10505 + */ + +#include + +void set_cmd(uc_msg_t *msg, const uint16_t cmd) { + (msg->head) = ((cmd &0x3) << 14) | ((msg->head) & 0x3FFF); +} + +void get_cmd(const uc_msg_t *msg, uint16_t *cmd) { + *cmd = ((msg->head) & 0xC000) >> 14; +} + +void set_madd(uc_msg_t *msg, const uint16_t madd) { + (msg->head) = ((madd & 0x1)<< 13) | ((msg->head) & 0xDFFF); +} + +void get_madd(const uc_msg_t *msg, uint16_t *madd) { + *madd = ((msg->head) & 0x2000) >> 13; +} + +void set_cadd(uc_msg_t *msg, const uint16_t cadd) { + (msg->head) = ((cadd & 0x7) << 10) | ((msg->head) & 0xE3FF); +} + +void get_cadd(const uc_msg_t *msg, uint16_t *cadd) { + *cadd = ((msg->head) & 0x1C00) >> 10; +} + +void set_devadd(uc_msg_t *msg, const uint16_t devadd) { + (msg->head) = ((devadd & 0x3F) << 4) | ((msg->head) & 0xFC0F); +} + +void get_devadd(const uc_msg_t *msg, uint16_t *devadd) { + *devadd = ((msg->head) & 0x03F0) >> 4; +} + +void set_msgcnt(uc_msg_t *msg, const uint16_t msgcnt) { + (msg->head) = (msgcnt & 0xF) | ((msg->head) & 0xFFF0); +} + +void get_msgcnt(const uc_msg_t *msg, uint16_t *msgcnt) { + *msgcnt = ((msg->head) & 0x000F); +} + +void set_datalen(uc_msg_t *msg, const uint16_t datalen) { + (msg->data.dhead) = ((datalen & 0x3) << 14) | ((msg->data.dhead) & 0x3FFF); +} + +void get_datalen(const uc_msg_t *msg, uint16_t *datalen) { + *datalen = ((msg->data.dhead) & 0xC000) >> 14; +} + +void set_regadd(uc_msg_t *msg, const uint16_t regadd) { + (msg->data.dhead) = (regadd & 0x3FFF) | ((msg->data.dhead) & 0xC000); +} + +void get_regadd(const uc_msg_t *msg, uint16_t *regadd) { + *regadd = (msg->data.dhead) & 0x3FFF; +} + +void set_data(uc_msg_t *msg, const uint16_t data, const unsigned index) { + (msg->data.data[index]) = data; +} + +void get_data(const uc_msg_t *msg, uint16_t *data, const unsigned index) { + *data = msg->data.data[index]; +} + +void set_crc(uc_msg_t *msg, const uint16_t crc) { + (msg->crc) = crc; +} + +void get_crc(const uc_msg_t *msg, uint16_t *crc) { + *crc = (msg->crc); +} + +/* Calculate the CRC of a message */ +uint16_t crc_add_item(uint16_t remainder, uint16_t item) { + int i; + + remainder ^= item; + + for (i=0; i < 16; i++) + { + /* + * Try to divide the current data bit. + */ + if (remainder & 0x8000) { + remainder = (remainder << 1) ^ ((0x9eb2 << 1) + 0x1); + } else { + remainder = (remainder << 1); + } + } + + return (remainder); +} + +uint16_t calc_crc(const uc_msg_t *msg) { + uint16_t remainder = 0; + int i; + + remainder = crc_add_item(remainder, msg->head); + remainder = crc_add_item(remainder, msg->data.dhead); + + for (i=0; i < (msg->message_length - 3); i++) { + remainder = crc_add_item(remainder, msg->data.data[i]); + } + + return(remainder); +} + +/* returns true if CRC matches argument */ +int check_crc(const uc_msg_t *msg, const uint16_t ref_crc) { + uint16_t msg_crc; + + get_crc(msg, &msg_crc); + + return (msg_crc == ref_crc); +} + +void set_message_length(uc_msg_t *msg, const uint16_t length) { + msg->message_length = length; +} + +void get_message_length(const uc_msg_t *msg, uint16_t *length) { + *length = msg->message_length; +} diff --git a/src/app/driver/afe/nxp/mc33775a/vendor/uc_msg_t.h b/src/app/driver/afe/nxp/mc33775a/vendor/uc_msg_t.h new file mode 100644 index 00000000..a59adbea --- /dev/null +++ b/src/app/driver/afe/nxp/mc33775a/vendor/uc_msg_t.h @@ -0,0 +1,86 @@ +/* Copyright 2019 NXP +* +* Redistribution and use in source and binary forms, with or without modification, are permitted +* provided that the following terms 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. +*/ +/* + * uc_msg_t.h + * + * Created on: 26.03.2019 + * Author: nxf19022 + */ + +#ifndef INC_UC_MSG_T_H_ +#define INC_UC_MSG_T_H_ + +#include + +enum bms1_command {BMS1_CMD_NOP=0, BMS1_CMD_READ, BMS1_CMD_WRITE, BMS1_CMD_RESP}; + +typedef struct { + uint16_t dhead; + uint16_t data[4]; +} uc_msg_data_t; + +typedef struct { + uint16_t head; + uc_msg_data_t data; + uint16_t crc; + uint16_t message_length; +} uc_msg_t; + +void set_cmd(uc_msg_t*, const uint16_t); +void get_cmd(const uc_msg_t*, uint16_t*); + +void set_madd(uc_msg_t*, const uint16_t); +void get_madd(const uc_msg_t*, uint16_t*); + +void set_cadd(uc_msg_t*, const uint16_t); +void get_cadd(const uc_msg_t*, uint16_t*); + +void set_devadd(uc_msg_t*, const uint16_t); +void get_devadd(const uc_msg_t*, uint16_t*); + +void set_msgcnt(uc_msg_t*, const uint16_t); +void get_msgcnt(const uc_msg_t*, uint16_t*); + +void set_datalen(uc_msg_t*, const uint16_t); +void get_datalen(const uc_msg_t*, uint16_t*); + +void set_regadd(uc_msg_t*, const uint16_t); +void get_regadd(const uc_msg_t*, uint16_t*); + +void set_data(uc_msg_t*, const uint16_t, const unsigned); +void get_data(const uc_msg_t*, uint16_t*, const unsigned); + +void set_crc(uc_msg_t*, const uint16_t); +void get_crc(const uc_msg_t*, uint16_t*); + +uint16_t calc_crc(const uc_msg_t*); + +/* returns true if CRC matches argument */ +int check_crc(const uc_msg_t*, const uint16_t); + +void set_message_length(uc_msg_t*, const uint16_t); +void get_message_length(const uc_msg_t*, uint16_t*); + + + + +#endif /* INC_UC_MSG_T_H_ */ diff --git a/src/app/driver/afe/nxp/mc33775a/wscript b/src/app/driver/afe/nxp/mc33775a/wscript new file mode 100644 index 00000000..debc7196 --- /dev/null +++ b/src/app/driver/afe/nxp/mc33775a/wscript @@ -0,0 +1,119 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# Copyright (c) 2010 - 2022, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. +# All rights reserved. +# +# 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®" + +"""TODO""" + +import os +from waflib.Utils import unversioned_sys_platform + +NXP_MC33775A_VENDOR_HASHES = { + os.path.join("vendor", "MC33775A.h"): { + "win32": b"\xe0\xeb1\xf2\xa19P;\x8d\xb5\xa9\x8c\xa81\xd9M", + "linux": b"N\x8d\x1d_N\x0b\xd4\x9c\x89\x05\xbf-\xdd*\xaa\x02", + }, + os.path.join("vendor", "uc_msg_t.c"): { + "win32": b"\xec79\xabfh>\x83%p\xa1\x92\xca5\xca\x7f", + "linux": b"!\xf1x@\xa8\xac\x057\xa5\xfdJ[\x96T\x11\xb7", + }, + os.path.join("vendor", "uc_msg_t.h"): { + "win32": b"\xbe\xd4\x11w\xa2\xae\xa1\xe2}e3\xa95\x8aH\xcb", + "linux": b"\x93E*y\x8d\xfe\x83\xf1\xaa;\x97\xdd\xc0\xbd7\xac", + }, +} + + +def build(bld): + """builds the measurement ic driver library for NXP MC33775A""" + source = [ + os.path.join("..", "api", "nxp_afe.c"), + os.path.join("api", "nxp_mc33775a_afe.c"), + os.path.join("nxp_afe_dma.c"), + os.path.join("config", "nxp_afe_dma_cfg.c"), + os.path.join("nxp_mc33775a.c"), + os.path.join("nxp_mc33775a-ll.c"), + os.path.join("config", "nxp_mc33775a_cfg.c"), + os.path.join("vendor", "uc_msg_t.c"), + ] + includes = [ + ".", + os.path.join("api"), + os.path.join("config"), + os.path.join("vendor"), + os.path.join("..", "api"), + os.path.join("..", "..", "api"), + os.path.join("..", "..", "..", "config"), + os.path.join("..", "..", "..", "dma"), + os.path.join("..", "..", "..", "foxmath"), + os.path.join("..", "..", "..", "io"), + os.path.join("..", "..", "..", "mcu"), + os.path.join("..", "..", "..", "pex"), + os.path.join("..", "..", "..", "spi"), + os.path.join("..", "..", "..", "ts"), + os.path.join("..", "..", "..", "ts", "api"), + os.path.join("..", "..", "..", "..", "application", "config"), + os.path.join("..", "..", "..", "..", "engine", "config"), + os.path.join("..", "..", "..", "..", "engine", "database"), + os.path.join("..", "..", "..", "..", "engine", "diag"), + os.path.join("..", "..", "..", "..", "main", "include"), + os.path.join("..", "..", "..", "..", "task", "config"), + os.path.join("..", "..", "..", "..", "task", "config"), + os.path.join("..", "..", "..", "..", "task", "ftask"), + os.path.join("..", "..", "..", "..", "task", "os"), + ] + includes.extend(bld.env.INCLUDES_RTOS) + cflags = bld.env.CFLAGS_FOXBMS + target = f"{bld.env.APPNAME.lower()}-afe-driver" + bld.stlib( + source=source, + includes=includes, + use=f"{bld.env.APPNAME.lower()}-nxp-afe", + cflags=cflags, + target=target, + ) + + for k, val in NXP_MC33775A_VENDOR_HASHES.items(): + node = bld.path.find_node(k) + node_hash = node.h_file() + if not node_hash == val[unversioned_sys_platform()]: + bld.fatal( + "File hash of vendored file does not match " + f"('{node}' should return {val[unversioned_sys_platform()]} " + f"but returned {node_hash}." + ) diff --git a/src/app/driver/afe/nxp/wscript b/src/app/driver/afe/nxp/wscript index df576dec..31437737 100644 --- a/src/app/driver/afe/nxp/wscript +++ b/src/app/driver/afe/nxp/wscript @@ -40,42 +40,7 @@ """TODO""" -import os - def build(bld): - """builds the AFE driver library for N775""" - source = [ - os.path.join(bld.env.afe_chip, "api", "nxp_afe.c"), - os.path.join(bld.env.afe_chip, "nxp_afe_dma.c"), - os.path.join(bld.env.afe_chip, "config", "nxp_afe_dma_cfg.c"), - os.path.join(bld.env.afe_chip, "n775.c"), - os.path.join(bld.env.afe_chip, "config", "n775_cfg.c"), - ] - includes = [ - bld.env.afe_chip, - os.path.join(bld.env.afe_chip, "..", "..", "api"), - os.path.join(bld.env.afe_chip, "config"), - os.path.join("..", "..", "config"), - os.path.join("..", "..", "dma"), - os.path.join("..", "..", "foxmath"), - os.path.join("..", "..", "io"), - os.path.join("..", "..", "spi"), - os.path.join("..", "..", "ts"), - os.path.join("..", "..", "mcu"), - os.path.join("..", "..", "..", "application", "config"), - os.path.join("..", "..", "..", "engine", "config"), - os.path.join("..", "..", "..", "engine", "database"), - os.path.join("..", "..", "..", "engine", "diag"), - os.path.join("..", "..", "..", "main", "include"), - os.path.join("..", "..", "..", "task", "os"), - ] - includes.extend(bld.env.INCLUDES_OPERATING_SYSTEM) - cflags = bld.env.CFLAGS_FOXBMS - target = f"{bld.env.APPNAME.lower()}-afe-driver" - bld.stlib( - source=source, - includes=includes, - cflags=cflags, - target=target, - ) + """selects the driver library to be build""" + bld.recurse(bld.env.afe_ic) diff --git a/src/app/driver/can/can.c b/src/app/driver/can/can.c index ed8dd510..48dd98be 100644 --- a/src/app/driver/can/can.c +++ b/src/app/driver/can/can.c @@ -43,8 +43,8 @@ * @file can.c * @author foxBMS Team * @date 2019-12-04 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix CAN * @@ -103,9 +103,9 @@ /** tracks the local state of the can module */ static CAN_STATE_s can_state = { .periodicEnable = false, - .currentSensorPresent = {REPEAT_U(false, STRIP(BS_NR_OF_STRINGS))}, - .currentSensorCCPresent = {REPEAT_U(false, STRIP(BS_NR_OF_STRINGS))}, - .currentSensorECPresent = {REPEAT_U(false, STRIP(BS_NR_OF_STRINGS))}, + .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))}, }; /*========== Extern Constant and Variable Definitions =======================*/ @@ -181,6 +181,9 @@ static void CAN_SetCurrentSensorEcPresent(bool command, uint8_t stringNumber); /** initialize the SPI interface to the CAN transceiver */ static void CAN_InitializeTransceiver(void); +/** checks that the configured message period for Tx messages is valid */ +static void CAN_ValidateConfiguredTxMessagePeriod(void); + /*========== Static Function Implementations ================================*/ static void CAN_InitializeTransceiver(void) { @@ -197,10 +200,19 @@ static void CAN_InitializeTransceiver(void) { PEX_SetPin(PEX_PORT_EXPANDER2, CAN2_STANDBY_PIN); } +static void CAN_ValidateConfiguredTxMessagePeriod(void) { + for (uint16_t i = 0u; i < can_txLength; i++) { + if (can_txMessages[i].repetitionTime == 0u) { + FAS_ASSERT(FAS_TRAP); + } + } +} + /*========== Extern Function Implementations ================================*/ extern void CAN_Initialize(void) { CAN_InitializeTransceiver(); + CAN_ValidateConfiguredTxMessagePeriod(); } extern STD_RETURN_TYPE_e CAN_DataSend(canBASE_t *pNode, uint32_t id, uint8 *pData) { @@ -222,7 +234,7 @@ extern STD_RETURN_TYPE_e CAN_DataSend(canBASE_t *pNode, uint32_t id, uint8 *pDat /* standard frame: bits [28:18] */ /* extended frame: bits [28:0] */ /* bit 29 set to 1: to set direction Tx in IF2ARB register */ - canUpdateID(pNode, messageBox, ((id << 18) | (1U << 29))); + canUpdateID(pNode, messageBox, ((id << 18u) | (1u << 29u))); canTransmit(pNode, messageBox, pData); result = STD_OK; break; @@ -244,7 +256,7 @@ static STD_RETURN_TYPE_e CAN_PeriodicTransmit(void) { uint8_t data[8] = {0}; for (uint16_t i = 0u; i < can_txLength; i++) { - if (((counterTicks * CAN_TICK_MS) % (can_txMessages[i].repetitionTime)) == can_txMessages[i].repetitionPhase) { + if (((counterTicks * CAN_TICK_ms) % (can_txMessages[i].repetitionTime)) == can_txMessages[i].repetitionPhase) { if (can_txMessages[i].callbackFunction != NULL_PTR) { can_txMessages[i].callbackFunction( can_txMessages[i].id, @@ -474,7 +486,7 @@ static void CAN_RxInterrupt(canBASE_t *pNode, uint32 messageBox) { } /** called in case of CAN interrupt, defined as weak in HAL */ -/* AXIVION Next Line Style Linker-Multiple_Definition: TI HAL only provides a weak implementation */ +/* AXIVION Next Codeline Style Linker-Multiple_Definition: TI HAL only provides a weak implementation */ void UNIT_TEST_WEAK_IMPL canMessageNotification(canBASE_t *node, uint32 messageBox) { /* AXIVION Routine Generic-MissingParameterAssert: node: unchecked in interrupt */ /* AXIVION Routine Generic-MissingParameterAssert: messageBox: unchecked in interrupt */ @@ -487,34 +499,34 @@ void UNIT_TEST_WEAK_IMPL canMessageNotification(canBASE_t *node, uint32 messageB } extern STD_RETURN_TYPE_e CAN_TransmitBootMessage(void) { - uint8_t data[] = {REPEAT_U(0u, STRIP(CAN_MAX_DLC))}; + uint8_t data[] = {GEN_REPEAT_U(0u, GEN_STRIP(CAN_MAX_DLC))}; /* Set major number */ - data[CAN_BYTE_0_POSITION] = foxbmsVersionInfo.major; + data[CAN_BYTE_0_POSITION] = ver_foxbmsVersionInformation.major; /* Set minor number */ - data[CAN_BYTE_1_POSITION] = foxbmsVersionInfo.minor; + data[CAN_BYTE_1_POSITION] = ver_foxbmsVersionInformation.minor; /* Set patch number */ - data[CAN_BYTE_2_POSITION] = foxbmsVersionInfo.patch; + data[CAN_BYTE_2_POSITION] = ver_foxbmsVersionInformation.patch; /* intermediate variable for message byte 3 */ uint8_t versionControlByte = 0u; /* Set version control flags */ - if (foxbmsVersionInfo.underVersionControl == true) { + if (ver_foxbmsVersionInformation.underVersionControl == true) { versionControlByte |= (0x01u << CAN_BOOT_MESSAGE_BYTE_3_BIT_VERSION_CONTROL); } - if (foxbmsVersionInfo.isDirty == true) { + if (ver_foxbmsVersionInformation.isDirty == true) { versionControlByte |= (0x01u << CAN_BOOT_MESSAGE_BYTE_3_BIT_DIRTY_FLAG); } /* Set overflow flag (if release distance is larger than 31) */ - if (foxbmsVersionInfo.distanceFromLastRelease > CAN_BOOT_MESSAGE_MAXIMUM_RELEASE_DISTANCE) { + if (ver_foxbmsVersionInformation.distanceFromLastRelease > CAN_BOOT_MESSAGE_MAXIMUM_RELEASE_DISTANCE) { /* we need to set the overflow flag */ versionControlByte |= (0x01u << CAN_BOOT_MESSAGE_BYTE_3_BIT_DISTANCE_OVERFLOW_FLAG); } /* Set release distance (capped to maximum value) */ const uint8_t distanceCapped = (uint8_t)MATH_MinimumOfTwoUint16_t( - foxbmsVersionInfo.distanceFromLastRelease, (uint16_t)CAN_BOOT_MESSAGE_MAXIMUM_RELEASE_DISTANCE); + ver_foxbmsVersionInformation.distanceFromLastRelease, (uint16_t)CAN_BOOT_MESSAGE_MAXIMUM_RELEASE_DISTANCE); versionControlByte |= (distanceCapped << CAN_BOOT_MESSAGE_BYTE_3_BIT_DISTANCE_COUNTER); /* assign assembled byte to databyte */ @@ -535,7 +547,7 @@ extern STD_RETURN_TYPE_e CAN_TransmitBootMessage(void) { } extern STD_RETURN_TYPE_e CAN_TransmitDieId(void) { - uint8_t data[] = {REPEAT_U(0u, STRIP(CAN_MAX_DLC))}; + uint8_t data[] = {GEN_REPEAT_U(0u, GEN_STRIP(CAN_MAX_DLC))}; /* Read out device register with die ID low and high */ const uint32_t dieIdLow = systemREG1->DIEIDL; diff --git a/src/app/driver/can/can.h b/src/app/driver/can/can.h index 6f78786a..a20b0a07 100644 --- a/src/app/driver/can/can.h +++ b/src/app/driver/can/can.h @@ -43,15 +43,15 @@ * @file can.h * @author foxBMS Team * @date 2019-12-04 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix CAN * * @brief Header for the driver for the CAN module * - * Provides the interfaces for initialization, receive - * and transmit handling + * @details Provides the interfaces for initialization, receive + * and transmit handling * */ @@ -65,15 +65,15 @@ /*========== Macros and Definitions =========================================*/ -/** Half of the 64 messageboxes are defined for TX +/** Half of the 64 message boxes are defined for TX * This is used to determined in the CAN interrupt routine if TX or RX case */ -#define CAN_NR_OF_TX_MESSAGE_BOX (32U) +#define CAN_NR_OF_TX_MESSAGE_BOX (32u) /** Task time slot where the CAN TX function is called. Repetition time of * periodic CAN messages must be multiple of this (e.g., 1u, 10u or 100u) */ -#define CAN_TICK_MS (10U) +#define CAN_TICK_ms (10u) /** This structure contains variables relevant for the CAN signal module. */ typedef struct { diff --git a/src/app/driver/can/cbs/can_cbs.h b/src/app/driver/can/cbs/can_cbs.h index bca8f185..dddcfa9a 100644 --- a/src/app/driver/can/cbs/can_cbs.h +++ b/src/app/driver/can/cbs/can_cbs.h @@ -43,8 +43,8 @@ * @file can_cbs.h * @author foxBMS Team * @date 2021-04-20 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVER * @prefix CAN * diff --git a/src/app/driver/can/cbs/can_cbs_rx_command.c b/src/app/driver/can/cbs/can_cbs_rx_command.c index ff852bf8..97b0fc15 100644 --- a/src/app/driver/can/cbs/can_cbs_rx_command.c +++ b/src/app/driver/can/cbs/can_cbs_rx_command.c @@ -43,8 +43,8 @@ * @file can_cbs_rx_command.c * @author foxBMS Team * @date 2021-07-28 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVER * @prefix CAN * @@ -162,7 +162,7 @@ static void CAN_HandleModeRequest(uint64_t signalData, const CAN_SHIM_s *const k static void CAN_HandleBalancingRequest(uint64_t signalData) { /* AXIVION Routine Generic-MissingParameterAssert: signalData: parameter accepts whole range */ - /* AXIVION Next Line Style MisraC2012-2.2 MisraC2012-14.3: Depending on implementation STD_NOT_OK might be returned. */ + /* AXIVION Next Codeline Style MisraC2012-2.2 MisraC2012-14.3: Depending on implementation STD_NOT_OK might be returned. */ if (BAL_GetInitializationState() == STD_OK) { if (signalData == 0u) { BAL_SetStateRequest(BAL_STATE_GLOBAL_DISABLE_REQUEST); @@ -200,22 +200,22 @@ extern uint32_t CAN_RxRequest( uint64_t signalData = 0; /* Get mode request */ - /* AXIVION Next Line Style Generic-NoMagicNumbers: Signal data defined in .dbc file. */ + /* AXIVION Next Codeline Style Generic-NoMagicNumbers: Signal data defined in .dbc file. */ CAN_RxGetSignalDataFromMessageData(message, 1u, 2u, &signalData, endianness); CAN_HandleModeRequest(signalData, kpkCanShim); /* check for reset flag */ - /* AXIVION Next Line Style Generic-NoMagicNumbers: Signal data defined in .dbc file. */ + /* AXIVION Next Codeline Style Generic-NoMagicNumbers: Signal data defined in .dbc file. */ CAN_RxGetSignalDataFromMessageData(message, 2u, 1u, &signalData, endianness); CAN_ClearAllPersistentFlags(signalData); /* Get balancing request */ - /* AXIVION Next Line Style Generic-NoMagicNumbers: Signal data defined in .dbc file. */ + /* AXIVION Next Codeline Style Generic-NoMagicNumbers: Signal data defined in .dbc file. */ CAN_RxGetSignalDataFromMessageData(message, 8u, 1u, &signalData, endianness); CAN_HandleBalancingRequest(signalData); /* Get balancing threshold */ - /* AXIVION Next Line Style Generic-NoMagicNumbers: Signal data defined in .dbc file. */ + /* AXIVION Next Codeline Style Generic-NoMagicNumbers: Signal data defined in .dbc file. */ CAN_RxGetSignalDataFromMessageData(message, 23u, 8u, &signalData, endianness); CAN_SetBalancingThreshold(signalData); diff --git a/src/app/driver/can/cbs/can_cbs_rx_current_sensor.c b/src/app/driver/can/cbs/can_cbs_rx_current_sensor.c index c43697da..500b0395 100644 --- a/src/app/driver/can/cbs/can_cbs_rx_current_sensor.c +++ b/src/app/driver/can/cbs/can_cbs_rx_current_sensor.c @@ -43,8 +43,8 @@ * @file can_cbs_rx_current_sensor.c * @author foxBMS Team * @date 2021-04-20 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVER * @prefix CAN * @@ -58,14 +58,14 @@ /*========== Macros and Definitions =========================================*/ -/* Overcurrent flag */ -#define CAN_currentSensorDiagOcs (0x1u) -/* Actual measurement error flag */ -#define CAN_currentSensorDiagActualMeasurementError (0x2u) -/* Any measurement error flag */ -#define CAN_currentSensorDiagAnyMeasurementError (0x4u) -/* System error flag */ -#define CAN_currentSensorDiagSystemError (0x8u) +/** Overcurrent flag */ +#define CAN_CURRENT_SENSOR_DIAGNOSIS_OVERCURRENT (0x1u) +/** Actual measurement error flag */ +#define CAN_CURRENT_SENSOR_DIAGNOSIS_ACTUAL_MEASUREMENT_ERROR (0x2u) +/** Any measurement error flag */ +#define CAN_CURRENT_SENSOR_DIAGNOSIS_ANY_MEASUREMENT_ERROR (0x4u) +/** System error flag */ +#define CAN_CURRENT_SENSOR_DIAGNOSIS_SYSTEM_ERROR (0x8u) /*========== Static Constant and Variable Definitions =======================*/ @@ -120,10 +120,10 @@ extern uint32_t CAN_RxCurrentSensor( diagInfo = canSignal & 0xF0u; diagInfo >>= 4u; - if ((diagInfo & CAN_currentSensorDiagOcs) != 0u) { + if ((diagInfo & CAN_CURRENT_SENSOR_DIAGNOSIS_OVERCURRENT) != 0u) { /* Overcurrent detected. This feature is currently not supported. */ } - if ((diagInfo & CAN_currentSensorDiagActualMeasurementError) != 0u) { + if ((diagInfo & CAN_CURRENT_SENSOR_DIAGNOSIS_ACTUAL_MEASUREMENT_ERROR) != 0u) { switch (id) { case CAN_ID_STRING0_CURRENT: /* Current status */ case CAN_ID_STRING1_CURRENT: @@ -180,8 +180,8 @@ extern uint32_t CAN_RxCurrentSensor( kpkCanShim->pTableCurrentSensor->invalidEnergyCountingMeasurement[stringNumber] = 0; } - if (((diagInfo & CAN_currentSensorDiagAnyMeasurementError) != 0u) || - ((diagInfo & CAN_currentSensorDiagSystemError) != 0u)) { + if (((diagInfo & CAN_CURRENT_SENSOR_DIAGNOSIS_ANY_MEASUREMENT_ERROR) != 0u) || + ((diagInfo & CAN_CURRENT_SENSOR_DIAGNOSIS_SYSTEM_ERROR) != 0u)) { kpkCanShim->pTableCurrentSensor->invalidCurrentMeasurement[stringNumber] = 1; kpkCanShim->pTableCurrentSensor->invalidHighVoltageMeasurement[stringNumber][0] = 1; kpkCanShim->pTableCurrentSensor->invalidHighVoltageMeasurement[stringNumber][1] = 1; diff --git a/src/app/driver/can/cbs/can_cbs_rx_imd.c b/src/app/driver/can/cbs/can_cbs_rx_imd.c index 78ce7f84..a30a0249 100644 --- a/src/app/driver/can/cbs/can_cbs_rx_imd.c +++ b/src/app/driver/can/cbs/can_cbs_rx_imd.c @@ -43,8 +43,8 @@ * @file can_cbs_rx_imd.c * @author foxBMS Team * @date 2021-04-20 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVER * @prefix CAN * diff --git a/src/app/driver/can/cbs/can_cbs_rx_misc.c b/src/app/driver/can/cbs/can_cbs_rx_misc.c index bf11d1a8..294e5729 100644 --- a/src/app/driver/can/cbs/can_cbs_rx_misc.c +++ b/src/app/driver/can/cbs/can_cbs_rx_misc.c @@ -43,8 +43,8 @@ * @file can_cbs_rx_misc.c * @author foxBMS Team * @date 2021-04-20 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVER * @prefix CAN * diff --git a/src/app/driver/can/cbs/can_cbs_tx_limits.c b/src/app/driver/can/cbs/can_cbs_tx_limits.c index e8fa1a08..8d536ef9 100644 --- a/src/app/driver/can/cbs/can_cbs_tx_limits.c +++ b/src/app/driver/can/cbs/can_cbs_tx_limits.c @@ -43,8 +43,8 @@ * @file can_cbs_tx_limits.c * @author foxBMS Team * @date 2021-07-21 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVER * @prefix CAN * diff --git a/src/app/driver/can/cbs/can_cbs_tx_minmax.c b/src/app/driver/can/cbs/can_cbs_tx_minmax.c index 0e36988b..59284811 100644 --- a/src/app/driver/can/cbs/can_cbs_tx_minmax.c +++ b/src/app/driver/can/cbs/can_cbs_tx_minmax.c @@ -43,8 +43,8 @@ * @file can_cbs_tx_minmax.c * @author foxBMS Team * @date 2021-04-20 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVER * @prefix CAN * diff --git a/src/app/driver/can/cbs/can_cbs_tx_state.c b/src/app/driver/can/cbs/can_cbs_tx_state.c index 6982fea7..2357e9f5 100644 --- a/src/app/driver/can/cbs/can_cbs_tx_state.c +++ b/src/app/driver/can/cbs/can_cbs_tx_state.c @@ -43,8 +43,8 @@ * @file can_cbs_tx_state.c * @author foxBMS Team * @date 2021-07-21 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVER * @prefix CAN * @@ -434,7 +434,7 @@ extern uint32_t CAN_TxStringState( /* Error: Daisy-chain redundancy: CRC: TODO */ /* Error: Daisy-chain base: Voltage out of operating range */ - data = kpkCanShim->pTableErrorState->afeCellvoltageError[stringNumber]; + data = kpkCanShim->pTableErrorState->afeCellVoltageError[stringNumber]; CAN_TxSetMessageDataWithSignalData(&message, 39u, 1u, data, endianness); /* Error: Daisy-chain redundancy: Voltage out of operating range: TODO */ @@ -479,7 +479,7 @@ extern uint32_t CAN_TxStringState( CAN_TxSetMessageDataWithSignalData(&message, 51u, 1u, data, endianness); /* Error: Plausibility: Cell voltage */ - data = kpkCanShim->pTableErrorState->plausibilityCheckCellvoltage[stringNumber]; + data = kpkCanShim->pTableErrorState->plausibilityCheckCellVoltage[stringNumber]; CAN_TxSetMessageDataWithSignalData(&message, 52u, 1u, data, endianness); /* Error: Plausibility: String voltage */ @@ -491,7 +491,7 @@ extern uint32_t CAN_TxStringState( CAN_TxSetMessageDataWithSignalData(&message, 54u, 1u, data, endianness); /* Error: Plausibility: Cell voltage spread */ - data = kpkCanShim->pTableErrorState->plausibilityCheckCellvoltageSpread[stringNumber]; + data = kpkCanShim->pTableErrorState->plausibilityCheckCellVoltageSpread[stringNumber]; CAN_TxSetMessageDataWithSignalData(&message, 55u, 1u, data, endianness); /* AXIVION Enable Style Generic-NoMagicNumbers: */ diff --git a/src/app/driver/can/cbs/can_cbs_tx_state_estimation.c b/src/app/driver/can/cbs/can_cbs_tx_state_estimation.c index a8b250c4..4a3b674c 100644 --- a/src/app/driver/can/cbs/can_cbs_tx_state_estimation.c +++ b/src/app/driver/can/cbs/can_cbs_tx_state_estimation.c @@ -43,8 +43,8 @@ * @file can_cbs_tx_state_estimation.c * @author foxBMS Team * @date 2021-07-21 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVER * @prefix CAN * diff --git a/src/app/driver/can/cbs/can_cbs_tx_system_values.c b/src/app/driver/can/cbs/can_cbs_tx_system_values.c index 8a5e7df4..c362fe90 100644 --- a/src/app/driver/can/cbs/can_cbs_tx_system_values.c +++ b/src/app/driver/can/cbs/can_cbs_tx_system_values.c @@ -43,8 +43,8 @@ * @file can_cbs_tx_system_values.c * @author foxBMS Team * @date 2021-07-21 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVER * @prefix CAN * diff --git a/src/app/driver/can/cbs/can_cbs_tx_temperature.c b/src/app/driver/can/cbs/can_cbs_tx_temperature.c index 09519344..d71372ad 100644 --- a/src/app/driver/can/cbs/can_cbs_tx_temperature.c +++ b/src/app/driver/can/cbs/can_cbs_tx_temperature.c @@ -43,8 +43,8 @@ * @file can_cbs_tx_temperature.c * @author foxBMS Team * @date 2021-04-20 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVER * @prefix CAN * @@ -66,19 +66,19 @@ * Parameters: * bit start, bit length, factor, offset, minimum value, maximum value */ -static const CAN_SIGNAL_TYPE_s cellTemperatureMultiplexer = {7u, 8u, 1.0f, 0.0f, 0.0f, 1.0f}; -static const CAN_SIGNAL_TYPE_s cell0TemperatureInvalidFlag = {8u, 1u, 1.0f, 0.0f, 0.0f, 1.0f}; -static const CAN_SIGNAL_TYPE_s cell1TemperatureInvalidFlag = {9u, 1u, 1.0f, 0.0f, 0.0f, 1.0f}; -static const CAN_SIGNAL_TYPE_s cell2TemperatureInvalidFlag = {10u, 1u, 1.0f, 0.0f, 0.0f, 1.0f}; -static const CAN_SIGNAL_TYPE_s cell3TemperatureInvalidFlag = {11u, 1u, 1.0f, 0.0f, 0.0f, 1.0f}; -static const CAN_SIGNAL_TYPE_s cell4TemperatureInvalidFlag = {12u, 1u, 1.0f, 0.0f, 0.0f, 1.0f}; -static const CAN_SIGNAL_TYPE_s cell5TemperatureInvalidFlag = {13u, 1u, 1.0f, 0.0f, 0.0f, 1.0f}; -static const CAN_SIGNAL_TYPE_s cell0Temperature_degC = {23u, 8u, 1.0f, 0.0f, -128.0f, 127.0f}; -static const CAN_SIGNAL_TYPE_s cell1Temperature_degC = {31u, 8u, 1.0f, 0.0f, -128.0f, 127.0f}; -static const CAN_SIGNAL_TYPE_s cell2Temperature_degC = {39u, 8u, 1.0f, 0.0f, -128.0f, 127.0f}; -static const CAN_SIGNAL_TYPE_s cell3Temperature_degC = {47u, 8u, 1.0f, 0.0f, -128.0f, 127.0f}; -static const CAN_SIGNAL_TYPE_s cell4Temperature_degC = {55u, 8u, 1.0f, 0.0f, -128.0f, 127.0f}; -static const CAN_SIGNAL_TYPE_s cell5Temperature_degC = {63u, 8u, 1.0f, 0.0f, -128.0f, 127.0f}; +static const CAN_SIGNAL_TYPE_s can_cellTemperatureMultiplexer = {7u, 8u, 1.0f, 0.0f, 0.0f, 1.0f}; +static const CAN_SIGNAL_TYPE_s can_cell0TemperatureInvalidFlag = {8u, 1u, 1.0f, 0.0f, 0.0f, 1.0f}; +static const CAN_SIGNAL_TYPE_s can_cell1TemperatureInvalidFlag = {9u, 1u, 1.0f, 0.0f, 0.0f, 1.0f}; +static const CAN_SIGNAL_TYPE_s can_cell2TemperatureInvalidFlag = {10u, 1u, 1.0f, 0.0f, 0.0f, 1.0f}; +static const CAN_SIGNAL_TYPE_s can_cell3TemperatureInvalidFlag = {11u, 1u, 1.0f, 0.0f, 0.0f, 1.0f}; +static const CAN_SIGNAL_TYPE_s can_cell4TemperatureInvalidFlag = {12u, 1u, 1.0f, 0.0f, 0.0f, 1.0f}; +static const CAN_SIGNAL_TYPE_s can_cell5TemperatureInvalidFlag = {13u, 1u, 1.0f, 0.0f, 0.0f, 1.0f}; +static const CAN_SIGNAL_TYPE_s can_cell0Temperature_degC = {23u, 8u, 1.0f, 0.0f, -128.0f, 127.0f}; +static const CAN_SIGNAL_TYPE_s can_cell1Temperature_degC = {31u, 8u, 1.0f, 0.0f, -128.0f, 127.0f}; +static const CAN_SIGNAL_TYPE_s can_cell2Temperature_degC = {39u, 8u, 1.0f, 0.0f, -128.0f, 127.0f}; +static const CAN_SIGNAL_TYPE_s can_cell3Temperature_degC = {47u, 8u, 1.0f, 0.0f, -128.0f, 127.0f}; +static const CAN_SIGNAL_TYPE_s can_cell4Temperature_degC = {55u, 8u, 1.0f, 0.0f, -128.0f, 127.0f}; +static const CAN_SIGNAL_TYPE_s can_cell5Temperature_degC = {63u, 8u, 1.0f, 0.0f, -128.0f, 127.0f}; /*========== Extern Constant and Variable Definitions =======================*/ @@ -194,32 +194,36 @@ extern uint32_t CAN_TxCellTemperature( /* Set mux signal in CAN frame */ uint32_t signalData = *pMuxId / 6u; /* 6 temperatures per module */ CAN_TxSetMessageDataWithSignalData( - &message, cellTemperatureMultiplexer.bitStart, cellTemperatureMultiplexer.bitLength, signalData, endianness); + &message, + can_cellTemperatureMultiplexer.bitStart, + can_cellTemperatureMultiplexer.bitLength, + signalData, + endianness); /* Set other signals in CAN frame */ /* Each temperature frame contains 6 temperatures, with a correspond invalid flag*/ CAN_TxTemperatureSetData( - *pMuxId, &message, cell0Temperature_degC, cell0TemperatureInvalidFlag, endianness, kpkCanShim); + *pMuxId, &message, can_cell0Temperature_degC, can_cell0TemperatureInvalidFlag, endianness, kpkCanShim); /* Increment multiplexer for next cell */ (*pMuxId)++; CAN_TxTemperatureSetData( - *pMuxId, &message, cell1Temperature_degC, cell1TemperatureInvalidFlag, endianness, kpkCanShim); + *pMuxId, &message, can_cell1Temperature_degC, can_cell1TemperatureInvalidFlag, endianness, kpkCanShim); /* Increment multiplexer for next cell */ (*pMuxId)++; CAN_TxTemperatureSetData( - *pMuxId, &message, cell2Temperature_degC, cell2TemperatureInvalidFlag, endianness, kpkCanShim); + *pMuxId, &message, can_cell2Temperature_degC, can_cell2TemperatureInvalidFlag, endianness, kpkCanShim); /* Increment multiplexer for next cell */ (*pMuxId)++; CAN_TxTemperatureSetData( - *pMuxId, &message, cell3Temperature_degC, cell3TemperatureInvalidFlag, endianness, kpkCanShim); + *pMuxId, &message, can_cell3Temperature_degC, can_cell3TemperatureInvalidFlag, endianness, kpkCanShim); /* Increment multiplexer for next cell */ (*pMuxId)++; CAN_TxTemperatureSetData( - *pMuxId, &message, cell4Temperature_degC, cell4TemperatureInvalidFlag, endianness, kpkCanShim); + *pMuxId, &message, can_cell4Temperature_degC, can_cell4TemperatureInvalidFlag, endianness, kpkCanShim); /* Increment multiplexer for next cell */ (*pMuxId)++; CAN_TxTemperatureSetData( - *pMuxId, &message, cell5Temperature_degC, cell5TemperatureInvalidFlag, endianness, kpkCanShim); + *pMuxId, &message, can_cell5Temperature_degC, can_cell5TemperatureInvalidFlag, endianness, kpkCanShim); /* Increment multiplexer for next cell */ (*pMuxId)++; diff --git a/src/app/driver/can/cbs/can_cbs_tx_voltage.c b/src/app/driver/can/cbs/can_cbs_tx_voltage.c index f973af0c..5f4a6609 100644 --- a/src/app/driver/can/cbs/can_cbs_tx_voltage.c +++ b/src/app/driver/can/cbs/can_cbs_tx_voltage.c @@ -43,8 +43,8 @@ * @file can_cbs_tx_voltage.c * @author foxBMS Team * @date 2021-04-20 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVER * @prefix CAN * @@ -67,15 +67,15 @@ * Parameters: * bit start, bit length, factor, offset, minimum value, maximum value */ -static const CAN_SIGNAL_TYPE_s cellVoltageMultiplexer = {7u, 8u, 1.0f, 0.0f, 0.0f, 1.0f}; -static const CAN_SIGNAL_TYPE_s cellVoltage0InvalidFlag = {12u, 1u, 1.0f, 0.0f, 0.0f, 1.0f}; -static const CAN_SIGNAL_TYPE_s cellVoltage1InvalidFlag = {13u, 1u, 1.0f, 0.0f, 0.0f, 1.0f}; -static const CAN_SIGNAL_TYPE_s cellVoltage2InvalidFlag = {14u, 1u, 1.0f, 0.0f, 0.0f, 1.0f}; -static const CAN_SIGNAL_TYPE_s cellVoltage3InvalidFlag = {15u, 1u, 1.0f, 0.0f, 0.0f, 1.0f}; -static const CAN_SIGNAL_TYPE_s cellVoltage0_mV = {11u, 13u, 1.0f, 0.0f, 0.0f, 8192.0f}; -static const CAN_SIGNAL_TYPE_s cellVoltage1_mV = {30u, 13u, 1.0f, 0.0f, 0.0f, 8192.0f}; -static const CAN_SIGNAL_TYPE_s cellVoltage2_mV = {33u, 13u, 1.0f, 0.0f, 0.0f, 8192.0f}; -static const CAN_SIGNAL_TYPE_s cellVoltage3_mV = {52u, 13u, 1.0f, 0.0f, 0.0f, 8192.0f}; +static const CAN_SIGNAL_TYPE_s can_cellVoltageMultiplexer = {7u, 8u, 1.0f, 0.0f, 0.0f, 1.0f}; +static const CAN_SIGNAL_TYPE_s can_cellVoltage0InvalidFlag = {12u, 1u, 1.0f, 0.0f, 0.0f, 1.0f}; +static const CAN_SIGNAL_TYPE_s can_cellVoltage1InvalidFlag = {13u, 1u, 1.0f, 0.0f, 0.0f, 1.0f}; +static const CAN_SIGNAL_TYPE_s can_cellVoltage2InvalidFlag = {14u, 1u, 1.0f, 0.0f, 0.0f, 1.0f}; +static const CAN_SIGNAL_TYPE_s can_cellVoltage3InvalidFlag = {15u, 1u, 1.0f, 0.0f, 0.0f, 1.0f}; +static const CAN_SIGNAL_TYPE_s can_cellVoltage0_mV = {11u, 13u, 1.0f, 0.0f, 0.0f, 8192.0f}; +static const CAN_SIGNAL_TYPE_s can_cellVoltage1_mV = {30u, 13u, 1.0f, 0.0f, 0.0f, 8192.0f}; +static const CAN_SIGNAL_TYPE_s can_cellVoltage2_mV = {33u, 13u, 1.0f, 0.0f, 0.0f, 8192.0f}; +static const CAN_SIGNAL_TYPE_s can_cellVoltage3_mV = {52u, 13u, 1.0f, 0.0f, 0.0f, 8192.0f}; /*========== Extern Constant and Variable Definitions =======================*/ @@ -173,19 +173,23 @@ extern uint32_t CAN_TxVoltage( /* Set mux signal in CAN frame */ uint32_t signalData = *pMuxId / NUMBER_OF_MUX_VOLTAGES_PER_MESSAGE; CAN_TxSetMessageDataWithSignalData( - &message, cellVoltageMultiplexer.bitStart, cellVoltageMultiplexer.bitLength, (uint32_t)signalData, endianness); + &message, + can_cellVoltageMultiplexer.bitStart, + can_cellVoltageMultiplexer.bitLength, + (uint32_t)signalData, + endianness); /* Set other signals in CAN frame */ - CAN_TxVoltageSetData(*pMuxId, &message, cellVoltage0_mV, cellVoltage0InvalidFlag, endianness, kpkCanShim); + CAN_TxVoltageSetData(*pMuxId, &message, can_cellVoltage0_mV, can_cellVoltage0InvalidFlag, endianness, kpkCanShim); /* Increment multiplexer for next cell */ (*pMuxId)++; - CAN_TxVoltageSetData(*pMuxId, &message, cellVoltage1_mV, cellVoltage1InvalidFlag, endianness, kpkCanShim); + CAN_TxVoltageSetData(*pMuxId, &message, can_cellVoltage1_mV, can_cellVoltage1InvalidFlag, endianness, kpkCanShim); /* Increment multiplexer for next cell */ (*pMuxId)++; - CAN_TxVoltageSetData(*pMuxId, &message, cellVoltage2_mV, cellVoltage2InvalidFlag, endianness, kpkCanShim); + CAN_TxVoltageSetData(*pMuxId, &message, can_cellVoltage2_mV, can_cellVoltage2InvalidFlag, endianness, kpkCanShim); /* Increment multiplexer for next cell */ (*pMuxId)++; - CAN_TxVoltageSetData(*pMuxId, &message, cellVoltage3_mV, cellVoltage3InvalidFlag, endianness, kpkCanShim); + CAN_TxVoltageSetData(*pMuxId, &message, can_cellVoltage3_mV, can_cellVoltage3InvalidFlag, endianness, kpkCanShim); /* Increment multiplexer for next cell */ (*pMuxId)++; diff --git a/src/app/driver/can/cbs/can_helper.c b/src/app/driver/can/cbs/can_helper.c index b96beb20..0a02672f 100644 --- a/src/app/driver/can/cbs/can_helper.c +++ b/src/app/driver/can/cbs/can_helper.c @@ -43,8 +43,8 @@ * @file can_helper.c * @author foxBMS Team * @date 2021-04-22 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix CAN * diff --git a/src/app/driver/can/cbs/can_helper.h b/src/app/driver/can/cbs/can_helper.h index 1d47686a..5dabd1c2 100644 --- a/src/app/driver/can/cbs/can_helper.h +++ b/src/app/driver/can/cbs/can_helper.h @@ -43,8 +43,8 @@ * @file can_helper.h * @author foxBMS Team * @date 2021-04-22 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix CAN * diff --git a/src/app/driver/checksum/checksum.c b/src/app/driver/checksum/checksum.c index 788086dc..0567d78f 100644 --- a/src/app/driver/checksum/checksum.c +++ b/src/app/driver/checksum/checksum.c @@ -43,8 +43,8 @@ * @file checksum.c * @author foxBMS Team * @date 2019-12-03 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup TODO * @prefix CHK * diff --git a/src/app/driver/checksum/checksum.h b/src/app/driver/checksum/checksum.h index 0797778c..72165340 100644 --- a/src/app/driver/checksum/checksum.h +++ b/src/app/driver/checksum/checksum.h @@ -43,8 +43,8 @@ * @file checksum.h * @author foxBMS Team * @date 2019-12-03 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup TODO * @prefix CHK * diff --git a/src/app/driver/config/can_cfg.c b/src/app/driver/config/can_cfg.c index 99b7d2e8..da645411 100644 --- a/src/app/driver/config/can_cfg.c +++ b/src/app/driver/config/can_cfg.c @@ -43,15 +43,15 @@ * @file can_cfg.c * @author foxBMS Team * @date 2019-12-04 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS_CONFIGURATION * @prefix CAN * * @brief Configuration for the CAN module * - * The CAN bus settings and the received messages and their - * reception handling are to be specified here. + * @details The CAN bus settings and the received messages and their + * reception handling are to be specified here. * * */ @@ -70,13 +70,13 @@ /*========== Static Constant and Variable Definitions =======================*/ /** Multiplexer values @{*/ -static uint8_t voltageMux = 0u; -static uint8_t temperatureMux = 0u; -static uint8_t stringStateMux = 0u; -static uint8_t stringValuesMux = 0u; -static uint8_t stringMinMaxMux = 0u; -static uint8_t stringStateEstimationMux = 0u; -static uint8_t stringValues2Mux = 0u; +static uint8_t can_voltageMux = 0u; +static uint8_t can_temperatureMux = 0u; +static uint8_t can_stringStateMux = 0u; +static uint8_t can_stringValuesMux = 0u; +static uint8_t can_stringMinMaxMux = 0u; +static uint8_t can_stringStateEstimationMux = 0u; +static uint8_t can_stringValues2Mux = 0u; /**@}*/ /*========== Extern Constant and Variable Definitions =======================*/ @@ -110,7 +110,7 @@ const CAN_MSG_TX_TYPE_s can_txMessages[] = { CAN_TX_VOLTAGES_PHASE_MS, CAN_BIG_ENDIAN, &CAN_TxVoltage, - &voltageMux}, /*!< Cell voltages */ + &can_voltageMux}, /*!< Cell voltages */ {CAN1_NODE, CAN_ID_TX_TEMPERATURES, CAN_DLC, @@ -118,7 +118,7 @@ const CAN_MSG_TX_TYPE_s can_txMessages[] = { CAN_TX_TEMPERATURES_PHASE_MS, CAN_BIG_ENDIAN, &CAN_TxCellTemperature, - &temperatureMux}, /*!< Cell temperatures */ + &can_temperatureMux}, /*!< Cell temperatures */ {CAN1_NODE, CAN_ID_TX_LIMIT_VALUES, CAN_DLC, @@ -158,7 +158,7 @@ const CAN_MSG_TX_TYPE_s can_txMessages[] = { CAN_TX_STRING_STATE_PHASE_MS, CAN_BIG_ENDIAN, &CAN_TxStringState, - &stringStateMux}, /*!< String state values */ + &can_stringStateMux}, /*!< String state values */ {CAN1_NODE, CAN_ID_TX_STRING_VALUES, CAN_DLC, @@ -166,7 +166,7 @@ const CAN_MSG_TX_TYPE_s can_txMessages[] = { CAN_TX_STRING_VALUES_PHASE_MS, CAN_BIG_ENDIAN, &CAN_TxStringValues, - &stringValuesMux}, /*!< String values */ + &can_stringValuesMux}, /*!< String values */ {CAN1_NODE, CAN_ID_TX_STRING_MINIMUM_MAXIMUM, CAN_DLC, @@ -174,7 +174,7 @@ const CAN_MSG_TX_TYPE_s can_txMessages[] = { CAN_TX_STRING_MINIMUM_MAXIMUM_PHASE_MS, CAN_BIG_ENDIAN, &CAN_TxStringMinimumMaximumValues, - &stringMinMaxMux}, /*!< String minimum maximum values */ + &can_stringMinMaxMux}, /*!< String minimum maximum values */ {CAN1_NODE, CAN_ID_TX_STRING_STATE_ESTIMATION, CAN_DLC, @@ -182,7 +182,7 @@ const CAN_MSG_TX_TYPE_s can_txMessages[] = { CAN_TX_STRING_STATE_ESTIMATION_PHASE_MS, CAN_BIG_ENDIAN, &CAN_TxStringStateEstimation, - &stringStateEstimationMux}, /*!< String minimum maximum values */ + &can_stringStateEstimationMux}, /*!< String minimum maximum values */ {CAN1_NODE, CAN_ID_TX_STRING_VALUES_2, CAN_DLC, @@ -190,8 +190,7 @@ const CAN_MSG_TX_TYPE_s can_txMessages[] = { CAN_TX_STRING_VALUES_2_PHASE_MS, CAN_BIG_ENDIAN, &CAN_TxStringValues2, - &stringValues2Mux}, /*!< String minimum maximum values */ - + &can_stringValues2Mux}, /*!< String minimum maximum values */ }; /* *************************************** @@ -205,7 +204,7 @@ const CAN_MSG_RX_TYPE_s can_rxMessages[] = { CAN_ID_IMD_RESPONSE, CAN_DLC, CAN_LITTLE_ENDIAN, - &CAN_RxImdResponse}, /*!< response mesage from iso165c */ + &CAN_RxImdResponse}, /*!< response message from iso165c */ {CAN1_NODE, CAN_ID_COMMAND, CAN_DLC, CAN_BIG_ENDIAN, &CAN_RxRequest}, /*!< state request */ {CAN1_NODE, CAN_ID_SOFTWARE_RESET, CAN_DLC, CAN_LITTLE_ENDIAN, &CAN_RxSwReset}, /*!< software reset */ diff --git a/src/app/driver/config/can_cfg.h b/src/app/driver/config/can_cfg.h index ac8d1b7c..9f1cedf5 100644 --- a/src/app/driver/config/can_cfg.h +++ b/src/app/driver/config/can_cfg.h @@ -43,15 +43,15 @@ * @file can_cfg.h * @author foxBMS Team * @date 2019-12-04 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix CAN * * @brief Headers for the configuration for the CAN module * - * The activation and the length of the message buffers as well as the number of - * the messages that are received are to be configured here + * @details The activation and the length of the message buffers as well as the + * number of the messages that are received are to be configured here. * */ diff --git a/src/app/driver/config/contactor_cfg.c b/src/app/driver/config/contactor_cfg.c index 35973241..a49ae5ce 100644 --- a/src/app/driver/config/contactor_cfg.c +++ b/src/app/driver/config/contactor_cfg.c @@ -43,8 +43,8 @@ * @file contactor_cfg.c * @author foxBMS Team * @date 2020-02-11 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS_CONF * @prefix CONT * diff --git a/src/app/driver/config/contactor_cfg.h b/src/app/driver/config/contactor_cfg.h index 8522d49a..9e5b259c 100644 --- a/src/app/driver/config/contactor_cfg.h +++ b/src/app/driver/config/contactor_cfg.h @@ -43,8 +43,8 @@ * @file contactor_cfg.h * @author foxBMS Team * @date 2020-02-11 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS_CONFIGURATION * @prefix CONT * diff --git a/src/app/driver/config/dma_cfg.c b/src/app/driver/config/dma_cfg.c index f068109f..ee861a6e 100644 --- a/src/app/driver/config/dma_cfg.c +++ b/src/app/driver/config/dma_cfg.c @@ -43,15 +43,13 @@ * @file dma_cfg.c * @author foxBMS Team * @date 2020-03-05 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS_CONFIGURATION * @prefix DMA * * @brief Configuration for the DMA module * - * - * */ /*========== Includes =======================================================*/ diff --git a/src/app/driver/config/dma_cfg.h b/src/app/driver/config/dma_cfg.h index f3bc6f29..fb350efc 100644 --- a/src/app/driver/config/dma_cfg.h +++ b/src/app/driver/config/dma_cfg.h @@ -43,8 +43,8 @@ * @file dma_cfg.h * @author foxBMS Team * @date 2020-03-05 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS_CONFIGURATION * @prefix DMA * @@ -104,11 +104,11 @@ #define DMA_BIG_ENDIAN_ADDRESS_16BIT (2u) /** number of spi interfaces for DMA */ -#define DMA_NUMBER_SPI_INTERFACES 5u +#define DMA_NUMBER_SPI_INTERFACES (5u) /** DMA Request enable bit */ -#define DMAREQEN_BIT (0x10000U) +#define DMAREQEN_BIT (0x10000u) /** SPI enable bit */ -#define SPIEN_BIT (0x1000000U) +#define SPIEN_BIT (0x1000000u) /** DMA request line for LTC */ /**@{*/ diff --git a/src/app/driver/config/fram_cfg.c b/src/app/driver/config/fram_cfg.c index 698536c9..06d6558f 100644 --- a/src/app/driver/config/fram_cfg.c +++ b/src/app/driver/config/fram_cfg.c @@ -43,15 +43,13 @@ * @file fram_cfg.c * @author foxBMS Team * @date 2020-03-05 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS_CONFIGURATION * @prefix FRAM * * @brief Configuration for the FRAM module * - * - * */ /*========== Includes =======================================================*/ diff --git a/src/app/driver/config/fram_cfg.h b/src/app/driver/config/fram_cfg.h index 35a909a8..dbedb71d 100644 --- a/src/app/driver/config/fram_cfg.h +++ b/src/app/driver/config/fram_cfg.h @@ -43,8 +43,8 @@ * @file fram_cfg.h * @author foxBMS Team * @date 2020-03-05 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix FRAM * diff --git a/src/app/driver/config/interlock_cfg.c b/src/app/driver/config/interlock_cfg.c index 56a47e59..3ccbe1ed 100644 --- a/src/app/driver/config/interlock_cfg.c +++ b/src/app/driver/config/interlock_cfg.c @@ -43,8 +43,8 @@ * @file interlock_cfg.c * @author foxBMS Team * @date 2020-02-24 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS_CONFIGURATION * @prefix CONT * diff --git a/src/app/driver/config/interlock_cfg.h b/src/app/driver/config/interlock_cfg.h index fa95286d..71d3f9e8 100644 --- a/src/app/driver/config/interlock_cfg.h +++ b/src/app/driver/config/interlock_cfg.h @@ -43,8 +43,8 @@ * @file interlock_cfg.h * @author foxBMS Team * @date 2020-02-24 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS_CONFIGURATION * @prefix ILCK * diff --git a/src/app/driver/config/nxpfs85xx_cfg.c b/src/app/driver/config/nxpfs85xx_cfg.c index 296de0ec..07ff49f9 100644 --- a/src/app/driver/config/nxpfs85xx_cfg.c +++ b/src/app/driver/config/nxpfs85xx_cfg.c @@ -43,8 +43,8 @@ * @file nxpfs85xx_cfg.c * @author foxBMS Team * @date 2020-03-18 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS_CONFIGURATION * @prefix SBC * diff --git a/src/app/driver/config/nxpfs85xx_cfg.h b/src/app/driver/config/nxpfs85xx_cfg.h index 0fa8ec44..1dec0080 100644 --- a/src/app/driver/config/nxpfs85xx_cfg.h +++ b/src/app/driver/config/nxpfs85xx_cfg.h @@ -43,8 +43,8 @@ * @file nxpfs85xx_cfg.h * @author foxBMS Team * @date 2020-03-18 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS_CONFIGURATION * @prefix SBC * diff --git a/src/app/driver/config/pex_cfg.c b/src/app/driver/config/pex_cfg.c index e77b3dca..16b9d431 100644 --- a/src/app/driver/config/pex_cfg.c +++ b/src/app/driver/config/pex_cfg.c @@ -43,15 +43,13 @@ * @file pex_cfg.c * @author foxBMS Team * @date 2021-08-02 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS_CONFIGURATION * @prefix PEX * * @brief Configuration for the NXP PCA9539 port expander module * - * - * */ /*========== Includes =======================================================*/ diff --git a/src/app/driver/config/pex_cfg.h b/src/app/driver/config/pex_cfg.h index a460f524..a26dc3e6 100644 --- a/src/app/driver/config/pex_cfg.h +++ b/src/app/driver/config/pex_cfg.h @@ -43,8 +43,8 @@ * @file pex_cfg.h * @author foxBMS Team * @date 2021-08-02 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS_CONFIGURATION * @prefix PEX * diff --git a/src/app/driver/config/spi_cfg.c b/src/app/driver/config/spi_cfg.c index ab7f601e..53ee5c29 100644 --- a/src/app/driver/config/spi_cfg.c +++ b/src/app/driver/config/spi_cfg.c @@ -43,15 +43,13 @@ * @file spi_cfg.c * @author foxBMS Team * @date 2020-03-05 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS_CONFIGURATION * @prefix SPI * * @brief Configuration for the SPI module * - * - * */ /*========== Includes =======================================================*/ @@ -105,15 +103,15 @@ static spiDAT1_t spi_kMxmDataConfig = { static spiDAT1_t spi_kNxp775DataConfigTx[BS_NR_OF_STRINGS] = { {.CS_HOLD = TRUE, /* If true, HW chip select kept active */ .WDEL = TRUE, /* Activation of delay between words */ - .DFSEL = SPI_FMT_0, /* Data word format selection */ - .CSNR = SPI_HARDWARE_CHIP_SELECT_2_ACTIVE}, + .DFSEL = SPI_FMT_2, /* Data word format selection */ + .CSNR = SPI_HARDWARE_CHIP_SELECT_1_ACTIVE}, }; /** SPI data configuration struct for NXP MC33775A communication, Rx part */ static spiDAT1_t spi_kNxp775DataConfigRx[BS_NR_OF_STRINGS] = { {.CS_HOLD = TRUE, /* If true, HW chip select kept active */ .WDEL = TRUE, /* Activation of delay between words */ - .DFSEL = SPI_FMT_0, /* Data word format selection */ + .DFSEL = SPI_FMT_2, /* Data word format selection */ .CSNR = SPI_HARDWARE_CHIP_SELECT_0_ACTIVE}, }; @@ -183,7 +181,7 @@ SPI_INTERFACE_CONFIG_s spi_ltcInterface[BS_NR_OF_STRINGS] = { }; /** SPI interface configuration for MXM communication */ -SPI_INTERFACE_CONFIG_s spi_MxmInterface = { +SPI_INTERFACE_CONFIG_s spi_mxmInterface = { .pConfig = &spi_kMxmDataConfig, .pNode = spiREG4, .pGioPort = &(spiREG4->PC3), @@ -197,7 +195,7 @@ SPI_INTERFACE_CONFIG_s spi_nxp775InterfaceTx[BS_NR_OF_STRINGS] = { .pConfig = &spi_kNxp775DataConfigTx[0u], .pNode = spiREG1, .pGioPort = &(spiREG1->PC3), - .csPin = 2u, + .csPin = 1u, .csType = SPI_CHIP_SELECT_HARDWARE, }, }; @@ -226,8 +224,8 @@ SPI_INTERFACE_CONFIG_s spi_framInterface = { SPI_INTERFACE_CONFIG_s spi_spsInterface = { .pConfig = &spi_kSpsDataConfigLowSpeed, .pNode = spiREG2, - .pGioPort = &SPS_SPI_CS_GIOPORT, - .csPin = SPS_SPI_CS_PIN, + .pGioPort = &SPI_SPS_CS_GIOPORT, + .csPin = SPI_SPS_CS_PIN, .csType = SPI_CHIP_SELECT_SOFTWARE, }; diff --git a/src/app/driver/config/spi_cfg.h b/src/app/driver/config/spi_cfg.h index 27f76e03..3d063a57 100644 --- a/src/app/driver/config/spi_cfg.h +++ b/src/app/driver/config/spi_cfg.h @@ -43,8 +43,8 @@ * @file spi_cfg.h * @author foxBMS Team * @date 2020-03-05 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS_CONFIGURATION * @prefix SPI * @@ -75,16 +75,16 @@ /**@}*/ /** Bit in SPIDAT1 register that activates hardware Chip Select hold */ -#define SPI_CSHOLD_BIT (0x10000000U) +#define SPI_CSHOLD_BIT (0x10000000u) /** Bit in SPIDAT1 register that activates delay between words */ -#define SPI_WDEL_BIT (0x04000000U) +#define SPI_WDEL_BIT (0x04000000u) /** Position of CSNR field in SPIDAT1 register */ -#define SPI_HARDWARE_CHIP_SELECT_FIELD_POSITION (16U) +#define SPI_HARDWARE_CHIP_SELECT_FIELD_POSITION (16u) /** Position of DFSEL field in SPIDAT1 register */ -#define SPI_DATA_FORMAT_FIELD_POSITION (24U) +#define SPI_DATA_FORMAT_FIELD_POSITION (24u) /** Position of TX buffer empty flag in SPIFLG register */ #define SPI_TX_BUFFER_EMPTY_FLAG_POSITION (9u) @@ -98,27 +98,10 @@ /** Max number of hardware chip select pins */ #define SPI_MAX_NUMBER_HW_CS (6u) -/* TODO: check definition of SPI nodes depending on target hardware */ -/** SPI defines for LTC */ -#define LTC_SPI_NODE (spiREG1) - /** GIO defines for SPI for Smart Power Switches @{ */ -#define SPS_SPI_CS_GIOPORT (hetREG2->DOUT) -#define SPS_SPI_CS_GIOPORT_DIR (hetREG2->DIR) -#define SPS_SPI_CS_PIN (1u) -/**@}*/ - -/** - * SPI defines for NXP MC33775A - * @{ - */ -#define N775_SPI_TX_NODE (spiREG1) -#define N775_SPI_TX_GIOPORT (N775_SPI_TX_NODE->PC3) -#define N775_SPI_TX_CS_PIN (2U) - -#define N775_SPI_RX_NODE (spiREG5) -#define N775_SPI_RX_GIOPORT (N775_SPI_TX_NODE->PC3) -#define N775_SPI_RX_CS_PIN (2U) +#define SPI_SPS_CS_GIOPORT (hetREG2->DOUT) +#define SPI_SPS_CS_GIOPORT_DIR (hetREG2->DIR) +#define SPI_SPS_CS_PIN (1u) /**@}*/ /** enum for spi interface state */ @@ -148,7 +131,7 @@ typedef struct { /*========== Extern Constant and Variable Declarations ======================*/ extern SPI_INTERFACE_CONFIG_s spi_ltcInterface[BS_NR_OF_STRINGS]; -extern SPI_INTERFACE_CONFIG_s spi_MxmInterface; +extern SPI_INTERFACE_CONFIG_s spi_mxmInterface; extern SPI_INTERFACE_CONFIG_s spi_nxp775InterfaceTx[BS_NR_OF_STRINGS]; extern SPI_INTERFACE_CONFIG_s spi_nxp775InterfaceRx[BS_NR_OF_STRINGS]; extern SPI_INTERFACE_CONFIG_s spi_framInterface; diff --git a/src/app/driver/config/sps_cfg.c b/src/app/driver/config/sps_cfg.c index 9fb3ef9b..91065939 100644 --- a/src/app/driver/config/sps_cfg.c +++ b/src/app/driver/config/sps_cfg.c @@ -43,8 +43,8 @@ * @file sps_cfg.c * @author foxBMS Team * @date 2020-10-14 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS_CONF * @prefix SPS * diff --git a/src/app/driver/config/sps_cfg.h b/src/app/driver/config/sps_cfg.h index b2f9134f..ca3f22cc 100644 --- a/src/app/driver/config/sps_cfg.h +++ b/src/app/driver/config/sps_cfg.h @@ -43,8 +43,8 @@ * @file sps_cfg.h * @author foxBMS Team * @date 2020-10-14 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS_CONF * @prefix SPS * diff --git a/src/app/driver/config/tsi_plausibility_cfg.h b/src/app/driver/config/tsi_plausibility_cfg.h index bf769baa..8015ed70 100644 --- a/src/app/driver/config/tsi_plausibility_cfg.h +++ b/src/app/driver/config/tsi_plausibility_cfg.h @@ -43,8 +43,8 @@ * @file tsi_plausibility_cfg.h * @author foxBMS Team * @date 2019-01-24 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup MODULES * @prefix TSI * diff --git a/src/app/driver/contactor/contactor.c b/src/app/driver/contactor/contactor.c index e956343b..88edfe7b 100644 --- a/src/app/driver/contactor/contactor.c +++ b/src/app/driver/contactor/contactor.c @@ -43,8 +43,8 @@ * @file contactor.c * @author foxBMS Team * @date 2020-02-11 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix CONT * @@ -245,7 +245,7 @@ extern STD_RETURN_TYPE_e CONT_ClosePrecharge(uint8_t stringNumber) { FAS_ASSERT(stringNumber < BS_NR_OF_STRINGS); STD_RETURN_TYPE_e retVal = STD_NOT_OK; uint8_t prechargeContactorNumber = 0u; - f_static_assert((BS_NR_OF_STRINGS <= (uint8_t)UINT8_MAX), "This code assumes BS_NR_OF_STRINGS fits into uint8_t"); + FAS_STATIC_ASSERT((BS_NR_OF_STRINGS <= (uint8_t)UINT8_MAX), "This code assumes BS_NR_OF_STRINGS fits into uint8_t"); /* Precharge contactors in the list stay after string contactors * so it has index (number of contactors)-1 diff --git a/src/app/driver/contactor/contactor.h b/src/app/driver/contactor/contactor.h index daa20d26..14e59cec 100644 --- a/src/app/driver/contactor/contactor.h +++ b/src/app/driver/contactor/contactor.h @@ -43,8 +43,8 @@ * @file contactor.h * @author foxBMS Team * @date 2020-02-11 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix CONT * diff --git a/src/app/driver/crc/crc.c b/src/app/driver/crc/crc.c index 4ca9f177..5c64ea11 100644 --- a/src/app/driver/crc/crc.c +++ b/src/app/driver/crc/crc.c @@ -43,8 +43,8 @@ * @file crc.c * @author foxBMS Team * @date 2022-02-22 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix CRC * @@ -94,10 +94,9 @@ extern STD_RETURN_TYPE_e CRC_CalculateCrc(uint64_t *pCrc, uint8_t *pData, uint32 /* Set mode to Full-CPU Mode to start the computation when writing the data*/ crcREG1->CTRL2 |= CRC_FULL_CPU_MODE_SET_MASK; - /* AXIVION Disable Style MisraC2012-11.3: 64 bit access needed, partial 32 bit access starts computation */ + /* AXIVION Next Codeline Style MisraC2012-11.3: 64 bit access needed, partial 32 bit access starts computation */ /* Pointer to access the two signature registers, where input data will be written */ volatile uint64_t *pCrcRegister = (volatile uint64 *)(&crcREG1->PSA_SIGREGL1); - /* AXIVION Enable Style MisraC2012-11.3: */ /* Treat packets of 64 bit data */ while (remainingBytes >= CRC_REGISTER_SIZE_IN_BYTES) { diff --git a/src/app/driver/crc/crc.h b/src/app/driver/crc/crc.h index e2329067..cf586a46 100644 --- a/src/app/driver/crc/crc.h +++ b/src/app/driver/crc/crc.h @@ -43,8 +43,8 @@ * @file crc.h * @author foxBMS Team * @date 2022-02-22 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix CRC * diff --git a/src/app/driver/dma/dma.c b/src/app/driver/dma/dma.c index 4cdeebed..ac0e4fcc 100644 --- a/src/app/driver/dma/dma.c +++ b/src/app/driver/dma/dma.c @@ -43,8 +43,8 @@ * @file dma.c * @author foxBMS Team * @date 2019-12-12 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix DMA * @@ -219,7 +219,7 @@ void DMA_Initialize(void) { } /** Function called on DMA complete interrupts (TX and RX). Defined as weak in HAL. */ -/* AXIVION Next Line Style Linker-Multiple_Definition: TI HAL only provides a weak implementation */ +/* AXIVION Next Codeline Style Linker-Multiple_Definition: TI HAL only provides a weak implementation */ void UNIT_TEST_WEAK_IMPL dmaGroupANotification(dmaInterrupt_t inttype, uint32 channel) { /* AXIVION Routine Generic-MissingParameterAssert: inttype: unchecked in interrupt */ /* AXIVION Routine Generic-MissingParameterAssert: channel: unchecked in interrupt */ diff --git a/src/app/driver/dma/dma.h b/src/app/driver/dma/dma.h index 2c5194d0..f7390e32 100644 --- a/src/app/driver/dma/dma.h +++ b/src/app/driver/dma/dma.h @@ -43,8 +43,8 @@ * @file dma.h * @author foxBMS Team * @date 2019-12-12 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix DMA * @@ -61,15 +61,6 @@ /*========== Macros and Definitions =========================================*/ /*========== Extern Constant and Variable Declarations ======================*/ -/** tx control packet for DMA */ -extern g_dmaCTRL g_dmaCTRLPKT_TX; -/** rx control packet for DMA */ -extern g_dmaCTRL g_dmaCTRLPKT_RX; - -/** tx control packet for N775 DMA */ -extern g_dmaCTRL dma_n775DmaControlPacketTx; -/** rx control packet for N775 DMA */ -extern g_dmaCTRL dma_n775DmaControlPacketRx; /*========== Extern Function Prototypes =====================================*/ @@ -79,13 +70,6 @@ extern g_dmaCTRL dma_n775DmaControlPacketRx; */ extern void DMA_Initialize(void); -/** - * @brief Re-enables the DMA module. - * @details This function re-enables the DMA streams. Called in DMA complete - * interrupt. - */ -extern void DMA_ReInit(void); - /** * @brief gets the SPI transmit status. * @return retval true if transmission still ongoing, false otherwise @@ -119,26 +103,6 @@ extern void DMA_SetTxTransmitOngoingN775(void); */ extern void DMA_SetRxTransmitOngoingN775(void); -/** - * @brief enables the DMA module. - * This function enables the DMA streams. - */ -void DMA_InitN775(void); - -/** - * @brief Re-enables the DMA module. - * This function re-enables the DMA streams. - * Called in DMA complete interrupt. - */ -void DMA_ReInitN775Tx(void); - -/** - * @brief Re-enables the DMA module. - * This function re-enables the DMA streams. - * Called in DMA complete interrupt. - */ -void DMA_ReInitN775Rx(void); - /*========== Externalized Static Functions Prototypes (Unit Test) ===========*/ #endif /* FOXBMS__DMA_H_ */ diff --git a/src/app/driver/foxmath/foxmath.c b/src/app/driver/foxmath/foxmath.c index 86e85e43..aad83043 100644 --- a/src/app/driver/foxmath/foxmath.c +++ b/src/app/driver/foxmath/foxmath.c @@ -43,8 +43,8 @@ * @file foxmath.c * @author foxBMS Team * @date 2018-01-18 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix MATH * @@ -75,7 +75,8 @@ /*========== Extern Function Implementations ================================*/ -/* AXIVION Disable Style Generic-MissingParameterAssert: If not specified otherwise, functions in this lib are designed to take full range input. No assert needed. */ +/* AXIVION Disable Style Generic-MissingParameterAssert: If not specified otherwise, functions in this lib are + designed to take full range input. No assert needed. */ extern void MATH_StartupSelfTest(void) { FAS_ASSERT(MATH_AbsInt64_t(INT64_MIN) == INT64_MAX); diff --git a/src/app/driver/foxmath/foxmath.h b/src/app/driver/foxmath/foxmath.h index 7690c94f..26665425 100644 --- a/src/app/driver/foxmath/foxmath.h +++ b/src/app/driver/foxmath/foxmath.h @@ -43,8 +43,8 @@ * @file foxmath.h * @author foxBMS Team * @date 2018-01-18 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix MATH * diff --git a/src/app/driver/fram/fram.c b/src/app/driver/fram/fram.c index c30043cf..08be0488 100644 --- a/src/app/driver/fram/fram.c +++ b/src/app/driver/fram/fram.c @@ -43,8 +43,8 @@ * @file fram.c * @author foxBMS Team * @date 2020-03-05 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix FRAM * @@ -65,7 +65,7 @@ /*========== Macros and Definitions =========================================*/ /** delay in µs after writing the FRAM */ -#define FRAM_DELAY_AFTER_WRITE_ENABLE_US (5U) +#define FRAM_DELAY_AFTER_WRITE_ENABLE_US (5u) /** control commands for the FRAM */ /**@{*/ diff --git a/src/app/driver/fram/fram.h b/src/app/driver/fram/fram.h index 8be328f5..09beb2cd 100644 --- a/src/app/driver/fram/fram.h +++ b/src/app/driver/fram/fram.h @@ -43,8 +43,8 @@ * @file fram.h * @author foxBMS Team * @date 2020-03-05 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix FRAM * diff --git a/src/app/driver/htsensor/htsensor.c b/src/app/driver/htsensor/htsensor.c index f371c978..4a9a0e24 100644 --- a/src/app/driver/htsensor/htsensor.c +++ b/src/app/driver/htsensor/htsensor.c @@ -43,8 +43,8 @@ * @file htsensor.c * @author foxBMS Team * @date 2021-08-05 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix HTSEN * diff --git a/src/app/driver/htsensor/htsensor.h b/src/app/driver/htsensor/htsensor.h index eeb49326..58123964 100644 --- a/src/app/driver/htsensor/htsensor.h +++ b/src/app/driver/htsensor/htsensor.h @@ -43,8 +43,8 @@ * @file htsensor.h * @author foxBMS Team * @date 2021-08-05 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix HTSEN * diff --git a/src/app/driver/i2c/i2c.c b/src/app/driver/i2c/i2c.c index fd2c94a3..9ac541eb 100644 --- a/src/app/driver/i2c/i2c.c +++ b/src/app/driver/i2c/i2c.c @@ -43,8 +43,8 @@ * @file i2c.c * @author foxBMS Team * @date 2021-07-22 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix I2C * @@ -445,15 +445,14 @@ extern STD_RETURN_TYPE_e I2C_ReadDma(uint32_t slaveAddress, uint8_t readAddress, FAS_ASSERT(raisePrivilegeResult == 0); /* Set Tx buffer address */ - /* AXIVION Disable Style MisraC2012-1.1: Cast necessary for DMA configuration */ + /* AXIVION Next Codeline Style MisraC2012-1.1: Cast necessary for DMA configuration */ dmaRAMREG->PCP[(dmaChannel_t)DMA_CHANNEL_I2C_RX].IDADDR = (uint32_t)readData; - /* AXIVION Enable Style MisraC2012-1.1: */ /* Set number of Tx bytes to transmit */ dmaRAMREG->PCP[(dmaChannel_t)DMA_CHANNEL_I2C_RX].ITCOUNT = (nrBytes << 16U) | 1U; dmaSetChEnable((dmaChannel_t)DMA_CHANNEL_I2C_RX, (dmaTriggerType_t)DMA_HW); - FSYS_SwitchToUserMode(); /* DMA config registers written, leave privileged mode */ + FSYS_SWITCH_TO_USER_MODE(); /* DMA config registers written, leave privileged mode */ OS_ExitTaskCritical(); i2cREG1->DMACR |= (uint32_t)I2C_RXDMAEN; /* Activate I2C DMA RX */ @@ -517,15 +516,15 @@ extern STD_RETURN_TYPE_e I2C_WriteDma( FAS_ASSERT(raisePrivilegeResult == 0); /* Set Tx buffer address */ - /* AXIVION Disable Style MisraC2012-1.1: Cast necessary for DMA configuration */ + /* AXIVION Next Codeline Style MisraC2012-1.1: Cast necessary for DMA configuration */ dmaRAMREG->PCP[(dmaChannel_t)DMA_CHANNEL_I2C_TX].ISADDR = (uint32_t)writeData; - /* AXIVION Enable Style MisraC2012-1.1: */ + /* Set number of Tx bytes to transmit */ dmaRAMREG->PCP[(dmaChannel_t)DMA_CHANNEL_I2C_TX].ITCOUNT = (nrBytes << 16U) | 1U; dmaSetChEnable((dmaChannel_t)DMA_CHANNEL_I2C_TX, (dmaTriggerType_t)DMA_HW); - FSYS_SwitchToUserMode(); /* DMA config registers written, leave privileged mode */ + FSYS_SWITCH_TO_USER_MODE(); /* DMA config registers written, leave privileged mode */ OS_ExitTaskCritical(); i2cSetMode(i2cREG1, (uint32_t)I2C_MASTER); /* Set as master */ diff --git a/src/app/driver/i2c/i2c.h b/src/app/driver/i2c/i2c.h index 56e5bd35..98ba6534 100644 --- a/src/app/driver/i2c/i2c.h +++ b/src/app/driver/i2c/i2c.h @@ -43,8 +43,8 @@ * @file i2c.h * @author foxBMS Team * @date 2021-07-22 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix I2C * @@ -63,7 +63,7 @@ /*========== Macros and Definitions =========================================*/ /** Timeout to avoid infinite loops when waiting for flags */ -#define I2C_TIMEOUT_ITERATIONS (1000u) +#define I2C_TIMEOUT_ITERATIONS (200u) /** Transmitter DMA enable */ #define I2C_TXDMAEN (0x2u) diff --git a/src/app/driver/imd/bender/ir155/bender_ir155.c b/src/app/driver/imd/bender/ir155/bender_ir155.c index 2b2f2987..abebfc14 100644 --- a/src/app/driver/imd/bender/ir155/bender_ir155.c +++ b/src/app/driver/imd/bender/ir155/bender_ir155.c @@ -43,8 +43,8 @@ * @file bender_ir155.c * @author foxBMS Team * @date 2014-02-11 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix IR155 * diff --git a/src/app/driver/imd/bender/ir155/bender_ir155.h b/src/app/driver/imd/bender/ir155/bender_ir155.h index 65a661b1..ca4ba07b 100644 --- a/src/app/driver/imd/bender/ir155/bender_ir155.h +++ b/src/app/driver/imd/bender/ir155/bender_ir155.h @@ -43,8 +43,8 @@ * @file bender_ir155.h * @author foxBMS Team * @date 2021-09-06 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix IR155 * diff --git a/src/app/driver/imd/bender/ir155/bender_ir155_helper.c b/src/app/driver/imd/bender/ir155/bender_ir155_helper.c index 50f89b50..f5578c59 100644 --- a/src/app/driver/imd/bender/ir155/bender_ir155_helper.c +++ b/src/app/driver/imd/bender/ir155/bender_ir155_helper.c @@ -43,8 +43,8 @@ * @file bender_ir155_helper.c * @author foxBMS Team * @date 2021-09-17 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix IR155 * @@ -244,7 +244,7 @@ IR155_MEASUREMENT_s IR155_GetMeasurementValues(void) { measurementResult.digitalStatusPin = IR155_GET_DIGITAL_STATUS_PIN_STATE(); /* get duty-cycle and frequency from PWM input measurement */ - measurementResult.pwmSignal = ECAP_GetPwmData(); + measurementResult.pwmSignal = PWM_GetPwmData(); /* TODO: How-to check valid data? */ bool isPwmMeasurementValid = true; diff --git a/src/app/driver/imd/bender/ir155/bender_ir155_helper.h b/src/app/driver/imd/bender/ir155/bender_ir155_helper.h index 90f40510..717d58d5 100644 --- a/src/app/driver/imd/bender/ir155/bender_ir155_helper.h +++ b/src/app/driver/imd/bender/ir155/bender_ir155_helper.h @@ -43,8 +43,8 @@ * @file bender_ir155_helper.h * @author foxBMS Team * @date 2021-09-17 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix IR155 * diff --git a/src/app/driver/imd/bender/ir155/config/bender_ir155_cfg.h b/src/app/driver/imd/bender/ir155/config/bender_ir155_cfg.h index 662ab242..773c9e7c 100644 --- a/src/app/driver/imd/bender/ir155/config/bender_ir155_cfg.h +++ b/src/app/driver/imd/bender/ir155/config/bender_ir155_cfg.h @@ -43,8 +43,8 @@ * @file bender_ir155_cfg.h * @author foxBMS Team * @date 2021-09-17 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS_CONFIGURATION * @prefix IR155 * diff --git a/src/app/driver/imd/bender/ir155/wscript b/src/app/driver/imd/bender/ir155/wscript index dee4ac02..ffdd81f6 100644 --- a/src/app/driver/imd/bender/ir155/wscript +++ b/src/app/driver/imd/bender/ir155/wscript @@ -70,7 +70,7 @@ def build(bld): os.path.join("..", "..", "..", "..", "task", "os"), os.path.join("..", "..", "..", "..", "task", "ftask"), ] - includes.extend(bld.env.INCLUDES_OPERATING_SYSTEM) + includes.extend(bld.env.INCLUDES_RTOS) cflags = bld.env.CFLAGS_FOXBMS bld( features="c", diff --git a/src/app/driver/imd/bender/iso165c/bender_iso165c.c b/src/app/driver/imd/bender/iso165c/bender_iso165c.c index 93586cc9..b642e5b7 100644 --- a/src/app/driver/imd/bender/iso165c/bender_iso165c.c +++ b/src/app/driver/imd/bender/iso165c/bender_iso165c.c @@ -43,8 +43,8 @@ * @file bender_iso165c.c * @author foxBMS Team * @date 2019-04-07 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix I165C * @@ -65,7 +65,7 @@ #include "ftask.h" /*========== Macros and Definitions =========================================*/ -/** statemachine short time definition in trigger calls until next state is processed */ +/** state machine short time definition in trigger calls until next state is processed */ #define I165C_FSM_SHORT_TIME (1u) /* -------------- State defines ---------------------------------------------*/ @@ -202,7 +202,6 @@ static I165C_RUNNING_STATE_s i165c_runningState = { .previousState = I165C_FSM_STATE_RUNNING_DUMMY, .receptionTries = 0u, .receptionTriesMessage = 0u, - }; static I165C_DISABLE_STATE_s i165c_disableState = { @@ -212,7 +211,6 @@ static I165C_DISABLE_STATE_s i165c_disableState = { .previousState = I165C_FSM_STATE_DISABLE_DUMMY, .receptionTries = 0u, .receptionTriesMessage = 0u, - }; static CAN_BUFFERELEMENT_s i165c_canTxMessage = {0u}; @@ -1103,7 +1101,6 @@ static IMD_FSM_STATES_e I165C_Initialize(void) { /* Reset state machine in case a re-initialization is necessary */ I165C_SetInitializationState( &i165c_initializationState, I165C_FSM_STATE_INITIALIZATION_HAS_NEVER_RUN, I165C_FSM_SHORT_TIME); - } else { /* Issue: 621 */ } @@ -1289,7 +1286,7 @@ static IMD_FSM_STATES_e I165C_Running(DATA_BLOCK_INSULATION_MONITORING_s *pTable if (I165C_GetImdInfo(&i165c_canRxMessage) == false) { i165c_runningState.receptionTriesMessage++; /* Issue: 621 */ - /* IMD_Info not comming: restart initialization procedure? + /* IMD_Info not coming: restart initialization procedure? if (i165c_runningState.receptionTriesMessage >= I165C_IMD_INFO_RECEIVE_ATTEMPTS) {*/ } else { i165c_runningState.receptionTriesMessage = 0u; diff --git a/src/app/driver/imd/bender/iso165c/bender_iso165c.h b/src/app/driver/imd/bender/iso165c/bender_iso165c.h index 970e999b..aada1ae1 100644 --- a/src/app/driver/imd/bender/iso165c/bender_iso165c.h +++ b/src/app/driver/imd/bender/iso165c/bender_iso165c.h @@ -43,8 +43,8 @@ * @file bender_iso165c.h * @author foxBMS Team * @date 2019-04-07 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix I165C * diff --git a/src/app/driver/imd/bender/iso165c/config/bender_iso165c_cfg.c b/src/app/driver/imd/bender/iso165c/config/bender_iso165c_cfg.c index c260e779..54e1bdb4 100644 --- a/src/app/driver/imd/bender/iso165c/config/bender_iso165c_cfg.c +++ b/src/app/driver/imd/bender/iso165c/config/bender_iso165c_cfg.c @@ -43,15 +43,13 @@ * @file bender_iso165c_cfg.c * @author foxBMS Team * @date 2021-03-17 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS_CONFIGURATION * @prefix I165C * * @brief Configuration for the insulation monitoring * - * - * */ /*========== Includes =======================================================*/ diff --git a/src/app/driver/imd/bender/iso165c/config/bender_iso165c_cfg.h b/src/app/driver/imd/bender/iso165c/config/bender_iso165c_cfg.h index f3b0f21c..389aae8a 100644 --- a/src/app/driver/imd/bender/iso165c/config/bender_iso165c_cfg.h +++ b/src/app/driver/imd/bender/iso165c/config/bender_iso165c_cfg.h @@ -43,18 +43,18 @@ * @file bender_iso165c_cfg.h * @author foxBMS Team * @date 2021-03-17 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS_CONFIGURATION * @prefix I165C * * @brief Headers for the configuration for the insulation monitoring * - * Please see the manual and data sheet for detailed information about the - * specifications and defines used within this file. + * @details Please see the manual and data sheet for detailed information about + * the specifications and defines used within this file. * - * docref: iso165C_C1_D00154_06_M_XXEN - 03/2021 - Manual - * docref: iso165Cx_D00154_04_D_XXEN - 03/2021 - Data sheet + * docref: iso165C_C1_D00154_06_M_XXEN - 03/2021 - Manual + * docref: iso165Cx_D00154_04_D_XXEN - 03/2021 - Data sheet */ #ifndef FOXBMS__BENDER_ISO165C_CFG_H_ diff --git a/src/app/driver/imd/bender/iso165c/wscript b/src/app/driver/imd/bender/iso165c/wscript index 5a6eea3f..62f1136a 100644 --- a/src/app/driver/imd/bender/iso165c/wscript +++ b/src/app/driver/imd/bender/iso165c/wscript @@ -67,7 +67,7 @@ def build(bld): os.path.join("..", "..", "..", "..", "task", "os"), os.path.join("..", "..", "..", "..", "task", "ftask"), ] - includes.extend(bld.env.INCLUDES_OPERATING_SYSTEM) + includes.extend(bld.env.INCLUDES_RTOS) cflags = bld.env.CFLAGS_FOXBMS bld( features="c", diff --git a/src/app/driver/imd/imd.c b/src/app/driver/imd/imd.c index 48b2d4a4..673f4bc9 100644 --- a/src/app/driver/imd/imd.c +++ b/src/app/driver/imd/imd.c @@ -43,8 +43,8 @@ * @file imd.c * @author foxBMS Team * @date 2021-11-04 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix IMD * @@ -66,7 +66,7 @@ /*========== Macros and Definitions =========================================*/ /** - * statemachine short time definition in #IMD_Trigger calls until next state is + * state machine short time definition in #IMD_Trigger calls until next state is * processed */ #define IMD_FSM_SHORT_TIME (1u) @@ -115,6 +115,7 @@ typedef struct { static DATA_BLOCK_INSULATION_MONITORING_s imd_tableInsulationMonitoring = { .header.uniqueId = DATA_BLOCK_ID_INSULATION_MONITORING}; +/** global IMD state */ static IMD_STATE_s imd_state = { .timer = 0u, .triggerEntry = 0u, @@ -150,7 +151,7 @@ static IMD_RETURN_TYPE_e IMD_SetStateRequest(IMD_STATE_s *pImdState, IMD_STATE_R /** * @brief checks the state requests that are made. * @details This function checks the validity of the state requests. The - * results of the checked staterequest is returned immediately. + * results of the checked state request is returned immediately. * @param[in] stateRequest state request to be checked * @param[in,out] pImdState pointer to state variable of IMD state machine * @return result of the state request that was made diff --git a/src/app/driver/imd/imd.h b/src/app/driver/imd/imd.h index 55206478..8b19627c 100644 --- a/src/app/driver/imd/imd.h +++ b/src/app/driver/imd/imd.h @@ -43,8 +43,8 @@ * @file imd.h * @author foxBMS Team * @date 2020-11-20 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix IMD * diff --git a/src/app/driver/imd/none/no-imd.c b/src/app/driver/imd/none/no-imd.c index 1d7bef2d..53c69cad 100644 --- a/src/app/driver/imd/none/no-imd.c +++ b/src/app/driver/imd/none/no-imd.c @@ -43,8 +43,8 @@ * @file no-imd.c * @author foxBMS Team * @date 2020-11-20 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix NOIMD * diff --git a/src/app/driver/imd/none/no-imd.h b/src/app/driver/imd/none/no-imd.h index 31ec3eda..67a2a155 100644 --- a/src/app/driver/imd/none/no-imd.h +++ b/src/app/driver/imd/none/no-imd.h @@ -43,8 +43,8 @@ * @file no-imd.h * @author foxBMS Team * @date 2020-11-20 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix NONE * diff --git a/src/app/driver/imd/none/wscript b/src/app/driver/imd/none/wscript index 1df904aa..e4eb898d 100644 --- a/src/app/driver/imd/none/wscript +++ b/src/app/driver/imd/none/wscript @@ -61,7 +61,7 @@ def build(bld): os.path.join("..", "..", "..", "task", "os"), os.path.join("..", "..", "..", "task", "ftask"), ] - includes.extend(bld.env.INCLUDES_OPERATING_SYSTEM) + includes.extend(bld.env.INCLUDES_RTOS) cflags = bld.env.CFLAGS_FOXBMS bld( features="c", diff --git a/src/app/driver/imd/wscript b/src/app/driver/imd/wscript index e97958cb..a4cab4ec 100644 --- a/src/app/driver/imd/wscript +++ b/src/app/driver/imd/wscript @@ -60,7 +60,7 @@ def build(bld): os.path.join("..", "..", "task", "config"), os.path.join("..", "..", "task", "os"), ] - includes.extend(bld.env.INCLUDES_OPERATING_SYSTEM) + includes.extend(bld.env.INCLUDES_RTOS) cflags = bld.env.CFLAGS_FOXBMS # Build imd.c as object diff --git a/src/app/driver/interlock/interlock.c b/src/app/driver/interlock/interlock.c index 29b2aee9..ca435c10 100644 --- a/src/app/driver/interlock/interlock.c +++ b/src/app/driver/interlock/interlock.c @@ -43,8 +43,8 @@ * @file interlock.c * @author foxBMS Team * @date 2020-02-24 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix ILCK * diff --git a/src/app/driver/interlock/interlock.h b/src/app/driver/interlock/interlock.h index 9d445632..17974250 100644 --- a/src/app/driver/interlock/interlock.h +++ b/src/app/driver/interlock/interlock.h @@ -43,8 +43,8 @@ * @file interlock.h * @author foxBMS Team * @date 2020-02-24 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix ILCK * @@ -119,11 +119,6 @@ typedef struct { /*========== Extern Constant and Variable Declarations ======================*/ /*========== Extern Function Prototypes =====================================*/ -/** - * @brief Checks the configuration of the interlock-module - * @return retVal (type: STD_RETURN_TYPE_e) - */ -extern STD_RETURN_TYPE_e ILCK_Init(void); /** * @brief sets the current state request of the state variable ilck_state. diff --git a/src/app/driver/io/io.c b/src/app/driver/io/io.c index 20d2e830..58c57bb1 100644 --- a/src/app/driver/io/io.c +++ b/src/app/driver/io/io.c @@ -43,8 +43,8 @@ * @file io.c * @author foxBMS Team * @date 2020-06-05 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix IO * @@ -72,35 +72,35 @@ extern void IO_SetPinDirectionToOutput(volatile uint32_t *pRegisterAddress, uint32_t pin) { FAS_ASSERT(pRegisterAddress != NULL_PTR); - FAS_ASSERT(pin <= LARGEST_PIN_NUMBER); + FAS_ASSERT(pin <= MCU_LARGEST_PIN_NUMBER); *pRegisterAddress |= (uint32_t)((uint32_t)1u << pin); } extern void IO_SetPinDirectionToInput(volatile uint32_t *pRegisterAddress, uint32_t pin) { FAS_ASSERT(pRegisterAddress != NULL_PTR); - FAS_ASSERT(pin <= LARGEST_PIN_NUMBER); + FAS_ASSERT(pin <= MCU_LARGEST_PIN_NUMBER); *pRegisterAddress &= ~(uint32_t)((uint32_t)1u << pin); } extern void IO_PinSet(volatile uint32_t *pRegisterAddress, uint32_t pin) { FAS_ASSERT(pRegisterAddress != NULL_PTR); - FAS_ASSERT(pin <= LARGEST_PIN_NUMBER); + FAS_ASSERT(pin <= MCU_LARGEST_PIN_NUMBER); *pRegisterAddress |= (uint32_t)((uint32_t)1u << pin); } extern void IO_PinReset(volatile uint32_t *pRegisterAddress, uint32_t pin) { FAS_ASSERT(pRegisterAddress != NULL_PTR); - FAS_ASSERT(pin <= LARGEST_PIN_NUMBER); + FAS_ASSERT(pin <= MCU_LARGEST_PIN_NUMBER); *pRegisterAddress &= ~(uint32_t)((uint32_t)1u << pin); } extern STD_PIN_STATE_e IO_PinGet(const volatile uint32_t *pRegisterAddress, uint32_t pin) { FAS_ASSERT(pRegisterAddress != NULL_PTR); - FAS_ASSERT(pin <= LARGEST_PIN_NUMBER); + FAS_ASSERT(pin <= MCU_LARGEST_PIN_NUMBER); STD_PIN_STATE_e retval = STD_PIN_UNDEFINED; uint8_t pinState = (uint8_t)((*pRegisterAddress & ((uint32_t)1u << (pin))) >> pin); diff --git a/src/app/driver/io/io.h b/src/app/driver/io/io.h index b7486c72..ce39cb61 100644 --- a/src/app/driver/io/io.h +++ b/src/app/driver/io/io.h @@ -43,8 +43,8 @@ * @file io.h * @author foxBMS Team * @date 2020-03-19 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix IO * diff --git a/src/app/driver/led/led.c b/src/app/driver/led/led.c index 4fca42b7..f02657bf 100644 --- a/src/app/driver/led/led.c +++ b/src/app/driver/led/led.c @@ -43,8 +43,8 @@ * @file led.c * @author foxBMS Team * @date 2021-09-28 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix LED * diff --git a/src/app/driver/led/led.h b/src/app/driver/led/led.h index e0ebcb7a..2302ec0b 100644 --- a/src/app/driver/led/led.h +++ b/src/app/driver/led/led.h @@ -43,8 +43,8 @@ * @file led.h * @author foxBMS Team * @date 2021-09-28 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix LED * diff --git a/src/app/driver/mcu/mcu.c b/src/app/driver/mcu/mcu.c index 7e08f425..c1ddb4a7 100644 --- a/src/app/driver/mcu/mcu.c +++ b/src/app/driver/mcu/mcu.c @@ -43,8 +43,8 @@ * @file mcu.c * @author foxBMS Team * @date 2019-02-19 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix MCU * @@ -63,10 +63,10 @@ * It is named portRTI_CNT0_CPUC0_REG * This must be changed to reflect the FreeRTOS configuration */ -#define MCU_RTI_CNT0_CPUC0_REG (0x00000001U) +#define MCU_RTI_CNT0_CPUC0_REG (0x00000001u) /** threshold in order to limit the time spent in wait to avoid livelock in wait */ -#define MCU_US_WAIT_TIMEOUT (10000U) +#define MCU_US_WAIT_TIMEOUT (10000u) /*========== Static Constant and Variable Definitions =======================*/ /** diff --git a/src/app/driver/mcu/mcu.h b/src/app/driver/mcu/mcu.h index 32c8c5fa..9bc34adf 100644 --- a/src/app/driver/mcu/mcu.h +++ b/src/app/driver/mcu/mcu.h @@ -43,8 +43,8 @@ * @file mcu.h * @author foxBMS Team * @date 2019-02-19 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix MCU * @@ -67,13 +67,13 @@ * @details Checked in the data sheet spnu563a: The largest pin number that is * used is 31. */ -#define LARGEST_PIN_NUMBER (31u) +#define MCU_LARGEST_PIN_NUMBER (31u) /** * @brief maximum number of channels measured by the ADC1 * @details Checked in the data sheet spnu563a: ADC1 supports 32 channels */ -#define ADC_ADC1_MAX_NR_CHANNELS (32U) +#define MCU_ADC1_MAX_NR_CHANNELS (32u) #ifndef UNITY_UNIT_TEST /** Address of Free Running Counter 0 (FRC0) */ diff --git a/src/app/driver/meas/meas.c b/src/app/driver/meas/meas.c index 0e833440..48a241b3 100644 --- a/src/app/driver/meas/meas.c +++ b/src/app/driver/meas/meas.c @@ -43,8 +43,8 @@ * @file meas.c * @author foxBMS Team * @date 2020-02-24 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix MEAS * diff --git a/src/app/driver/meas/meas.h b/src/app/driver/meas/meas.h index e114c3f4..13bdf962 100644 --- a/src/app/driver/meas/meas.h +++ b/src/app/driver/meas/meas.h @@ -43,8 +43,8 @@ * @file meas.h * @author foxBMS Team * @date 2020-02-24 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix MEAS * diff --git a/src/app/driver/pex/pex.c b/src/app/driver/pex/pex.c index ad493202..1206063a 100644 --- a/src/app/driver/pex/pex.c +++ b/src/app/driver/pex/pex.c @@ -43,8 +43,8 @@ * @file pex.c * @author foxBMS Team * @date 2021-08-02 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix PEX * diff --git a/src/app/driver/pex/pex.h b/src/app/driver/pex/pex.h index 652e6571..98b18b6f 100644 --- a/src/app/driver/pex/pex.h +++ b/src/app/driver/pex/pex.h @@ -43,8 +43,8 @@ * @file pex.h * @author foxBMS Team * @date 2021-08-02 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix PEX * diff --git a/src/app/driver/pwm/pwm.c b/src/app/driver/pwm/pwm.c index 88b2532c..472eff60 100644 --- a/src/app/driver/pwm/pwm.c +++ b/src/app/driver/pwm/pwm.c @@ -43,8 +43,8 @@ * @file pwm.c * @author foxBMS Team * @date 2021-10-07 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix PWM * @@ -59,6 +59,7 @@ #include "HL_etpwm.h" #include "HL_system.h" +#include "foxmath.h" #include "fsystem.h" /*========== Macros and Definitions =========================================*/ @@ -71,9 +72,10 @@ /** full period in promill */ #define PWM_FULL_PERIOD_PERM (1000u) +/** stores the initialization states of the different parts of the module */ typedef struct { - bool ecapInitialized; - bool etpwmInitialized; + bool ecapInitialized; /**< initialization state of the enhanced capture module */ + bool etpwmInitialized; /**< initialization state of the pwm module */ } PWM_INITIALIZATION_STATE_s; /*========== Static Constant and Variable Definitions =======================*/ @@ -132,7 +134,7 @@ extern void PWM_StartPwm(void) { FAS_ASSERT(raisePrivilegeResult == 0); etpwmStartTBCLK(); /* done; go back to user mode */ - FSYS_SwitchToUserMode(); + FSYS_SWITCH_TO_USER_MODE(); } extern void PWM_StopPwm(void) { @@ -141,7 +143,7 @@ extern void PWM_StopPwm(void) { FAS_ASSERT(raisePrivilegeResult == 0); etpwmStopTBCLK(); /* done; go back to user mode */ - FSYS_SwitchToUserMode(); + FSYS_SWITCH_TO_USER_MODE(); } extern void PWM_SetDutyCycle(uint16_t dutyCycle_perm) { @@ -164,7 +166,13 @@ extern void PWM_SetDutyCycle(uint16_t dutyCycle_perm) { etpwmSetCmpA(etpwmREG1, PWM_ComputeCounterValueFromDutyCycle(correctedDutyCycle_perm)); } +/** called in case of ECAP interrupt, defined as weak in HAL */ +/* AXIVION Next Codeline Style Linker-Multiple_Definition: TI HAL only provides a weak implementation */ +/* AXIVION Next Codeline Style MisraC2012-2.7: parameter needed by API */ extern void ecapNotification(ecapBASE_t *ecap, uint16 flags) { + FAS_ASSERT(ecap != NULL_PTR); + /* AXIVION Routine Generic-MissingParameterAssert: flags: parameter accept whole range */ + /* Counter value of rising edge */ uint32_t capture1 = ecapGetCAP1(ecapREG1); /* Counter value of falling edge */ @@ -172,19 +180,25 @@ extern void ecapNotification(ecapBASE_t *ecap, uint16 flags) { /* Counter value of next rising edge */ uint32_t capture3 = ecapGetCAP3(ecapREG1); - /* Counter 3 - Counter 1: Period in counter ticks */ - /* Convert MHz to Hz */ - ecap_inputPwmSignal.frequency_Hz = 1.0f / ((float)(capture3 - capture1) / (HCLK_FREQ * 1000000.0f)); - - /* Counter 2 - Counter 1: Duty cycle in counter ticks */ - ecap_inputPwmSignal.dutyCycle_perc = (float)(capture2 - capture1) / (float)(capture3 - capture1) * 100.0f; + if (capture3 != capture1) { + /* Counter 3 - Counter 1: Period in counter ticks */ + /* Convert MHz to Hz */ + ecap_inputPwmSignal.frequency_Hz = 1.0f / ((float)(capture3 - capture1) / (HCLK_FREQ * 1000000.0f)); + + /* Counter 2 - Counter 1: Duty cycle in counter ticks */ + ecap_inputPwmSignal.dutyCycle_perc = (float)(capture2 - capture1) / (float)(capture3 - capture1) * + UNIT_CONVERSION_FACTOR_100_FLOAT; + } else { + ecap_inputPwmSignal.frequency_Hz = 0.0f; + ecap_inputPwmSignal.dutyCycle_perc = 0.0f; + } } bool PWM_IsEcapModuleInitialized(void) { return pwm_state.ecapInitialized; } -extern PWM_SIGNAL_s ECAP_GetPwmData(void) { +extern PWM_SIGNAL_s PWM_GetPwmData(void) { /* TODO: how to ensure that values have been updated? add timestamp? Add counter?*/ return ecap_inputPwmSignal; } diff --git a/src/app/driver/pwm/pwm.h b/src/app/driver/pwm/pwm.h index b2cea071..9c393ab6 100644 --- a/src/app/driver/pwm/pwm.h +++ b/src/app/driver/pwm/pwm.h @@ -43,8 +43,8 @@ * @file pwm.h * @author foxBMS Team * @date 2021-10-07 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix PWM * @@ -65,7 +65,7 @@ #include "HL_reg_ecap.h" /*========== Macros and Definitions =========================================*/ - +/** type definition for PWM signal parameters */ typedef struct { float dutyCycle_perc; float frequency_Hz; @@ -95,7 +95,7 @@ extern void PWM_StopPwm(void); extern void PWM_SetDutyCycle(uint16_t dutyCycle_perm); /** @brief Get dutycycle and frequency of input PWM signal */ -extern PWM_SIGNAL_s ECAP_GetPwmData(void); +extern PWM_SIGNAL_s PWM_GetPwmData(void); /** * @brief Get initialization state of ecap module diff --git a/src/app/driver/rtc/rtc.c b/src/app/driver/rtc/rtc.c index cc93c6ba..30807be9 100644 --- a/src/app/driver/rtc/rtc.c +++ b/src/app/driver/rtc/rtc.c @@ -43,8 +43,8 @@ * @file rtc.c * @author foxBMS Team * @date 2021-02-22 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix RTC * diff --git a/src/app/driver/rtc/rtc.h b/src/app/driver/rtc/rtc.h index 5b0255e6..6251ff57 100644 --- a/src/app/driver/rtc/rtc.h +++ b/src/app/driver/rtc/rtc.h @@ -43,8 +43,8 @@ * @file rtc.h * @author foxBMS Team * @date 2021-02-22 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix RTC * diff --git a/src/app/driver/sbc/nxpfs85xx.c b/src/app/driver/sbc/nxpfs85xx.c index 05508582..6e0d2576 100644 --- a/src/app/driver/sbc/nxpfs85xx.c +++ b/src/app/driver/sbc/nxpfs85xx.c @@ -43,8 +43,8 @@ * @file nxpfs85xx.c * @author foxBMS Team * @date 2020-03-18 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix SBC * @@ -106,6 +106,32 @@ FS85_STATE_s fs85xx_mcuSupervisor = { */ static STD_RETURN_TYPE_e SBC_CheckRegisterValues(uint32_t registerValue, uint32_t expectedRegisterValue); +/** + * @brief Updates fail safe register values + * @details Updates fail safe register value of passed SBC instance + * with new values + * @param[in,out] pFsRegister pointer to fail-safe registers + * @param[in] registerAddress address of register that is updated + * @param[in] registerValue register value + */ +static void SBC_UpdateFailSafeRegister( + FS85_FS_REGISTER_s *pFsRegister, + uint32_t registerAddress, + uint32_t registerValue); + +/** + * @brief Updates main register values + * @details Updates main register value of passed SBC instance with new + * values + * @param[in,out] pMainRegister pointer to main registers + * @param[in] registerAddress address of register that is updated + * @param[in] registerValue register value + */ +static void SBC_UpdateMainRegister( + FS85_MAIN_REGISTERS_s *pMainRegister, + uint32_t registerAddress, + uint32_t registerValue); + /** * @brief Updates register values * @details Updates register value of passed SBC instance with new @@ -140,7 +166,7 @@ static STD_RETURN_TYPE_e SBC_ReadBackRegister(FS85_STATE_s *pInstance, bool isFa * @param[in] pInstance SBC instance that is updated * @param[in] registerAddress address of register * @param[in] registerValue value that is written into register - * @return #STD_OK if writting was successful, other #STD_NOT_OK + * @return #STD_OK if writing was successful, other #STD_NOT_OK */ static STD_RETURN_TYPE_e SBC_WriteRegisterFsInit( FS85_STATE_s *pInstance, @@ -155,7 +181,7 @@ static STD_RETURN_TYPE_e SBC_WriteRegisterFsInit( * @param[in,out] pInstance SBC instance that is updated * @param[in] registerAddress address of register * @param[in] registerValue value that is written into register - * @return #STD_OK if writting was successful, other #STD_NOT_OK + * @return #STD_OK if writing was successful, other #STD_NOT_OK */ static STD_RETURN_TYPE_e SBC_WriteBackRegisterFsInit( FS85_STATE_s *pInstance, @@ -171,7 +197,7 @@ static STD_RETURN_TYPE_e SBC_WriteBackRegisterFsInit( * @param[in] registerAddress address of register * @param[in] isFailSafe true if fail-safe register, false if main register * @param[in] registerValue value that is written into register - * @return #STD_OK if writting was successful, other #STD_NOT_OK + * @return #STD_OK if writing was successful, other #STD_NOT_OK */ static STD_RETURN_TYPE_e SBC_ClearRegisterFlags( FS85_STATE_s *pInstance, @@ -213,6 +239,127 @@ static STD_RETURN_TYPE_e SBC_CheckRegisterValues(uint32_t registerValue, uint32_ return retval; } +static void SBC_UpdateFailSafeRegister( + FS85_FS_REGISTER_s *pFsRegister, + uint32_t registerAddress, + uint32_t registerValue) { + FAS_ASSERT(pFsRegister != NULL_PTR); + FAS_ASSERT(registerAddress <= FS8X_M_DEVICEID_ADDR); + /* AXIVION Routine Generic-MissingParameterAssert: registerValue: parameter accepts whole range */ + switch (registerAddress) { + case FS8X_FS_GRL_FLAGS_ADDR: + pFsRegister->grl_flags = registerValue; + break; + case FS8X_FS_I_OVUV_SAFE_REACTION1_ADDR: + pFsRegister->iOvervoltageUndervoltageSafeReaction1 = registerValue; + break; + case FS8X_FS_I_OVUV_SAFE_REACTION2_ADDR: + pFsRegister->iOvervoltageUndervoltageSafeReaction2 = registerValue; + break; + case FS8X_FS_I_WD_CFG_ADDR: + pFsRegister->iWatchdogConfiguration = registerValue; + break; + case FS8X_FS_I_SAFE_INPUTS_ADDR: + pFsRegister->i_safe_inputs = registerValue; + break; + case FS8X_FS_I_FSSM_ADDR: + pFsRegister->iFailSafeSateMachine = registerValue; + break; + case FS8X_FS_I_SVS_ADDR: + pFsRegister->i_svs = registerValue; + break; + case FS8X_FS_WD_WINDOW_ADDR: + pFsRegister->watchdogWindow = registerValue; + break; + case FS8X_FS_WD_SEED_ADDR: + pFsRegister->watchdogSeed = registerValue; + break; + case FS8X_FS_WD_ANSWER_ADDR: + pFsRegister->watchdogAnswer = registerValue; + break; + case FS8X_FS_OVUVREG_STATUS_ADDR: + pFsRegister->overvoltageUndervoltageRegisterStatus = registerValue; + break; + case FS8X_FS_RELEASE_FS0B_ADDR: + pFsRegister->releaseFs0bPin = registerValue; + break; + case FS8X_FS_SAFE_IOS_ADDR: + pFsRegister->safeIos = registerValue; + break; + case FS8X_FS_DIAG_SAFETY_ADDR: + pFsRegister->diag_safety = registerValue; + break; + case FS8X_FS_INTB_MASK_ADDR: + pFsRegister->intb_mask = registerValue; + break; + case FS8X_FS_STATES_ADDR: + pFsRegister->states = registerValue; + break; + default: + FAS_ASSERT(FAS_TRAP); /* This case should never be reached */ + break; + } +} + +static void SBC_UpdateMainRegister( + FS85_MAIN_REGISTERS_s *pMainRegister, + uint32_t registerAddress, + uint32_t registerValue) { + FAS_ASSERT(pMainRegister != NULL_PTR); + FAS_ASSERT(registerAddress <= FS8X_M_DEVICEID_ADDR); + /* AXIVION Routine Generic-MissingParameterAssert: registerValue: parameter accepts whole range */ + switch (registerAddress) { + case FS8X_M_FLAG_ADDR: + pMainRegister->flag = registerValue; + break; + case FS8X_M_MODE_ADDR: + pMainRegister->mode = registerValue; + break; + case FS8X_M_REG_CTRL1_ADDR: + pMainRegister->registerControl1 = registerValue; + break; + case FS8X_M_REG_CTRL2_ADDR: + pMainRegister->registerControl2 = registerValue; + break; + case FS8X_M_AMUX_ADDR: + pMainRegister->analogMultiplexer = registerValue; + break; + case FS8X_M_CLOCK_ADDR: + pMainRegister->clock = registerValue; + break; + case FS8X_M_INT_MASK1_ADDR: + pMainRegister->int_mask1 = registerValue; + break; + case FS8X_M_INT_MASK2_ADDR: + pMainRegister->int_mask2 = registerValue; + break; + case FS8X_M_FLAG1_ADDR: + pMainRegister->flag1 = registerValue; + break; + case FS8X_M_FLAG2_ADDR: + pMainRegister->flag2 = registerValue; + break; + case FS8X_M_VMON_REGX_ADDR: + pMainRegister->vmon_regx = registerValue; + break; + case FS8X_M_LVB1_SVS_ADDR: + pMainRegister->lvb1_svs = registerValue; + break; + case FS8X_M_MEMORY0_ADDR: + pMainRegister->memory0 = registerValue; + break; + case FS8X_M_MEMORY1_ADDR: + pMainRegister->memory1 = registerValue; + break; + case FS8X_M_DEVICEID_ADDR: + pMainRegister->deviceId = registerValue; + break; + default: + FAS_ASSERT(FAS_TRAP); /* This case should never be reached */ + break; + } +} + static void SBC_UpdateRegister( FS85_STATE_s *pInstance, bool isFailSafe, @@ -224,144 +371,10 @@ static void SBC_UpdateRegister( /* AXIVION Routine Generic-MissingParameterAssert: registerValue: parameter accepts whole range */ /* Check if fail-safe or main register needs to be updated */ - if (isFailSafe == true) { - /* Update fail-safe register */ - switch (registerAddress) { - case FS8X_FS_GRL_FLAGS_ADDR: - pInstance->fsRegister.grl_flags = registerValue; - break; - - case FS8X_FS_I_OVUV_SAFE_REACTION1_ADDR: - pInstance->fsRegister.iOvervoltageUndervolateSafeReaction1 = registerValue; - break; - - case FS8X_FS_I_OVUV_SAFE_REACTION2_ADDR: - pInstance->fsRegister.iOvervoltageUndervolateSafeReaction2 = registerValue; - break; - - case FS8X_FS_I_WD_CFG_ADDR: - pInstance->fsRegister.iWatchdogConfiguration = registerValue; - break; - - case FS8X_FS_I_SAFE_INPUTS_ADDR: - pInstance->fsRegister.i_safe_inputs = registerValue; - break; - - case FS8X_FS_I_FSSM_ADDR: - pInstance->fsRegister.iFailSafeSateMachine = registerValue; - break; - - case FS8X_FS_I_SVS_ADDR: - pInstance->fsRegister.i_svs = registerValue; - break; - - case FS8X_FS_WD_WINDOW_ADDR: - pInstance->fsRegister.watchdogWindow = registerValue; - break; - - case FS8X_FS_WD_SEED_ADDR: - pInstance->fsRegister.watchdogSeed = registerValue; - break; - - case FS8X_FS_WD_ANSWER_ADDR: - pInstance->fsRegister.watchdogAnswer = registerValue; - break; - - case FS8X_FS_OVUVREG_STATUS_ADDR: - pInstance->fsRegister.overvoltageUndervoltageRegisterStatus = registerValue; - break; - - case FS8X_FS_RELEASE_FS0B_ADDR: - pInstance->fsRegister.releaseFs0bPin = registerValue; - break; - - case FS8X_FS_SAFE_IOS_ADDR: - pInstance->fsRegister.safeIos = registerValue; - break; - - case FS8X_FS_DIAG_SAFETY_ADDR: - pInstance->fsRegister.diag_safety = registerValue; - break; - - case FS8X_FS_INTB_MASK_ADDR: - pInstance->fsRegister.intb_mask = registerValue; - break; - - case FS8X_FS_STATES_ADDR: - pInstance->fsRegister.states = registerValue; - break; - - default: - FAS_ASSERT(FAS_TRAP); /* This case should never be reached */ - break; - } - } else { - /* Update main register */ - switch (registerAddress) { - case FS8X_M_FLAG_ADDR: - pInstance->mainRegister.flag = registerValue; - break; - - case FS8X_M_MODE_ADDR: - pInstance->mainRegister.mode = registerValue; - break; - - case FS8X_M_REG_CTRL1_ADDR: - pInstance->mainRegister.registerControl1 = registerValue; - break; - - case FS8X_M_REG_CTRL2_ADDR: - pInstance->mainRegister.registerControl2 = registerValue; - break; - - case FS8X_M_AMUX_ADDR: - pInstance->mainRegister.analogMultiplexer = registerValue; - break; - - case FS8X_M_CLOCK_ADDR: - pInstance->mainRegister.clock = registerValue; - break; - - case FS8X_M_INT_MASK1_ADDR: - pInstance->mainRegister.int_mask1 = registerValue; - break; - - case FS8X_M_INT_MASK2_ADDR: - pInstance->mainRegister.int_mask2 = registerValue; - break; - - case FS8X_M_FLAG1_ADDR: - pInstance->mainRegister.flag1 = registerValue; - break; - - case FS8X_M_FLAG2_ADDR: - pInstance->mainRegister.flag2 = registerValue; - break; - - case FS8X_M_VMON_REGX_ADDR: - pInstance->mainRegister.vmon_regx = registerValue; - break; - - case FS8X_M_LVB1_SVS_ADDR: - pInstance->mainRegister.lvb1_svs = registerValue; - break; - - case FS8X_M_MEMORY0_ADDR: - pInstance->mainRegister.memory0 = registerValue; - break; - - case FS8X_M_MEMORY1_ADDR: - pInstance->mainRegister.memory1 = registerValue; - break; - - case FS8X_M_DEVICEID_ADDR: - pInstance->mainRegister.deviceId = registerValue; - break; - - default: - FAS_ASSERT(FAS_TRAP); /* This case should never be reached */ - break; - } + if (isFailSafe == true) { /* Update fail-safe register */ + SBC_UpdateFailSafeRegister(&(pInstance->fsRegister), registerAddress, registerValue); + } else { /* Update main register */ + SBC_UpdateMainRegister(&(pInstance->mainRegister), registerAddress, registerValue); } } @@ -814,7 +827,7 @@ extern STD_RETURN_TYPE_e FS85_InitializeFsPhase(FS85_STATE_s *pInstance) { /** 3.: Clear all the flags by writing in FS_DIAG_SAFETY */ registerValue = 0; - /** Flags are cleared by writting '1' to register */ + /** Flags are cleared by writing '1' to register */ registerValue |= (FS8X_FS_FCCU12_ERROR_DETECTED | FS8X_FS_FCCU1_ERROR_DETECTED | FS8X_FS_FCCU2_ERROR_DETECTED); registerValue |= FS8X_FS_ERRMON_ERROR_DETECTED; registerValue |= (FS8X_FS_BAD_WD_DATA_BAD_WD_REFRESH | FS8X_FS_BAD_WD_TIMING_BAD_WD_REFRESH); @@ -828,7 +841,7 @@ extern STD_RETURN_TYPE_e FS85_InitializeFsPhase(FS85_STATE_s *pInstance) { /** Clear all the flags by writing in FS_OVUVREG_STATUS */ registerValue = 0; - /** Flags are cleared by writting '1' to register */ + /** Flags are cleared by writing '1' to register */ registerValue |= (FS8X_FS_VCOREMON_OV_OVERVOLTAGE_REPORTED | FS8X_FS_VCOREMON_UV_UNDERVOLTAGE_REPORTED); registerValue |= (FS8X_FS_VDDIO_OV_OVERVOLTAGE_REPORTED | FS8X_FS_VDDIO_UV_UNDERVOLTAGE_REPORTED); registerValue |= @@ -969,7 +982,7 @@ extern STD_RETURN_TYPE_e FS85_SafetyPathChecks(FS85_STATE_s *pInstance) { return retval; } -/* AXIVION Next Line Style CodingStyle-Naming: The function name is pre-defined by the driver provided by NXP */ +/* AXIVION Next Codeline Style CodingStyle-Naming.Function: The name is pre-defined by the driver provided by NXP. */ extern UNIT_TEST_WEAK_IMPL fs8x_status_t MCU_SPI_TransferData( SPI_INTERFACE_CONFIG_s *pSpiInterface, uint8_t *txFrame, @@ -1113,7 +1126,7 @@ static STD_RETURN_TYPE_e SBC_PerformPathCheckRstb(FS85_STATE_s *pInstance) { IO_PinSet(pInstance->fin.pGIOport, pInstance->fin.pin); /** No further register access required -> leave privilege mode */ - FSYS_SwitchToUserMode(); + FSYS_SWITCH_TO_USER_MODE(); /** FIN state okay, no short circuit. Update also in nvram struct */ DIAG_Handler(DIAG_ID_SBC_FIN_STATE, DIAG_EVENT_OK, DIAG_SYSTEM, 0); @@ -1222,3 +1235,31 @@ static STD_RETURN_TYPE_e SBC_PerformPathCheckFs0b(FS85_STATE_s *pInstance) { } /*========== Externalized Static Function Implementations (Unit Test) =======*/ +#ifdef UNITY_UNIT_TEST +extern STD_RETURN_TYPE_e TEST_SBC_CheckRegisterValues(uint32_t registerValue, uint32_t expectedRegisterValue) { + return SBC_CheckRegisterValues(registerValue, expectedRegisterValue); +} + +extern void TEST_SBC_UpdateRegister( + FS85_STATE_s *pInstance, + bool isFailSafe, + uint32_t registerAddress, + uint32_t registerValue) { + return SBC_UpdateRegister(pInstance, isFailSafe, registerAddress, registerValue); +} + +extern void TEST_SBC_UpdateFailSafeRegister( + FS85_FS_REGISTER_s *pFsRegister, + uint32_t registerAddress, + uint32_t registerValue) { + return SBC_UpdateFailSafeRegister(pFsRegister, registerAddress, registerValue); +} + +extern void TEST_SBC_UpdateMainRegister( + FS85_MAIN_REGISTERS_s *pMainRegister, + uint32_t registerAddress, + uint32_t registerValue) { + return SBC_UpdateMainRegister(pMainRegister, registerAddress, registerValue); +} + +#endif diff --git a/src/app/driver/sbc/nxpfs85xx.h b/src/app/driver/sbc/nxpfs85xx.h index dea66e5f..07fb50ce 100644 --- a/src/app/driver/sbc/nxpfs85xx.h +++ b/src/app/driver/sbc/nxpfs85xx.h @@ -43,8 +43,8 @@ * @file nxpfs85xx.h * @author foxBMS Team * @date 2020-03-18 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix FS85 * @@ -70,8 +70,8 @@ * for register description see data sheet FS84_FS85 - Rev. 3.0 - 9 April 2019 */ typedef struct { uint16_t grl_flags; /*!< FS8X_FS_GRL_FLAGS_ADDR */ - uint16_t iOvervoltageUndervolateSafeReaction1; /*!< FS8X_FS_I_OVUV_SAFE_REACTION1_ADDR */ - uint16_t iOvervoltageUndervolateSafeReaction2; /*!< FS8X_FS_I_OVUV_SAFE_REACTION2_ADDR */ + uint16_t iOvervoltageUndervoltageSafeReaction1; /*!< FS8X_FS_I_OVUV_SAFE_REACTION1_ADDR */ + uint16_t iOvervoltageUndervoltageSafeReaction2; /*!< FS8X_FS_I_OVUV_SAFE_REACTION2_ADDR */ uint16_t iWatchdogConfiguration; /*!< FS8X_FS_I_WD_CFG_ADDR */ uint16_t i_safe_inputs; /*!< FS8X_FS_I_SAFE_INPUTS_ADDR */ uint16_t iFailSafeSateMachine; /*!< FS8X_FS_I_FSSM_ADDR */ @@ -197,5 +197,21 @@ extern STD_RETURN_TYPE_e FS85_SafetyPathChecks(FS85_STATE_s *pInstance); extern STD_RETURN_TYPE_e SBC_TriggerWatchdog(FS85_STATE_s *pInstance); /*========== Externalized Static Functions Prototypes (Unit Test) ===========*/ +#ifdef UNITY_UNIT_TEST +extern STD_RETURN_TYPE_e TEST_SBC_CheckRegisterValues(uint32_t registerValue, uint32_t expectedRegisterValue); +extern void TEST_SBC_UpdateRegister( + FS85_STATE_s *pInstance, + bool isFailSafe, + uint32_t registerAddress, + uint32_t registerValue); +extern void TEST_SBC_UpdateFailSafeRegister( + FS85_FS_REGISTER_s *pFsRegister, + uint32_t registerAddress, + uint32_t registerValue); +extern void TEST_SBC_UpdateMainRegister( + FS85_MAIN_REGISTERS_s *pMainRegister, + uint32_t registerAddress, + uint32_t registerValue); +#endif #endif /* FOXBMS__NXPFS85XX_H_ */ diff --git a/src/app/driver/sbc/sbc.c b/src/app/driver/sbc/sbc.c index 2cabd84a..7c03c592 100644 --- a/src/app/driver/sbc/sbc.c +++ b/src/app/driver/sbc/sbc.c @@ -43,8 +43,8 @@ * @file sbc.c * @author foxBMS Team * @date 2020-07-14 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix SBC * @@ -111,7 +111,7 @@ static SBC_RETURN_TYPE_e SBC_CheckStateRequest(SBC_STATE_s *pInstance, SBC_STATE /** * @brief Re-entrance check of SBC state machine trigger function * @details This function is not re-entrant and should only be called time- or - * event-triggered. It increments the triggerentry counter from the + * event-triggered. It increments the triggerEntry counter from the * state variable pInstance->triggerEntry. It should never be called * by two different processes, so if it is the case, triggerEntry * should never be higher than 0 when this function is called. @@ -132,6 +132,16 @@ static SBC_CHECK_REENTRANCE_e SBC_CheckReEntrance(SBC_STATE_s *pInstance); */ static SBC_STATE_REQUEST_e SBC_TransferStateRequest(SBC_STATE_s *pInstance); +/** + * @brief Triggers the watchdog if the timing requires it. + * @details This function checks whether the watchdog timer elapses, + * and triggers the watchdog in that case. + * @param[in,out] pInstance + * @return retVal current state request, taken from + * #SYS_STATE_REQUEST_e + */ +static bool SBC_TriggerWatchdogIfRequired(SBC_STATE_s *pInstance); + /*========== Static Function Implementations ================================*/ static void SBC_SaveLastStates(SBC_STATE_s *pInstance) { FAS_ASSERT(pInstance != NULL_PTR); @@ -172,16 +182,6 @@ static SBC_RETURN_TYPE_e SBC_CheckStateRequest(SBC_STATE_s *pInstance, SBC_STATE return retval; } -/** - * @brief re-entrance check of SYS state machine trigger function - * @details This function is not re-entrant and should only be called time- or - * event-triggered. It increments the triggerentry counter from the - * state variable sys_systemState. It should never be called by two - * different processes, so if it is the case, triggerentry should - * never be higher than 0 when this function is called. - * @return retval 0 if no further instance of the function is active, 0xff - * else - */ static SBC_CHECK_REENTRANCE_e SBC_CheckReEntrance(SBC_STATE_s *pInstance) { FAS_ASSERT(pInstance != NULL_PTR); @@ -211,6 +211,27 @@ static SBC_STATE_REQUEST_e SBC_TransferStateRequest(SBC_STATE_s *pInstance) { return (retval); } +static bool SBC_TriggerWatchdogIfRequired(SBC_STATE_s *pInstance) { + FAS_ASSERT(pInstance != NULL_PTR); + bool watchdogHasBeenTriggered = false; + if (pInstance->watchdogTrigger > 0u) { + pInstance->watchdogTrigger--; + if (pInstance->watchdogTrigger == 0u) { + if (STD_OK != SBC_TriggerWatchdog(pInstance->pFs85xxInstance)) { + /* TODO: Do what if triggering of watchdog fails? */ + } else { + watchdogHasBeenTriggered = true; + /* Debug LED Ball V2! :*/ + /* gioToggleBit(hetPORT1, 1); */ + /* Reset watchdog counter: + * Decremented every SBC_TASK_CYCLE_CONTEXT_MS and checked in next cycle -> Period-1 */ + pInstance->watchdogTrigger = pInstance->watchdogPeriod_10ms; + } + } + } + return watchdogHasBeenTriggered; +} + /*========== Extern Function Implementations ================================*/ extern SBC_RETURN_TYPE_e SBC_SetStateRequest(SBC_STATE_s *pInstance, SBC_STATE_REQUEST_e stateRequest) { FAS_ASSERT(pInstance != NULL_PTR); @@ -246,20 +267,8 @@ extern void SBC_Trigger(SBC_STATE_s *pInstance) { /* Periodic watchdog triggering */ if (pInstance->watchdogState == SBC_PERIODIC_WATCHDOG_ACTIVATED) { - if (pInstance->watchdogTrigger > 0u) { - pInstance->watchdogTrigger--; - if (pInstance->watchdogTrigger == 0u) { - if (STD_OK != SBC_TriggerWatchdog(pInstance->pFs85xxInstance)) { - /* Do what if triggering of watchdog fails? */ - } else { - /* Debug LED Ball V2! :*/ - /* gioToggleBit(hetPORT1, 1); */ - /* Reset watchdog counter: - * Decremented every SBC_TASK_CYCLE_CONTEXT_MS and checked in next cycle -> Period-1 */ - pInstance->watchdogTrigger = pInstance->watchdogPeriod_10ms; - } - } - } + /* return value is only for unit testing purposes */ + (void)SBC_TriggerWatchdogIfRequired(pInstance); } if (pInstance->timer > 0u) { @@ -387,3 +396,8 @@ extern void SBC_Trigger(SBC_STATE_s *pInstance) { } /*========== Externalized Static Function Implementations (Unit Test) =======*/ +#ifdef UNITY_UNIT_TEST +extern bool TEST_SBC_TriggerWatchdogIfRequired(SBC_STATE_s *pInstance) { + return SBC_TriggerWatchdogIfRequired(pInstance); +} +#endif diff --git a/src/app/driver/sbc/sbc.h b/src/app/driver/sbc/sbc.h index 078fd773..a569cbc2 100644 --- a/src/app/driver/sbc/sbc.h +++ b/src/app/driver/sbc/sbc.h @@ -43,8 +43,8 @@ * @file sbc.h * @author foxBMS Team * @date 2020-07-14 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix SBC * @@ -73,7 +73,7 @@ * * This sets the minimum time between two subsequent executed states/substates. * - * Define is only used for compile-time assertion, it has no programatic + * Define is only used for compile-time assertion, it has no programmatic * influence on the actual code. */ #define SBC_STATEMACHINE_TASK_CYCLE_CONTEXT_MS (10u) @@ -83,19 +83,19 @@ #endif /** - * SBC statemachine short time definition in #SBC_Trigger() calls until next + * SBC state machine short time definition in #SBC_Trigger() calls until next * state/substate is processed */ #define SBC_STATEMACHINE_SHORTTIME (1u) /** - * SBC statemachine medium time definition in #SBC_Trigger() calls until next + * SBC state machine medium time definition in #SBC_Trigger() calls until next * state/substate is processed */ #define SBC_STATEMACHINE_MEDIUMTIME (5u) /** - * SBC statemachine long time definition in #SBC_Trigger() calls until next + * SBC state machine long time definition in #SBC_Trigger() calls until next * state/substate is processed */ #define SBC_STATEMACHINE_LONGTIME (10u) @@ -105,7 +105,7 @@ */ #define SBC_WINDOW_WATCHDOG_PERIOD_MS (100u) -/** State requests for the SYS statemachine */ +/** State requests for the SYS state machine */ typedef enum { SBC_STATE_INIT_REQUEST, /*!< request to begin SBC initialization */ SBC_STATE_ERROR_REQUEST, /*!< request to switch SBC into error state */ @@ -118,7 +118,7 @@ typedef enum { SBC_PERIODIC_WATCHDOG_DEACTIVATED, } SBC_PERIODIC_WATCHDOG_STATE_e; -/** Possible return values when state requests are made to the SYS statemachine */ +/** Possible return values when state requests are made to the SYS state machine */ typedef enum { SBC_OK, /*!< sys --> ok */ SBC_BUSY_OK, /*!< sys busy --> ok */ @@ -131,7 +131,7 @@ typedef enum { /** States of the SBC state machine */ typedef enum { /* Init-Sequence */ - SBC_STATEMACHINE_UNINITIALIZED, /*!< statemachien start value */ + SBC_STATEMACHINE_UNINITIALIZED, /*!< state machine start value */ SBC_STATEMACHINE_INITIALIZATION, /*!< SBC startup initialization process */ SBC_STATEMACHINE_RUNNING, /*!< error detected communicating with SBC */ SBC_STATEMACHINE_ERROR, /*!< default initialization value */ @@ -209,5 +209,8 @@ extern SBC_STATEMACHINE_e SBC_GetState(SBC_STATE_s *pInstance); extern void SBC_Trigger(SBC_STATE_s *pInstance); /*========== Externalized Static Functions Prototypes (Unit Test) ===========*/ +#ifdef UNITY_UNIT_TEST +extern bool TEST_SBC_TriggerWatchdogIfRequired(SBC_STATE_s *pInstance); +#endif #endif /* FOXBMS__SBC_H_ */ diff --git a/src/app/driver/spi/spi.c b/src/app/driver/spi/spi.c index 37a4dd64..e0ba0e6d 100644 --- a/src/app/driver/spi/spi.c +++ b/src/app/driver/spi/spi.c @@ -43,8 +43,8 @@ * @file spi.c * @author foxBMS Team * @date 2019-12-12 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix SPI * @@ -74,6 +74,9 @@ static uint32_t spi_txLastWord[DMA_NUMBER_SPI_INTERFACES] = {0}; /*========== Extern Constant and Variable Definitions =======================*/ +bool spi_txFinished = false; +bool spi_rxFinished = false; + /*========== Static Function Prototypes =====================================*/ /*========== Static Function Implementations ================================*/ @@ -295,7 +298,7 @@ extern STD_RETURN_TYPE_e SPI_TransmitReceiveDataDma( dmaSetChEnable((dmaChannel_t)dma_spiDmaChannels[spiIndex].rxChannel, (dmaTriggerType_t)DMA_HW); /* DMA config registers written, leave privilege mode */ - FSYS_SwitchToUserMode(); + FSYS_SWITCH_TO_USER_MODE(); /* DMA_REQ_Enable */ /* Starts DMA requests if SPIEN is also set to 1 */ @@ -352,7 +355,7 @@ extern void SPI_Unlock(uint8_t spi) { extern void SPI_SetFunctional(spiBASE_t *pNode, enum spiPinSelect bit, bool hardwareControlled) { FAS_ASSERT(pNode != NULL_PTR); - FAS_ASSERT(bit <= (enum spiPinSelect)LARGEST_PIN_NUMBER); + FAS_ASSERT(bit <= (enum spiPinSelect)MCU_LARGEST_PIN_NUMBER); /* retrieve current configuration */ spi_config_reg_t configRegisterBuffer = {0}; @@ -406,6 +409,10 @@ extern STD_RETURN_TYPE_e SPI_SlaveSetReceiveDataDma( pSpiInterface->pNode->INT0 &= ~DMAREQEN_BIT; pSpiInterface->pNode->GCR1 &= ~SPIEN_BIT; + /* Write FMT configuration in DAT1; as SPI is configured as slave, this does not provoke a transmission */ + SPIDATAFMT_t DataFormat = pSpiInterface->pConfig->DFSEL; + pSpiInterface->pNode->DAT1 |= ((uint32)DataFormat << SPI_DATA_FORMAT_FIELD_POSITION); + /* Set Tx buffer address */ dmaRAMREG->PCP[(dmaChannel_t)dma_spiDmaChannels[SPI_GetSpiIndex(pSpiInterface->pNode)].txChannel].ISADDR = (uint32_t)pTxBuff; @@ -428,7 +435,7 @@ extern STD_RETURN_TYPE_e SPI_SlaveSetReceiveDataDma( (dmaChannel_t)dma_spiDmaChannels[SPI_GetSpiIndex(pSpiInterface->pNode)].rxChannel, (dmaTriggerType_t)DMA_HW); /* DMA config registers written, leave privilege mode */ - FSYS_SwitchToUserMode(); + FSYS_SWITCH_TO_USER_MODE(); OS_ExitTaskCritical(); @@ -453,7 +460,13 @@ extern void SPI_DmaSendLastByte(uint8_t spiIndex) { dma_spiInterfaces[spiIndex]->DAT1 = spi_txLastWord[spiIndex]; } -/* AXIVION Next Line Style Linker-Multiple_Definition: TI HAL only provides a weak implementation */ +/* AXIVION Next Codeline Style Linker-Multiple_Definition: TI HAL only provides a weak implementation */ +/* Doxygen comment needs to be here, as this is from a TI generated HAL header */ +/** + * @brief SPI Interrupt callback + * @param[in] spi spi device + * @param flags flags to be passed + */ void UNIT_TEST_WEAK_IMPL spiNotification(spiBASE_t *spi, uint32 flags) { } diff --git a/src/app/driver/spi/spi.h b/src/app/driver/spi/spi.h index 64f25869..bda77c05 100644 --- a/src/app/driver/spi/spi.h +++ b/src/app/driver/spi/spi.h @@ -43,8 +43,8 @@ * @file spi.h * @author foxBMS Team * @date 2019-12-12 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix SPI * @@ -62,6 +62,12 @@ /*========== Extern Constant and Variable Declarations ======================*/ +/* Flag to indicate that N775 Tx was finished */ +extern bool spi_txFinished; + +/* Flag to indicate that N775 Rx was finished */ +extern bool spi_rxFinished; + /*========== Extern Function Prototypes =====================================*/ /* INCLUDE MARKER FOR THE DOCUMENTATION; DO NOT MOVE spi-documentation-dummy-start-include */ diff --git a/src/app/driver/spi/spi_cfg-helper.h b/src/app/driver/spi/spi_cfg-helper.h index 5516c49c..3ef1447c 100644 --- a/src/app/driver/spi/spi_cfg-helper.h +++ b/src/app/driver/spi/spi_cfg-helper.h @@ -43,8 +43,8 @@ * @file spi_cfg-helper.h * @author foxBMS Team * @date 2021-12-08 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS_CONFIGURATION * @prefix SPI * diff --git a/src/app/driver/sps/sps.c b/src/app/driver/sps/sps.c index 2e71675b..bc2d294a 100644 --- a/src/app/driver/sps/sps.c +++ b/src/app/driver/sps/sps.c @@ -43,8 +43,8 @@ * @file sps.c * @author foxBMS Team * @date 2020-10-14 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix SPS * @@ -252,10 +252,10 @@ static void SPS_InitializeIo(void) { /** Pin to drive reset line of SPS ICs */ SPS_RESET_GIO_PORT_DIR |= (uint32)((uint32)1u << SPS_RESET_PIN); /** Pin to drive Chip Select line of SPS ICs */ - SPS_SPI_CS_GIOPORT_DIR |= (uint32)((uint32)1u << SPS_SPI_CS_PIN); + SPI_SPS_CS_GIOPORT_DIR |= (uint32)((uint32)1u << SPI_SPS_CS_PIN); /* set feedback enable as output */ - SETBIT(SPS_FEEDBACK_GIO_PORT_DIR, SPS_FEEDBACK_PIN); + GEN_SET_BIT(SPS_FEEDBACK_GIO_PORT_DIR, SPS_FEEDBACK_PIN); /* enable output on feedback enable */ IO_PinSet(&SPS_FEEDBACK_GIO_PORT, SPS_FEEDBACK_PIN); } diff --git a/src/app/driver/sps/sps.h b/src/app/driver/sps/sps.h index 806388b7..cae83cb8 100644 --- a/src/app/driver/sps/sps.h +++ b/src/app/driver/sps/sps.h @@ -43,8 +43,8 @@ * @file sps.h * @author foxBMS Team * @date 2020-10-14 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix SPS * diff --git a/src/app/driver/sps/sps_types.h b/src/app/driver/sps/sps_types.h index feb3048b..cf0e64e3 100644 --- a/src/app/driver/sps/sps_types.h +++ b/src/app/driver/sps/sps_types.h @@ -43,8 +43,8 @@ * @file sps_types.h * @author foxBMS Team * @date 2020-12-01 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVERS * @prefix SPS * diff --git a/src/app/driver/ts/api/tsi.h b/src/app/driver/ts/api/tsi.h index 6ba10843..27d66987 100644 --- a/src/app/driver/ts/api/tsi.h +++ b/src/app/driver/ts/api/tsi.h @@ -43,8 +43,8 @@ * @file tsi.h * @author foxBMS Team * @date 2020-08-25 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVER * @prefix TSI * diff --git a/src/app/driver/ts/api/tsi_limits.c b/src/app/driver/ts/api/tsi_limits.c index 71f250a1..bdc05608 100644 --- a/src/app/driver/ts/api/tsi_limits.c +++ b/src/app/driver/ts/api/tsi_limits.c @@ -43,8 +43,8 @@ * @file tsi_limits.c * @author foxBMS Team * @date 2021-01-15 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DRIVER * @prefix TSI * diff --git a/src/app/driver/ts/beta.c b/src/app/driver/ts/beta.c index 3b2cf19b..d611203c 100644 --- a/src/app/driver/ts/beta.c +++ b/src/app/driver/ts/beta.c @@ -43,8 +43,8 @@ * @file beta.c * @author foxBMS Team * @date 2020-01-17 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup TEMPERATURE_SENSORS * @prefix BETA * diff --git a/src/app/driver/ts/beta.h b/src/app/driver/ts/beta.h index 798c88f4..bb4be915 100644 --- a/src/app/driver/ts/beta.h +++ b/src/app/driver/ts/beta.h @@ -43,8 +43,8 @@ * @file beta.h * @author foxBMS Team * @date 2020-01-17 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup TEMPERATURE_SENSORS * @prefix BETA * diff --git a/src/app/driver/ts/epcos/b57251v5103j060/epcos_b57251v5103j060.c b/src/app/driver/ts/epcos/b57251v5103j060/epcos_b57251v5103j060.c index 5442c2f4..1e6776c4 100644 --- a/src/app/driver/ts/epcos/b57251v5103j060/epcos_b57251v5103j060.c +++ b/src/app/driver/ts/epcos/b57251v5103j060/epcos_b57251v5103j060.c @@ -43,8 +43,8 @@ * @file epcos_b57251v5103j060.c * @author foxBMS Team * @date 2018-10-30 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup TEMPERATURE_SENSORS * @prefix TS * @@ -198,7 +198,7 @@ extern int16_t TS_Epc00GetTemperatureFromLut(uint16_t adcVoltage_mV) { extern int16_t TS_Epc00GetTemperatureFromPolynomial(uint16_t adcVoltage_mV) { /* AXIVION Routine Generic-MissingParameterAssert: adcVoltage_mV: parameter accepts whole range */ - float temperature_degC = 0.0; + float temperature_degC = 0.0f; float vadc_V = adcVoltage_mV / 1000.0; float vadc2 = vadc_V * vadc_V; float vadc3 = vadc2 * vadc_V; diff --git a/src/app/driver/ts/epcos/b57251v5103j060/epcos_b57251v5103j060.h b/src/app/driver/ts/epcos/b57251v5103j060/epcos_b57251v5103j060.h index f36ebcea..323d80db 100644 --- a/src/app/driver/ts/epcos/b57251v5103j060/epcos_b57251v5103j060.h +++ b/src/app/driver/ts/epcos/b57251v5103j060/epcos_b57251v5103j060.h @@ -43,13 +43,15 @@ * @file epcos_b57251v5103j060.h * @author foxBMS Team * @date 2018-10-30 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup TEMPERATURE_SENSORS * @prefix TS * * @brief Resistive divider used for measuring temperature * + * @details Schematics: + * * V_supply * --.-- * | diff --git a/src/app/driver/ts/epcos/b57251v5103j060/lookup-table/epcos_b57251v5103j060_lookup-table.c b/src/app/driver/ts/epcos/b57251v5103j060/lookup-table/epcos_b57251v5103j060_lookup-table.c index e6e80ca7..6d3d2602 100644 --- a/src/app/driver/ts/epcos/b57251v5103j060/lookup-table/epcos_b57251v5103j060_lookup-table.c +++ b/src/app/driver/ts/epcos/b57251v5103j060/lookup-table/epcos_b57251v5103j060_lookup-table.c @@ -43,8 +43,8 @@ * @file epcos_b57251v5103j060_lookup-table.c * @author foxBMS Team * @date 2020-08-25 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup TEMPERATURE_SENSORS * @prefix TS * diff --git a/src/app/driver/ts/epcos/b57251v5103j060/polynomial/epcos_b57251v5103j060_polynomial.c b/src/app/driver/ts/epcos/b57251v5103j060/polynomial/epcos_b57251v5103j060_polynomial.c index 6f6f20b7..a44e826e 100644 --- a/src/app/driver/ts/epcos/b57251v5103j060/polynomial/epcos_b57251v5103j060_polynomial.c +++ b/src/app/driver/ts/epcos/b57251v5103j060/polynomial/epcos_b57251v5103j060_polynomial.c @@ -43,8 +43,8 @@ * @file epcos_b57251v5103j060_polynomial.c * @author foxBMS Team * @date 2020-08-25 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup TEMPERATURE_SENSORS * @prefix TS * diff --git a/src/app/driver/ts/epcos/b57861s0103f045/epcos_b57861s0103f045.c b/src/app/driver/ts/epcos/b57861s0103f045/epcos_b57861s0103f045.c index ab3d5ff5..38938317 100644 --- a/src/app/driver/ts/epcos/b57861s0103f045/epcos_b57861s0103f045.c +++ b/src/app/driver/ts/epcos/b57861s0103f045/epcos_b57861s0103f045.c @@ -43,8 +43,8 @@ * @file epcos_b57861s0103f045.c * @author foxBMS Team * @date 2018-10-30 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup TEMPERATURE_SENSORS * @prefix TS * diff --git a/src/app/driver/ts/epcos/b57861s0103f045/epcos_b57861s0103f045.h b/src/app/driver/ts/epcos/b57861s0103f045/epcos_b57861s0103f045.h index 6ad40089..0a94cfc1 100644 --- a/src/app/driver/ts/epcos/b57861s0103f045/epcos_b57861s0103f045.h +++ b/src/app/driver/ts/epcos/b57861s0103f045/epcos_b57861s0103f045.h @@ -43,8 +43,8 @@ * @file epcos_b57861s0103f045.h * @author foxBMS Team * @date 2018-10-30 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup TEMPERATURE_SENSORS * @prefix TS * diff --git a/src/app/driver/ts/epcos/b57861s0103f045/lookup-table/epcos_b57861s0103f045_lookup-table.c b/src/app/driver/ts/epcos/b57861s0103f045/lookup-table/epcos_b57861s0103f045_lookup-table.c index 743ae2b9..cf3e75fc 100644 --- a/src/app/driver/ts/epcos/b57861s0103f045/lookup-table/epcos_b57861s0103f045_lookup-table.c +++ b/src/app/driver/ts/epcos/b57861s0103f045/lookup-table/epcos_b57861s0103f045_lookup-table.c @@ -43,8 +43,8 @@ * @file epcos_b57861s0103f045_lookup-table.c * @author foxBMS Team * @date 2020-08-25 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup TEMPERATURE_SENSORS * @prefix TS * diff --git a/src/app/driver/ts/epcos/b57861s0103f045/polynomial/epcos_b57861s0103f045_polynomial.c b/src/app/driver/ts/epcos/b57861s0103f045/polynomial/epcos_b57861s0103f045_polynomial.c index edf3aa9d..d76de455 100644 --- a/src/app/driver/ts/epcos/b57861s0103f045/polynomial/epcos_b57861s0103f045_polynomial.c +++ b/src/app/driver/ts/epcos/b57861s0103f045/polynomial/epcos_b57861s0103f045_polynomial.c @@ -43,8 +43,8 @@ * @file epcos_b57861s0103f045_polynomial.c * @author foxBMS Team * @date 2020-08-25 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup TEMPERATURE_SENSORS * @prefix TS * diff --git a/src/app/driver/ts/fake/none/fake_none.c b/src/app/driver/ts/fake/none/fake_none.c index 87d0deec..c3422f6b 100644 --- a/src/app/driver/ts/fake/none/fake_none.c +++ b/src/app/driver/ts/fake/none/fake_none.c @@ -43,8 +43,8 @@ * @file fake_none.c * @author foxBMS Team * @date 2020-08-25 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup TEMPERATURE_SENSORS * @prefix TS * diff --git a/src/app/driver/ts/fake/none/fake_none.h b/src/app/driver/ts/fake/none/fake_none.h index 0fdfe912..c7804731 100644 --- a/src/app/driver/ts/fake/none/fake_none.h +++ b/src/app/driver/ts/fake/none/fake_none.h @@ -43,8 +43,8 @@ * @file fake_none.h * @author foxBMS Team * @date 2020-08-25 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup TEMPERATURE_SENSORS * @prefix TS * diff --git a/src/app/driver/ts/fake/none/lookup-table/fake_none_lookup-table.c b/src/app/driver/ts/fake/none/lookup-table/fake_none_lookup-table.c index b7fd7c98..cc5f5e1d 100644 --- a/src/app/driver/ts/fake/none/lookup-table/fake_none_lookup-table.c +++ b/src/app/driver/ts/fake/none/lookup-table/fake_none_lookup-table.c @@ -43,8 +43,8 @@ * @file fake_none_lookup-table.c * @author foxBMS Team * @date 2020-08-25 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup TEMPERATURE_SENSORS * @prefix TS * diff --git a/src/app/driver/ts/fake/none/polynomial/fake_none_polynomial.c b/src/app/driver/ts/fake/none/polynomial/fake_none_polynomial.c index ac15d0fd..20f785fe 100644 --- a/src/app/driver/ts/fake/none/polynomial/fake_none_polynomial.c +++ b/src/app/driver/ts/fake/none/polynomial/fake_none_polynomial.c @@ -43,8 +43,8 @@ * @file fake_none_polynomial.c * @author foxBMS Team * @date 2020-08-25 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup TEMPERATURE_SENSORS * @prefix TS * diff --git a/src/app/driver/ts/temperature_sensor_defs.h b/src/app/driver/ts/temperature_sensor_defs.h index 185fe205..96faf65b 100644 --- a/src/app/driver/ts/temperature_sensor_defs.h +++ b/src/app/driver/ts/temperature_sensor_defs.h @@ -43,8 +43,8 @@ * @file temperature_sensor_defs.h * @author foxBMS Team * @date 2020-08-25 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup TEMPERATURE_SENSORS * @prefix TS * diff --git a/src/app/driver/ts/vishay/ntcalug01a103g/lookup-table/vishay_ntcalug01a103g_lookup-table.c b/src/app/driver/ts/vishay/ntcalug01a103g/lookup-table/vishay_ntcalug01a103g_lookup-table.c index 2133f9dc..eb33063e 100644 --- a/src/app/driver/ts/vishay/ntcalug01a103g/lookup-table/vishay_ntcalug01a103g_lookup-table.c +++ b/src/app/driver/ts/vishay/ntcalug01a103g/lookup-table/vishay_ntcalug01a103g_lookup-table.c @@ -43,8 +43,8 @@ * @file vishay_ntcalug01a103g_lookup-table.c * @author foxBMS Team * @date 2020-08-25 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup TEMPERATURE_SENSORS * @prefix TS * diff --git a/src/app/driver/ts/vishay/ntcalug01a103g/polynomial/vishay_ntcalug01a103g_polynomial.c b/src/app/driver/ts/vishay/ntcalug01a103g/polynomial/vishay_ntcalug01a103g_polynomial.c index dea1da52..5611f18b 100644 --- a/src/app/driver/ts/vishay/ntcalug01a103g/polynomial/vishay_ntcalug01a103g_polynomial.c +++ b/src/app/driver/ts/vishay/ntcalug01a103g/polynomial/vishay_ntcalug01a103g_polynomial.c @@ -43,8 +43,8 @@ * @file vishay_ntcalug01a103g_polynomial.c * @author foxBMS Team * @date 2020-08-25 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup TEMPERATURE_SENSORS * @prefix TS * diff --git a/src/app/driver/ts/vishay/ntcalug01a103g/vishay_ntcalug01a103g.c b/src/app/driver/ts/vishay/ntcalug01a103g/vishay_ntcalug01a103g.c index 2ab7c0d5..af6014b9 100644 --- a/src/app/driver/ts/vishay/ntcalug01a103g/vishay_ntcalug01a103g.c +++ b/src/app/driver/ts/vishay/ntcalug01a103g/vishay_ntcalug01a103g.c @@ -43,8 +43,8 @@ * @file vishay_ntcalug01a103g.c * @author foxBMS Team * @date 2018-10-30 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup TEMPERATURE_SENSORS * @prefix TS * diff --git a/src/app/driver/ts/vishay/ntcalug01a103g/vishay_ntcalug01a103g.h b/src/app/driver/ts/vishay/ntcalug01a103g/vishay_ntcalug01a103g.h index 7fb0eadb..87dd92aa 100644 --- a/src/app/driver/ts/vishay/ntcalug01a103g/vishay_ntcalug01a103g.h +++ b/src/app/driver/ts/vishay/ntcalug01a103g/vishay_ntcalug01a103g.h @@ -43,8 +43,8 @@ * @file vishay_ntcalug01a103g.h * @author foxBMS Team * @date 2018-10-30 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup TEMPERATURE_SENSORS * @prefix TS * diff --git a/src/app/driver/ts/vishay/ntcle317e4103sba/lookup-table/vishay_ntcle317e4103sba_lookup-table.c b/src/app/driver/ts/vishay/ntcle317e4103sba/lookup-table/vishay_ntcle317e4103sba_lookup-table.c index 61f2deec..076e4339 100644 --- a/src/app/driver/ts/vishay/ntcle317e4103sba/lookup-table/vishay_ntcle317e4103sba_lookup-table.c +++ b/src/app/driver/ts/vishay/ntcle317e4103sba/lookup-table/vishay_ntcle317e4103sba_lookup-table.c @@ -43,8 +43,8 @@ * @file vishay_ntcle317e4103sba_lookup-table.c * @author foxBMS Team * @date 2021-11-03 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup TEMPERATURE_SENSORS * @prefix TS * diff --git a/src/app/driver/ts/vishay/ntcle317e4103sba/vishay_ntcle317e4103sba.c b/src/app/driver/ts/vishay/ntcle317e4103sba/vishay_ntcle317e4103sba.c index a5481b19..d5344c33 100644 --- a/src/app/driver/ts/vishay/ntcle317e4103sba/vishay_ntcle317e4103sba.c +++ b/src/app/driver/ts/vishay/ntcle317e4103sba/vishay_ntcle317e4103sba.c @@ -43,8 +43,8 @@ * @file vishay_ntcle317e4103sba.c * @author foxBMS Team * @date 2021-11-03 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup TEMPERATURE_SENSORS * @prefix TS * diff --git a/src/app/driver/ts/vishay/ntcle317e4103sba/vishay_ntcle317e4103sba.h b/src/app/driver/ts/vishay/ntcle317e4103sba/vishay_ntcle317e4103sba.h index ed549f17..6baaab56 100644 --- a/src/app/driver/ts/vishay/ntcle317e4103sba/vishay_ntcle317e4103sba.h +++ b/src/app/driver/ts/vishay/ntcle317e4103sba/vishay_ntcle317e4103sba.h @@ -43,8 +43,8 @@ * @file vishay_ntcle317e4103sba.h * @author foxBMS Team * @date 2021-10-29 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup TEMPERATURE_SENSORS * @prefix TS * diff --git a/src/app/driver/wscript b/src/app/driver/wscript index 7906cb5d..8e507ddf 100644 --- a/src/app/driver/wscript +++ b/src/app/driver/wscript @@ -48,6 +48,9 @@ import os def build(bld): """builds the driver library""" + ts_man = bld.env.temperature_sensor_manuf + ts_mod = bld.env.temperature_sensor_model + ts_met = bld.env.temperature_sensor_meth source = [ os.path.join("adc", "adc.c"), os.path.join("can", "can.c"), @@ -94,14 +97,7 @@ def build(bld): os.path.join("sbc", "fs8x_driver", "sbc_fs8x.c"), os.path.join("spi", "spi.c"), os.path.join("sps", "sps.c"), - os.path.join( - "ts", - bld.env.temperature_sensor_manuf, - bld.env.temperature_sensor_model, - bld.env.temperature_sensor_meth, - f"{bld.env.temperature_sensor_manuf}_{bld.env.temperature_sensor_model}" - f"_{bld.env.temperature_sensor_meth}.c", - ), + os.path.join("ts", ts_man, ts_mod, ts_met, f"{ts_man}_{ts_mod}" f"_{ts_met}.c"), os.path.join("ts", "api", "tsi_limits.c"), os.path.join("ts", "epcos", "b57251v5103j060", "epcos_b57251v5103j060.c"), os.path.join("ts", "epcos", "b57861s0103f045", "epcos_b57861s0103f045.c"), @@ -160,9 +156,7 @@ def build(bld): os.path.join("..", "task", "os"), os.path.join("..", "task", "ftask"), ] - includes.extend( - bld.env.INCLUDES_OPERATING_SYSTEM + bld.env.INCLUDES_AFE + bld.env.INCLUDES_IMD - ) + includes.extend(bld.env.INCLUDES_RTOS + bld.env.INCLUDES_AFE + bld.env.INCLUDES_IMD) cflags = bld.env.CFLAGS_FOXBMS target = f"{bld.env.APPNAME.lower()}-driver" use = [f"{bld.env.APPNAME.lower()}-afe-driver", f"{bld.env.APPNAME}-imd"] diff --git a/src/app/engine/config/database_cfg.c b/src/app/engine/config/database_cfg.c index e3b8cbe0..49d6a0ce 100644 --- a/src/app/engine/config/database_cfg.c +++ b/src/app/engine/config/database_cfg.c @@ -43,8 +43,8 @@ * @file database_cfg.c * @author foxBMS Team * @date 2015-08-18 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup ENGINE_CONFIGURATION * @prefix DATA * diff --git a/src/app/engine/config/database_cfg.h b/src/app/engine/config/database_cfg.h index 2eb5779c..93c48b22 100644 --- a/src/app/engine/config/database_cfg.h +++ b/src/app/engine/config/database_cfg.h @@ -43,14 +43,14 @@ * @file database_cfg.h * @author foxBMS Team * @date 2015-08-18 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup ENGINE_CONFIGURATION * @prefix DATA * * @brief Database configuration header * - * Provides interfaces to database configuration + * @details Provides interfaces to database configuration * */ @@ -109,7 +109,7 @@ typedef enum { DATA_BLOCK_ID_MAX, /**< DO NOT CHANGE, MUST BE THE LAST ENTRY */ } DATA_BLOCK_ID_e; -f_static_assert( +FAS_STATIC_ASSERT( (int16_t)DATA_BLOCK_ID_MAX < UINT8_MAX, "Maximum number of database entries exceeds UINT8_MAX; adapted length " "checking in DATA_Initialize and DATA_IterateOverDatabaseEntries"); @@ -335,7 +335,7 @@ typedef struct { uint8_t muxError[BS_NR_OF_STRINGS]; /*!< 0 -> no error, 1 -> error */ uint8_t spiError[BS_NR_OF_STRINGS]; /*!< 0 -> no error, 1 -> error */ uint8_t afeConfigurationError[BS_NR_OF_STRINGS]; /*!< 0 -> no error, 1 -> error */ - uint8_t afeCellvoltageError[BS_NR_OF_STRINGS]; /*!< 0 -> no error, 1 -> error */ + uint8_t afeCellVoltageError[BS_NR_OF_STRINGS]; /*!< 0 -> no error, 1 -> error */ uint8_t afeCellTemperatureError[BS_NR_OF_STRINGS]; /*!< 0 -> no error, 1 -> error */ uint8_t baseCellVoltageMeasurementTimeout; /*!< 0 -> no error, 1 -> error */ uint8_t redundancy0CellVoltageMeasurementTimeout; /*!< 0 -> no error, 1 -> error */ @@ -364,8 +364,8 @@ typedef struct { uint8_t mcuDieTemperature; /*!< 0 -> no error, 1 -> error */ uint8_t coinCellVoltage; /*!< 0 -> no error, 1 -> error */ uint8_t plausibilityCheckPackvoltage[BS_NR_OF_STRINGS]; /*!< 0 -> no error, else: error */ - uint8_t plausibilityCheckCellvoltage[BS_NR_OF_STRINGS]; /*!< 0 -> no error, else: error */ - uint8_t plausibilityCheckCellvoltageSpread[BS_NR_OF_STRINGS]; /*!< 0 -> no error, else: error */ + uint8_t plausibilityCheckCellVoltage[BS_NR_OF_STRINGS]; /*!< 0 -> no error, else: error */ + uint8_t plausibilityCheckCellVoltageSpread[BS_NR_OF_STRINGS]; /*!< 0 -> no error, else: error */ uint8_t plausibilityCheckCelltemperatureSpread[BS_NR_OF_STRINGS]; /*!< 0 -> no error, 1 -> error */ uint8_t plausibilityCheckCelltemperature[BS_NR_OF_STRINGS]; /*!< 0 -> no error, else: error */ uint8_t deepDischargeDetected[BS_NR_OF_STRINGS]; /*!< 0 -> no error, 1 -> error */ @@ -593,7 +593,7 @@ typedef struct { * the initialization of a database struct, uniqueId must be set to the * respective database entry representation in enum DATA_BLOCK_ID_e. */ DATA_BLOCK_HEADER_s header; /*!< Data block header */ - float adc1ConvertedVoltages_mV[ADC_ADC1_MAX_NR_CHANNELS]; /*!< voltages measured by the internal ADC ADC1 */ + float adc1ConvertedVoltages_mV[MCU_ADC1_MAX_NR_CHANNELS]; /*!< voltages measured by the internal ADC ADC1 */ } DATA_BLOCK_ADC_VOLTAGE_s; /** data block struct for the database built-in self-test */ diff --git a/src/app/engine/config/diag_cfg.c b/src/app/engine/config/diag_cfg.c index 70419ed0..09916df7 100644 --- a/src/app/engine/config/diag_cfg.c +++ b/src/app/engine/config/diag_cfg.c @@ -43,35 +43,42 @@ * @file diag_cfg.c * @author foxBMS Team * @date 2019-11-28 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup ENGINE_CONFIGURATION * @prefix DIAG * * @brief Diagnostic module configuration * - * The configuration of the different diagnosis events defined in diag_cfg.h is set in the array - * DIAG_ID_cfg[], e.g. initialization errors or runtime errors. + * @details The configuration of the different diagnosis events defined in + * diag_cfg.h is set in the array diag_diagnosisIdConfiguration[], + * e.g., initialization errors or runtime errors. * - * Every entry of the DIAG_ID_cfg[] array consists of - * - name of the diagnosis event (defined in diag_cfg.h) - * - type of diagnosis event - * - diagnosis sensitivity (after how many occurrences event is counted as error) - * - enabling of the recording for diagnosis event - * - enabling of the diagnosis event - * - callback function for diagnosis event if wished, otherwise DIAG_dummy_callback + * Every entry of the diag_diagnosisIdConfiguration[] array consists + * of + * - name of the diagnosis event (defined in diag_cfg.h) + * - type of diagnosis event + * - diagnosis sensitivity (after how many occurrences event is + * counted as error) + * - enabling of the recording for diagnosis event + * - enabling of the diagnosis event + * - callback function for diagnosis event if wished, otherwise + * DIAG_dummy_callback * - * The system monitoring configuration defined in diag_cfg.h is set in the array - * sysm_ch_cfg[]. The system monitoring is at the moment only used for - * supervising the cyclic/periodic tasks. + * The system monitoring configuration defined in diag_cfg.h is set in + * the array sysm_ch_cfg[]. The system monitoring is at the moment + * only used for supervising the cyclic/periodic tasks. * - * Every entry of the sysm_ch_cfg[] consists of - * - enum of monitored object - * - type of monitored object (at the moment only DIAG_SYSMON_CYCLICTASK is supported) - * - maximum delay in [ms] in which the object needs to call the SYSM_Notify function defined in diag.c - * - enabling of the recording for system monitoring - * - enabling of the system monitoring for the monitored object - * - callback function if system monitoring notices an error if wished, otherwise SYSM_DummyCallback + * Every entry of the sysm_ch_cfg[] consists of + * - enum of monitored object + * - type of monitored object (at the moment only + * DIAG_SYSMON_CYCLICTASK is supported) + * - maximum delay in [ms] in which the object needs to call the + * SYSM_Notify function defined in diag.c + * - enabling of the recording for system monitoring + * - enabling of the system monitoring for the monitored object + * - callback function if system monitoring notices an error if + * wished, otherwise SYSM_DummyCallback */ /*========== Includes =======================================================*/ @@ -86,7 +93,7 @@ /** value of #DIAG_ID_MAX (as a define for the pre-processor) */ #define DIAG_ID_MAX_FOR_INIT (75u) -f_static_assert(DIAG_ID_MAX_FOR_INIT == (uint16_t)DIAG_ID_MAX, "Both values need to be identical."); +FAS_STATIC_ASSERT(DIAG_ID_MAX_FOR_INIT == (uint16_t)DIAG_ID_MAX, "Both values need to be identical."); /*========== Static Constant and Variable Definitions =======================*/ /** local copy of the #DATA_BLOCK_ERRORSTATE_s table */ @@ -112,21 +119,21 @@ const DIAG_DATABASE_SHIM_s diag_kDatabaseShim = { /*========== Extern Constant and Variable Definitions =======================*/ /** variable tracking the state of the diag channels */ -DIAG_ID_CFG_s DIAG_ID_cfg[] = { +DIAG_ID_CFG_s diag_diagnosisIdConfiguration[] = { /* clang-format off */ {DIAG_ID_FLASHCHECKSUM, DIAG_ERROR_SENSITIVITY_FIRST_EVENT, DIAG_FATAL_ERROR, DIAG_NO_DELAY, DIAG_RECORDING_ENABLED, DIAG_EVALUATION_ENABLED, DIAG_DummyCallback}, - {DIAG_ID_SYSTEMMONITORING, DIAG_ERROR_SENSITIVITY_FIRST_EVENT, DIAG_FATAL_ERROR, DIAG_NO_DELAY, DIAG_RECORDING_ENABLED, DIAG_EVALUATION_ENABLED, DIAG_ErrorSystemMonitoring}, + {DIAG_ID_SYSTEM_MONITORING, DIAG_ERROR_SENSITIVITY_FIRST_EVENT, DIAG_FATAL_ERROR, DIAG_NO_DELAY, DIAG_RECORDING_ENABLED, DIAG_EVALUATION_ENABLED, DIAG_ErrorSystemMonitoring}, {DIAG_ID_CONFIGASSERT, DIAG_ERROR_SENSITIVITY_FIRST_EVENT, DIAG_FATAL_ERROR, DIAG_NO_DELAY, DIAG_RECORDING_ENABLED, DIAG_EVALUATION_ENABLED, DIAG_DummyCallback}, {DIAG_ID_INTERLOCK_FEEDBACK, DIAG_ERROR_INTERLOCK_SENSITIVITY, DIAG_FATAL_ERROR, DIAG_DELAY_INTERLOCK_ms, DIAG_RECORDING_ENABLED, DIAG_EVALUATION_ENABLED, DIAG_ErrorInterlock}, - {DIAG_ID_CELLVOLTAGE_OVERVOLTAGE_MSL, DIAG_ERROR_VOLTAGE_SENSITIVITY_MSL, DIAG_FATAL_ERROR, DIAG_DELAY_OVERVOLTAGE_ms, DIAG_RECORDING_ENABLED, DIAG_EVALUATION_ENABLED, DIAG_ErrorOvervoltage}, - {DIAG_ID_CELLVOLTAGE_OVERVOLTAGE_RSL, DIAG_ERROR_VOLTAGE_SENSITIVITY_RSL, DIAG_WARNING, DIAG_DELAY_DISCARDED, DIAG_RECORDING_ENABLED, DIAG_EVALUATION_ENABLED, DIAG_ErrorOvervoltage}, - {DIAG_ID_CELLVOLTAGE_OVERVOLTAGE_MOL, DIAG_ERROR_VOLTAGE_SENSITIVITY_MOL, DIAG_INFO, DIAG_DELAY_DISCARDED, DIAG_RECORDING_ENABLED, DIAG_EVALUATION_ENABLED, DIAG_ErrorOvervoltage}, + {DIAG_ID_CELL_VOLTAGE_OVERVOLTAGE_MSL, DIAG_ERROR_VOLTAGE_SENSITIVITY_MSL, DIAG_FATAL_ERROR, DIAG_DELAY_OVERVOLTAGE_ms, DIAG_RECORDING_ENABLED, DIAG_EVALUATION_ENABLED, DIAG_ErrorOvervoltage}, + {DIAG_ID_CELL_VOLTAGE_OVERVOLTAGE_RSL, DIAG_ERROR_VOLTAGE_SENSITIVITY_RSL, DIAG_WARNING, DIAG_DELAY_DISCARDED, DIAG_RECORDING_ENABLED, DIAG_EVALUATION_ENABLED, DIAG_ErrorOvervoltage}, + {DIAG_ID_CELL_VOLTAGE_OVERVOLTAGE_MOL, DIAG_ERROR_VOLTAGE_SENSITIVITY_MOL, DIAG_INFO, DIAG_DELAY_DISCARDED, DIAG_RECORDING_ENABLED, DIAG_EVALUATION_ENABLED, DIAG_ErrorOvervoltage}, - {DIAG_ID_CELLVOLTAGE_UNDERVOLTAGE_MSL, DIAG_ERROR_VOLTAGE_SENSITIVITY_MSL, DIAG_FATAL_ERROR, DIAG_DELAY_UNDERVOLTAGE_ms, DIAG_RECORDING_ENABLED, DIAG_EVALUATION_ENABLED, DIAG_ErrorUndervoltage}, - {DIAG_ID_CELLVOLTAGE_UNDERVOLTAGE_RSL, DIAG_ERROR_VOLTAGE_SENSITIVITY_RSL, DIAG_WARNING, DIAG_DELAY_DISCARDED, DIAG_RECORDING_ENABLED, DIAG_EVALUATION_ENABLED, DIAG_ErrorUndervoltage}, - {DIAG_ID_CELLVOLTAGE_UNDERVOLTAGE_MOL, DIAG_ERROR_VOLTAGE_SENSITIVITY_MOL, DIAG_INFO, DIAG_DELAY_DISCARDED, DIAG_RECORDING_ENABLED, DIAG_EVALUATION_ENABLED, DIAG_ErrorUndervoltage}, + {DIAG_ID_CELL_VOLTAGE_UNDERVOLTAGE_MSL, DIAG_ERROR_VOLTAGE_SENSITIVITY_MSL, DIAG_FATAL_ERROR, DIAG_DELAY_UNDERVOLTAGE_ms, DIAG_RECORDING_ENABLED, DIAG_EVALUATION_ENABLED, DIAG_ErrorUndervoltage}, + {DIAG_ID_CELL_VOLTAGE_UNDERVOLTAGE_RSL, DIAG_ERROR_VOLTAGE_SENSITIVITY_RSL, DIAG_WARNING, DIAG_DELAY_DISCARDED, DIAG_RECORDING_ENABLED, DIAG_EVALUATION_ENABLED, DIAG_ErrorUndervoltage}, + {DIAG_ID_CELL_VOLTAGE_UNDERVOLTAGE_MOL, DIAG_ERROR_VOLTAGE_SENSITIVITY_MOL, DIAG_INFO, DIAG_DELAY_DISCARDED, DIAG_RECORDING_ENABLED, DIAG_EVALUATION_ENABLED, DIAG_ErrorUndervoltage}, {DIAG_ID_TEMP_OVERTEMPERATURE_CHARGE_MSL, DIAG_ERROR_TEMPERATURE_SENSITIVITY_MSL, DIAG_FATAL_ERROR, DIAG_DELAY_TEMPERATURE_ms, DIAG_RECORDING_ENABLED, DIAG_EVALUATION_ENABLED, DIAG_ErrorOvertemperatureCharge}, {DIAG_ID_TEMP_OVERTEMPERATURE_CHARGE_RSL, DIAG_ERROR_TEMPERATURE_SENSITIVITY_RSL, DIAG_WARNING, DIAG_DELAY_DISCARDED, DIAG_RECORDING_ENABLED, DIAG_EVALUATION_ENABLED, DIAG_ErrorOvertemperatureCharge}, @@ -188,10 +195,10 @@ DIAG_ID_CFG_s DIAG_ID_cfg[] = { {DIAG_ID_PLAUSIBILITY_CELL_TEMPERATURE_SPREAD, DIAG_ERROR_SENSITIVITY_FIRST_EVENT, DIAG_WARNING, DIAG_DELAY_DISCARDED, DIAG_RECORDING_ENABLED, DIAG_EVALUATION_ENABLED, DIAG_PlausibilityCheck}, {DIAG_ID_AFE_CELL_VOLTAGE_MEAS_ERROR, DIAG_ERROR_SENSITIVITY_FIRST_EVENT, DIAG_WARNING, DIAG_DELAY_DISCARDED, DIAG_RECORDING_ENABLED, DIAG_EVALUATION_ENABLED, DIAG_ErrorAfe}, {DIAG_ID_AFE_CELL_TEMPERATURE_MEAS_ERROR, DIAG_ERROR_SENSITIVITY_FIRST_EVENT, DIAG_WARNING, DIAG_DELAY_DISCARDED, DIAG_RECORDING_ENABLED, DIAG_EVALUATION_ENABLED, DIAG_ErrorAfe}, - {DIAG_ID_BASE_CELL_VOLTAGE_MESUREMENT_TIMEOUT, DIAG_ERROR_SENSITIVITY_FIRST_EVENT, DIAG_WARNING, DIAG_DELAY_DISCARDED, DIAG_RECORDING_ENABLED, DIAG_EVALUATION_ENABLED, DIAG_ErrorAfe}, - {DIAG_ID_REDUNDANCY0_CELL_VOLTAGE_MESUREMENT_TIMEOUT, DIAG_ERROR_SENSITIVITY_FIRST_EVENT, DIAG_WARNING, DIAG_DELAY_DISCARDED, DIAG_RECORDING_ENABLED, DIAG_EVALUATION_ENABLED, DIAG_ErrorAfe}, - {DIAG_ID_BASE_CELL_TEMPERATURE_MESUREMENT_TIMEOUT, DIAG_ERROR_SENSITIVITY_FIRST_EVENT, DIAG_WARNING, DIAG_DELAY_DISCARDED, DIAG_RECORDING_ENABLED, DIAG_EVALUATION_ENABLED, DIAG_ErrorAfe}, - {DIAG_ID_REDUNDANCY0_CELL_TEMPERATURE_MESUREMENT_TIMEOUT, DIAG_ERROR_SENSITIVITY_FIRST_EVENT, DIAG_WARNING, DIAG_DELAY_DISCARDED, DIAG_RECORDING_ENABLED, DIAG_EVALUATION_ENABLED, DIAG_ErrorAfe}, + {DIAG_ID_BASE_CELL_VOLTAGE_MEASUREMENT_TIMEOUT, DIAG_ERROR_SENSITIVITY_FIRST_EVENT, DIAG_WARNING, DIAG_DELAY_DISCARDED, DIAG_RECORDING_ENABLED, DIAG_EVALUATION_ENABLED, DIAG_ErrorAfe}, + {DIAG_ID_REDUNDANCY0_CELL_VOLTAGE_MEASUREMENT_TIMEOUT, DIAG_ERROR_SENSITIVITY_FIRST_EVENT, DIAG_WARNING, DIAG_DELAY_DISCARDED, DIAG_RECORDING_ENABLED, DIAG_EVALUATION_ENABLED, DIAG_ErrorAfe}, + {DIAG_ID_BASE_CELL_TEMPERATURE_MEASUREMENT_TIMEOUT, DIAG_ERROR_SENSITIVITY_FIRST_EVENT, DIAG_WARNING, DIAG_DELAY_DISCARDED, DIAG_RECORDING_ENABLED, DIAG_EVALUATION_ENABLED, DIAG_ErrorAfe}, + {DIAG_ID_REDUNDANCY0_CELL_TEMPERATURE_MEASUREMENT_TIMEOUT, DIAG_ERROR_SENSITIVITY_FIRST_EVENT, DIAG_WARNING, DIAG_DELAY_DISCARDED, DIAG_RECORDING_ENABLED, DIAG_EVALUATION_ENABLED, DIAG_ErrorAfe}, {DIAG_ID_DEEP_DISCHARGE_DETECTED, DIAG_ERROR_SENSITIVITY_HIGH, DIAG_FATAL_ERROR, DIAG_DELAY_DEEP_DISCHARGE_ms, DIAG_RECORDING_ENABLED, DIAG_EVALUATION_ENABLED, DIAG_ErrorDeepDischarge}, @@ -215,10 +222,10 @@ DIAG_ID_CFG_s DIAG_ID_cfg[] = { }; DIAG_DEV_s diag_device = { - .nrOfConfiguredDiagnosisEntries = sizeof(DIAG_ID_cfg) / sizeof(DIAG_ID_CFG_s), - .pConfigurationOfDiagnosisEntries = &DIAG_ID_cfg[0], + .nrOfConfiguredDiagnosisEntries = sizeof(diag_diagnosisIdConfiguration) / sizeof(DIAG_ID_CFG_s), + .pConfigurationOfDiagnosisEntries = &diag_diagnosisIdConfiguration[0], .numberOfFatalErrors = 0u, - .pFatalErrorLinkTable = {REPEAT_U(NULL_PTR, STRIP(DIAG_ID_MAX_FOR_INIT))}, + .pFatalErrorLinkTable = {GEN_REPEAT_U(NULL_PTR, GEN_STRIP(DIAG_ID_MAX_FOR_INIT))}, }; /*========== Static Function Implementations ================================*/ diff --git a/src/app/engine/config/diag_cfg.h b/src/app/engine/config/diag_cfg.h index b44d2896..e947d6bd 100644 --- a/src/app/engine/config/diag_cfg.h +++ b/src/app/engine/config/diag_cfg.h @@ -43,8 +43,8 @@ * @file diag_cfg.h * @author foxBMS Team * @date 2019-11-28 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup ENGINE_CONFIGURATION * @prefix DIAG * @@ -144,7 +144,7 @@ /** composite type for storing and passing on the local database table handles */ typedef struct { - DATA_BLOCK_ERRORSTATE_s *pTableError; /*!< database table with errorstates */ + DATA_BLOCK_ERRORSTATE_s *pTableError; /*!< database table with error states */ DATA_BLOCK_MOL_FLAG_s *pTableMol; /*!< database table with MOL flags */ DATA_BLOCK_RSL_FLAG_s *pTableRsl; /*!< database table with RSL flags */ DATA_BLOCK_MSL_FLAG_s *pTableMsl; /*!< database table with MSL flags */ @@ -156,13 +156,13 @@ extern const DIAG_DATABASE_SHIM_s diag_kDatabaseShim; /** list of diag IDs */ typedef enum { DIAG_ID_FLASHCHECKSUM, /*!< the checksum of the flashed software could not be validated */ - DIAG_ID_SYSTEMMONITORING, /*!< the system monitoring module has detected a deviation from task timing limits */ + DIAG_ID_SYSTEM_MONITORING, /*!< the system monitoring module has detected a deviation from task timing limits */ DIAG_ID_CONFIGASSERT, /*!< TODO */ DIAG_ID_AFE_SPI, /*!< issues with the SPI communication of the AFE */ DIAG_ID_AFE_COM_INTEGRITY, /*!< error on the communication integrity of the AFE, e.g. PEC error for LTC */ DIAG_ID_AFE_MUX, /*!< the multiplexer that is connected to the AFE does not react in an expected way */ DIAG_ID_AFE_CONFIG, /*!< the AFE driver has recognized a configuration error */ - DIAG_ID_CAN_TIMING, /*!< the BMS does not receive CAN messages or they are not inside the excpected timing constraints */ + DIAG_ID_CAN_TIMING, /*!< the BMS does not receive CAN messages or they are not inside the expected timing constraints */ DIAG_ID_CAN_RX_QUEUE_FULL, /*!< the reception queue of the driver is full; no new messages can be received */ DIAG_ID_CAN_CC_RESPONDING, /*!< current counter measurements on the CAN bus are missing or not inside expected timing constraints */ DIAG_ID_CAN_EC_RESPONDING, /*!< energy counter measurements on the CAN bus are missing or not inside expected timing constraints */ @@ -173,12 +173,12 @@ typedef enum { DIAG_ID_PLAUSIBILITY_CELL_TEMP, /*!< redundant measurement of the cell temperatures has returned implausible values */ DIAG_ID_PLAUSIBILITY_CELL_VOLTAGE_SPREAD, /*!< the spread (difference between min and max values) of the cell voltages is implausibly high */ DIAG_ID_PLAUSIBILITY_CELL_TEMPERATURE_SPREAD, /*!< the spread (difference between min and max values) of the cell temperatures is implausibly high */ - DIAG_ID_CELLVOLTAGE_OVERVOLTAGE_MSL, /*!< Cell voltage limits violated */ - DIAG_ID_CELLVOLTAGE_OVERVOLTAGE_RSL, /*!< Cell voltage limits violated */ - DIAG_ID_CELLVOLTAGE_OVERVOLTAGE_MOL, /*!< Cell voltage limits violated */ - DIAG_ID_CELLVOLTAGE_UNDERVOLTAGE_MSL, /*!< Cell voltage limits violated */ - DIAG_ID_CELLVOLTAGE_UNDERVOLTAGE_RSL, /*!< Cell voltage limits violated */ - DIAG_ID_CELLVOLTAGE_UNDERVOLTAGE_MOL, /*!< Cell voltage limits violated */ + DIAG_ID_CELL_VOLTAGE_OVERVOLTAGE_MSL, /*!< Cell voltage limits violated */ + DIAG_ID_CELL_VOLTAGE_OVERVOLTAGE_RSL, /*!< Cell voltage limits violated */ + DIAG_ID_CELL_VOLTAGE_OVERVOLTAGE_MOL, /*!< Cell voltage limits violated */ + DIAG_ID_CELL_VOLTAGE_UNDERVOLTAGE_MSL, /*!< Cell voltage limits violated */ + DIAG_ID_CELL_VOLTAGE_UNDERVOLTAGE_RSL, /*!< Cell voltage limits violated */ + DIAG_ID_CELL_VOLTAGE_UNDERVOLTAGE_MOL, /*!< Cell voltage limits violated */ DIAG_ID_TEMP_OVERTEMPERATURE_CHARGE_MSL, /*!< Temperature limits violated */ DIAG_ID_TEMP_OVERTEMPERATURE_CHARGE_RSL, /*!< Temperature limits violated */ DIAG_ID_TEMP_OVERTEMPERATURE_CHARGE_MOL, /*!< Temperature limits violated */ @@ -214,10 +214,10 @@ typedef enum { DIAG_ID_PRECHARGE_CONTACTOR_FEEDBACK, /*!< the feedback on a precharge contactor does not match the expected value */ DIAG_ID_SBC_FIN_STATE, /*!< the state of the FIN signal in the SBC is not ok */ DIAG_ID_SBC_RSTB_STATE, /*!< an activation of the RSTB pin of the SBC has been detected */ - DIAG_ID_BASE_CELL_VOLTAGE_MESUREMENT_TIMEOUT, /*!< the redundancy module has detected that the base cell voltage measurements are missing */ - DIAG_ID_REDUNDANCY0_CELL_VOLTAGE_MESUREMENT_TIMEOUT, /*!< the redundancy module has detected that the redundancy0 cell voltage measurements are missing */ - DIAG_ID_BASE_CELL_TEMPERATURE_MESUREMENT_TIMEOUT, /*!< the redundancy module has detected that the base cell temperature measurements are missing */ - DIAG_ID_REDUNDANCY0_CELL_TEMPERATURE_MESUREMENT_TIMEOUT, /*!< the redundancy module has detected that the redundancy0 temperature measurements are missing */ + DIAG_ID_BASE_CELL_VOLTAGE_MEASUREMENT_TIMEOUT, /*!< the redundancy module has detected that the base cell voltage measurements are missing */ + DIAG_ID_REDUNDANCY0_CELL_VOLTAGE_MEASUREMENT_TIMEOUT, /*!< the redundancy module has detected that the redundancy0 cell voltage measurements are missing */ + DIAG_ID_BASE_CELL_TEMPERATURE_MEASUREMENT_TIMEOUT, /*!< the redundancy module has detected that the base cell temperature measurements are missing */ + DIAG_ID_REDUNDANCY0_CELL_TEMPERATURE_MEASUREMENT_TIMEOUT, /*!< the redundancy module has detected that the redundancy0 temperature measurements are missing */ DIAG_ID_CURRENT_MEASUREMENT_TIMEOUT, /*!< the redundancy module has detected that the current measurement on a string is not updated */ DIAG_ID_CURRENT_MEASUREMENT_ERROR, /*!< the redundancy module has detected a current measurement to be invalid */ DIAG_ID_CURRENT_SENSOR_V1_MEASUREMENT_TIMEOUT, /*!< the redundancy module has detected that the voltage 1 measurement of a current sensor is not updated */ @@ -289,13 +289,13 @@ typedef enum { /** * @brief function type for diag callbacks - * @param[in] ch_id ID of diag entry + * @param[in] diagId ID of diag entry * @param[in] event #DIAG_EVENT_e * @param[in] kpkDiagShim shim to the database entries * @param[in] data data */ typedef void DIAG_CALLBACK_FUNCTION_f( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t data); @@ -331,7 +331,7 @@ typedef struct { /*========== Extern Constant and Variable Declarations ======================*/ /** diag device configuration struct */ extern DIAG_DEV_s diag_device; -extern DIAG_ID_CFG_s DIAG_ID_cfg[DIAG_ID_MAX]; +extern DIAG_ID_CFG_s diag_diagnosisIdConfiguration[DIAG_ID_MAX]; /*========== Extern Function Prototypes =====================================*/ /** diff --git a/src/app/engine/config/sys_cfg.c b/src/app/engine/config/sys_cfg.c index 6f157c49..da19ec74 100644 --- a/src/app/engine/config/sys_cfg.c +++ b/src/app/engine/config/sys_cfg.c @@ -43,8 +43,8 @@ * @file sys_cfg.c * @author foxBMS Team * @date 2020-02-24 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup ENGINE_CONFIGURATION * @prefix SYS * diff --git a/src/app/engine/config/sys_cfg.h b/src/app/engine/config/sys_cfg.h index 0e13fe0f..afdb9deb 100644 --- a/src/app/engine/config/sys_cfg.h +++ b/src/app/engine/config/sys_cfg.h @@ -43,8 +43,8 @@ * @file sys_cfg.h * @author foxBMS Team * @date 2020-02-24 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup ENGINE_CONFIGURATION * @prefix SYS * diff --git a/src/app/engine/config/sys_mon_cfg.c b/src/app/engine/config/sys_mon_cfg.c index 088ecab3..728da0f4 100644 --- a/src/app/engine/config/sys_mon_cfg.c +++ b/src/app/engine/config/sys_mon_cfg.c @@ -43,8 +43,8 @@ * @file sys_mon_cfg.c * @author foxBMS Team * @date 2019-11-28 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup ENGINE_CONFIGURATION * @prefix SYSM * @@ -73,40 +73,40 @@ SYSM_MONITORING_CFG_s sysm_ch_cfg[] = { FTSK_TASK_ENGINE_CYCLE_TIME, FTSK_TASK_ENGINE_MAXIMUM_JITTER, SYSM_RECORDING_ENABLED, - SYSM_HANDLING_SWITCHOFFCONTACTOR, + SYSM_HANDLING_SWITCH_OFF_CONTACTOR, SYSM_DummyCallback}, {SYSM_TASK_ID_CYCLIC_1ms, SYSM_ENABLED, FTSK_TASK_CYCLIC_1MS_CYCLE_TIME, FTSK_TASK_CYCLIC_1MS_MAXIMUM_JITTER, SYSM_RECORDING_ENABLED, - SYSM_HANDLING_SWITCHOFFCONTACTOR, + SYSM_HANDLING_SWITCH_OFF_CONTACTOR, SYSM_DummyCallback}, {SYSM_TASK_ID_CYCLIC_10ms, SYSM_ENABLED, FTSK_TASK_CYCLIC_10MS_CYCLE_TIME, FTSK_TASK_CYCLIC_10MS_MAXIMUM_JITTER, SYSM_RECORDING_ENABLED, - SYSM_HANDLING_SWITCHOFFCONTACTOR, + SYSM_HANDLING_SWITCH_OFF_CONTACTOR, SYSM_DummyCallback}, {SYSM_TASK_ID_CYCLIC_100ms, SYSM_ENABLED, FTSK_TASK_CYCLIC_100MS_CYCLE_TIME, FTSK_TASK_CYCLIC_100MS_MAXIMUM_JITTER, SYSM_RECORDING_ENABLED, - SYSM_HANDLING_SWITCHOFFCONTACTOR, + SYSM_HANDLING_SWITCH_OFF_CONTACTOR, SYSM_DummyCallback}, {SYSM_TASK_ID_CYCLIC_ALGORITHM_100ms, SYSM_ENABLED, FTSK_TASK_CYCLIC_ALGORITHM_100MS_CYCLE_TIME, FTSK_TASK_CYCLIC_ALGORITHM_100MS_MAXIMUM_JITTER, SYSM_RECORDING_ENABLED, - SYSM_HANDLING_SWITCHOFFCONTACTOR, + SYSM_HANDLING_SWITCH_OFF_CONTACTOR, SYSM_DummyCallback}, }; /* DOCUMENTATION marker - sys_mon config exit */ -f_static_assert( +FAS_STATIC_ASSERT( (sizeof(sysm_ch_cfg) / sizeof(SYSM_MONITORING_CFG_s)) == (uint32_t)SYSM_TASK_ID_MAX, "invalid sys_mon configuration!"); diff --git a/src/app/engine/config/sys_mon_cfg.h b/src/app/engine/config/sys_mon_cfg.h index 4d967bcf..e0933495 100644 --- a/src/app/engine/config/sys_mon_cfg.h +++ b/src/app/engine/config/sys_mon_cfg.h @@ -43,8 +43,8 @@ * @file sys_mon_cfg.h * @author foxBMS Team * @date 2019-11-28 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup ENGINE_CONFIGURATION * @prefix SYSM * @@ -62,8 +62,8 @@ /*========== Macros and Definitions =========================================*/ /** diagnosis handling type for system monitoring */ typedef enum { - SYSM_HANDLING_DONOTHING, /*!< take no action */ - SYSM_HANDLING_SWITCHOFFCONTACTOR /*!< open contactors */ + SYSM_HANDLING_DO_NOTHING, /*!< take no action */ + SYSM_HANDLING_SWITCH_OFF_CONTACTOR /*!< open contactors */ } SYSM_HANDLING_TYPE_e; /** @@ -93,13 +93,13 @@ typedef enum { /** Channel configuration of one system monitoring channel */ typedef struct { - SYSM_TASK_ID_e id; /*!< the task id by its symbolic name */ - SYSM_ACTIVATE_e enable; /*!< enable or disable system monitoring */ - uint8_t cycleTime; /*!< max. delay time in ms until #SYSM_Notify has to be called */ - uint8_t maxJitter; /*!< max. jitter in ms */ - SYSM_RECORDING_e enableRecording; /*!< enabled if set to DIAG_RECORDING_ENABLED */ - SYSM_HANDLING_TYPE_e handlingType; /*!< type of handling of system monitoring errors */ - void (*callbackfunc)(SYSM_TASK_ID_e taskID); /*!< callback in case of error */ + SYSM_TASK_ID_e id; /*!< the task id by its symbolic name */ + SYSM_ACTIVATE_e enable; /*!< enable or disable system monitoring */ + uint8_t cycleTime; /*!< max. delay time in ms until #SYSM_Notify has to be called */ + uint8_t maxJitter; /*!< max. jitter in ms */ + SYSM_RECORDING_e enableRecording; /*!< enabled if set to DIAG_RECORDING_ENABLED */ + SYSM_HANDLING_TYPE_e handlingType; /*!< type of handling of system monitoring errors */ + void (*callbackFunction)(SYSM_TASK_ID_e taskId); /*!< callback in case of error */ } SYSM_MONITORING_CFG_s; /*========== Extern Constant and Variable Declarations ======================*/ diff --git a/src/app/engine/database/database.c b/src/app/engine/database/database.c index 419958d5..6bd94757 100644 --- a/src/app/engine/database/database.c +++ b/src/app/engine/database/database.c @@ -43,8 +43,8 @@ * @file database.c * @author foxBMS Team * @date 2015-08-18 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup ENGINE * @prefix DATA * @@ -78,7 +78,7 @@ #define DATA_QUEUE_TIMEOUT_MS (DATA_MAX_QUEUE_TIMEOUT_MS / OS_TICK_RATE_MS) -f_static_assert(DATA_QUEUE_TIMEOUT_MS > 0u, "invalid database queue timeout!"); +FAS_STATIC_ASSERT(DATA_QUEUE_TIMEOUT_MS > 0u, "invalid database queue timeout!"); /** configuration struct of database device */ typedef struct { @@ -172,7 +172,7 @@ static void DATA_CopyData( if (accessType == DATA_WRITE_ACCESS) { /* Pointer on data block header of passed struct */ - /* AXIVION Next Line Style MisraC2012-11.5 this casted is required in order to have a generic interface + /* AXIVION Next Codeline Style MisraC2012-11.5 this casted is required in order to have a generic interface * for all database entries. */ DATA_BLOCK_HEADER_s *pHeader = (DATA_BLOCK_HEADER_s *)pPassedDataStruct; /* Update timestamps in passed database struct and then copy this struct into database */ @@ -180,7 +180,7 @@ static void DATA_CopyData( pHeader->timestamp = OS_GetTickCount(); /* Copy passed struct in database struct */ /* memcpy has no return value therefore there is nothing to check: casting to void */ - /* AXIVION Next Line Style MisraC2012-21.18 + /* AXIVION Next Codeline Style MisraC2012-21.18 * */ (void)memcpy(pDatabaseStruct, pPassedDataStruct, dataLength); } else if (accessType == DATA_READ_ACCESS) { @@ -229,10 +229,10 @@ STD_RETURN_TYPE_e DATA_Initialize(void) { const bool allQueuesCreatedCopyForAssert = ftsk_allQueuesCreated; FAS_ASSERT(allQueuesCreatedCopyForAssert == true); - f_static_assert((sizeof(data_database) != 0u), "No database defined"); + FAS_STATIC_ASSERT((sizeof(data_database) != 0u), "No database defined"); /* make sure that no basic assumptions are broken -- since data_database is declared with length DATA_BLOCK_ID_MAX, this assert should never fail */ - f_static_assert( + FAS_STATIC_ASSERT( ((sizeof(data_database) / sizeof(DATA_BASE_s)) == (uint8_t)(DATA_BLOCK_ID_MAX)), "Database array length error"); /* Iterate over database and set respective read/write pointer for each database entry */ @@ -276,7 +276,8 @@ STD_RETURN_TYPE_e DATA_Initialize(void) { void DATA_Task(void) { if (ftsk_databaseQueue != NULL_PTR) { DATA_QUEUE_MESSAGE_s receiveMessage = { - .accessType = DATA_READ_ACCESS, .pDatabaseEntry = {REPEAT_U(NULL_PTR, STRIP(DATA_MAX_ENTRIES_PER_ACCESS))}}; + .accessType = DATA_READ_ACCESS, + .pDatabaseEntry = {GEN_REPEAT_U(NULL_PTR, GEN_STRIP(DATA_MAX_ENTRIES_PER_ACCESS))}}; /* scan queue and wait for a message up to a maximum amount of 1ms (block time) */ if (OS_ReceiveFromQueue(ftsk_databaseQueue, (&receiveMessage), 1u) == OS_SUCCESS) { /* plausibility check, error whether the first pointer is a NULL_PTR, as this must not happen. diff --git a/src/app/engine/database/database.h b/src/app/engine/database/database.h index 7c699138..72eb626f 100644 --- a/src/app/engine/database/database.h +++ b/src/app/engine/database/database.h @@ -43,8 +43,8 @@ * @file database.h * @author foxBMS Team * @date 2015-08-18 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup ENGINE * @prefix DATA * @@ -77,7 +77,7 @@ #define DATA_ENTRY_3 (3u) /** helper macro for the variadic macros for read and write functions */ -/* AXIVION Next Line Style Generic-NoUnsafeMacro: unsafe macro is needed for variadic macro magic */ +/* AXIVION Next Codeline Style Generic-NoUnsafeMacro: unsafe macro is needed for variadic macro magic */ #define GET_MACRO(_1, _2, _3, _4, NAME, ...) (NAME) /** variadic macro for read access to the database */ #define DATA_READ_DATA(...) \ diff --git a/src/app/engine/database/database_helper.c b/src/app/engine/database/database_helper.c index a6c64236..2bf699fa 100644 --- a/src/app/engine/database/database_helper.c +++ b/src/app/engine/database/database_helper.c @@ -43,8 +43,8 @@ * @file database_helper.c * @author foxBMS Team * @date 2021-05-05 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup ENGINE * @prefix DATA * @@ -86,7 +86,7 @@ extern bool DATA_EntryUpdatedWithinInterval(DATA_BLOCK_HEADER_s dataBlockHeader, bool retval = false; uint32_t currentTimestamp = OS_GetTickCount(); - /* Unsigned integer arithmetic also works correctly if currentTimestap is + /* Unsigned integer arithmetic also works correctly if currentTimestamp is larger than pHeader->timestamp (timer overflow), thus no need to use abs() */ const uint32_t timeDifferenceLastCall = currentTimestamp - dataBlockHeader.timestamp; const bool updatedAtLeastOnce = DATA_DatabaseEntryUpdatedAtLeastOnce(dataBlockHeader); @@ -102,7 +102,7 @@ extern bool DATA_EntryUpdatedPeriodicallyWithinInterval(DATA_BLOCK_HEADER_s data bool retval = false; const uint32_t currentTimestamp = OS_GetTickCount(); - /* Unsigned integer arithmetic also works correctly if currentTimestap is + /* Unsigned integer arithmetic also works correctly if currentTimestamp is smaller than dataBlockHeader.timestamp (timer overflow), thus no need to use abs() */ const uint32_t timeDifferenceLastCall = currentTimestamp - dataBlockHeader.timestamp; const uint32_t timeDifferenceBetweenCalls = dataBlockHeader.timestamp - dataBlockHeader.previousTimestamp; diff --git a/src/app/engine/database/database_helper.h b/src/app/engine/database/database_helper.h index 4ca55e2f..71b95c4a 100644 --- a/src/app/engine/database/database_helper.h +++ b/src/app/engine/database/database_helper.h @@ -43,8 +43,8 @@ * @file database_helper.h * @author foxBMS Team * @date 2021-05-05 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup ENGINE * @prefix DATA * diff --git a/src/app/engine/diag/cbs/diag_cbs.h b/src/app/engine/diag/cbs/diag_cbs.h index 03c453d0..6284b280 100644 --- a/src/app/engine/diag/cbs/diag_cbs.h +++ b/src/app/engine/diag/cbs/diag_cbs.h @@ -43,8 +43,8 @@ * @file diag_cbs.h * @author foxBMS Team * @date 2021-02-17 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup ENGINE * @prefix DIAG * @@ -67,155 +67,155 @@ /*========== Extern Function Prototypes =====================================*/ /** * @brief dummy callback function of diagnosis events - * @param[in] ch_id ID of entry + * @param[in] diagId ID of diag entry * @param[in] event OK, NOK or RESET * @param[in] kpkDiagShim shim to the database entries * @param[in] data data */ extern void DIAG_DummyCallback( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t data); /** * @brief diagnosis callback function for overvoltage events - * @param[in] ch_id ID of diag entry + * @param[in] diagId ID of diag entry * @param[in] event OK, NOK or RESET * @param[in] kpkDiagShim shim to the database entries * @param[in] stringNumber stringNumber where overvoltage event occurred */ extern void DIAG_ErrorOvervoltage( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber); /** * @brief diagnosis callback function for undervoltage events - * @param[in] ch_id ID of diag entry + * @param[in] diagId ID of diag entry * @param[in] event OK, NOK or RESET * @param[in] kpkDiagShim shim to the database entries * @param[in] stringNumber stringNumber where undervoltage event occurred */ extern void DIAG_ErrorUndervoltage( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber); /** * @brief diagnosis callback function for overtemperature charge events - * @param[in] ch_id ID of diag entry + * @param[in] diagId ID of diag entry * @param[in] event OK, NOK or RESET * @param[in] kpkDiagShim shim to the database entries * @param[in] stringNumber stringNumber where overtemperature event occurred */ extern void DIAG_ErrorOvertemperatureCharge( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber); /** * @brief diagnosis callback function for overtemperature discharge events - * @param[in] ch_id ID of diag entry + * @param[in] diagId ID of diag entry * @param[in] event OK, NOK or RESET * @param[in] kpkDiagShim shim to the database entries * @param[in] stringNumber stringNumber where overtemperature event occurred */ extern void DIAG_ErrorOvertemperatureDischarge( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber); /** * @brief diagnosis callback function for undertemperature charge events - * @param[in] ch_id ID of diag entry + * @param[in] diagId ID of diag entry * @param[in] event OK, NOK or RESET * @param[in] kpkDiagShim shim to the database entries * @param[in] stringNumber stringNumber where undertemperature event occurred */ extern void DIAG_ErrorUndertemperatureCharge( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber); /** * @brief diagnosis callback function for undertemperature discharge events - * @param[in] ch_id ID of diag entry + * @param[in] diagId ID of diag entry * @param[in] event OK, NOK or RESET * @param[in] kpkDiagShim shim to the database entries * @param[in] stringNumber stringNumber where undertemperature event occurred */ extern void DIAG_ErrorUndertemperatureDischarge( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber); /** * @brief diagnosis callback function for overcurrent charge events - * @param[in] ch_id ID of diag entry + * @param[in] diagId ID of diag entry * @param[in] event OK, NOK or RESET * @param[in] kpkDiagShim shim to the database entries * @param[in] stringNumber stringNumber where overcurrent event occurred */ extern void DIAG_ErrorOvercurrentCharge( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber); /** * @brief diagnosis callback function for overcurrent discharge events - * @param[in] ch_id ID of diag entry + * @param[in] diagId ID of diag entry * @param[in] event OK, NOK or RESET * @param[in] kpkDiagShim shim to the database entries * @param[in] stringNumber stringNumber where overcurrent event occurred */ extern void DIAG_ErrorOvercurrentDischarge( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber); /** * @brief diagnosis callback function for overcurrent charge events - * @param[in] ch_id ID of diag entry + * @param[in] diagId ID of diag entry * @param[in] event OK, NOK or RESET * @param[in] kpkDiagShim shim to the database entries * @param[in] stringNumber stringNumber where overcurrent event occurred */ extern void DIAG_ErrorCurrentOnOpenString( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber); /** * @brief diagnosis callback function for current measurement related events - * @param[in] ch_id ID of diag entry + * @param[in] diagId ID of diag entry * @param[in] event OK, NOK or RESET * @param[in] kpkDiagShim shim to the database entries * @param[in] stringNumber stringNumber where event occurred */ extern void DIAG_ErrorCurrentMeasurement( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber); /** * @brief diagnosis callback function for current sensor related events - * @param[in] ch_id ID of diag entry + * @param[in] diagId ID of diag entry * @param[in] event OK, NOK or RESET * @param[in] kpkDiagShim shim to the database entries * @param[in] stringNumber stringNumber where event occurred */ extern void DIAG_ErrorHighVoltageMeasurement( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber); @@ -224,210 +224,221 @@ extern void DIAG_ErrorHighVoltageMeasurement( /** * @brief Callback function for system monitoring related diagnosis events - * @param[in] ch_id ID of diag entry - * @param[in] event #DIAG_EVENT_e - * @param[in] kpkDiagShim shim to the database entries - * @param[in] data data + * @param[in] diagId ID of diag entry + * @param[in] event #DIAG_EVENT_e + * @param[in] kpkDiagShim shim to the database entries + * @param[in] data data */ extern void DIAG_ErrorSystemMonitoring( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t data); /** * @brief Callback function for interlock related diagnosis events - * @param[in] ch_id ID of diag entry - * @param[in] event #DIAG_EVENT_e + * @param[in] diagId ID of diag entry + * @param[in] event #DIAG_EVENT_e * @param[in] kpkDiagShim shim to the database entries - * @param[in] data data + * @param[in] data data */ extern void DIAG_ErrorInterlock( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t data); /** * @brief diagnosis callback function for CAN related events - * @param[in] ch_id ID of diag entry - * @param[in] event #DIAG_EVENT_e - * @param[in] kpkDiagShim shim to the database entries - * @param[in] data data + * @param[in] diagId ID of diag entry + * @param[in] event #DIAG_EVENT_e + * @param[in] kpkDiagShim shim to the database entries + * @param[in] data data */ extern void DIAG_ErrorCanTiming( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t data); /** * @brief diagnosis callback function for CAN related events - * @param[in] ch_id ID of diag entry - * @param[in] event #DIAG_EVENT_e - * @param[in] kpkDiagShim shim to the database entries - * @param[in] data data + * @param[in] diagId ID of diag entry + * @param[in] event #DIAG_EVENT_e + * @param[in] kpkDiagShim shim to the database entries + * @param[in] data data */ extern void DIAG_ErrorCanRxQueueFull( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t data); /** * @brief diagnosis callback function for AFE module related events - * @param[in] ch_id ID of diag entry + * @param[in] diagId ID of diag entry * @param[in] event OK, NOK or RESET * @param[in] kpkDiagShim shim to the database entries * @param[in] stringNumber stringNumber where AFE event occurred */ extern void DIAG_ErrorAfeDriver( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber); /** * @brief diagnosis callback function for AFE related events - * @param[in] ch_id ID of diag entry + * @param[in] diagId ID of diag entry * @param[in] event OK, NOK or RESET * @param[in] kpkDiagShim shim to the database entries * @param[in] stringNumber stringNumber where event occurred */ extern void DIAG_ErrorAfe( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber); /** * @brief diagnosis callback function for current sensor related events - * @param[in] ch_id ID of diag entry + * @param[in] diagId ID of diag entry * @param[in] event OK, NOK or RESET * @param[in] kpkDiagShim shim to the database entries * @param[in] stringNumber stringNumber where current sensor event occurred */ extern void DIAG_ErrorCurrentSensor( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber); /** * @brief diagnosis callback function for SBC related events - * @param[in] ch_id ID of diag entry - * @param[in] event #DIAG_EVENT_e - * @param[in] kpkDiagShim shim to the database entries - * @param[in] data data + * @param[in] diagId ID of diag entry + * @param[in] event #DIAG_EVENT_e + * @param[in] kpkDiagShim shim to the database entries + * @param[in] data data */ -extern void DIAG_Sbc(DIAG_ID_e ch_id, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t data); +extern void DIAG_Sbc( + DIAG_ID_e diagId, + DIAG_EVENT_e event, + const DIAG_DATABASE_SHIM_s *const kpkDiagShim, + uint32_t data); /** * @brief diagnosis callback function for plausibility check related events - * @param[in] ch_id ID of diag entry + * @param[in] diagId ID of diag entry * @param[in] event #DIAG_EVENT_e * @param[in] kpkDiagShim shim to the database entries * @param[in] stringNumber stringNumber where current sensor event occurred */ extern void DIAG_ErrorPlausibility( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber); /** * @brief diagnosis callback function for string contactor feedback related events - * @param[in] ch_id ID of diag entry + * @param[in] diagId ID of diag entry * @param[in] event #DIAG_EVENT_e * @param[in] kpkDiagShim shim to the database entries * @param[in] stringNumber stringNumber where contactor feedback event occurred */ extern void DIAG_StringContactorFeedback( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber); /** * @brief diagnosis callback function for precharge contactor feedback related events - * @param[in] ch_id ID of diag entry + * @param[in] diagId ID of diag entry * @param[in] event #DIAG_EVENT_e * @param[in] kpkDiagShim shim to the database entries * @param[in] stringNumber stringNumber where precharge feedback event occurred */ extern void DIAG_PrechargeContactorFeedback( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber); /** * @brief diagnosis callback function for plausibility check related events - * @param[in] ch_id ID of diag entry + * @param[in] diagId ID of diag entry * @param[in] event #DIAG_EVENT_e * @param[in] kpkDiagShim shim to the database entries * @param[in] stringNumber stringNumber where precharge feedback event occurred */ extern void DIAG_PlausibilityCheck( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber); /** * @brief diagnosis callback function for deep discharge events - * @param[in] ch_id ID of diag entry + * @param[in] diagId ID of diag entry * @param[in] event OK, NOK or RESET * @param[in] kpkDiagShim shim to the database entries * @param[in] stringNumber stringNumber where deep discharge event occurred */ extern void DIAG_ErrorDeepDischarge( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber); /** * @brief diagnosis callback function for current sensor related events - * @param[in] ch_id ID of diag entry + * @param[in] diagId ID of diag entry * @param[in] event OK, NOK or RESET * @param[in] kpkDiagShim shim to the database entries * @param[in] stringNumber TODO */ extern void DIAG_ErrorPowerMeasurement( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber); +/** + * @brief diagnosis callback function for the insulation measurement + * @param[in] diagId ID of diag entry + * @param[in] event OK, NOK or RESET + * @param[in] kpkDiagShim shim to the database entries + * @param[in] stringNumber TODO + */ extern void DIAG_Insulation( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber); /** * @brief diagnosis callback function for I2C port expander related events - * @param[in] ch_id ID of diag entry + * @param[in] diagId ID of diag entry * @param[in] event OK, NOK or RESET * @param[in] kpkDiagShim shim to the database entries * @param[in] data not relevant */ extern void DIAG_I2cPex( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t data); /** * @brief diagnosis callback function for FRAM related events - * @param[in] ch_id ID of diag entry + * @param[in] diagId ID of diag entry * @param[in] event OK, NOK or RESET * @param[in] kpkDiagShim shim to the database entries * @param[in] data not relevant */ extern void DIAG_FramError( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t data); diff --git a/src/app/engine/diag/cbs/diag_cbs_afe.c b/src/app/engine/diag/cbs/diag_cbs_afe.c index 986a5858..39685928 100644 --- a/src/app/engine/diag/cbs/diag_cbs_afe.c +++ b/src/app/engine/diag/cbs/diag_cbs_afe.c @@ -43,8 +43,8 @@ * @file diag_cbs_afe.c * @author foxBMS Team * @date 2021-02-17 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup ENGINE * @prefix DIAG * @@ -67,51 +67,51 @@ /*========== Extern Function Implementations ================================*/ extern void DIAG_ErrorAfe( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber) { - FAS_ASSERT(ch_id < DIAG_ID_MAX); + FAS_ASSERT(diagId < DIAG_ID_MAX); FAS_ASSERT((event == DIAG_EVENT_OK) || (event == DIAG_EVENT_NOT_OK) || (event == DIAG_EVENT_RESET)); FAS_ASSERT(kpkDiagShim != NULL_PTR); FAS_ASSERT(stringNumber < BS_NR_OF_STRINGS); - if (ch_id == DIAG_ID_AFE_CELL_VOLTAGE_MEAS_ERROR) { + if (diagId == DIAG_ID_AFE_CELL_VOLTAGE_MEAS_ERROR) { if (event == DIAG_EVENT_RESET) { - kpkDiagShim->pTableError->afeCellvoltageError[stringNumber] = 0; + kpkDiagShim->pTableError->afeCellVoltageError[stringNumber] = 0; } if (event == DIAG_EVENT_NOT_OK) { - kpkDiagShim->pTableError->afeCellvoltageError[stringNumber] = 1; + kpkDiagShim->pTableError->afeCellVoltageError[stringNumber] = 1; } - } else if (ch_id == DIAG_ID_AFE_CELL_TEMPERATURE_MEAS_ERROR) { + } else if (diagId == DIAG_ID_AFE_CELL_TEMPERATURE_MEAS_ERROR) { if (event == DIAG_EVENT_RESET) { kpkDiagShim->pTableError->afeCellTemperatureError[stringNumber] = 0; } if (event == DIAG_EVENT_NOT_OK) { kpkDiagShim->pTableError->afeCellTemperatureError[stringNumber] = 1; } - } else if (ch_id == DIAG_ID_BASE_CELL_VOLTAGE_MESUREMENT_TIMEOUT) { + } else if (diagId == DIAG_ID_BASE_CELL_VOLTAGE_MEASUREMENT_TIMEOUT) { if (event == DIAG_EVENT_RESET) { kpkDiagShim->pTableError->baseCellVoltageMeasurementTimeout = 0; } if (event == DIAG_EVENT_NOT_OK) { kpkDiagShim->pTableError->baseCellVoltageMeasurementTimeout = 1; } - } else if (ch_id == DIAG_ID_REDUNDANCY0_CELL_VOLTAGE_MESUREMENT_TIMEOUT) { + } else if (diagId == DIAG_ID_REDUNDANCY0_CELL_VOLTAGE_MEASUREMENT_TIMEOUT) { if (event == DIAG_EVENT_RESET) { kpkDiagShim->pTableError->redundancy0CellVoltageMeasurementTimeout = 0; } if (event == DIAG_EVENT_NOT_OK) { kpkDiagShim->pTableError->redundancy0CellVoltageMeasurementTimeout = 1; } - } else if (ch_id == DIAG_ID_BASE_CELL_TEMPERATURE_MESUREMENT_TIMEOUT) { + } else if (diagId == DIAG_ID_BASE_CELL_TEMPERATURE_MEASUREMENT_TIMEOUT) { if (event == DIAG_EVENT_RESET) { kpkDiagShim->pTableError->baseCellTemperatureMeasurementTimeout = 0; } if (event == DIAG_EVENT_NOT_OK) { kpkDiagShim->pTableError->baseCellTemperatureMeasurementTimeout = 1; } - } else if (ch_id == DIAG_ID_REDUNDANCY0_CELL_TEMPERATURE_MESUREMENT_TIMEOUT) { + } else if (diagId == DIAG_ID_REDUNDANCY0_CELL_TEMPERATURE_MEASUREMENT_TIMEOUT) { if (event == DIAG_EVENT_RESET) { kpkDiagShim->pTableError->redundancy0CellTemperatureMeasurementTimeout = 0; } @@ -122,44 +122,44 @@ extern void DIAG_ErrorAfe( } extern void DIAG_ErrorAfeDriver( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber) { - FAS_ASSERT(ch_id < DIAG_ID_MAX); + FAS_ASSERT(diagId < DIAG_ID_MAX); FAS_ASSERT((event == DIAG_EVENT_OK) || (event == DIAG_EVENT_NOT_OK) || (event == DIAG_EVENT_RESET)); FAS_ASSERT(kpkDiagShim != NULL_PTR); FAS_ASSERT(stringNumber < BS_NR_OF_STRINGS); - if (ch_id == DIAG_ID_AFE_SPI) { + if (diagId == DIAG_ID_AFE_SPI) { if (event == DIAG_EVENT_RESET) { kpkDiagShim->pTableError->spiError[stringNumber] = 0; } if (event == DIAG_EVENT_NOT_OK) { kpkDiagShim->pTableError->spiError[stringNumber] = 1; } - } else if (ch_id == DIAG_ID_AFE_COM_INTEGRITY) { + } else if (diagId == DIAG_ID_AFE_COM_INTEGRITY) { if (event == DIAG_EVENT_RESET) { kpkDiagShim->pTableError->crcError[stringNumber] = 0; } if (event == DIAG_EVENT_NOT_OK) { kpkDiagShim->pTableError->crcError[stringNumber] = 1; } - } else if (ch_id == DIAG_ID_AFE_MUX) { + } else if (diagId == DIAG_ID_AFE_MUX) { if (event == DIAG_EVENT_RESET) { kpkDiagShim->pTableError->muxError[stringNumber] = 0; } if (event == DIAG_EVENT_NOT_OK) { kpkDiagShim->pTableError->muxError[stringNumber] = 1; } - } else if (ch_id == DIAG_ID_AFE_CONFIG) { + } else if (diagId == DIAG_ID_AFE_CONFIG) { if (event == DIAG_EVENT_RESET) { kpkDiagShim->pTableError->afeConfigurationError[stringNumber] = 0; } if (event == DIAG_EVENT_NOT_OK) { kpkDiagShim->pTableError->afeConfigurationError[stringNumber] = 1; } - } else if (ch_id == DIAG_ID_AFE_OPEN_WIRE) { + } else if (diagId == DIAG_ID_AFE_OPEN_WIRE) { if (event == DIAG_EVENT_RESET) { kpkDiagShim->pTableError->open_wire[stringNumber] = 0; } diff --git a/src/app/engine/diag/cbs/diag_cbs_can.c b/src/app/engine/diag/cbs/diag_cbs_can.c index 01c93f07..4779087a 100644 --- a/src/app/engine/diag/cbs/diag_cbs_can.c +++ b/src/app/engine/diag/cbs/diag_cbs_can.c @@ -43,8 +43,8 @@ * @file diag_cbs_can.c * @author foxBMS Team * @date 2021-02-17 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup ENGINE * @prefix DIAG * @@ -67,15 +67,15 @@ /*========== Extern Function Implementations ================================*/ extern void DIAG_ErrorCanTiming( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t data) { - FAS_ASSERT(ch_id < DIAG_ID_MAX); + FAS_ASSERT(diagId < DIAG_ID_MAX); FAS_ASSERT((event == DIAG_EVENT_OK) || (event == DIAG_EVENT_NOT_OK) || (event == DIAG_EVENT_RESET)); FAS_ASSERT(kpkDiagShim != NULL_PTR); - if (ch_id == DIAG_ID_CAN_TIMING) { + if (diagId == DIAG_ID_CAN_TIMING) { if (event == DIAG_EVENT_RESET) { kpkDiagShim->pTableError->canTiming = 0; } @@ -86,15 +86,15 @@ extern void DIAG_ErrorCanTiming( } extern void DIAG_ErrorCanRxQueueFull( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t data) { - FAS_ASSERT(ch_id < DIAG_ID_MAX); + FAS_ASSERT(diagId < DIAG_ID_MAX); FAS_ASSERT((event == DIAG_EVENT_OK) || (event == DIAG_EVENT_NOT_OK) || (event == DIAG_EVENT_RESET)); FAS_ASSERT(kpkDiagShim != NULL_PTR); - if (ch_id == DIAG_ID_CAN_RX_QUEUE_FULL) { + if (diagId == DIAG_ID_CAN_RX_QUEUE_FULL) { if (event == DIAG_EVENT_RESET) { kpkDiagShim->pTableError->canRxQueueFull = 0; } diff --git a/src/app/engine/diag/cbs/diag_cbs_contactor.c b/src/app/engine/diag/cbs/diag_cbs_contactor.c index 64c55997..4944cfa1 100644 --- a/src/app/engine/diag/cbs/diag_cbs_contactor.c +++ b/src/app/engine/diag/cbs/diag_cbs_contactor.c @@ -43,8 +43,8 @@ * @file diag_cbs_contactor.c * @author foxBMS Team * @date 2021-02-17 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup ENGINE * @prefix DIAG * @@ -67,16 +67,16 @@ /*========== Extern Function Implementations ================================*/ extern void DIAG_StringContactorFeedback( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber) { - FAS_ASSERT(ch_id < DIAG_ID_MAX); + FAS_ASSERT(diagId < DIAG_ID_MAX); FAS_ASSERT((event == DIAG_EVENT_OK) || (event == DIAG_EVENT_NOT_OK) || (event == DIAG_EVENT_RESET)); FAS_ASSERT(kpkDiagShim != NULL_PTR); FAS_ASSERT(stringNumber < BS_NR_OF_STRINGS); - if (ch_id == DIAG_ID_STRING_CONTACTOR_FEEDBACK) { + if (diagId == DIAG_ID_STRING_CONTACTOR_FEEDBACK) { if (event == DIAG_EVENT_RESET) { kpkDiagShim->pTableError->stringContactor[stringNumber] = 0u; } @@ -87,16 +87,16 @@ extern void DIAG_StringContactorFeedback( } extern void DIAG_PrechargeContactorFeedback( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber) { - FAS_ASSERT(ch_id < DIAG_ID_MAX); + FAS_ASSERT(diagId < DIAG_ID_MAX); FAS_ASSERT((event == DIAG_EVENT_OK) || (event == DIAG_EVENT_NOT_OK) || (event == DIAG_EVENT_RESET)); FAS_ASSERT(kpkDiagShim != NULL_PTR); FAS_ASSERT(stringNumber < BS_NR_OF_STRINGS); - if (ch_id == DIAG_ID_PRECHARGE_CONTACTOR_FEEDBACK) { + if (diagId == DIAG_ID_PRECHARGE_CONTACTOR_FEEDBACK) { if (event == DIAG_EVENT_RESET) { kpkDiagShim->pTableError->prechargeContactor[stringNumber] = 0u; } diff --git a/src/app/engine/diag/cbs/diag_cbs_current-sensor.c b/src/app/engine/diag/cbs/diag_cbs_current-sensor.c index 2e0e2ddd..9de622fb 100644 --- a/src/app/engine/diag/cbs/diag_cbs_current-sensor.c +++ b/src/app/engine/diag/cbs/diag_cbs_current-sensor.c @@ -43,8 +43,8 @@ * @file diag_cbs_current-sensor.c * @author foxBMS Team * @date 2021-02-17 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup ENGINE * @prefix DIAG * @@ -67,30 +67,30 @@ /*========== Extern Function Implementations ================================*/ void DIAG_ErrorCurrentSensor( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber) { - FAS_ASSERT(ch_id < DIAG_ID_MAX); + FAS_ASSERT(diagId < DIAG_ID_MAX); FAS_ASSERT((event == DIAG_EVENT_OK) || (event == DIAG_EVENT_NOT_OK) || (event == DIAG_EVENT_RESET)); FAS_ASSERT(kpkDiagShim != NULL_PTR); FAS_ASSERT(stringNumber < BS_NR_OF_STRINGS); - if (ch_id == DIAG_ID_CURRENT_SENSOR_RESPONDING) { + if (diagId == DIAG_ID_CURRENT_SENSOR_RESPONDING) { if (event == DIAG_EVENT_RESET) { kpkDiagShim->pTableError->currentSensor[stringNumber] = 0; } if (event == DIAG_EVENT_NOT_OK) { kpkDiagShim->pTableError->currentSensor[stringNumber] = 1; } - } else if (ch_id == DIAG_ID_CAN_CC_RESPONDING) { + } else if (diagId == DIAG_ID_CAN_CC_RESPONDING) { if (event == DIAG_EVENT_RESET) { kpkDiagShim->pTableError->canTimingCc[stringNumber] = 0; } if (event == DIAG_EVENT_NOT_OK) { kpkDiagShim->pTableError->canTimingCc[stringNumber] = 1; } - } else if (ch_id == DIAG_ID_CAN_EC_RESPONDING) { + } else if (diagId == DIAG_ID_CAN_EC_RESPONDING) { if (event == DIAG_EVENT_RESET) { kpkDiagShim->pTableError->canTimingEc[stringNumber] = 0; } diff --git a/src/app/engine/diag/cbs/diag_cbs_current.c b/src/app/engine/diag/cbs/diag_cbs_current.c index ff8c24d2..0900c9fe 100644 --- a/src/app/engine/diag/cbs/diag_cbs_current.c +++ b/src/app/engine/diag/cbs/diag_cbs_current.c @@ -43,8 +43,8 @@ * @file diag_cbs_current.c * @author foxBMS Team * @date 2021-02-17 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup ENGINE * @prefix DIAG * @@ -67,16 +67,16 @@ /*========== Extern Function Implementations ================================*/ extern void DIAG_ErrorOvercurrentCharge( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber) { - FAS_ASSERT(ch_id < DIAG_ID_MAX); + FAS_ASSERT(diagId < DIAG_ID_MAX); FAS_ASSERT((event == DIAG_EVENT_OK) || (event == DIAG_EVENT_NOT_OK) || (event == DIAG_EVENT_RESET)); FAS_ASSERT(kpkDiagShim != NULL_PTR); FAS_ASSERT(stringNumber < BS_NR_OF_STRINGS); - switch (ch_id) { + switch (diagId) { case DIAG_ID_OVERCURRENT_CHARGE_CELL_MSL: if (event == DIAG_EVENT_RESET) { kpkDiagShim->pTableMsl->cellChargeOvercurrent[stringNumber] = 0; @@ -149,16 +149,16 @@ extern void DIAG_ErrorOvercurrentCharge( } extern void DIAG_ErrorOvercurrentDischarge( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber) { - FAS_ASSERT(ch_id < DIAG_ID_MAX); + FAS_ASSERT(diagId < DIAG_ID_MAX); FAS_ASSERT((event == DIAG_EVENT_OK) || (event == DIAG_EVENT_NOT_OK) || (event == DIAG_EVENT_RESET)); FAS_ASSERT(kpkDiagShim != NULL_PTR); FAS_ASSERT(stringNumber < BS_NR_OF_STRINGS); - switch (ch_id) { + switch (diagId) { case DIAG_ID_OVERCURRENT_DISCHARGE_CELL_MSL: if (event == DIAG_EVENT_RESET) { kpkDiagShim->pTableMsl->cellDischargeOvercurrent[stringNumber] = 0; @@ -230,16 +230,16 @@ extern void DIAG_ErrorOvercurrentDischarge( } extern void DIAG_ErrorCurrentMeasurement( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber) { - FAS_ASSERT(ch_id < DIAG_ID_MAX); + FAS_ASSERT(diagId < DIAG_ID_MAX); FAS_ASSERT((event == DIAG_EVENT_OK) || (event == DIAG_EVENT_NOT_OK) || (event == DIAG_EVENT_RESET)); FAS_ASSERT(kpkDiagShim != NULL_PTR); FAS_ASSERT(stringNumber < BS_NR_OF_STRINGS); - switch (ch_id) { + switch (diagId) { case DIAG_ID_CURRENT_MEASUREMENT_TIMEOUT: if (event == DIAG_EVENT_RESET) { kpkDiagShim->pTableError->currentMeasurementTimeout[stringNumber] = 0u; @@ -267,16 +267,16 @@ extern void DIAG_ErrorCurrentMeasurement( } void DIAG_ErrorCurrentOnOpenString( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber) { - FAS_ASSERT(ch_id < DIAG_ID_MAX); + FAS_ASSERT(diagId < DIAG_ID_MAX); FAS_ASSERT((event == DIAG_EVENT_OK) || (event == DIAG_EVENT_NOT_OK) || (event == DIAG_EVENT_RESET)); FAS_ASSERT(kpkDiagShim != NULL_PTR); FAS_ASSERT(stringNumber < BS_NR_OF_STRINGS); - switch (ch_id) { + switch (diagId) { case DIAG_ID_CURRENT_ON_OPEN_STRING: if (event == DIAG_EVENT_RESET) { kpkDiagShim->pTableError->currentOnOpenString[stringNumber] = 0u; diff --git a/src/app/engine/diag/cbs/diag_cbs_deep-discharge.c b/src/app/engine/diag/cbs/diag_cbs_deep-discharge.c index 0cc9ad35..e5693c7e 100644 --- a/src/app/engine/diag/cbs/diag_cbs_deep-discharge.c +++ b/src/app/engine/diag/cbs/diag_cbs_deep-discharge.c @@ -43,8 +43,8 @@ * @file diag_cbs_deep-discharge.c * @author foxBMS Team * @date 2021-02-17 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup ENGINE * @prefix DIAG * @@ -68,16 +68,16 @@ /*========== Extern Function Implementations ================================*/ void DIAG_ErrorDeepDischarge( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber) { - FAS_ASSERT(ch_id < DIAG_ID_MAX); + FAS_ASSERT(diagId < DIAG_ID_MAX); FAS_ASSERT((event == DIAG_EVENT_OK) || (event == DIAG_EVENT_NOT_OK) || (event == DIAG_EVENT_RESET)); FAS_ASSERT(kpkDiagShim != NULL_PTR); FAS_ASSERT(stringNumber < BS_NR_OF_STRINGS); - if (ch_id == DIAG_ID_DEEP_DISCHARGE_DETECTED) { + if (diagId == DIAG_ID_DEEP_DISCHARGE_DETECTED) { if (event == DIAG_EVENT_RESET) { kpkDiagShim->pTableError->deepDischargeDetected[stringNumber] = 0; fram_deepDischargeFlags.deepDischargeFlag[stringNumber] = false; diff --git a/src/app/engine/diag/cbs/diag_cbs_dummy.c b/src/app/engine/diag/cbs/diag_cbs_dummy.c index 4a90524f..96cc3d26 100644 --- a/src/app/engine/diag/cbs/diag_cbs_dummy.c +++ b/src/app/engine/diag/cbs/diag_cbs_dummy.c @@ -43,8 +43,8 @@ * @file diag_cbs_dummy.c * @author foxBMS Team * @date 2021-02-17 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup ENGINE * @prefix DIAG * @@ -67,7 +67,7 @@ /*========== Extern Function Implementations ================================*/ extern void DIAG_DummyCallback( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t data) { diff --git a/src/app/engine/diag/cbs/diag_cbs_fram.c b/src/app/engine/diag/cbs/diag_cbs_fram.c index ad7bc740..74dc3eda 100644 --- a/src/app/engine/diag/cbs/diag_cbs_fram.c +++ b/src/app/engine/diag/cbs/diag_cbs_fram.c @@ -43,8 +43,8 @@ * @file diag_cbs_fram.c * @author foxBMS Team * @date 2022-02-24 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup ENGINE * @prefix DIAG * @@ -66,16 +66,16 @@ /*========== Extern Function Implementations ================================*/ extern void DIAG_FramError( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t data) { - FAS_ASSERT(ch_id < DIAG_ID_MAX); + FAS_ASSERT(diagId < DIAG_ID_MAX); FAS_ASSERT((event == DIAG_EVENT_OK) || (event == DIAG_EVENT_NOT_OK) || (event == DIAG_EVENT_RESET)); FAS_ASSERT(kpkDiagShim != NULL_PTR); (void)data; /* data is unused */ - if (ch_id == DIAG_ID_FRAM_READ_CRC_ERROR) { + if (diagId == DIAG_ID_FRAM_READ_CRC_ERROR) { if (event == DIAG_EVENT_RESET) { kpkDiagShim->pTableError->framReadCrcError = 0; } diff --git a/src/app/engine/diag/cbs/diag_cbs_i2c.c b/src/app/engine/diag/cbs/diag_cbs_i2c.c index d1559877..de22239f 100644 --- a/src/app/engine/diag/cbs/diag_cbs_i2c.c +++ b/src/app/engine/diag/cbs/diag_cbs_i2c.c @@ -43,8 +43,8 @@ * @file diag_cbs_i2c.c * @author foxBMS Team * @date 2021-09-29 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup ENGINE * @prefix DIAG * @@ -66,16 +66,16 @@ /*========== Extern Function Implementations ================================*/ extern void DIAG_I2cPex( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t data) { - FAS_ASSERT(ch_id < DIAG_ID_MAX); + FAS_ASSERT(diagId < DIAG_ID_MAX); FAS_ASSERT((event == DIAG_EVENT_OK) || (event == DIAG_EVENT_NOT_OK) || (event == DIAG_EVENT_RESET)); FAS_ASSERT(kpkDiagShim != NULL_PTR); (void)data; /* data is unused */ - if (ch_id == DIAG_ID_I2C_PEX_ERROR) { + if (diagId == DIAG_ID_I2C_PEX_ERROR) { if (event == DIAG_EVENT_RESET) { kpkDiagShim->pTableError->i2cPexError = 0; } diff --git a/src/app/engine/diag/cbs/diag_cbs_insulation.c b/src/app/engine/diag/cbs/diag_cbs_insulation.c index 744b48e9..c7af3cb4 100644 --- a/src/app/engine/diag/cbs/diag_cbs_insulation.c +++ b/src/app/engine/diag/cbs/diag_cbs_insulation.c @@ -43,8 +43,8 @@ * @file diag_cbs_insulation.c * @author foxBMS Team * @date 2021-02-22 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup ENGINE * @prefix DIAG * @@ -67,37 +67,37 @@ /*========== Extern Function Implementations ================================*/ extern void DIAG_Insulation( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber) { - FAS_ASSERT(ch_id < DIAG_ID_MAX); + FAS_ASSERT(diagId < DIAG_ID_MAX); FAS_ASSERT((event == DIAG_EVENT_OK) || (event == DIAG_EVENT_NOT_OK) || (event == DIAG_EVENT_RESET)); FAS_ASSERT(kpkDiagShim != NULL_PTR); FAS_ASSERT(stringNumber < BS_NR_OF_STRINGS); - if (ch_id == DIAG_ID_INSULATION_MEASUREMENT_VALID) { + if (diagId == DIAG_ID_INSULATION_MEASUREMENT_VALID) { if (event == DIAG_EVENT_RESET) { kpkDiagShim->pTableError->insulationMeasurementValid = true; } if (event == DIAG_EVENT_NOT_OK) { kpkDiagShim->pTableError->insulationMeasurementValid = false; } - } else if (ch_id == DIAG_ID_LOW_INSULATION_RESISTANCE_ERROR) { + } else if (diagId == DIAG_ID_LOW_INSULATION_RESISTANCE_ERROR) { if (event == DIAG_EVENT_RESET) { kpkDiagShim->pTableError->criticalLowInsulationResistance = false; } if (event == DIAG_EVENT_NOT_OK) { kpkDiagShim->pTableError->criticalLowInsulationResistance = true; } - } else if (ch_id == DIAG_ID_LOW_INSULATION_RESISTANCE_WARNING) { + } else if (diagId == DIAG_ID_LOW_INSULATION_RESISTANCE_WARNING) { if (event == DIAG_EVENT_RESET) { kpkDiagShim->pTableError->warnableLowInsulationResistance = false; } if (event == DIAG_EVENT_NOT_OK) { kpkDiagShim->pTableError->warnableLowInsulationResistance = true; } - } else if (ch_id == DIAG_ID_INSULATION_GROUND_ERROR) { + } else if (diagId == DIAG_ID_INSULATION_GROUND_ERROR) { if (event == DIAG_EVENT_RESET) { kpkDiagShim->pTableError->insulationGroundFaultDetected = false; } diff --git a/src/app/engine/diag/cbs/diag_cbs_interlock.c b/src/app/engine/diag/cbs/diag_cbs_interlock.c index ef85665d..431dfc7b 100644 --- a/src/app/engine/diag/cbs/diag_cbs_interlock.c +++ b/src/app/engine/diag/cbs/diag_cbs_interlock.c @@ -43,8 +43,8 @@ * @file diag_cbs_interlock.c * @author foxBMS Team * @date 2021-02-17 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup ENGINE * @prefix DIAG * @@ -67,15 +67,15 @@ /*========== Extern Function Implementations ================================*/ extern void DIAG_ErrorInterlock( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t data) { - FAS_ASSERT(ch_id < DIAG_ID_MAX); + FAS_ASSERT(diagId < DIAG_ID_MAX); FAS_ASSERT((event == DIAG_EVENT_OK) || (event == DIAG_EVENT_NOT_OK) || (event == DIAG_EVENT_RESET)); FAS_ASSERT(kpkDiagShim != NULL_PTR); - if (ch_id == DIAG_ID_INTERLOCK_FEEDBACK) { + if (diagId == DIAG_ID_INTERLOCK_FEEDBACK) { if (event == DIAG_EVENT_RESET) { kpkDiagShim->pTableError->interlock = 0; } diff --git a/src/app/engine/diag/cbs/diag_cbs_plausibility.c b/src/app/engine/diag/cbs/diag_cbs_plausibility.c index ffd55a60..da05ef8f 100644 --- a/src/app/engine/diag/cbs/diag_cbs_plausibility.c +++ b/src/app/engine/diag/cbs/diag_cbs_plausibility.c @@ -43,8 +43,8 @@ * @file diag_cbs_plausibility.c * @author foxBMS Team * @date 2021-02-17 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup ENGINE * @prefix DIAG * @@ -67,16 +67,16 @@ /*========== Extern Function Implementations ================================*/ extern void DIAG_ErrorPlausibility( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber) { - FAS_ASSERT(ch_id < DIAG_ID_MAX); + FAS_ASSERT(diagId < DIAG_ID_MAX); FAS_ASSERT((event == DIAG_EVENT_OK) || (event == DIAG_EVENT_NOT_OK) || (event == DIAG_EVENT_RESET)); FAS_ASSERT(kpkDiagShim != NULL_PTR); FAS_ASSERT(stringNumber < BS_NR_OF_STRINGS); - if (ch_id == DIAG_ID_PLAUSIBILITY_PACK_VOLTAGE) { + if (diagId == DIAG_ID_PLAUSIBILITY_PACK_VOLTAGE) { if (event == DIAG_EVENT_RESET) { kpkDiagShim->pTableError->plausibilityCheckPackvoltage[stringNumber] = 0u; } @@ -87,37 +87,37 @@ extern void DIAG_ErrorPlausibility( } extern void DIAG_PlausibilityCheck( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber) { - FAS_ASSERT(ch_id < DIAG_ID_MAX); + FAS_ASSERT(diagId < DIAG_ID_MAX); FAS_ASSERT((event == DIAG_EVENT_OK) || (event == DIAG_EVENT_NOT_OK) || (event == DIAG_EVENT_RESET)); FAS_ASSERT(kpkDiagShim != NULL_PTR); FAS_ASSERT(stringNumber < BS_NR_OF_STRINGS); - if (ch_id == DIAG_ID_PLAUSIBILITY_CELL_VOLTAGE) { + if (diagId == DIAG_ID_PLAUSIBILITY_CELL_VOLTAGE) { if (event == DIAG_EVENT_RESET) { - kpkDiagShim->pTableError->plausibilityCheckCellvoltage[stringNumber] = 0u; + kpkDiagShim->pTableError->plausibilityCheckCellVoltage[stringNumber] = 0u; } if (event == DIAG_EVENT_NOT_OK) { - kpkDiagShim->pTableError->plausibilityCheckCellvoltage[stringNumber] = 1u; + kpkDiagShim->pTableError->plausibilityCheckCellVoltage[stringNumber] = 1u; } - } else if (ch_id == DIAG_ID_PLAUSIBILITY_CELL_TEMP) { + } else if (diagId == DIAG_ID_PLAUSIBILITY_CELL_TEMP) { if (event == DIAG_EVENT_RESET) { kpkDiagShim->pTableError->plausibilityCheckCelltemperature[stringNumber] = 0u; } if (event == DIAG_EVENT_NOT_OK) { kpkDiagShim->pTableError->plausibilityCheckCelltemperature[stringNumber] = 1u; } - } else if (ch_id == DIAG_ID_PLAUSIBILITY_CELL_VOLTAGE_SPREAD) { + } else if (diagId == DIAG_ID_PLAUSIBILITY_CELL_VOLTAGE_SPREAD) { if (event == DIAG_EVENT_RESET) { - kpkDiagShim->pTableError->plausibilityCheckCellvoltageSpread[stringNumber] = 0u; + kpkDiagShim->pTableError->plausibilityCheckCellVoltageSpread[stringNumber] = 0u; } if (event == DIAG_EVENT_NOT_OK) { - kpkDiagShim->pTableError->plausibilityCheckCellvoltageSpread[stringNumber] = 1u; + kpkDiagShim->pTableError->plausibilityCheckCellVoltageSpread[stringNumber] = 1u; } - } else if (ch_id == DIAG_ID_PLAUSIBILITY_CELL_TEMPERATURE_SPREAD) { + } else if (diagId == DIAG_ID_PLAUSIBILITY_CELL_TEMPERATURE_SPREAD) { if (event == DIAG_EVENT_RESET) { kpkDiagShim->pTableError->plausibilityCheckCelltemperatureSpread[stringNumber] = 0u; } diff --git a/src/app/engine/diag/cbs/diag_cbs_power-measurement.c b/src/app/engine/diag/cbs/diag_cbs_power-measurement.c index eafa480d..225209ab 100644 --- a/src/app/engine/diag/cbs/diag_cbs_power-measurement.c +++ b/src/app/engine/diag/cbs/diag_cbs_power-measurement.c @@ -43,8 +43,8 @@ * @file diag_cbs_power-measurement.c * @author foxBMS Team * @date 2021-02-17 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup ENGINE * @prefix DIAG * @@ -67,16 +67,16 @@ /*========== Extern Function Implementations ================================*/ extern void DIAG_ErrorPowerMeasurement( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber) { - FAS_ASSERT(ch_id < DIAG_ID_MAX); + FAS_ASSERT(diagId < DIAG_ID_MAX); FAS_ASSERT((event == DIAG_EVENT_OK) || (event == DIAG_EVENT_NOT_OK) || (event == DIAG_EVENT_RESET)); FAS_ASSERT(kpkDiagShim != NULL_PTR); FAS_ASSERT(stringNumber < BS_NR_OF_STRINGS); - switch (ch_id) { + switch (diagId) { case DIAG_ID_CURRENT_SENSOR_POWER_MEASUREMENT_TIMEOUT: if (event == DIAG_EVENT_RESET) { kpkDiagShim->pTableError->currentSensorPowerTimeout[stringNumber] = 0u; diff --git a/src/app/engine/diag/cbs/diag_cbs_sbc.c b/src/app/engine/diag/cbs/diag_cbs_sbc.c index 53c1567f..32989b2f 100644 --- a/src/app/engine/diag/cbs/diag_cbs_sbc.c +++ b/src/app/engine/diag/cbs/diag_cbs_sbc.c @@ -43,8 +43,8 @@ * @file diag_cbs_sbc.c * @author foxBMS Team * @date 2021-02-17 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup ENGINE * @prefix DIAG * @@ -67,22 +67,22 @@ /*========== Extern Function Implementations ================================*/ extern void DIAG_Sbc( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t data) { - FAS_ASSERT(ch_id < DIAG_ID_MAX); + FAS_ASSERT(diagId < DIAG_ID_MAX); FAS_ASSERT((event == DIAG_EVENT_OK) || (event == DIAG_EVENT_NOT_OK) || (event == DIAG_EVENT_RESET)); FAS_ASSERT(kpkDiagShim != NULL_PTR); - if (ch_id == DIAG_ID_SBC_FIN_STATE) { + if (diagId == DIAG_ID_SBC_FIN_STATE) { if (event == DIAG_EVENT_RESET) { kpkDiagShim->pTableError->sbcFinState = 0u; } if (event == DIAG_EVENT_NOT_OK) { kpkDiagShim->pTableError->sbcFinState = 1u; } - } else if (ch_id == DIAG_ID_SBC_RSTB_STATE) { + } else if (diagId == DIAG_ID_SBC_RSTB_STATE) { if (event == DIAG_EVENT_RESET) { kpkDiagShim->pTableError->sbcRstbState = 0u; } diff --git a/src/app/engine/diag/cbs/diag_cbs_sys-mon.c b/src/app/engine/diag/cbs/diag_cbs_sys-mon.c index 7867f6b8..7e580961 100644 --- a/src/app/engine/diag/cbs/diag_cbs_sys-mon.c +++ b/src/app/engine/diag/cbs/diag_cbs_sys-mon.c @@ -43,8 +43,8 @@ * @file diag_cbs_sys-mon.c * @author foxBMS Team * @date 2021-02-17 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup ENGINE * @prefix DIAG * @@ -74,40 +74,36 @@ static bool DIAG_EventToBool(DIAG_EVENT_e event); /*========== Static Function Implementations ================================*/ static bool DIAG_EventToBool(DIAG_EVENT_e event) { FAS_ASSERT((event == DIAG_EVENT_OK) || (event == DIAG_EVENT_NOT_OK) || (event == DIAG_EVENT_RESET)); - bool returnValue = false; if (event == DIAG_EVENT_NOT_OK) { - /* event is not ok, set output to true */ - returnValue = true; + returnValue = true; /* event is not ok, set output to true */ } - return returnValue; } /*========== Extern Function Implementations ================================*/ extern void DIAG_ErrorSystemMonitoring( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t data) { - FAS_ASSERT(ch_id < DIAG_ID_MAX); + FAS_ASSERT(diagId == DIAG_ID_SYSTEM_MONITORING); FAS_ASSERT((event == DIAG_EVENT_OK) || (event == DIAG_EVENT_NOT_OK) || (event == DIAG_EVENT_RESET)); FAS_ASSERT(kpkDiagShim != NULL_PTR); + FAS_ASSERT(data < (uint32_t)SYSM_TASK_ID_MAX); - if (ch_id == DIAG_ID_SYSTEMMONITORING) { - if ((SYSM_TASK_ID_e)data == SYSM_TASK_ID_ENGINE) { - kpkDiagShim->pTableError->timingViolationEngine = DIAG_EventToBool(event); - } else if ((SYSM_TASK_ID_e)data == SYSM_TASK_ID_CYCLIC_1ms) { - kpkDiagShim->pTableError->timingViolation1ms = DIAG_EventToBool(event); - } else if ((SYSM_TASK_ID_e)data == SYSM_TASK_ID_CYCLIC_10ms) { - kpkDiagShim->pTableError->timingViolation10ms = DIAG_EventToBool(event); - } else if ((SYSM_TASK_ID_e)data == SYSM_TASK_ID_CYCLIC_100ms) { - kpkDiagShim->pTableError->timingViolation100ms = DIAG_EventToBool(event); - } else if ((SYSM_TASK_ID_e)data == SYSM_TASK_ID_CYCLIC_ALGORITHM_100ms) { - kpkDiagShim->pTableError->timingViolation100msAlgo = DIAG_EventToBool(event); - } else { - FAS_ASSERT(FAS_TRAP); - } + if (data == (uint32_t)SYSM_TASK_ID_ENGINE) { + kpkDiagShim->pTableError->timingViolationEngine = DIAG_EventToBool(event); + } else if (data == (uint32_t)SYSM_TASK_ID_CYCLIC_1ms) { + kpkDiagShim->pTableError->timingViolation1ms = DIAG_EventToBool(event); + } else if (data == (uint32_t)SYSM_TASK_ID_CYCLIC_10ms) { + kpkDiagShim->pTableError->timingViolation10ms = DIAG_EventToBool(event); + } else if (data == (uint32_t)SYSM_TASK_ID_CYCLIC_100ms) { + kpkDiagShim->pTableError->timingViolation100ms = DIAG_EventToBool(event); + } else if (data == (uint32_t)SYSM_TASK_ID_CYCLIC_ALGORITHM_100ms) { + kpkDiagShim->pTableError->timingViolation100msAlgo = DIAG_EventToBool(event); + } else { + FAS_ASSERT(FAS_TRAP); } } diff --git a/src/app/engine/diag/cbs/diag_cbs_temperature.c b/src/app/engine/diag/cbs/diag_cbs_temperature.c index 9258a9df..f70dba3e 100644 --- a/src/app/engine/diag/cbs/diag_cbs_temperature.c +++ b/src/app/engine/diag/cbs/diag_cbs_temperature.c @@ -43,8 +43,8 @@ * @file diag_cbs_temperature.c * @author foxBMS Team * @date 2021-02-17 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup ENGINE * @prefix DIAG * @@ -67,30 +67,30 @@ /*========== Extern Function Implementations ================================*/ extern void DIAG_ErrorOvertemperatureCharge( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber) { - FAS_ASSERT(ch_id < DIAG_ID_MAX); + FAS_ASSERT(diagId < DIAG_ID_MAX); FAS_ASSERT((event == DIAG_EVENT_OK) || (event == DIAG_EVENT_NOT_OK) || (event == DIAG_EVENT_RESET)); FAS_ASSERT(kpkDiagShim != NULL_PTR); FAS_ASSERT(stringNumber < BS_NR_OF_STRINGS); - if (ch_id == DIAG_ID_TEMP_OVERTEMPERATURE_CHARGE_MSL) { + if (diagId == DIAG_ID_TEMP_OVERTEMPERATURE_CHARGE_MSL) { if (event == DIAG_EVENT_RESET) { kpkDiagShim->pTableMsl->overtemperatureCharge[stringNumber] = 0; } if (event == DIAG_EVENT_NOT_OK) { kpkDiagShim->pTableMsl->overtemperatureCharge[stringNumber] = 1; } - } else if (ch_id == DIAG_ID_TEMP_OVERTEMPERATURE_CHARGE_RSL) { + } else if (diagId == DIAG_ID_TEMP_OVERTEMPERATURE_CHARGE_RSL) { if (event == DIAG_EVENT_RESET) { kpkDiagShim->pTableRsl->overtemperatureCharge[stringNumber] = 0; } if (event == DIAG_EVENT_NOT_OK) { kpkDiagShim->pTableRsl->overtemperatureCharge[stringNumber] = 1; } - } else if (ch_id == DIAG_ID_TEMP_OVERTEMPERATURE_CHARGE_MOL) { + } else if (diagId == DIAG_ID_TEMP_OVERTEMPERATURE_CHARGE_MOL) { if (event == DIAG_EVENT_RESET) { kpkDiagShim->pTableMol->overtemperatureCharge[stringNumber] = 0; } @@ -101,30 +101,30 @@ extern void DIAG_ErrorOvertemperatureCharge( } extern void DIAG_ErrorOvertemperatureDischarge( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber) { - FAS_ASSERT(ch_id < DIAG_ID_MAX); + FAS_ASSERT(diagId < DIAG_ID_MAX); FAS_ASSERT((event == DIAG_EVENT_OK) || (event == DIAG_EVENT_NOT_OK) || (event == DIAG_EVENT_RESET)); FAS_ASSERT(kpkDiagShim != NULL_PTR); FAS_ASSERT(stringNumber < BS_NR_OF_STRINGS); - if (ch_id == DIAG_ID_TEMP_OVERTEMPERATURE_DISCHARGE_MSL) { + if (diagId == DIAG_ID_TEMP_OVERTEMPERATURE_DISCHARGE_MSL) { if (event == DIAG_EVENT_RESET) { kpkDiagShim->pTableMsl->overtemperatureDischarge[stringNumber] = 0; } if (event == DIAG_EVENT_NOT_OK) { kpkDiagShim->pTableMsl->overtemperatureDischarge[stringNumber] = 1; } - } else if (ch_id == DIAG_ID_TEMP_OVERTEMPERATURE_DISCHARGE_RSL) { + } else if (diagId == DIAG_ID_TEMP_OVERTEMPERATURE_DISCHARGE_RSL) { if (event == DIAG_EVENT_RESET) { kpkDiagShim->pTableRsl->overtemperatureDischarge[stringNumber] = 0; } if (event == DIAG_EVENT_NOT_OK) { kpkDiagShim->pTableRsl->overtemperatureDischarge[stringNumber] = 1; } - } else if (ch_id == DIAG_ID_TEMP_OVERTEMPERATURE_DISCHARGE_MOL) { + } else if (diagId == DIAG_ID_TEMP_OVERTEMPERATURE_DISCHARGE_MOL) { if (event == DIAG_EVENT_RESET) { kpkDiagShim->pTableMol->overtemperatureDischarge[stringNumber] = 0; } @@ -135,30 +135,30 @@ extern void DIAG_ErrorOvertemperatureDischarge( } extern void DIAG_ErrorUndertemperatureCharge( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber) { - FAS_ASSERT(ch_id < DIAG_ID_MAX); + FAS_ASSERT(diagId < DIAG_ID_MAX); FAS_ASSERT((event == DIAG_EVENT_OK) || (event == DIAG_EVENT_NOT_OK) || (event == DIAG_EVENT_RESET)); FAS_ASSERT(kpkDiagShim != NULL_PTR); FAS_ASSERT(stringNumber < BS_NR_OF_STRINGS); - if (ch_id == DIAG_ID_TEMP_UNDERTEMPERATURE_CHARGE_MSL) { + if (diagId == DIAG_ID_TEMP_UNDERTEMPERATURE_CHARGE_MSL) { if (event == DIAG_EVENT_RESET) { kpkDiagShim->pTableMsl->undertemperatureCharge[stringNumber] = 0; } if (event == DIAG_EVENT_NOT_OK) { kpkDiagShim->pTableMsl->undertemperatureCharge[stringNumber] = 1; } - } else if (ch_id == DIAG_ID_TEMP_UNDERTEMPERATURE_CHARGE_RSL) { + } else if (diagId == DIAG_ID_TEMP_UNDERTEMPERATURE_CHARGE_RSL) { if (event == DIAG_EVENT_RESET) { kpkDiagShim->pTableRsl->undertemperatureCharge[stringNumber] = 0; } if (event == DIAG_EVENT_NOT_OK) { kpkDiagShim->pTableRsl->undertemperatureCharge[stringNumber] = 1; } - } else if (ch_id == DIAG_ID_TEMP_UNDERTEMPERATURE_CHARGE_MOL) { + } else if (diagId == DIAG_ID_TEMP_UNDERTEMPERATURE_CHARGE_MOL) { if (event == DIAG_EVENT_RESET) { kpkDiagShim->pTableMol->undertemperatureCharge[stringNumber] = 0; } @@ -169,30 +169,30 @@ extern void DIAG_ErrorUndertemperatureCharge( } extern void DIAG_ErrorUndertemperatureDischarge( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber) { - FAS_ASSERT(ch_id < DIAG_ID_MAX); + FAS_ASSERT(diagId < DIAG_ID_MAX); FAS_ASSERT((event == DIAG_EVENT_OK) || (event == DIAG_EVENT_NOT_OK) || (event == DIAG_EVENT_RESET)); FAS_ASSERT(kpkDiagShim != NULL_PTR); FAS_ASSERT(stringNumber < BS_NR_OF_STRINGS); - if (ch_id == DIAG_ID_TEMP_UNDERTEMPERATURE_DISCHARGE_MSL) { + if (diagId == DIAG_ID_TEMP_UNDERTEMPERATURE_DISCHARGE_MSL) { if (event == DIAG_EVENT_RESET) { kpkDiagShim->pTableMsl->undertemperatureDischarge[stringNumber] = 0; } if (event == DIAG_EVENT_NOT_OK) { kpkDiagShim->pTableMsl->undertemperatureDischarge[stringNumber] = 1; } - } else if (ch_id == DIAG_ID_TEMP_UNDERTEMPERATURE_DISCHARGE_RSL) { + } else if (diagId == DIAG_ID_TEMP_UNDERTEMPERATURE_DISCHARGE_RSL) { if (event == DIAG_EVENT_RESET) { kpkDiagShim->pTableRsl->undertemperatureDischarge[stringNumber] = 0; } if (event == DIAG_EVENT_NOT_OK) { kpkDiagShim->pTableRsl->undertemperatureDischarge[stringNumber] = 1; } - } else if (ch_id == DIAG_ID_TEMP_UNDERTEMPERATURE_DISCHARGE_MOL) { + } else if (diagId == DIAG_ID_TEMP_UNDERTEMPERATURE_DISCHARGE_MOL) { if (event == DIAG_EVENT_RESET) { kpkDiagShim->pTableMol->undertemperatureDischarge[stringNumber] = 0; } diff --git a/src/app/engine/diag/cbs/diag_cbs_voltage.c b/src/app/engine/diag/cbs/diag_cbs_voltage.c index f94d54e7..7aa8000d 100644 --- a/src/app/engine/diag/cbs/diag_cbs_voltage.c +++ b/src/app/engine/diag/cbs/diag_cbs_voltage.c @@ -43,8 +43,8 @@ * @file diag_cbs_voltage.c * @author foxBMS Team * @date 2021-02-17 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup ENGINE * @prefix DIAG * @@ -67,30 +67,30 @@ /*========== Extern Function Implementations ================================*/ extern void DIAG_ErrorOvervoltage( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber) { - FAS_ASSERT(ch_id < DIAG_ID_MAX); + FAS_ASSERT(diagId < DIAG_ID_MAX); FAS_ASSERT((event == DIAG_EVENT_OK) || (event == DIAG_EVENT_NOT_OK) || (event == DIAG_EVENT_RESET)); FAS_ASSERT(kpkDiagShim != NULL_PTR); FAS_ASSERT(stringNumber < BS_NR_OF_STRINGS); - if (ch_id == DIAG_ID_CELLVOLTAGE_OVERVOLTAGE_MSL) { + if (diagId == DIAG_ID_CELL_VOLTAGE_OVERVOLTAGE_MSL) { if (event == DIAG_EVENT_RESET) { kpkDiagShim->pTableMsl->overVoltage[stringNumber] = 0; } if (event == DIAG_EVENT_NOT_OK) { kpkDiagShim->pTableMsl->overVoltage[stringNumber] = 1; } - } else if (ch_id == DIAG_ID_CELLVOLTAGE_OVERVOLTAGE_RSL) { + } else if (diagId == DIAG_ID_CELL_VOLTAGE_OVERVOLTAGE_RSL) { if (event == DIAG_EVENT_RESET) { kpkDiagShim->pTableRsl->overVoltage[stringNumber] = 0; } if (event == DIAG_EVENT_NOT_OK) { kpkDiagShim->pTableRsl->overVoltage[stringNumber] = 1; } - } else if (ch_id == DIAG_ID_CELLVOLTAGE_OVERVOLTAGE_MOL) { + } else if (diagId == DIAG_ID_CELL_VOLTAGE_OVERVOLTAGE_MOL) { if (event == DIAG_EVENT_RESET) { kpkDiagShim->pTableMol->overVoltage[stringNumber] = 0; } @@ -101,30 +101,30 @@ extern void DIAG_ErrorOvervoltage( } extern void DIAG_ErrorUndervoltage( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber) { - FAS_ASSERT(ch_id < DIAG_ID_MAX); + FAS_ASSERT(diagId < DIAG_ID_MAX); FAS_ASSERT((event == DIAG_EVENT_OK) || (event == DIAG_EVENT_NOT_OK) || (event == DIAG_EVENT_RESET)); FAS_ASSERT(kpkDiagShim != NULL_PTR); FAS_ASSERT(stringNumber < BS_NR_OF_STRINGS); - if (ch_id == DIAG_ID_CELLVOLTAGE_UNDERVOLTAGE_MSL) { + if (diagId == DIAG_ID_CELL_VOLTAGE_UNDERVOLTAGE_MSL) { if (event == DIAG_EVENT_RESET) { kpkDiagShim->pTableMsl->underVoltage[stringNumber] = 0; } if (event == DIAG_EVENT_NOT_OK) { kpkDiagShim->pTableMsl->underVoltage[stringNumber] = 1; } - } else if (ch_id == DIAG_ID_CELLVOLTAGE_UNDERVOLTAGE_RSL) { + } else if (diagId == DIAG_ID_CELL_VOLTAGE_UNDERVOLTAGE_RSL) { if (event == DIAG_EVENT_RESET) { kpkDiagShim->pTableRsl->underVoltage[stringNumber] = 0; } if (event == DIAG_EVENT_NOT_OK) { kpkDiagShim->pTableRsl->underVoltage[stringNumber] = 1; } - } else if (ch_id == DIAG_ID_CELLVOLTAGE_UNDERVOLTAGE_MOL) { + } else if (diagId == DIAG_ID_CELL_VOLTAGE_UNDERVOLTAGE_MOL) { if (event == DIAG_EVENT_RESET) { kpkDiagShim->pTableMol->underVoltage[stringNumber] = 0; } @@ -135,16 +135,16 @@ extern void DIAG_ErrorUndervoltage( } extern void DIAG_ErrorHighVoltageMeasurement( - DIAG_ID_e ch_id, + DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber) { - FAS_ASSERT(ch_id < DIAG_ID_MAX); + FAS_ASSERT(diagId < DIAG_ID_MAX); FAS_ASSERT((event == DIAG_EVENT_OK) || (event == DIAG_EVENT_NOT_OK) || (event == DIAG_EVENT_RESET)); FAS_ASSERT(kpkDiagShim != NULL_PTR); FAS_ASSERT(stringNumber < BS_NR_OF_STRINGS); - switch (ch_id) { + switch (diagId) { case DIAG_ID_CURRENT_SENSOR_V1_MEASUREMENT_TIMEOUT: if (event == DIAG_EVENT_RESET) { kpkDiagShim->pTableError->currentSensorTimeoutV1[stringNumber] = 0u; diff --git a/src/app/engine/diag/diag.c b/src/app/engine/diag/diag.c index 440e007a..6b58a8b8 100644 --- a/src/app/engine/diag/diag.c +++ b/src/app/engine/diag/diag.c @@ -43,16 +43,17 @@ * @file diag.c * @author foxBMS Team * @date 2019-11-28 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup ENGINE * @prefix DIAG * * @brief Diagnosis driver implementation * - * This diagnose module is responsible for error handling and reporting. - * Reported errors are logged into the global database and can be reviewed - * on user request. + * @details This diagnose module is responsible for error handling and + * reporting. + * Reported errors are logged into the global database and can be + * reviewed on user request. */ /*========== Includes =======================================================*/ @@ -162,8 +163,9 @@ STD_RETURN_TYPE_e DIAG_Initialize(DIAG_DEV_s *diag_dev_pointer) { diag_dev_pointer->numberOfFatalErrors = 0u; /* Fill pointer array with links to all diagnosis entries with a fatal error */ for (uint16_t entry = 0u; entry < (uint16_t)DIAG_ID_MAX; entry++) { - if (DIAG_ID_cfg[entry].severity == DIAG_FATAL_ERROR) { - diag_dev_pointer->pFatalErrorLinkTable[diag_dev_pointer->numberOfFatalErrors] = &DIAG_ID_cfg[entry]; + if (diag_diagnosisIdConfiguration[entry].severity == DIAG_FATAL_ERROR) { + diag_dev_pointer->pFatalErrorLinkTable[diag_dev_pointer->numberOfFatalErrors] = + &diag_diagnosisIdConfiguration[entry]; diag_dev_pointer->numberOfFatalErrors++; } } @@ -208,12 +210,12 @@ static uint8_t DIAG_EntryWrite(uint8_t eventID, DIAG_EVENT_e event, uint32_t dat } if (++diag.entry_cnt[eventID] > DIAG_MAX_ENTRIES_OF_ERROR) { - /* this type of error has been recorded too many times -> ignore to avoid filling buffer with same failurecodes */ + /* this type of error has been recorded too many times -> ignore to avoid filling buffer with same failure codes */ diag.entry_cnt[eventID] = DIAG_MAX_ENTRIES_OF_ERROR; return ret_val; } - /* now record failurecode */ + /* now record failure code */ ret_val = 0xFF; /* counts of (new) diagnosis entry records which is still not been read by @@ -226,7 +228,7 @@ static uint8_t DIAG_EntryWrite(uint8_t eventID, DIAG_EVENT_e event, uint32_t dat return ret_val; } -DIAG_RETURNTYPE_e DIAG_Handler(DIAG_ID_e diag_id, DIAG_EVENT_e event, DIAG_IMPACT_LEVEL_e impact, uint32_t data) { +DIAG_RETURNTYPE_e DIAG_Handler(DIAG_ID_e diagId, DIAG_EVENT_e event, DIAG_IMPACT_LEVEL_e impact, uint32_t data) { DIAG_RETURNTYPE_e ret_val = DIAG_HANDLER_RETURN_UNKNOWN; uint32_t *u32ptr_errCodemsk = NULL_PTR; uint32_t *u32ptr_warnCodemsk = NULL_PTR; @@ -242,7 +244,7 @@ DIAG_RETURNTYPE_e DIAG_Handler(DIAG_ID_e diag_id, DIAG_EVENT_e event, DIAG_IMPAC return DIAG_HANDLER_RETURN_NOT_READY; } - if (diag_id >= DIAG_ID_MAX) { + if (diagId >= DIAG_ID_MAX) { return DIAG_HANDLER_RETURN_WRONG_ID; } @@ -263,15 +265,15 @@ DIAG_RETURNTYPE_e DIAG_Handler(DIAG_ID_e diag_id, DIAG_EVENT_e event, DIAG_IMPAC stringID = data; } - err_enable_idx = diag_id / 32; /* array index of diag.err_enableflag[..] */ - err_enable_bitmask = 1 << (diag_id % 32); /* bit number (mask) of diag.err_enableflag[idx] */ + err_enable_idx = diagId / 32; /* array index of diag.err_enableflag[..] */ + err_enable_bitmask = 1 << (diagId % 32); /* bit number (mask) of diag.err_enableflag[idx] */ u32ptr_errCodemsk = &diag.errflag[err_enable_idx]; u32ptr_warnCodemsk = &diag.warnflag[err_enable_idx]; - u16ptr_threshcounter = &diag.occurrenceCounter[stringID][diag_id]; - cfg_threshold = diag_devptr->pConfigurationOfDiagnosisEntries[diag.id2ch[diag_id]].threshold; - recording_enabled = diag_devptr->pConfigurationOfDiagnosisEntries[diag.id2ch[diag_id]].enable_recording; - evaluate_enabled = diag_devptr->pConfigurationOfDiagnosisEntries[diag.id2ch[diag_id]].enable_evaluate; + u16ptr_threshcounter = &diag.occurrenceCounter[stringID][diagId]; + cfg_threshold = diag_devptr->pConfigurationOfDiagnosisEntries[diag.id2ch[diagId]].threshold; + recording_enabled = diag_devptr->pConfigurationOfDiagnosisEntries[diag.id2ch[diagId]].enable_recording; + evaluate_enabled = diag_devptr->pConfigurationOfDiagnosisEntries[diag.id2ch[diagId]].enable_evaluate; if (event == DIAG_EVENT_OK) { if ((diag.err_enableflag[err_enable_idx] & err_enable_bitmask) > 0u) { @@ -288,12 +290,13 @@ DIAG_RETURNTYPE_e DIAG_Handler(DIAG_ID_e diag_id, DIAG_EVENT_e event, DIAG_IMPAC (*u16ptr_threshcounter) = 0; /* Make entry in error-memory (error disappeared) */ if (recording_enabled == DIAG_RECORDING_ENABLED) { - DIAG_EntryWrite(diag_id, event, data); + DIAG_EntryWrite(diagId, event, data); } if (evaluate_enabled == DIAG_EVALUATION_ENABLED) { /* Call callback function and reset error */ - DIAG_ID_cfg[diag.id2ch[diag_id]].fpCallback(diag_id, DIAG_EVENT_RESET, &diag_kDatabaseShim, data); + diag_diagnosisIdConfiguration[diag.id2ch[diagId]].fpCallback( + diagId, DIAG_EVENT_RESET, &diag_kDatabaseShim, data); } } } @@ -311,12 +314,13 @@ DIAG_RETURNTYPE_e DIAG_Handler(DIAG_ID_e diag_id, DIAG_EVENT_e event, DIAG_IMPAC /* Make entry in error-memory (error occurred) */ if (recording_enabled == DIAG_RECORDING_ENABLED) { - DIAG_EntryWrite(diag_id, event, data); + DIAG_EntryWrite(diagId, event, data); } if (evaluate_enabled == DIAG_EVALUATION_ENABLED) { /* Call callback function and set error */ - DIAG_ID_cfg[diag.id2ch[diag_id]].fpCallback(diag_id, DIAG_EVENT_NOT_OK, &diag_kDatabaseShim, data); + diag_diagnosisIdConfiguration[diag.id2ch[diagId]].fpCallback( + diagId, DIAG_EVENT_NOT_OK, &diag_kDatabaseShim, data); } /* Function returns an error-message! */ ret_val = DIAG_HANDLER_RETURN_ERR_OCCURRED; @@ -325,7 +329,7 @@ DIAG_RETURNTYPE_e DIAG_Handler(DIAG_ID_e diag_id, DIAG_EVENT_e event, DIAG_IMPAC ret_val = DIAG_HANDLER_RETURN_ERR_OCCURRED; } } else { - /* Error occured BUT NOT enabled by mask */ + /* Error occurred BUT NOT enabled by mask */ *u32ptr_errCodemsk &= ~err_enable_bitmask; /* ERROR: clear corresponding bit in errflag[idx] */ *u32ptr_warnCodemsk |= err_enable_bitmask; /* WARNING: set corresponding bit in warnflag[idx] */ ret_val = DIAG_HANDLER_RETURN_WARNING_OCCURRED; /* Function returns an error-message! */ @@ -337,14 +341,13 @@ DIAG_RETURNTYPE_e DIAG_Handler(DIAG_ID_e diag_id, DIAG_EVENT_e event, DIAG_IMPAC *u32ptr_warnCodemsk &= ~err_enable_bitmask; /* WARNING: clear corresponding bit in warnflag[idx] */ (*u16ptr_threshcounter) = 0; if (recording_enabled == DIAG_RECORDING_ENABLED) { - DIAG_EntryWrite( - diag_id, - event, - data); /* Make entry in error-memory (error disappeared) if error was recorded before */ + /* Make entry in error-memory (error disappeared) if error was recorded before */ + DIAG_EntryWrite(diagId, event, data); } if (evaluate_enabled == DIAG_EVALUATION_ENABLED) { /* Call callback function and reset error */ - DIAG_ID_cfg[diag.id2ch[diag_id]].fpCallback(diag_id, DIAG_EVENT_RESET, &diag_kDatabaseShim, data); + diag_diagnosisIdConfiguration[diag.id2ch[diagId]].fpCallback( + diagId, DIAG_EVENT_RESET, &diag_kDatabaseShim, data); } } ret_val = DIAG_HANDLER_RETURN_OK; /* Function does not return an error-message! */ @@ -353,17 +356,13 @@ DIAG_RETURNTYPE_e DIAG_Handler(DIAG_ID_e diag_id, DIAG_EVENT_e event, DIAG_IMPAC return ret_val; } -STD_RETURN_TYPE_e DIAG_CheckEvent( - STD_RETURN_TYPE_e cond, - DIAG_ID_e diag_id, - DIAG_IMPACT_LEVEL_e impact, - uint32_t data) { +STD_RETURN_TYPE_e DIAG_CheckEvent(STD_RETURN_TYPE_e cond, DIAG_ID_e diagId, DIAG_IMPACT_LEVEL_e impact, uint32_t data) { STD_RETURN_TYPE_e retVal = STD_NOT_OK; if (cond == STD_OK) { - DIAG_Handler(diag_id, DIAG_EVENT_OK, impact, data); + DIAG_Handler(diagId, DIAG_EVENT_OK, impact, data); } else { - DIAG_Handler(diag_id, DIAG_EVENT_NOT_OK, impact, data); + DIAG_Handler(diagId, DIAG_EVENT_NOT_OK, impact, data); } return retVal; @@ -371,7 +370,7 @@ STD_RETURN_TYPE_e DIAG_CheckEvent( uint32_t DIAG_GetDelay(DIAG_ID_e diagnosisEntry) { FAS_ASSERT(diagnosisEntry < DIAG_ID_MAX); - return DIAG_ID_cfg[diag.id2ch[(uint16_t)diagnosisEntry]].delay_ms; + return diag_diagnosisIdConfiguration[diag.id2ch[(uint16_t)diagnosisEntry]].delay_ms; } bool DIAG_IsAnyFatalErrorSet(void) { diff --git a/src/app/engine/diag/diag.h b/src/app/engine/diag/diag.h index ff7c9420..1feb048a 100644 --- a/src/app/engine/diag/diag.h +++ b/src/app/engine/diag/diag.h @@ -43,8 +43,8 @@ * @file diag.h * @author foxBMS Team * @date 2019-11-28 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup ENGINE * @prefix DIAG * @@ -108,14 +108,14 @@ typedef struct { * module itself, or can be done in the callback function defined in * diag_cfg.c * @ingroup API_DIAG - * @param diag_id #DIAG_ID_e of the event that has occurred + * @param diagId #DIAG_ID_e of the event that has occurred * @param event event that occurred (OK, NOK, RESET) * @param impact #DIAG_IMPACT_LEVEL_e of #DIAG_ID_e * @param data individual information for #DIAG_ID_e e.g. string number,.. * @return #DIAG_HANDLER_RETURN_UNKNOWN if invalid #DIAG_EVENT_e, otherwise * return value of #DIAG_RETURNTYPE_e */ -extern DIAG_RETURNTYPE_e DIAG_Handler(DIAG_ID_e diag_id, DIAG_EVENT_e event, DIAG_IMPACT_LEVEL_e impact, uint32_t data); +extern DIAG_RETURNTYPE_e DIAG_Handler(DIAG_ID_e diagId, DIAG_EVENT_e event, DIAG_IMPACT_LEVEL_e impact, uint32_t data); /** * @brief DIAG_CheckEvent provides a simple interface to check an event for @@ -126,14 +126,14 @@ extern DIAG_RETURNTYPE_e DIAG_Handler(DIAG_ID_e diag_id, DIAG_EVENT_e event, DIA * this function should be used instead of directly calling the * #DIAG_Handler(). * @param cond condition - * @param diag_id event ID of the event that has occurred + * @param diagId event ID of the event that has occurred * @param impact #DIAG_IMPACT_LEVEL_e of #DIAG_ID_e * @param data individual information for #DIAG_ID_e e.g. string number,.. * @return STD_OK if ok, STD_NOT_OK if not ok */ extern STD_RETURN_TYPE_e DIAG_CheckEvent( STD_RETURN_TYPE_e cond, - DIAG_ID_e diag_id, + DIAG_ID_e diagId, DIAG_IMPACT_LEVEL_e impact, uint32_t data); diff --git a/src/app/engine/hwinfo/masterinfo.c b/src/app/engine/hwinfo/masterinfo.c index 194488c7..6107a154 100644 --- a/src/app/engine/hwinfo/masterinfo.c +++ b/src/app/engine/hwinfo/masterinfo.c @@ -43,8 +43,8 @@ * @file masterinfo.c * @author foxBMS Team * @date 2020-07-08 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup GENERAL * @prefix MINFO * diff --git a/src/app/engine/hwinfo/masterinfo.h b/src/app/engine/hwinfo/masterinfo.h index 116ec714..37007ef4 100644 --- a/src/app/engine/hwinfo/masterinfo.h +++ b/src/app/engine/hwinfo/masterinfo.h @@ -43,8 +43,8 @@ * @file masterinfo.h * @author foxBMS Team * @date 2020-07-08 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup GENERAL * @prefix MINFO * diff --git a/src/app/engine/sys/sys.c b/src/app/engine/sys/sys.c index 77aed4d2..5d2d2657 100644 --- a/src/app/engine/sys/sys.c +++ b/src/app/engine/sys/sys.c @@ -43,8 +43,8 @@ * @file sys.c * @author foxBMS Team * @date 2020-02-24 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup ENGINE * @prefix SYS * @@ -66,7 +66,7 @@ #include "meas.h" #include "os.h" #include "sbc.h" -#include "sof.h" +#include "sof_trapezoid.h" #include "state_estimation.h" /*========== Macros and Definitions =========================================*/ @@ -656,9 +656,9 @@ static SYS_RETURN_TYPE_e SYS_CheckStateRequest(SYS_STATE_REQUEST_e stateRequest) /*========== Extern Function Implementations ================================*/ extern void SYS_GeneralMacroBist(void) { - const uint8_t dummy[REPEAT_MAXIMUM_REPETITIONS] = { - REPEAT_U(SYS_BIST_GENERAL_MAGIC_NUMBER, STRIP(REPEAT_MAXIMUM_REPETITIONS))}; - for (uint8_t i = 0u; i < REPEAT_MAXIMUM_REPETITIONS; i++) { + const uint8_t dummy[GEN_REPEAT_MAXIMUM_REPETITIONS] = { + GEN_REPEAT_U(SYS_BIST_GENERAL_MAGIC_NUMBER, GEN_STRIP(GEN_REPEAT_MAXIMUM_REPETITIONS))}; + for (uint8_t i = 0u; i < GEN_REPEAT_MAXIMUM_REPETITIONS; i++) { FAS_ASSERT(dummy[i] == SYS_BIST_GENERAL_MAGIC_NUMBER); } } diff --git a/src/app/engine/sys/sys.h b/src/app/engine/sys/sys.h index c1e0a187..85f97f18 100644 --- a/src/app/engine/sys/sys.h +++ b/src/app/engine/sys/sys.h @@ -43,8 +43,8 @@ * @file sys.h * @author foxBMS Team * @date 2020-02-24 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup ENGINE * @prefix SYS * diff --git a/src/app/engine/sys_mon/sys_mon.c b/src/app/engine/sys_mon/sys_mon.c index bb04162f..68a7efd2 100644 --- a/src/app/engine/sys_mon/sys_mon.c +++ b/src/app/engine/sys_mon/sys_mon.c @@ -43,8 +43,8 @@ * @file sys_mon.c * @author foxBMS Team * @date 2019-11-28 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup ENGINE * @prefix SYSM * @@ -169,12 +169,12 @@ void SYSM_CheckNotifications(void) { if ((time_since_last_call > max_allowed_jitter) && (sysm_notifications[taskId].duration > sysm_ch_cfg[taskId].cycleTime)) { /* module not running within its timed limits */ - DIAG_Handler(DIAG_ID_SYSTEMMONITORING, DIAG_EVENT_NOT_OK, DIAG_SYSTEM, (uint32_t)taskId); + DIAG_Handler(DIAG_ID_SYSTEM_MONITORING, DIAG_EVENT_NOT_OK, DIAG_SYSTEM, (uint32_t)taskId); if (sysm_ch_cfg[taskId].enableRecording == SYSM_RECORDING_ENABLED) { SYSM_RecordTimingViolation( taskId, sysm_notifications[taskId].duration, sysm_notifications[taskId].timestampEnter); } - sysm_ch_cfg[taskId].callbackfunc(taskId); + sysm_ch_cfg[taskId].callbackFunction(taskId); } } } @@ -232,7 +232,7 @@ extern void SYSM_GetRecordedTimingViolations(SYSM_TIMING_VIOLATION_RESPONSE_s *p extern void SYSM_ClearAllTimingViolations(void) { /* clear all diag entries */ for (SYSM_TASK_ID_e taskId = (SYSM_TASK_ID_e)0; taskId < SYSM_TASK_ID_MAX; taskId++) { - DIAG_Handler(DIAG_ID_SYSTEMMONITORING, DIAG_EVENT_OK, DIAG_SYSTEM, (uint32_t)taskId); + DIAG_Handler(DIAG_ID_SYSTEM_MONITORING, DIAG_EVENT_OK, DIAG_SYSTEM, (uint32_t)taskId); } /* clear local FRAM copy */ OS_EnterTaskCritical(); diff --git a/src/app/engine/sys_mon/sys_mon.h b/src/app/engine/sys_mon/sys_mon.h index ef98c78e..ac159e78 100644 --- a/src/app/engine/sys_mon/sys_mon.h +++ b/src/app/engine/sys_mon/sys_mon.h @@ -43,8 +43,8 @@ * @file sys_mon.h * @author foxBMS Team * @date 2019-11-28 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup ENGINE * @prefix SYSM * diff --git a/src/app/engine/wscript b/src/app/engine/wscript index fd0bf4cd..68c3a217 100644 --- a/src/app/engine/wscript +++ b/src/app/engine/wscript @@ -113,7 +113,7 @@ def build(bld): os.path.join("..", "task", "config"), os.path.join("..", "task", "ftask"), ] - includes.extend(bld.env.INCLUDES_OPERATING_SYSTEM + bld.env.INCLUDES_AFE) + includes.extend(bld.env.INCLUDES_RTOS + bld.env.INCLUDES_AFE) target = f"{bld.env.APPNAME.lower()}-engine" cflags = bld.env.CFLAGS_FOXBMS diff --git a/src/app/main/fassert.c b/src/app/main/fassert.c index 194c87e7..6decf71f 100644 --- a/src/app/main/fassert.c +++ b/src/app/main/fassert.c @@ -43,8 +43,8 @@ * @file fassert.c * @author foxBMS Team * @date 2020-05-26 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup ASSERT * @prefix FAS * diff --git a/src/app/main/fstartup.c b/src/app/main/fstartup.c index cfa3dafa..c67975d9 100644 --- a/src/app/main/fstartup.c +++ b/src/app/main/fstartup.c @@ -43,8 +43,8 @@ * @file fstartup.c * @author foxBMS Team * @date 2020-07-09 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup GENERAL * @prefix STU * @@ -99,13 +99,16 @@ #include "HL_sys_mpu.h" #include "HL_errata_SSWF021_45.h" +#include "fassert.h" #include "fstartup.h" #include "main.h" + +#include /* clang-format on */ /*========== Macros and Definitions =========================================*/ /** number of retries for the PLL to come up */ -#define STU_PLL_RETRIES 5U +#define STU_PLL_RETRIES (5u) /*========== Static Constant and Variable Definitions =======================*/ @@ -130,8 +133,7 @@ static resetSource_t STU_GetResetSourceWithoutFlagReset(void); /*========== Static Function Implementations ================================*/ void STU_HandlePllLockFail(void) { - while (1) { - } + FAS_ASSERT(FAS_TRAP); } resetSource_t STU_GetResetSourceWithoutFlagReset(void) { register resetSource_t rst_source; @@ -269,7 +271,7 @@ void _c_int00(void) { /* call the application */ main(); - /* AXIVION Next Line Style MisraC2012-21.8: exit is called as in generated code by TI */ + /* AXIVION Next Codeline Style MisraC2012-21.8: exit is called as in generated code by TI */ exit(0); } diff --git a/src/app/main/include/config/version_cfg.h b/src/app/main/include/config/version_cfg.h index 5ad186c9..103d096c 100644 --- a/src/app/main/include/config/version_cfg.h +++ b/src/app/main/include/config/version_cfg.h @@ -43,10 +43,10 @@ * @file version_cfg.h * @author foxBMS Team * @date 2021-07-14 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup GENERAL - * @prefix NONE + * @prefix VER * * @brief Header file for the version information that is generated by the toolchain * @@ -59,20 +59,20 @@ #include "general.h" /*========== Macros and Definitions =========================================*/ -/** maximum length of the string #VERSION_s::gitRemote +/** maximum length of the string #VER_VERSION_s::gitRemote * * Has to be in line with the value in f_ti_arm_cgt.py! */ -#define VERSION_STRUCT_MAXIMUM_REMOTE_STRING_LENGTH (128u) +#define VER_VERSION_STRUCT_MAXIMUM_REMOTE_STRING_LENGTH (128u) -/** maximum length of the string #VERSION_s::commitHash +/** maximum length of the string #VER_VERSION_s::commitHash * * Has to be in line with the value in f_ti_arm_cgt.py! */ -#define VERSION_STRUCT_MAXIMUM_COMMIT_HASH_LENGTH (9u) +#define VER_VERSION_STRUCT_MAXIMUM_COMMIT_HASH_LENGTH (9u) /** macro for an attribute that tells the linker script where to place the version information */ -#define VERSION_INFORMATION __attribute__((section(".versionInformation"))) +#define VER_VERSION_INFORMATION __attribute__((section(".versionInformation"))) /** struct type that describes the version information of the system */ typedef struct { @@ -82,14 +82,14 @@ typedef struct { const uint8_t minor; /*!< minor release version */ const uint8_t patch; /*!< patch release version */ const uint16_t distanceFromLastRelease; /*!< distance in commits from the last tagged release in version control */ - const char commitHash[VERSION_STRUCT_MAXIMUM_COMMIT_HASH_LENGTH]; /*!< hash of the last commit */ + const char commitHash[VER_VERSION_STRUCT_MAXIMUM_COMMIT_HASH_LENGTH]; /*!< hash of the last commit */ const char gitRemote - [VERSION_STRUCT_MAXIMUM_REMOTE_STRING_LENGTH]; /*!< address of the git remote linked in the repository */ -} VERSION_s; + [VER_VERSION_STRUCT_MAXIMUM_REMOTE_STRING_LENGTH]; /*!< address of the git remote linked in the repository */ +} VER_VERSION_s; /*========== Extern Constant and Variable Declarations ======================*/ /** version information of the system */ -extern const VERSION_s foxbmsVersionInfo; +extern const VER_VERSION_s ver_foxbmsVersionInformation; /*========== Extern Function Prototypes =====================================*/ diff --git a/src/app/main/include/fassert.h b/src/app/main/include/fassert.h index 5463dac1..8d00c440 100644 --- a/src/app/main/include/fassert.h +++ b/src/app/main/include/fassert.h @@ -43,31 +43,31 @@ * @file fassert.h * @author foxBMS Team * @date 2020-03-20 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup ASSERT * @prefix FAS * * @brief Assert macro implementation * * @details The default implementation accommodates three behaviors, - * based on ASSERT_LEVEL symbol: + * based on FAS_ASSERT_LEVEL symbol: * - * - When the ASSERT_LEVEL symbol is defined as - * ASSERT_LEVEL_INF_LOOP_AND_DISABLE_INTERRUPTS, the FAS_ASSERT macro is + * - When the FAS_ASSERT_LEVEL symbol is defined as + * FAS_ASSERT_LEVEL_INF_LOOP_AND_DISABLE_INTERRUPTS, the FAS_ASSERT macro is * implemented as an infinite loop in which all interrupts are disabled. This * will definitely trigger a watchdog reset. * - * - When ASSERT_LEVEL symbol is defined as ASSERT_LEVEL_INF_LOOP_FOR_DEBUG, + * - When FAS_ASSERT_LEVEL symbol is defined as FAS_ASSERT_LEVEL_INF_LOOP_FOR_DEBUG, * the validation performed by the FAS_ASSERT macro is enabled, and a failed * validation triggers an infinite loop. This configuration is recommended * for development environments, as it prevents further execution. Depending * on the configuration this might lead to a watchdog reset. This mode is * intended for investigation of problems by a developer. * - * - When ASSERT_LEVEL symbol is defined as ASSERT_LEVEL_NO_OPERATION, the + * - When FAS_ASSERT_LEVEL symbol is defined as FAS_ASSERT_LEVEL_NO_OPERATION, the * FAS_ASSERT macro is defined as empty and does nothing. It might be - * necessary to activate this mode in ressource-constrained situations. + * necessary to activate this mode in resource-constrained situations. * Generally it is not recommended to use this option as it will not notice * the undefined system-states that the assert should catch. * @@ -92,9 +92,18 @@ /*========== Macros and Definitions =========================================*/ -/* AXIVION Disable Style MisraC2012-1.2 MisraC2012Directive-4.1: Function is - * implemented in Assembler (see swiPortDisableInterrupts) and this is the way - * to tell it the TI compiler */ +/* AXIVION Disable Style MisraC2012Directive-1.1: 'pragma' required to tell the + * TI ARM CGT compiler, that this is an interrupt function + * (see SPNU151V-January1998-RevisedFebruary2020: 5.11.29 The SWI_ALIAS Pragma) + */ +/* AXIVION Disable Style MisraC2012-1.2: Function is implemented in assembler + * and this is the way to tell it the TI compiler (see + * src\os\freertos\portable\ccs\arm_cortex-r5\portasm.asm::swiPortDisableInterrupts) + */ +/* AXIVION Disable Style MisraC2012-8.6: Function definition is in assembler + * (see + * src\os\freertos\portable\ccs\arm_cortex-r5\portasm.asm::swiPortDisableInterrupts) + */ /** * @brief Disable interrupts * @details This alias is mapped to an ASM function and disables all interrupts @@ -104,7 +113,9 @@ */ #pragma SWI_ALIAS(FAS_DisableInterrupts, 5) extern void FAS_DisableInterrupts(void); -/* AXIVION Enable Style MisraC2012-1.2 MisraC2012Directive-4.1: */ +/* AXIVION Enable Style MisraC2012-8.6: */ +/* AXIVION Enable Style MisraC2012-1.2: */ +/* AXIVION Enable Style MisraC2012Directive-1.1: */ /** * @brief Define that evaluates to essential boolean false thus tripping @@ -131,7 +142,7 @@ typedef struct { * This definition has to be at this position in order to be used by * the macros below. * If you get issues in a unit test with this being not defined, try - * to add this header to the unit tests includes explicitely. + * to add this header to the unit tests includes explicitly. * @param[in] pc address of the program counter where the assertion * occurred * @param[in] line line where the assertion occurred @@ -139,52 +150,52 @@ typedef struct { extern void FAS_StoreAssertLocation(uint32_t *pc, uint32_t line); /** - * @def ASSERT_LEVEL_INF_LOOP_AND_DISABLE_INTERRUPTS + * @def FAS_ASSERT_LEVEL_INF_LOOP_AND_DISABLE_INTERRUPTS * @brief This assert level traps the complete program by going into an * infinite loop and disabling all interrupts. * - * @def ASSERT_LEVEL_INF_LOOP_FOR_DEBUG + * @def FAS_ASSERT_LEVEL_INF_LOOP_FOR_DEBUG * @brief This assert level traps the current task by going into an * infinite loop. * - * @def ASSERT_LEVEL_NO_OPERATION + * @def FAS_ASSERT_LEVEL_NO_OPERATION * @brief This assert level does nothing (except for the standard recording * of the assert location which does every level). */ -#define ASSERT_LEVEL_INF_LOOP_AND_DISABLE_INTERRUPTS (0u) -#define ASSERT_LEVEL_INF_LOOP_FOR_DEBUG (1u) -#define ASSERT_LEVEL_NO_OPERATION (2u) +#define FAS_ASSERT_LEVEL_INF_LOOP_AND_DISABLE_INTERRUPTS (0u) +#define FAS_ASSERT_LEVEL_INF_LOOP_FOR_DEBUG (1u) +#define FAS_ASSERT_LEVEL_NO_OPERATION (2u) /** - * @def ASSERT_LEVEL + * @def FAS_ASSERT_LEVEL * @brief Set the assert level to a standard value if not set by the build. */ -#ifndef ASSERT_LEVEL -#define ASSERT_LEVEL ASSERT_LEVEL_INF_LOOP_AND_DISABLE_INTERRUPTS +#ifndef FAS_ASSERT_LEVEL +#define FAS_ASSERT_LEVEL FAS_ASSERT_LEVEL_INF_LOOP_AND_DISABLE_INTERRUPTS #endif /*============= define how the assert shall behave =============*/ -#if ASSERT_LEVEL == ASSERT_LEVEL_INF_LOOP_AND_DISABLE_INTERRUPTS +#if FAS_ASSERT_LEVEL == FAS_ASSERT_LEVEL_INF_LOOP_AND_DISABLE_INTERRUPTS /** Assert macro will trigger a watchdog reset */ static inline void FAS_InfiniteLoop(void) { /* disable IRQ interrupts */ FAS_DisableInterrupts(); - /* AXIVION Next Line Style MisraC2012-2.2: an infinite loop is intended to stop further code execution */ + /* AXIVION Next Codeline Style MisraC2012-2.2: an infinite loop is intended to stop further code execution */ while (true) { /* Stay here until watchdog reset happens */ } } -#elif ASSERT_LEVEL == ASSERT_LEVEL_INF_LOOP_FOR_DEBUG +#elif FAS_ASSERT_LEVEL == FAS_ASSERT_LEVEL_INF_LOOP_FOR_DEBUG /** Assert macro will stay in infinite loop */ static inline void FAS_InfiniteLoop(void) { while (true) { /* Stay here to ease debugging */ } } -#elif ASSERT_LEVEL == ASSERT_LEVEL_NO_OPERATION +#elif FAS_ASSERT_LEVEL == FAS_ASSERT_LEVEL_NO_OPERATION static inline void FAS_InfiniteLoop(void) { } #else -#error "Invalid value for ASSERT_LEVEL" +#error "Invalid value for FAS_ASSERT_LEVEL" #endif /*============= define the recording macro =============*/ @@ -207,13 +218,13 @@ static inline uint32_t __curpc(void) { * It is important that this is a macro in order to insert it directly * at he assert location in the code */ -#define FAS_ASSERT_RECORD() \ - do { \ - /* AXIVION Next Line Style MisraC2012-11.5: The program counter needs to be casted to platform register +#define FAS_ASSERT_RECORD() \ + do { \ + /* AXIVION Next Codeline Style MisraC2012-11.5: The program counter needs to be casted to platform register width */ \ - uint32_t *pc = (uint32_t *)__curpc(); \ - FAS_StoreAssertLocation(pc, __LINE__); \ - } while (0) + uint32_t *pc = (uint32_t *)__curpc(); \ + FAS_StoreAssertLocation(pc, __LINE__); \ + } while (false) /*============= define the assertion-macro =============*/ /** @@ -227,7 +238,7 @@ static inline uint32_t __curpc(void) { * * Use this macro if you want to assert. If the assertion fails * the macro will take action based on the configuration of this module. - * See #ASSERT_LEVEL for reference. + * See #FAS_ASSERT_LEVEL for reference. * * If the macro passes, it is just ignored. If you want to definitely * fail, you can use the value #FAS_TRAP as an argument which is @@ -245,31 +256,31 @@ static inline uint32_t __curpc(void) { FAS_ASSERT_RECORD(); \ FAS_InfiniteLoop(); \ } \ - } while (0) + } while (false) #endif #if defined(__STDC_VERSION__) /* We have some newer compiler (C94 at least) */ #if __STDC_VERSION__ == 199409L -#warning "Ignoring static asserts in C94 mode (f_static_assert)." -#define f_static_assert(cond, msg) +#warning "Ignoring static asserts in C94 mode (FAS_STATIC_ASSERT)." +#define FAS_STATIC_ASSERT(cond, msg) #elif __STDC_VERSION__ == 199901L #if defined(__TI_COMPILER_VERSION__) /* The TI compiler seems to have hacks to enable static assert see include/sys/cdefs.h */ -#define f_static_assert(cond, msg) _Static_assert(cond, msg) +#define FAS_STATIC_ASSERT(cond, msg) _Static_assert(cond, msg) #else /* for other compilers just ignore the static assert */ -#warning "Ignoring static asserts in C99 mode (f_static_assert)." -#define f_static_assert(...) +#warning "Ignoring static asserts in C99 mode (FAS_STATIC_ASSERT)." +#define FAS_STATIC_ASSERT(...) #endif #elif __STDC_VERSION__ == 201112L -#define f_static_assert(cond, msg) _Static_assert(cond, msg) +#define FAS_STATIC_ASSERT(cond, msg) _Static_assert(cond, msg) #elif __STDC_VERSION__ == 201710L -#define f_static_assert(cond, msg) _Static_assert(cond, msg) +#define FAS_STATIC_ASSERT(cond, msg) _Static_assert(cond, msg) #endif #else /* if __STDC_VERSION__ is not defined, we have some very old compiler and we need to ignore static asserting */ -#warning "Ignoring static asserts in C89/C90 mode (f_static_assert)." -#define f_static_assert(cond, msg) +#warning "Ignoring static asserts in C89/C90 mode (FAS_STATIC_ASSERT)." +#define FAS_STATIC_ASSERT(cond, msg) #endif /*========== Extern Constant and Variable Declarations ======================*/ diff --git a/src/app/main/include/fstartup.h b/src/app/main/include/fstartup.h index 48b68778..3e364e20 100644 --- a/src/app/main/include/fstartup.h +++ b/src/app/main/include/fstartup.h @@ -43,8 +43,8 @@ * @file fstartup.h * @author foxBMS Team * @date 2022-05-18 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup GENERAL * @prefix STU * @@ -61,23 +61,22 @@ /*========== Extern Constant and Variable Declarations ======================*/ /*========== Extern Function Prototypes =====================================*/ + +/* AXIVION Next Codeline Style MisraC2012-21.2: Library function with no header + see SPNU151V-January1998-RevisedFebruary2020: 6.10 System Initialization */ /** * @brief initialize global variable and constructors - * @details TI library function */ + * @details TI library function + */ extern void __TI_auto_init(void); -/** - * @brief exit application - * @details C standard exit function - * @param _status the return code to exit with - * */ -extern void exit(int _status); - +/* AXIVION Next Codeline Style MisraC2012-21.2: Library function with no header + see SPNU151V-January1998-RevisedFebruary2020: 6.10 System Initialization */ /** * @brief Startup Routine * @details The name of the startup routine is defined in the TI ARM CGT * manual. -*/ + */ extern void _c_int00(void); /*========== Externalized Static Functions Prototypes (Unit Test) ===========*/ diff --git a/src/app/main/include/fstd_types.h b/src/app/main/include/fstd_types.h index 5b6082c1..62f4d5b3 100644 --- a/src/app/main/include/fstd_types.h +++ b/src/app/main/include/fstd_types.h @@ -43,8 +43,8 @@ * @file fstd_types.h * @author foxBMS Team * @date 2015-12-20 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup GENERAL_CONF * @prefix STD * diff --git a/src/app/main/include/fsystem.h b/src/app/main/include/fsystem.h index 103ba8ae..dc5d804d 100644 --- a/src/app/main/include/fsystem.h +++ b/src/app/main/include/fsystem.h @@ -43,8 +43,8 @@ * @file fsystem.h * @author foxBMS Team * @date 2020-07-21 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup SYSTEM * @prefix FSYS * @@ -59,11 +59,23 @@ /*========== Macros and Definitions =========================================*/ -/* AXIVION Disable Style MisraC2012-1.2 MisraC2012Directive-4.1: Function is - * implemented in Assembler (see swiRaisePrivilege) and this is the way to tell - * it the TI compiler */ +/* AXIVION Disable Style Generic-DoxygenCommentInHeader: Function has a doxygen + * comment, but since the '#pragma' AXIVION does not detect it, we annotate it + */ +/* AXIVION Disable Style MisraC2012Directive-1.1: 'pragma' required to tell the + * TI ARM CGT compiler, that this is an interrupt function + * (see SPNU151V-January1998-RevisedFebruary2020: 5.11.29 The SWI_ALIAS Pragma) + */ +/* AXIVION Disable Style MisraC2012-1.2: Function is implemented in assembler + * and this is the way to tell it the TI compiler (see + * src\os\freertos\portable\ccs\arm_cortex-r5\portasm.asm::swiRaisePrivilege) + */ +/* AXIVION Disable Style MisraC2012-8.6: Function defintion is in assembler + * (see + * src\os\freertos\portable\ccs\arm_cortex-r5\portasm.asm::swiRaisePrivilege) + */ /** - * @brief raise privilege + * @brief Raise privilege * @details This alias is mapped to an ASM function and raises to a privileged * processor state if the system is currently in user mode. * This is done by the following ASM code: @@ -91,7 +103,7 @@ * * Target address is contained in r14 * \verbatim bx r14 \endverbatim * - * It is important to issue #FSYS_SwitchToUserMode() after the + * It is important to issue #FSYS_SWITCH_TO_USER_MODE() after the * privileged mode is no longer needed. Otherwise the system would * stay in privileged mode. * @@ -101,20 +113,23 @@ */ #pragma SWI_ALIAS(FSYS_RaisePrivilege, 1); extern long FSYS_RaisePrivilege(void); -/* AXIVION Enable Style MisraC2012-1.2 MisraC2012Directive-4.1: */ +/* AXIVION Enable Style MisraC2012-8.6: */ +/* AXIVION Enable Style MisraC2012-1.2: */ +/* AXIVION Enable Style MisraC2012Directive-1.1: */ +/* AXIVION Enable Style Generic-DoxygenCommentInHeader: */ /** - * @def FSYS_SwitchToUserMode() + * @def FSYS_SWITCH_TO_USER_MODE() * @brief Switch back to user mode * @details This macro is used after raising the privileges with * #FSYS_RaisePrivilege(). Failure to call this macro may lead to * unintended system behavior. */ #ifndef UNITY_UNIT_TEST -#define FSYS_SwitchToUserMode() \ +#define FSYS_SWITCH_TO_USER_MODE() \ { __asm(" CPS #0x10"); } #else -#define FSYS_SwitchToUserMode() +#define FSYS_SWITCH_TO_USER_MODE() #endif /*========== Extern Constant and Variable Declarations ======================*/ diff --git a/src/app/main/include/general.h b/src/app/main/include/general.h index 4f248a01..8744dfe4 100644 --- a/src/app/main/include/general.h +++ b/src/app/main/include/general.h @@ -43,10 +43,10 @@ * @file general.h * @author foxBMS Team * @date 2019-09-24 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup GENERAL_CONF - * @prefix NONE + * @prefix GEN * * @brief General macros and definitions for the whole platform. * @@ -70,13 +70,13 @@ * @param[in,out] register register on which to set the bit * @param[in] bit number of the bit that should be set to 1u */ -#define SETBIT(register, bit) ((register) |= (uint32)((uint32)1U << (bit))) +#define GEN_SET_BIT(register, bit) ((register) |= (uint32)((uint32)1U << (bit))) /** * @brief clears a bit to 0u * @param[in,out] register register on which to clear the bit * @param[in] bit number of the bit that should be cleared to 0u */ -#define CLEARBIT(register, bit) ((register) &= ~(uint32)((uint32)1U << (bit))) +#define GEN_CLEAR_BIT(register, bit) ((register) &= ~(uint32)((uint32)1U << (bit))) /** * @brief Allows functions to generate warnings in GCC for unused returns. @@ -85,10 +85,10 @@ * The compiler will generate a warning when the return value of a function * with this marker is not used in subsequent code. */ -#define must_check_return __attribute__((warn_unused_result)) +#define GEN_MUST_CHECK_RETURN __attribute__((warn_unused_result)) /** This attribute tells the compiler that the function should always be inlined */ -#define always_inline __attribute__((always_inline)) +#define GEN_ALWAYS_INLINE __attribute__((always_inline)) /** allow implementations to be weak for unit tests */ #ifdef UNITY_UNIT_TEST @@ -99,129 +99,130 @@ /* assert that the basic datatypes in fstd_types.h are intact */ /* AXIVION Disable Style MisraC2012-10.4: These assertions have to check the actual values of the enums and defines. */ -f_static_assert(false == 0, "false seems to have been modified."); -f_static_assert(true != false, "true seems to have been modified."); -f_static_assert(true == 1, "true seems to have been modified."); +FAS_STATIC_ASSERT(false == 0, "false seems to have been modified."); +FAS_STATIC_ASSERT(true != false, "true seems to have been modified."); +FAS_STATIC_ASSERT(true == 1, "true seems to have been modified."); -f_static_assert(STD_OK == 0, "STD_OK seems to have been modified."); -f_static_assert(STD_OK != STD_NOT_OK, "STD_OK or STD_NOT_OK seem to have been modified."); -f_static_assert(STD_NOT_OK == 1, "STD_NOT_OK seems to have been modified."); +FAS_STATIC_ASSERT(STD_OK == 0, "STD_OK seems to have been modified."); +FAS_STATIC_ASSERT(STD_OK != STD_NOT_OK, "STD_OK or STD_NOT_OK seem to have been modified."); +FAS_STATIC_ASSERT(STD_NOT_OK == 1, "STD_NOT_OK seems to have been modified."); /* AXIVION Enable Style MisraC2012-10.4: */ /** - * Internal macros for the implementation of #REPEAT_U(). Do not use outside. + * Internal macros for the implementation of #GEN_REPEAT_U(). Do not use outside. * @{ */ /* AXIVION Disable Style Generic-NoUnsafeMacro MisraC2012Directive-4.9: Due to the nature of these macros it is impossible to wrap the REPEAT_Uxu(x) token in parentheses. With these function-like Macros repeating a token is implemented. */ -#define REPEAT_U1u(x) (x) -#define REPEAT_U2u(x) REPEAT_U1u(x), (x) -#define REPEAT_U3u(x) REPEAT_U2u(x), (x) -#define REPEAT_U4u(x) REPEAT_U3u(x), (x) -#define REPEAT_U5u(x) REPEAT_U4u(x), (x) -#define REPEAT_U6u(x) REPEAT_U5u(x), (x) -#define REPEAT_U7u(x) REPEAT_U6u(x), (x) -#define REPEAT_U8u(x) REPEAT_U7u(x), (x) -#define REPEAT_U9u(x) REPEAT_U8u(x), (x) -#define REPEAT_U10u(x) REPEAT_U9u(x), (x) -#define REPEAT_U11u(x) REPEAT_U10u(x), (x) -#define REPEAT_U12u(x) REPEAT_U11u(x), (x) -#define REPEAT_U13u(x) REPEAT_U12u(x), (x) -#define REPEAT_U14u(x) REPEAT_U13u(x), (x) -#define REPEAT_U15u(x) REPEAT_U14u(x), (x) -#define REPEAT_U16u(x) REPEAT_U15u(x), (x) -#define REPEAT_U17u(x) REPEAT_U16u(x), (x) -#define REPEAT_U18u(x) REPEAT_U17u(x), (x) -#define REPEAT_U19u(x) REPEAT_U18u(x), (x) -#define REPEAT_U20u(x) REPEAT_U19u(x), (x) -#define REPEAT_U21u(x) REPEAT_U20u(x), (x) -#define REPEAT_U22u(x) REPEAT_U21u(x), (x) -#define REPEAT_U23u(x) REPEAT_U22u(x), (x) -#define REPEAT_U24u(x) REPEAT_U23u(x), (x) -#define REPEAT_U25u(x) REPEAT_U24u(x), (x) -#define REPEAT_U26u(x) REPEAT_U25u(x), (x) -#define REPEAT_U27u(x) REPEAT_U26u(x), (x) -#define REPEAT_U28u(x) REPEAT_U27u(x), (x) -#define REPEAT_U29u(x) REPEAT_U28u(x), (x) -#define REPEAT_U30u(x) REPEAT_U29u(x), (x) -#define REPEAT_U31u(x) REPEAT_U30u(x), (x) -#define REPEAT_U32u(x) REPEAT_U31u(x), (x) -#define REPEAT_U33u(x) REPEAT_U32u(x), (x) -#define REPEAT_U34u(x) REPEAT_U33u(x), (x) -#define REPEAT_U35u(x) REPEAT_U34u(x), (x) -#define REPEAT_U36u(x) REPEAT_U35u(x), (x) -#define REPEAT_U37u(x) REPEAT_U36u(x), (x) -#define REPEAT_U38u(x) REPEAT_U37u(x), (x) -#define REPEAT_U39u(x) REPEAT_U38u(x), (x) -#define REPEAT_U40u(x) REPEAT_U39u(x), (x) -#define REPEAT_U41u(x) REPEAT_U40u(x), (x) -#define REPEAT_U42u(x) REPEAT_U41u(x), (x) -#define REPEAT_U43u(x) REPEAT_U42u(x), (x) -#define REPEAT_U44u(x) REPEAT_U43u(x), (x) -#define REPEAT_U45u(x) REPEAT_U44u(x), (x) -#define REPEAT_U46u(x) REPEAT_U45u(x), (x) -#define REPEAT_U47u(x) REPEAT_U46u(x), (x) -#define REPEAT_U48u(x) REPEAT_U47u(x), (x) -#define REPEAT_U49u(x) REPEAT_U48u(x), (x) -#define REPEAT_U50u(x) REPEAT_U49u(x), (x) -#define REPEAT_U51u(x) REPEAT_U50u(x), (x) -#define REPEAT_U52u(x) REPEAT_U51u(x), (x) -#define REPEAT_U53u(x) REPEAT_U52u(x), (x) -#define REPEAT_U54u(x) REPEAT_U53u(x), (x) -#define REPEAT_U55u(x) REPEAT_U54u(x), (x) -#define REPEAT_U56u(x) REPEAT_U55u(x), (x) -#define REPEAT_U57u(x) REPEAT_U56u(x), (x) -#define REPEAT_U58u(x) REPEAT_U57u(x), (x) -#define REPEAT_U59u(x) REPEAT_U58u(x), (x) -#define REPEAT_U60u(x) REPEAT_U59u(x), (x) -#define REPEAT_U61u(x) REPEAT_U60u(x), (x) -#define REPEAT_U62u(x) REPEAT_U61u(x), (x) -#define REPEAT_U63u(x) REPEAT_U62u(x), (x) -#define REPEAT_U64u(x) REPEAT_U63u(x), (x) -#define REPEAT_U65u(x) REPEAT_U64u(x), (x) -#define REPEAT_U66u(x) REPEAT_U65u(x), (x) -#define REPEAT_U67u(x) REPEAT_U66u(x), (x) -#define REPEAT_U68u(x) REPEAT_U67u(x), (x) -#define REPEAT_U69u(x) REPEAT_U68u(x), (x) -#define REPEAT_U70u(x) REPEAT_U69u(x), (x) -#define REPEAT_U71u(x) REPEAT_U70u(x), (x) -#define REPEAT_U72u(x) REPEAT_U71u(x), (x) -#define REPEAT_U73u(x) REPEAT_U72u(x), (x) -#define REPEAT_U74u(x) REPEAT_U73u(x), (x) -#define REPEAT_U75u(x) REPEAT_U74u(x), (x) -#define REPEAT_U76u(x) REPEAT_U75u(x), (x) -#define REPEAT_U77u(x) REPEAT_U76u(x), (x) -#define REPEAT_U78u(x) REPEAT_U77u(x), (x) -#define REPEAT_U79u(x) REPEAT_U78u(x), (x) -#define REPEAT_U80u(x) REPEAT_U79u(x), (x) -#define REPEAT_U81u(x) REPEAT_U80u(x), (x) -#define REPEAT_U82u(x) REPEAT_U81u(x), (x) -#define REPEAT_U83u(x) REPEAT_U82u(x), (x) -#define REPEAT_U84u(x) REPEAT_U83u(x), (x) -#define REPEAT_U85u(x) REPEAT_U84u(x), (x) -#define REPEAT_U86u(x) REPEAT_U85u(x), (x) -#define REPEAT_U87u(x) REPEAT_U86u(x), (x) -#define REPEAT_U88u(x) REPEAT_U87u(x), (x) -#define REPEAT_U89u(x) REPEAT_U88u(x), (x) -#define REPEAT_U90u(x) REPEAT_U89u(x), (x) -#define REPEAT_U91u(x) REPEAT_U90u(x), (x) -#define REPEAT_U92u(x) REPEAT_U91u(x), (x) -#define REPEAT_U93u(x) REPEAT_U92u(x), (x) -#define REPEAT_U94u(x) REPEAT_U93u(x), (x) -#define REPEAT_U95u(x) REPEAT_U94u(x), (x) -#define REPEAT_U96u(x) REPEAT_U95u(x), (x) -#define REPEAT_U97u(x) REPEAT_U96u(x), (x) -#define REPEAT_U98u(x) REPEAT_U97u(x), (x) -#define REPEAT_U99u(x) REPEAT_U98u(x), (x) +/* us lowercase 'u' suffix to emphasize the unsignedness of the 'GEN_REPEAT_U*u' macros. */ +#define GEN_REPEAT_U1u(x) (x) +#define GEN_REPEAT_U2u(x) GEN_REPEAT_U1u(x), (x) +#define GEN_REPEAT_U3u(x) GEN_REPEAT_U2u(x), (x) +#define GEN_REPEAT_U4u(x) GEN_REPEAT_U3u(x), (x) +#define GEN_REPEAT_U5u(x) GEN_REPEAT_U4u(x), (x) +#define GEN_REPEAT_U6u(x) GEN_REPEAT_U5u(x), (x) +#define GEN_REPEAT_U7u(x) GEN_REPEAT_U6u(x), (x) +#define GEN_REPEAT_U8u(x) GEN_REPEAT_U7u(x), (x) +#define GEN_REPEAT_U9u(x) GEN_REPEAT_U8u(x), (x) +#define GEN_REPEAT_U10u(x) GEN_REPEAT_U9u(x), (x) +#define GEN_REPEAT_U11u(x) GEN_REPEAT_U10u(x), (x) +#define GEN_REPEAT_U12u(x) GEN_REPEAT_U11u(x), (x) +#define GEN_REPEAT_U13u(x) GEN_REPEAT_U12u(x), (x) +#define GEN_REPEAT_U14u(x) GEN_REPEAT_U13u(x), (x) +#define GEN_REPEAT_U15u(x) GEN_REPEAT_U14u(x), (x) +#define GEN_REPEAT_U16u(x) GEN_REPEAT_U15u(x), (x) +#define GEN_REPEAT_U17u(x) GEN_REPEAT_U16u(x), (x) +#define GEN_REPEAT_U18u(x) GEN_REPEAT_U17u(x), (x) +#define GEN_REPEAT_U19u(x) GEN_REPEAT_U18u(x), (x) +#define GEN_REPEAT_U20u(x) GEN_REPEAT_U19u(x), (x) +#define GEN_REPEAT_U21u(x) GEN_REPEAT_U20u(x), (x) +#define GEN_REPEAT_U22u(x) GEN_REPEAT_U21u(x), (x) +#define GEN_REPEAT_U23u(x) GEN_REPEAT_U22u(x), (x) +#define GEN_REPEAT_U24u(x) GEN_REPEAT_U23u(x), (x) +#define GEN_REPEAT_U25u(x) GEN_REPEAT_U24u(x), (x) +#define GEN_REPEAT_U26u(x) GEN_REPEAT_U25u(x), (x) +#define GEN_REPEAT_U27u(x) GEN_REPEAT_U26u(x), (x) +#define GEN_REPEAT_U28u(x) GEN_REPEAT_U27u(x), (x) +#define GEN_REPEAT_U29u(x) GEN_REPEAT_U28u(x), (x) +#define GEN_REPEAT_U30u(x) GEN_REPEAT_U29u(x), (x) +#define GEN_REPEAT_U31u(x) GEN_REPEAT_U30u(x), (x) +#define GEN_REPEAT_U32u(x) GEN_REPEAT_U31u(x), (x) +#define GEN_REPEAT_U33u(x) GEN_REPEAT_U32u(x), (x) +#define GEN_REPEAT_U34u(x) GEN_REPEAT_U33u(x), (x) +#define GEN_REPEAT_U35u(x) GEN_REPEAT_U34u(x), (x) +#define GEN_REPEAT_U36u(x) GEN_REPEAT_U35u(x), (x) +#define GEN_REPEAT_U37u(x) GEN_REPEAT_U36u(x), (x) +#define GEN_REPEAT_U38u(x) GEN_REPEAT_U37u(x), (x) +#define GEN_REPEAT_U39u(x) GEN_REPEAT_U38u(x), (x) +#define GEN_REPEAT_U40u(x) GEN_REPEAT_U39u(x), (x) +#define GEN_REPEAT_U41u(x) GEN_REPEAT_U40u(x), (x) +#define GEN_REPEAT_U42u(x) GEN_REPEAT_U41u(x), (x) +#define GEN_REPEAT_U43u(x) GEN_REPEAT_U42u(x), (x) +#define GEN_REPEAT_U44u(x) GEN_REPEAT_U43u(x), (x) +#define GEN_REPEAT_U45u(x) GEN_REPEAT_U44u(x), (x) +#define GEN_REPEAT_U46u(x) GEN_REPEAT_U45u(x), (x) +#define GEN_REPEAT_U47u(x) GEN_REPEAT_U46u(x), (x) +#define GEN_REPEAT_U48u(x) GEN_REPEAT_U47u(x), (x) +#define GEN_REPEAT_U49u(x) GEN_REPEAT_U48u(x), (x) +#define GEN_REPEAT_U50u(x) GEN_REPEAT_U49u(x), (x) +#define GEN_REPEAT_U51u(x) GEN_REPEAT_U50u(x), (x) +#define GEN_REPEAT_U52u(x) GEN_REPEAT_U51u(x), (x) +#define GEN_REPEAT_U53u(x) GEN_REPEAT_U52u(x), (x) +#define GEN_REPEAT_U54u(x) GEN_REPEAT_U53u(x), (x) +#define GEN_REPEAT_U55u(x) GEN_REPEAT_U54u(x), (x) +#define GEN_REPEAT_U56u(x) GEN_REPEAT_U55u(x), (x) +#define GEN_REPEAT_U57u(x) GEN_REPEAT_U56u(x), (x) +#define GEN_REPEAT_U58u(x) GEN_REPEAT_U57u(x), (x) +#define GEN_REPEAT_U59u(x) GEN_REPEAT_U58u(x), (x) +#define GEN_REPEAT_U60u(x) GEN_REPEAT_U59u(x), (x) +#define GEN_REPEAT_U61u(x) GEN_REPEAT_U60u(x), (x) +#define GEN_REPEAT_U62u(x) GEN_REPEAT_U61u(x), (x) +#define GEN_REPEAT_U63u(x) GEN_REPEAT_U62u(x), (x) +#define GEN_REPEAT_U64u(x) GEN_REPEAT_U63u(x), (x) +#define GEN_REPEAT_U65u(x) GEN_REPEAT_U64u(x), (x) +#define GEN_REPEAT_U66u(x) GEN_REPEAT_U65u(x), (x) +#define GEN_REPEAT_U67u(x) GEN_REPEAT_U66u(x), (x) +#define GEN_REPEAT_U68u(x) GEN_REPEAT_U67u(x), (x) +#define GEN_REPEAT_U69u(x) GEN_REPEAT_U68u(x), (x) +#define GEN_REPEAT_U70u(x) GEN_REPEAT_U69u(x), (x) +#define GEN_REPEAT_U71u(x) GEN_REPEAT_U70u(x), (x) +#define GEN_REPEAT_U72u(x) GEN_REPEAT_U71u(x), (x) +#define GEN_REPEAT_U73u(x) GEN_REPEAT_U72u(x), (x) +#define GEN_REPEAT_U74u(x) GEN_REPEAT_U73u(x), (x) +#define GEN_REPEAT_U75u(x) GEN_REPEAT_U74u(x), (x) +#define GEN_REPEAT_U76u(x) GEN_REPEAT_U75u(x), (x) +#define GEN_REPEAT_U77u(x) GEN_REPEAT_U76u(x), (x) +#define GEN_REPEAT_U78u(x) GEN_REPEAT_U77u(x), (x) +#define GEN_REPEAT_U79u(x) GEN_REPEAT_U78u(x), (x) +#define GEN_REPEAT_U80u(x) GEN_REPEAT_U79u(x), (x) +#define GEN_REPEAT_U81u(x) GEN_REPEAT_U80u(x), (x) +#define GEN_REPEAT_U82u(x) GEN_REPEAT_U81u(x), (x) +#define GEN_REPEAT_U83u(x) GEN_REPEAT_U82u(x), (x) +#define GEN_REPEAT_U84u(x) GEN_REPEAT_U83u(x), (x) +#define GEN_REPEAT_U85u(x) GEN_REPEAT_U84u(x), (x) +#define GEN_REPEAT_U86u(x) GEN_REPEAT_U85u(x), (x) +#define GEN_REPEAT_U87u(x) GEN_REPEAT_U86u(x), (x) +#define GEN_REPEAT_U88u(x) GEN_REPEAT_U87u(x), (x) +#define GEN_REPEAT_U89u(x) GEN_REPEAT_U88u(x), (x) +#define GEN_REPEAT_U90u(x) GEN_REPEAT_U89u(x), (x) +#define GEN_REPEAT_U91u(x) GEN_REPEAT_U90u(x), (x) +#define GEN_REPEAT_U92u(x) GEN_REPEAT_U91u(x), (x) +#define GEN_REPEAT_U93u(x) GEN_REPEAT_U92u(x), (x) +#define GEN_REPEAT_U94u(x) GEN_REPEAT_U93u(x), (x) +#define GEN_REPEAT_U95u(x) GEN_REPEAT_U94u(x), (x) +#define GEN_REPEAT_U96u(x) GEN_REPEAT_U95u(x), (x) +#define GEN_REPEAT_U97u(x) GEN_REPEAT_U96u(x), (x) +#define GEN_REPEAT_U98u(x) GEN_REPEAT_U97u(x), (x) +#define GEN_REPEAT_U99u(x) GEN_REPEAT_U98u(x), (x) /* AXIVION Disable Style MisraC2012-20.10: Usage allowed as long as remarks in documentation are honored. */ -#define REPEAT_Ux(x, n) REPEAT_U##n(x) +#define GEN_REPEAT_Ux(x, n) GEN_REPEAT_U##n(x) /* AXIVION Enable Style Generic-NoUnsafeMacro MisraC2012Directive-4.9 MisraC2012-20.10: */ /**@}*/ -/** Maximum number of supported repetitions in #REPEAT_U(). Adapt if you change implementation.*/ -#define REPEAT_MAXIMUM_REPETITIONS (99u) +/** Maximum number of supported repetitions in #GEN_REPEAT_U(). Adapt if you change implementation.*/ +#define GEN_REPEAT_MAXIMUM_REPETITIONS (99u) /** * @brief Macro that helps to generate a series of literals (for array initializers). @@ -232,45 +233,44 @@ f_static_assert(STD_NOT_OK == 1, "STD_NOT_OK seems to have been modified."); * * @param x token that should be repeated, e.g. true * @param n Times that it should be repeated (stripped of parenthesis with - * #STRIP() and described as unsigned integer literal) (maximum 16, - * #REPEAT_MAXIMUM_REPETITIONS, repetitions) + * #GEN_STRIP() and described as unsigned integer literal) (maximum 16, + * #GEN_REPEAT_MAXIMUM_REPETITIONS, repetitions) * * Example usage: \verbatim #define ARRAY_SIZE (4u) - bool variable[ARRAY_SIZE] = {REPEAT_U(false, STRIP(ARRAY_SIZE))}; + bool variable[ARRAY_SIZE] = {GEN_REPEAT_U(false, GEN_STRIP(ARRAY_SIZE))}; \endverbatim * This will expand to: \verbatim bool variable[ARRAY_SIZE] = {false, false, false, false}; \endverbatim */ -/* AXIVION Disable Style MisraC2012Directive-4.9: Function-like macro needed for this feature. */ -#define REPEAT_U(x, n) REPEAT_Ux(x, n) -/* AXIVION Enable Style MisraC2012Directive-4.9: */ +/* AXIVION Next Codeline Style MisraC2012Directive-4.9: Function-like macro needed for this feature. */ +#define GEN_REPEAT_U(x, n) GEN_REPEAT_Ux(x, n) -/** Internal helper macros for #STRIP(). Do not use outside. +/** Internal helper macros for #GEN_STRIP(). Do not use outside. * @{ */ -/* AXIVION Disable Style MisraC2012Directive-4.9 MisraC2012-20.7 Generic-NoUnsafeMacro: Function-like macro needed for - this feature. Parenthesis stripping is intended here. */ -#define GET_ARGS(...) __VA_ARGS__ -#define STRIP_PARENS(x) x +/* AXIVION Disable Style MisraC2012Directive-4.9 MisraC2012-20.7 Generic-NoUnsafeMacro CertC-PRE01: Function-like macro + needed for this feature. Parenthesis stripping is intended here. */ +#define GEN_GET_ARGS(...) __VA_ARGS__ +#define GEN_STRIP_PARENS(x) x /**@}*/ /** Strips a token of its surrounding parenthesis. */ -#define STRIP(x) STRIP_PARENS(GET_ARGS x) +#define GEN_STRIP(x) GEN_STRIP_PARENS(GEN_GET_ARGS x) /* AXIVION Enable Style MisraC2012Directive-4.9 MisraC2012-20.7 Generic-NoUnsafeMacro: */ /** Defines the word size in bytes of the platform */ #if defined(__TI_COMPILER_VERSION__) && defined(__ARM_32BIT_STATE) && defined(__TMS470__) -#define BYTES_PER_WORD (4u) +#define GEN_BYTES_PER_WORD (4u) #elif defined(UNITY_UNIT_TEST) /* since this define only affects the task size, it can be safely set in unit tests to the value that is used in the embedded platform */ -#define BYTES_PER_WORD (4u) +#define GEN_BYTES_PER_WORD (4u) #else #warning "Unspecified platform default to 4 bytes per word." -#define BYTES_PER_WORD (4u) +#define GEN_BYTES_PER_WORD (4u) #endif /*========== Extern Constant and Variable Declarations ======================*/ diff --git a/src/app/main/include/main.h b/src/app/main/include/main.h index 382a5510..8f622d66 100644 --- a/src/app/main/include/main.h +++ b/src/app/main/include/main.h @@ -43,8 +43,8 @@ * @file main.h * @author foxBMS Team * @date 2018-10-23 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup GENERAL * @prefix TODO * diff --git a/src/app/main/linker_script_elf.cmd b/src/app/main/linker_script_elf.cmd index 735de23b..641d8017 100644 --- a/src/app/main/linker_script_elf.cmd +++ b/src/app/main/linker_script_elf.cmd @@ -81,7 +81,7 @@ #define VFILL_FLASH_PATTERN (0xffffffff) -/* size of VERSION_INFORMATION (has to be large enough to accomodate the version struct) */ +/* size of VER_VERSION_INFORMATION (has to be large enough to accomodate the version struct) */ #define VERSION_INFORMATION_SIZE (0xC0) /* size of the VECTORS table */ @@ -121,7 +121,7 @@ #define KERNEL_DATA_SIZE (0x800) /* size of shared-RAM section for DMA */ -#define SHARED_RAM_SIZE (0x1000) +#define SHARED_RAM_SIZE (0x2000) /*========== Memory Layout ==================================================*/ MEMORY @@ -136,7 +136,7 @@ MEMORY FLASH (RX) : origin = end(KERNEL_FUNCTIONS) length = FLASH_SIZE vfill = VFILL_FLASH_PATTERN - VERSION_INFORMATION (RX) : origin = end(FLASH) + VER_VERSION_INFORMATION (RX) : origin = end(FLASH) length = VERSION_INFORMATION_SIZE vfill = VFILL_FLASH_PATTERN /* RAM */ @@ -160,7 +160,7 @@ MEMORY ECC = { input_range = FLASH } ECC_VERSION_INFORMATION (R) : origin = end(ECC_FLASH) length = ECC_VERSION_INFORMATION_SIZE - ECC = { input_range = VERSION_INFORMATION } + ECC = { input_range = VER_VERSION_INFORMATION } } /*========== ECC Algorithm Configuration ====================================*/ @@ -180,7 +180,7 @@ SECTIONS .kernelTEXT align(32) : {} > KERNEL_FUNCTIONS .cinit align(32) : {} > KERNEL_FUNCTIONS /* Rest of code to user mode flash region */ - .versionInformation align(32) : {} > VERSION_INFORMATION + .versionInformation align(32) : {} > VER_VERSION_INFORMATION .syscallTEXT align(32) : {} > FLASH .text align(32) : {} > FLASH .const align(32) : {} > FLASH diff --git a/src/app/main/linker_script_hex.cmd b/src/app/main/linker_script_hex.cmd index 8cf7753f..09a16a4d 100644 --- a/src/app/main/linker_script_hex.cmd +++ b/src/app/main/linker_script_hex.cmd @@ -1,30 +1,30 @@ -/* 5bdaa91787743532b42ae61d62dcef3d */ +/* 2111aab3769f0edeaaf370f2b19d9abb */ /* Aligned with names in "MEMORY" in the elf-linker script */ ROMS { /* FLASH */ - VECTORS_TABLE : origin = 0x00000000 - length = 0x20 - fill = 0xFFFFFFFF - KERNEL_FUNCTIONS : origin = 0x00000020 - length = 0x8000 - fill = 0xFFFFFFFF - FLASH : origin = 0x00008020 /*(0x00000000 + 0x20 + 0x8000)*/ - length = 0x3F7F20 - fill = 0xFFFFFFFF - VERSION_INFORMATION : origin = 0x003FFF40 /*(0x00000000 + 0x20 + 0x8000 + 0x3F7F20) */ - length = 0xC0 - fill = 0xFFFFFFFF + VECTORS_TABLE : origin = 0x00000000 + length = 0x20 + fill = 0xFFFFFFFF + KERNEL_FUNCTIONS : origin = 0x00000020 + length = 0x8000 + fill = 0xFFFFFFFF + FLASH : origin = 0x00008020 /*(0x00000000 + 0x20 + 0x8000)*/ + length = 0x3F7F20 + fill = 0xFFFFFFFF + VER_VERSION_INFORMATION : origin = 0x003FFF40 /*(0x00000000 + 0x20 + 0x8000 + 0x3F7F20) */ + length = 0xC0 + fill = 0xFFFFFFFF /* RAM */ - STACKS : origin = 0x08000000 - length = 0x800 - KERNEL_DATA : origin = 0x08000800 - length = 0x800 - RAM : origin = 0x08001000 - length = 0x7E000 - SHARED_RAM : origin = 0x0807F000 - length = 0x1000 + STACKS : origin = 0x08000000 + length = 0x800 + KERNEL_DATA : origin = 0x08000800 + length = 0x800 + RAM : origin = 0x08001000 + length = 0x7D000 + SHARED_RAM : origin = 0x0807E000 + length = 0x2000 ECC_VECTORS_TABLE : origin = 0xF0400000 length = 0x4 diff --git a/src/app/main/main.c b/src/app/main/main.c index ff946fca..f4591eba 100644 --- a/src/app/main/main.c +++ b/src/app/main/main.c @@ -43,8 +43,8 @@ * @file main.c * @author foxBMS Team * @date 2019-08-27 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup GENERAL * @prefix TODO * @@ -109,17 +109,14 @@ int main(void) { OS_InitializeOperatingSystem(); if (OS_INIT_PRE_OS != os_boot) { - while (true) { - /* Could not create Queues, Mutexes, Events and Tasks - do not boot further from this point on*/ - } + /* Could not create Queues, Mutexes, Events and Tasks do not boot further from this point on */ + FAS_ASSERT(FAS_TRAP); } if (STD_OK != CHK_ValidateChecksum()) { if (DIAG_HANDLER_RETURN_OK != DIAG_Handler(DIAG_ID_FLASHCHECKSUM, DIAG_EVENT_NOT_OK, DIAG_SYSTEM, 0u)) { - while (true) { - /* Could not validate checksum do not boot further from this point on */ - } + /* Could not validate checksum do not boot further from this point on */ + FAS_ASSERT(FAS_TRAP); } } @@ -127,7 +124,7 @@ int main(void) { OS_StartScheduler(); /* we must never get here; there is no way to determine the exit state of this program, - * but for the sake of correctness we exit with an errorcode */ + * but for the sake of correctness we exit with an error code */ return 1; } diff --git a/src/app/main/wscript b/src/app/main/wscript index eb181a08..ecca75d3 100644 --- a/src/app/main/wscript +++ b/src/app/main/wscript @@ -81,7 +81,7 @@ def build(bld): os.path.join("..", "task", "os"), os.path.join("..", "task", "config"), ] - includes.extend(bld.env.INCLUDES_OPERATING_SYSTEM + bld.env.INCLUDES_AFE) + includes.extend(bld.env.INCLUDES_RTOS + bld.env.INCLUDES_AFE) cflags = bld.env.CFLAGS_FOXBMS use = [ f"{bld.env.APPNAME.lower()}-application", diff --git a/src/app/task/config/ftask_cfg.c b/src/app/task/config/ftask_cfg.c index 4a8fd34d..60dbe6f0 100644 --- a/src/app/task/config/ftask_cfg.c +++ b/src/app/task/config/ftask_cfg.c @@ -43,8 +43,8 @@ * @file ftask_cfg.c * @author foxBMS Team * @date 2019-08-26 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup TASK_CONFIGURATION * @prefix FTSK * @@ -77,7 +77,7 @@ #include "pex.h" #include "redundancy.h" #include "sbc.h" -#include "sof.h" +#include "sof_trapezoid.h" #include "spi.h" #include "sps.h" #include "state_estimation.h" @@ -156,7 +156,9 @@ extern void FTSK_InitializeUserCodeEngine(void) { } /* Suspend AFE task if unused, otherwise it will preempt all lower priority tasks */ +#if (FOXBMS_AFE_DRIVER_TYPE_FSM == 1) vTaskSuspend(ftsk_taskHandleAfe); +#endif /* Init FRAM */ FRAM_Initialize(); @@ -219,7 +221,9 @@ extern void FTSK_RunUserCodeCyclic1ms(void) { OS_IncrementTimer(); DIAG_UpdateFlags(); /* user code */ +#if (FOXBMS_AFE_DRIVER_TYPE_FSM == 1) MEAS_Control(); +#endif CAN_ReadRxBuffer(); } @@ -277,6 +281,9 @@ extern void FTSK_RunUserCodeCyclicAlgorithm100ms(void) { void FTSK_RunUserCodeAfe(void) { /* user code */ +#if (FOXBMS_AFE_DRIVER_TYPE_NO_FSM == 1) + MEAS_Control(); +#endif } extern void FTSK_RunUserCodeIdle(void) { diff --git a/src/app/task/config/ftask_cfg.h b/src/app/task/config/ftask_cfg.h index 4af4b865..05523fb6 100644 --- a/src/app/task/config/ftask_cfg.h +++ b/src/app/task/config/ftask_cfg.h @@ -43,8 +43,8 @@ * @file ftask_cfg.h * @author foxBMS Team * @date 2019-08-26 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup TASK_CONFIGURATION * @prefix FTSK * @@ -279,8 +279,8 @@ extern void FTSK_RunUserCodeCyclicAlgorithm100ms(void); /** * @brief Continuously running task for AFEs - * @details Used to implement the communications with AFEs, - * for drivers that do not use a cyclic task. + * @details Implements the communications with AFEs, without + * statemachine. * @ingroup API_OS */ extern void FTSK_RunUserCodeAfe(void); diff --git a/src/app/task/ftask/freertos/ftask_freertos.c b/src/app/task/ftask/freertos/ftask_freertos.c index 79205455..26d7ec7b 100644 --- a/src/app/task/ftask/freertos/ftask_freertos.c +++ b/src/app/task/ftask/freertos/ftask_freertos.c @@ -43,8 +43,8 @@ * @file ftask_freertos.c * @author foxBMS Team * @date 2019-08-27 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup TASK * @prefix FTSK * @@ -63,7 +63,7 @@ /*========== Macros and Definitions =========================================*/ /** helper macro to translate the stack sizes from bytes into words as FreeRTOS requires words and not bytes */ -#define FTSK_BYTES_TO_WORDS(VARIABALE_IN_BYTES) ((VARIABALE_IN_BYTES) / BYTES_PER_WORD) +#define FTSK_BYTES_TO_WORDS(VARIABALE_IN_BYTES) ((VARIABALE_IN_BYTES) / GEN_BYTES_PER_WORD) /** Stack size of engine task in words */ #define FTSK_TASK_ENGINE_STACK_SIZE_IN_WORDS FTSK_BYTES_TO_WORDS(FTSK_TASK_ENGINE_STACK_SIZE_IN_BYTES) /** @brief Stack size of cyclic 1 ms task in words */ @@ -90,6 +90,7 @@ /*========== Static Constant and Variable Definitions =======================*/ /*========== Extern Constant and Variable Definitions =======================*/ +/** @brief Definition of task handle for the AFE task */ TaskHandle_t ftsk_taskHandleAfe; volatile bool ftsk_allQueuesCreated = false; diff --git a/src/app/task/ftask/ftask.c b/src/app/task/ftask/ftask.c index b5218de3..8915ddfa 100644 --- a/src/app/task/ftask/ftask.c +++ b/src/app/task/ftask/ftask.c @@ -43,8 +43,8 @@ * @file ftask.c * @author foxBMS Team * @date 2019-08-27 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup TASK * @prefix FTSK * @@ -68,7 +68,7 @@ /*========== Static Function Implementations ================================*/ /*========== Extern Function Implementations ================================*/ -/* AXIVION Next Line Style MisraC2012Directive-1.1 MisraC2012-1.2 FaultDetection-DeadBranches: tell the CCS compiler +/* AXIVION Next Codeline Style MisraC2012Directive-1.1 MisraC2012-1.2 FaultDetection-DeadBranches: tell the CCS compiler * that this function is a task, context save not necessary */ #pragma TASK(FTSK_CreateTaskEngine) extern void FTSK_CreateTaskEngine(void *const pvParameters) { @@ -78,19 +78,19 @@ extern void FTSK_CreateTaskEngine(void *const pvParameters) { FTSK_InitializeUserCodeEngine(); os_boot = OS_ENGINE_RUNNING; - /* AXIVION Next Line Style MisraC2012-2.2 FaultDetection-DeadBranches: FreeRTOS task setup requires an infinite + /* AXIVION Next Codeline Style MisraC2012-2.2 FaultDetection-DeadBranches: FreeRTOS task setup requires an infinite * loop for the user code (see www.freertos.org/a00125.html)*/ while (true) { /* notify system monitoring that task will be called */ SYSM_Notify(SYSM_TASK_ID_ENGINE, SYSM_NOTIFY_ENTER, OS_GetTickCount()); - /* user code implemention */ + /* user code implementation */ FTSK_RunUserCodeEngine(); /* notify system monitoring that task has been called */ SYSM_Notify(SYSM_TASK_ID_ENGINE, SYSM_NOTIFY_EXIT, OS_GetTickCount()); } } -/* AXIVION Next Line Style MisraC2012Directive-1.1 MisraC2012-1.2 FaultDetection-DeadBranches: tell the CCS compiler +/* AXIVION Next Codeline Style MisraC2012Directive-1.1 MisraC2012-1.2 FaultDetection-DeadBranches: tell the CCS compiler * that this function is a task, context save not necessary */ #pragma TASK(FTSK_CreateTaskCyclic1ms) extern void FTSK_CreateTaskCyclic1ms(void *const pvParameters) { @@ -98,16 +98,17 @@ extern void FTSK_CreateTaskCyclic1ms(void *const pvParameters) { OS_MarkTaskAsRequiringFpuContext(); uint32_t currentTimeCreateTaskCyclic1ms = 0; + /* AXIVION Next Codeline Style Generic-NoEmptyLoops: start cyclic 1ms task only when engine task is running */ while (os_boot != OS_ENGINE_RUNNING) { } FTSK_InitializeUserCodePreCyclicTasks(); - os_boot = OS_PRECYCLIC_INIT_HAS_FINISHED; + os_boot = OS_PRE_CYCLIC_INITIALIZATION_HAS_FINISHED; /* cycle time (1ms) equals the minimum tick time (1ms), * therefore it is not possible to configure a phase for this task */ currentTimeCreateTaskCyclic1ms = OS_GetTickCount(); - /* AXIVION Next Line Style MisraC2012-2.2 FaultDetection-DeadBranches: FreeRTOS task setup requires an infinite + /* AXIVION Next Codeline Style MisraC2012-2.2 FaultDetection-DeadBranches: FreeRTOS task setup requires an infinite * loop for the user code (see www.freertos.org/a00125.html)*/ while (true) { /* notify system monitoring that task will be called */ @@ -121,20 +122,22 @@ extern void FTSK_CreateTaskCyclic1ms(void *const pvParameters) { } } -/* AXIVION Next Line Style MisraC2012Directive-1.1 MisraC2012-1.2 FaultDetection-DeadBranches: tell the CCS compiler - * that this function is a task, context save not necessary */ +/* AXIVION Next Codeline Style MisraC2012Directive-1.1 MisraC2012-1.2 FaultDetection-DeadBranches: tell the CCS + compiler that this function is a task, context save not necessary */ #pragma TASK(FTSK_CreateTaskCyclic10ms) extern void FTSK_CreateTaskCyclic10ms(void *const pvParameters) { FAS_ASSERT(pvParameters == NULL_PTR); OS_MarkTaskAsRequiringFpuContext(); uint32_t currentTimeCreateTaskCyclic10ms = 0; - while (os_boot != OS_PRECYCLIC_INIT_HAS_FINISHED) { + /* AXIVION Next Codeline Style Generic-NoEmptyLoops: wait until the 1ms cyclic task setup has finished the + pre-cyclic initialization sequence */ + while (os_boot != OS_PRE_CYCLIC_INITIALIZATION_HAS_FINISHED) { } OS_DelayTaskUntil(&os_schedulerStartTime, ftsk_taskDefinitionCyclic10ms.phase); currentTimeCreateTaskCyclic10ms = OS_GetTickCount(); - /* AXIVION Next Line Style MisraC2012-2.2 FaultDetection-DeadBranches: FreeRTOS task setup requires an infinite + /* AXIVION Next Codeline Style MisraC2012-2.2 FaultDetection-DeadBranches: FreeRTOS task setup requires an infinite * loop for the user code (see www.freertos.org/a00125.html)*/ while (true) { /* notify system monitoring that task will be called */ @@ -148,20 +151,22 @@ extern void FTSK_CreateTaskCyclic10ms(void *const pvParameters) { } } -/* AXIVION Next Line Style MisraC2012Directive-1.1 MisraC2012-1.2 FaultDetection-DeadBranches: tell the CCS compiler - * that this function is a task, context save not necessary */ +/* AXIVION Next Codeline Style MisraC2012Directive-1.1 MisraC2012-1.2 FaultDetection-DeadBranches: tell the CCS + compiler that this function is a task, context save not necessary */ #pragma TASK(FTSK_CreateTaskCyclic100ms) extern void FTSK_CreateTaskCyclic100ms(void *const pvParameters) { FAS_ASSERT(pvParameters == NULL_PTR); OS_MarkTaskAsRequiringFpuContext(); uint32_t currentTimeCreateTaskCyclic100ms = 0; - while (os_boot != OS_PRECYCLIC_INIT_HAS_FINISHED) { + /* AXIVION Next Codeline Style Generic-NoEmptyLoops: wait until the 1ms cyclic task setup has finished the + pre-cyclic initialization sequence */ + while (os_boot != OS_PRE_CYCLIC_INITIALIZATION_HAS_FINISHED) { } OS_DelayTaskUntil(&os_schedulerStartTime, ftsk_taskDefinitionCyclic100ms.phase); currentTimeCreateTaskCyclic100ms = OS_GetTickCount(); - /* AXIVION Next Line Style MisraC2012-2.2 FaultDetection-DeadBranches: FreeRTOS task setup requires an infinite + /* AXIVION Next Codeline Style MisraC2012-2.2 FaultDetection-DeadBranches: FreeRTOS task setup requires an infinite * loop for the user code (see www.freertos.org/a00125.html)*/ while (true) { /* notify system monitoring that task will be called */ @@ -175,21 +180,23 @@ extern void FTSK_CreateTaskCyclic100ms(void *const pvParameters) { } } -/* AXIVION Next Line Style MisraC2012Directive-1.1 MisraC2012-1.2 FaultDetection-DeadBranches: tell the CCS compiler - * that this function is a task, context save not necessary */ +/* AXIVION Next Codeline Style MisraC2012Directive-1.1 MisraC2012-1.2 FaultDetection-DeadBranches: tell the CCS + compiler that this function is a task, context save not necessary */ #pragma TASK(FTSK_CreateTaskCyclicAlgorithm100ms) extern void FTSK_CreateTaskCyclicAlgorithm100ms(void *const pvParameters) { FAS_ASSERT(pvParameters == NULL_PTR); OS_MarkTaskAsRequiringFpuContext(); uint32_t currentTimeCreateTaskCyclicAlgorithms100ms = 0; - while (os_boot != OS_PRECYCLIC_INIT_HAS_FINISHED) { + /* AXIVION Next Codeline Style Generic-NoEmptyLoops: wait until the 1ms cyclic task setup has finished the + pre-cyclic initialization sequence */ + while (os_boot != OS_PRE_CYCLIC_INITIALIZATION_HAS_FINISHED) { } OS_DelayTaskUntil(&os_schedulerStartTime, ftsk_taskDefinitionCyclicAlgorithm100ms.phase); os_boot = OS_SYSTEM_RUNNING; currentTimeCreateTaskCyclicAlgorithms100ms = OS_GetTickCount(); - /* AXIVION Next Line Style MisraC2012-2.2 FaultDetection-DeadBranches: FreeRTOS task setup requires an infinite + /* AXIVION Next Codeline Style MisraC2012-2.2 FaultDetection-DeadBranches: FreeRTOS task setup requires an infinite * loop for the user code (see www.freertos.org/a00125.html)*/ while (true) { /* notify system monitoring that task will be called */ @@ -204,17 +211,19 @@ extern void FTSK_CreateTaskCyclicAlgorithm100ms(void *const pvParameters) { } } -/* AXIVION Next Line Style MisraC2012Directive-1.1 MisraC2012-1.2 FaultDetection-DeadBranches: tell the CCS compiler - * tell compiler this function is a task, context save not necessary */ +/* AXIVION Next Codeline Style MisraC2012Directive-1.1 MisraC2012-1.2 FaultDetection-DeadBranches: tell the CCS + compiler tell compiler this function is a task, context save not necessary */ #pragma TASK(FTSK_CreateTaskAfe) extern void FTSK_CreateTaskAfe(void *const pvParameters) { FAS_ASSERT(pvParameters == NULL_PTR); OS_MarkTaskAsRequiringFpuContext(); - while (os_boot != OS_PRECYCLIC_INIT_HAS_FINISHED) { + /* AXIVION Next Codeline Style Generic-NoEmptyLoops: wait until the 1ms cyclic task setup has finished the + pre-cyclic initialization sequence */ + while (os_boot != OS_PRE_CYCLIC_INITIALIZATION_HAS_FINISHED) { } - /* AXIVION Next Line Style MisraC2012-2.2 FaultDetection-DeadBranches: FreeRTOS task setup requires an infinite + /* AXIVION Next Codeline Style MisraC2012-2.2 FaultDetection-DeadBranches: FreeRTOS task setup requires an infinite * loop for the user code (see www.freertos.org/a00125.html)*/ while (true) { /* user code implementation */ diff --git a/src/app/task/ftask/ftask.h b/src/app/task/ftask/ftask.h index 4ef0fcce..6717ab70 100644 --- a/src/app/task/ftask/ftask.h +++ b/src/app/task/ftask/ftask.h @@ -43,8 +43,8 @@ * @file ftask.h * @author foxBMS Team * @date 2019-08-27 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup TASK * @prefix FTSK * diff --git a/src/app/task/os/freertos/os_freertos.c b/src/app/task/os/freertos/os_freertos.c index ffa4840e..1745c1f0 100644 --- a/src/app/task/os/freertos/os_freertos.c +++ b/src/app/task/os/freertos/os_freertos.c @@ -43,8 +43,8 @@ * @file os_freertos.c * @author foxBMS Team * @date 2021-11-18 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup OS * @prefix OS * diff --git a/src/app/task/os/freertos/os_freertos_config-validation.h b/src/app/task/os/freertos/os_freertos_config-validation.h index ee4602ff..aa0e3196 100644 --- a/src/app/task/os/freertos/os_freertos_config-validation.h +++ b/src/app/task/os/freertos/os_freertos_config-validation.h @@ -43,8 +43,8 @@ * @file os_freertos_config-validation.h * @author foxBMS Team * @date 2019-08-27 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup OS * @prefix OS * @@ -74,22 +74,24 @@ "foxBMS requires using FreeRTOS 'xTaskGetSchedulerState' therefore 'INCLUDE_xTaskGetSchedulerState' must be defined to '1'." #endif /* INCLUDE_xTaskGetSchedulerState */ -f_static_assert( - (configMINIMAL_STACK_SIZE * BYTES_PER_WORD) < (StackType_t)FTSK_TASK_ENGINE_STACK_SIZE_IN_BYTES, +FAS_STATIC_ASSERT( + (configMINIMAL_STACK_SIZE * GEN_BYTES_PER_WORD) < (StackType_t)FTSK_TASK_ENGINE_STACK_SIZE_IN_BYTES, "Size of the 'Engine' task is too small."); -f_static_assert( - (configMINIMAL_STACK_SIZE * BYTES_PER_WORD) < (StackType_t)FTSK_TASK_CYCLIC_1MS_STACK_SIZE_IN_BYTES, +FAS_STATIC_ASSERT( + (configMINIMAL_STACK_SIZE * GEN_BYTES_PER_WORD) < (StackType_t)FTSK_TASK_CYCLIC_1MS_STACK_SIZE_IN_BYTES, "Size of the '1ms cyclic' task is too small."); -f_static_assert( - (configMINIMAL_STACK_SIZE * BYTES_PER_WORD) < (StackType_t)FTSK_TASK_CYCLIC_10MS_STACK_SIZE_IN_BYTES, +FAS_STATIC_ASSERT( + (configMINIMAL_STACK_SIZE * GEN_BYTES_PER_WORD) < (StackType_t)FTSK_TASK_CYCLIC_10MS_STACK_SIZE_IN_BYTES, "Size of the '10ms cyclic' task is too small."); -f_static_assert( - (configMINIMAL_STACK_SIZE * BYTES_PER_WORD) < (StackType_t)FTSK_TASK_CYCLIC_100MS_STACK_SIZE_IN_BYTES, +FAS_STATIC_ASSERT( + (configMINIMAL_STACK_SIZE * GEN_BYTES_PER_WORD) < (StackType_t)FTSK_TASK_CYCLIC_100MS_STACK_SIZE_IN_BYTES, "Size of the '100ms cyclic' task is too small."); -f_static_assert( - (configMINIMAL_STACK_SIZE * BYTES_PER_WORD) < (StackType_t)FTSK_TASK_CYCLIC_ALGORITHM_100MS_STACK_SIZE_IN_BYTES, +FAS_STATIC_ASSERT( + (configMINIMAL_STACK_SIZE * GEN_BYTES_PER_WORD) < (StackType_t)FTSK_TASK_CYCLIC_ALGORITHM_100MS_STACK_SIZE_IN_BYTES, "Size of the '100ms cyclic algorithm' task is too small."); -f_static_assert((sizeof(StackType_t) == sizeof(uint32_t)), "Assumptions on the size of StackType_t have been broken."); +FAS_STATIC_ASSERT( + (sizeof(StackType_t) == sizeof(uint32_t)), + "Assumptions on the size of StackType_t have been broken."); /*========== Extern Constant and Variable Declarations ======================*/ diff --git a/src/app/task/os/os.c b/src/app/task/os/os.c index bd4f5c12..13b1f08e 100644 --- a/src/app/task/os/os.c +++ b/src/app/task/os/os.c @@ -43,8 +43,8 @@ * @file os.c * @author foxBMS Team * @date 2019-08-27 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup OS * @prefix OS * @@ -114,17 +114,17 @@ extern void OS_IncrementTimer(void) { } /* AXIVION Enable Style Generic-MaxNesting: */ -/* AXIVION Next Line Style Generic-MissingParameterAssert: The function is designed and tested for full range */ +/* AXIVION Next Codeline Style Generic-MissingParameterAssert: The function is designed and tested for full range */ extern bool OS_CheckTimeHasPassedWithTimestamp( uint32_t oldTimeStamp_ms, uint32_t currentTimeStamp_ms, uint32_t timeToPass_ms) { - /* AXIVION Next Line Style MisraC2012Directive-4.1: correct handling of underflows is checked with unit tests */ + /* AXIVION Next Codeline Style MisraC2012Directive-4.1: correct handling of underflows is checked with unit tests */ const uint32_t timeDifference_ms = currentTimeStamp_ms - oldTimeStamp_ms; - bool timehasPassed = false; + bool timeHasPassed = false; if (timeToPass_ms == 0u) { - timehasPassed = true; + timeHasPassed = true; } else if (timeDifference_ms == 0u) { /* case timeToPass_ms is 0u has already been extracted therefore, only the cases where full UINT32_MAX time has passed @@ -132,15 +132,15 @@ extern bool OS_CheckTimeHasPassedWithTimestamp( passed between these two timestamps and will therefore return false. */ } else if (timeDifference_ms >= timeToPass_ms) { - timehasPassed = true; + timeHasPassed = true; } else { - /* timehasPassed is already false, nothing to do */ + /* timeHasPassed is already false, nothing to do */ } - return timehasPassed; + return timeHasPassed; } -/* AXIVION Next Line Style Generic-MissingParameterAssert: The function is designed and tested for full range */ +/* AXIVION Next Codeline Style Generic-MissingParameterAssert: The function is designed and tested for full range */ extern bool OS_CheckTimeHasPassed(uint32_t oldTimeStamp_ms, uint32_t timeToPass_ms) { return OS_CheckTimeHasPassedWithTimestamp(oldTimeStamp_ms, OS_GetTickCount(), timeToPass_ms); } @@ -148,24 +148,28 @@ extern bool OS_CheckTimeHasPassed(uint32_t oldTimeStamp_ms, uint32_t timeToPass_ extern STD_RETURN_TYPE_e OS_CheckTimeHasPassedSelfTest(void) { STD_RETURN_TYPE_e selfCheckReturnValue = STD_OK; - /* AXIVION Next Line Style MisraC2012-2.2 MisraC2012-14.3: If the code works as expected, this self test function is expected to always return the same value */ + /* AXIVION Next Codeline Style MisraC2012-2.2 MisraC2012-14.3: If the code works as expected, this self test + function is expected to always return the same value */ if (OS_CheckTimeHasPassedWithTimestamp(0u, 0u, 0u) != true) { /* AXIVION Next Line Style FaultDetection-UnusedAssignments: All cases collected, using each not necessary. */ selfCheckReturnValue = STD_NOT_OK; } if (OS_CheckTimeHasPassedWithTimestamp(0u, 1u, 1u) != true) { - /* AXIVION Next Line Style FaultDetection-UnusedAssignments: All cases collected, using each not necessary. */ + /* AXIVION Next Codeline Style FaultDetection-UnusedAssignments: All cases collected, using each not + necessary. */ selfCheckReturnValue = STD_NOT_OK; } if (OS_CheckTimeHasPassedWithTimestamp(1u, 2u, 2u) != false) { - /* AXIVION Next Line Style FaultDetection-UnusedAssignments: All cases collected, using each not necessary. */ + /* AXIVION Next Codeline Style FaultDetection-UnusedAssignments: All cases collected, using each not + necessary. */ selfCheckReturnValue = STD_NOT_OK; } if (OS_CheckTimeHasPassedWithTimestamp(0u, 1u, 0u) != true) { - /* AXIVION Next Line Style FaultDetection-UnusedAssignments: All cases collected, using each not necessary. */ + /* AXIVION Next Codeline Style FaultDetection-UnusedAssignments: All cases collected, using each not + necessary. */ selfCheckReturnValue = STD_NOT_OK; } diff --git a/src/app/task/os/os.h b/src/app/task/os/os.h index 27a41cd7..16f87b5d 100644 --- a/src/app/task/os/os.h +++ b/src/app/task/os/os.h @@ -43,8 +43,8 @@ * @file os.h * @author foxBMS Team * @date 2019-08-27 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup OS * @prefix OS * @@ -98,18 +98,18 @@ typedef enum { /** @brief enum of OS boot states */ typedef enum { - OS_OFF, /**< system is off */ - OS_INITIALIZE_SCHEDULER, /**< state right before initalizing the scheduler */ - OS_CREATE_QUEUES, /**< state right before queues are created */ - OS_CREATE_TASKS, /**< state right before tasks are created */ - OS_INIT_PRE_OS, /**< state right after tasks are created */ - OS_SCHEDULER_RUNNING, /**< scheduler is running */ - OS_ENGINE_RUNNING, /**< state right after scheduler is started and engine is initalized */ - OS_PRECYCLIC_INIT_HAS_FINISHED, /**< state after the precyclic init has finished */ - OS_SYSTEM_RUNNING, /**< system is running */ - OS_INIT_OS_FATALERROR_SCHEDULER, /**< error in scheduler */ - OS_INIT_OS_FATALERROR, /**< fatal error */ - OS_BOOT_STATE_MAX, /**< DO NOT CHANGE, MUST BE THE LAST ENTRY */ + OS_OFF, /**< system is off */ + OS_INITIALIZE_SCHEDULER, /**< state right before initializing the scheduler */ + OS_CREATE_QUEUES, /**< state right before queues are created */ + OS_CREATE_TASKS, /**< state right before tasks are created */ + OS_INIT_PRE_OS, /**< state right after tasks are created */ + OS_SCHEDULER_RUNNING, /**< scheduler is running */ + OS_ENGINE_RUNNING, /**< state right after scheduler is started and engine is initalized */ + OS_PRE_CYCLIC_INITIALIZATION_HAS_FINISHED, /**< state after the pre-cyclic init has finished */ + OS_SYSTEM_RUNNING, /**< system is running */ + OS_INIT_OS_FATALERROR_SCHEDULER, /**< error in scheduler */ + OS_INIT_OS_FATALERROR, /**< fatal error */ + OS_BOOT_STATE_MAX, /**< DO NOT CHANGE, MUST BE THE LAST ENTRY */ } OS_BOOT_STATE_e; /** @brief OS timer */ @@ -164,7 +164,7 @@ extern void OS_InitializeOperatingSystem(void); * @details This is necessary for the combination of * configSUPPORT_STATIC_ALLOCATION and configUSE_TIMERS. * This is an FreeRTOS function an does not adhere to foxBMS function - * naming convetions. + * naming conventions. * @param ppxTimerTaskTCBBuffer TODO * @param ppxTimerTaskStackBuffer TODO * @param pulTimerTaskStackSize TODO @@ -178,7 +178,7 @@ extern void vApplicationGetTimerTaskMemory( /** * @brief Hook function for the idle task * @details This is an FreeRTOS function an does not adhere to foxBMS function - * naming convetions + * naming conventions */ extern void vApplicationIdleHook(void); @@ -226,12 +226,6 @@ extern uint32_t OS_GetTickCount(void); */ extern void OS_DelayTaskUntil(uint32_t *pPreviousWakeTime, uint32_t milliseconds); -/** - * @brief Handles the tick increment of operating systick timer - * @details TODO - */ -extern void OS_SystemTickHandler(void); - /** * @brief Marks the current task as requiring FPU context * @details In order to avoid corruption of the registers of the floating @@ -247,7 +241,7 @@ extern void OS_MarkTaskAsRequiringFpuContext(void); /** * @brief Receive an item from a queue - * @details This function needs to implement the wrapper to OS specfic queue + * @details This function needs to implement the wrapper to OS specific queue * posting. * The queue needs to be implement in a FreeRTOS compatible way. * This function must not be called from within an interrupt service @@ -264,7 +258,7 @@ extern OS_STD_RETURN_e OS_ReceiveFromQueue(OS_QUEUE xQueue, void *const pvBuffer /** * @brief Post an item to the back the provided queue - * @details This function needs to implement the wrapper to OS specfic queue + * @details This function needs to implement the wrapper to OS specific queue * posting. * The queue needs to be implement in a FreeRTOS compatible way. * @param xQueue FreeRTOS compatible queue handle that should be @@ -277,7 +271,7 @@ extern OS_STD_RETURN_e OS_SendToBackOfQueue(OS_QUEUE xQueue, const void *const p /** * @brief Post an item to the back the provided queue during an ISR - * @details This function needs to implement the wrapper to OS specfic queue + * @details This function needs to implement the wrapper to OS specific queue * posting. * @param xQueue queue handle that should be posted to. * @param pvItemToQueue Pointer to the item to be posted in the @@ -296,7 +290,7 @@ extern OS_STD_RETURN_e OS_SendToBackOfQueueFromIsr( /** * @brief Check if messages are waiting for queue - * @details This function needs to implement the wrapper to OS specfic queue + * @details This function needs to implement the wrapper to OS specific queue * posting. * @param xQueue queue handle that should be posted to. * @return number of message currently stored in xQueue @@ -307,7 +301,7 @@ extern uint32_t OS_GetNumberOfStoredMessagesInQueue(OS_QUEUE xQueue); * @brief This function checks if timeToPass has passed since the last timestamp to now * @details This function retrieves the current time stamp with #OS_GetTickCount(), * compares it to the oldTimestamp_ms and checks if more or equal of - * timetoPass_ms timer increments have passed. + * timeToPass_ms timer increments have passed. * @param[in] oldTimeStamp_ms timestamp that shall be compared to the current time in ms * @param[in] timeToPass_ms timer increments (in ms) that shall pass between oldTimeStamp_ms and now * @returns true in the case that more than timeToPass_ms timer increments have passed, otherwise false @@ -318,7 +312,7 @@ extern bool OS_CheckTimeHasPassed(uint32_t oldTimeStamp_ms, uint32_t timeToPass_ * @brief This function checks if timeToPass has passed since the last timestamp to now * @details This function is passed the current time stamp as argument currentTimeStamp_ms, * compares it to the oldTimestamp_ms and checks if more or equal of - * timetoPass_ms timer increments have passed. + * timeToPass_ms timer increments have passed. * @param[in] oldTimeStamp_ms timestamp that shall be compared to the current time in ms * @param[in] currentTimeStamp_ms timestamp of the current time in ms * @param[in] timeToPass_ms timer increments (in ms) that shall pass between oldTimeStamp_ms and now diff --git a/src/app/task/wscript b/src/app/task/wscript index 1ee76da6..9a037d85 100644 --- a/src/app/task/wscript +++ b/src/app/task/wscript @@ -49,7 +49,7 @@ import os def build(bld): """builds the task library""" - os_name = bld.env.OPERATING_SYSTEM_NAME[0] + os_name = bld.env.RTOS_NAME[0] source = [ os.path.join("config", "ftask_cfg.c"), os.path.join("ftask", "ftask.c"), @@ -104,7 +104,7 @@ def build(bld): os.path.join("..", "engine", "sys"), os.path.join("..", "main", "include"), ] - includes.extend(bld.env.INCLUDES_OPERATING_SYSTEM + bld.env.INCLUDES_AFE) + includes.extend(bld.env.INCLUDES_RTOS + bld.env.INCLUDES_AFE) cflags = bld.env.CFLAGS_FOXBMS target = f"{bld.env.APPNAME.lower()}-task" @@ -120,16 +120,18 @@ def build(bld): config_source = bld.path.find_or_declare(f"{os_name.lower()}-config-test.c") config_source.parent.mkdir() config_source.write(c_fragment, encoding="utf-8") - config_includes = bld.env.INCLUDES_OPERATING_SYSTEM + [ + config_includes = bld.env.INCLUDES_RTOS + [ "os", os.path.join("..", "driver", "mcu"), os.path.join("..", "main", "include"), os.path.join("config"), os.path.join("os", "freertos"), ] + # this file is only built once, therefore we force id=1 on this build bld.objects( source=[config_source], includes=config_includes, cflags=cflags, target=f"{os_name.lower()}-config-test", + idx=1, ) diff --git a/src/doxygen_src.h b/src/doxygen_src.h index 8ec8ccd6..a325d00a 100644 --- a/src/doxygen_src.h +++ b/src/doxygen_src.h @@ -43,8 +43,8 @@ * @file doxygen_src.h * @author foxBMS Team * @date 2019-06-02 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup DOXYGEN * @prefix DX * diff --git a/src/opt/cells/config/lg_inr18650mj1.c b/src/opt/cells/config/lg_inr18650mj1.c index 9702eb0d..dc25eae6 100644 --- a/src/opt/cells/config/lg_inr18650mj1.c +++ b/src/opt/cells/config/lg_inr18650mj1.c @@ -43,8 +43,8 @@ * @file lg_inr18650mj1.c * @author foxBMS Team * @date 2017-11-07 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup BATTERY_CELL_CONF * @prefix BC * diff --git a/src/opt/cells/config/lg_inr18650mj1.h b/src/opt/cells/config/lg_inr18650mj1.h index 08dcafac..d1bc6d58 100644 --- a/src/opt/cells/config/lg_inr18650mj1.h +++ b/src/opt/cells/config/lg_inr18650mj1.h @@ -43,8 +43,8 @@ * @file lg_inr18650mj1.h * @author foxBMS Team * @date 2017-11-07 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup BATTERY_CELL_CONF * @prefix BC * diff --git a/src/opt/cells/config/pana_ncr18650bd.h b/src/opt/cells/config/pana_ncr18650bd.h index d2d96ba8..911d9019 100644 --- a/src/opt/cells/config/pana_ncr18650bd.h +++ b/src/opt/cells/config/pana_ncr18650bd.h @@ -43,8 +43,8 @@ * @file pana_ncr18650bd.h * @author foxBMS Team * @date 2018-10-02 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup BATTERY_CELL_CONF * @prefix BC * diff --git a/src/os/freertos/portable/ccs/arm_cortex-r5/port.c b/src/os/freertos/portable/ccs/arm_cortex-r5/port.c index 03e35dd4..f57d3f00 100644 --- a/src/os/freertos/portable/ccs/arm_cortex-r5/port.c +++ b/src/os/freertos/portable/ccs/arm_cortex-r5/port.c @@ -296,8 +296,8 @@ void vPortStoreTaskMPUSettings( xMPU_SETTINGS * xMPUSettings, /* Configure last configurable MPU region (region 15) as non-cachable, for usage with DMA */ /* This region is also defined in the linker script as sharedRAM */ - xMPUSettings->xRegion[ portNUM_CONFIGURABLE_REGIONS - 1 ].ulRegionBaseAddress = 0x0807F000; - xMPUSettings->xRegion[ portNUM_CONFIGURABLE_REGIONS - 1 ].ulRegionSize = portMPU_SIZE_4KB | portMPU_REGION_ENABLE; + xMPUSettings->xRegion[ portNUM_CONFIGURABLE_REGIONS - 1 ].ulRegionBaseAddress = 0x0807E000; + xMPUSettings->xRegion[ portNUM_CONFIGURABLE_REGIONS - 1 ].ulRegionSize = portMPU_SIZE_8KB | portMPU_REGION_ENABLE; xMPUSettings->xRegion[ portNUM_CONFIGURABLE_REGIONS - 1 ].ulRegionAttribute = portMPU_PRIV_RW_USER_RW_NOEXEC | portMPU_NORMAL_OINC_SHARED; } /* end: required for Cortex-R5 MPU port - generated by TI HALCoGen - see src/os/freertos/README.ti-halcogen.md for details */ diff --git a/src/os/freertos/wscript b/src/os/freertos/wscript index fdfa3f6e..f9f082d2 100644 --- a/src/os/freertos/wscript +++ b/src/os/freertos/wscript @@ -44,10 +44,12 @@ Helper script to recursively build the embedded sources""" import os +from pathlib import Path def build(bld): """Build the FreeRTOS library""" + source = [ "croutine.c", "event_groups.c", @@ -70,3 +72,13 @@ def build(bld): cflags=cflags, target=target, ) + + root = Path(bld.top_dir).as_posix() + bld( + features="swi-check", + files=bld.root.ant_glob(f"{root}/src/**/*.c {root}/src/**/*.h"), + jump_table_file=bld.path.find_node( + os.path.join("portable", "ccs", "arm_cortex-r5", "portasm.asm") + ), + idx=1, + ) diff --git a/src/os/wscript b/src/os/wscript index 55a14529..b818f881 100644 --- a/src/os/wscript +++ b/src/os/wscript @@ -46,4 +46,4 @@ Helper script to recursively build the embedded sources""" def build(bld): """Propagates the build process details to the lower level wscript.""" - bld.recurse(bld.env.OPERATING_SYSTEM_NAME[0]) + bld.recurse(bld.env.RTOS_NAME[0]) diff --git a/tests/axivion/.axivion.preinc b/tests/axivion/.axivion.preinc index 17aef3bb..04b30cc0 100644 --- a/tests/axivion/.axivion.preinc +++ b/tests/axivion/.axivion.preinc @@ -328,3 +328,19 @@ unsigned long _lo(long double); /* foxBMS 2 specific adapations */ unsigned _ftoi (float src); + +#ifdef __TI_ARM__ +/* TI Arm Clang Compiler Tools User Guide, Release v2.1.0.LTS + 2.3. Migrating C and C++ Source Code: Conversions that Require More Attention */ +void _dmb(void); +/* https://developer.arm.com/documentation/dui0491/i/Compiler-specific-Features/--clrex-intrinsic */ +void __clrex(void); +/* https://developer.arm.com/documentation/dui0491/i/Compiler-specific-Features/--ldrex-intrinsic */ +unsigned int __ldrexw(volatile void*); +/* TI Arm Clang Compiler Tools User Guide, Release v2.1.0.LTS + 2.3. Migrating C and C++ Source Code: Non-ACLE Compiler Intrinsics */ +unsigned int _disable_interrupts(void); +void _restore_interrupts(unsigned int); +#pragma immutable_macro __atomic_compare_exchange +#define __atomic_is_lock_free __atomic_is_lock_free_no_builtin +#endif diff --git a/tests/axivion/README.md b/tests/axivion/README.md index e6755c74..5d4e3635 100644 --- a/tests/axivion/README.md +++ b/tests/axivion/README.md @@ -53,3 +53,11 @@ start_local_dashserver.bat wrapper_make_race_pdfs.bat ``` + +## MISRA C:2012 Hints + +| Strictness | Meaning | Deviations | foxBMS 2 specifics | +|------------|-----------------------------|------------------------------------------------|---------------------------------| +| mandatory | Rule **SHALL** be followed | No deviations. | - | +| required | Rule **SHOULD** be followed | Deviations need to be justified and documented | - | +| advisory | Rule **SHOULD** be followed | Deviations need to be documented | Rule also needs to be justified | diff --git a/tests/axivion/addon-test/.clang-format b/tests/axivion/addon-test/.clang-format new file mode 100644 index 00000000..9d159247 --- /dev/null +++ b/tests/axivion/addon-test/.clang-format @@ -0,0 +1,2 @@ +DisableFormat: true +SortIncludes: false diff --git a/tests/axivion/addon-test/run_axivion_addon_tests.bat b/tests/axivion/addon-test/run_axivion_addon_tests.bat new file mode 100644 index 00000000..1ba762b5 --- /dev/null +++ b/tests/axivion/addon-test/run_axivion_addon_tests.bat @@ -0,0 +1,78 @@ +@REM Copyright (c) 2010 - 2022, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. +@REM All rights reserved. +@REM +@REM SPDX-License-Identifier: BSD-3-Clause +@REM +@REM Redistribution and use in source and binary forms, with or without +@REM modification, are permitted provided that the following conditions are met: +@REM +@REM 1. Redistributions of source code must retain the above copyright notice, this +@REM list of conditions and the following disclaimer. +@REM +@REM 2. Redistributions in binary form must reproduce the above copyright notice, +@REM this list of conditions and the following disclaimer in the documentation +@REM and/or other materials provided with the distribution. +@REM +@REM 3. Neither the name of the copyright holder nor the names of its +@REM contributors may be used to endorse or promote products derived from +@REM this software without specific prior written permission. +@REM +@REM THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +@REM AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +@REM IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +@REM DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +@REM FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +@REM DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +@REM SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +@REM CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +@REM OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +@REM OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +@REM +@REM We kindly request you to use one or more of the following phrases to refer to +@REM foxBMS in your hardware, software, documentation or advertising materials: +@REM +@REM - "This product uses parts of foxBMS®" +@REM - "This product includes parts of foxBMS®" +@REM - "This product is derived from foxBMS®" + +@setlocal enableextensions enabledelayedexpansion + +@pushd %~dp0 +@CALL :NORMALIZEPATH "%~dp0\..\ +@SET BAUHAUS_CONFIG=%NORMALIZED_PATH% +@ECHO Setting 'BAUHAUS_CONFIG' to '%BAUHAUS_CONFIG%' + +@for /f "tokens=*" %%s in (%~dp0..\..\..\conf\env\paths_win32.txt) do @( + @echo %%s | findstr /i "bauhaus">nul && (@SET BAUHAUS_DIR=%%s) +) + +@REM preferr the perform_tests.exe that is found on PATH +@SET TEST_EXE=perform_tests.exe +@ECHO Seraching program '%TEST_EXE%' +@WHERE %TEST_EXE% 1>NUL 2>NUL +@IF %ERRORLEVEL% neq 0 ( + @ECHO '%TEST_EXE%' is not in %%PATH%% + @SET TEST_RUNNER=%BAUHAUS_DIR%\%TEST_EXE% +) ELSE ( + @SET TEST_RUNNER=%TEST_EXE% +) + +@IF exist %TEST_RUNNER% ( + @ECHO Using '%TEST_RUNNER%' +) ELSE ( + @WHERE %TEST_EXE% 1>NUL 2>NUL + @IF %ERRORLEVEL% neq 0 ( + @ECHO Could not find program '%TEST_RUNNER%' + @EXIT /b 1 + ) +) +@echo Found '%TEST_RUNNER%' +@%TEST_RUNNER% test_*.c* test_*/test_*.c* +@SET TEST_RUNNER_EXIT_LEVEL=%ERRORLEVEL% +@SET BAUHAUS_CONFIG= +@popd +@EXIT /B %ERRORLEVEL% + +:NORMALIZEPATH + @SET NORMALIZED_PATH=%~dpfn1 + @EXIT /B diff --git a/tests/axivion/addon-test/test_check_literal_suffixes.cpp b/tests/axivion/addon-test/test_check_literal_suffixes.cpp new file mode 100644 index 00000000..845dad62 --- /dev/null +++ b/tests/axivion/addon-test/test_check_literal_suffixes.cpp @@ -0,0 +1,91 @@ +/* axivion_config.json: +{ + "Analysis": { + "Analysis-GlobalOptions": { + "_additional_rules": [ + "$(TEST_SOURCE_DIR)/../addon" + ] + }, + "IISB-LiteralSuffixesCheck": { + "consider_int_sign_conversion": true, + "exclude_in_macros": [ + "__LINE__" + ] + } + }, + "_Format": "1.0" +} +*/ +// test: analysis(['IISB-LiteralSuffixesCheck']) + +unsigned int first = 4000; +//^ stdout:22: error: Integer literal constant of size 32 requires "u" suffix [4000] (Rule IISB-LiteralSuffixesCheck) +unsigned int second = 0x8000; /* not compliant */ +//^ stdout:23: error: Integer literal constant of size 32 requires "u" suffix [0x8000] (Rule IISB-LiteralSuffixesCheck) +unsigned int good1 = 4000U; +//^stdout:22: error: Literal constant suffix has wrong casing, please use "u" [4000U] (Rule IISB-LiteralSuffixesCheck) +unsigned int good2 = 0x8000u; +unsigned int badhex = 0x888a; /* not compliant */ +//^ stdout:23: error: Integer literal constant of size 32 requires "u" suffix [0x888a] (Rule IISB-LiteralSuffixesCheck) +unsigned int goodhex = 0x888au; +unsigned int goodlongsuffix = 0ul; +//^stdout:31: error: Integer literal constant of size 32 requires "u" suffix [0ul] (Rule IISB-LiteralSuffixesCheck) +unsigned int alsogood = 0lu; +//^stdout:25: error: Integer literal constant of size 32 requires "u" suffix [0lu] (Rule IISB-LiteralSuffixesCheck) +unsigned int suppress = __LINE__; + +float f_first = 0.123; +//^stdout:17: error: Floating point literal constant of size 32 requires "f" suffix [0.123] (Rule IISB-LiteralSuffixesCheck) +float f_second = 0.123E10; +//^stdout:18: error: Floating point literal constant of size 32 requires "f" suffix [0.123E10] (Rule IISB-LiteralSuffixesCheck) +float f_third = 0.23E10F; +//^stdout:17: error: Literal constant suffix has wrong casing, please use "f" [0.23E10F] (Rule IISB-LiteralSuffixesCheck) +float f_fourth = 0xa0.12b3p10; +//^stdout:18: error: Floating point literal constant of size 32 requires "f" suffix [0xa0.12b3p10] (Rule IISB-LiteralSuffixesCheck) +float f_fifth = 0x2e3p10; +//^stdout:17: error: Floating point literal constant of size 32 requires "f" suffix [0x2e3p10] (Rule IISB-LiteralSuffixesCheck) +float f_sixth = 0x2.3p23F; +//^stdout:17: error: Literal constant suffix has wrong casing, please use "f" [0x2.3p23F] (Rule IISB-LiteralSuffixesCheck) + +double d_ok_first = 0.123; +double d_second = 0.123E10f; +//^stdout:19: error: Literal constant should have no suffix [0.123E10f] (Rule IISB-LiteralSuffixesCheck) +double d_third = 0.23E10F; +//^stdout:18: error: Literal constant should have no suffix [0.23E10F] (Rule IISB-LiteralSuffixesCheck) +double d_fourth = 0xa0.12p3f; +//^stdout:19: error: Literal constant should have no suffix [0xa0.12p3f] (Rule IISB-LiteralSuffixesCheck) +double d_ok_fifth = 0x2p10; +double d_sixth = 0x2.3p23F; +//^stdout:18: error: Literal constant should have no suffix [0x2.3p23F] (Rule IISB-LiteralSuffixesCheck) + +double d_ok_second = 0.123E10; +double d_ok_third = 0.23E10; +double d_ok_fourth = 0xa0.12p3; +double d_ok_sixth = 0x2.3p23; + +float f_ok_first = 0.123f; +float f_ok_second = 0.123E10f; +float f_ok_third = 0.23E10f; +float f_ok_fourth = 0xa0.12p3f; +float f_ok_fifth = 0x2p10f; +float f_ok_sixth = 0x2.3p23f; + + +#if 0 /* ok */ +#endif + +struct Iterator +{ + Iterator& operator++(const int dummy); +}; + +void f() +{ + for (Iterator i; true; i++) {} /* avoid message */ + int small = -1; + if (small < 0) {} /* ok, not an unsigned context */ +} + +int main() +{ +} diff --git a/tests/axivion/addon-test/test_doxygen_comments/file.cpp b/tests/axivion/addon-test/test_doxygen_comments/file.cpp new file mode 100644 index 00000000..67d180bd --- /dev/null +++ b/tests/axivion/addon-test/test_doxygen_comments/file.cpp @@ -0,0 +1,45 @@ +// primary_file: test_doxygen_comments.cpp + +#include "header.h" + +class X +//^stdout:7: error: Need Doxygen comment for this entity. [X] (Rule IISB-DoxygenCommentAtDeclaration) +{ +}; + +void only_defined_func() +//^stdout:6: error: Need Doxygen comment for this entity. [only_defined_func()] (Rule IISB-DoxygenCommentAtDeclaration) +{ +} + +void in_header_declared_func() +{ +} + +void in_cpp_declared_func(); +//^stdout:6: error: Need Doxygen comment for any declaration of this entity. [in_cpp_declared_func()] (Rule IISB-DoxygenCommentAtDeclaration) + +void in_cpp_declared_func() +{ +} + + +void mixed_declared_func_nok(); // label:mixed_declared_func_nok__decl_in_cpp +//^stdout:6: error: Need Doxygen comment for any declaration of this entity. [mixed_declared_func_nok()] (Rule IISB-DoxygenCommentAtDeclaration), $(mixed_declared_func_nok__decl_in_h):6: + +void mixed_declared_func_nok() +{ +} + + +void mixed_declared_func_ok(); + +void mixed_declared_func_ok() +{ +} + +static T1 var_1 = 0; +//^stdout:11: error: Need Doxygen comment for this entity. [var_1] (Rule IISB-DoxygenCommentAtDeclaration) + +/** Hallo */ +static T2 var_2 = 0; diff --git a/tests/axivion/addon-test/test_doxygen_comments/header.h b/tests/axivion/addon-test/test_doxygen_comments/header.h new file mode 100644 index 00000000..76f54536 --- /dev/null +++ b/tests/axivion/addon-test/test_doxygen_comments/header.h @@ -0,0 +1,79 @@ +// primary_file: test_doxygen_comments.cpp + +extern void do_something(); // this has no definition +//^stdout:13: error: Need Doxygen comment for any declaration of this entity. [do_something()] (Rule IISB-DoxygenCommentAtDeclaration) + +template +class Dummy +//^stdout:7: error: Need Doxygen comment for this entity. [Dummy] (Rule IISB-DoxygenCommentAtDeclaration) +{ +public: + /** This is a valid comment + */ + void print(); + + void another_print(); + //^stdout:10: error: Need Doxygen comment for any declaration of this entity. [another_print()] (Rule IISB-DoxygenCommentAtDeclaration) +}; + + +template +void Dummy::print() +{ + do_something(); +} + +template +void Dummy::another_print() +{ + do_something(); +} + +/** template class documentation */ +template +class XY +{ +public: + /** in-class documentation */ + XY(const XY& other); +}; + +template +XY::XY(const XY& other) +{ +} + +void in_header_declared_func(); +//^stdout:6: error: Need Doxygen comment for any declaration of this entity. [in_header_declared_func()] (Rule IISB-DoxygenCommentAtDeclaration) + + +static void in_header_defined_func(); +//^stdout:13: error: Need Doxygen comment for any declaration of this entity. [in_header_defined_func()] (Rule IISB-DoxygenCommentAtDeclaration) + +static void in_header_defined_func() +{ +} + +void mixed_declared_func_nok(); // label:mixed_declared_func_nok__decl_in_h +//^stdout:6: error: Need Doxygen comment for any declaration of this entity. [mixed_declared_func_nok()] (Rule IISB-DoxygenCommentAtDeclaration), $(mixed_declared_func_nok__decl_in_cpp):6: + +/** + */ +void mixed_declared_func_ok(); + +/** + * Type T1. + */ +typedef int T1; + +typedef int T2; +//^stdout:13: error: Need Doxygen comment for this entity. [T2] (Rule IISB-DoxygenCommentAtDeclaration) + +using T3 = int; +//^stdout:7: error: Need Doxygen comment for this entity. [T3] (Rule IISB-DoxygenCommentAtDeclaration) + +/** Type T4. */ +using T4 = int; + +/** Hallo */ +static T3 var_3; diff --git a/tests/axivion/addon-test/test_doxygen_comments/test_doxygen_comments.cpp b/tests/axivion/addon-test/test_doxygen_comments/test_doxygen_comments.cpp new file mode 100644 index 00000000..f65e4fc1 --- /dev/null +++ b/tests/axivion/addon-test/test_doxygen_comments/test_doxygen_comments.cpp @@ -0,0 +1,22 @@ +/* axivion_config.json: +{ + "Analysis": { + "Analysis-GlobalOptions": { + "_additional_rules": [ + "$(TEST_SOURCE_DIR)/../../addon" + ] + } + }, + "_Format": "1.0" +} +*/ +// include: file.cpp +// include: header.h +// setup: cafeCC(args=[TESTCASE.filename, 'file.cpp']) +// test: analysis(['IISB-DoxygenCommentAtDeclaration']) + + +int main() +//^stdout:5: error: Need Doxygen comment for this entity. [main()] (Rule IISB-DoxygenCommentAtDeclaration) +{ +} diff --git a/tests/axivion/addon-test/test_file_comments/interlock.c b/tests/axivion/addon-test/test_file_comments/interlock.c new file mode 100644 index 00000000..5c1dace2 --- /dev/null +++ b/tests/axivion/addon-test/test_file_comments/interlock.c @@ -0,0 +1,69 @@ +//primary_file: test_file_comments.c + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +/** + * @file interlock.c + * @author foxBMS Team + * @date 2020-02-24 (date of creation) + * @updated 2022-05-30 (date of last update) + * @version v1.2.3 + * @ingroup DRIVERS + * @prefix ILCK + * + * @brief Driver for the interlock. + * @details The interlock driver measures the relevant hardware signals from + * the interlock circuit. For details on available hardware signals + * please refer to the section on this module in the foxBMS + * documentation. + * + * In reference to the names in the foxBMS schematic, this module uses + * the following names: + * + * shorthand | meaning + * --------- | --------- + * IL | interlock + * HS | high-side + * LS | low-side + * VS | voltage sense + * CS | current sense + * + */ diff --git a/tests/axivion/addon-test/test_file_comments/ltc_defs.h b/tests/axivion/addon-test/test_file_comments/ltc_defs.h new file mode 100644 index 00000000..c510504d --- /dev/null +++ b/tests/axivion/addon-test/test_file_comments/ltc_defs.h @@ -0,0 +1,15 @@ +/* License */ + +/** + * @file ltc_defs.h + * @author foxBMS Team + * @date 2015-09-01 (date of creation) + * @updated 2022-05-30 (date of last update) + * @version v1.2.3 + * @ingroup DRIVERS + * @prefix LTC + * + * @brief Headers for the driver for the LTC monitoring chip. + * + */ +//^stdout:3: error: Missing tags in comment: @details (Rule IISB-DoxygenFileComment) diff --git a/tests/axivion/addon-test/test_file_comments/not_doxygen_comment.c b/tests/axivion/addon-test/test_file_comments/not_doxygen_comment.c new file mode 100644 index 00000000..54c6935f --- /dev/null +++ b/tests/axivion/addon-test/test_file_comments/not_doxygen_comment.c @@ -0,0 +1,54 @@ +/** + * + * @copyright © 2010 - 2022, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. + * All rights reserved. + * + * 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®″ + * + */ + + /* + * @file ok.c + * @author foxBMS Team + * @date 2019-08-27 (date of creation) + * @updated 2022-05-30 (date of last update) + * @version v1.3.0 + */ +//primary_file: test_file_comments.c +//^^^^^^^^stdout:1: error: Expect a Doxygen comment here (Rule IISB-DoxygenFileComment) + +void not_doxygen_comment() +{ +} diff --git a/tests/axivion/addon-test/test_file_comments/ok.c b/tests/axivion/addon-test/test_file_comments/ok.c new file mode 100644 index 00000000..de84a5fa --- /dev/null +++ b/tests/axivion/addon-test/test_file_comments/ok.c @@ -0,0 +1,33 @@ +/* + * License + */ + +/** + * @file ok.c + * @author foxBMS Team + * @date 2019-08-27 (date of creation) + * @updated 2022-05-30 (date of last update) + * @version v1.3.0 + * @ingroup GENERAL + * @prefix BLA + * + * @brief this is a brief comment + * might span multiple lines + * and these lines must be aligned + * This is a list + * - a + * - a1 + * - b2 + * - b + * + * @details needs to look and work + * the same way + * as "@brief" + */ +//primary_file: test_file_comments.c + +#include "ok.h" + +void ok() +{ +} diff --git a/tests/axivion/addon-test/test_file_comments/ok.h b/tests/axivion/addon-test/test_file_comments/ok.h new file mode 100644 index 00000000..786e6acb --- /dev/null +++ b/tests/axivion/addon-test/test_file_comments/ok.h @@ -0,0 +1,27 @@ +/** + * @file ok.h + * @author foxBMS Team + * @date 2019-08-27 (date of creation) + * @updated 2022-05-30 (date of last update) + * @version v1.3.0 + * @ingroup GENERAL + * @prefix BLA + * + * @brief this is a brief comment + * might span multiple lines + * and these lines must be aligned + * This is a list + * - a + * - a1 + * - b2 + * - b + * + * @details needs to look and work + * the same way + * as "@brief" + */ + +#ifndef OK_H +#define OK_H 1 + +#endif diff --git a/tests/axivion/addon-test/test_file_comments/test_file_comments.c b/tests/axivion/addon-test/test_file_comments/test_file_comments.c new file mode 100644 index 00000000..774c48e4 --- /dev/null +++ b/tests/axivion/addon-test/test_file_comments/test_file_comments.c @@ -0,0 +1,30 @@ +/* axivion_config.json: +{ + "Analysis": { + "Analysis-GlobalOptions": { + "_additional_rules": [ + "$(TEST_SOURCE_DIR)/../../addon" + ] + } + }, + "_Format": "1.0" +} +*/ +// include: ltc_defs.h +// include: not_doxygen_comment.c +// include: ok.c +// include: ok.h +// include: text_error.c +// include: unexpected_tag.c +// include: value_error.c +// include: interlock.c +// setup: cafeCC(args=[TESTCASE.filename, 'not_doxygen_comment.c', 'ok.c', 'text_error.c', 'unexpected_tag.c', 'value_error.c', 'interlock.c']) +// test: analysis(['IISB-DoxygenFileComment']) + +#include "ltc_defs.h" + +// test: TESTCASE.add_expected_stdout(f"test_file_comments.c:13:1: error: Expect a Doxygen comment here (Rule IISB-DoxygenFileComment)") + +int main() +{ +} diff --git a/tests/axivion/addon-test/test_file_comments/text_error.c b/tests/axivion/addon-test/test_file_comments/text_error.c new file mode 100644 index 00000000..deec48ba --- /dev/null +++ b/tests/axivion/addon-test/test_file_comments/text_error.c @@ -0,0 +1,55 @@ +/** + * + * @copyright © 2010 - 2022, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. + * All rights reserved. + * + * 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®″ + * + */ + + /** + * @file ok.c + * @author foxBMS Team + * @date 2019-08-27 (date of creation) + * @updated 2022-05-30 (date of last update) + * @version v1.3.0 + + */ +//primary_file: test_file_comments.c +//^^stdout:1: error: Line should start with prefix ' *' (Rule IISB-DoxygenFileComment) + + +void text_error() +{ +} diff --git a/tests/axivion/addon-test/test_file_comments/unexpected_tag.c b/tests/axivion/addon-test/test_file_comments/unexpected_tag.c new file mode 100644 index 00000000..448141c9 --- /dev/null +++ b/tests/axivion/addon-test/test_file_comments/unexpected_tag.c @@ -0,0 +1,54 @@ +/** + * + * @copyright © 2010 - 2022, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. + * All rights reserved. + * + * 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®″ + * + */ + + /** + * @file ok.c + * @author foxBMS Team + * @date 2019-08-27 (date of creation) + * @version v1.3.0 + * @updated 2022-05-30 (date of last update) + */ +//primary_file: test_file_comments.c +//^^^^stdout:4: error: Expected tag '@updated' (Rule IISB-DoxygenFileComment), unexpected_tag.c:47:4: , unexpected_tag.c:48:3: + +void unexpected_tag() +{ +} diff --git a/tests/axivion/addon-test/test_file_comments/value_error.c b/tests/axivion/addon-test/test_file_comments/value_error.c new file mode 100644 index 00000000..d2663627 --- /dev/null +++ b/tests/axivion/addon-test/test_file_comments/value_error.c @@ -0,0 +1,54 @@ +/** + * + * @copyright © 2010 - 2022, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. + * All rights reserved. + * + * 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®″ + * + */ + + /** + * @file ok.c + * @author foxBMS Team + * @date abc + * @updated 2022-05-30 (date of last update) + * @version v1.3.0 + */ //label:value_error__too_short +//primary_file: test_file_comments.c +//^^^^^stdout:13: error: Value of tag '@date' does not match expected regex '(2[0-9]{3}-[01][0-9]-[0-3][0-9])(:?|\s*\(date\s+of\s+creation\))' (Rule IISB-DoxygenFileComment), $(value_error__too_short):3: + +void value_error() +{ +} diff --git a/tests/axivion/addon-test/test_file_encoding/latin1.cpp b/tests/axivion/addon-test/test_file_encoding/latin1.cpp new file mode 100644 index 00000000..8faf9b89 --- /dev/null +++ b/tests/axivion/addon-test/test_file_encoding/latin1.cpp @@ -0,0 +1,8 @@ +//primary_file: test_file_encoding.cpp + +#include + +void latin1() +{ + std::cout << "" << std::endl; +} diff --git a/tests/axivion/addon-test/test_file_encoding/test_file_encoding.cpp b/tests/axivion/addon-test/test_file_encoding/test_file_encoding.cpp new file mode 100644 index 00000000..c4554676 --- /dev/null +++ b/tests/axivion/addon-test/test_file_encoding/test_file_encoding.cpp @@ -0,0 +1,32 @@ +/* axivion_config.json: +{ + "Analysis": { + "Analysis-GlobalOptions": { + "_additional_rules": [ + "$(TEST_SOURCE_DIR)/../../addon" + ] + }, + "IISB-FileEncodingCheck": { + "alternative_encoding": { + "$(delta:+)": { + "latin1.cpp": "latin_1" + }, + "$(delta:-)": [] + } + } + }, + "_Format": "1.0" +} +*/ +// include: utf8.cpp +// include: latin1.cpp +// include: windows-1252.cpp +// setup: cafeCC(args=[TESTCASE.filename, 'utf8.cpp', 'latin1.cpp', 'windows-1252.cpp']) +// test: analysis(['IISB-FileEncodingCheck']) + +// test: TESTCASE.add_expected_stdout("windows-1252.cpp:1:1: error: File does not have required encoding utf_8 [windows-1252.cpp] (Rule IISB-FileEncodingCheck)") + + +int main() +{ +} diff --git a/tests/axivion/addon-test/test_file_encoding/utf8.cpp b/tests/axivion/addon-test/test_file_encoding/utf8.cpp new file mode 100644 index 00000000..c80e3501 --- /dev/null +++ b/tests/axivion/addon-test/test_file_encoding/utf8.cpp @@ -0,0 +1,8 @@ +//primary_file: test_file_encoding.cpp + +#include + +void utf8() +{ + std::cout << "äöüß" << std::endl; +} diff --git a/tests/axivion/addon-test/test_file_encoding/windows-1252.cpp b/tests/axivion/addon-test/test_file_encoding/windows-1252.cpp new file mode 100644 index 00000000..d22c9ce3 --- /dev/null +++ b/tests/axivion/addon-test/test_file_encoding/windows-1252.cpp @@ -0,0 +1,8 @@ +//primary_file: test_file_encoding.cpp + +#include + +void windows_1252() +{ + std::cout << "" << std::endl; +} diff --git a/tests/axivion/addon-test/test_license_comments/license_incorrect.c b/tests/axivion/addon-test/test_license_comments/license_incorrect.c new file mode 100644 index 00000000..7a00a49f --- /dev/null +++ b/tests/axivion/addon-test/test_license_comments/license_incorrect.c @@ -0,0 +1,55 @@ +/** + * + * @copyright © 2010 - 2022, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. + * All rights reserved. + * + * 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, INDIECT, 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®″ + * + */ + + /** + * @file license_incorrect.c + * @author foxBMS Team + * @date 2019-08-27 (date of creation) + * @updated 2022-05-30 (date of last update) + * @version v1.3.0 + */ +//primary_file: test_license_comments.c + +//test: TESTCASE.add_expected_stdout("license_incorrect.c:26:1: error: License header is incorrect (Rule IISB-FileLicenseComment)") + +void license_incorrect() +{ +} diff --git a/tests/axivion/addon-test/test_license_comments/license_short.c b/tests/axivion/addon-test/test_license_comments/license_short.c new file mode 100644 index 00000000..818f8a17 --- /dev/null +++ b/tests/axivion/addon-test/test_license_comments/license_short.c @@ -0,0 +1,39 @@ +/** + * + * @copyright © 2010 - 2022, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. + * All rights reserved. + * + * 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. + * + */ +//primary_file: test_file_comments.c +//^^stdout:1: error: License header is incorrect (Rule IISB-FileLicenseComment) + +void unexpected_tag() +{ +} diff --git a/tests/axivion/addon-test/test_license_comments/no_license_comment.h b/tests/axivion/addon-test/test_license_comments/no_license_comment.h new file mode 100644 index 00000000..106d3ee0 --- /dev/null +++ b/tests/axivion/addon-test/test_license_comments/no_license_comment.h @@ -0,0 +1,6 @@ +#ifndef NO_LICENSE_COMMENT_H +#define NO_LICENSE_COMMENT_H + +extern void no_license_comment(); + +#endif diff --git a/tests/axivion/addon-test/test_license_comments/ok.c b/tests/axivion/addon-test/test_license_comments/ok.c new file mode 100644 index 00000000..981b9804 --- /dev/null +++ b/tests/axivion/addon-test/test_license_comments/ok.c @@ -0,0 +1,68 @@ +/** + * + * @copyright © 2010 - 2022, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. + * All rights reserved. + * + * 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®″ + * + */ + + /** + * @file ok.c + * @author foxBMS Team + * @date 2019-08-27 (date of creation) + * @updated 2022-05-30 (date of last update) + * @version v1.3.0 + * @ingroup GENERAL + * @prefix BLA + * + * @brief this is a brief comment + * might span multiple lines + * and these lines must be aligned + * This is a list + * - a + * - a1 + * - b2 + * - b + * + * @details needs to look and work + * the same way + * as "@brief" + */ +//primary_file: test_license_comments.c + +void ok() +{ +} diff --git a/tests/axivion/addon-test/test_license_comments/test_license_comments.c b/tests/axivion/addon-test/test_license_comments/test_license_comments.c new file mode 100644 index 00000000..2b6c6b28 --- /dev/null +++ b/tests/axivion/addon-test/test_license_comments/test_license_comments.c @@ -0,0 +1,32 @@ +/* axivion_config.json: +{ + "Analysis": { + "Analysis-GlobalOptions": { + "_additional_rules": [ + "$(TEST_SOURCE_DIR)/../../addon" + ] + } + }, + "_Format": "1.0" +} +*/ +// include: ok.c +// include: no_license_comment.h +// include: license_incorrect.c +// include: license_short.c +// setup: cafeCC(args=[TESTCASE.filename, 'ok.c', 'license_incorrect.c', 'license_short.c']) +// test: analysis(['IISB-FileLicenseComment']) + +// test: TESTCASE.add_expected_stdout(f"test_license_comments.c:1:1: error: License header is incorrect (Rule IISB-FileLicenseComment)") + +#include "no_license_comment.h" +// test: TESTCASE.add_expected_stdout("no_license_comment.h:1:1: error: No license header found (Rule IISB-FileLicenseComment)") + + +void no_license_comment() +{ +} + +int main() +{ +} diff --git a/tests/axivion/addon-test/test_unique_filename/a.c b/tests/axivion/addon-test/test_unique_filename/a.c new file mode 100644 index 00000000..01a5dd53 --- /dev/null +++ b/tests/axivion/addon-test/test_unique_filename/a.c @@ -0,0 +1,5 @@ +//primary_file:test_unique_filename.cpp + +void second() +{ +} diff --git a/tests/axivion/addon-test/test_unique_filename/a.cpp b/tests/axivion/addon-test/test_unique_filename/a.cpp new file mode 100644 index 00000000..f31360d2 --- /dev/null +++ b/tests/axivion/addon-test/test_unique_filename/a.cpp @@ -0,0 +1,7 @@ +//primary_file:test_unique_filename.cpp + +#include "a.h" + +void first() +{ +} diff --git a/tests/axivion/addon-test/test_unique_filename/a.h b/tests/axivion/addon-test/test_unique_filename/a.h new file mode 100644 index 00000000..e89e254b --- /dev/null +++ b/tests/axivion/addon-test/test_unique_filename/a.h @@ -0,0 +1,10 @@ +//primary_file:test_unique_filename.cpp + +#ifndef A_H +#define A_H + +extern void first(); +extern void second(); +extern void third(); + +#endif diff --git a/tests/axivion/addon-test/test_unique_filename/sub/a.c b/tests/axivion/addon-test/test_unique_filename/sub/a.c new file mode 100644 index 00000000..fccb7199 --- /dev/null +++ b/tests/axivion/addon-test/test_unique_filename/sub/a.c @@ -0,0 +1,7 @@ +//primary_file:test_unique_filename.cpp + +#include "../a.h" + +void third() +{ +} diff --git a/tests/axivion/addon-test/test_unique_filename/test_unique_filename.cpp b/tests/axivion/addon-test/test_unique_filename/test_unique_filename.cpp new file mode 100644 index 00000000..ca10c7bd --- /dev/null +++ b/tests/axivion/addon-test/test_unique_filename/test_unique_filename.cpp @@ -0,0 +1,31 @@ +/* axivion_config.json: +{ + "Analysis": { + "Analysis-GlobalOptions": { + "_additional_rules": [ + "$(TEST_SOURCE_DIR)/../../addon" + ] + } + }, + "_Format": "1.0" +} +*/ +// include: a.c +// include: a.cpp +// include: a.h +// include: sub/a.c +// setup: cafeCC(args=[TESTCASE.filename, 'a.c', 'a.cpp', 'sub/a.c']) +// test: analysis(['IISB-UniqueFileNameCheck']) + +// test: TESTCASE.add_expected_stdout("a.c:1:1: error: File names are too similar [a.c] (Rule IISB-UniqueFileNameCheck), sub/a.c:1:1:") +// test: TESTCASE.add_expected_stdout("sub/a.c:1:1: error: File names are too similar [sub/a.c] (Rule IISB-UniqueFileNameCheck), a.c:1:1:") + + +#include "a.h" + +int main() +{ + first(); + second(); + third(); +} diff --git a/tests/axivion/addon/__init__.py b/tests/axivion/addon/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/axivion/addon/doxygen_comment_at_declaration.py b/tests/axivion/addon/doxygen_comment_at_declaration.py new file mode 100644 index 00000000..6bce2ffd --- /dev/null +++ b/tests/axivion/addon/doxygen_comment_at_declaration.py @@ -0,0 +1,247 @@ +# Copyright (c) 2022, Axivion GmbH +# All rights reserved. +# +# 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®" + + +import itertools +import typing +from enum import Enum, auto + +from bauhaus import analysis, ir +from bauhaus.analysis.config import SearchPattern +from bauhaus.ir.common.algorithms import symbol_declarations +from bauhaus.ir.common.output import unparse +from bauhaus.ir.common.scanner import comments + + +class LocationSpecifier(Enum): + at_definition = auto() + """The Doxygen comment shall be located before the definition.""" + at_any_declaration = auto() + """The Doxygen comment shall be located before any (of potentially many) declaration of the entity. + This includes the definition.""" + at_all_declarations = auto() + """A Doxygen comment shall be located before all declarations of the entity or the definition + if that is the only declaration.""" + at_all_decls_and_defs = auto() + """A Doxygen comment shall be located before all declarations and definitions of the entity.""" + + +@analysis.rule("IISB-DoxygenCommentAtDeclaration") +class DoxygenCommentRule(analysis.AnalysisRule): + title = """Place Doxygen comments above declarations or definitions of entities.""" + + languages = {analysis.Language.C, analysis.Language.CPP} + + node_types: typing.Dict[ir.LIR_Class_Name, LocationSpecifier] = { + "Composite_Type": LocationSpecifier.at_definition, + "Routine": LocationSpecifier.at_any_declaration, + "General_Typedef_Type": LocationSpecifier.at_any_declaration, + "Global_Static_Variable": LocationSpecifier.at_any_declaration, + "Global_Normal_Variable": LocationSpecifier.at_any_declaration, + } + """Logical IR node types to check for preceding Doxygen comment. The comment shall be placed + before the entities specified in the mapping.""" + + doxygen_start: typing.Set[str] = {"/**", "///"} + """Start of a valid Doxygen comment.""" + + ignore_redefinitions = False + """If True, method redefinitions are not checked as they can 'inherit' + the comment from the redefined method.""" + + ignore_deleted = False + """If True, deleted function declarations are not checked for comments.""" + + ignore_defaulted = False + """If True, defaulted function declarations are not checked for comments.""" + + allow_inherited = False + """ + If True, a definition does not need documentation, if a corresponding + declaration is documented. This includes definitions of virtual member function. + """ + + allow_missing_documentation_on_private = False + """If True, a class-member definition does not need documentation, if it + is `private`.""" + + allow_missing_documentation_on_protected = False + """If True, a class-member definition does not need documentation, if it + is `protected`.""" + + ignore_tool_comments: typing.Optional[SearchPattern] = None + """ + An optional regular expression. Comments where this regex finds a matching + substring are ignored in the search for a doxygen comment (e.g. control-comments of other tools). + """ + + _rule_description = """ +

Requires doxygen comments to appear before certain source + code entities.

+

The set of entities that should be documented can be controlled + with the attribute node_types. A set of LIR node types can be selected + and the places where the comment should be placed (before any declaration, before + all declarations, before the definition or before all of the beforementioned). See + configuration attribute node_types.

+ """ + + _message_descriptions = { + "comment_missing": "Need Doxygen comment for this entity.", + "comment_potentially_missing": "Need Doxygen comment for any declaration of this entity.", + } + + def is_allowed_comment(self, text): + return text.startswith(tuple(self.doxygen_start)) + + def is_relevant_node(self, lir_node): + # for functions, optionally ignore = delete ones + if lir_node.is_of_type("Routine") and lir_node.Attributes: + if self.ignore_deleted and lir_node.Attributes.is_deleted: + return False + + if self.ignore_defaulted and lir_node.Attributes.is_defaulted: + return False + + if lir_node.is_of_type("Member"): + if ( + self.allow_missing_documentation_on_protected + and lir_node.Visibility == ir.visibility_protected + ): + return False + + if ( + self.allow_missing_documentation_on_private + and lir_node.Visibility == ir.visibility_private + ): + return False + + # for functions, optionally allow inheriting from any declaration + if lir_node.is_of_type("Routine") and self.allow_inherited: + candidates = itertools.chain( + lir_node.Decls_And_Defs, + ( + itertools.chain.from_iterable( + n.Decls_And_Defs for n in lir_node.Redefines + ) + if lir_node.is_of_type("Method") + else () + ), + ) + if any( + comments.has_comment_before( + n, + self.is_allowed_comment, + ignore_matching=self.ignore_tool_comments, + ) + for n in candidates + ): + return False + + # for method decl/def, optionally allow comment from redefined base + # method + if ( + lir_node.is_of_type("Method") + and self.ignore_redefinitions + and lir_node.Redefines + ): + return False + return True + + def execute(self, ir_graph): + for node_types, check in self.node_types.items(): + for lir_node in ir_graph.nodes_of_type(ir.Logical, node_types): + pir_node = lir_node.Physical + if ( + pir_node + and lir_node + and not pir_node.Artificial + and not pir_node.In_Template_Instance + and self.is_relevant_node(lir_node) + ): + all_required = list() + one_of = list() + if len(lir_node.Declarations) == 0: + all_required.extend(lir_node.Definitions) + else: + if check == LocationSpecifier.at_definition: + all_required.extend(lir_node.Definitions) + elif check == LocationSpecifier.at_any_declaration: + one_of.extend(lir_node.Declarations) + elif check == LocationSpecifier.at_all_declarations: + all_required.extend(lir_node.Declarations) + elif check == LocationSpecifier.at_all_decls_and_defs: + all_required.extend(lir_node.Decls_And_Defs) + else: + assert False + + secondaries = symbol_declarations.sort_by_position( + one_of + all_required + ) + if not any( + comments.has_comment_before( + n, + self.is_allowed_comment, + ignore_matching=self.ignore_tool_comments, + ) + for n in one_of + ): + for primary in one_of: + self.add_message( + msg_key="comment_potentially_missing", + entity=unparse.entity(primary), + primary_sloc=primary, + secondary_slocs=filter( + lambda n: n != primary, secondaries + ), + ) + if not all( + comments.has_comment_before( + n, + self.is_allowed_comment, + ignore_matching=self.ignore_tool_comments, + ) + for n in all_required + ): + for primary in all_required: + self.add_message( + msg_key="comment_missing", + entity=unparse.entity(primary), + primary_sloc=primary, + secondary_slocs=filter( + lambda n: n != primary, secondaries + ), + ) diff --git a/tests/axivion/addon/file_comment.py b/tests/axivion/addon/file_comment.py new file mode 100644 index 00000000..17904074 --- /dev/null +++ b/tests/axivion/addon/file_comment.py @@ -0,0 +1,429 @@ +# Copyright (c) 2022, Axivion GmbH +# All rights reserved. +# +# 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®" + + +import dataclasses +import io +import re +import typing +from enum import Enum, auto + +from bauhaus import analysis, ir +from bauhaus.ir.common.files import files_by_language +from bauhaus.ir.common.scanner import comments +from bauhaus.shared import MessageSLoc +from bauhaus.style import excludes + +from . import iisb_base + + +class MatchResult(Enum): + ok = auto() + wrong_prefix = auto() + wrong_tag = auto() + wrong_value = auto() + unmatched = auto() + + +@dataclasses.dataclass +class RequirementMatchResult: + state: MatchResult = MatchResult.unmatched + tag_index: typing.Optional[int] = None + value_index: typing.Optional[int] = None + continue_option: typing.Optional["LineRequirement"] = None + + def __bool__(self): + return self.state == MatchResult.ok + + +@dataclasses.dataclass +class LineRequirement: + tag_name: typing.Optional[str] + match_tag: bool = True + prefix: str = " *" + pattern_min_index: typing.Optional[int] = None + pattern: typing.Optional[typing.Pattern[str]] = None + multiline: bool = False + + @classmethod + def empty_line(cls) -> "LineRequirement": + return LineRequirement(tag_name=None, prefix=" *", pattern=re.compile("\\s*")) + + def expected_arguments(self) -> typing.Dict[str, str]: + return { + "tag": self.tag_name if self.tag_name else "", + "prefix": self.prefix if self.prefix else "", + "pattern": self.pattern.pattern if self.pattern is not None else "", + } + + def match(self, line: str) -> RequirementMatchResult: + """Checks if line matches self's requirements. Returns a triple of match status, + index in line where the pattern starts (if there is any) and optionally a continue pattern to match + succeeding lines for a multiline pattern.""" + index = 0 + if not line.startswith(self.prefix): + return RequirementMatchResult(state=MatchResult.wrong_prefix) + index += len(self.prefix) + line = line[len(self.prefix) :] + while len(line) > 0 and line[0].isspace(): + index += 1 + line = line[1:] + tag_start_index = index + if self.tag_name is not None: + if line.startswith(self.tag_name): + index += len(self.tag_name) + line = line[len(self.tag_name) :] + elif self.match_tag: + return RequirementMatchResult( + state=MatchResult.wrong_tag, tag_index=tag_start_index + ) + while ( + len(line) > 0 + and line[0].isspace() + and (self.pattern_min_index is None or index < self.pattern_min_index) + ): + index += 1 + line = line[1:] + value_start_index = index + # for multiline comments, create requirements for the next line containing + # only a continuation of the value. Verify correct value_start_index! + continue_option: typing.Optional["LineRequirement"] = ( + None + if not self.multiline + else LineRequirement( + prefix=self.prefix, + tag_name=self.tag_name, + match_tag=False, + pattern_min_index=value_start_index + if self.pattern_min_index is None + else self.pattern_min_index, + pattern=self.pattern, + multiline=True, + ) + ) + if line == "" and self.multiline: + # accept empty lines in multiline mode + pass + elif ( + line != "" + and self.pattern_min_index is not None + and value_start_index < self.pattern_min_index + ): + # need proper indent of the value to accept it + return RequirementMatchResult( + state=MatchResult.wrong_value, + tag_index=tag_start_index, + value_index=value_start_index, + continue_option=continue_option, + ) + elif self.pattern is not None: + m = self.pattern.fullmatch(line) + if not m: + return RequirementMatchResult( + state=MatchResult.wrong_value, + tag_index=tag_start_index, + value_index=value_start_index, + continue_option=continue_option, + ) + return RequirementMatchResult( + state=MatchResult.ok, + tag_index=tag_start_index, + value_index=value_start_index, + continue_option=continue_option, + ) + + +@dataclasses.dataclass +class LineDescription: + sloc: MessageSLoc + text: str + pattern_no: typing.Optional[int] = None + + +@analysis.rule("IISB-DoxygenFileComment") +class IisbDoxygenFileCommentRule(iisb_base.IISBRule, analysis.AnalysisRule): + title = """Verify header comments in files.""" + + file_node_kinds: typing.Set[ir.PIR_Class_Name] = { + "Primary_File", + "User_Include_File", + } + + _iso_date_pattern = r"(2[0-9]{3}-[01][0-9]-[0-3][0-9])" + + required_tags: typing.List[LineRequirement] = [ + LineRequirement(prefix="/**", tag_name=None), + LineRequirement(tag_name="@file", pattern=re.compile(r"\S.*")), + LineRequirement(tag_name="@author", pattern=re.compile(r"\S.*")), + LineRequirement( + tag_name="@date", + pattern=re.compile(_iso_date_pattern + r"(:?|\s*\(date\s+of\s+creation\))"), + ), + LineRequirement( + tag_name="@updated", + pattern=re.compile( + _iso_date_pattern + r"(:?|\s*\(date\s+of\s+last\s+update\))" + ), + ), + LineRequirement( + tag_name="@version", + pattern=re.compile(r"v((\d{1,}|x)\.(\d{1,}|y)\.(\d{1,}|z))"), + ), + LineRequirement(tag_name="@ingroup", pattern=re.compile(r"\S.*")), + LineRequirement(tag_name="@prefix", pattern=re.compile(r"\S.*")), + LineRequirement.empty_line(), + LineRequirement(tag_name="@brief", pattern=re.compile(r"\S.*"), multiline=True), + # Do not add an empty line here, because previous is a multiline comment, + # which itself allows empty line already + LineRequirement( + tag_name="@details", pattern=re.compile(r"\S.*"), multiline=True + ), + LineRequirement(prefix=" */", tag_name=None), + ] + """List of tags to appear inside the comment. The exact order of this list + will be enforced. Each entry consists of a pair of 'tag' and regular + expression restricting allowed values for the tag. Only a single line of text + is allowed for each tag.""" + + _rule_description = """ +

Each file should begin with a header comment. The + header comment should be in doxygen format and contain a defined list + of tags in an exact order. See option required_tags.

+ """ + + _message_descriptions = { + "no_header_comment": "No Doxygen file header comment found", + "first_comment_is_not_header_comment": "The only comment before the first source code token is not a correct file comment. Add license header to get detailed message", + "wrong_prefix": "Line should start with prefix '{prefix}'", + "wrong_tag": "Expected tag '{tag}'", + "wrong_value": "Value of tag '{tag}' does not match expected regex '{pattern}'", + "unmatched": "Unexpected text in comment", + "not_doxygen_comment": "Expect a Doxygen comment here", + "content_missing": "Unexpected end of comment", + "tags_missing": "Missing tags in comment: {}", + } + + def get_inputs(self, ctx): + return ir.Graph, comments.comment_cache_work_item(ctx) + + @staticmethod + def header_comments( + ir_graph: ir.Graph, + file_node_kinds: typing.Iterable[ir.PIR_Class_Name], + lang: excludes.Language, + cached_comments: typing.Dict[ir.Node, typing.List[comments.CachedComment]], + ) -> typing.Iterable[ + typing.Tuple[ + ir.Node, + typing.Optional[comments.CachedComment], + typing.Optional[comments.CachedComment], + ] + ]: + selected_files = set() + if lang: + selected_files = set( + node.Parent + for node in files_by_language.files_by_language(ir_graph, lang) + ) + + def is_of_language(filenode): + return not lang or filenode in selected_files + + if cached_comments is not None: + for src_file in cached_comments: + if src_file.is_of_type(file_node_kinds) and is_of_language(src_file): + license_header = None + file_header = None + for comment in cached_comments[src_file]: + if comment.at_beginning: + if license_header is None: + license_header = comment + elif file_header is None: + file_header = comment + break + yield src_file, license_header, file_header + + def execute(self, ir_graph, cached_comments): + for src_file, license_comment, header_comment in self.header_comments( + ir_graph=ir_graph, + file_node_kinds=self.file_node_kinds, + lang=self.languages, + cached_comments=cached_comments, + ): + if license_comment is None: + self.add_message(msg_key="no_header_comment", primary_sloc=src_file) + elif header_comment is None: + if not self.verify(comment=license_comment, silent=True): + self.add_message( + msg_key="first_comment_is_not_header_comment", + primary_sloc=src_file, + ) + else: + self.verify(comment=header_comment) + + def verify_license(self, comment: comments.CachedComment) -> bool: + comment_stream = io.StringIO(initial_value=comment.Value) + line_no = 0 + pattern_no = -1 + for line_str in comment_stream: + if line_no == 0: + line_no = comment.line() + column_no = comment.column() + else: + line_no += 1 + column_no = 1 + pattern_no += 1 + line_str = line_str.splitlines(keepends=False)[0] + match = self.license_comment[pattern_no].fullmatch(line_str) + if not match: + self.add_message( + msg_key="license_incorrect", + primary_sloc=MessageSLoc( + filename=comment.filename(), line=line_no, column=column_no + ), + ) + pattern_no = None + return False + if pattern_no is not None and pattern_no + 1 < len(self.license_comment): + self.add_message( + msg_key="license_short", + primary_sloc=MessageSLoc( + filename=comment.filename(), + line=comment.End_Line, + column=comment.End_Column, + ), + ) + return False + return True + + def verify(self, comment: comments.CachedComment, silent: bool = False): + comment_stream = io.StringIO(initial_value=comment.Value) + line_no = 0 + filename = comment.filename() + issue_key: typing.Optional[str] = None + issue_arguments = None + slocs: typing.List[MessageSLoc] = list() + pattern_no = -1 + continuation: typing.Optional[LineRequirement] = None + for line_str in comment_stream: + line_str = line_str.rstrip() + if line_no == 0: + line_no = comment.line() + else: + line_no += 1 + match = ( + RequirementMatchResult() + if continuation is None + else continuation.match(line=line_str) + ) + if match: + continuation = match.continue_option + else: + pattern_no += 1 + if pattern_no >= len(self.required_tags): + break + # required should be configured up to the end of the comment + match = self.required_tags[pattern_no].match(line_str) + if match: + continuation = match.continue_option + else: + if issue_key is None: + if pattern_no == 0 and match.state == MatchResult.wrong_prefix: + issue_key = "not_doxygen_comment" + column_no = 1 + slocs = [ + MessageSLoc( + filename=filename, line=line_no, column=column_no + ) + ] + break + elif pattern_no + 1 < len( + self.required_tags + ) and self.required_tags[-1].match(line_str): + issue_key = "content_missing" + else: + issue_key = match.state.name + issue_arguments = self.required_tags[ + pattern_no + ].expected_arguments() + if match.state == MatchResult.wrong_prefix: + column_no = 1 + elif match.state == MatchResult.wrong_tag: + column_no = match.tag_index + 1 + elif match.state == MatchResult.wrong_value: + column_no = match.value_index + 1 + else: + column_no = 1 + slocs.append( + MessageSLoc(filename=filename, line=line_no, column=column_no) + ) + + if issue_key is None and pattern_no + 1 < len(self.required_tags): + issue_key = "content_missing" + if issue_key is not None and not silent: + if issue_key == "content_missing": + end_sloc = MessageSLoc( + line=comment.End_Line, + column=comment.End_Column, + filename=comment.filename(), + ) + missing_tags: typing.List[str] = list( + expected.tag_name + for expected in filter( + lambda e: e.tag_name and e.match_tag, + self.required_tags[pattern_no:], + ) + ) + if len(missing_tags) > 0: + self.add_message( + msg_key="tags_missing", + primary_sloc=end_sloc, + message_arguments=(", ".join(missing_tags),), + ) + else: + self.add_message( + msg_key="content_missing", + primary_sloc=end_sloc, + ) + else: + self.add_message( + msg_key=issue_key, + message_arguments=issue_arguments, + primary_sloc=slocs[0], + secondary_slocs=slocs[1:], + ) + return issue_key is None diff --git a/tests/axivion/addon/file_encoding_check.py b/tests/axivion/addon/file_encoding_check.py new file mode 100644 index 00000000..314cfc13 --- /dev/null +++ b/tests/axivion/addon/file_encoding_check.py @@ -0,0 +1,223 @@ +# Copyright (c) 2022, Axivion GmbH +# All rights reserved. +# +# 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®" + + +import fnmatch +import typing +from enum import Enum, auto +from pathlib import Path + +from bauhaus import analysis, ir +from bauhaus.analysis import config +from bauhaus.ir.common.output import unparse + +from . import iisb_base + + +class EncodingEnum(Enum): + ascii = auto() + big5 = auto() + big5hkscs = auto() + cp037 = auto() + cp273 = auto() + cp424 = auto() + cp437 = auto() + cp500 = auto() + cp720 = auto() + cp737 = auto() + cp775 = auto() + cp850 = auto() + cp852 = auto() + cp855 = auto() + cp856 = auto() + cp857 = auto() + cp858 = auto() + cp860 = auto() + cp861 = auto() + cp862 = auto() + cp863 = auto() + cp864 = auto() + cp865 = auto() + cp866 = auto() + cp869 = auto() + cp874 = auto() + cp875 = auto() + cp932 = auto() + cp949 = auto() + cp950 = auto() + cp1006 = auto() + cp1026 = auto() + cp1125 = auto() + cp1140 = auto() + cp1250 = auto() + cp1251 = auto() + cp1252 = auto() + cp1253 = auto() + cp1254 = auto() + cp1255 = auto() + cp1256 = auto() + cp1257 = auto() + cp1258 = auto() + euc_jp = auto() + euc_jis_2004 = auto() + euc_jisx0213 = auto() + euc_kr = auto() + gb2312 = auto() + gbk = auto() + gb18030 = auto() + hz = auto() + iso2022_jp = auto() + iso2022_jp_1 = auto() + iso2022_jp_2 = auto() + iso2022_jp_2004 = auto() + iso2022_jp_3 = auto() + iso2022_jp_ext = auto() + iso2022_kr = auto() + latin_1 = auto() + iso8859_2 = auto() + iso8859_3 = auto() + iso8859_4 = auto() + iso8859_5 = auto() + iso8859_6 = auto() + iso8859_7 = auto() + iso8859_8 = auto() + iso8859_9 = auto() + iso8859_10 = auto() + iso8859_11 = auto() + iso8859_13 = auto() + iso8859_14 = auto() + iso8859_15 = auto() + iso8859_16 = auto() + johab = auto() + koi8_r = auto() + koi8_t = auto() + koi8_u = auto() + kz1048 = auto() + mac_cyrillic = auto() + mac_greek = auto() + mac_iceland = auto() + mac_latin2 = auto() + mac_roman = auto() + mac_turkish = auto() + ptcp154 = auto() + shift_jis = auto() + shift_jis_2004 = auto() + shift_jisx0213 = auto() + utf_32 = auto() + utf_32_be = auto() + utf_32_le = auto() + utf_16 = auto() + utf_16_be = auto() + utf_16_le = auto() + utf_7 = auto() + utf_8 = auto() + utf_8_sig = auto() + + +@analysis.rule("IISB-FileEncodingCheck") +class IisbEncodingRule(iisb_base.IISBRule, analysis.AnalysisRule): + title = """Force Source Files to be decodable with specific encoding.""" + + _rule_description = """ +

All user include and primary files in the project shall be encoded + with a defined encoding (see general_encoding). Exceptions + can be defined in alternative_encoding

+ """ + + _message_descriptions = { + "not_found": "File does not exist, encoding could not be verified", + "could_not_open": "File could not be read, encoding could not be verified due to: {}", + "wrong_encoding": "File does not have required encoding {}", + } + + general_encoding: typing.Union[EncodingEnum, str] = EncodingEnum.utf_8 + """Define a default encoding for all source code files, not mentioned + in alternative_encoding.""" + + alternative_encoding: typing.Dict[ + config.FileGlobPattern, typing.Union[EncodingEnum, str] + ] = dict() + """Define an alternative encoding for certain files.""" + + def execute(self, ir_graph: ir.Graph): + ir_base_path = Path(ir_graph.Basepath) + for file in ir_graph.nodes_of_type( + ir.Physical, ("User_Include_File", "Primary_File") + ): + encoding = self.general_encoding + for pat, enc_str in self.alternative_encoding.items(): + if fnmatch.fnmatch(name=file.Full_Name, pat=pat): + encoding = enc_str + encoding_str = ( + encoding.name if isinstance(encoding, EncodingEnum) else encoding + ) + if not encoding_str: + continue + + path = Path(file.Full_Name) + if not path.exists() and not path.is_absolute(): + # this is necessary if the cwd is not the project root directory + # (e.g. when run by perform_tests) + path = ir_base_path / path + if not path.exists(): + self.add_message( + primary_sloc=file, + msg_key="not_found", + entity=unparse.entity(file), + ) + continue + + try: + with open( + path, encoding=encoding_str, errors="strict", mode="rt" + ) as fd: + for _line in fd: + pass + except OSError as e: + self.add_message( + primary_sloc=file, + msg_key="could_not_open", + message_arguments=(str(e),), + entity=unparse.entity(file), + ) + except ValueError as _: + self.add_message( + primary_sloc=file, + msg_key="wrong_encoding", + message_arguments=(encoding_str,), + entity=unparse.entity(file), + ) diff --git a/tests/axivion/addon/file_license_header.py b/tests/axivion/addon/file_license_header.py new file mode 100644 index 00000000..af3ce686 --- /dev/null +++ b/tests/axivion/addon/file_license_header.py @@ -0,0 +1,200 @@ +# Copyright (c) 2022, Axivion GmbH +# All rights reserved. +# +# 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®" + + +import io +import re +import typing + +from bauhaus import analysis, ir +from bauhaus.ir.common.files import files_by_language +from bauhaus.ir.common.scanner import comments +from bauhaus.shared import MessageSLoc +from bauhaus.style import excludes + +from . import iisb_base + + +@analysis.rule("IISB-FileLicenseComment") +class IisbFileLicenseRule(iisb_base.IISBRule, analysis.AnalysisRule): + title = """Verify license comments in files.""" + + file_node_kinds: typing.Set[ir.PIR_Class_Name] = { + "Primary_File", + "User_Include_File", + } + + license_comment: typing.List[typing.Pattern[str]] = list( + re.compile(re.escape(s)) + for s in """/** + * + * @copyright © 2010 - 2022, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. + * All rights reserved. + * + * 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®″ + * + */""".splitlines( + keepends=False + ) + ) + + _rule_description = """ +

Every file must start with a license header comment, see license_comment. + Exceptions can be configured in the attribute alternative_licenses.

+ """ + + _message_descriptions = { + "no_license_comment": "No license header found", + "license_incorrect": "License header is incorrect", + "license_short": "License header is too short", + } + + def get_inputs(self, ctx): + return ir.Graph, comments.comment_cache_work_item(ctx) + + @staticmethod + def header_comments( + ir_graph: ir.Graph, + file_node_kinds: typing.Iterable[ir.PIR_Class_Name], + lang: excludes.Language, + cached_comments: typing.Dict[ir.Node, typing.List[comments.CachedComment]], + ) -> typing.Iterable[ + typing.Tuple[ + ir.Node, + typing.Optional[comments.CachedComment], + typing.Optional[comments.CachedComment], + ] + ]: + selected_files = set() + if lang: + selected_files = set( + node.Parent + for node in files_by_language.files_by_language(ir_graph, lang) + ) + + def is_of_language(filenode): + return not lang or filenode in selected_files + + if cached_comments is not None: + for src_file in cached_comments: + if src_file.is_of_type(file_node_kinds) and is_of_language(src_file): + for comment in cached_comments[src_file]: + if comment.at_beginning: + yield src_file, comment + break + else: + # have no comment in src_file + yield src_file, None + + def execute(self, ir_graph, cached_comments): + for src_file, license_comment in self.header_comments( + ir_graph=ir_graph, + file_node_kinds=self.file_node_kinds, + lang=self.languages, + cached_comments=cached_comments, + ): + if license_comment is None: + self.add_message(msg_key="no_license_comment", primary_sloc=src_file) + else: + _ok = self.verify_license(comment=license_comment) + + def verify_license(self, comment: comments.CachedComment) -> bool: + comment_stream = io.StringIO(initial_value=comment.Value) + line_no = 0 + pattern_no = -1 + for line_str in comment_stream: + if line_no == 0: + line_no = comment.line() + column_no = comment.column() + else: + line_no += 1 + column_no = 1 + pattern_no += 1 + line_str = line_str.splitlines(keepends=False)[0] + match = self.license_comment[pattern_no].fullmatch(line_str) + if not match: + self.add_message( + msg_key="license_incorrect", + primary_sloc=MessageSLoc( + filename=comment.filename(), line=line_no, column=column_no + ), + ) + pattern_no = None + return False + if pattern_no is not None and pattern_no + 1 < len(self.license_comment): + self.add_message( + msg_key="license_short", + primary_sloc=MessageSLoc( + filename=comment.filename(), + line=comment.End_Line, + column=comment.End_Column, + ), + ) + return False + return True diff --git a/tests/axivion/addon/iisb_base.py b/tests/axivion/addon/iisb_base.py new file mode 100644 index 00000000..8380ccfb --- /dev/null +++ b/tests/axivion/addon/iisb_base.py @@ -0,0 +1,63 @@ +# Copyright (c) 2022, Axivion GmbH +# All rights reserved. +# +# 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®" + + +import typing + +from bauhaus import analysis +from bauhaus.analysis import rule_group + + +class IISBRule(analysis.ConfigurableRule): + languages = {analysis.Language.C, analysis.Language.CPP} + + _rule_description: typing.Optional[str] = None + + def get_rulehtml_description( + self, config: typing.Optional[analysis.RuleConfiguration] = None + ): + if self._rule_description: + return self._rule_description + else: + return super().get_rulehtml_description(config) + + +@analysis.rule("IISB", parent_rulegroup="Stylechecks") +class IISBRuleGroup(rule_group.StyleRuleGroup): + @property + def title(self) -> str: + return "Fraunhofer IISB Styleguide." diff --git a/tests/axivion/addon/literal_suffixes.py b/tests/axivion/addon/literal_suffixes.py new file mode 100644 index 00000000..7b3a5373 --- /dev/null +++ b/tests/axivion/addon/literal_suffixes.py @@ -0,0 +1,187 @@ +# Copyright (c) 2022, Axivion GmbH +# All rights reserved. +# +# 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®" + + +import re +import typing + +from bauhaus import analysis, ir +from bauhaus.ir.common.preprocessor import preprocessor_ifs +from bauhaus.ir.common.scanner import literals +from bauhaus.ir.common.types import integer_types + +from . import iisb_base + + +@analysis.rule("IISB-LiteralSuffixesCheck") +class IisbLiteralSuffixesRule(iisb_base.IISBRule, analysis.AnalysisRule): + title = """Force Source Files to be decodable with specific encoding.""" + + _message_descriptions = { + "expect_no_literal_suffix": "Literal constant should have no suffix", + "unexpected_int_literal_suffix": 'Integer literal constant of size {} requires "{}" suffix', + "unexpected_float_literal_suffix": 'Floating point literal constant of size {} requires "{}" suffix', + "wrong_casing_in_literal_suffix": 'Literal constant suffix has wrong casing, please use "{}"', + } + + _rule_description = """ +

Force literal suffixes for numerical assignment + (force LL for int64 and force it to be uppercase, + force lowercase u for unsigned, force lowercase f for float, …)

+
    +
  • int64_t: LL
  • +
  • uintX_t: u
  • +
  • uint64_t: uLL
  • +
  • float: f
  • +
+ """ + + consider_int_sign_conversion = False + """Selects whether literals with an implicit conversion from signed to unsigned are reported.""" + + consider_pp_expressions = False + """Whether literals in #if conditions are checked.""" + + unsigned_int_suffixes: typing.Dict[int, str] = {8: "u", 16: "u", 32: "u", 64: "uLL"} + """Mapping of bit-size of unsigned int types to expected suffixes for literals + of the corresponding type.""" + + signed_int_suffixes: typing.Dict[int, str] = {8: "", 16: "", 32: "", 64: "LL"} + """Mapping of bit-size of signed int types to expected suffixes for literals + of the corresponding type.""" + + float_suffixes: typing.Dict[int, str] = {32: "f", 64: ""} + """Mapping of bit-size of floating point types to expected suffixes for literals + of or immediately converted to the corresponding type.""" + + def check_suffix( + self, node: ir.Node, suffix: str, expected_suffix: str, size: int, type_str: str + ): + if suffix != expected_suffix: + if expected_suffix == "": + self.add_message( + msg_key="expect_no_literal_suffix", + entity=node.External_Form, + primary_sloc=node, + ) + elif suffix.lower() != expected_suffix.lower(): + self.add_message( + msg_key=f"unexpected_{type_str}_literal_suffix", + message_arguments=(size, expected_suffix), + entity=node.External_Form, + primary_sloc=node, + ) + else: + self.add_message( + msg_key="wrong_casing_in_literal_suffix", + message_arguments=(expected_suffix,), + entity=node.External_Form, + primary_sloc=node, + ) + + _hex_literal_pattern: typing.Pattern[str] = re.compile( + ( + r"(" + r"(0[xX](?P['0-9A-Fa-f]+(\.['0-9A-Fa-f]+)?)(?P[pP][-+]?['0-9]+))" + r"|" + r"((?P['0-9]+(\.['0-9]+)?)(?P[eE][-+]?['0-9]+)?)" + r")" + r"(?P[fFlL])?" + ) + ) + + def get_floating_point_suffix(self, text: str): + match = self._hex_literal_pattern.fullmatch(text.strip()) + if match: + suffix = match["suffix"] + if suffix is not None: + return suffix + return "" + + def execute(self, ir_graph: ir.Graph): + for node in ir_graph.nodes_of_type( + ir.Physical, + "Floating_Point_Literal", + lambda n: n.Position and n.External_Form, + ): + suffix = self.get_floating_point_suffix(node.External_Form) + its_type = node.Its_Type.skip_typedefs(True) + if node.Parent.is_of_type("Conversion"): + parent_type = node.Parent.Its_Type.skip_typedefs(True) + if parent_type.is_of_type("Floating_Point_Type"): + its_type = parent_type + size = its_type.Size_In_Bits + self.check_suffix( + node=node, + suffix=suffix, + expected_suffix=self.float_suffixes.get(size, ""), + size=size, + type_str="float", + ) + for node in ir_graph.nodes_of_type( + ir.Physical, + "Integer_Literal", + lambda n: ( + n.Position + and n.External_Form + and (self.consider_pp_expressions or not preprocessor_ifs.is_pp_expr(n)) + ), + ): + suffix = literals.get_suffix(node) + its_type = node.Its_Type.skip_typedefs(True) + if ( + not integer_types.is_unsigned(its_type) + and ( + self.consider_int_sign_conversion + and node.Parent.is_of_type("Conversion") + and integer_types.is_unsigned(node.Parent.Its_Type) + ) + and not node.Parent.is_of_type("Bit_Field_Definition") + ): + its_type = node.Parent.Its_Type.skip_typedefs(True) + size = its_type.Size_In_Bits + self.check_suffix( + node=node, + suffix=suffix, + expected_suffix=( + self.unsigned_int_suffixes.get(size, "") + if integer_types.is_unsigned(its_type) + else self.signed_int_suffixes.get(size, "") + ), + size=size, + type_str="int", + ) diff --git a/tests/axivion/addon/unique_filenames.py b/tests/axivion/addon/unique_filenames.py new file mode 100644 index 00000000..e378cb90 --- /dev/null +++ b/tests/axivion/addon/unique_filenames.py @@ -0,0 +1,84 @@ +# Copyright (c) 2022, Axivion GmbH +# All rights reserved. +# +# 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®" + + +import typing +from collections import defaultdict +from pathlib import Path + +from bauhaus import analysis, ir +from bauhaus.ir.common.algorithms import symbol_declarations +from bauhaus.ir.common.output import unparse + +from . import iisb_base + + +@analysis.rule("IISB-UniqueFileNameCheck") +class IisbUniqueFileNameRule(iisb_base.IISBRule, analysis.AnalysisRule): + title = """Report equally named files in a project.""" + + ignore_casing: bool = True + """Treat file names that differ only in casing as equal""" + + _rule_description = """ +

No two user-defined files in a project should have the same base name.

+ """ + + _message_descriptions = { + "not_unique": "File names are too similar", + } + + def execute(self, ir_graph: ir.Graph): + all_files: typing.DefaultDict[str, typing.List[ir.Node]] = defaultdict(list) + for file in ir_graph.nodes_of_type(ir.Physical, "File"): + name = Path(file.Full_Name).name + if self.ignore_casing: + name = name.lower() + all_files[name].append(file) + for bucket in filter(lambda b: len(b) > 1, all_files.values()): + bucket = list(symbol_declarations.sort_by_position(bucket)) + for i, file in enumerate(bucket): + # do not report system include files as primary sloc as we probably cannot change them + if file.is_of_type( + ("Primary_File", "Preinclude_File", "User_Include_File") + ): + self.add_message( + msg_key="not_unique", + primary_sloc=file, + secondary_slocs=bucket[:i] + bucket[i + 1 :], + entity=unparse.entity(file), + ) diff --git a/tests/axivion/axivion_config.json b/tests/axivion/axivion_config.json index 4c05d766..d83c87a3 100644 --- a/tests/axivion/axivion_config.json +++ b/tests/axivion/axivion_config.json @@ -7,6 +7,9 @@ "rule_config_c.json", "rule_config_names.py", "rule_config_names.json", - "rule_config_include_guard.py" + "rule_config_include_guard.py", + "rule_config_bad_tokens.json", + "rule_config_metric_lines.json", + "rule_config_addon.json" ] } diff --git a/tests/axivion/ci_config.json b/tests/axivion/ci_config.json index 48281976..9103614e 100644 --- a/tests/axivion/ci_config.json +++ b/tests/axivion/ci_config.json @@ -4,6 +4,7 @@ "global_excludes": [ "C:/ti/*", "*src/app/driver/afe/ltc/common/ltc_pec.*", + "*src/app/driver/afe/nxp/mc33775a/vendor/*", "*src/app/driver/sbc/fs8x_driver/*", "*src/hal/*", "*src/os/*" @@ -45,12 +46,12 @@ "*.[ch]" ], "rootpath": "build/axivion/src/app/main", - "shadow_directory": "$(builtin:AXIVION_CONFDIR)/../../build/axivion/src/app/main" + "shadow_directory": "$(env:projectShadowRepo)" } }, "Results": { "Dashboard": { - "dashboard_url": "$(env:AXIVION_DASHBOARD_URL=https://axivion-dash.iisb.fraunhofer.de/axivion)" + "dashboard_url": "$(env:AXIVION_DASHBOARD_URL=)" }, "Database": { "ci_mode": { diff --git a/tests/axivion/compiler_config.json b/tests/axivion/compiler_config.json index fc30e047..3bbf27ad 100644 --- a/tests/axivion/compiler_config.json +++ b/tests/axivion/compiler_config.json @@ -32,10 +32,9 @@ "variadic_macros": "enabled" }, "language_version": "C11", - "native_compiler": "C:\\ti\\ccs1100\\ccs\\tools\\compiler\\ti-cgt-arm_20.2.5.LTS\\bin\\armcl.exe", + "native_compiler": "C:\\ti\\ccs1100\\ccs\\tools\\compiler\\ti-cgt-arm_20.2.5.LTS\\bin\\armcl.EXE", "preprocessing": { "predefined_macros": { - "_INLINE": "1", "_OPTIMIZE_FOR_SPACE": "1", "__32bis__": "1", "__ARM_32BIT_STATE": "1", @@ -82,7 +81,10 @@ "__SIZEOF_WCHAR_T__": "2", "__SIZEOF_WINT_T__": "2", "__SIZE_T_TYPE__": "unsigned", + "__STDC_HOSTED__": "1", "__STDC_NO_THREADS__": "1", + "__STDC_UTF_16__": "1", + "__STDC_UTF_32__": "1", "__TI_ARM_V7R4__": "1", "__TI_ARM_V7R5__": "1", "__TI_ARM_V7__": "1", @@ -94,7 +96,7 @@ "__TI_EABI_SUPPORT__": "1", "__TI_EABI__": "1", "__TI_GNU_ATTRIBUTE_SUPPORT__": "1", - "__TI_STRICT_ANSI_MODE__": "0", + "__TI_STRICT_ANSI_MODE__": "1", "__TI_STRICT_FP_MODE__": "1", "__TI_TMS470_V7R4__": "1", "__TI_TMS470_V7R5__": "1", @@ -112,12 +114,111 @@ "sys_include_envvar": null, "sys_include_path": [ "C:\\ti\\ccs1100\\ccs\\tools\\compiler\\ti-cgt-arm_20.2.5.LTS\\include" - ] + ], + "user_include_path": [] } }, - "language_c.command.#": "C:\\ti\\ccs1100\\ccs\\tools\\compiler\\ti-cgt-arm_20.2.5.LTS\\bin\\armcl.exe", + "language_c.command.#": "C:\\ti\\ccs1100\\ccs\\tools\\compiler\\ti-cgt-arm_20.2.5.LTS\\bin\\armcl.EXE --silicon_version=7R5 --code_state=32 --float_support=VFPv3D16 -g --diag_wrap=off --display_error_number --enum_type=packed --abi=eabi --c11 -Ooff --issue_remarks --strict_ansi", "language_c.info.#": "20.2.5\n", + "language_cxx": { + "features": { + "exceptions": false, + "runtime_type_information": false + }, + "language_version": "Cpp14", + "native_compiler": "C:\\ti\\ccs1100\\ccs\\tools\\compiler\\ti-cgt-arm_20.2.5.LTS\\bin\\armcl.EXE", + "preprocessing": { + "predefined_macros": { + "_BOOL": "1", + "_OPTIMIZE_FOR_SPACE": "1", + "_WCHAR_T": "1", + "__32bis__": "1", + "__ARM_32BIT_STATE": "1", + "__ARM_ACLE": "200", + "__ARM_ARCH": "7", + "__ARM_ARCH_ISA_ARM": "1", + "__ARM_ARCH_ISA_THUMB": "2", + "__ARM_ARCH_PROFILE": "82", + "__ARM_BIG_ENDIAN": "1", + "__ARM_FEATURE_CLZ": "1", + "__ARM_FEATURE_DSP": "1", + "__ARM_FEATURE_LDREX": "15", + "__ARM_FEATURE_SAT": "1", + "__ARM_FEATURE_SIMD32": "1", + "__ARM_FEATURE_UNALIGNED": "1", + "__ARM_FP": "12", + "__ARM_FP16_ARGS": "1", + "__ARM_FP16_FORMAT_IEEE": "1", + "__ARM_PCS": "1", + "__ARM_PCS_VFP": "1", + "__ARM_SIZEOF_MINIMAL_ENUM": "1", + "__ARM_SIZEOF_WCHAR_T": "2", + "__ARRAY_OPERATORS": "1", + "__BIG_ENDIAN__": "1", + "__CHAR16_T_AND_CHAR32_T": "1", + "__CHAR_BIT__": "8", + "__COMPILER_VERSION__": "20002005", + "__EDG_VERSION__": "413", + "__ELF__": "1", + "__INT_MAX__": "2147483647", + "__LONG_LONG_MAX__": "9223372036854775807", + "__LONG_MAX__": "2147483647", + "__PLACEMENT_DELETE": "1", + "__PRAGMA_REDEFINE_EXTNAME": "1", + "__PTRDIFF_T_TYPE__": "int", + "__SCHAR_MAX__": "127", + "__SHRT_MAX__": "32767", + "__SIZEOF_DOUBLE__": "8", + "__SIZEOF_FLOAT__": "4", + "__SIZEOF_INT__": "4", + "__SIZEOF_LONG_DOUBLE__": "8", + "__SIZEOF_LONG_LONG__": "8", + "__SIZEOF_LONG__": "4", + "__SIZEOF_PTRDIFF_T__": "4", + "__SIZEOF_SHORT__": "2", + "__SIZEOF_SIZE_T__": "4", + "__SIZEOF_WCHAR_T__": "2", + "__SIZEOF_WINT_T__": "2", + "__SIZE_T_TYPE__": "unsigned", + "__STDC_HOSTED__": "1", + "__TI_ARM_V7R4__": "1", + "__TI_ARM_V7R5__": "1", + "__TI_ARM_V7__": "1", + "__TI_ARM__": "1", + "__TI_C99_COMPLEX_ENABLED__": "1", + "__TI_COMPILER_VERSION_QUAL_ID__": "21103", + "__TI_COMPILER_VERSION_QUAL__": "QUAL_LETTER", + "__TI_COMPILER_VERSION__": "20002005", + "__TI_EABI_SUPPORT__": "1", + "__TI_EABI__": "1", + "__TI_GNU_ATTRIBUTE_SUPPORT__": "1", + "__TI_STRICT_ANSI_MODE__": "1", + "__TI_STRICT_FP_MODE__": "1", + "__TI_TMS470_V7R4__": "1", + "__TI_TMS470_V7R5__": "1", + "__TI_TMS470_V7__": "1", + "__TI_VFPV3D16_SUPPORT__": "1", + "__TI_VFP_SUPPORT__": "1", + "__TI_WCHAR_T_BITS__": "16", + "__TMS470__": "1", + "__VARIADIC_TEMPLATES": "1", + "__WCHAR_T_TYPE__": "unsigned short", + "__big_endian__": "1", + "__eabi__": "1", + "__edg_front_end__": "1", + "__unsigned_chars__": "1" + }, + "sys_include_path": [ + "C:\\ti\\ccs1100\\ccs\\tools\\compiler\\ti-cgt-arm_20.2.5.LTS\\include\\libcxx", + "C:\\ti\\ccs1100\\ccs\\tools\\compiler\\ti-cgt-arm_20.2.5.LTS\\include" + ], + "user_include_path": [] + } + }, + "language_cxx.command.#": "C:\\ti\\ccs1100\\ccs\\tools\\compiler\\ti-cgt-arm_20.2.5.LTS\\bin\\armcl.EXE --silicon_version=7R5 --code_state=32 --float_support=VFPv3D16 -g --diag_wrap=off --display_error_number --enum_type=packed --abi=eabi --c11 -Ooff --issue_remarks --strict_ansi", + "language_cxx.info.#": "20.2.5\n", "linker": { + "library_path": [], "advanced": { "ignore_input_files": { "$(delta:+)": [ @@ -382,7 +483,7 @@ "parameter_mode": "mandatory_immediate" }, "-o": { - "action": "IgnoreSwitch", + "action": "OutputFile", "parameter_mode": "mandatory_space_or_immediate" }, "-qq": { diff --git a/tests/axivion/config-test/.clang-format b/tests/axivion/config-test/.clang-format new file mode 100644 index 00000000..ae7fad80 --- /dev/null +++ b/tests/axivion/config-test/.clang-format @@ -0,0 +1,178 @@ +Language: Cpp +AccessModifierOffset: -2 +AlignAfterOpenBracket: AlwaysBreak +AlignArrayOfStructures: None # clang-bug +AlignConsecutiveMacros: Consecutive +AlignConsecutiveAssignments: true +AlignConsecutiveBitFields: Consecutive +AlignConsecutiveDeclarations: false +AlignEscapedNewlines: Left +AlignOperands: Align +AlignTrailingComments: true +AllowAllArgumentsOnNextLine: true +AllowAllConstructorInitializersOnNextLine: true +AllowAllParametersOfDeclarationOnNextLine: false +AllowShortBlocksOnASingleLine: false +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: InlineOnly +AllowShortLambdasOnASingleLine: All +AllowShortIfStatementsOnASingleLine: false +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: false +AlwaysBreakTemplateDeclarations: MultiLine +AttributeMacros: [] +BinPackArguments: false +BinPackParameters: false +BraceWrapping: + AfterCaseLabel: false + AfterClass: false + AfterControlStatement: Never + AfterEnum: false + AfterFunction: false + AfterNamespace: false + AfterObjCDeclaration: false + AfterStruct: false + AfterUnion: false + AfterExternBlock: false + BeforeCatch: false + BeforeElse: false + BeforeLambdaBody: false + BeforeWhile: false + IndentBraces: false + SplitEmptyFunction: true + SplitEmptyRecord: true + SplitEmptyNamespace: true +BreakBeforeBinaryOperators: None +BreakBeforeConceptDeclarations: true +BreakBeforeBraces: Attach +BreakBeforeInheritanceComma: false +BreakInheritanceList: BeforeColon +BreakBeforeTernaryOperators: true +BreakConstructorInitializersBeforeComma: false +BreakConstructorInitializers: BeforeColon +BreakAfterJavaFieldAnnotations: false +BreakStringLiterals: true +ColumnLimit: 120 +CommentPragmas: "^ IWYU pragma:" +CompactNamespaces: false +ConstructorInitializerAllOnOneLineOrOnePerLine: false +ConstructorInitializerIndentWidth: 4 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: true +DeriveLineEnding: true +DerivePointerAlignment: false +DisableFormat: false +EmptyLineAfterAccessModifier: Never +EmptyLineBeforeAccessModifier: LogicalBlock +ExperimentalAutoDetectBinPacking: false +FixNamespaceComments: true +ForEachMacros: [] +IfMacros: [] +IncludeBlocks: Regroup +IncludeCategories: + - Regex: '^"(general\.h)"$' + Priority: -1 + SortPriority: -1 + - Regex: '^"ltc_defs.h"$' + Priority: 5 + SortPriority: 5 + - Regex: '^"(Mock).*' + Priority: 0 + SortPriority: 4 + - Regex: '^"(.*)_cfg.h"$' + Priority: 5 + SortPriority: 7 + - Regex: '^"(unity)' + Priority: 0 + SortPriority: 2 + - Regex: '^"HL_.*' + Priority: 10 + SortPriority: 10 + - Regex: '^"ti_.*' + Priority: 10 + SortPriority: 12 + - Regex: '^"(FreeRTOS)' + Priority: 15 + SortPriority: 15 + - Regex: '^"(atomic|croutine|event_groups|message_buffer|queue|semphr|stream_buffer|task|timers)\.h' + Priority: 15 + SortPriority: 17 + - Regex: '".*"' + Priority: 20 + SortPriority: 20 +IncludeIsMainRegex: "(_cfg)?$" +IncludeIsMainSourceRegex: "" +IndentAccessModifiers: false +IndentCaseLabels: true +IndentCaseBlocks: false +IndentGotoLabels: true +IndentPPDirectives: None +IndentExternBlock: AfterExternBlock +IndentRequires: false +IndentWidth: 4 +IndentWrappedFunctionNames: true +InsertTrailingCommas: None +JavaScriptQuotes: Leave +JavaScriptWrapImports: true +KeepEmptyLinesAtTheStartOfBlocks: false +LambdaBodyIndentation: Signature +MacroBlockBegin: "" +MacroBlockEnd: "" +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: None +ObjCBinPackProtocolList: Auto +ObjCBlockIndentWidth: 2 +ObjCBreakBeforeNestedBlockParam: true +ObjCSpaceAfterProperty: false +ObjCSpaceBeforeProtocolList: true +PenaltyBreakAssignment: 20 +PenaltyBreakBeforeFirstCallParameter: 19 +PenaltyBreakComment: 300 +PenaltyBreakFirstLessLess: 120 +PenaltyBreakString: 1000 +PenaltyBreakTemplateDeclaration: 10 +PenaltyExcessCharacter: 1000000 +PenaltyReturnTypeOnItsOwnLine: 100000 +PenaltyIndentedWhitespace: 0 +PointerAlignment: Right +PPIndentWidth: -1 +ReferenceAlignment: Pointer +ReflowComments: false +ShortNamespaceLines: 1 +SortIncludes: CaseSensitive +SortJavaStaticImport: Before +SortUsingDeclarations: true +SpaceAfterCStyleCast: false +SpaceAfterLogicalNot: false +SpaceAfterTemplateKeyword: true +SpaceBeforeAssignmentOperators: true +SpaceBeforeCaseColon: false +SpaceBeforeCpp11BracedList: false +SpaceBeforeCtorInitializerColon: true +SpaceBeforeInheritanceColon: true +SpaceBeforeParens: ControlStatements +SpaceAroundPointerQualifiers: Default +SpaceBeforeRangeBasedForLoopColon: true +SpaceInEmptyBlock: false +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 2 +SpacesInAngles: Never +SpacesInConditionalStatement: false +SpacesInContainerLiterals: true +SpacesInCStyleCastParentheses: false +SpacesInLineCommentPrefix: + Minimum: 1 + Maximum: -1 +SpacesInParentheses: false +SpacesInSquareBrackets: false +SpaceBeforeSquareBrackets: false +BitFieldColonSpacing: Both +Standard: Latest +StatementAttributeLikeMacros: [] +StatementMacros: [] +TabWidth: 4 +UseCRLF: true +UseTab: Never +WhitespaceSensitiveMacros: [] diff --git a/tests/axivion/config-test/run_axivion_config_tests.bat b/tests/axivion/config-test/run_axivion_config_tests.bat new file mode 100644 index 00000000..1ba762b5 --- /dev/null +++ b/tests/axivion/config-test/run_axivion_config_tests.bat @@ -0,0 +1,78 @@ +@REM Copyright (c) 2010 - 2022, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. +@REM All rights reserved. +@REM +@REM SPDX-License-Identifier: BSD-3-Clause +@REM +@REM Redistribution and use in source and binary forms, with or without +@REM modification, are permitted provided that the following conditions are met: +@REM +@REM 1. Redistributions of source code must retain the above copyright notice, this +@REM list of conditions and the following disclaimer. +@REM +@REM 2. Redistributions in binary form must reproduce the above copyright notice, +@REM this list of conditions and the following disclaimer in the documentation +@REM and/or other materials provided with the distribution. +@REM +@REM 3. Neither the name of the copyright holder nor the names of its +@REM contributors may be used to endorse or promote products derived from +@REM this software without specific prior written permission. +@REM +@REM THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +@REM AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +@REM IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +@REM DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +@REM FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +@REM DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +@REM SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +@REM CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +@REM OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +@REM OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +@REM +@REM We kindly request you to use one or more of the following phrases to refer to +@REM foxBMS in your hardware, software, documentation or advertising materials: +@REM +@REM - "This product uses parts of foxBMS®" +@REM - "This product includes parts of foxBMS®" +@REM - "This product is derived from foxBMS®" + +@setlocal enableextensions enabledelayedexpansion + +@pushd %~dp0 +@CALL :NORMALIZEPATH "%~dp0\..\ +@SET BAUHAUS_CONFIG=%NORMALIZED_PATH% +@ECHO Setting 'BAUHAUS_CONFIG' to '%BAUHAUS_CONFIG%' + +@for /f "tokens=*" %%s in (%~dp0..\..\..\conf\env\paths_win32.txt) do @( + @echo %%s | findstr /i "bauhaus">nul && (@SET BAUHAUS_DIR=%%s) +) + +@REM preferr the perform_tests.exe that is found on PATH +@SET TEST_EXE=perform_tests.exe +@ECHO Seraching program '%TEST_EXE%' +@WHERE %TEST_EXE% 1>NUL 2>NUL +@IF %ERRORLEVEL% neq 0 ( + @ECHO '%TEST_EXE%' is not in %%PATH%% + @SET TEST_RUNNER=%BAUHAUS_DIR%\%TEST_EXE% +) ELSE ( + @SET TEST_RUNNER=%TEST_EXE% +) + +@IF exist %TEST_RUNNER% ( + @ECHO Using '%TEST_RUNNER%' +) ELSE ( + @WHERE %TEST_EXE% 1>NUL 2>NUL + @IF %ERRORLEVEL% neq 0 ( + @ECHO Could not find program '%TEST_RUNNER%' + @EXIT /b 1 + ) +) +@echo Found '%TEST_RUNNER%' +@%TEST_RUNNER% test_*.c* test_*/test_*.c* +@SET TEST_RUNNER_EXIT_LEVEL=%ERRORLEVEL% +@SET BAUHAUS_CONFIG= +@popd +@EXIT /B %ERRORLEVEL% + +:NORMALIZEPATH + @SET NORMALIZED_PATH=%~dpfn1 + @EXIT /B diff --git a/tests/axivion/config-test/test_macro-names.c b/tests/axivion/config-test/test_macro-names.c new file mode 100644 index 00000000..03faa6e9 --- /dev/null +++ b/tests/axivion/config-test/test_macro-names.c @@ -0,0 +1,15 @@ +/* + * @prefix TEST + */ + +// test: analysis(['CodingStyle-Naming.Macro']) + +#include "test_macro-names.h" +#define TEST_HALLO /* valid prefix, casing -> good */ +#define TEST_HALLO_ms /* valid prefix, casing and suffix -> good */ +#define MACRO_MISSIS_PREFIX /* must fail */ +#define macro_has_bad_casing /* must fail */ + +// test: TESTCASE.add_expected_stdout("test_macro-names.c:10:9: error: The macro name is not 'ALL_CAPS'. [MACRO_MISSIS_PREFIX] (Rule CodingStyle-Naming.Macro)") +// test: TESTCASE.add_expected_stdout("test_macro-names.c:11:9: error: Macro names shall use the naming convention '(prefix.upper())_ALL_CAPS' (and optional unit suffix preceded by _) or for include guards 'FOXBMS__FILENAME_H_'. [macro_has_bad_casing] (Rule CodingStyle-Naming.Macro)") +// test: TESTCASE.add_expected_stdout("test_macro-names.c:11:9: error: The macro name is not 'ALL_CAPS'. [macro_has_bad_casing] (Rule CodingStyle-Naming.Macro)") diff --git a/tests/axivion/config-test/test_macro-names.h b/tests/axivion/config-test/test_macro-names.h new file mode 100644 index 00000000..73f4b1a3 --- /dev/null +++ b/tests/axivion/config-test/test_macro-names.h @@ -0,0 +1,8 @@ +/* + * @prefix TEST + */ +// test: analysis(['CodingStyle-Naming.Macro']) + +#ifndef FOXBMS__TEST_MACRO_NAMES_H_ +#define FOXBMS__TEST_MACRO_NAMES_H_ +#endif /* FOXBMS__TEST_MACRO_NAMES_H_*/ diff --git a/tests/axivion/forbidden-violations/forbidden-violations.txt b/tests/axivion/forbidden-violations/forbidden-violations.txt index 0e597eb0..c6560cc2 100644 --- a/tests/axivion/forbidden-violations/forbidden-violations.txt +++ b/tests/axivion/forbidden-violations/forbidden-violations.txt @@ -138,12 +138,54 @@ MisraC2012-22.5 MisraC2012-22.6 # Generic +Generic-CComments +Generic-DoxygenCommentAtDefinition +Generic-DoxygenCommentInHeader +Generic-DuplicateIncludeGuard +Generic-ForbiddenFunctions Generic-IncludeKind +Generic-MaxConditions +Generic-MaxOneStmtPerLine +Generic-MissingIncludeGuard +Generic-MissingOverride +Generic-MissingSelfHeaderInclude +Generic-MixedUpArgumentOrder +Generic-NoAbsoluteInclude +Generic-NoCommaSequence +Generic-NoCompilerWarnings +Generic-NoConditionalOperator +Generic-NoConstCasts Generic-NoConstOnLHS +Generic-NoEllipsis +Generic-NoEmptyStructs +Generic-NoExternInImpl +Generic-NoFunctionDefinitionInHeader +Generic-NoImplicitTypeConversion +Generic-NoIncludePaths +Generic-NoIrregularInclude +Generic-NoLeakingReferenceToLocal +Generic-NoLinkerWarnings +Generic-NoMalloc +Generic-NoReferenceToLocalVariable +Generic-NoSemicolonAtEndOfMacro +Generic-NoSingleCharIdentifier +Generic-NoStaticInHeader +Generic-NoTabs +Generic-NoTrailingWhitespace +Generic-NoUncheckedPointerParamDereference Generic-NoUnsafeMacro +Generic-NoWhitespaceMemberSelection +Generic-TooManyIncludes +Generic-TypedefCheck +Generic-WrongIncludeCasing # CertC +CertC-PRE01 +CertC-PRE04 +CertC-PRE06 +CertC-PRE08 CertC-PRE31 +CertC-PRE02 # Style CodingStyle-FilenameNaming @@ -154,3 +196,11 @@ CodingStyle-NoBlankLinesAtBraces CodingStyle-NoSingleCharIdentifier CodingStyle-NoTabs CodingStyle-NoTrailingWhitespace +CodingStyle-FileExtensionNaming +CodingStyle-FilenameNaming +CodingStyle-MaxOneStmtPerLine +CodingStyle-NoSingleCharIdentifier +CodingStyle-NoWhitespaceMemberSelection +CodingStyle-TooManyIncludes + +Linker-Multiple_Definition diff --git a/tests/axivion/rule_config_addon.json b/tests/axivion/rule_config_addon.json new file mode 100644 index 00000000..1b8823f4 --- /dev/null +++ b/tests/axivion/rule_config_addon.json @@ -0,0 +1,79 @@ +{ + "Analysis": { + "Analysis-GlobalOptions": { + "_additional_rules": [ + "addon" + ] + }, + "IISB-DoxygenCommentAtDeclaration": { + "_active": true + }, + "IISB-DoxygenFileComment": { + "_active": true + }, + "IISB-FileEncodingCheck": { + "_active": true + }, + "IISB-FileLicenseComment": { + "_active": true + }, + "IISB-LiteralSuffixesCheck": { + "_active": true, + "exclude_in_macros": [ + "adcGROUP1", + "adcREG1", + "canREG1", + "canREG2", + "crcREG1", + "dmaRAMREG", + "ecapREG1", + "esmREG", + "etpwmREG1", + "FS8x_C*", + "FS8X_FS_A*", + "FS8X_FS_BAD_*", + "FS8X_FS_C*", + "FS8X_FS_D*", + "FS8X_FS_E*", + "FS8X_FS_FC*", + "FS8X_FS_FS*", + "FS8X_FS_G*", + "FS8X_FS_I*", + "FS8X_FS_LBIST_OK_*", + "FS8X_FS_O*", + "FS8X_FS_R*", + "FS8X_FS_S*", + "FS8X_FS_V*", + "FS8X_FS_WD_*", + "FS8X_FS_WDW_*", + "FS8X_M_*", + "FS8x_WD_SEED_DEFAULT", + "hetREG1", + "hetREG2", + "i2cREG1", + "spiREG1", + "spiREG2", + "spiREG3", + "spiREG4", + "spiREG5", + "SYS_EXCEPTION", + "systemREG1", + "FLT_EPSILON", + "UINT32_MAX", + "RTI_FREQ" + ], + "excludes": [] + }, + "IISB-UniqueFileNameCheck": { + "_active": true + } + }, + "_Format": "1.0", + "_Version": "7.4.0", + "_VersionNum": [ + 7, + 4, + 0, + 9870 + ] +} diff --git a/tests/axivion/rule_config_bad_tokens.json b/tests/axivion/rule_config_bad_tokens.json new file mode 100644 index 00000000..73173dbc --- /dev/null +++ b/tests/axivion/rule_config_bad_tokens.json @@ -0,0 +1,30 @@ +{ + "Analysis": { + "Metric-TokenFileMetric.Check": { + "_active": true + }, + "Metric-TokenFileMetric.Debug": { + "_active": true + }, + "Metric-TokenFileMetric.Fixme": { + "_active": true + }, + "Metric-TokenFileMetric.Hack": { + "_active": true + }, + "Metric-TokenFileMetric.Todo": { + "_active": true + }, + "Metric-TokenFileMetric.XXX": { + "_active": true + } + }, + "_Format": "1.0", + "_Version": "7.4.0", + "_VersionNum": [ + 7, + 4, + 0, + 9870 + ] +} diff --git a/tests/axivion/rule_config_c.json b/tests/axivion/rule_config_c.json index 7e80772f..9e42dae8 100644 --- a/tests/axivion/rule_config_c.json +++ b/tests/axivion/rule_config_c.json @@ -90,9 +90,18 @@ "Architecture-SaveRFG": { "_active": true }, + "AutosarC++19_03-A2.13.5": { + "_active": true, + "languages": [ + "C" + ] + }, "CWE-Bad-Coding-Practices-562": { "_active": true }, + "CWE-Complexity-Issues-1075": { + "_active": true + }, "CWE-Error-Conditions-617": { "_active": true }, @@ -108,11 +117,59 @@ "FAS_ASSERT" ] }, + "CertC-DCL01": { + "_active": true + }, "CertC-DCL03": { "_active": true }, + "CertC-INT09": { + "_active": true, + "languages": [ + "C" + ] + }, + "CertC-PRE01": { + "_active": true, + "languages": [ + "C", + "Assembler" + ] + }, + "CertC-PRE04": { + "_active": true, + "languages": [ + "C", + "Assembler" + ] + }, + "CertC-PRE06": { + "_active": true, + "languages": [ + "C", + "Assembler" + ] + }, + "CertC-PRE08": { + "_active": true, + "languages": [ + "C", + "Assembler" + ] + }, "CertC-PRE31": { - "_active": true + "_active": true, + "languages": [ + "C", + "Assembler" + ] + }, + "CertC-PRE32": { + "_active": true, + "languages": [ + "C", + "Assembler" + ] }, "CloneDetection": { "_active": true, @@ -149,6 +206,13 @@ ], "show_charset": true }, + "CodingStyle-LinesOfCodeInFile": { + "languages": [ + "C", + "Assembler" + ], + "max_value": 800 + }, "CodingStyle-MaxOneStmtPerLine": { "_active": true, "ignore_stmts": [ @@ -166,7 +230,7 @@ "maximum_length": 120 }, "CodingStyle-Naming.Enum": { - "_active": false, + "_active": true, "naming_convention": "^[A-Z][A-Z0-9]*_e$" }, "CodingStyle-Naming.Enumerator": { @@ -176,7 +240,7 @@ "_active": true }, "CodingStyle-Naming.GlobalVariable": { - "_active": false + "_active": true }, "CodingStyle-Naming.Label": { "_active": false @@ -185,13 +249,13 @@ "_active": false }, "CodingStyle-Naming.Macro": { - "_active": false + "_active": true }, "CodingStyle-Naming.Parameter": { - "_active": false + "_active": true }, "CodingStyle-Naming.Struct": { - "_active": false, + "_active": true, "naming_convention": "^[A-Z][A-Z0-9]*_s$" }, "CodingStyle-Naming.StructField": { @@ -204,27 +268,75 @@ "_active": false }, "CodingStyle-NoBlankLinesAtBraces": { - "_active": false + "_active": true, + "languages": [ + "C", + "Assembler" + ] + }, + "CodingStyle-NoDoubleUnderscoreInMacro": { + "_active": true, + "exclude_in_macros": [ + "FOXBMS__*_H_" + ], + "languages": [ + "C", + "Assembler" + ] }, "CodingStyle-NoSingleCharIdentifier": { "_active": true, "exclude_loop_counter": true, + "languages": [ + "C", + "Assembler" + ], "whitelist": [] }, "CodingStyle-NoTabs": { - "_active": true + "_active": true, + "languages": [ + "C", + "Assembler" + ] }, "CodingStyle-NoTrailingWhitespace": { - "_active": true + "_active": true, + "languages": [ + "C", + "Assembler" + ] }, "CodingStyle-NoWhitespaceMemberSelection": { "_active": true }, "CodingStyle-NoWhitespacePointerReference": { - "_active": false + "_active": false, + "languages": [ + "C", + "Assembler" + ] + }, + "CodingStyle-NoWhitespacePointerReferenceInverse": { + "_active": false, + "languages": [ + "C", + "Assembler" + ] + }, + "CodingStyle-StrongTypeViolations": { + "_active": false, + "languages": [ + "C", + "Assembler" + ] }, "CodingStyle-TooManyIncludes": { - "_active": true + "_active": true, + "languages": [ + "C", + "Assembler" + ] }, "CycleDetection-CallgraphCycles": { "_active": true @@ -314,6 +426,10 @@ "Generic-FinalNewline": { "_active": true, "_copy_from": "Generic-NoCompilerWarnings", + "languages": [ + "C", + "Assembler" + ], "reported_severities": [ "remark" ] @@ -372,7 +488,10 @@ "_active": true }, "Generic-MissingIncludeGuard": { - "_active": true + "_active": true, + "languages": [ + "C" + ] }, "Generic-MissingOverride": { "_active": true @@ -387,9 +506,15 @@ "Generic-MissingSelfHeaderInclude": { "_active": true }, + "Generic-MixedUpArgumentOrder": { + "_active": true + }, "Generic-NoAbsoluteInclude": { "_active": true }, + "Generic-NoCommaSequence": { + "_active": true + }, "Generic-NoCompilerWarnings": { "_active": true }, @@ -411,6 +536,13 @@ "Generic-NoEllipsis": { "_active": true }, + "Generic-NoEmptyLoops": { + "_active": true, + "languages": [ + "C", + "Assembler" + ] + }, "Generic-NoEmptyStructs": { "_active": true }, @@ -462,10 +594,18 @@ "_active": true }, "Generic-NoTabs": { - "_active": true + "_active": true, + "languages": [ + "C", + "Assembler" + ] }, "Generic-NoTrailingWhitespace": { - "_active": true + "_active": true, + "languages": [ + "C", + "Assembler" + ] }, "Generic-NoTypeConversionToBool": { "_active": true @@ -534,66 +674,6 @@ "Metric-IssueCount.Style": { "_active": true }, - "Metric-Lines.Class.LOC": { - "_active": true - }, - "Metric-Lines.Comment": { - "_active": true - }, - "Metric-Lines.File.Comment": { - "_active": true - }, - "Metric-Lines.File.LOC": { - "_active": true - }, - "Metric-Lines.LOC": { - "_active": true - }, - "Metric-Lines.PP.Define": { - "_active": true - }, - "Metric-Lines.PP.Elif": { - "_active": true - }, - "Metric-Lines.PP.Else": { - "_active": true - }, - "Metric-Lines.PP.Endif": { - "_active": true - }, - "Metric-Lines.PP.Error": { - "_active": true - }, - "Metric-Lines.PP.Ident": { - "_active": true - }, - "Metric-Lines.PP.If": { - "_active": true - }, - "Metric-Lines.PP.Ifdef": { - "_active": true - }, - "Metric-Lines.PP.Ifndef": { - "_active": true - }, - "Metric-Lines.PP.Include": { - "_active": true - }, - "Metric-Lines.PP.Line": { - "_active": true - }, - "Metric-Lines.PP.Pragma": { - "_active": true - }, - "Metric-Lines.PP.Undef": { - "_active": true - }, - "Metric-Lines.PP.Warning": { - "_active": true - }, - "Metric-Lines.Routine.LOC": { - "_active": true - }, "Metric-LogNPathCeiling": { "_active": true }, @@ -618,10 +698,12 @@ "_active": true }, "Metric-NumberOfParameters": { - "_active": true + "_active": true, + "max_value": 5 }, "Metric-NumberOfReturns": { - "_active": true + "_active": true, + "max_value": 1 }, "Metric-NumberOfSCCs": { "_active": true @@ -632,24 +714,6 @@ "Metric-SwitchComplexity": { "_active": true }, - "Metric-TokenFileMetric.Check": { - "_active": false - }, - "Metric-TokenFileMetric.Debug": { - "_active": false - }, - "Metric-TokenFileMetric.Fixme": { - "_active": false - }, - "Metric-TokenFileMetric.Hack": { - "_active": false - }, - "Metric-TokenFileMetric.Todo": { - "_active": false - }, - "Metric-TokenFileMetric.XXX": { - "_active": false - }, "Metric-TokenMetric.Check": { "_active": false }, @@ -678,15 +742,14 @@ "_active": true, "standards": [ "--c11", - "--c99", - "--c89" + "--c99" ] }, "MisraC2012-1.2": { "_active": true, "exclude_in_macros": [ - "must_check_return", - "VERSION_INFORMATION" + "GEN_MUST_CHECK_RETURN", + "VER_VERSION_INFORMATION" ] }, "MisraC2012-1.3": { @@ -1248,6 +1311,9 @@ "MisraC2012Directive-4.9": { "_active": true }, + "NextCodeline": { + "_active": true + }, "NextLine": { "_active": true }, diff --git a/tests/axivion/rule_config_metric_lines.json b/tests/axivion/rule_config_metric_lines.json new file mode 100644 index 00000000..63a9b194 --- /dev/null +++ b/tests/axivion/rule_config_metric_lines.json @@ -0,0 +1,104 @@ +{ + "Analysis": { + "Metric-Comment.Density": { + "_active": true, + "min_value": 0.15 + }, + "Metric-Lines.Class.LOC": { + "_active": false + }, + "Metric-Lines.Comment": { + "_active": true + }, + "Metric-Lines.Empty": { + "_active": true, + "max_value": 20, + "min_value": 0 + }, + "Metric-Lines.File.Code": { + "_active": true, + "min_value": 0 + }, + "Metric-Lines.File.Comment": { + "_active": true, + "min_value": 10 + }, + "Metric-Lines.File.CommentRatio": { + "_active": true, + "min_value": 0.15 + }, + "Metric-Lines.File.LOC": { + "_active": true, + "max_value": 800, + "min_value": 0 + }, + "Metric-Lines.LOC": { + "_active": true + }, + "Metric-Lines.OnlyComment": { + "_active": true + }, + "Metric-Lines.PP.Define": { + "_active": true + }, + "Metric-Lines.PP.Elif": { + "_active": true + }, + "Metric-Lines.PP.Else": { + "_active": true + }, + "Metric-Lines.PP.Endif": { + "_active": true + }, + "Metric-Lines.PP.Error": { + "_active": true + }, + "Metric-Lines.PP.Ident": { + "_active": true + }, + "Metric-Lines.PP.If": { + "_active": true + }, + "Metric-Lines.PP.Ifdef": { + "_active": true + }, + "Metric-Lines.PP.Ifndef": { + "_active": true + }, + "Metric-Lines.PP.Include": { + "_active": true + }, + "Metric-Lines.PP.Line": { + "_active": true + }, + "Metric-Lines.PP.Pragma": { + "_active": true + }, + "Metric-Lines.PP.Undef": { + "_active": true + }, + "Metric-Lines.PP.Warning": { + "_active": true + }, + "Metric-Lines.Routine.Code": { + "_active": true, + "min_value": 1 + }, + "Metric-Lines.Routine.CommentRatio": { + "_active": true, + "min_value": 0.15 + }, + "Metric-Lines.Routine.LOC": { + "_active": true, + "max_value": 100 + } + }, + "_Format": "1.0", + "_Version": "7.4.0", + "_VersionNum": [ + 7, + 4, + 0, + 9870 + ] +} diff --git a/tests/axivion/rule_config_names.json b/tests/axivion/rule_config_names.json index a54a671f..e772bc30 100644 --- a/tests/axivion/rule_config_names.json +++ b/tests/axivion/rule_config_names.json @@ -18,6 +18,10 @@ "wmain", "wWinMain" ], + "languages": [ + "C", + "Assembler" + ], "msg": { "non_compliant_name": { "text": "Function names shall use the naming convention (prefix.upper())_PascalCase." @@ -27,30 +31,65 @@ }, "CodingStyle-Naming.GlobalVariable": { "_active": true, + "languages": [ + "C", + "Assembler" + ], "msg": { "non_compliant_name": { - "text": "Names of global variables shall use the naming convention (prefix.lower())_camelCase." + "text": "Names of global variables shall use the naming convention (prefix.lower())_camelCase (and optional unit suffix preceded by _)." } }, - "naming_convention": "[a-z]+_[a-z0-9]([a-z0-9]*[A-Z0-9]*[a-z0-9]+)*(_[umd]?([AKVs]|perc|degC))?" + "naming_convention": "^[a-z][a-z0-9]{1,4}_(([a-z]|[0-9]{1,}[A-Za-z]))[A-Za-z0-9_]{0,}" }, "CodingStyle-Naming.LocalVariable": { "_active": true, + "languages": [ + "C", + "Assembler" + ], "msg": { "non_compliant_name": { - "text": "Names of local variables shall use the naming convention (prefix.lower())_camelCase." + "text": "Names of local variables shall use the naming convention (prefix.lower())_camelCase (and optional unit suffix preceded by _)." } }, - "naming_convention": "[a-z0-9]([a-z0-9]*[A-Z0-9]*[a-z0-9]+)*(_[umd]?([AKVs]|perc|degC))?" + "naming_convention": "^(([a-z]|[0-9]{1,}[A-Za-z]))[A-Za-z0-9_]{0,}" }, "CodingStyle-Naming.Macro": { "_active": true, + "exclude_in_macros": [ + "GEN_REPEAT_U*u" + ], + "languages": [ + "C", + "Assembler" + ], + "msg": { + "non_compliant_name": { + "text": "Macro names shall use the naming convention '(prefix.upper())_ALL_CAPS' (and optional unit suffix preceded by _) or for include guards 'FOXBMS__FILENAME_H_'." + } + }, + "naming_convention": "(([A-Z][A-Z0-9]{1,4})_([A-Z0-9]([A-Z0-9_]*)).*)(? str: @@ -106,22 +137,36 @@ def __getitem__(self, item): def containing_modules(node): """yields the file""" + + def file_sort_key(f): + """sort by key""" + if f.is_of_type("User_Include_File"): + index = 1 + elif f.is_of_type("System_Include_File"): + index = 10 + elif f.is_of_type("Preinclude_File"): + index = 1000 + elif f.is_of_type("PCH_File"): + index = 20 + elif f.is_of_type("Primary_File"): + index = 50 + else: + index = 100 + return ( + index, + f.Full_Name, + ) + if node.part() == ir.Logical: - nodes = node.Definitions - # if no definitions available, go for the declarations - if len(nodes) == 0: - # use declarations if available, otherwise fallback - nodes = node.Declarations - if len(nodes) == 0: - nodes = (node.Physical,) + files = (pir_node.enclosing_of_type("File") for pir_node in node.Decls_And_Defs) + try: + yield next(iter(sorted(files, key=file_sort_key))) + except StopIteration: + pass else: - nodes = (node,) - - for pir_node in nodes: - if pir_node: - file = pir_node.enclosing_of_type("File") - if file: - yield file + file = node.enclosing_of_type("File") + if file: + yield file def check_lowercase_prefix(node: ir.Node, module_prefixes: ModulePrefixLookup) -> bool: @@ -146,6 +191,64 @@ def check_uppercase_prefix(node: ir.Node, module_prefixes: ModulePrefixLookup) - return True +def check_macro_name(node: ir.Node, module_prefixes: ModulePrefixLookup) -> bool: + """check that the macro starts with the upper-case module prefixed followed by + an underscore (exception: include guard macro 'FOXBMS__{FILENAME}_H_').""" + if not node.Name: + return True + # ignore compiler builtins + if ( + not node.type() == "Predefined_Object_Macro_Definition" + and not node.Name.startswith("__") + ): + logging.debug(f"node.Name: {node.Name}") + else: + logging.getLogger().setLevel(logging.FATAL) # ignore output + + for file in containing_modules(node): + if file in module_prefixes: + logging.debug(f"found prefix: {module_prefixes[file]}") + if not node.Name.startswith(module_prefixes[file].upper() + "_"): + logging.debug(f"Check if '{node.Name}' is a include guard.") + # check that we are not hitting an include guard, as + # include guards use the pattern 'FOXBMS__{FILENAME}_H_' + file_name_to_guard = "".join( + ch.upper() if ch.isalnum() else "_" for ch in Path(file.Name).stem + ) + define_guard = f"FOXBMS__{file_name_to_guard}_H_" + if node.Name == define_guard: + logging.debug(f"found include guard ('{node.Name}').") + logging.debug(f"Done for '{node.Name}'.\n") + return True + logging.debug(f"'{node.Name}' is not an include guard.") + # we have not hit an include guard, now check that the macro starts + # with the prefix is all uppercase and optionally ends with one of + # the valid suffixes + if not node.Name.startswith(module_prefixes[file].upper() + "_"): + # macro does not use the module prefix + logging.error(f"'{node.Name}' is missing the prefix.") + logging.debug(f"Done for '{node.Name}'.\n") + return False + if node.Name == node.Name.upper(): + logging.debug(f"'{node.Name}' uses a valid name.") + logging.debug(f"Done for '{node.Name}'.\n") + return True + # we start with the prefix, but the macro is not all uppercase, + # so maybe we appended a valid suffix + for suffix in VALID_SUFFIXES: + if node.Name.endswith(f"_{suffix}"): + # remove the suffix, then we need to be all uppercase + # we need to subtract additionally -1 because of the underscore + without_suffix = node.Name[: len(node.Name) - len(suffix) - 1] + if without_suffix == without_suffix.upper(): + logging.debug(f"Done for '{node.Name}'.\n") + return True + logging.error(f"'{node.Name}' uses an invalid macro name.") + logging.debug(f"Done for '{node.Name}'.\n") + logging.getLogger().setLevel(logging.DEBUG) # reset logging level + return False + + def check_prefix_known(node: ir.Node, module_prefixes: ModulePrefixLookup) -> bool: """check that a module prefix exists for the current node.""" if node.Name: @@ -175,7 +278,7 @@ def check_function_name(node: ir.Node, module_prefixes: ModulePrefixLookup) -> b base_name_splitted = base_name.split("_", maxsplit=1) function_name = base_name_splitted[0] - try: + try: # TODO: will not work if suffix contains underscore function_name_suffix = base_name_splitted[1] except IndexError: function_name_suffix = None @@ -186,59 +289,141 @@ def check_function_name(node: ir.Node, module_prefixes: ModulePrefixLookup) -> b idx.append(i) valid_pascal_case = True + # any valid PascalCase word needs to start with an uppercase letter + if not function_name[0].upper() == function_name[0]: + valid_pascal_case = False for i in range(1, len(idx)): # if the difference between two indexes is 1, we are not seeing PascalCase if idx[i] - idx[i - 1] == 1: valid_pascal_case = False break - valid_suffix = True - if function_name_suffix: - valid_suffix = False - if function_name_suffix in VALID_FUNCTION_SUFFIXES: - valid_suffix = True + valid_suffix = validate_suffix(function_name_suffix) return valid_pascal_case and valid_suffix -#: list: List of things that MUST start with the upper-case module prefix -upper_case = ( - "CodingStyle-Naming.Function", - "CodingStyle-Naming.Macro", - "CodingStyle-Naming.TypedefedFuncPtr", - "CodingStyle-Naming.TypedefedEnum", - "CodingStyle-Naming.TypedefedStruct", -) +# pylint: disable=unused-argument +def check_parameter_name(node: ir.Node, module_prefixes: ModulePrefixLookup) -> bool: + """Checks that a parameter name is a camelName base name and an + optional suffix that indicates the unit.""" + if not node.Name: + return True + base_name = str(node.Name) + base_name_splitted = base_name.split("_", maxsplit=1) + parameter_name = base_name_splitted[0] + if not parameter_name: + # a="_bla"; a.split("_"); ['', 'bla'] + return False -for name in upper_case: - ANALYSIS[name].additional_checks.append( - ( - check_uppercase_prefix, - f"Please use upper-case module prefix for {get_rule_type_from_name(name)}.", - ) - ) - ANALYSIS[name].additional_checks.append( - (check_prefix_known, "Unknown which module prefix to check.") - ) + try: # TODO: will not work if suffix contains underscore + parameter_name_suffix = base_name_splitted[1] + except IndexError: + parameter_name_suffix = None -ANALYSIS["CodingStyle-Naming.Function"].additional_checks.append( - (check_function_name, "The function name is not PascalCase.") -) + idx = [] + for i, val in enumerate(parameter_name): + if val.isupper(): + idx.append(i) -#: list: List of things that MUST start with the lower-case module prefix -lower_case = ( - "CodingStyle-Naming.GlobalVariable", - "CodingStyle-Naming.LocalVariable", -) -for name in lower_case: - ANALYSIS[name].additional_checks.append( - ( - check_lowercase_prefix, - f"Please use lower-case module prefix for {get_rule_type_from_name(name)}.", + valid_camel_case = True + # any valid camelCase word needs to start with an lowercase letter + if not parameter_name[0].lower() == parameter_name[0]: + valid_camel_case = False + for i in range(1, len(idx)): + # if the difference between two indexes is 1, we are not seeing camelCase + if idx[i] - idx[i - 1] == 1: + valid_camel_case = False + break + + valid_suffix = validate_suffix(parameter_name_suffix) + return valid_camel_case and valid_suffix + + +def check_global_variable_name( + node: ir.Node, module_prefixes: ModulePrefixLookup +) -> bool: + """Checks that a variable name is a camelName base name and an + optional suffix that indicates the unit.""" + if not node.Name: + return True + prefix = None + if node.Name: + for file in containing_modules(node): + if file in module_prefixes: + prefix = module_prefixes[file].lower() + "_" + if not prefix: # something went wrong + return False + + base_name = "" + if node.Name.startswith(prefix): + base_name = node.Name[len(prefix) :] + else: + return False + + base_name_splitted = base_name.split("_", maxsplit=1) + variable_name = base_name_splitted[0] + try: + variable_name_suffix = base_name_splitted[1] + except IndexError: + variable_name_suffix = None + + idx = [] + for i, val in enumerate(variable_name): + if val.isupper(): + idx.append(i) + + valid_camel_case = True + # any valid camelCase word needs to start with an lowercase letter + if not variable_name[0].lower() == variable_name[0]: + valid_camel_case = False + for i in range(1, len(idx)): + # if the difference between two indexes is 1, we are not seeing camelCase + if idx[i] - idx[i - 1] == 1: + valid_camel_case = False + break + + valid_suffix = validate_suffix(variable_name_suffix) + return valid_camel_case and valid_suffix + + +NAMING = "CodingStyle-Naming" +prefix_check = { + "lower": ( + f"{NAMING}.GlobalVariable", + f"{NAMING}.LocalVariable", + ), + "upper": ( + f"{NAMING}.Function", + f"{NAMING}.TypedefedFuncPtr", + f"{NAMING}.TypedefedEnum", + f"{NAMING}.TypedefedStruct", + ), +} + +for casing, applicable_rules in prefix_check.items(): + for rule in applicable_rules: + RULE_TYPE = get_rule_type_from_name(rule) + error_message = f"Please use {casing}case module prefix for {RULE_TYPE}." + ANALYSIS[rule].additional_checks.extend( + [ + (check_prefix_known, UNKNOWN_PREFIX_ERROR_MESSAGE), + (globals()[f"check_{casing}case_prefix"], error_message), + ] ) - ) - ANALYSIS[name].additional_checks.append( - (check_prefix_known, "Unknown which module prefix to check.") - ) + +FUNCTION_NAME_ERROR_MESSAGE = "The function name is not 'PascalCase'." +GLOBAL_VARIABLE_ERROR_MESSAGE = "The global variable name is not 'camelCase'." +MACRO_ERROR_MESSAGE = "The macro name is not 'ALL_CAPS'." +PARAMETER_ERROR_MESSAGE = "The parameter name is not 'camelCase'." +naming_errors = { + "Function": (check_function_name, FUNCTION_NAME_ERROR_MESSAGE), + "GlobalVariable": (check_global_variable_name, GLOBAL_VARIABLE_ERROR_MESSAGE), + "Macro": (check_macro_name, MACRO_ERROR_MESSAGE), + "Parameter": (check_parameter_name, PARAMETER_ERROR_MESSAGE), +} + +for applicable_rule, handling in naming_errors.items(): + ANALYSIS[f"{NAMING}.{applicable_rule}"].additional_checks.append(handling) # Only check function pointers with rule CodingStyle-Naming.TypedefedFuncPtr @@ -251,6 +436,4 @@ def is_function_pointer_type(type_node: ir.Node) -> bool: return False -ANALYSIS[ - "CodingStyle-Naming.TypedefedFuncPtr" -].filter_predicate = is_function_pointer_type +ANALYSIS[f"{NAMING}.TypedefedFuncPtr"].filter_predicate = is_function_pointer_type diff --git a/tests/axivion/scripts/start_local_analysis.bat b/tests/axivion/scripts/start_local_analysis.bat index 85d4c83c..d7661e1b 100644 --- a/tests/axivion/scripts/start_local_analysis.bat +++ b/tests/axivion/scripts/start_local_analysis.bat @@ -39,4 +39,7 @@ @set AXIVION=TRUE @set AXIVION_LOCAL_BUILD=TRUE +@set STORE_REQUESTS_CA_BUNDLE=%REQUESTS_CA_BUNDLE% +@set REQUESTS_CA_BUNDLE=%USERPROFILE%\.bauhaus\auto.crt @call %~dp0start_analysis.bat +@set REQUESTS_CA_BUNDLE=%STORE_REQUESTS_CA_BUNDLE% diff --git a/tests/c-std/c-std-test-inline-helper.h b/tests/c-std/c-std-test-inline-helper.h index 8a6f2f85..5b7de3a3 100644 --- a/tests/c-std/c-std-test-inline-helper.h +++ b/tests/c-std/c-std-test-inline-helper.h @@ -43,8 +43,8 @@ * @file c-std-test-inline-helper.h * @author foxBMS Team * @date 2022-03-16 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup TESTS * @prefix TEST * diff --git a/tests/c-std/c-std-test.c b/tests/c-std/c-std-test.c index badd922a..34319a58 100644 --- a/tests/c-std/c-std-test.c +++ b/tests/c-std/c-std-test.c @@ -43,8 +43,8 @@ * @file c-std-test.c * @author foxBMS Team * @date 2022-03-16 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup TESTS * @prefix TEST * diff --git a/tests/c-std/c-std-test.json b/tests/c-std/c-std-test.json index 217f5703..97df85cc 100644 --- a/tests/c-std/c-std-test.json +++ b/tests/c-std/c-std-test.json @@ -1,15 +1,15 @@ { "c89": [ - "#warning \"Ignoring static asserts in C89/C90 mode (f_static_assert).\"" + "#warning \"Ignoring static asserts in C89/C90 mode (FAS_STATIC_ASSERT).\"" ], "c90": [ - "#warning \"Ignoring static asserts in C89/C90 mode (f_static_assert).\"" + "#warning \"Ignoring static asserts in C89/C90 mode (FAS_STATIC_ASSERT).\"" ], "iso9899:199409": [ - "#warning \"Ignoring static asserts in C94 mode (f_static_assert).\"" + "#warning \"Ignoring static asserts in C94 mode (FAS_STATIC_ASSERT).\"" ], "c99": [ - "#warning \"Ignoring static asserts in C99 mode (f_static_assert).\"" + "#warning \"Ignoring static asserts in C99 mode (FAS_STATIC_ASSERT).\"" ], "c11": [], "c17": [] diff --git a/tests/env/packages/env_test_prometheus-client.py b/tests/env/packages/env_test_prometheus-client.py index 071a6e5e..7f5891ac 100644 --- a/tests/env/packages/env_test_prometheus-client.py +++ b/tests/env/packages/env_test_prometheus-client.py @@ -46,7 +46,7 @@ import logging # package to test -import prometheus_client # pylint: disable=unused-import +import prometheus_client def main(): @@ -69,6 +69,11 @@ def main(): else: logging.basicConfig(level=logging.ERROR) + # https://github.com/prometheus/client_python#counter + c = prometheus_client.Counter("my_failures", "Description of counter") + c.inc() # Increment by 1 + c.inc(1.6) # Increment by given value + if __name__ == "__main__": main() diff --git a/tests/re-names/README.md b/tests/re-names/README.md index ae000526..6eeee91b 100644 --- a/tests/re-names/README.md +++ b/tests/re-names/README.md @@ -3,6 +3,9 @@ Tests to verify that the regular expressions that are used to check function names etc. are indeed correct. +These are relaxed tests, as the real naming tests is implemented in the Axivion +test (``tests/axivion/rule_config_names.py``). + ## Running the Test ``` diff --git a/tests/re-names/global-variable.json b/tests/re-names/global-variable.json index 0728c6d9..897d4b91 100644 --- a/tests/re-names/global-variable.json +++ b/tests/re-names/global-variable.json @@ -41,7 +41,6 @@ "aBc_myVar1", "aBc_my1Var1", "aBc_myVar1Var", - "aBc_myVar1Var1", - "abc_myVar_" + "aBc_myVar1Var1" ] } diff --git a/tests/re-names/local-variable.json b/tests/re-names/local-variable.json index 40b4fce9..4d44ef31 100644 --- a/tests/re-names/local-variable.json +++ b/tests/re-names/local-variable.json @@ -18,7 +18,6 @@ ], "invalid": [ "_", - "myVar_", "MyVar", "MyVar1", "My1Var1", diff --git a/tests/re-names/macro.json b/tests/re-names/macro.json index af50c2f3..31f19d6a 100644 --- a/tests/re-names/macro.json +++ b/tests/re-names/macro.json @@ -6,7 +6,8 @@ "ABC_123_12", "ABC_123_AB", "ABC_123_AB_mV", - "ABC_123_AB_perc" + "ABC_123_AB_perc", + "FOXBMS__ABC_ABC_123_H_" ], "invalid": [ "_ABC", @@ -17,6 +18,8 @@ "abc_", "ABC_", "ABC_abc", - "ABC_ABC_123_" + "ABC_ABC_123_", + "FOXBMS__ABC_ABC_123_H", + "FOXBMS__ABC_ABC_123_" ] } diff --git a/tests/scripts/gui/test_foxbms_gui.py b/tests/scripts/gui/test_foxbms_gui.py index a828374b..b3575732 100644 --- a/tests/scripts/gui/test_foxbms_gui.py +++ b/tests/scripts/gui/test_foxbms_gui.py @@ -79,7 +79,7 @@ def get_git_root(path: str) -> str: ROOT = get_git_root(os.path.realpath(__file__)) sys.path.insert(1, os.path.abspath(os.path.join(ROOT, "tools", "gui"))) -import foxbms_gui # pylint:disable=wrong-import-position,unused-import +from fgui import foxbms_gui # pylint:disable=wrong-import-position,unused-import class TestDialog(unittest.TestCase): diff --git a/tests/scripts/gui/test_info_dialog.py b/tests/scripts/gui/test_info_dialog.py index 200a4571..756ded46 100644 --- a/tests/scripts/gui/test_info_dialog.py +++ b/tests/scripts/gui/test_info_dialog.py @@ -79,7 +79,7 @@ def get_git_root(path: str) -> str: ROOT = get_git_root(os.path.realpath(__file__)) sys.path.insert(1, os.path.abspath(os.path.join(ROOT, "tools", "gui"))) -import info_dialog # pylint:disable=wrong-import-position +from fgui import info_dialog # pylint:disable=wrong-import-position class TestDialog(unittest.TestCase): diff --git a/tests/scripts/waf-tools/f_guidelines/tests/c-004_tests/c-004_test5.c b/tests/scripts/waf-tools/f_guidelines/tests/c-004_tests/c-004_test5.c index 6efb8832..c7f4b70b 100644 --- a/tests/scripts/waf-tools/f_guidelines/tests/c-004_tests/c-004_test5.c +++ b/tests/scripts/waf-tools/f_guidelines/tests/c-004_tests/c-004_test5.c @@ -8,6 +8,6 @@ * @ingroup TEMPERATURE_SENSORS * @prefix TSEN * - * @brief TODO + * @brief Add some brief description here * */ diff --git a/tests/unit/app/application/algorithm/config/test_algorithm_cfg.c b/tests/unit/app/application/algorithm/config/test_algorithm_cfg.c index 12892e46..cc2a7464 100644 --- a/tests/unit/app/application/algorithm/config/test_algorithm_cfg.c +++ b/tests/unit/app/application/algorithm/config/test_algorithm_cfg.c @@ -43,8 +43,8 @@ * @file test_algorithm_cfg.c * @author foxBMS Team * @date 2020-06-30 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/application/algorithm/moving_average/test_moving_average.c b/tests/unit/app/application/algorithm/moving_average/test_moving_average.c index 21cea9b7..d6fdd556 100644 --- a/tests/unit/app/application/algorithm/moving_average/test_moving_average.c +++ b/tests/unit/app/application/algorithm/moving_average/test_moving_average.c @@ -43,8 +43,8 @@ * @file test_moving_average.c * @author foxBMS Team * @date 2020-07-01 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/application/algorithm/state_estimation/soc/counting/test_soc_counting.c b/tests/unit/app/application/algorithm/state_estimation/soc/counting/test_soc_counting.c index 1990e3ca..0ed1115d 100644 --- a/tests/unit/app/application/algorithm/state_estimation/soc/counting/test_soc_counting.c +++ b/tests/unit/app/application/algorithm/state_estimation/soc/counting/test_soc_counting.c @@ -43,8 +43,8 @@ * @file test_soc_counting.c * @author foxBMS Team * @date 2020-10-07 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * @@ -73,10 +73,10 @@ void setUp(void) { void tearDown(void) { } -void testSOC_GetFromVoltage(void) { +void testSE_GetStateOfChargeFromVoltage(void) { float test_soc = -1.0; int16_t test_voltage_mV = 3780; - test_soc = SOC_GetFromVoltage(test_voltage_mV); + test_soc = SE_GetStateOfChargeFromVoltage(test_voltage_mV); TEST_ASSERT_EQUAL(64.0f, test_soc); } diff --git a/tests/unit/app/application/algorithm/state_estimation/soc/counting/test_soc_counting_cfg.c b/tests/unit/app/application/algorithm/state_estimation/soc/counting/test_soc_counting_cfg.c index ac2d2234..2af36f01 100644 --- a/tests/unit/app/application/algorithm/state_estimation/soc/counting/test_soc_counting_cfg.c +++ b/tests/unit/app/application/algorithm/state_estimation/soc/counting/test_soc_counting_cfg.c @@ -43,8 +43,8 @@ * @file test_soc_counting_cfg.c * @author foxBMS Team * @date 2020-10-07 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/application/algorithm/state_estimation/soc/debug/test_soc_debug.c b/tests/unit/app/application/algorithm/state_estimation/soc/debug/test_soc_debug.c index faa43886..9a61b214 100644 --- a/tests/unit/app/application/algorithm/state_estimation/soc/debug/test_soc_debug.c +++ b/tests/unit/app/application/algorithm/state_estimation/soc/debug/test_soc_debug.c @@ -43,8 +43,8 @@ * @file test_soc_debug.c * @author foxBMS Team * @date 2020-10-14 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/application/algorithm/state_estimation/soc/debug/test_soc_debug_cfg.c b/tests/unit/app/application/algorithm/state_estimation/soc/debug/test_soc_debug_cfg.c index 3e831882..0edb3fbe 100644 --- a/tests/unit/app/application/algorithm/state_estimation/soc/debug/test_soc_debug_cfg.c +++ b/tests/unit/app/application/algorithm/state_estimation/soc/debug/test_soc_debug_cfg.c @@ -43,8 +43,8 @@ * @file test_soc_debug_cfg.c * @author foxBMS Team * @date 2020-10-07 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/application/algorithm/state_estimation/soc/none/test_soc_none.c b/tests/unit/app/application/algorithm/state_estimation/soc/none/test_soc_none.c index aaa372de..3261a41c 100644 --- a/tests/unit/app/application/algorithm/state_estimation/soc/none/test_soc_none.c +++ b/tests/unit/app/application/algorithm/state_estimation/soc/none/test_soc_none.c @@ -43,8 +43,8 @@ * @file test_soc_none.c * @author foxBMS Team * @date 2020-10-14 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/application/algorithm/state_estimation/soc/none/test_soc_none_cfg.c b/tests/unit/app/application/algorithm/state_estimation/soc/none/test_soc_none_cfg.c index 46102e8a..d33e4089 100644 --- a/tests/unit/app/application/algorithm/state_estimation/soc/none/test_soc_none_cfg.c +++ b/tests/unit/app/application/algorithm/state_estimation/soc/none/test_soc_none_cfg.c @@ -43,8 +43,8 @@ * @file test_soc_none_cfg.c * @author foxBMS Team * @date 2020-10-07 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/application/algorithm/state_estimation/soe/counting/test_soe_counting.c b/tests/unit/app/application/algorithm/state_estimation/soe/counting/test_soe_counting.c index e9359a34..54ca71a0 100644 --- a/tests/unit/app/application/algorithm/state_estimation/soe/counting/test_soe_counting.c +++ b/tests/unit/app/application/algorithm/state_estimation/soe/counting/test_soe_counting.c @@ -43,8 +43,8 @@ * @file test_soe_counting.c * @author foxBMS Team * @date 2020-10-07 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/application/algorithm/state_estimation/soe/counting/test_soe_counting_cfg.c b/tests/unit/app/application/algorithm/state_estimation/soe/counting/test_soe_counting_cfg.c index 455b99b7..7a7e490d 100644 --- a/tests/unit/app/application/algorithm/state_estimation/soe/counting/test_soe_counting_cfg.c +++ b/tests/unit/app/application/algorithm/state_estimation/soe/counting/test_soe_counting_cfg.c @@ -43,8 +43,8 @@ * @file test_soe_counting_cfg.c * @author foxBMS Team * @date 2020-10-07 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/application/algorithm/state_estimation/soe/debug/test_soe_debug.c b/tests/unit/app/application/algorithm/state_estimation/soe/debug/test_soe_debug.c index 780d02ee..4348414b 100644 --- a/tests/unit/app/application/algorithm/state_estimation/soe/debug/test_soe_debug.c +++ b/tests/unit/app/application/algorithm/state_estimation/soe/debug/test_soe_debug.c @@ -43,8 +43,8 @@ * @file test_soe_debug.c * @author foxBMS Team * @date 2020-10-14 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/application/algorithm/state_estimation/soe/debug/test_soe_debug_cfg.c b/tests/unit/app/application/algorithm/state_estimation/soe/debug/test_soe_debug_cfg.c index d366a46d..763096b8 100644 --- a/tests/unit/app/application/algorithm/state_estimation/soe/debug/test_soe_debug_cfg.c +++ b/tests/unit/app/application/algorithm/state_estimation/soe/debug/test_soe_debug_cfg.c @@ -43,8 +43,8 @@ * @file test_soe_debug_cfg.c * @author foxBMS Team * @date 2020-10-14 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/application/algorithm/state_estimation/soe/none/test_soe_none.c b/tests/unit/app/application/algorithm/state_estimation/soe/none/test_soe_none.c index 684ccbeb..4e390a94 100644 --- a/tests/unit/app/application/algorithm/state_estimation/soe/none/test_soe_none.c +++ b/tests/unit/app/application/algorithm/state_estimation/soe/none/test_soe_none.c @@ -43,8 +43,8 @@ * @file test_soe_none.c * @author foxBMS Team * @date 2020-10-14 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/application/algorithm/state_estimation/soe/none/test_soe_none_cfg.c b/tests/unit/app/application/algorithm/state_estimation/soe/none/test_soe_none_cfg.c index daff9366..0c06aab7 100644 --- a/tests/unit/app/application/algorithm/state_estimation/soe/none/test_soe_none_cfg.c +++ b/tests/unit/app/application/algorithm/state_estimation/soe/none/test_soe_none_cfg.c @@ -43,8 +43,8 @@ * @file test_soe_none_cfg.c * @author foxBMS Team * @date 2020-10-14 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/application/algorithm/state_estimation/sof/trapezoid/test_sof.c b/tests/unit/app/application/algorithm/state_estimation/sof/trapezoid/test_sof_trapezoid.c similarity index 94% rename from tests/unit/app/application/algorithm/state_estimation/sof/trapezoid/test_sof.c rename to tests/unit/app/application/algorithm/state_estimation/sof/trapezoid/test_sof_trapezoid.c index 41acef4d..8293178f 100644 --- a/tests/unit/app/application/algorithm/state_estimation/sof/trapezoid/test_sof.c +++ b/tests/unit/app/application/algorithm/state_estimation/sof/trapezoid/test_sof_trapezoid.c @@ -40,11 +40,11 @@ */ /** - * @file test_sof.c + * @file test_sof_trapezoid.c * @author foxBMS Team * @date 2020-10-07 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * @@ -58,10 +58,10 @@ #include "Mockdatabase.h" #include "Mockfram.h" -#include "sof_cfg.h" +#include "sof_trapezoid_cfg.h" #include "foxmath.h" -#include "sof.h" +#include "sof_trapezoid.h" /*========== Definitions and Implementations for Unit Test ==================*/ FRAM_SOC_s fram_soc = {0}; diff --git a/tests/unit/app/application/algorithm/state_estimation/sof/trapezoid/test_sof_cfg.c b/tests/unit/app/application/algorithm/state_estimation/sof/trapezoid/test_sof_trapezoid_cfg.c similarity index 95% rename from tests/unit/app/application/algorithm/state_estimation/sof/trapezoid/test_sof_cfg.c rename to tests/unit/app/application/algorithm/state_estimation/sof/trapezoid/test_sof_trapezoid_cfg.c index 809b7d8c..eb3a524b 100644 --- a/tests/unit/app/application/algorithm/state_estimation/sof/trapezoid/test_sof_cfg.c +++ b/tests/unit/app/application/algorithm/state_estimation/sof/trapezoid/test_sof_trapezoid_cfg.c @@ -40,11 +40,11 @@ */ /** - * @file test_sof_cfg.c + * @file test_sof_trapezoid_cfg.c * @author foxBMS Team * @date 2020-10-07 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * @@ -55,7 +55,7 @@ /*========== Includes =======================================================*/ #include "unity.h" -#include "sof_cfg.h" +#include "sof_trapezoid_cfg.h" /*========== Definitions and Implementations for Unit Test ==================*/ diff --git a/tests/unit/app/application/algorithm/state_estimation/soh/debug/test_soh_debug.c b/tests/unit/app/application/algorithm/state_estimation/soh/debug/test_soh_debug.c index 1cc3a7aa..924c1969 100644 --- a/tests/unit/app/application/algorithm/state_estimation/soh/debug/test_soh_debug.c +++ b/tests/unit/app/application/algorithm/state_estimation/soh/debug/test_soh_debug.c @@ -43,8 +43,8 @@ * @file test_soh_debug.c * @author foxBMS Team * @date 2020-10-14 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * @@ -72,8 +72,8 @@ void tearDown(void) { /** test invalid input values */ void testInvalidInput(void) { DATA_BLOCK_SOX_s table_test = {.header.uniqueId = DATA_BLOCK_ID_SOX}; - TEST_ASSERT_FAIL_ASSERT(SOH_Init(NULL_PTR, BS_NR_OF_STRINGS - 1u)); - TEST_ASSERT_FAIL_ASSERT(SOH_Init(&table_test, BS_NR_OF_STRINGS)); + TEST_ASSERT_FAIL_ASSERT(SE_InitializeStateOfHealth(NULL_PTR, BS_NR_OF_STRINGS - 1u)); + TEST_ASSERT_FAIL_ASSERT(SE_InitializeStateOfHealth(&table_test, BS_NR_OF_STRINGS)); - TEST_ASSERT_FAIL_ASSERT(SOH_Calculation(NULL_PTR)); + TEST_ASSERT_FAIL_ASSERT(SE_CalculateStateOfHealth(NULL_PTR)); } diff --git a/tests/unit/app/application/algorithm/state_estimation/soh/debug/test_soh_debug_cfg.c b/tests/unit/app/application/algorithm/state_estimation/soh/debug/test_soh_debug_cfg.c index f8293ea6..49c627f9 100644 --- a/tests/unit/app/application/algorithm/state_estimation/soh/debug/test_soh_debug_cfg.c +++ b/tests/unit/app/application/algorithm/state_estimation/soh/debug/test_soh_debug_cfg.c @@ -43,8 +43,8 @@ * @file test_soh_debug_cfg.c * @author foxBMS Team * @date 2021-12-14 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/application/algorithm/state_estimation/soh/none/test_soh_none.c b/tests/unit/app/application/algorithm/state_estimation/soh/none/test_soh_none.c index 24daec89..c3d9a693 100644 --- a/tests/unit/app/application/algorithm/state_estimation/soh/none/test_soh_none.c +++ b/tests/unit/app/application/algorithm/state_estimation/soh/none/test_soh_none.c @@ -43,8 +43,8 @@ * @file test_soh_none.c * @author foxBMS Team * @date 2020-10-14 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * @@ -72,8 +72,8 @@ void tearDown(void) { /** test invalid input values */ void testInvalidInput(void) { DATA_BLOCK_SOX_s table_test = {.header.uniqueId = DATA_BLOCK_ID_SOX}; - TEST_ASSERT_FAIL_ASSERT(SOH_Init(NULL_PTR, BS_NR_OF_STRINGS - 1u)); - TEST_ASSERT_FAIL_ASSERT(SOH_Init(&table_test, BS_NR_OF_STRINGS)); + TEST_ASSERT_FAIL_ASSERT(SE_InitializeStateOfHealth(NULL_PTR, BS_NR_OF_STRINGS - 1u)); + TEST_ASSERT_FAIL_ASSERT(SE_InitializeStateOfHealth(&table_test, BS_NR_OF_STRINGS)); - TEST_ASSERT_FAIL_ASSERT(SOH_Calculation(NULL_PTR)); + TEST_ASSERT_FAIL_ASSERT(SE_CalculateStateOfHealth(NULL_PTR)); } diff --git a/tests/unit/app/application/algorithm/state_estimation/soh/none/test_soh_none_cfg.c b/tests/unit/app/application/algorithm/state_estimation/soh/none/test_soh_none_cfg.c index 8ee16bf6..e1c1bfb2 100644 --- a/tests/unit/app/application/algorithm/state_estimation/soh/none/test_soh_none_cfg.c +++ b/tests/unit/app/application/algorithm/state_estimation/soh/none/test_soh_none_cfg.c @@ -43,8 +43,8 @@ * @file test_soh_none_cfg.c * @author foxBMS Team * @date 2021-12-14 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/application/algorithm/state_estimation/test_state_estimation.c b/tests/unit/app/application/algorithm/state_estimation/test_state_estimation.c index eca75608..8e7e0ce7 100644 --- a/tests/unit/app/application/algorithm/state_estimation/test_state_estimation.c +++ b/tests/unit/app/application/algorithm/state_estimation/test_state_estimation.c @@ -43,8 +43,8 @@ * @file test_state_estimation.c * @author foxBMS Team * @date 2020-10-14 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * @@ -81,18 +81,18 @@ void testInvalidInput(void) { TEST_ASSERT_FAIL_ASSERT(SE_InitializeSoh(BS_NR_OF_STRINGS)); - TEST_ASSERT_FAIL_ASSERT(SOC_Init(NULL_PTR, true, BS_NR_OF_STRINGS - 1u)); - TEST_ASSERT_FAIL_ASSERT(SOC_Init(&table_test, true, BS_NR_OF_STRINGS)); + TEST_ASSERT_FAIL_ASSERT(SE_InitializeStateOfCharge(NULL_PTR, true, BS_NR_OF_STRINGS - 1u)); + TEST_ASSERT_FAIL_ASSERT(SE_InitializeStateOfCharge(&table_test, true, BS_NR_OF_STRINGS)); - TEST_ASSERT_FAIL_ASSERT(SOC_Calculation(NULL_PTR)); + TEST_ASSERT_FAIL_ASSERT(SE_CalculateStateOfCharge(NULL_PTR)); - TEST_ASSERT_FAIL_ASSERT(SOE_Init(NULL_PTR, true, BS_NR_OF_STRINGS - 1u)); - TEST_ASSERT_FAIL_ASSERT(SOE_Init(&table_test, true, BS_NR_OF_STRINGS)); + TEST_ASSERT_FAIL_ASSERT(SE_InitializeStateOfEnergy(NULL_PTR, true, BS_NR_OF_STRINGS - 1u)); + TEST_ASSERT_FAIL_ASSERT(SE_InitializeStateOfEnergy(&table_test, true, BS_NR_OF_STRINGS)); - TEST_ASSERT_FAIL_ASSERT(SOE_Calculation(NULL_PTR)); + TEST_ASSERT_FAIL_ASSERT(SE_CalculateStateOfEnergy(NULL_PTR)); - TEST_ASSERT_FAIL_ASSERT(SOH_Init(NULL_PTR, BS_NR_OF_STRINGS - 1u)); - TEST_ASSERT_FAIL_ASSERT(SOH_Init(&table_test, BS_NR_OF_STRINGS)); + TEST_ASSERT_FAIL_ASSERT(SE_InitializeStateOfHealth(NULL_PTR, BS_NR_OF_STRINGS - 1u)); + TEST_ASSERT_FAIL_ASSERT(SE_InitializeStateOfHealth(&table_test, BS_NR_OF_STRINGS)); - TEST_ASSERT_FAIL_ASSERT(SOH_Calculation(NULL_PTR)); + TEST_ASSERT_FAIL_ASSERT(SE_CalculateStateOfHealth(NULL_PTR)); } diff --git a/tests/unit/app/application/algorithm/test_algorithm.c b/tests/unit/app/application/algorithm/test_algorithm.c index 92d02336..7fe0778d 100644 --- a/tests/unit/app/application/algorithm/test_algorithm.c +++ b/tests/unit/app/application/algorithm/test_algorithm.c @@ -43,8 +43,8 @@ * @file test_algorithm.c * @author foxBMS Team * @date 2020-06-30 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * @@ -137,7 +137,7 @@ void testUnlockInitializationInvalidAlgorithmConfiguration(void) { const uint32_t storeCycleTime = algo_algorithms[0].cycleTime_ms; /* set to an invalid cycle time */ - algo_algorithms[0].cycleTime_ms = ALGO_TICK_MS + 1u; + algo_algorithms[0].cycleTime_ms = ALGO_TICK_ms + 1u; TEST_ASSERT_FAIL_ASSERT(ALGO_MainFunction()); diff --git a/tests/unit/app/application/bal/history/test_bal_strategy_history.c b/tests/unit/app/application/bal/history/test_bal_strategy_history.c index 15623f47..9956fcc4 100644 --- a/tests/unit/app/application/bal/history/test_bal_strategy_history.c +++ b/tests/unit/app/application/bal/history/test_bal_strategy_history.c @@ -43,8 +43,8 @@ * @file test_bal_strategy_history.c * @author foxBMS Team * @date 2020-06-05 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/application/bal/none/test_bal_strategy_none.c b/tests/unit/app/application/bal/none/test_bal_strategy_none.c index f941b669..2120f38a 100644 --- a/tests/unit/app/application/bal/none/test_bal_strategy_none.c +++ b/tests/unit/app/application/bal/none/test_bal_strategy_none.c @@ -43,8 +43,8 @@ * @file test_bal_strategy_none.c * @author foxBMS Team * @date 2020-08-03 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/application/bal/test_bal.c b/tests/unit/app/application/bal/test_bal.c index 6006b71d..afef5218 100644 --- a/tests/unit/app/application/bal/test_bal.c +++ b/tests/unit/app/application/bal/test_bal.c @@ -43,8 +43,8 @@ * @file test_bal.c * @author foxBMS Team * @date 2020-08-05 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/application/bal/voltage/test_bal_strategy_voltage.c b/tests/unit/app/application/bal/voltage/test_bal_strategy_voltage.c index 358b8b84..95369ba2 100644 --- a/tests/unit/app/application/bal/voltage/test_bal_strategy_voltage.c +++ b/tests/unit/app/application/bal/voltage/test_bal_strategy_voltage.c @@ -43,8 +43,8 @@ * @file test_bal_strategy_voltage.c * @author foxBMS Team * @date 2020-06-05 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/application/bms/test_bms.c b/tests/unit/app/application/bms/test_bms.c index 4b506edd..dcc3bfbf 100644 --- a/tests/unit/app/application/bms/test_bms.c +++ b/tests/unit/app/application/bms/test_bms.c @@ -43,8 +43,8 @@ * @file test_bms.c * @author foxBMS Team * @date 2020-04-01 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * @@ -73,11 +73,11 @@ #include "test_assert_helper.h" /*========== Definitions and Implementations for Unit Test ==================*/ -DIAG_ID_CFG_s DIAG_ID_cfg[] = {}; +DIAG_ID_CFG_s diag_diagnosisIdConfiguration[] = {}; DIAG_DEV_s diag_device = { - .nrOfConfiguredDiagnosisEntries = sizeof(DIAG_ID_cfg) / sizeof(DIAG_ID_CFG_s), - .pConfigurationOfDiagnosisEntries = &DIAG_ID_cfg[0], + .nrOfConfiguredDiagnosisEntries = sizeof(diag_diagnosisIdConfiguration) / sizeof(DIAG_ID_CFG_s), + .pConfigurationOfDiagnosisEntries = &diag_diagnosisIdConfiguration[0], .numberOfFatalErrors = 0u, }; diff --git a/tests/unit/app/application/config/test_bal_cfg.c b/tests/unit/app/application/config/test_bal_cfg.c index 78a44300..3584b28f 100644 --- a/tests/unit/app/application/config/test_bal_cfg.c +++ b/tests/unit/app/application/config/test_bal_cfg.c @@ -43,8 +43,8 @@ * @file test_bal_cfg.c * @author foxBMS Team * @date 2022-02-26 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/application/config/test_battery_cell_cfg.c b/tests/unit/app/application/config/test_battery_cell_cfg.c index 61bde7ea..8cabbb3d 100644 --- a/tests/unit/app/application/config/test_battery_cell_cfg.c +++ b/tests/unit/app/application/config/test_battery_cell_cfg.c @@ -43,8 +43,8 @@ * @file test_battery_cell_cfg.c * @author foxBMS Team * @date 2020-10-08 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/application/config/test_battery_system_cfg.c b/tests/unit/app/application/config/test_battery_system_cfg.c index f782184c..da434b34 100644 --- a/tests/unit/app/application/config/test_battery_system_cfg.c +++ b/tests/unit/app/application/config/test_battery_system_cfg.c @@ -43,8 +43,8 @@ * @file test_battery_system_cfg.c * @author foxBMS Team * @date 2020-04-02 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/application/config/test_soa_cfg.c b/tests/unit/app/application/config/test_soa_cfg.c index 8e166851..57da8c4b 100644 --- a/tests/unit/app/application/config/test_soa_cfg.c +++ b/tests/unit/app/application/config/test_soa_cfg.c @@ -43,8 +43,8 @@ * @file test_soa_cfg.c * @author foxBMS Team * @date 2020-04-01 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/application/plausibility/test_plausibility.c b/tests/unit/app/application/plausibility/test_plausibility.c index eb9bc94f..dc55289a 100644 --- a/tests/unit/app/application/plausibility/test_plausibility.c +++ b/tests/unit/app/application/plausibility/test_plausibility.c @@ -43,8 +43,8 @@ * @file test_plausibility.c * @author foxBMS Team * @date 2020-04-01 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/application/redundancy/test_redundancy.c b/tests/unit/app/application/redundancy/test_redundancy.c index ad5da592..571db472 100644 --- a/tests/unit/app/application/redundancy/test_redundancy.c +++ b/tests/unit/app/application/redundancy/test_redundancy.c @@ -43,8 +43,8 @@ * @file test_redundancy.c * @author foxBMS Team * @date 2020-07-31 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/application/soa/test_soa.c b/tests/unit/app/application/soa/test_soa.c index 11e5fba0..b37d8260 100644 --- a/tests/unit/app/application/soa/test_soa.c +++ b/tests/unit/app/application/soa/test_soa.c @@ -43,8 +43,8 @@ * @file test_soa.c * @author foxBMS Team * @date 2020-04-01 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/adc/test_adc.c b/tests/unit/app/driver/adc/test_adc.c index 30e0cc81..add54bd4 100644 --- a/tests/unit/app/driver/adc/test_adc.c +++ b/tests/unit/app/driver/adc/test_adc.c @@ -43,8 +43,8 @@ * @file test_adc.c * @author foxBMS Team * @date 2020-04-01 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/afe/api/test_afe_plausibility.c b/tests/unit/app/driver/afe/api/test_afe_plausibility.c index abbedec3..917761e6 100644 --- a/tests/unit/app/driver/afe/api/test_afe_plausibility.c +++ b/tests/unit/app/driver/afe/api/test_afe_plausibility.c @@ -43,8 +43,8 @@ * @file test_afe_plausibility.c * @author foxBMS Team * @date 2020-07-13 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/afe/debug/default/api/test_debug_default_afe.c b/tests/unit/app/driver/afe/debug/default/api/test_debug_default_afe.c index 0300d7cc..213c1285 100644 --- a/tests/unit/app/driver/afe/debug/default/api/test_debug_default_afe.c +++ b/tests/unit/app/driver/afe/debug/default/api/test_debug_default_afe.c @@ -43,8 +43,8 @@ * @file test_debug_default_afe.c * @author foxBMS Team * @date 2020-05-25 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/afe/debug/default/api/test_debug_default_afe_dma.c b/tests/unit/app/driver/afe/debug/default/api/test_debug_default_afe_dma.c index fb16444b..e48e34a3 100644 --- a/tests/unit/app/driver/afe/debug/default/api/test_debug_default_afe_dma.c +++ b/tests/unit/app/driver/afe/debug/default/api/test_debug_default_afe_dma.c @@ -43,8 +43,8 @@ * @file test_debug_default_afe_dma.c * @author foxBMS Team * @date 2020-06-10 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/afe/debug/default/config/test_debug_default_cfg.c b/tests/unit/app/driver/afe/debug/default/config/test_debug_default_cfg.c index e9315ba7..9792335d 100644 --- a/tests/unit/app/driver/afe/debug/default/config/test_debug_default_cfg.c +++ b/tests/unit/app/driver/afe/debug/default/config/test_debug_default_cfg.c @@ -43,8 +43,8 @@ * @file test_debug_default_cfg.c * @author foxBMS Team * @date 2020-09-29 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/afe/debug/default/test_debug_default.c b/tests/unit/app/driver/afe/debug/default/test_debug_default.c index 78f794a0..a660baeb 100644 --- a/tests/unit/app/driver/afe/debug/default/test_debug_default.c +++ b/tests/unit/app/driver/afe/debug/default/test_debug_default.c @@ -43,8 +43,8 @@ * @file test_debug_default.c * @author foxBMS Team * @date 2020-09-17 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/afe/ltc/6806/config/test_ltc_6806_cfg.c b/tests/unit/app/driver/afe/ltc/6806/config/test_ltc_6806_cfg.c index 8973f3aa..5aa8399b 100644 --- a/tests/unit/app/driver/afe/ltc/6806/config/test_ltc_6806_cfg.c +++ b/tests/unit/app/driver/afe/ltc/6806/config/test_ltc_6806_cfg.c @@ -43,8 +43,8 @@ * @file test_ltc_6806_cfg.c * @author foxBMS Team * @date 2020-04-01 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/afe/ltc/6806/test_ltc_6806.c b/tests/unit/app/driver/afe/ltc/6806/test_ltc_6806.c index c98ec272..ae31fb30 100644 --- a/tests/unit/app/driver/afe/ltc/6806/test_ltc_6806.c +++ b/tests/unit/app/driver/afe/ltc/6806/test_ltc_6806.c @@ -43,8 +43,8 @@ * @file test_ltc_6806.c * @author foxBMS Team * @date 2020-07-13 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * @@ -76,7 +76,7 @@ TEST_FILE("ltc_6806.c") /*========== Definitions and Implementations for Unit Test ==================*/ /** SPI data configuration struct for LTC communication */ -static const spiDAT1_t spi_kLtcDataConfig[BS_NR_OF_STRINGS] = { +static spiDAT1_t spi_kLtcDataConfig[BS_NR_OF_STRINGS] = { { /* struct is implemented in the TI HAL and uses uppercase true and false */ .CS_HOLD = TRUE, /* If true, HW chip select kept active between words */ diff --git a/tests/unit/app/driver/afe/ltc/6806/test_ltc_6806_pec_in_arrays.c b/tests/unit/app/driver/afe/ltc/6806/test_ltc_6806_pec_in_arrays.c index 8ba4534e..d31f5028 100644 --- a/tests/unit/app/driver/afe/ltc/6806/test_ltc_6806_pec_in_arrays.c +++ b/tests/unit/app/driver/afe/ltc/6806/test_ltc_6806_pec_in_arrays.c @@ -43,8 +43,8 @@ * @file test_ltc_6806_pec_in_arrays.c * @author foxBMS Team * @date 2020-12-16 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * @@ -90,18 +90,6 @@ SPI_INTERFACE_CONFIG_s spi_ltcInterface[BS_NR_OF_STRINGS] = { .pGioPort = &(spiREG1->PC3), .csPin = 2u, }, - { - .pConfig = &spi_kLtcDataConfig, - .pNode = spiREG1, - .pGioPort = &(spiREG1->PC3), - .csPin = 2u, - }, - { - .pConfig = &spi_kLtcDataConfig, - .pNode = spiREG1, - .pGioPort = &(spiREG1->PC3), - .csPin = 2u, - }, }; SPI_INTERFACE_CONFIG_s spi_ltcInterfaceSecondary[BS_NR_OF_STRINGS] = { diff --git a/tests/unit/app/driver/afe/ltc/6813-1/config/test_ltc_6813-1_cfg.c b/tests/unit/app/driver/afe/ltc/6813-1/config/test_ltc_6813-1_cfg.c index 61c22929..4ddc10f9 100644 --- a/tests/unit/app/driver/afe/ltc/6813-1/config/test_ltc_6813-1_cfg.c +++ b/tests/unit/app/driver/afe/ltc/6813-1/config/test_ltc_6813-1_cfg.c @@ -43,8 +43,8 @@ * @file test_ltc_6813-1_cfg.c * @author foxBMS Team * @date 2020-04-01 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/afe/ltc/6813-1/test_ltc_6813-1.c b/tests/unit/app/driver/afe/ltc/6813-1/test_ltc_6813-1.c index a6175632..9ddc60a7 100644 --- a/tests/unit/app/driver/afe/ltc/6813-1/test_ltc_6813-1.c +++ b/tests/unit/app/driver/afe/ltc/6813-1/test_ltc_6813-1.c @@ -43,8 +43,8 @@ * @file test_ltc_6813-1.c * @author foxBMS Team * @date 2020-03-30 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/afe/ltc/6813-1/test_ltc_6813-1_pec_in_arrays.c b/tests/unit/app/driver/afe/ltc/6813-1/test_ltc_6813-1_pec_in_arrays.c index d5140ff6..f9777e53 100644 --- a/tests/unit/app/driver/afe/ltc/6813-1/test_ltc_6813-1_pec_in_arrays.c +++ b/tests/unit/app/driver/afe/ltc/6813-1/test_ltc_6813-1_pec_in_arrays.c @@ -43,8 +43,8 @@ * @file test_ltc_6813-1_pec_in_arrays.c * @author foxBMS Team * @date 2020-03-30 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/afe/ltc/api/test_ltc_afe.c b/tests/unit/app/driver/afe/ltc/api/test_ltc_afe.c index 43a0476c..6cab539a 100644 --- a/tests/unit/app/driver/afe/ltc/api/test_ltc_afe.c +++ b/tests/unit/app/driver/afe/ltc/api/test_ltc_afe.c @@ -43,8 +43,8 @@ * @file test_ltc_afe.c * @author foxBMS Team * @date 2020-05-25 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * @@ -78,10 +78,10 @@ uint8_t ltc_TXPECbuffer[LTC_N_BYTES_FOR_DATA_TRANSMISSION] = {0}; #define DMA_REQ_LINE_SPI3_TX (DMA_REQ15) #define DMA_REQ_LINE_SPI3_RX (DMA_REQ14) -#define BIG_ENDIAN (3U) -#define ELEMENT_COUNT (1U) -#define DMAREQEN_BIT (0x10000U) -#define SPIEN_BIT (0x1000000U) +#define BIG_ENDIAN (3u) +#define ELEMENT_COUNT (1u) +#define DMAREQEN_BIT (0x10000u) +#define SPIEN_BIT (0x1000000u) #define DMA_REQ_LINE_TX (DMA_REQ_LINE_SPI1_TX) #define DMA_REQ_LINE_RX (DMA_REQ_LINE_SPI1_RX) diff --git a/tests/unit/app/driver/afe/ltc/common/config/test_ltc_afe_dma_cfg.c b/tests/unit/app/driver/afe/ltc/common/config/test_ltc_afe_dma_cfg.c index d9e73bac..dff0f4f0 100644 --- a/tests/unit/app/driver/afe/ltc/common/config/test_ltc_afe_dma_cfg.c +++ b/tests/unit/app/driver/afe/ltc/common/config/test_ltc_afe_dma_cfg.c @@ -43,8 +43,8 @@ * @file test_ltc_afe_dma_cfg.c * @author foxBMS Team * @date 2020-04-01 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/afe/ltc/common/test_ltc_afe_dma.c b/tests/unit/app/driver/afe/ltc/common/test_ltc_afe_dma.c index 4cc947f6..842a4515 100644 --- a/tests/unit/app/driver/afe/ltc/common/test_ltc_afe_dma.c +++ b/tests/unit/app/driver/afe/ltc/common/test_ltc_afe_dma.c @@ -43,8 +43,8 @@ * @file test_ltc_afe_dma.c * @author foxBMS Team * @date 2020-06-10 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * @@ -76,10 +76,10 @@ uint8_t ltc_TXPECbuffer[LTC_N_BYTES_FOR_DATA_TRANSMISSION] = {0}; #define DMA_REQ_LINE_SPI3_TX (DMA_REQ15) #define DMA_REQ_LINE_SPI3_RX (DMA_REQ14) -#define BIG_ENDIAN (3U) -#define ELEMENT_COUNT (1U) -#define DMAREQEN_BIT (0x10000U) -#define SPIEN_BIT (0x1000000U) +#define BIG_ENDIAN (3u) +#define ELEMENT_COUNT (1u) +#define DMAREQEN_BIT (0x10000u) +#define SPIEN_BIT (0x1000000u) #define DMA_REQ_LINE_TX (DMA_REQ_LINE_SPI1_TX) #define DMA_REQ_LINE_RX (DMA_REQ_LINE_SPI1_RX) diff --git a/tests/unit/app/driver/afe/maxim/api/test_mxm_afe.c b/tests/unit/app/driver/afe/maxim/api/test_mxm_afe.c index f2332a32..a4a4df45 100644 --- a/tests/unit/app/driver/afe/maxim/api/test_mxm_afe.c +++ b/tests/unit/app/driver/afe/maxim/api/test_mxm_afe.c @@ -43,8 +43,8 @@ * @file test_mxm_afe.c * @author foxBMS Team * @date 2020-06-17 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/afe/maxim/common/config/test_mxm_cfg.c b/tests/unit/app/driver/afe/maxim/common/config/test_mxm_cfg.c index 0efade7c..f9eb4b50 100644 --- a/tests/unit/app/driver/afe/maxim/common/config/test_mxm_cfg.c +++ b/tests/unit/app/driver/afe/maxim/common/config/test_mxm_cfg.c @@ -43,8 +43,8 @@ * @file test_mxm_cfg.c * @author foxBMS Team * @date 2020-06-24 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * @@ -64,7 +64,7 @@ /*========== Definitions and Implementations for Unit Test ==================*/ /* SPI interface configuration for MXM communication */ -SPI_INTERFACE_CONFIG_s spi_MxmInterface = { +SPI_INTERFACE_CONFIG_s spi_mxmInterface = { .pConfig = 0, .pNode = 0, .pGioPort = 0, @@ -102,10 +102,10 @@ void testMXM_EnableBridgeIc(void) { } void testMXM_GetSpiStateReady(void) { - SPI_CheckInterfaceAvailable_ExpectAndReturn(spi_MxmInterface.pNode, STD_OK); + SPI_CheckInterfaceAvailable_ExpectAndReturn(spi_mxmInterface.pNode, STD_OK); TEST_ASSERT_EQUAL(STD_OK, MXM_GetSPIStateReady()); - SPI_CheckInterfaceAvailable_ExpectAndReturn(spi_MxmInterface.pNode, STD_NOT_OK); + SPI_CheckInterfaceAvailable_ExpectAndReturn(spi_mxmInterface.pNode, STD_NOT_OK); TEST_ASSERT_EQUAL(STD_NOT_OK, MXM_GetSPIStateReady()); } @@ -114,7 +114,7 @@ void testMXM_SendData(void) { uint16_t buffer = 0; uint16_t bufferLength = 1; - SPI_TransmitData_ExpectAndReturn(&spi_MxmInterface, &buffer, bufferLength, STD_OK); + SPI_TransmitData_ExpectAndReturn(&spi_mxmInterface, &buffer, bufferLength, STD_OK); DIAG_CheckEvent_ExpectAndReturn(STD_OK, DIAG_ID_AFE_SPI, DIAG_STRING, 0u, STD_OK); TEST_ASSERT_EQUAL(STD_OK, MXM_SendData(&buffer, bufferLength)); } @@ -124,7 +124,7 @@ void testMXM_ReceiveData(void) { uint16_t buffer = 0; uint16_t bufferLength = 1; - SPI_TransmitReceiveData_ExpectAndReturn(&spi_MxmInterface, &buffer, &buffer, bufferLength, STD_OK); + SPI_TransmitReceiveData_ExpectAndReturn(&spi_mxmInterface, &buffer, &buffer, bufferLength, STD_OK); DIAG_CheckEvent_ExpectAndReturn(STD_OK, DIAG_ID_AFE_SPI, DIAG_STRING, 0u, STD_OK); TEST_ASSERT_EQUAL(STD_OK, MXM_ReceiveData(&buffer, &buffer, bufferLength)); } diff --git a/tests/unit/app/driver/afe/maxim/common/test_mxm_17841b.c b/tests/unit/app/driver/afe/maxim/common/test_mxm_17841b.c index a06cba4a..70974b6c 100644 --- a/tests/unit/app/driver/afe/maxim/common/test_mxm_17841b.c +++ b/tests/unit/app/driver/afe/maxim/common/test_mxm_17841b.c @@ -43,8 +43,8 @@ * @file test_mxm_17841b.c * @author foxBMS Team * @date 2020-06-22 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix MXM * diff --git a/tests/unit/app/driver/afe/maxim/common/test_mxm_1785x.c b/tests/unit/app/driver/afe/maxim/common/test_mxm_1785x.c index ddb34357..dab33ae2 100644 --- a/tests/unit/app/driver/afe/maxim/common/test_mxm_1785x.c +++ b/tests/unit/app/driver/afe/maxim/common/test_mxm_1785x.c @@ -43,8 +43,8 @@ * @file test_mxm_1785x.c * @author foxBMS Team * @date 2020-07-02 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix MXM * diff --git a/tests/unit/app/driver/afe/maxim/common/test_mxm_1785x_tools.c b/tests/unit/app/driver/afe/maxim/common/test_mxm_1785x_tools.c index f971764f..bf706df2 100644 --- a/tests/unit/app/driver/afe/maxim/common/test_mxm_1785x_tools.c +++ b/tests/unit/app/driver/afe/maxim/common/test_mxm_1785x_tools.c @@ -43,8 +43,8 @@ * @file test_mxm_1785x_tools.c * @author foxBMS Team * @date 2020-07-15 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix MXM * diff --git a/tests/unit/app/driver/afe/maxim/common/test_mxm_afe_dma.c b/tests/unit/app/driver/afe/maxim/common/test_mxm_afe_dma.c index 769b42df..a3ddeafc 100644 --- a/tests/unit/app/driver/afe/maxim/common/test_mxm_afe_dma.c +++ b/tests/unit/app/driver/afe/maxim/common/test_mxm_afe_dma.c @@ -43,8 +43,8 @@ * @file test_mxm_afe_dma.c * @author foxBMS Team * @date 2020-06-17 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/afe/maxim/common/test_mxm_battery_management.c b/tests/unit/app/driver/afe/maxim/common/test_mxm_battery_management.c index 891616f1..4d9d7a5d 100644 --- a/tests/unit/app/driver/afe/maxim/common/test_mxm_battery_management.c +++ b/tests/unit/app/driver/afe/maxim/common/test_mxm_battery_management.c @@ -43,8 +43,8 @@ * @file test_mxm_battery_management.c * @author foxBMS Team * @date 2020-07-02 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix MXM * diff --git a/tests/unit/app/driver/afe/maxim/common/test_mxm_bitextract.c b/tests/unit/app/driver/afe/maxim/common/test_mxm_bitextract.c index 5e40af48..4740364d 100644 --- a/tests/unit/app/driver/afe/maxim/common/test_mxm_bitextract.c +++ b/tests/unit/app/driver/afe/maxim/common/test_mxm_bitextract.c @@ -43,8 +43,8 @@ * @file test_mxm_bitextract.c * @author foxBMS Team * @date 2020-04-07 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/afe/maxim/common/test_mxm_crc8.c b/tests/unit/app/driver/afe/maxim/common/test_mxm_crc8.c index 792cee6c..fa2be686 100644 --- a/tests/unit/app/driver/afe/maxim/common/test_mxm_crc8.c +++ b/tests/unit/app/driver/afe/maxim/common/test_mxm_crc8.c @@ -43,8 +43,8 @@ * @file test_mxm_crc8.c * @author foxBMS Team * @date 2020-03-13 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix MXM * diff --git a/tests/unit/app/driver/afe/maxim/common/test_mxm_register_map.c b/tests/unit/app/driver/afe/maxim/common/test_mxm_register_map.c index d6607e87..38c17163 100644 --- a/tests/unit/app/driver/afe/maxim/common/test_mxm_register_map.c +++ b/tests/unit/app/driver/afe/maxim/common/test_mxm_register_map.c @@ -43,8 +43,8 @@ * @file test_mxm_register_map.c * @author foxBMS Team * @date 2020-04-07 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/afe/maxim/common/test_mxm_registry.c b/tests/unit/app/driver/afe/maxim/common/test_mxm_registry.c index 7811b9a5..d772ebb1 100644 --- a/tests/unit/app/driver/afe/maxim/common/test_mxm_registry.c +++ b/tests/unit/app/driver/afe/maxim/common/test_mxm_registry.c @@ -43,8 +43,8 @@ * @file test_mxm_registry.c * @author foxBMS Team * @date 2020-07-16 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix MXM * diff --git a/tests/unit/app/driver/afe/maxim/max17852/test_mxm_17852.c b/tests/unit/app/driver/afe/maxim/max17852/test_mxm_17852.c index 6cd39212..c4522301 100644 --- a/tests/unit/app/driver/afe/maxim/max17852/test_mxm_17852.c +++ b/tests/unit/app/driver/afe/maxim/max17852/test_mxm_17852.c @@ -43,8 +43,8 @@ * @file test_mxm_17852.c * @author foxBMS Team * @date 2021-11-30 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix MXM * diff --git a/tests/unit/app/driver/afe/nxp/common/api/test_nxp_afe.c b/tests/unit/app/driver/afe/nxp/api/test_nxp_afe.c similarity index 96% rename from tests/unit/app/driver/afe/nxp/common/api/test_nxp_afe.c rename to tests/unit/app/driver/afe/nxp/api/test_nxp_afe.c index f6b0a20b..1cf7bc0a 100644 --- a/tests/unit/app/driver/afe/nxp/common/api/test_nxp_afe.c +++ b/tests/unit/app/driver/afe/nxp/api/test_nxp_afe.c @@ -43,8 +43,8 @@ * @file test_nxp_afe.c * @author foxBMS Team * @date 2020-06-10 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * @@ -57,7 +57,7 @@ #include "unity.h" #include "MockHL_sys_dma.h" -#include "Mockn775.h" +#include "Mocknxp_afe.h" #include "afe.h" diff --git a/tests/unit/app/driver/afe/nxp/mc33775a/api/test_nxp_mc33775a_afe.c b/tests/unit/app/driver/afe/nxp/mc33775a/api/test_nxp_mc33775a_afe.c new file mode 100644 index 00000000..ed950c5e --- /dev/null +++ b/tests/unit/app/driver/afe/nxp/mc33775a/api/test_nxp_mc33775a_afe.c @@ -0,0 +1,110 @@ +/** + * + * @copyright © 2010 - 2022, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. + * All rights reserved. + * + * 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®″ + * + */ + +/** + * @file test_nxp_mc33775a_afe.c + * @author foxBMS Team + * @date 2020-06-10 (date of creation) + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 + * @ingroup UNIT_TEST_IMPLEMENTATION + * @prefix TEST + * + * @brief Test of some module + * + */ + +/*========== Includes =======================================================*/ +#include "general.h" + +#include "unity.h" +#include "Mockafe_dma.h" +#include "Mockdma.h" +#include "Mocknxp_mc33775a.h" +#include "Mockos.h" +#include "Mockpex.h" + +TEST_FILE("nxp_mc33775a_afe.c") + +/*========== Definitions and Implementations for Unit Test ==================*/ + +static DATA_BLOCK_CELL_VOLTAGE_s n775_cellVoltage = {.header.uniqueId = DATA_BLOCK_ID_CELL_VOLTAGE_BASE}; +static DATA_BLOCK_CELL_TEMPERATURE_s n775_cellTemperature = {.header.uniqueId = DATA_BLOCK_ID_CELL_TEMPERATURE_BASE}; +static DATA_BLOCK_MIN_MAX_s n775_minMax = {.header.uniqueId = DATA_BLOCK_ID_MIN_MAX}; +static DATA_BLOCK_BALANCING_CONTROL_s n775_balancingControl = {.header.uniqueId = DATA_BLOCK_ID_BALANCING_CONTROL}; +static DATA_BLOCK_ALL_GPIO_VOLTAGES_s n775_allGpioVoltage = {.header.uniqueId = DATA_BLOCK_ID_ALL_GPIO_VOLTAGES_BASE}; +static DATA_BLOCK_BALANCING_FEEDBACK_s n775_balancingFeedback = { + .header.uniqueId = DATA_BLOCK_ID_BALANCING_FEEDBACK_BASE}; +static DATA_BLOCK_SLAVE_CONTROL_s n775_slaveControl = {.header.uniqueId = DATA_BLOCK_ID_SLAVE_CONTROL}; +static DATA_BLOCK_OPEN_WIRE_s n775_openwire = {.header.uniqueId = DATA_BLOCK_ID_OPEN_WIRE_BASE}; +static N775_SUPPLY_CURRENT_s n775_supplyCurrent = {0}; +static N775_ERRORTABLE_s n775_errorTable = {0}; + +N775_STATE_s n775_stateBase = { + .firstMeasurementMade = false, + .currentString = 0u, + .pSpiTxSequenceStart = NULL_PTR, + .pSpiTxSequence = NULL_PTR, + .pSpiRxSequenceStart = NULL_PTR, + .pSpiRxSequence = NULL_PTR, + .currentMux = {0u}, + .pMuxSequenceStart = NULL_PTR, + .pMuxSequence = NULL_PTR, + .n775Data.cellVoltage = &n775_cellVoltage, + .n775Data.cellTemperature = &n775_cellTemperature, + .n775Data.allGpioVoltage = &n775_allGpioVoltage, + .n775Data.minMax = &n775_minMax, + .n775Data.balancingFeedback = &n775_balancingFeedback, + .n775Data.balancingControl = &n775_balancingControl, + .n775Data.slaveControl = &n775_slaveControl, + .n775Data.openWire = &n775_openwire, + .n775Data.supplyCurrent = &n775_supplyCurrent, + .n775Data.errorTable = &n775_errorTable, +}; + +/*========== Setup and Teardown =============================================*/ +void setUp(void) { +} + +void tearDown(void) { +} + +/*========== Test Cases =====================================================*/ diff --git a/tests/unit/app/driver/afe/nxp/common/config/test_nxp_afe_dma_cfg.c b/tests/unit/app/driver/afe/nxp/mc33775a/config/test_nxp_afe_dma_cfg.c similarity index 97% rename from tests/unit/app/driver/afe/nxp/common/config/test_nxp_afe_dma_cfg.c rename to tests/unit/app/driver/afe/nxp/mc33775a/config/test_nxp_afe_dma_cfg.c index 899c0514..71018e99 100644 --- a/tests/unit/app/driver/afe/nxp/common/config/test_nxp_afe_dma_cfg.c +++ b/tests/unit/app/driver/afe/nxp/mc33775a/config/test_nxp_afe_dma_cfg.c @@ -43,8 +43,8 @@ * @file test_nxp_afe_dma_cfg.c * @author foxBMS Team * @date 2020-04-01 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/afe/nxp/common/config/test_n775_cfg.c b/tests/unit/app/driver/afe/nxp/mc33775a/config/test_nxp_mc33775a_cfg.c similarity index 93% rename from tests/unit/app/driver/afe/nxp/common/config/test_n775_cfg.c rename to tests/unit/app/driver/afe/nxp/mc33775a/config/test_nxp_mc33775a_cfg.c index a22c6d10..90f5a9a3 100644 --- a/tests/unit/app/driver/afe/nxp/common/config/test_n775_cfg.c +++ b/tests/unit/app/driver/afe/nxp/mc33775a/config/test_nxp_mc33775a_cfg.c @@ -40,22 +40,23 @@ */ /** - * @file test_n775_cfg.c + * @file test_nxp_mc33775a_cfg.c * @author foxBMS Team * @date 2020-06-10 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * - * @brief Test of the n775_cfg.c module + * @brief Test of some module * */ /*========== Includes =======================================================*/ #include "unity.h" +#include "Mocktsi.h" -#include "n775_cfg.h" +TEST_FILE("nxp_mc33775a_cfg.c") /*========== Definitions and Implementations for Unit Test ==================*/ @@ -67,6 +68,3 @@ void tearDown(void) { } /*========== Test Cases =====================================================*/ - -void testDummy(void) { -} diff --git a/tests/unit/app/driver/afe/nxp/common/test_nxp_afe_dma.c b/tests/unit/app/driver/afe/nxp/mc33775a/test_nxp_afe_dma.c similarity index 75% rename from tests/unit/app/driver/afe/nxp/common/test_nxp_afe_dma.c rename to tests/unit/app/driver/afe/nxp/mc33775a/test_nxp_afe_dma.c index d047cd2b..93878a0a 100644 --- a/tests/unit/app/driver/afe/nxp/common/test_nxp_afe_dma.c +++ b/tests/unit/app/driver/afe/nxp/mc33775a/test_nxp_afe_dma.c @@ -43,41 +43,42 @@ * @file test_nxp_afe_dma.c * @author foxBMS Team * @date 2020-06-10 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * - * @brief Test of the afe_dma.c module in nxp + * @brief Test of some module * */ /*========== Includes =======================================================*/ #include "unity.h" -#include "MockHL_sys_dma.h" +#include "Mockdma.h" #include "Mockio.h" -#include "Mockn775.h" -#include "Mockn775_cfg.h" +#include "Mockmcu.h" +#include "Mocknxp_afe_dma.h" +#include "Mocknxp_mc33775a-ll.h" +#include "Mocknxp_mc33775a.h" +#include "Mockos.h" +#include "Mockspi.h" +#include "Mocktask.h" -#include "nxp_afe_dma.h" +TEST_FILE("nxp_afe_dma.c") /*========== Definitions and Implementations for Unit Test ==================*/ -N775_STATE_s n775_state = { - .timer = 0, - .stateReq = N775_STATE_NO_REQUEST, - .state = N775_STATEMACH_UNINITIALIZED, - .subState = 0, - .lastState = N775_STATEMACH_UNINITIALIZED, - .lastSubState = 0, - .errRequestCounter = 0, - .triggerEntry = 0, - .firstMeasurementMade = STD_NOT_OK, - .checkSpiFlag = STD_NOT_OK, - .balanceControlDone = STD_NOT_OK, - .txTransmitOngoing = false, - .rxTransmitOngoing = false, - .totalMessages = 0u, - .remainingMessages = 0u, + +TaskHandle_t ftsk_taskHandleAfe; + +bool spi_txFinished = false; +bool spi_rxFinished = false; + +spiBASE_t *dma_spiInterfaces[DMA_NUMBER_SPI_INTERFACES] = { + spiREG1, /* SPI1 */ + spiREG2, /* SPI2 */ + spiREG3, /* SPI3 */ + spiREG4, /* SPI4 */ + spiREG5, /* SPI5 */ }; /*========== Setup and Teardown =============================================*/ @@ -88,6 +89,3 @@ void tearDown(void) { } /*========== Test Cases =====================================================*/ - -void testDummy(void) { -} diff --git a/tests/unit/app/driver/afe/nxp/common/test_n775.c b/tests/unit/app/driver/afe/nxp/mc33775a/test_nxp_mc33775a-ll.c similarity index 68% rename from tests/unit/app/driver/afe/nxp/common/test_n775.c rename to tests/unit/app/driver/afe/nxp/mc33775a/test_nxp_mc33775a-ll.c index 1e1b9c73..3c702eb0 100644 --- a/tests/unit/app/driver/afe/nxp/common/test_n775.c +++ b/tests/unit/app/driver/afe/nxp/mc33775a/test_nxp_mc33775a-ll.c @@ -40,52 +40,45 @@ */ /** - * @file test_n775.c + * @file test_nxp_mc33775a-ll.c * @author foxBMS Team - * @date 2020-06-10 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @date 2021-10-20 (date of creation) + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * - * @brief Test of the n775.c module + * @brief Test of some module * */ /*========== Includes =======================================================*/ #include "unity.h" -#include "Mockafe.h" -#include "Mockdatabase.h" -#include "Mockfassert.h" -#include "Mocknxp_afe_dma.h" +#include "Mockdma.h" +#include "Mockio.h" +#include "Mockmcu.h" #include "Mockos.h" #include "Mockspi.h" +#include "Mocktask.h" -#include "n775.h" -#include "spi_cfg-helper.h" +#include "nxp_mc33775a-ll.h" +#include "uc_msg_t.h" + +TEST_FILE("nxp_mc33775a-ll.c") /*========== Definitions and Implementations for Unit Test ==================*/ -/** SPI data configuration struct for NXP MC33775A communication, Tx part */ -static const spiDAT1_t spi_kNxp775DataConfigTx[BS_NR_OF_STRINGS] = { - { - .CS_HOLD = TRUE, /*!< The HW chip select signal is deactivated */ - .WDEL = TRUE, /*!< No delay will be inserted */ - .DFSEL = SPI_FMT_0, /*!< Data word format select */ - .CSNR = SPI_HARDWARE_CHIP_SELECT_2_ACTIVE, /* CS2 enabled */ - }, +/** struct containing the lock state of the SPI interfaces */ +SPI_BUSY_STATE_e spi_busyFlags[] = { + SPI_IDLE, + SPI_IDLE, + SPI_IDLE, + SPI_IDLE, + SPI_IDLE, }; -/** SPI interface configuration for N775 communication Tx part */ -SPI_INTERFACE_CONFIG_s spi_nxp775InterfaceTx[BS_NR_OF_STRINGS] = { - { - .pConfig = &spi_kNxp775DataConfigTx[0u], - .pNode = spiREG1, - .pGioPort = &(spiREG1->PC3), - .csPin = 2u, - .csType = SPI_CHIP_SELECT_HARDWARE, - }, -}; +bool spi_txFinished = false; +bool spi_rxFinished = false; /*========== Setup and Teardown =============================================*/ void setUp(void) { @@ -95,6 +88,3 @@ void tearDown(void) { } /*========== Test Cases =====================================================*/ - -void testDummy(void) { -} diff --git a/tests/unit/app/driver/afe/nxp/mc33775a/test_nxp_mc33775a.c b/tests/unit/app/driver/afe/nxp/mc33775a/test_nxp_mc33775a.c new file mode 100644 index 00000000..b462c15c --- /dev/null +++ b/tests/unit/app/driver/afe/nxp/mc33775a/test_nxp_mc33775a.c @@ -0,0 +1,167 @@ +/** + * + * @copyright © 2010 - 2022, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. + * All rights reserved. + * + * 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®″ + * + */ + +/** + * @file test_nxp_mc33775a.c + * @author foxBMS Team + * @date 2021-10-20 (date of creation) + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 + * @ingroup UNIT_TEST_IMPLEMENTATION + * @prefix TEST + * + * @brief Test of some module + * + */ + +/*========== Includes =======================================================*/ +#include "unity.h" +#include "MockHL_gio.h" +#include "MockHL_system.h" +#include "Mockafe_dma.h" +#include "Mockdatabase.h" +#include "Mockdiag.h" +#include "Mockftask.h" +#include "Mockio.h" +#include "Mockmcu.h" +#include "Mocknxp_mc33775a-ll.h" +#include "Mocknxp_mc33775a_cfg.h" +#include "Mockos.h" +#include "Mockspi.h" + +#include "MC33775A.h" +#include "nxp_mc33775a.h" +#include "spi_cfg-helper.h" +#include "uc_msg_t.h" + +TEST_FILE("nxp_mc33775a.c") + +/*========== Definitions and Implementations for Unit Test ==================*/ + +bool spi_txFinished = false; +bool spi_rxFinished = false; + +/** SPI data configuration struct for NXP MC33775A communication, Tx part */ +static spiDAT1_t spi_kNxp775DataConfigTx[BS_NR_OF_STRINGS] = { + {.CS_HOLD = TRUE, /* If true, HW chip select kept active */ + .WDEL = TRUE, /* Activation of delay between words */ + .DFSEL = SPI_FMT_0, /* Data word format selection */ + .CSNR = SPI_HARDWARE_CHIP_SELECT_2_ACTIVE}, +}; + +/** SPI data configuration struct for NXP MC33775A communication, Rx part */ +static spiDAT1_t spi_kNxp775DataConfigRx[BS_NR_OF_STRINGS] = { + {.CS_HOLD = TRUE, /* If true, HW chip select kept active */ + .WDEL = TRUE, /* Activation of delay between words */ + .DFSEL = SPI_FMT_0, /* Data word format selection */ + .CSNR = SPI_HARDWARE_CHIP_SELECT_0_ACTIVE}, +}; + +/** SPI interface configuration for N775 communication Tx part */ +SPI_INTERFACE_CONFIG_s spi_nxp775InterfaceTx[BS_NR_OF_STRINGS] = { + { + .pConfig = &spi_kNxp775DataConfigTx[0u], + .pNode = spiREG1, + .pGioPort = &(spiREG1->PC3), + .csPin = 2u, + .csType = SPI_CHIP_SELECT_HARDWARE, + }, +}; + +/** SPI interface configuration for N775 communication, Rx part */ +SPI_INTERFACE_CONFIG_s spi_nxp775InterfaceRx[BS_NR_OF_STRINGS] = { + { + .pConfig = &spi_kNxp775DataConfigRx[0u], + .pNode = spiREG4, + .pGioPort = &(spiREG4->PC3), + .csPin = 0u, + .csType = SPI_CHIP_SELECT_HARDWARE, + }, +}; + +/** + * Default multiplexer measurement sequence + * Must be adapted to the application + */ +N775_MUX_CH_CFG_s n775_muxSequence[N775_MUX_SEQUENCE_LENGTH] = { + /* multiplexer 0 measurement */ + { + .muxId = 0, + .muxChannel = 0, + }, + { + .muxId = 0, + .muxChannel = 1, + }, + { + .muxId = 0, + .muxChannel = 2, + }, + { + .muxId = 0, + .muxChannel = 3, + }, + { + .muxId = 0, + .muxChannel = 4, + }, + { + .muxId = 0, + .muxChannel = 5, + }, + { + .muxId = 0, + .muxChannel = 6, + }, + { + .muxId = 0, + .muxChannel = 7, + }, +}; + +/*========== Setup and Teardown =============================================*/ +void setUp(void) { +} + +void tearDown(void) { +} + +/*========== Test Cases =====================================================*/ diff --git a/tests/unit/app/driver/can/cbs/test_can_cbs_rx_command.c b/tests/unit/app/driver/can/cbs/test_can_cbs_rx_command.c index f18b917d..cf28453b 100644 --- a/tests/unit/app/driver/can/cbs/test_can_cbs_rx_command.c +++ b/tests/unit/app/driver/can/cbs/test_can_cbs_rx_command.c @@ -43,8 +43,8 @@ * @file test_can_cbs_rx_command.c * @author foxBMS Team * @date 2021-07-28 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/can/cbs/test_can_cbs_rx_current_sensor.c b/tests/unit/app/driver/can/cbs/test_can_cbs_rx_current_sensor.c index 1d2dd2a3..0815b390 100644 --- a/tests/unit/app/driver/can/cbs/test_can_cbs_rx_current_sensor.c +++ b/tests/unit/app/driver/can/cbs/test_can_cbs_rx_current_sensor.c @@ -43,8 +43,8 @@ * @file test_can_cbs_rx_current_sensor.c * @author foxBMS Team * @date 2021-04-22 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/can/cbs/test_can_cbs_rx_imd.c b/tests/unit/app/driver/can/cbs/test_can_cbs_rx_imd.c index 16d44cbe..25a828a1 100644 --- a/tests/unit/app/driver/can/cbs/test_can_cbs_rx_imd.c +++ b/tests/unit/app/driver/can/cbs/test_can_cbs_rx_imd.c @@ -43,8 +43,8 @@ * @file test_can_cbs_rx_imd.c * @author foxBMS Team * @date 2021-04-22 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/can/cbs/test_can_cbs_rx_misc.c b/tests/unit/app/driver/can/cbs/test_can_cbs_rx_misc.c index e2fd9e2a..fd161a02 100644 --- a/tests/unit/app/driver/can/cbs/test_can_cbs_rx_misc.c +++ b/tests/unit/app/driver/can/cbs/test_can_cbs_rx_misc.c @@ -43,8 +43,8 @@ * @file test_can_cbs_rx_misc.c * @author foxBMS Team * @date 2021-04-22 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/can/cbs/test_can_cbs_tx_limits.c b/tests/unit/app/driver/can/cbs/test_can_cbs_tx_limits.c index 36dc7a56..8a89f641 100644 --- a/tests/unit/app/driver/can/cbs/test_can_cbs_tx_limits.c +++ b/tests/unit/app/driver/can/cbs/test_can_cbs_tx_limits.c @@ -43,8 +43,8 @@ * @file test_can_cbs_tx_limits.c * @author foxBMS Team * @date 2021-07-27 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/can/cbs/test_can_cbs_tx_minmax.c b/tests/unit/app/driver/can/cbs/test_can_cbs_tx_minmax.c index b453efce..9b235bb3 100644 --- a/tests/unit/app/driver/can/cbs/test_can_cbs_tx_minmax.c +++ b/tests/unit/app/driver/can/cbs/test_can_cbs_tx_minmax.c @@ -43,8 +43,8 @@ * @file test_can_cbs_tx_minmax.c * @author foxBMS Team * @date 2021-04-22 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/can/cbs/test_can_cbs_tx_state.c b/tests/unit/app/driver/can/cbs/test_can_cbs_tx_state.c index 83cfdd03..6a831f47 100644 --- a/tests/unit/app/driver/can/cbs/test_can_cbs_tx_state.c +++ b/tests/unit/app/driver/can/cbs/test_can_cbs_tx_state.c @@ -43,8 +43,8 @@ * @file test_can_cbs_tx_state.c * @author foxBMS Team * @date 2021-07-27 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/can/cbs/test_can_cbs_tx_state_estimation.c b/tests/unit/app/driver/can/cbs/test_can_cbs_tx_state_estimation.c index ce72fcdb..fea2a091 100644 --- a/tests/unit/app/driver/can/cbs/test_can_cbs_tx_state_estimation.c +++ b/tests/unit/app/driver/can/cbs/test_can_cbs_tx_state_estimation.c @@ -43,8 +43,8 @@ * @file test_can_cbs_tx_state_estimation.c * @author foxBMS Team * @date 2021-07-27 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/can/cbs/test_can_cbs_tx_system_values.c b/tests/unit/app/driver/can/cbs/test_can_cbs_tx_system_values.c index bc970ad8..a64d4e6e 100644 --- a/tests/unit/app/driver/can/cbs/test_can_cbs_tx_system_values.c +++ b/tests/unit/app/driver/can/cbs/test_can_cbs_tx_system_values.c @@ -43,8 +43,8 @@ * @file test_can_cbs_tx_system_values.c * @author foxBMS Team * @date 2021-07-27 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/can/cbs/test_can_cbs_tx_temperature.c b/tests/unit/app/driver/can/cbs/test_can_cbs_tx_temperature.c index 1c6e4dd7..bb2faa42 100644 --- a/tests/unit/app/driver/can/cbs/test_can_cbs_tx_temperature.c +++ b/tests/unit/app/driver/can/cbs/test_can_cbs_tx_temperature.c @@ -43,8 +43,8 @@ * @file test_can_cbs_tx_temperature.c * @author foxBMS Team * @date 2021-04-22 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/can/cbs/test_can_cbs_tx_voltage.c b/tests/unit/app/driver/can/cbs/test_can_cbs_tx_voltage.c index af4add0f..c472f886 100644 --- a/tests/unit/app/driver/can/cbs/test_can_cbs_tx_voltage.c +++ b/tests/unit/app/driver/can/cbs/test_can_cbs_tx_voltage.c @@ -43,8 +43,8 @@ * @file test_can_cbs_tx_voltage.c * @author foxBMS Team * @date 2021-04-22 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/can/cbs/test_can_helper.c b/tests/unit/app/driver/can/cbs/test_can_helper.c index 76d33b95..0c14d088 100644 --- a/tests/unit/app/driver/can/cbs/test_can_helper.c +++ b/tests/unit/app/driver/can/cbs/test_can_helper.c @@ -43,8 +43,8 @@ * @file test_can_helper.c * @author foxBMS Team * @date 2021-04-22 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/can/test_can.c b/tests/unit/app/driver/can/test_can.c index 9d0e8c16..3dc9a43a 100644 --- a/tests/unit/app/driver/can/test_can.c +++ b/tests/unit/app/driver/can/test_can.c @@ -43,8 +43,8 @@ * @file test_can.c * @author foxBMS Team * @date 2020-04-01 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * @@ -75,7 +75,7 @@ /*========== Definitions and Implementations for Unit Test ==================*/ /* Dummy for version file implementation */ -const VERSION_s foxbmsVersionInfo = { +const VER_VERSION_s ver_foxbmsVersionInformation = { .underVersionControl = true, .isDirty = true, .major = 1, diff --git a/tests/unit/app/driver/checksum/test_checksum.c b/tests/unit/app/driver/checksum/test_checksum.c index 603731e0..0c7f9ca5 100644 --- a/tests/unit/app/driver/checksum/test_checksum.c +++ b/tests/unit/app/driver/checksum/test_checksum.c @@ -43,8 +43,8 @@ * @file test_checksum.c * @author foxBMS Team * @date 2020-04-01 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/config/test_can_cfg.c b/tests/unit/app/driver/config/test_can_cfg.c index dcf466f0..dca2fae2 100644 --- a/tests/unit/app/driver/config/test_can_cfg.c +++ b/tests/unit/app/driver/config/test_can_cfg.c @@ -43,8 +43,8 @@ * @file test_can_cfg.c * @author foxBMS Team * @date 2020-07-28 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/config/test_contactor_cfg.c b/tests/unit/app/driver/config/test_contactor_cfg.c index dff9cd9e..44c30367 100644 --- a/tests/unit/app/driver/config/test_contactor_cfg.c +++ b/tests/unit/app/driver/config/test_contactor_cfg.c @@ -43,8 +43,8 @@ * @file test_contactor_cfg.c * @author foxBMS Team * @date 2020-04-01 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/config/test_dma_cfg.c b/tests/unit/app/driver/config/test_dma_cfg.c index 1e7d586e..0e1f8d98 100644 --- a/tests/unit/app/driver/config/test_dma_cfg.c +++ b/tests/unit/app/driver/config/test_dma_cfg.c @@ -43,8 +43,8 @@ * @file test_dma_cfg.c * @author foxBMS Team * @date 2020-04-01 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/config/test_fram_cfg.c b/tests/unit/app/driver/config/test_fram_cfg.c index ba475bfe..b3897285 100644 --- a/tests/unit/app/driver/config/test_fram_cfg.c +++ b/tests/unit/app/driver/config/test_fram_cfg.c @@ -43,8 +43,8 @@ * @file test_fram_cfg.c * @author foxBMS Team * @date 2020-04-01 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/config/test_interlock_cfg.c b/tests/unit/app/driver/config/test_interlock_cfg.c index fc4abb67..0f6f4ee9 100644 --- a/tests/unit/app/driver/config/test_interlock_cfg.c +++ b/tests/unit/app/driver/config/test_interlock_cfg.c @@ -43,8 +43,8 @@ * @file test_interlock_cfg.c * @author foxBMS Team * @date 2020-04-01 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/config/test_nxpfs85xx_cfg.c b/tests/unit/app/driver/config/test_nxpfs85xx_cfg.c index 92184beb..0e28d414 100644 --- a/tests/unit/app/driver/config/test_nxpfs85xx_cfg.c +++ b/tests/unit/app/driver/config/test_nxpfs85xx_cfg.c @@ -43,8 +43,8 @@ * @file test_nxpfs85xx_cfg.c * @author foxBMS Team * @date 2020-04-01 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/config/test_pex_cfg.c b/tests/unit/app/driver/config/test_pex_cfg.c index d0579cf4..0e0f7cae 100644 --- a/tests/unit/app/driver/config/test_pex_cfg.c +++ b/tests/unit/app/driver/config/test_pex_cfg.c @@ -43,8 +43,8 @@ * @file test_pex_cfg.c * @author foxBMS Team * @date 2021-08-03 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/config/test_spi_cfg.c b/tests/unit/app/driver/config/test_spi_cfg.c index 1e33a609..028a2176 100644 --- a/tests/unit/app/driver/config/test_spi_cfg.c +++ b/tests/unit/app/driver/config/test_spi_cfg.c @@ -43,8 +43,8 @@ * @file test_spi_cfg.c * @author foxBMS Team * @date 2020-04-01 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/config/test_sps_cfg.c b/tests/unit/app/driver/config/test_sps_cfg.c index 3a3b0626..a6ec381e 100644 --- a/tests/unit/app/driver/config/test_sps_cfg.c +++ b/tests/unit/app/driver/config/test_sps_cfg.c @@ -43,8 +43,8 @@ * @file test_sps_cfg.c * @author foxBMS Team * @date 2020-10-28 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/contactor/test_contactor.c b/tests/unit/app/driver/contactor/test_contactor.c index 828717f3..b1a076c2 100644 --- a/tests/unit/app/driver/contactor/test_contactor.c +++ b/tests/unit/app/driver/contactor/test_contactor.c @@ -43,8 +43,8 @@ * @file test_contactor.c * @author foxBMS Team * @date 2020-03-31 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/crc/test_crc.c b/tests/unit/app/driver/crc/test_crc.c index a146e2db..fb5a2e9e 100644 --- a/tests/unit/app/driver/crc/test_crc.c +++ b/tests/unit/app/driver/crc/test_crc.c @@ -43,8 +43,8 @@ * @file test_crc.c * @author foxBMS Team * @date 2022-02-23 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/dma/test_dma.c b/tests/unit/app/driver/dma/test_dma.c index 45be2b72..4b902ba8 100644 --- a/tests/unit/app/driver/dma/test_dma.c +++ b/tests/unit/app/driver/dma/test_dma.c @@ -43,8 +43,8 @@ * @file test_dma.c * @author foxBMS Team * @date 2020-04-01 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/foxmath/test_foxmath.c b/tests/unit/app/driver/foxmath/test_foxmath.c index 653f86b5..e2c23a7d 100644 --- a/tests/unit/app/driver/foxmath/test_foxmath.c +++ b/tests/unit/app/driver/foxmath/test_foxmath.c @@ -43,8 +43,8 @@ * @file test_foxmath.c * @author foxBMS Team * @date 2020-04-01 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/fram/test_fram.c b/tests/unit/app/driver/fram/test_fram.c index fd960861..05d31cba 100644 --- a/tests/unit/app/driver/fram/test_fram.c +++ b/tests/unit/app/driver/fram/test_fram.c @@ -43,8 +43,8 @@ * @file test_fram.c * @author foxBMS Team * @date 2020-04-01 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/htsensor/test_htsensor.c b/tests/unit/app/driver/htsensor/test_htsensor.c index 62688f45..2f2949d0 100644 --- a/tests/unit/app/driver/htsensor/test_htsensor.c +++ b/tests/unit/app/driver/htsensor/test_htsensor.c @@ -43,8 +43,8 @@ * @file test_htsensor.c * @author foxBMS Team * @date 2021-08-05 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/i2c/test_i2c.c b/tests/unit/app/driver/i2c/test_i2c.c index 1f32c06f..f0a13762 100644 --- a/tests/unit/app/driver/i2c/test_i2c.c +++ b/tests/unit/app/driver/i2c/test_i2c.c @@ -43,8 +43,8 @@ * @file test_i2c.c * @author foxBMS Team * @date 2021-07-23 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/imd/bender/ir155/test_bender_ir155.c b/tests/unit/app/driver/imd/bender/ir155/test_bender_ir155.c index 82ca1a57..f4c8f7a6 100644 --- a/tests/unit/app/driver/imd/bender/ir155/test_bender_ir155.c +++ b/tests/unit/app/driver/imd/bender/ir155/test_bender_ir155.c @@ -43,8 +43,8 @@ * @file test_bender_ir155.c * @author foxBMS Team * @date 2020-04-01 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/imd/bender/ir155/test_bender_ir155_helper.c b/tests/unit/app/driver/imd/bender/ir155/test_bender_ir155_helper.c index 5bef0ed7..0f85e683 100644 --- a/tests/unit/app/driver/imd/bender/ir155/test_bender_ir155_helper.c +++ b/tests/unit/app/driver/imd/bender/ir155/test_bender_ir155_helper.c @@ -43,8 +43,8 @@ * @file test_bender_ir155_helper.c * @author foxBMS Team * @date 2020-11-02 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/imd/bender/iso165c/config/test_bender_iso165c_cfg.c b/tests/unit/app/driver/imd/bender/iso165c/config/test_bender_iso165c_cfg.c index 6a28c835..64423efb 100644 --- a/tests/unit/app/driver/imd/bender/iso165c/config/test_bender_iso165c_cfg.c +++ b/tests/unit/app/driver/imd/bender/iso165c/config/test_bender_iso165c_cfg.c @@ -43,8 +43,8 @@ * @file test_bender_iso165c_cfg.c * @author foxBMS Team * @date 2021-03-29 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/imd/bender/iso165c/test_bender_iso165c.c b/tests/unit/app/driver/imd/bender/iso165c/test_bender_iso165c.c index 8a81783f..efc5b68e 100644 --- a/tests/unit/app/driver/imd/bender/iso165c/test_bender_iso165c.c +++ b/tests/unit/app/driver/imd/bender/iso165c/test_bender_iso165c.c @@ -43,8 +43,8 @@ * @file test_bender_iso165c.c * @author foxBMS Team * @date 2021-01-19 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/imd/none/test_no-imd.c b/tests/unit/app/driver/imd/none/test_no-imd.c index 82862d9b..bcdc2e2a 100644 --- a/tests/unit/app/driver/imd/none/test_no-imd.c +++ b/tests/unit/app/driver/imd/none/test_no-imd.c @@ -43,8 +43,8 @@ * @file test_no-imd.c * @author foxBMS Team * @date 2020-04-01 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/imd/test_imd.c b/tests/unit/app/driver/imd/test_imd.c index bfd55942..879b2a65 100644 --- a/tests/unit/app/driver/imd/test_imd.c +++ b/tests/unit/app/driver/imd/test_imd.c @@ -43,8 +43,8 @@ * @file test_imd.c * @author foxBMS Team * @date 2021-11-15 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/interlock/test_interlock.c b/tests/unit/app/driver/interlock/test_interlock.c index 970ea61b..b26766c7 100644 --- a/tests/unit/app/driver/interlock/test_interlock.c +++ b/tests/unit/app/driver/interlock/test_interlock.c @@ -43,8 +43,8 @@ * @file test_interlock.c * @author foxBMS Team * @date 2020-04-01 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/io/test_io.c b/tests/unit/app/driver/io/test_io.c index d0da03f3..b7b99f25 100644 --- a/tests/unit/app/driver/io/test_io.c +++ b/tests/unit/app/driver/io/test_io.c @@ -43,8 +43,8 @@ * @file test_io.c * @author foxBMS Team * @date 2020-06-10 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/led/test_led.c b/tests/unit/app/driver/led/test_led.c index 10d91d39..77ee9ec5 100644 --- a/tests/unit/app/driver/led/test_led.c +++ b/tests/unit/app/driver/led/test_led.c @@ -43,8 +43,8 @@ * @file test_led.c * @author foxBMS Team * @date 2020-10-05 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/mcu/test_mcu.c b/tests/unit/app/driver/mcu/test_mcu.c index 32a8a6a0..02d2eee6 100644 --- a/tests/unit/app/driver/mcu/test_mcu.c +++ b/tests/unit/app/driver/mcu/test_mcu.c @@ -43,8 +43,8 @@ * @file test_mcu.c * @author foxBMS Team * @date 2020-04-01 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/meas/test_meas.c b/tests/unit/app/driver/meas/test_meas.c index d1d109c2..18688fb9 100644 --- a/tests/unit/app/driver/meas/test_meas.c +++ b/tests/unit/app/driver/meas/test_meas.c @@ -43,8 +43,8 @@ * @file test_meas.c * @author foxBMS Team * @date 2020-04-01 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/pex/test_pex.c b/tests/unit/app/driver/pex/test_pex.c index 62e9e776..d5c8ad1c 100644 --- a/tests/unit/app/driver/pex/test_pex.c +++ b/tests/unit/app/driver/pex/test_pex.c @@ -43,8 +43,8 @@ * @file test_pex.c * @author foxBMS Team * @date 2021-09-29 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/pwm/test_pwm.c b/tests/unit/app/driver/pwm/test_pwm.c index bcb68337..0d714f9e 100644 --- a/tests/unit/app/driver/pwm/test_pwm.c +++ b/tests/unit/app/driver/pwm/test_pwm.c @@ -43,8 +43,8 @@ * @file test_pwm.c * @author foxBMS Team * @date 2021-10-08 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/rtc/test_rtc.c b/tests/unit/app/driver/rtc/test_rtc.c index 29ed206b..35042f0b 100644 --- a/tests/unit/app/driver/rtc/test_rtc.c +++ b/tests/unit/app/driver/rtc/test_rtc.c @@ -43,8 +43,8 @@ * @file test_rtc.c * @author foxBMS Team * @date 2020-04-01 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/sbc/test_nxpfs85xx.c b/tests/unit/app/driver/sbc/test_nxpfs85xx.c index d274f67c..4cca35c8 100644 --- a/tests/unit/app/driver/sbc/test_nxpfs85xx.c +++ b/tests/unit/app/driver/sbc/test_nxpfs85xx.c @@ -43,8 +43,8 @@ * @file test_nxpfs85xx.c * @author foxBMS Team * @date 2020-04-06 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix SBC * @@ -65,11 +65,18 @@ #include "Mocksbc_fs8x_communication.h" #include "Mockspi.h" +#include "nxpfs85xx.h" +#include "test_assert_helper.h" + /* #include "nxpfs85xx.h" can't be included because of call of FSYS_SwitchToUserMode */ TEST_FILE("nxpfs85xx.c") /*========== Definitions and Implementations for Unit Test ==================*/ +#define REGISTER_TEST_VALUE (1234u) + +#define MAIN_REGISTER fs85xx_mcuSupervisor.mainRegister +#define FAILSAFE_REGISTER fs85xx_mcuSupervisor.fsRegister static const spiDAT1_t spi_kSbcDataConfig = { /* struct is implemented in the TI HAL and uses uppercase true and false */ @@ -106,3 +113,100 @@ void tearDown(void) { void testDoSomething(void) { } + +void testSBC_CheckRegisterValues(void) { + TEST_ASSERT_EQUAL(STD_OK, TEST_SBC_CheckRegisterValues(0u, 0u)); + TEST_ASSERT_EQUAL(STD_OK, TEST_SBC_CheckRegisterValues(UINT32_MAX, UINT32_MAX)); + TEST_ASSERT_EQUAL(STD_NOT_OK, TEST_SBC_CheckRegisterValues(0u, 1u)); + TEST_ASSERT_EQUAL(STD_NOT_OK, TEST_SBC_CheckRegisterValues(0u, UINT32_MAX)); +} + +void testSBC_UpdateRegister(void) { + TEST_SBC_UpdateRegister(&fs85xx_mcuSupervisor, true, 0u, REGISTER_TEST_VALUE); + TEST_SBC_UpdateRegister(&fs85xx_mcuSupervisor, false, 0u, REGISTER_TEST_VALUE); + TEST_ASSERT_FAIL_ASSERT(TEST_SBC_UpdateRegister(NULL_PTR, true, 0u, REGISTER_TEST_VALUE)); + TEST_ASSERT_FAIL_ASSERT( + TEST_SBC_UpdateRegister(&fs85xx_mcuSupervisor, true, FS8X_M_DEVICEID_ADDR + 1u, REGISTER_TEST_VALUE)); +} + +void testSBC_UpdateFailSafeRegister(void) { + TEST_SBC_UpdateFailSafeRegister( + &(fs85xx_mcuSupervisor.fsRegister), FS8X_FS_GRL_FLAGS_ADDR, REGISTER_TEST_VALUE + 0u); + TEST_SBC_UpdateFailSafeRegister( + &(fs85xx_mcuSupervisor.fsRegister), FS8X_FS_I_OVUV_SAFE_REACTION1_ADDR, REGISTER_TEST_VALUE + 1u); + TEST_SBC_UpdateFailSafeRegister( + &(fs85xx_mcuSupervisor.fsRegister), FS8X_FS_I_OVUV_SAFE_REACTION2_ADDR, REGISTER_TEST_VALUE + 2u); + TEST_SBC_UpdateFailSafeRegister( + &(fs85xx_mcuSupervisor.fsRegister), FS8X_FS_I_WD_CFG_ADDR, REGISTER_TEST_VALUE + 3u); + TEST_SBC_UpdateFailSafeRegister( + &(fs85xx_mcuSupervisor.fsRegister), FS8X_FS_I_SAFE_INPUTS_ADDR, REGISTER_TEST_VALUE + 4u); + TEST_SBC_UpdateFailSafeRegister(&(fs85xx_mcuSupervisor.fsRegister), FS8X_FS_I_FSSM_ADDR, REGISTER_TEST_VALUE + 5u); + TEST_SBC_UpdateFailSafeRegister(&(fs85xx_mcuSupervisor.fsRegister), FS8X_FS_I_SVS_ADDR, REGISTER_TEST_VALUE + 6u); + TEST_SBC_UpdateFailSafeRegister( + &(fs85xx_mcuSupervisor.fsRegister), FS8X_FS_WD_WINDOW_ADDR, REGISTER_TEST_VALUE + 7u); + TEST_SBC_UpdateFailSafeRegister(&(fs85xx_mcuSupervisor.fsRegister), FS8X_FS_WD_SEED_ADDR, REGISTER_TEST_VALUE + 8u); + TEST_SBC_UpdateFailSafeRegister( + &(fs85xx_mcuSupervisor.fsRegister), FS8X_FS_WD_ANSWER_ADDR, REGISTER_TEST_VALUE + 9u); + TEST_SBC_UpdateFailSafeRegister( + &(fs85xx_mcuSupervisor.fsRegister), FS8X_FS_OVUVREG_STATUS_ADDR, REGISTER_TEST_VALUE + 10u); + TEST_SBC_UpdateFailSafeRegister( + &(fs85xx_mcuSupervisor.fsRegister), FS8X_FS_RELEASE_FS0B_ADDR, REGISTER_TEST_VALUE + 11u); + TEST_SBC_UpdateFailSafeRegister( + &(fs85xx_mcuSupervisor.fsRegister), FS8X_FS_SAFE_IOS_ADDR, REGISTER_TEST_VALUE + 12u); + TEST_SBC_UpdateFailSafeRegister( + &(fs85xx_mcuSupervisor.fsRegister), FS8X_FS_DIAG_SAFETY_ADDR, REGISTER_TEST_VALUE + 13u); + TEST_SBC_UpdateFailSafeRegister( + &(fs85xx_mcuSupervisor.fsRegister), FS8X_FS_INTB_MASK_ADDR, REGISTER_TEST_VALUE + 14u); + TEST_SBC_UpdateFailSafeRegister(&(fs85xx_mcuSupervisor.fsRegister), FS8X_FS_STATES_ADDR, REGISTER_TEST_VALUE + 15u); + + TEST_ASSERT_EQUAL(FAILSAFE_REGISTER.grl_flags, REGISTER_TEST_VALUE + 0u); + TEST_ASSERT_EQUAL(FAILSAFE_REGISTER.iOvervoltageUndervoltageSafeReaction1, REGISTER_TEST_VALUE + 1u); + TEST_ASSERT_EQUAL(FAILSAFE_REGISTER.iOvervoltageUndervoltageSafeReaction2, REGISTER_TEST_VALUE + 2u); + TEST_ASSERT_EQUAL(FAILSAFE_REGISTER.iWatchdogConfiguration, REGISTER_TEST_VALUE + 3u); + TEST_ASSERT_EQUAL(FAILSAFE_REGISTER.i_safe_inputs, REGISTER_TEST_VALUE + 4u); + TEST_ASSERT_EQUAL(FAILSAFE_REGISTER.iFailSafeSateMachine, REGISTER_TEST_VALUE + 5u); + TEST_ASSERT_EQUAL(FAILSAFE_REGISTER.i_svs, REGISTER_TEST_VALUE + 6u); + TEST_ASSERT_EQUAL(FAILSAFE_REGISTER.watchdogWindow, REGISTER_TEST_VALUE + 7u); + TEST_ASSERT_EQUAL(FAILSAFE_REGISTER.watchdogSeed, REGISTER_TEST_VALUE + 8u); + TEST_ASSERT_EQUAL(FAILSAFE_REGISTER.watchdogAnswer, REGISTER_TEST_VALUE + 9u); + TEST_ASSERT_EQUAL(FAILSAFE_REGISTER.overvoltageUndervoltageRegisterStatus, REGISTER_TEST_VALUE + 10u); + TEST_ASSERT_EQUAL(FAILSAFE_REGISTER.releaseFs0bPin, REGISTER_TEST_VALUE + 11u); + TEST_ASSERT_EQUAL(FAILSAFE_REGISTER.safeIos, REGISTER_TEST_VALUE + 12u); + TEST_ASSERT_EQUAL(FAILSAFE_REGISTER.diag_safety, REGISTER_TEST_VALUE + 13u); + TEST_ASSERT_EQUAL(FAILSAFE_REGISTER.intb_mask, REGISTER_TEST_VALUE + 14u); + TEST_ASSERT_EQUAL(FAILSAFE_REGISTER.states, REGISTER_TEST_VALUE + 15u); +} + +void testSBC_UpdateMainRegister(void) { + TEST_SBC_UpdateMainRegister(&(fs85xx_mcuSupervisor.mainRegister), FS8X_M_FLAG_ADDR, REGISTER_TEST_VALUE + 0u); + TEST_SBC_UpdateMainRegister(&(fs85xx_mcuSupervisor.mainRegister), FS8X_M_MODE_ADDR, REGISTER_TEST_VALUE + 1u); + TEST_SBC_UpdateMainRegister(&(fs85xx_mcuSupervisor.mainRegister), FS8X_M_REG_CTRL1_ADDR, REGISTER_TEST_VALUE + 2u); + TEST_SBC_UpdateMainRegister(&(fs85xx_mcuSupervisor.mainRegister), FS8X_M_REG_CTRL2_ADDR, REGISTER_TEST_VALUE + 3u); + TEST_SBC_UpdateMainRegister(&(fs85xx_mcuSupervisor.mainRegister), FS8X_M_AMUX_ADDR, REGISTER_TEST_VALUE + 4u); + TEST_SBC_UpdateMainRegister(&(fs85xx_mcuSupervisor.mainRegister), FS8X_M_CLOCK_ADDR, REGISTER_TEST_VALUE + 5u); + TEST_SBC_UpdateMainRegister(&(fs85xx_mcuSupervisor.mainRegister), FS8X_M_INT_MASK1_ADDR, REGISTER_TEST_VALUE + 6u); + TEST_SBC_UpdateMainRegister(&(fs85xx_mcuSupervisor.mainRegister), FS8X_M_INT_MASK2_ADDR, REGISTER_TEST_VALUE + 7u); + TEST_SBC_UpdateMainRegister(&(fs85xx_mcuSupervisor.mainRegister), FS8X_M_FLAG1_ADDR, REGISTER_TEST_VALUE + 8u); + TEST_SBC_UpdateMainRegister(&(fs85xx_mcuSupervisor.mainRegister), FS8X_M_FLAG2_ADDR, REGISTER_TEST_VALUE + 9u); + TEST_SBC_UpdateMainRegister(&(fs85xx_mcuSupervisor.mainRegister), FS8X_M_VMON_REGX_ADDR, REGISTER_TEST_VALUE + 10u); + TEST_SBC_UpdateMainRegister(&(fs85xx_mcuSupervisor.mainRegister), FS8X_M_LVB1_SVS_ADDR, REGISTER_TEST_VALUE + 11u); + TEST_SBC_UpdateMainRegister(&(fs85xx_mcuSupervisor.mainRegister), FS8X_M_MEMORY0_ADDR, REGISTER_TEST_VALUE + 12u); + TEST_SBC_UpdateMainRegister(&(fs85xx_mcuSupervisor.mainRegister), FS8X_M_MEMORY1_ADDR, REGISTER_TEST_VALUE + 13u); + TEST_SBC_UpdateMainRegister(&(fs85xx_mcuSupervisor.mainRegister), FS8X_M_DEVICEID_ADDR, REGISTER_TEST_VALUE + 14u); + + TEST_ASSERT_EQUAL(MAIN_REGISTER.flag, REGISTER_TEST_VALUE + 0u); + TEST_ASSERT_EQUAL(MAIN_REGISTER.mode, REGISTER_TEST_VALUE + 1u); + TEST_ASSERT_EQUAL(MAIN_REGISTER.registerControl1, REGISTER_TEST_VALUE + 2u); + TEST_ASSERT_EQUAL(MAIN_REGISTER.registerControl2, REGISTER_TEST_VALUE + 3u); + TEST_ASSERT_EQUAL(MAIN_REGISTER.analogMultiplexer, REGISTER_TEST_VALUE + 4u); + TEST_ASSERT_EQUAL(MAIN_REGISTER.clock, REGISTER_TEST_VALUE + 5u); + TEST_ASSERT_EQUAL(MAIN_REGISTER.int_mask1, REGISTER_TEST_VALUE + 6u); + TEST_ASSERT_EQUAL(MAIN_REGISTER.int_mask2, REGISTER_TEST_VALUE + 7u); + TEST_ASSERT_EQUAL(MAIN_REGISTER.flag1, REGISTER_TEST_VALUE + 8u); + TEST_ASSERT_EQUAL(MAIN_REGISTER.flag2, REGISTER_TEST_VALUE + 9u); + TEST_ASSERT_EQUAL(MAIN_REGISTER.vmon_regx, REGISTER_TEST_VALUE + 10u); + TEST_ASSERT_EQUAL(MAIN_REGISTER.lvb1_svs, REGISTER_TEST_VALUE + 11u); + TEST_ASSERT_EQUAL(MAIN_REGISTER.memory0, REGISTER_TEST_VALUE + 12u); + TEST_ASSERT_EQUAL(MAIN_REGISTER.memory1, REGISTER_TEST_VALUE + 13u); + TEST_ASSERT_EQUAL(MAIN_REGISTER.deviceId, REGISTER_TEST_VALUE + 14u); +} diff --git a/tests/unit/app/driver/sbc/test_sbc.c b/tests/unit/app/driver/sbc/test_sbc.c index 6f6e9aec..b61578b0 100644 --- a/tests/unit/app/driver/sbc/test_sbc.c +++ b/tests/unit/app/driver/sbc/test_sbc.c @@ -43,8 +43,8 @@ * @file test_sbc.c * @author foxBMS Team * @date 2020-07-15 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix SBC * @@ -83,3 +83,21 @@ void tearDown(void) { void testSBC_Trigger(void) { } + +void testSBC_TriggerWatchdogIfRequired(void) { + TEST_ASSERT_FALSE(TEST_SBC_TriggerWatchdogIfRequired(&sbc_stateMcuSupervisor)); + sbc_stateMcuSupervisor.watchdogTrigger = 10u; + /* decrement so we are going to see a trigger event */ + for (int i = 0; i < sbc_stateMcuSupervisor.watchdogPeriod_10ms - 1; i++) { + TEST_ASSERT_FALSE(TEST_SBC_TriggerWatchdogIfRequired(&sbc_stateMcuSupervisor)); + } + /* timer has elapsed now, we should see a trigger event */ + SBC_TriggerWatchdog_IgnoreAndReturn(STD_OK); + TEST_ASSERT_TRUE(TEST_SBC_TriggerWatchdogIfRequired(&sbc_stateMcuSupervisor)); + TEST_ASSERT_EQUAL(sbc_stateMcuSupervisor.watchdogTrigger, sbc_stateMcuSupervisor.watchdogPeriod_10ms); + + /* elapse timer and fail to run watchdog trigger */ + sbc_stateMcuSupervisor.watchdogTrigger = 1u; + SBC_TriggerWatchdog_IgnoreAndReturn(STD_NOT_OK); + TEST_ASSERT_FALSE(TEST_SBC_TriggerWatchdogIfRequired(&sbc_stateMcuSupervisor)); +} diff --git a/tests/unit/app/driver/spi/test_spi.c b/tests/unit/app/driver/spi/test_spi.c index 0c5f4dc0..925ff4ff 100644 --- a/tests/unit/app/driver/spi/test_spi.c +++ b/tests/unit/app/driver/spi/test_spi.c @@ -43,8 +43,8 @@ * @file test_spi.c * @author foxBMS Team * @date 2020-04-01 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/sps/test_sps.c b/tests/unit/app/driver/sps/test_sps.c index 802e0912..00c14d5c 100644 --- a/tests/unit/app/driver/sps/test_sps.c +++ b/tests/unit/app/driver/sps/test_sps.c @@ -43,8 +43,8 @@ * @file test_sps.c * @author foxBMS Team * @date 2020-10-28 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/ts/api/test_tsi_limits.c b/tests/unit/app/driver/ts/api/test_tsi_limits.c index f7a2f94d..ad44c0d2 100644 --- a/tests/unit/app/driver/ts/api/test_tsi_limits.c +++ b/tests/unit/app/driver/ts/api/test_tsi_limits.c @@ -43,8 +43,8 @@ * @file test_tsi_limits.c * @author foxBMS Team * @date 2021-01-15 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TSI * diff --git a/tests/unit/app/driver/ts/epcos/b57251v5103j060/lookup-table/test_epcos_b57251v5103j060_lookup-table.c b/tests/unit/app/driver/ts/epcos/b57251v5103j060/lookup-table/test_epcos_b57251v5103j060_lookup-table.c index 2b6a4cee..8c92ca5a 100644 --- a/tests/unit/app/driver/ts/epcos/b57251v5103j060/lookup-table/test_epcos_b57251v5103j060_lookup-table.c +++ b/tests/unit/app/driver/ts/epcos/b57251v5103j060/lookup-table/test_epcos_b57251v5103j060_lookup-table.c @@ -43,8 +43,8 @@ * @file test_epcos_b57251v5103j060_lookup-table.c * @author foxBMS Team * @date 2020-08-25 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/ts/epcos/b57251v5103j060/polynomial/test_epcos_b57251v5103j060_polynomial.c b/tests/unit/app/driver/ts/epcos/b57251v5103j060/polynomial/test_epcos_b57251v5103j060_polynomial.c index f7c41e53..481a3222 100644 --- a/tests/unit/app/driver/ts/epcos/b57251v5103j060/polynomial/test_epcos_b57251v5103j060_polynomial.c +++ b/tests/unit/app/driver/ts/epcos/b57251v5103j060/polynomial/test_epcos_b57251v5103j060_polynomial.c @@ -43,8 +43,8 @@ * @file test_epcos_b57251v5103j060_polynomial.c * @author foxBMS Team * @date 2020-08-25 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/ts/epcos/b57251v5103j060/test_epcos_b57251v5103j060.c b/tests/unit/app/driver/ts/epcos/b57251v5103j060/test_epcos_b57251v5103j060.c index f41de8ba..2e11988b 100644 --- a/tests/unit/app/driver/ts/epcos/b57251v5103j060/test_epcos_b57251v5103j060.c +++ b/tests/unit/app/driver/ts/epcos/b57251v5103j060/test_epcos_b57251v5103j060.c @@ -43,8 +43,8 @@ * @file test_epcos_b57251v5103j060.c * @author foxBMS Team * @date 2020-04-01 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/ts/epcos/b57861s0103f045/lookup-table/test_epcos_b57861s0103f045_lookup-table.c b/tests/unit/app/driver/ts/epcos/b57861s0103f045/lookup-table/test_epcos_b57861s0103f045_lookup-table.c index 557895c3..0e35a817 100644 --- a/tests/unit/app/driver/ts/epcos/b57861s0103f045/lookup-table/test_epcos_b57861s0103f045_lookup-table.c +++ b/tests/unit/app/driver/ts/epcos/b57861s0103f045/lookup-table/test_epcos_b57861s0103f045_lookup-table.c @@ -43,8 +43,8 @@ * @file test_epcos_b57861s0103f045_lookup-table.c * @author foxBMS Team * @date 2020-08-25 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/ts/epcos/b57861s0103f045/polynomial/test_epcos_b57861s0103f045_polynomial.c b/tests/unit/app/driver/ts/epcos/b57861s0103f045/polynomial/test_epcos_b57861s0103f045_polynomial.c index 0f0ba557..955aeaed 100644 --- a/tests/unit/app/driver/ts/epcos/b57861s0103f045/polynomial/test_epcos_b57861s0103f045_polynomial.c +++ b/tests/unit/app/driver/ts/epcos/b57861s0103f045/polynomial/test_epcos_b57861s0103f045_polynomial.c @@ -43,8 +43,8 @@ * @file test_epcos_b57861s0103f045_polynomial.c * @author foxBMS Team * @date 2020-08-25 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/ts/epcos/b57861s0103f045/test_epcos_b57861s0103f045.c b/tests/unit/app/driver/ts/epcos/b57861s0103f045/test_epcos_b57861s0103f045.c index 225ba838..ed13e8ad 100644 --- a/tests/unit/app/driver/ts/epcos/b57861s0103f045/test_epcos_b57861s0103f045.c +++ b/tests/unit/app/driver/ts/epcos/b57861s0103f045/test_epcos_b57861s0103f045.c @@ -43,8 +43,8 @@ * @file test_epcos_b57861s0103f045.c * @author foxBMS Team * @date 2020-04-01 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/ts/fake/none/lookup-table/test_fake_none_lookup-table.c b/tests/unit/app/driver/ts/fake/none/lookup-table/test_fake_none_lookup-table.c index 070d98f7..853476ff 100644 --- a/tests/unit/app/driver/ts/fake/none/lookup-table/test_fake_none_lookup-table.c +++ b/tests/unit/app/driver/ts/fake/none/lookup-table/test_fake_none_lookup-table.c @@ -43,8 +43,8 @@ * @file test_fake_none_lookup-table.c * @author foxBMS Team * @date 2020-08-25 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/ts/fake/none/polynomial/test_fake_none_polynomial.c b/tests/unit/app/driver/ts/fake/none/polynomial/test_fake_none_polynomial.c index b98a90a9..58cd09a9 100644 --- a/tests/unit/app/driver/ts/fake/none/polynomial/test_fake_none_polynomial.c +++ b/tests/unit/app/driver/ts/fake/none/polynomial/test_fake_none_polynomial.c @@ -43,8 +43,8 @@ * @file test_fake_none_polynomial.c * @author foxBMS Team * @date 2020-08-25 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/ts/fake/none/test_fake_none.c b/tests/unit/app/driver/ts/fake/none/test_fake_none.c index 6f753cdb..103b169c 100644 --- a/tests/unit/app/driver/ts/fake/none/test_fake_none.c +++ b/tests/unit/app/driver/ts/fake/none/test_fake_none.c @@ -43,8 +43,8 @@ * @file test_fake_none.c * @author foxBMS Team * @date 2020-08-25 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/ts/test_beta.c b/tests/unit/app/driver/ts/test_beta.c index 7b91cd87..fbf16126 100644 --- a/tests/unit/app/driver/ts/test_beta.c +++ b/tests/unit/app/driver/ts/test_beta.c @@ -43,8 +43,8 @@ * @file test_beta.c * @author foxBMS Team * @date 2020-03-13 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix BETA * diff --git a/tests/unit/app/driver/ts/vishay/ntcalug01a103g/lookup-table/test_vishay_ntcalug01a103g_lookup-table.c b/tests/unit/app/driver/ts/vishay/ntcalug01a103g/lookup-table/test_vishay_ntcalug01a103g_lookup-table.c index c1b2c871..544f33db 100644 --- a/tests/unit/app/driver/ts/vishay/ntcalug01a103g/lookup-table/test_vishay_ntcalug01a103g_lookup-table.c +++ b/tests/unit/app/driver/ts/vishay/ntcalug01a103g/lookup-table/test_vishay_ntcalug01a103g_lookup-table.c @@ -43,8 +43,8 @@ * @file test_vishay_ntcalug01a103g_lookup-table.c * @author foxBMS Team * @date 2020-08-25 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/ts/vishay/ntcalug01a103g/polynomial/test_vishay_ntcalug01a103g_polynomial.c b/tests/unit/app/driver/ts/vishay/ntcalug01a103g/polynomial/test_vishay_ntcalug01a103g_polynomial.c index dfd3e3c5..d9cc7e51 100644 --- a/tests/unit/app/driver/ts/vishay/ntcalug01a103g/polynomial/test_vishay_ntcalug01a103g_polynomial.c +++ b/tests/unit/app/driver/ts/vishay/ntcalug01a103g/polynomial/test_vishay_ntcalug01a103g_polynomial.c @@ -43,8 +43,8 @@ * @file test_vishay_ntcalug01a103g_polynomial.c * @author foxBMS Team * @date 2020-08-25 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/ts/vishay/ntcalug01a103g/test_vishay_ntcalug01a103g.c b/tests/unit/app/driver/ts/vishay/ntcalug01a103g/test_vishay_ntcalug01a103g.c index 96de4dd4..0fed8d46 100644 --- a/tests/unit/app/driver/ts/vishay/ntcalug01a103g/test_vishay_ntcalug01a103g.c +++ b/tests/unit/app/driver/ts/vishay/ntcalug01a103g/test_vishay_ntcalug01a103g.c @@ -43,8 +43,8 @@ * @file test_vishay_ntcalug01a103g.c * @author foxBMS Team * @date 2020-04-01 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/ts/vishay/ntcle317e4103sba/lookup-table/test_vishay_ntcle317e4103sba_lookup-table.c b/tests/unit/app/driver/ts/vishay/ntcle317e4103sba/lookup-table/test_vishay_ntcle317e4103sba_lookup-table.c index 2237685b..333cde07 100644 --- a/tests/unit/app/driver/ts/vishay/ntcle317e4103sba/lookup-table/test_vishay_ntcle317e4103sba_lookup-table.c +++ b/tests/unit/app/driver/ts/vishay/ntcle317e4103sba/lookup-table/test_vishay_ntcle317e4103sba_lookup-table.c @@ -43,8 +43,8 @@ * @file test_vishay_ntcle317e4103sba_lookup-table.c * @author foxBMS Team * @date 2021-11-02 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/driver/ts/vishay/ntcle317e4103sba/test_vishay_ntcle317e4103sba.c b/tests/unit/app/driver/ts/vishay/ntcle317e4103sba/test_vishay_ntcle317e4103sba.c index 9debb7da..0fbf8223 100644 --- a/tests/unit/app/driver/ts/vishay/ntcle317e4103sba/test_vishay_ntcle317e4103sba.c +++ b/tests/unit/app/driver/ts/vishay/ntcle317e4103sba/test_vishay_ntcle317e4103sba.c @@ -43,8 +43,8 @@ * @file test_vishay_ntcle317e4103sba.c * @author foxBMS Team * @date 2021-11-02 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/engine/config/test_database_cfg.c b/tests/unit/app/engine/config/test_database_cfg.c index 9f51d052..9dd14a87 100644 --- a/tests/unit/app/engine/config/test_database_cfg.c +++ b/tests/unit/app/engine/config/test_database_cfg.c @@ -43,8 +43,8 @@ * @file test_database_cfg.c * @author foxBMS Team * @date 2020-04-02 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/engine/config/test_diag_cfg.c b/tests/unit/app/engine/config/test_diag_cfg.c index 9e89ae9a..d4b7dbdc 100644 --- a/tests/unit/app/engine/config/test_diag_cfg.c +++ b/tests/unit/app/engine/config/test_diag_cfg.c @@ -43,8 +43,8 @@ * @file test_diag_cfg.c * @author foxBMS Team * @date 2020-04-01 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/engine/config/test_sys_cfg.c b/tests/unit/app/engine/config/test_sys_cfg.c index 62da0736..bde37f00 100644 --- a/tests/unit/app/engine/config/test_sys_cfg.c +++ b/tests/unit/app/engine/config/test_sys_cfg.c @@ -43,8 +43,8 @@ * @file test_sys_cfg.c * @author foxBMS Team * @date 2020-04-02 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/engine/config/test_sys_mon_cfg.c b/tests/unit/app/engine/config/test_sys_mon_cfg.c index 6605922d..2e95816f 100644 --- a/tests/unit/app/engine/config/test_sys_mon_cfg.c +++ b/tests/unit/app/engine/config/test_sys_mon_cfg.c @@ -43,8 +43,8 @@ * @file test_sys_mon_cfg.c * @author foxBMS Team * @date 2020-04-02 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/engine/database/test_database.c b/tests/unit/app/engine/database/test_database.c index bd90982c..825857c0 100644 --- a/tests/unit/app/engine/database/test_database.c +++ b/tests/unit/app/engine/database/test_database.c @@ -43,8 +43,8 @@ * @file test_database.c * @author foxBMS Team * @date 2020-04-01 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/engine/database/test_database_helper.c b/tests/unit/app/engine/database/test_database_helper.c index ba2b9d37..f81f1183 100644 --- a/tests/unit/app/engine/database/test_database_helper.c +++ b/tests/unit/app/engine/database/test_database_helper.c @@ -43,8 +43,8 @@ * @file test_database_helper.c * @author foxBMS Team * @date 2021-05-05 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/engine/diag/cbs/test_diag_cbs_afe.c b/tests/unit/app/engine/diag/cbs/test_diag_cbs_afe.c index 3a35bffb..33a7a85d 100644 --- a/tests/unit/app/engine/diag/cbs/test_diag_cbs_afe.c +++ b/tests/unit/app/engine/diag/cbs/test_diag_cbs_afe.c @@ -43,8 +43,8 @@ * @file test_diag_cbs_afe.c * @author foxBMS Team * @date 2021-02-17 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/engine/diag/cbs/test_diag_cbs_can.c b/tests/unit/app/engine/diag/cbs/test_diag_cbs_can.c index f65ed54d..9fb8121c 100644 --- a/tests/unit/app/engine/diag/cbs/test_diag_cbs_can.c +++ b/tests/unit/app/engine/diag/cbs/test_diag_cbs_can.c @@ -43,8 +43,8 @@ * @file test_diag_cbs_can.c * @author foxBMS Team * @date 2021-02-17 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * @@ -122,6 +122,6 @@ void testDIAG_DoNothingOnWrongIdCanModule(void) { /* Use a wrong ID to make sure, that this does not alter the CAN entry */ uint8_t testValue = 42; diag_kpkDatabaseShim.pTableError->canTiming = testValue; - DIAG_ErrorCanTiming(DIAG_ID_CELLVOLTAGE_OVERVOLTAGE_RSL, DIAG_EVENT_RESET, &diag_kpkDatabaseShim, 0u); + DIAG_ErrorCanTiming(DIAG_ID_CELL_VOLTAGE_OVERVOLTAGE_RSL, DIAG_EVENT_RESET, &diag_kpkDatabaseShim, 0u); TEST_ASSERT_EQUAL(testValue, diag_kpkDatabaseShim.pTableError->canTiming); } diff --git a/tests/unit/app/engine/diag/cbs/test_diag_cbs_contactor.c b/tests/unit/app/engine/diag/cbs/test_diag_cbs_contactor.c index 678fff40..7290c84d 100644 --- a/tests/unit/app/engine/diag/cbs/test_diag_cbs_contactor.c +++ b/tests/unit/app/engine/diag/cbs/test_diag_cbs_contactor.c @@ -43,8 +43,8 @@ * @file test_diag_cbs_contactor.c * @author foxBMS Team * @date 2021-02-17 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * @@ -202,8 +202,8 @@ void testDIAG_DoNothingOnWrongIdContactorModule(void) { /* Use a wrong ID to make sure, that this does not alter the CAN entry */ for (uint8_t s = 0; s < BS_NR_OF_STRINGS; s++) { DIAG_PrechargeContactorFeedback( - DIAG_ID_CELLVOLTAGE_OVERVOLTAGE_RSL, DIAG_EVENT_RESET, &diag_kpkDatabaseShim, s); - DIAG_StringContactorFeedback(DIAG_ID_CELLVOLTAGE_OVERVOLTAGE_RSL, DIAG_EVENT_RESET, &diag_kpkDatabaseShim, s); + DIAG_ID_CELL_VOLTAGE_OVERVOLTAGE_RSL, DIAG_EVENT_RESET, &diag_kpkDatabaseShim, s); + DIAG_StringContactorFeedback(DIAG_ID_CELL_VOLTAGE_OVERVOLTAGE_RSL, DIAG_EVENT_RESET, &diag_kpkDatabaseShim, s); } for (uint8_t s = 0; s < BS_NR_OF_STRINGS; s++) { TEST_ASSERT_EQUAL(testValue - BS_NR_OF_STRINGS + s, diag_kpkDatabaseShim.pTableError->prechargeContactor[s]); diff --git a/tests/unit/app/engine/diag/cbs/test_diag_cbs_current-sensor.c b/tests/unit/app/engine/diag/cbs/test_diag_cbs_current-sensor.c index 1ff272fd..f4ae107e 100644 --- a/tests/unit/app/engine/diag/cbs/test_diag_cbs_current-sensor.c +++ b/tests/unit/app/engine/diag/cbs/test_diag_cbs_current-sensor.c @@ -43,8 +43,8 @@ * @file test_diag_cbs_current-sensor.c * @author foxBMS Team * @date 2021-02-17 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/engine/diag/cbs/test_diag_cbs_current.c b/tests/unit/app/engine/diag/cbs/test_diag_cbs_current.c index 23ed4a15..31c39614 100644 --- a/tests/unit/app/engine/diag/cbs/test_diag_cbs_current.c +++ b/tests/unit/app/engine/diag/cbs/test_diag_cbs_current.c @@ -43,8 +43,8 @@ * @file test_diag_cbs_current.c * @author foxBMS Team * @date 2021-02-17 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/engine/diag/cbs/test_diag_cbs_deep-discharge.c b/tests/unit/app/engine/diag/cbs/test_diag_cbs_deep-discharge.c index 947598cb..767046ab 100644 --- a/tests/unit/app/engine/diag/cbs/test_diag_cbs_deep-discharge.c +++ b/tests/unit/app/engine/diag/cbs/test_diag_cbs_deep-discharge.c @@ -43,8 +43,8 @@ * @file test_diag_cbs_deep-discharge.c * @author foxBMS Team * @date 2021-02-17 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/engine/diag/cbs/test_diag_cbs_dummy.c b/tests/unit/app/engine/diag/cbs/test_diag_cbs_dummy.c index 53556d61..7e30d76c 100644 --- a/tests/unit/app/engine/diag/cbs/test_diag_cbs_dummy.c +++ b/tests/unit/app/engine/diag/cbs/test_diag_cbs_dummy.c @@ -43,8 +43,8 @@ * @file test_diag_cbs_dummy.c * @author foxBMS Team * @date 2021-02-17 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/engine/diag/cbs/test_diag_cbs_fram.c b/tests/unit/app/engine/diag/cbs/test_diag_cbs_fram.c index c9a3610c..117a67f6 100644 --- a/tests/unit/app/engine/diag/cbs/test_diag_cbs_fram.c +++ b/tests/unit/app/engine/diag/cbs/test_diag_cbs_fram.c @@ -43,8 +43,8 @@ * @file test_diag_cbs_fram.c * @author foxBMS Team * @date 2022-02-24 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * @@ -118,6 +118,6 @@ void testDIAG_FramErrorDoNothingOnWrongId(void) { /* Use a wrong ID to make sure, that this does not alter the FRAM entry */ uint8_t testValue = 42; diag_kpkDatabaseShim.pTableError->framReadCrcError = testValue; - DIAG_FramError(DIAG_ID_CELLVOLTAGE_OVERVOLTAGE_RSL, DIAG_EVENT_RESET, &diag_kpkDatabaseShim, 0u); + DIAG_FramError(DIAG_ID_CELL_VOLTAGE_OVERVOLTAGE_RSL, DIAG_EVENT_RESET, &diag_kpkDatabaseShim, 0u); TEST_ASSERT_EQUAL(testValue, diag_kpkDatabaseShim.pTableError->framReadCrcError); } diff --git a/tests/unit/app/engine/diag/cbs/test_diag_cbs_i2c.c b/tests/unit/app/engine/diag/cbs/test_diag_cbs_i2c.c index a8b0f9b7..ff07359b 100644 --- a/tests/unit/app/engine/diag/cbs/test_diag_cbs_i2c.c +++ b/tests/unit/app/engine/diag/cbs/test_diag_cbs_i2c.c @@ -43,8 +43,8 @@ * @file test_diag_cbs_i2c.c * @author foxBMS Team * @date 2021-09-29 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * @@ -118,6 +118,6 @@ void testDIAG_I2cPexDoNothingOnWrongId(void) { /* Use a wrong ID to make sure, that this does not alter the I2C entry */ uint8_t testValue = 42; diag_kpkDatabaseShim.pTableError->i2cPexError = testValue; - DIAG_I2cPex(DIAG_ID_CELLVOLTAGE_OVERVOLTAGE_RSL, DIAG_EVENT_RESET, &diag_kpkDatabaseShim, 0u); + DIAG_I2cPex(DIAG_ID_CELL_VOLTAGE_OVERVOLTAGE_RSL, DIAG_EVENT_RESET, &diag_kpkDatabaseShim, 0u); TEST_ASSERT_EQUAL(testValue, diag_kpkDatabaseShim.pTableError->i2cPexError); } diff --git a/tests/unit/app/engine/diag/cbs/test_diag_cbs_insulation.c b/tests/unit/app/engine/diag/cbs/test_diag_cbs_insulation.c index efe687d1..5f04e291 100644 --- a/tests/unit/app/engine/diag/cbs/test_diag_cbs_insulation.c +++ b/tests/unit/app/engine/diag/cbs/test_diag_cbs_insulation.c @@ -43,8 +43,8 @@ * @file test_diag_cbs_insulation.c * @author foxBMS Team * @date 2021-02-22 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/engine/diag/cbs/test_diag_cbs_interlock.c b/tests/unit/app/engine/diag/cbs/test_diag_cbs_interlock.c index 67cfa851..54385746 100644 --- a/tests/unit/app/engine/diag/cbs/test_diag_cbs_interlock.c +++ b/tests/unit/app/engine/diag/cbs/test_diag_cbs_interlock.c @@ -43,8 +43,8 @@ * @file test_diag_cbs_interlock.c * @author foxBMS Team * @date 2021-02-17 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/engine/diag/cbs/test_diag_cbs_plausibility.c b/tests/unit/app/engine/diag/cbs/test_diag_cbs_plausibility.c index 6082ecb0..51556a08 100644 --- a/tests/unit/app/engine/diag/cbs/test_diag_cbs_plausibility.c +++ b/tests/unit/app/engine/diag/cbs/test_diag_cbs_plausibility.c @@ -43,8 +43,8 @@ * @file test_diag_cbs_plausibility.c * @author foxBMS Team * @date 2021-02-17 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/engine/diag/cbs/test_diag_cbs_power-measurement.c b/tests/unit/app/engine/diag/cbs/test_diag_cbs_power-measurement.c index ce2c52b9..ecd013db 100644 --- a/tests/unit/app/engine/diag/cbs/test_diag_cbs_power-measurement.c +++ b/tests/unit/app/engine/diag/cbs/test_diag_cbs_power-measurement.c @@ -43,8 +43,8 @@ * @file test_diag_cbs_power-measurement.c * @author foxBMS Team * @date 2021-02-17 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/engine/diag/cbs/test_diag_cbs_sbc.c b/tests/unit/app/engine/diag/cbs/test_diag_cbs_sbc.c index 8d4489e3..9d6b4d40 100644 --- a/tests/unit/app/engine/diag/cbs/test_diag_cbs_sbc.c +++ b/tests/unit/app/engine/diag/cbs/test_diag_cbs_sbc.c @@ -43,8 +43,8 @@ * @file test_diag_cbs_sbc.c * @author foxBMS Team * @date 2021-02-17 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/engine/diag/cbs/test_diag_cbs_sys-mon.c b/tests/unit/app/engine/diag/cbs/test_diag_cbs_sys-mon.c index dfca9cbd..1c41e697 100644 --- a/tests/unit/app/engine/diag/cbs/test_diag_cbs_sys-mon.c +++ b/tests/unit/app/engine/diag/cbs/test_diag_cbs_sys-mon.c @@ -43,8 +43,8 @@ * @file test_diag_cbs_sys-mon.c * @author foxBMS Team * @date 2021-02-17 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * @@ -103,25 +103,26 @@ void testDIAG_ErrorSystemMonitoring(void) { const uint8_t numberOfTasks = sizeof(tasks) / sizeof(tasks[0]); for (uint8_t i = 0; i < numberOfTasks; i++) { - DIAG_ErrorSystemMonitoring(DIAG_ID_SYSTEMMONITORING, DIAG_EVENT_RESET, &diag_kpkDatabaseShim, i); - DIAG_ErrorSystemMonitoring(DIAG_ID_SYSTEMMONITORING, DIAG_EVENT_NOT_OK, &diag_kpkDatabaseShim, i); - DIAG_ErrorSystemMonitoring(DIAG_ID_SYSTEMMONITORING, DIAG_EVENT_OK, &diag_kpkDatabaseShim, i); + DIAG_ErrorSystemMonitoring(DIAG_ID_SYSTEM_MONITORING, DIAG_EVENT_RESET, &diag_kpkDatabaseShim, i); + DIAG_ErrorSystemMonitoring(DIAG_ID_SYSTEM_MONITORING, DIAG_EVENT_NOT_OK, &diag_kpkDatabaseShim, i); + DIAG_ErrorSystemMonitoring(DIAG_ID_SYSTEM_MONITORING, DIAG_EVENT_OK, &diag_kpkDatabaseShim, i); } } -void testDIAG_DoNothingOnWrongIdSystemMonitoringModule(void) { - /* Use a wrong ID to make sure, that this does not alter the CAN entry */ - DIAG_ErrorSystemMonitoring(DIAG_ID_CELLVOLTAGE_OVERVOLTAGE_RSL, DIAG_EVENT_RESET, &diag_kpkDatabaseShim, 0u); +void testDIAG_ErrorSystemMonitoringInvalidInput2(void) { + /* Use a wrong diagnosis ID to make sure, that we assert as expected */ + TEST_ASSERT_FAIL_ASSERT( + DIAG_ErrorSystemMonitoring(DIAG_ID_CELL_VOLTAGE_OVERVOLTAGE_RSL, DIAG_EVENT_RESET, &diag_kpkDatabaseShim, 0u)); } /** test against invalid input */ void testDIAG_ErrorSystemMonitoringInvalidInput0(void) { /* check the task ID is allowed */ TEST_ASSERT_FAIL_ASSERT( - DIAG_ErrorSystemMonitoring(DIAG_ID_SYSTEMMONITORING, DIAG_EVENT_OK, &diag_kpkDatabaseShim, 42u)); + DIAG_ErrorSystemMonitoring(DIAG_ID_SYSTEM_MONITORING, DIAG_EVENT_OK, &diag_kpkDatabaseShim, 42u)); } void testDIAG_ErrorSystemMonitoringInvalidInput1(void) { TEST_ASSERT_FAIL_ASSERT(DIAG_ErrorSystemMonitoring(DIAG_ID_MAX, DIAG_EVENT_OK, &diag_kpkDatabaseShim, 0u)); - TEST_ASSERT_FAIL_ASSERT(DIAG_ErrorSystemMonitoring(DIAG_ID_SYSTEMMONITORING, 42, &diag_kpkDatabaseShim, 0u)); - TEST_ASSERT_FAIL_ASSERT(DIAG_ErrorSystemMonitoring(DIAG_ID_SYSTEMMONITORING, DIAG_EVENT_OK, NULL_PTR, 0u)); + TEST_ASSERT_FAIL_ASSERT(DIAG_ErrorSystemMonitoring(DIAG_ID_SYSTEM_MONITORING, 42, &diag_kpkDatabaseShim, 0u)); + TEST_ASSERT_FAIL_ASSERT(DIAG_ErrorSystemMonitoring(DIAG_ID_SYSTEM_MONITORING, DIAG_EVENT_OK, NULL_PTR, 0u)); } diff --git a/tests/unit/app/engine/diag/cbs/test_diag_cbs_temperature.c b/tests/unit/app/engine/diag/cbs/test_diag_cbs_temperature.c index 3be7ae23..9cfb610a 100644 --- a/tests/unit/app/engine/diag/cbs/test_diag_cbs_temperature.c +++ b/tests/unit/app/engine/diag/cbs/test_diag_cbs_temperature.c @@ -43,8 +43,8 @@ * @file test_diag_cbs_temperature.c * @author foxBMS Team * @date 2021-02-17 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/engine/diag/cbs/test_diag_cbs_voltage.c b/tests/unit/app/engine/diag/cbs/test_diag_cbs_voltage.c index 29e46ed8..3edaaf64 100644 --- a/tests/unit/app/engine/diag/cbs/test_diag_cbs_voltage.c +++ b/tests/unit/app/engine/diag/cbs/test_diag_cbs_voltage.c @@ -43,8 +43,8 @@ * @file test_diag_cbs_voltage.c * @author foxBMS Team * @date 2021-02-17 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * @@ -92,20 +92,20 @@ void tearDown(void) { /** tests invalid input values */ void testDIAG_ErrorOvervoltageInvalidInput(void) { TEST_ASSERT_FAIL_ASSERT(DIAG_ErrorOvervoltage(DIAG_ID_MAX, DIAG_EVENT_OK, &diag_kpkDatabaseShim, 0u)); - TEST_ASSERT_FAIL_ASSERT(DIAG_ErrorOvervoltage(DIAG_ID_CELLVOLTAGE_OVERVOLTAGE_MSL, 42, &diag_kpkDatabaseShim, 0u)); - TEST_ASSERT_FAIL_ASSERT(DIAG_ErrorOvervoltage(DIAG_ID_CELLVOLTAGE_OVERVOLTAGE_MSL, DIAG_EVENT_OK, NULL_PTR, 0u)); + TEST_ASSERT_FAIL_ASSERT(DIAG_ErrorOvervoltage(DIAG_ID_CELL_VOLTAGE_OVERVOLTAGE_MSL, 42, &diag_kpkDatabaseShim, 0u)); + TEST_ASSERT_FAIL_ASSERT(DIAG_ErrorOvervoltage(DIAG_ID_CELL_VOLTAGE_OVERVOLTAGE_MSL, DIAG_EVENT_OK, NULL_PTR, 0u)); TEST_ASSERT_FAIL_ASSERT(DIAG_ErrorOvervoltage( - DIAG_ID_CELLVOLTAGE_OVERVOLTAGE_MSL, DIAG_EVENT_OK, &diag_kpkDatabaseShim, BS_NR_OF_STRINGS)); + DIAG_ID_CELL_VOLTAGE_OVERVOLTAGE_MSL, DIAG_EVENT_OK, &diag_kpkDatabaseShim, BS_NR_OF_STRINGS)); } /** tests invalid input values */ void testDIAG_ErrorUndervoltageInvalidInput(void) { TEST_ASSERT_FAIL_ASSERT(DIAG_ErrorUndervoltage(DIAG_ID_MAX, DIAG_EVENT_OK, &diag_kpkDatabaseShim, 0u)); TEST_ASSERT_FAIL_ASSERT( - DIAG_ErrorUndervoltage(DIAG_ID_CELLVOLTAGE_UNDERVOLTAGE_MSL, 42, &diag_kpkDatabaseShim, 0u)); - TEST_ASSERT_FAIL_ASSERT(DIAG_ErrorUndervoltage(DIAG_ID_CELLVOLTAGE_UNDERVOLTAGE_MSL, DIAG_EVENT_OK, NULL_PTR, 0u)); + DIAG_ErrorUndervoltage(DIAG_ID_CELL_VOLTAGE_UNDERVOLTAGE_MSL, 42, &diag_kpkDatabaseShim, 0u)); + TEST_ASSERT_FAIL_ASSERT(DIAG_ErrorUndervoltage(DIAG_ID_CELL_VOLTAGE_UNDERVOLTAGE_MSL, DIAG_EVENT_OK, NULL_PTR, 0u)); TEST_ASSERT_FAIL_ASSERT(DIAG_ErrorUndervoltage( - DIAG_ID_CELLVOLTAGE_UNDERVOLTAGE_MSL, DIAG_EVENT_OK, &diag_kpkDatabaseShim, BS_NR_OF_STRINGS)); + DIAG_ID_CELL_VOLTAGE_UNDERVOLTAGE_MSL, DIAG_EVENT_OK, &diag_kpkDatabaseShim, BS_NR_OF_STRINGS)); } /** tests invalid input values */ diff --git a/tests/unit/app/engine/diag/test_diag.c b/tests/unit/app/engine/diag/test_diag.c index 00750ed5..f7ec5c86 100644 --- a/tests/unit/app/engine/diag/test_diag.c +++ b/tests/unit/app/engine/diag/test_diag.c @@ -43,8 +43,8 @@ * @file test_diag.c * @author foxBMS Team * @date 2020-04-02 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/engine/hwinfo/test_masterinfo.c b/tests/unit/app/engine/hwinfo/test_masterinfo.c index 4c4538dc..67bfd7e6 100644 --- a/tests/unit/app/engine/hwinfo/test_masterinfo.c +++ b/tests/unit/app/engine/hwinfo/test_masterinfo.c @@ -43,8 +43,8 @@ * @file test_masterinfo.c * @author foxBMS Team * @date 2020-07-09 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/engine/sys/test_sys.c b/tests/unit/app/engine/sys/test_sys.c index cd364ad9..68d2f693 100644 --- a/tests/unit/app/engine/sys/test_sys.c +++ b/tests/unit/app/engine/sys/test_sys.c @@ -43,8 +43,8 @@ * @file test_sys.c * @author foxBMS Team * @date 2020-04-02 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * @@ -69,7 +69,7 @@ #include "Mockmeas.h" #include "Mockos.h" #include "Mocksbc.h" -#include "Mocksof.h" +#include "Mocksof_trapezoid.h" #include "Mockstate_estimation.h" #include "Mocksys_cfg.h" diff --git a/tests/unit/app/engine/sys_mon/test_sys_mon.c b/tests/unit/app/engine/sys_mon/test_sys_mon.c index 86d02cb0..f123a083 100644 --- a/tests/unit/app/engine/sys_mon/test_sys_mon.c +++ b/tests/unit/app/engine/sys_mon/test_sys_mon.c @@ -43,8 +43,8 @@ * @file test_sys_mon.c * @author foxBMS Team * @date 2020-04-02 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * @@ -65,11 +65,11 @@ #include "test_assert_helper.h" /*========== Definitions and Implementations for Unit Test ==================*/ -#define DUMMY_TASK_ID_0 0 -#define DUMMY_TASK_ID_1 1 -#define DUMMY_TASK_ID_2 2 -#define DUMMY_CYCLETIME 10 -#define DUMMY_MAX_JITTER 1 +#define DUMMY_TASK_ID_0 (0) +#define DUMMY_TASK_ID_1 (1) +#define DUMMY_TASK_ID_2 (2) +#define DUMMY_CYCLE_TIME (10) +#define DUMMY_MAX_JITTER (1) void TEST_SYSM_DummyCallback_0(SYSM_TASK_ID_e taskId) { TEST_ASSERT_EQUAL(DUMMY_TASK_ID_0, taskId); @@ -86,24 +86,24 @@ void TEST_SYSM_DummyCallback_2(SYSM_TASK_ID_e taskId) { SYSM_MONITORING_CFG_s sysm_ch_cfg[3] = { {DUMMY_TASK_ID_0, SYSM_ENABLED, - DUMMY_CYCLETIME, + DUMMY_CYCLE_TIME, DUMMY_MAX_JITTER, SYSM_RECORDING_ENABLED, - SYSM_HANDLING_SWITCHOFFCONTACTOR, + SYSM_HANDLING_SWITCH_OFF_CONTACTOR, TEST_SYSM_DummyCallback_0}, {DUMMY_TASK_ID_1, SYSM_DISABLED, - DUMMY_CYCLETIME, + DUMMY_CYCLE_TIME, DUMMY_MAX_JITTER, SYSM_RECORDING_ENABLED, - SYSM_HANDLING_SWITCHOFFCONTACTOR, + SYSM_HANDLING_SWITCH_OFF_CONTACTOR, TEST_SYSM_DummyCallback_1}, {DUMMY_TASK_ID_2, SYSM_ENABLED, - DUMMY_CYCLETIME, + DUMMY_CYCLE_TIME, DUMMY_MAX_JITTER, SYSM_RECORDING_DISABLED, - SYSM_HANDLING_SWITCHOFFCONTACTOR, + SYSM_HANDLING_SWITCH_OFF_CONTACTOR, TEST_SYSM_DummyCallback_2}, }; @@ -177,7 +177,7 @@ void testSYSM_CheckNotificationsProvokeDurationViolation(void) { OS_GetTickCount_ExpectAndReturn(100u); DIAG_Handler_ExpectAndReturn( - DIAG_ID_SYSTEMMONITORING, DIAG_EVENT_NOT_OK, DIAG_SYSTEM, DUMMY_TASK_ID_0, DIAG_HANDLER_RETURN_OK); + DIAG_ID_SYSTEM_MONITORING, DIAG_EVENT_NOT_OK, DIAG_SYSTEM, DUMMY_TASK_ID_0, DIAG_HANDLER_RETURN_OK); SYSM_CheckNotifications(); } @@ -197,7 +197,7 @@ void testSYSM_CheckNotificationsProvokeDurationViolationWithRecording(void) { OS_GetTickCount_ExpectAndReturn(100u); DIAG_Handler_ExpectAndReturn( - DIAG_ID_SYSTEMMONITORING, DIAG_EVENT_NOT_OK, DIAG_SYSTEM, DUMMY_TASK_ID_0, DIAG_HANDLER_RETURN_OK); + DIAG_ID_SYSTEM_MONITORING, DIAG_EVENT_NOT_OK, DIAG_SYSTEM, DUMMY_TASK_ID_0, DIAG_HANDLER_RETURN_OK); SYSM_CheckNotifications(); /* check if violation has been recorded */ diff --git a/tests/unit/app/main/test_fassert.c b/tests/unit/app/main/test_fassert.c index ad15db9a..d05ace33 100644 --- a/tests/unit/app/main/test_fassert.c +++ b/tests/unit/app/main/test_fassert.c @@ -43,8 +43,8 @@ * @file test_fassert.c * @author foxBMS Team * @date 2020-04-01 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/main/test_fstartup.c b/tests/unit/app/main/test_fstartup.c index e0bbce76..5d7ef7f7 100644 --- a/tests/unit/app/main/test_fstartup.c +++ b/tests/unit/app/main/test_fstartup.c @@ -43,8 +43,8 @@ * @file test_fstartup.c * @author foxBMS Team * @date 2020-04-01 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/main/test_main.c b/tests/unit/app/main/test_main.c index c4e68db4..c4d06a4c 100644 --- a/tests/unit/app/main/test_main.c +++ b/tests/unit/app/main/test_main.c @@ -43,8 +43,8 @@ * @file test_main.c * @author foxBMS Team * @date 2020-04-01 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/task/config/test_ftask_cfg.c b/tests/unit/app/task/config/test_ftask_cfg.c index b0949e47..887f98ff 100644 --- a/tests/unit/app/task/config/test_ftask_cfg.c +++ b/tests/unit/app/task/config/test_ftask_cfg.c @@ -43,8 +43,8 @@ * @file test_ftask_cfg.c * @author foxBMS Team * @date 2020-04-02 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * @@ -77,7 +77,7 @@ #include "Mockpex.h" #include "Mockredundancy.h" #include "Mocksbc.h" -#include "Mocksof.h" +#include "Mocksof_trapezoid.h" #include "Mocksps.h" #include "Mockstate_estimation.h" #include "Mocksys.h" diff --git a/tests/unit/app/task/ftask/freertos/test_ftask_freertos.c b/tests/unit/app/task/ftask/freertos/test_ftask_freertos.c index f70e9901..3678e262 100644 --- a/tests/unit/app/task/ftask/freertos/test_ftask_freertos.c +++ b/tests/unit/app/task/ftask/freertos/test_ftask_freertos.c @@ -43,8 +43,8 @@ * @file test_ftask_freertos.c * @author foxBMS Team * @date 2021-11-26 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * @@ -64,6 +64,8 @@ TEST_FILE("ftask_freertos.c") /*========== Definitions and Implementations for Unit Test ==================*/ +TaskHandle_t ftsk_taskHandleAfe; + OS_TASK_DEFINITION_s ftsk_taskDefinitionEngine = { OS_PRIORITY_REAL_TIME, FTSK_TASK_ENGINE_PHASE, diff --git a/tests/unit/app/task/ftask/test_ftask.c b/tests/unit/app/task/ftask/test_ftask.c index 85925b0c..82947e85 100644 --- a/tests/unit/app/task/ftask/test_ftask.c +++ b/tests/unit/app/task/ftask/test_ftask.c @@ -43,8 +43,8 @@ * @file test_ftask.c * @author foxBMS Team * @date 2020-04-02 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * @@ -79,7 +79,7 @@ #include "Mockpex.h" #include "Mockredundancy.h" #include "Mocksbc.h" -#include "Mocksof.h" +#include "Mocksof_trapezoid.h" #include "Mocksps.h" #include "Mockstate_estimation.h" #include "Mocksys.h" diff --git a/tests/unit/app/task/os/freertos/test_os_freertos.c b/tests/unit/app/task/os/freertos/test_os_freertos.c index 437fe288..ec48f5ea 100644 --- a/tests/unit/app/task/os/freertos/test_os_freertos.c +++ b/tests/unit/app/task/os/freertos/test_os_freertos.c @@ -43,8 +43,8 @@ * @file test_os_freertos.c * @author foxBMS Team * @date 2021-11-26 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/app/task/os/test_os.c b/tests/unit/app/task/os/test_os.c index 2752e069..aac4afb4 100644 --- a/tests/unit/app/task/os/test_os.c +++ b/tests/unit/app/task/os/test_os.c @@ -43,8 +43,8 @@ * @file test_os.c * @author foxBMS Team * @date 2020-03-13 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix OS * diff --git a/tests/unit/doxygen_tests.h b/tests/unit/doxygen_tests.h index 8e58fe33..53169d60 100644 --- a/tests/unit/doxygen_tests.h +++ b/tests/unit/doxygen_tests.h @@ -43,8 +43,8 @@ * @file doxygen_tests.h * @author foxBMS Team * @date 2019-06-02 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix DX * diff --git a/tests/unit/opt/cells/config/test_lg_inr18650mj1.c b/tests/unit/opt/cells/config/test_lg_inr18650mj1.c index da68fb75..5bcf90f4 100644 --- a/tests/unit/opt/cells/config/test_lg_inr18650mj1.c +++ b/tests/unit/opt/cells/config/test_lg_inr18650mj1.c @@ -43,8 +43,8 @@ * @file test_lg_inr18650mj1.c * @author foxBMS Team * @date 2020-07-31 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/support/test_algorithm_stubs.h b/tests/unit/support/test_algorithm_stubs.h index df54202c..3e17b0c6 100644 --- a/tests/unit/support/test_algorithm_stubs.h +++ b/tests/unit/support/test_algorithm_stubs.h @@ -43,8 +43,8 @@ * @file test_algorithm_stubs.h * @author foxBMS Team * @date 2020-12-09 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/support/test_assert_helper.h b/tests/unit/support/test_assert_helper.h index 1d25f1db..43a42bbd 100644 --- a/tests/unit/support/test_assert_helper.h +++ b/tests/unit/support/test_assert_helper.h @@ -43,8 +43,8 @@ * @file test_assert_helper.h * @author foxBMS Team * @date 2020-07-22 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/support/test_can_mpu_prototype_queue_create_stub.h b/tests/unit/support/test_can_mpu_prototype_queue_create_stub.h index d22089b2..d36744f5 100644 --- a/tests/unit/support/test_can_mpu_prototype_queue_create_stub.h +++ b/tests/unit/support/test_can_mpu_prototype_queue_create_stub.h @@ -43,8 +43,8 @@ * @file test_can_mpu_prototype_queue_create_stub.h * @author foxBMS Team * @date 2021-06-09 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/unit/support/test_pec_helper.h b/tests/unit/support/test_pec_helper.h index dc345643..ec90f63f 100644 --- a/tests/unit/support/test_pec_helper.h +++ b/tests/unit/support/test_pec_helper.h @@ -43,8 +43,8 @@ * @file test_pec_helper.h * @author foxBMS Team * @date 2020-12-16 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup UNIT_TEST_IMPLEMENTATION * @prefix TEST * diff --git a/tests/variants/README.md b/tests/variants/README.md index 5f4c63b0..a067c703 100644 --- a/tests/variants/README.md +++ b/tests/variants/README.md @@ -10,15 +10,17 @@ The naming schema for simple build variant configuration files is: 1. SoX algorithms: 1. SoC algorithm 1. SoE algorithm + 1. SoF algorithm 1. SoH algorithm 1. Insulation Measurement Device -Therefore for a an **FreeRTOS** based build, using and **LTC 6813-1** -AFE with **voltage-based balancing** and **coulomb counting** as -basis for **SoC and SoE** but **no SoH** estimation and IMD, the bms -configuration file must be named: +Therefore for a **FreeRTOS** based build, using an **LTC 6813-1** +AFE, with **voltage-based balancing**, with **coulomb counting** as +basis for **SoC and SoE**, with **trapezoid** for **SoF**, with +**no SoH** estimation, without IMD, the bms configuration file +must be named: -``freertos_ltc-6813-1_vbb_cc-cc-none_none-no-imd.json`` +``freertos_ltc-6813-1_vbb_cc-cc-tr-none_none-no-imd.json`` For more complex build variants a directory must be created the all required files must be placed in that directory. See the library build in ``lib-build`` diff --git a/tests/variants/freertos_debug-default_none_cc-cc-none_none-no-imd.json b/tests/variants/freertos_debug-default_none_cc-cc-tr-none_none-no-imd.json similarity index 89% rename from tests/variants/freertos_debug-default_none_cc-cc-none_none-no-imd.json rename to tests/variants/freertos_debug-default_none_cc-cc-tr-none_none-no-imd.json index b9bba0d2..a4e56838 100644 --- a/tests/variants/freertos_debug-default_none_cc-cc-none_none-no-imd.json +++ b/tests/variants/freertos_debug-default_none_cc-cc-tr-none_none-no-imd.json @@ -2,9 +2,8 @@ "slave-unit": { "analog-front-end": { "manufacturer": "debug", - "chip": "default" + "ic": "default" }, - "balancing-strategy": "none", "temperature-sensor": { "manufacturer": "epcos", "model": "b57251v5103j060", @@ -16,15 +15,17 @@ "state-estimation": { "soc": "counting", "soe": "counting", + "sof": "trapezoid", "soh": "none" } }, + "balancing-strategy": "none", "insulation-monitoring-device": { "manufacturer": "none", "model": "" } }, - "operating-system": { + "rtos": { "name": "freertos" } } diff --git a/tests/variants/freertos_debug-default_none_debug-debug-debug_none-no-imd.json b/tests/variants/freertos_debug-default_none_debug-debug-tr-debug_none-no-imd.json similarity index 89% rename from tests/variants/freertos_debug-default_none_debug-debug-debug_none-no-imd.json rename to tests/variants/freertos_debug-default_none_debug-debug-tr-debug_none-no-imd.json index 34745e53..58c56802 100644 --- a/tests/variants/freertos_debug-default_none_debug-debug-debug_none-no-imd.json +++ b/tests/variants/freertos_debug-default_none_debug-debug-tr-debug_none-no-imd.json @@ -2,9 +2,8 @@ "slave-unit": { "analog-front-end": { "manufacturer": "debug", - "chip": "default" + "ic": "default" }, - "balancing-strategy": "none", "temperature-sensor": { "manufacturer": "epcos", "model": "b57251v5103j060", @@ -16,15 +15,17 @@ "state-estimation": { "soc": "debug", "soe": "debug", + "sof": "trapezoid", "soh": "debug" } }, + "balancing-strategy": "none", "insulation-monitoring-device": { "manufacturer": "none", "model": "" } }, - "operating-system": { + "rtos": { "name": "freertos" } } diff --git a/tests/variants/freertos_debug-default_none_none-none-none_none-no-imd.json b/tests/variants/freertos_debug-default_none_none-none-tr-none_none-no-imd.json similarity index 89% rename from tests/variants/freertos_debug-default_none_none-none-none_none-no-imd.json rename to tests/variants/freertos_debug-default_none_none-none-tr-none_none-no-imd.json index a8bc363f..6b229d4b 100644 --- a/tests/variants/freertos_debug-default_none_none-none-none_none-no-imd.json +++ b/tests/variants/freertos_debug-default_none_none-none-tr-none_none-no-imd.json @@ -2,9 +2,8 @@ "slave-unit": { "analog-front-end": { "manufacturer": "debug", - "chip": "default" + "ic": "default" }, - "balancing-strategy": "none", "temperature-sensor": { "manufacturer": "epcos", "model": "b57251v5103j060", @@ -16,15 +15,17 @@ "state-estimation": { "soc": "none", "soe": "none", + "sof": "trapezoid", "soh": "none" } }, + "balancing-strategy": "none", "insulation-monitoring-device": { "manufacturer": "none", "model": "" } }, - "operating-system": { + "rtos": { "name": "freertos" } } diff --git a/tests/variants/freertos_ltc-6804-1_hbb_cc-cc-none_none-no-imd.json b/tests/variants/freertos_ltc-6804-1_hbb_cc-cc-tr-none_none-no-imd.json similarity index 89% rename from tests/variants/freertos_ltc-6804-1_hbb_cc-cc-none_none-no-imd.json rename to tests/variants/freertos_ltc-6804-1_hbb_cc-cc-tr-none_none-no-imd.json index 748b93e3..50b660db 100644 --- a/tests/variants/freertos_ltc-6804-1_hbb_cc-cc-none_none-no-imd.json +++ b/tests/variants/freertos_ltc-6804-1_hbb_cc-cc-tr-none_none-no-imd.json @@ -2,9 +2,8 @@ "slave-unit": { "analog-front-end": { "manufacturer": "ltc", - "chip": "6804-1" + "ic": "6804-1" }, - "balancing-strategy": "history", "temperature-sensor": { "manufacturer": "epcos", "model": "b57251v5103j060", @@ -16,15 +15,17 @@ "state-estimation": { "soc": "counting", "soe": "counting", + "sof": "trapezoid", "soh": "none" } }, + "balancing-strategy": "history", "insulation-monitoring-device": { "manufacturer": "none", "model": "" } }, - "operating-system": { + "rtos": { "name": "freertos" } } diff --git a/tests/variants/freertos_ltc-6806_none_cc-cc-none_none-no-imd.json b/tests/variants/freertos_ltc-6806_none_cc-cc-tr-none_none-no-imd.json similarity index 89% rename from tests/variants/freertos_ltc-6806_none_cc-cc-none_none-no-imd.json rename to tests/variants/freertos_ltc-6806_none_cc-cc-tr-none_none-no-imd.json index 3b15ffbe..f6ef4250 100644 --- a/tests/variants/freertos_ltc-6806_none_cc-cc-none_none-no-imd.json +++ b/tests/variants/freertos_ltc-6806_none_cc-cc-tr-none_none-no-imd.json @@ -2,9 +2,8 @@ "slave-unit": { "analog-front-end": { "manufacturer": "ltc", - "chip": "6806" + "ic": "6806" }, - "balancing-strategy": "none", "temperature-sensor": { "manufacturer": "epcos", "model": "b57251v5103j060", @@ -16,15 +15,17 @@ "state-estimation": { "soc": "counting", "soe": "counting", + "sof": "trapezoid", "soh": "none" } }, + "balancing-strategy": "none", "insulation-monitoring-device": { "manufacturer": "none", "model": "" } }, - "operating-system": { + "rtos": { "name": "freertos" } } diff --git a/tests/variants/freertos_ltc-6813-1_hbb_cc-cc-none_bender-iso165c.json b/tests/variants/freertos_ltc-6812-1_hbb_cc-cc-tr-none_bender-iso165c.json similarity index 89% rename from tests/variants/freertos_ltc-6813-1_hbb_cc-cc-none_bender-iso165c.json rename to tests/variants/freertos_ltc-6812-1_hbb_cc-cc-tr-none_bender-iso165c.json index 972b0d64..d491c6cd 100644 --- a/tests/variants/freertos_ltc-6813-1_hbb_cc-cc-none_bender-iso165c.json +++ b/tests/variants/freertos_ltc-6812-1_hbb_cc-cc-tr-none_bender-iso165c.json @@ -2,9 +2,8 @@ "slave-unit": { "analog-front-end": { "manufacturer": "ltc", - "chip": "6813-1" + "ic": "6813-1" }, - "balancing-strategy": "history", "temperature-sensor": { "manufacturer": "epcos", "model": "b57251v5103j060", @@ -16,15 +15,17 @@ "state-estimation": { "soc": "counting", "soe": "counting", + "sof": "trapezoid", "soh": "none" } }, + "balancing-strategy": "history", "insulation-monitoring-device": { "manufacturer": "bender", "model": "iso165c" } }, - "operating-system": { + "rtos": { "name": "freertos" } } diff --git a/tests/variants/freertos_ltc-6813-1_hbb_cc-cc-none_bender-ir155.json b/tests/variants/freertos_ltc-6813-1_hbb_cc-cc-tr-none_bender-ir155.json similarity index 89% rename from tests/variants/freertos_ltc-6813-1_hbb_cc-cc-none_bender-ir155.json rename to tests/variants/freertos_ltc-6813-1_hbb_cc-cc-tr-none_bender-ir155.json index 7e099a2c..5c28f945 100644 --- a/tests/variants/freertos_ltc-6813-1_hbb_cc-cc-none_bender-ir155.json +++ b/tests/variants/freertos_ltc-6813-1_hbb_cc-cc-tr-none_bender-ir155.json @@ -2,9 +2,8 @@ "slave-unit": { "analog-front-end": { "manufacturer": "ltc", - "chip": "6813-1" + "ic": "6813-1" }, - "balancing-strategy": "history", "temperature-sensor": { "manufacturer": "epcos", "model": "b57251v5103j060", @@ -16,15 +15,17 @@ "state-estimation": { "soc": "counting", "soe": "counting", + "sof": "trapezoid", "soh": "none" } }, + "balancing-strategy": "history", "insulation-monitoring-device": { "manufacturer": "bender", "model": "ir155" } }, - "operating-system": { + "rtos": { "name": "freertos" } } diff --git a/tests/variants/freertos_ltc-6812-1_hbb_cc-cc-none_bender-iso165c.json b/tests/variants/freertos_ltc-6813-1_hbb_cc-cc-tr-none_bender-iso165c.json similarity index 89% rename from tests/variants/freertos_ltc-6812-1_hbb_cc-cc-none_bender-iso165c.json rename to tests/variants/freertos_ltc-6813-1_hbb_cc-cc-tr-none_bender-iso165c.json index 972b0d64..d491c6cd 100644 --- a/tests/variants/freertos_ltc-6812-1_hbb_cc-cc-none_bender-iso165c.json +++ b/tests/variants/freertos_ltc-6813-1_hbb_cc-cc-tr-none_bender-iso165c.json @@ -2,9 +2,8 @@ "slave-unit": { "analog-front-end": { "manufacturer": "ltc", - "chip": "6813-1" + "ic": "6813-1" }, - "balancing-strategy": "history", "temperature-sensor": { "manufacturer": "epcos", "model": "b57251v5103j060", @@ -16,15 +15,17 @@ "state-estimation": { "soc": "counting", "soe": "counting", + "sof": "trapezoid", "soh": "none" } }, + "balancing-strategy": "history", "insulation-monitoring-device": { "manufacturer": "bender", "model": "iso165c" } }, - "operating-system": { + "rtos": { "name": "freertos" } } diff --git a/tests/variants/freertos_ltc-6813-1_vbb_cc-cc-none_bender-ir155.json b/tests/variants/freertos_ltc-6813-1_vbb_cc-cc-tr-none_bender-ir155.json similarity index 89% rename from tests/variants/freertos_ltc-6813-1_vbb_cc-cc-none_bender-ir155.json rename to tests/variants/freertos_ltc-6813-1_vbb_cc-cc-tr-none_bender-ir155.json index d530979c..71942434 100644 --- a/tests/variants/freertos_ltc-6813-1_vbb_cc-cc-none_bender-ir155.json +++ b/tests/variants/freertos_ltc-6813-1_vbb_cc-cc-tr-none_bender-ir155.json @@ -2,9 +2,8 @@ "slave-unit": { "analog-front-end": { "manufacturer": "ltc", - "chip": "6813-1" + "ic": "6813-1" }, - "balancing-strategy": "voltage", "temperature-sensor": { "manufacturer": "epcos", "model": "b57251v5103j060", @@ -16,15 +15,17 @@ "state-estimation": { "soc": "counting", "soe": "counting", + "sof": "trapezoid", "soh": "none" } }, + "balancing-strategy": "voltage", "insulation-monitoring-device": { "manufacturer": "bender", "model": "ir155" } }, - "operating-system": { + "rtos": { "name": "freertos" } } diff --git a/tests/variants/freertos_ltc-6813-1_vbb_cc-cc-none_bender-iso165c.json b/tests/variants/freertos_ltc-6813-1_vbb_cc-cc-tr-none_bender-iso165c.json similarity index 89% rename from tests/variants/freertos_ltc-6813-1_vbb_cc-cc-none_bender-iso165c.json rename to tests/variants/freertos_ltc-6813-1_vbb_cc-cc-tr-none_bender-iso165c.json index bcba15dd..dba68507 100644 --- a/tests/variants/freertos_ltc-6813-1_vbb_cc-cc-none_bender-iso165c.json +++ b/tests/variants/freertos_ltc-6813-1_vbb_cc-cc-tr-none_bender-iso165c.json @@ -2,9 +2,8 @@ "slave-unit": { "analog-front-end": { "manufacturer": "ltc", - "chip": "6813-1" + "ic": "6813-1" }, - "balancing-strategy": "voltage", "temperature-sensor": { "manufacturer": "epcos", "model": "b57251v5103j060", @@ -16,15 +15,17 @@ "state-estimation": { "soc": "counting", "soe": "counting", + "sof": "trapezoid", "soh": "none" } }, + "balancing-strategy": "voltage", "insulation-monitoring-device": { "manufacturer": "bender", "model": "iso165c" } }, - "operating-system": { + "rtos": { "name": "freertos" } } diff --git a/tests/variants/freertos_maxim-max17852_vbb_cc-cc-none_none-no-imd.json b/tests/variants/freertos_maxim-max17852_vbb_cc-cc-tr-none_none-no-imd.json similarity index 89% rename from tests/variants/freertos_maxim-max17852_vbb_cc-cc-none_none-no-imd.json rename to tests/variants/freertos_maxim-max17852_vbb_cc-cc-tr-none_none-no-imd.json index 2882fe1e..e4b0b864 100644 --- a/tests/variants/freertos_maxim-max17852_vbb_cc-cc-none_none-no-imd.json +++ b/tests/variants/freertos_maxim-max17852_vbb_cc-cc-tr-none_none-no-imd.json @@ -2,9 +2,8 @@ "slave-unit": { "analog-front-end": { "manufacturer": "maxim", - "chip": "max17852" + "ic": "max17852" }, - "balancing-strategy": "voltage", "temperature-sensor": { "manufacturer": "epcos", "model": "b57251v5103j060", @@ -16,15 +15,17 @@ "state-estimation": { "soc": "counting", "soe": "counting", + "sof": "trapezoid", "soh": "none" } }, + "balancing-strategy": "voltage", "insulation-monitoring-device": { "manufacturer": "none", "model": "" } }, - "operating-system": { + "rtos": { "name": "freertos" } } diff --git a/tests/variants/freertos_nxp-mc33775a_vbb_cc-cc-none_none-no-imd.json b/tests/variants/freertos_nxp-mc33775a_vbb_cc-cc-tr-none_none-no-imd.json similarity index 89% rename from tests/variants/freertos_nxp-mc33775a_vbb_cc-cc-none_none-no-imd.json rename to tests/variants/freertos_nxp-mc33775a_vbb_cc-cc-tr-none_none-no-imd.json index 3aca9ac7..df51b81c 100644 --- a/tests/variants/freertos_nxp-mc33775a_vbb_cc-cc-none_none-no-imd.json +++ b/tests/variants/freertos_nxp-mc33775a_vbb_cc-cc-tr-none_none-no-imd.json @@ -2,9 +2,8 @@ "slave-unit": { "analog-front-end": { "manufacturer": "nxp", - "chip": "common" + "ic": "mc33775a" }, - "balancing-strategy": "voltage", "temperature-sensor": { "manufacturer": "epcos", "model": "b57251v5103j060", @@ -16,15 +15,17 @@ "state-estimation": { "soc": "counting", "soe": "counting", + "sof": "trapezoid", "soh": "none" } }, + "balancing-strategy": "voltage", "insulation-monitoring-device": { "manufacturer": "none", "model": "" } }, - "operating-system": { + "rtos": { "name": "freertos" } } diff --git a/tests/variants/lib-build/lib-build_main.c b/tests/variants/lib-build/lib-build_main.c index 890645ca..72895abe 100644 --- a/tests/variants/lib-build/lib-build_main.c +++ b/tests/variants/lib-build/lib-build_main.c @@ -43,8 +43,8 @@ * @file lib-build_main.c * @author foxBMS Team * @date 2020-10-06 (date of creation) - * @updated 2022-05-30 (date of last update) - * @version v1.3.0 + * @updated 2022-07-28 (date of last update) + * @version v1.4.0 * @ingroup GENERAL * @prefix TODO * diff --git a/tools/gui/LICENSE.md b/tools/gui/LICENSE.md new file mode 100644 index 00000000..42d75c61 --- /dev/null +++ b/tools/gui/LICENSE.md @@ -0,0 +1,37 @@ +# foxBMS 2 Licenses + +## foxBMS 2 Hardware and Documentation License + +- foxBMS 2 hardware and documentation is licensed under the + Creative Commons Attribution 4.0 International License. + The license can be obtained from https://creativecommons.org/licenses/by/4.0/. +- The license text is found in [CC-BY-4.0.txt](CC-BY-4.0.txt). +- The SPDX short identifier is + [CC-BY-4.0](https://spdx.org/licenses/CC-BY-4.0.html). + +## foxBMS 2 Software License + +- foxBMS 2 software is licensed under the BSD 3-Clause License. +- The license text is found in [BSD-3-Clause.txt](BSD-3-Clause.txt). +- The SPDX short identifier is + [BSD-3-Clause](https://spdx.org/licenses/BSD-3-Clause.html). + +## Further Information + +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®″ + +If you use foxBMS in your products, we encourage you to contact us at: + +``` +CONTACT INFORMATION +Fraunhofer IISB +Schottkystrasse 10 +91058 Erlangen, Germany +mailto:info@foxbms.org +https://foxbms.org +``` diff --git a/tools/gui/README.md b/tools/gui/README.md index 15829ede..9649e869 100644 --- a/tools/gui/README.md +++ b/tools/gui/README.md @@ -1,6 +1,5 @@ # foxBMS 2 GUI - ## Starting the GUI In order to start the gui, run ``gui.bat``. diff --git a/tools/gui/fgui/__init__.py b/tools/gui/fgui/__init__.py index 7066c0a7..25ee1b26 100644 --- a/tools/gui/fgui/__init__.py +++ b/tools/gui/fgui/__init__.py @@ -39,10 +39,26 @@ # - "This product is derived from foxBMS®" """sets the version package etc.""" +import os -__version__ = "1.3.0" +__version__ = "1.4.0" __appname__ = "foxBMS 2" __author__ = "The foxBMS Team" __copyright__ = "(c) 2010 - 2022 foxBMS" __author__ = "The foxBMS Team" __email__ = "info@foxbms.org" + +MODULE_DIR = os.path.dirname(os.path.realpath(__file__)) +MODULE_FOXBMS_LOGO = os.path.join(MODULE_DIR, "_static", "logo_foxbms.png") +MODULE_FHG_IISB_LOGO = os.path.join(MODULE_DIR, "_static", "logo_fhg_iisb.png") +MODULE_README_FILE = os.path.join(MODULE_DIR, "..", "README.md") +MODULE_LICENSE_FILE = os.path.join(MODULE_DIR, "..", "LICENSE.md") +MODULE_LOCAL_DOC_PATH = os.path.join( + MODULE_DIR, "..", "..", "..", "build", "docs", "index.html" +) +FOXBMS_URL = "https://foxbms.org" +FOXBMS_DOC_BASE_URL = "https://iisb-foxbms.iisb.fraunhofer.de/" +FOXBMS_DOC_URL = f"{FOXBMS_DOC_BASE_URL}/foxbms/gen2/docs/html/latest/" +FOXBMS_LICENSE_FALLBACK_URL = ( + f"{FOXBMS_DOC_BASE_URL}foxbms/gen2/docs/html/latest/general/license.html" +) diff --git a/tools/gui/fgui/__main__.py b/tools/gui/fgui/__main__.py new file mode 100644 index 00000000..bb5ec459 --- /dev/null +++ b/tools/gui/fgui/__main__.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# Copyright (c) 2010 - 2022, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. +# All rights reserved. +# +# 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®" + +"""Make this module callable""" + + +from fgui import foxbms_gui + + +foxbms_gui.main() diff --git a/tools/gui/_static/logo_fhg_iisb.png b/tools/gui/fgui/_static/logo_fhg_iisb.png similarity index 100% rename from tools/gui/_static/logo_fhg_iisb.png rename to tools/gui/fgui/_static/logo_fhg_iisb.png diff --git a/tools/gui/_static/logo_foxbms.png b/tools/gui/fgui/_static/logo_foxbms.png similarity index 100% rename from tools/gui/_static/logo_foxbms.png rename to tools/gui/fgui/_static/logo_foxbms.png diff --git a/tools/gui/foxbms_gui.py b/tools/gui/fgui/foxbms_gui.py similarity index 87% rename from tools/gui/foxbms_gui.py rename to tools/gui/fgui/foxbms_gui.py index d60dccc6..c954a438 100644 --- a/tools/gui/foxbms_gui.py +++ b/tools/gui/fgui/foxbms_gui.py @@ -46,21 +46,15 @@ import os import webbrowser -import fgui import wx import wx.adv -from info_dialog import FoxbmsInfoDialog -from log_parser import LogParserFrame - -__version__ = fgui.__version__ -__appname__ = fgui.__appname__ -__author__ = fgui.__author__ -__copyright__ = fgui.__copyright__ -__author__ = fgui.__author__ -__email__ = fgui.__email__ - -SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__)) -FOXBMS_LOGO = os.path.join(SCRIPT_DIR, "..", "..", "docs", "_static", "foxbms250px.png") +from fgui import ( + FOXBMS_DOC_URL, + MODULE_FOXBMS_LOGO, + MODULE_LOCAL_DOC_PATH, +) +from fgui.info_dialog import FoxbmsInfoDialog +from fgui.log_parser import LogParserFrame class foxBMSMainFrame(wx.Frame): @@ -104,7 +98,7 @@ def initialize_gui(self): # Add logo _icon = wx.Icon() - logo_img = wx.Image(FOXBMS_LOGO) + logo_img = wx.Image(MODULE_FOXBMS_LOGO) logo_img_size = logo_img.GetSize() resized = logo_img_size / 5 logo_img.Rescale(resized[0], resized[1]) @@ -112,7 +106,7 @@ def initialize_gui(self): _icon.CopyFromBitmap(image) self.SetIcon(_icon) - # all gui elements are now initalized, so we can show the GUI + # all gui elements are now initialized, so we can show the GUI self.SetTitle("foxBMS") self.Centre() self.Show(True) @@ -131,9 +125,9 @@ def cb_start_log_parser(cls, event): def cb_open_documentation(cls, event): """Shows the foxBMS documentation from local source if it exists, from web if it does not""" - doc = os.path.join(SCRIPT_DIR, "..", "..", "build", "docs", "index.html") + doc = MODULE_LOCAL_DOC_PATH if not os.path.isfile(doc): - doc = "https://iisb-foxbms.iisb.fraunhofer.de/foxbms/gen2/docs/html/latest/" + doc = FOXBMS_DOC_URL webbrowser.open(doc) @classmethod diff --git a/tools/gui/info_dialog.py b/tools/gui/fgui/info_dialog.py similarity index 89% rename from tools/gui/info_dialog.py rename to tools/gui/fgui/info_dialog.py index 57fe7467..a6f3533d 100644 --- a/tools/gui/info_dialog.py +++ b/tools/gui/fgui/info_dialog.py @@ -40,7 +40,6 @@ """helper for the info dialog""" -import os import pathlib import fgui @@ -50,6 +49,13 @@ import wx.grid import wx.html import wx.lib.agw.hyperlink as hl +from fgui import ( + MODULE_LICENSE_FILE, + MODULE_README_FILE, + MODULE_FOXBMS_LOGO, + FOXBMS_URL, + FOXBMS_LICENSE_FALLBACK_URL, +) __version__ = fgui.__version__ __appname__ = fgui.__appname__ @@ -58,14 +64,6 @@ __author__ = fgui.__author__ __email__ = fgui.__email__ -SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__)) -README_FILE = os.path.join(SCRIPT_DIR, "README.md") -LICENSE_FILE = os.path.join(SCRIPT_DIR, "..", "..", "LICENSE.md") -FOXBMS_LOGO = os.path.join(SCRIPT_DIR, "..", "..", "docs", "_static", "foxbms250px.png") -FOXBMS_URL = "https://foxbms.org" -BASE_URL = "https://iisb-foxbms.iisb.fraunhofer.de/" -LICENSE_FALLBACK_URL = f"{BASE_URL}foxbms/gen2/docs/html/latest/general/license.html" - class FoxbmsInfoDialog(wx.Dialog): """Dialog box for 'Info' message""" @@ -76,8 +74,8 @@ def __init__(self, *args, **kw): super().__init__(*args, **kw) self.SetSize((605, 1000)) self.SetTitle("About foxBMS 2") - self.license_file = self.get_file(LICENSE_FILE) - self.readme_file = self.get_file(README_FILE) + self.license_file = self.get_file(MODULE_LICENSE_FILE) + self.readme_file = self.get_file(MODULE_README_FILE) self.license_text = self.get_license_text() self.readme_text = self.get_readme_text() self.init_foxbms_dialog() @@ -87,7 +85,7 @@ def init_foxbms_dialog(self): """Setup the text of the dialog box""" # Add icon _icon = wx.Icon() - logo_img = wx.Image(FOXBMS_LOGO) + logo_img = wx.Image(MODULE_FOXBMS_LOGO) logo_img_size = logo_img.GetSize() resized = logo_img_size / 5 logo_img.Rescale(resized[0], resized[1]) @@ -98,7 +96,7 @@ def init_foxbms_dialog(self): panel = wx.Panel(self, -1) sizer = wx.GridBagSizer(4, 2) # logo and heading - png = wx.Image(FOXBMS_LOGO, wx.BITMAP_TYPE_ANY).ConvertToBitmap() + png = wx.Image(MODULE_FOXBMS_LOGO, wx.BITMAP_TYPE_ANY).ConvertToBitmap() logo = wx.StaticBitmap(self, -1, png, (5, 5), (png.GetWidth(), png.GetHeight())) heading = wx.TextCtrl( self, @@ -168,7 +166,7 @@ def get_license_text(self): else: license_text = ( "Could not find foxBMS 2 license file.\n" - f"Please check {LICENSE_FALLBACK_URL}." + f"Please check {FOXBMS_LICENSE_FALLBACK_URL}." ) self.license_file_missing_msg_box = wx.MessageBox( license_text, "License file missing", wx.OK | wx.ICON_WARNING diff --git a/tools/gui/log_parser.py b/tools/gui/fgui/log_parser.py similarity index 98% rename from tools/gui/log_parser.py rename to tools/gui/fgui/log_parser.py index 90431ed3..6b19890e 100644 --- a/tools/gui/log_parser.py +++ b/tools/gui/fgui/log_parser.py @@ -49,7 +49,9 @@ import matplotlib.pyplot as plt import pandas import wx -from info_dialog import FoxbmsInfoDialog +from fgui.info_dialog import FoxbmsInfoDialog + +from fgui import MODULE_FOXBMS_LOGO, MODULE_FHG_IISB_LOGO __version__ = fgui.__version__ __appname__ = fgui.__appname__ @@ -173,14 +175,10 @@ def basic_gui(self): self.clb_select_sig.Bind(wx.EVT_CHECKLISTBOX, self.cb_on_click_checked_box) # set up images - png = wx.Image( - os.path.join("_static", "logo_fhg_iisb.png"), wx.BITMAP_TYPE_ANY - ).ConvertToBitmap() + png = wx.Image(MODULE_FHG_IISB_LOGO, wx.BITMAP_TYPE_ANY).ConvertToBitmap() wx.StaticBitmap(self, -1, png, (650, 5), (png.GetWidth(), png.GetHeight())) - png = wx.Image( - os.path.join("_static", "logo_foxbms.png"), wx.BITMAP_TYPE_ANY - ).ConvertToBitmap() + png = wx.Image(MODULE_FOXBMS_LOGO, wx.BITMAP_TYPE_ANY).ConvertToBitmap() wx.StaticBitmap(self, -1, png, (50, 5), (png.GetWidth(), png.GetHeight())) self.Show(True) diff --git a/tools/gui/gui.bat b/tools/gui/gui.bat index 5d319d2b..206f803d 100644 --- a/tools/gui/gui.bat +++ b/tools/gui/gui.bat @@ -49,7 +49,7 @@ @SET PYEXE=python @WHERE %PYEXE% 1>NUL 2>NUL @IF %ERRORLEVEL% neq 0 SET PYEXE=py -@START "PARSER" /b %PYEXE% -x "%~dp0\foxbms_gui.py" %* +@START "foxBMS 2 GUI" /b %PYEXE% -m fgui %* @POPD @IF %ERRORLEVEL% NEQ 0 ( @EXIT /b %ERRORLEVEL% diff --git a/tools/ide/vscode/c_cpp_properties.json.jinja2 b/tools/ide/vscode/c_cpp_properties.json.jinja2 index 2efd3fb5..80a71fc4 100644 --- a/tools/ide/vscode/c_cpp_properties.json.jinja2 +++ b/tools/ide/vscode/c_cpp_properties.json.jinja2 @@ -11,7 +11,7 @@ "${workspaceFolder}/src/app/application/algorithm/state_estimation/", "${workspaceFolder}/src/app/application/algorithm/state_estimation/soc/{{ STATE_ESTIMATOR_SOC }}", "${workspaceFolder}/src/app/application/algorithm/state_estimation/soe/{{ STATE_ESTIMATOR_SOE }}", - "${workspaceFolder}/src/app/application/algorithm/state_estimation/sof/trapezoid", + "${workspaceFolder}/src/app/application/algorithm/state_estimation/sof/{{ STATE_ESTIMATOR_SOF }}", "${workspaceFolder}/src/app/application/algorithm/state_estimation/soh/{{ STATE_ESTIMATOR_SOH }}", "${workspaceFolder}/src/app/application/bal", "${workspaceFolder}/src/app/application/bal/{{ BALANCING_STRATEGY }}", @@ -45,7 +45,7 @@ "${workspaceFolder}/src/app/driver/afe/api", "${workspaceFolder}/src/app/driver/afe/{{ AFE_MANUFACTURER }}/api/**", "${workspaceFolder}/src/app/driver/afe/{{ AFE_MANUFACTURER }}/common/**", - "${workspaceFolder}/src/app/driver/afe/{{ AFE_MANUFACTURER }}/{{ AFE_CHIP }}/**", + "${workspaceFolder}/src/app/driver/afe/{{ AFE_MANUFACTURER }}/{{ AFE_IC }}/**", "${workspaceFolder}/src/app/driver/pex", "${workspaceFolder}/src/app/driver/pwm", "${workspaceFolder}/src/app/driver/rtc", @@ -72,11 +72,11 @@ "${workspaceFolder}/src/app/main/include/config", "${workspaceFolder}/src/app/task/config", "${workspaceFolder}/src/app/task/ftask", - "${workspaceFolder}/src/app/task/ftask/{{ OS }}", + "${workspaceFolder}/src/app/task/ftask/{{ RTOS }}", "${workspaceFolder}/src/app/task/os", - "${workspaceFolder}/src/app/task/os/{{ OS }}", - "${workspaceFolder}/src/os/{{ OS }}", - {% for os_include in OS_INCLUDES %}"${workspaceFolder}/{{ os_include }}", + "${workspaceFolder}/src/app/task/os/{{ RTOS }}", + "${workspaceFolder}/src/os/{{ RTOS }}", + {% for rtos_include in RTOS_INCLUDES %}"${workspaceFolder}/{{ rtos_include }}", {% endfor -%} "${workspaceFolder}/tools/vendor/ceedling/vendor/unity/src", "${workspaceFolder}/tools/vendor/ceedling/vendor/c_exception/lib", @@ -106,7 +106,7 @@ {% endfor %} ], "intelliSenseMode": "${default}", - "cStandard": "{{ CSTANDARD }}" + "cStandard": "{{ C_STANDARD }}" } ], "version": 4 diff --git a/tools/ide/vscode/cspell.json.jinja2 b/tools/ide/vscode/cspell.json.jinja2 index 34d7d890..07090d8b 100644 --- a/tools/ide/vscode/cspell.json.jinja2 +++ b/tools/ide/vscode/cspell.json.jinja2 @@ -6,8 +6,8 @@ "language": "en", // words - list of words to be always considered correct "words": [ - "archiver", "alphanumericals", + "archiver", "cacheable", "contactor", "contactors", @@ -21,31 +21,36 @@ "multiline", "optocoupler", "overcurrent", + "overtemperature", "overvoltage", "parens", + "phosphane", "pinout", "pinouts", - "phosphane", "precharge", "precharged", + "precharging", "prepend", "prepending", - "recurse", "readmes", + "recalibrated", "receptable", + "recurse", "roadmap", - "recalibrated", "semihosting", + "solderabilty", "strippable", "substate", "substates", "supercapacitor", "supercapacitors", - "Typedefed", "throughs", + "timespan", "toolchain", "toolchains", "toolset", + "typedefed", + "undertemperature", "undervoltage", "unversioned", "vendored", @@ -68,11 +73,17 @@ "Erlangen", // Company and product names "Altium", + "Cppcheck", // a static program analysis tool "GitHub", "GitLab", "Mictor", + "OSHWA", // Open Source Hardware Association + "SAMTEC", // company "JFLASH", "Molex", + "orcid", + "wuerth", + "zenodo", // user name in the documentation "vulpes", "fgui", @@ -97,6 +108,7 @@ "SYSM", "FTSK", "FTASK", + "EMIF", // Extended Memory Interface "NOIMD", "MRC", "fstd", @@ -105,9 +117,37 @@ "ddeg", "perc", // C standard header + "assert", + "complex", + "ctype", + "errno", + "fenv", + "float", + "inttypes", + "iso646", + "limits", + "locale", + "math", + "setjmp", + "signal", + "stdalign", + "stdarg", + "stdatomic", "stdbool", - "MOSFET", + "stddef", + "stdint", + "stdio", + "stdlib", + "stdnoreturn", + "string", + "tgmath", + "threads", + "time", + "uchar", + "wchar", + "wctype", // general software terms + "MOSFET", "memcpy", "NTFS", "JTAG", @@ -155,6 +195,7 @@ "CBIT", "SIMO", "SOMI", + "docref", // bender "VIFC", // Vehicle Interface Controller // ARM @@ -164,9 +205,15 @@ "orreq", "msreq", // Compound words in defines, abbreveations from HAL, etc. + "ecap", // TI: abbrevation for "Enhanced Capture" driver "RTSV", // TI: abbrevation for "runtime support library" - "SPNA", // TI prefix for lots of documents (and we reference them) - "SCPS", // TI prefix for lots of documents (and we reference them) + "SPNA", // TI: prefix for lots of documents (and we reference them) + "SCPS", // TI: prefix for lots of documents (and we reference them) + "REPEATMODE", // TI: driver code + "BUSBUSY", // TI: driver code + "RAMREG", // TI: driver code + "SIGREGL", // TI: driver code + "SIGREGH", // TI: driver code "ADDMODERD", "ADDMODEWR", "CSHOLD", @@ -382,6 +429,8 @@ "VSUPUVH", "BTFB", "BTSC", + // protocols + "UART", // standards "misra", // hardware abbreveations or hardware components @@ -399,12 +448,14 @@ // Axivion "axivion", "cafecc", + "Codeline", "gravis", "larg", "preinc", "dashserver", "localbuild", "noauth", + "workitem", // asm keywords "endasmfunc", // third party software, tools, configuration files etc. @@ -476,34 +527,50 @@ "halcogen", // ceedling "cmock", + // html + "endverbatim", // waf "APPNAME", - "sigs", + "autoconfig", + "destdir", + "TARGETLIB", "algo", - "setenv", - "stlib", - "stlink", - "waf's", - "waflib", - "wscript", - "distclean", - "distcheck", - "testbuild", - "confcache", - "ccroot", + "bdir", + "bindir", + "bldnode", "bldpath", - "CPPPATH", "CCDEPS", "CCLINK", - "STLIBPATH", + "ccroot", + "confcache", + "CPPPATH", "cprogram", - "tiprogram", + "cstlib", + "deps", + "distcheck", + "distclean", + "incnodes", + "incpaths", "LDFLAGS", + "libdir", + "LIBPATH", "LINKDEPS", - "deps", - "bdir", "okmsg", - "bldnode", + "outdir", + "setenv", + "sigs", + "srcnode", + "stlib", + "STLIBPATH", + "stlink", + "taskgen", + "testbuild", + "tiprogram", + "tooldir", + "uselib", + "waflib", + "waf's", + "wscript", // variables in wscript "confpy", // rst @@ -521,6 +588,8 @@ "genindex", "modindex", // python + "maxsplit", + "arcname", // 'tar' package "pycache", "getenv", "pypi", @@ -529,6 +598,8 @@ "pylintrc", "pyproject", "groupby", + "linesep", // 'os' package + "pathsep", // 'os' package "platformdirs", "popen", "tzname", @@ -538,6 +609,7 @@ "hexlify", "startswith", // python packages + "jsonschema", "cffconvert", "clib", "gprof2dot", @@ -574,7 +646,8 @@ "ltail", "rankdir", "doublecircle", - // conf.py (sphinx) + // conf.py and sphinx + "autofunction", "numfig", "delim", //latex @@ -590,6 +663,7 @@ "HEXGENFLAGS", "NMFLAGS", // misc + "Zener", "pprs" ], "dictionaries": [ @@ -628,7 +702,7 @@ "conf/unit/vsc-settings.yml", "docs/_ext/**", "docs/_themes/**", - "docs/stylesheetfile.css", + "docs/style-sheet-file.css", "docs/doxygen*.*", "docs/general/team-ad-sc.rst", "docs/general/team-dev.rst", @@ -655,6 +729,8 @@ "hardware/**/*.stp", // third party sources "src/app/driver/afe/nxp/common/MC33775A.h", + "src/app/driver/afe/nxp/mc33775a/vendor/*.c", + "src/app/driver/afe/nxp/mc33775a/vendor/*.h", "src/app/driver/sbc/fs8x_driver/**", "src/app/driver/afe/ltc/common/ltc_pec.*", "src/os/**", @@ -662,6 +738,7 @@ "tests/axivion/.axivion.preinc", "tests/axivion/rule_config_c.json", "tests/axivion/ci_config.json", + "tests/axivion/addon-test/**/test_*.*", "tests/re-names/*.json", "tools/dbc/*.dbc", "tools/dbc/*.sym", diff --git a/tools/ide/vscode/settings.json.jinja2 b/tools/ide/vscode/settings.json.jinja2 index 796f5650..b6fed79b 100644 --- a/tools/ide/vscode/settings.json.jinja2 +++ b/tools/ide/vscode/settings.json.jinja2 @@ -33,7 +33,7 @@ "build/conf_check_*/**": true, "build/predefined_defines/**": true, "**/.lock-waf_*_build":true, - "**/.wafpickle-*":true, + "**/.wafpickle-*":true }, "files.watcherExclude": { "**/.git/objects/**": true, @@ -61,7 +61,8 @@ "json.schemas": [ { "fileMatch": [ - "conf/bms/bms.json" + "conf/bms/bms.json", + "tests/variants/*.json" ], "url": "./conf/bms/schema/bms.schema.json" } @@ -101,7 +102,7 @@ {% endfor %} ], "python.formatting.provider": "black", - "python.formatting.blackPath": "{{ BLACKPATH }}", + "python.formatting.blackPath": "{{ BLACK_PATH }}", "python.formatting.blackArgs": [ "--config", "{{ BLACK_CONFIG }}" diff --git a/tools/utils/update_doxygen_header.py b/tools/utils/update_doxygen_header.py index 4be96dfd..ba794724 100644 --- a/tools/utils/update_doxygen_header.py +++ b/tools/utils/update_doxygen_header.py @@ -113,7 +113,9 @@ def main(): logging.warning("Could not find any changed files.") sys.exit(0) changed_files = [ - Path(os.path.join(ROOT, i.strip())) for i in tmp if i.endswith((".c", ".h")) + Path(os.path.join(ROOT, i.strip())) + for i in tmp + if i.endswith((".c", ".h")) and "addon-test" not in i ] m = False # pylint: disable=invalid-name diff --git a/tools/utils/update_version.py b/tools/utils/update_version.py new file mode 100644 index 00000000..de7105a9 --- /dev/null +++ b/tools/utils/update_version.py @@ -0,0 +1,199 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# Copyright (c) 2010 - 2022, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. +# All rights reserved. +# +# 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®" + +"""Template for Python scripts""" + +import sys +import argparse +import os +import re +import logging +from pathlib import Path +from datetime import date + + +from git import Repo + + +def get_git_root(path: str = os.path.realpath(__file__)) -> Path: + """helper function to find the repository root + + Args: + path (string): path of test_f_guidelines + + Returns: + root (string): root path of the git repository + """ + repo = Repo(path, search_parent_directories=True) + root = Path(repo.git.rev_parse("--show-toplevel")) + return root + + +def date_get_today() -> str: + """returns the date string for the output""" + today = date.today() + return today.strftime("%Y-%m-%d") + + +def main(): # pylint: disable=too-many-statements + """This script does this and that""" + parser = argparse.ArgumentParser() + parser.add_argument( + "-v", + "--verbosity", + dest="verbosity", + action="count", + default=0, + help="set verbosity level", + ) + parser.add_argument( + "--from", + dest="from_version", + action="store", + default="x.y.z", + help="from version", + ) + parser.add_argument( + "--to", + dest="to_version", + action="store", + default=0, + help="to version", + ) + args = parser.parse_args() + _from = args.from_version + _to = args.to_version + if not _to: + sys.exit("Don't know to version to bump.") + root = Path(get_git_root()) + docs = root / "docs" + iso_date_today = date_get_today() + if args.verbosity == 1: + logging.basicConfig(level=logging.INFO) + elif args.verbosity > 1: + logging.basicConfig(level=logging.DEBUG) + else: + logging.basicConfig(level=logging.ERROR) + + # *.c, *.h files + all_c_h_files = ( + list((root / "conf").rglob("**/*.[c|h]")) + + list((root / "docs").rglob("**/*.[c|h]")) + + list((root / "src").rglob("**/*.[c|h]")) + + list((root / "tests").rglob("**/*.[c|h]")) + ) + updated = re.compile(r" \* @updated (\d{4}-\d{2}-\d{2}) \(date of last update\)") + updated_new = f" * @updated {iso_date_today} (date of last update)" + old_version = f" * @version v{_from}" + new_version = f" * @version v{_to}" + logging.debug(f"from: {old_version}") + logging.debug(f"to: {new_version}") + for i in all_c_h_files: + txt = i.read_text(encoding="utf-8") + if " * @author foxBMS Team" in txt: + # re-read file to ensure ascii encoding on our files + txt = i.read_text(encoding="utf-8") + logging.debug(f"Found foxBMS 2 file: {i}") + if old_version in txt: + logging.debug("...Replacing version") + txt = txt.replace(old_version, new_version, 1) + logging.debug("...Replacing updated") + txt = updated.sub(updated_new, txt) + i.write_text(txt, encoding="ascii") + + wscript = root / "wscript" + txt = wscript.read_text(encoding="utf-8") + txt = txt.replace(f'VERSION = "{_from}"', f'VERSION = "{_to}"') + wscript.write_text(txt, encoding="utf-8") + + citation = root / "CITATION.cff" + txt = citation.read_text(encoding="utf-8") + txt = txt.replace(f'version: "{_from}"', f'version: "{_to}"') + txt = re.sub( + r"date-released: \d{4}-\d{2}-\d{2}", f"date-released: {iso_date_today}", txt + ) + citation.write_text(txt, encoding="utf-8") + + changelog = docs / "general" / "changelog.rst" + logging.debug(f"Patching {changelog}") + changelog_regex = re.compile( + rf"\[{_from}\][ ]-[ ]([0-9]{{4}})[-](([0-9]{{2}})|(xx))-(([0-9]{{2}})|(xx))" + ) + logging.debug(f"Using {changelog_regex}") + txt = changelog.read_text(encoding="utf-8") + txt = changelog_regex.sub( + f"[{_to}] - {iso_date_today}", + txt, + ) + changelog.write_text(txt, encoding="utf-8") + + releases = docs / "general" / "releases.csv" + txt = releases.read_text(encoding="utf-8") + txt = txt.replace(f"v{_from};", f"v{_to};", 1) + txt = re.sub(r"\d{4}-\d{2}-\d{2}", iso_date_today, txt, 1) + txt = txt.replace(f"/v{_from}/", f"/v{_to}/", 1) + releases.write_text(txt, encoding="utf-8") + + software_installation = docs / "getting-started" / "software-installation.rst" + txt = software_installation.read_text(encoding="utf-8") + txt = txt.replace(_from, _to, 4) + software_installation.write_text(txt, encoding="utf-8") + + macros = docs / "macros.txt" + txt = macros.read_text(encoding="utf-8") + txt = txt.replace( + f".. |version_foxbms| replace:: ``{_from}``", + f".. |version_foxbms| replace:: ``{_to}``", + 1, + ) + macros.write_text(txt, encoding="utf-8") + + fgui = root / "tools" / "gui" / "fgui" / "__init__.py" + txt = fgui.read_text(encoding="utf-8") + txt = txt.replace( + f'__version__ = "{_from}"', + f'__version__ = "{_to}"', + 1, + ) + fgui.write_text(txt, encoding="utf-8") + + +if __name__ == "__main__": + main() diff --git a/tools/waf-tools/f_clang_format.py b/tools/waf-tools/f_clang_format.py index e06c706f..a0fdbe76 100644 --- a/tools/waf-tools/f_clang_format.py +++ b/tools/waf-tools/f_clang_format.py @@ -71,7 +71,7 @@ class clang_format(Task.Task): # pylint: disable-msg=invalid-name #: str: color in which the command line is displayed in the terminal color = "BLUE" - vars = ["CLANG_FORMAT_OPTIONS"] + vars = ["CLANG_FORMAT_OPTIONS", "CLANG_FORMAT_CONFIGURATION_FILES"] run_str = "${CLANG_FORMAT} ${CLANG_FORMAT_OPTIONS} ${SRC[0].abspath()}" diff --git a/tools/waf-tools/f_guidelines.py b/tools/waf-tools/f_guidelines.py index a623758f..ba896e3a 100644 --- a/tools/waf-tools/f_guidelines.py +++ b/tools/waf-tools/f_guidelines.py @@ -1713,6 +1713,10 @@ def process_guidelines(self): c_formatting_provider = c_rules["formatting"]["provider"] if c_formatting_provider != "clang-format": self.bld.fatal("Only clang-format is supported.") + tmp = [] + for i in self.bld.path.ant_glob("**/.clang-format"): + tmp.append(i.h_file()) + self.bld.env.CLANG_FORMAT_CONFIGURATION_FILES = tmp if self.bld.env.CLANG_FORMAT: for i in c_to_check_formatting: self.create_task("clang_format", src=i, cwd=self.path) diff --git a/tools/waf-tools/f_pylint.py b/tools/waf-tools/f_pylint.py index c9afee62..108f34e9 100644 --- a/tools/waf-tools/f_pylint.py +++ b/tools/waf-tools/f_pylint.py @@ -38,7 +38,7 @@ # - "This product includes parts of foxBMS®" # - "This product is derived from foxBMS®" -r"""Implements a waf tool to run `pylint `_. +r"""Implements a waf tool to run `pylint `_. :numref:`f-pylint-usage` shows how to use this tool. diff --git a/tools/waf-tools/f_ti_arm_cgt.py b/tools/waf-tools/f_ti_arm_cgt.py index 6e685622..b1aabd4f 100644 --- a/tools/waf-tools/f_ti_arm_cgt.py +++ b/tools/waf-tools/f_ti_arm_cgt.py @@ -49,6 +49,7 @@ import shutil import sys from hashlib import md5 +from datetime import date import waflib.Tools.asm from waflib import Context, Logs, Task, TaskGen, Utils, Errors @@ -1089,9 +1090,23 @@ def get_version_from_git(self): # pylint: disable=no-member describe_output = f"no-vcs-{self.env.VERSION}-dirty" if self.repo: - describe_output = self.repo.git.describe( - "--dirty", "--tags", "--long", "--always", "--match", "*.*" + cmd = [ + self.generator.env.GIT[0], + "describe", + "--dirty", + "--tags", + "--long", + "--always", + "--match", + "*.*", + ] + describe_output, _ = self.generator.bld.cmd_and_log( + cmd, + quiet=Context.BOTH, + output=Context.BOTH, + cwd=self.env.PROJECT_ROOT[0], ) + describe_output = describe_output.strip() if describe_output.endswith("-dirty"): dirty = True @@ -1105,9 +1120,11 @@ def get_version_from_git(self): patch = 0 distance = 0 commit = "no-vcs" - if describe_output.startswith("v"): - # remove v from start - describe_output = describe_output[1:] + if describe_output.startswith(("v", "gh-")): + if describe_output.startswith("v"): + describe_output = describe_output[1:] # remove v from start + elif describe_output.startswith("gh-"): + describe_output = describe_output[3:] # remove gh- from start # we are on a branch with a tagged version tag, distance, commit = describe_output.rsplit("-", 2) # try to split of any additions like -rc or -alpha as we don't care @@ -1165,8 +1182,16 @@ def run(self): git_remote = self.get_remote() version_output = self.get_version_from_git() - - if version_output.get("tag") not in ("unreleased", waf_version): + if waf_version == "x.y.z": + version_output["version"] = "x.y.z" + version_output["tag"] = "0.0.0" + version_output["major"] = 0 + version_output["minor"] = 0 + version_output["patch"] = 0 + + if (not version_output.get("tag") == waf_version) and ( + not waf_version == "x.y.z" + ): self.generator.bld.fatal( f"Extracted version from git repo ({version_output['tag']}) does not match " f"version defined in waf ({waf_version})." @@ -1179,29 +1204,64 @@ def run(self): maximum_version_size = 255 maximum_distance_size = 65535 distance_int = min(maximum_distance_size, version_output["distance"]) + + major = min(maximum_version_size, version_output["major"]) + minor = min(maximum_version_size, version_output["minor"]) + patch = min(maximum_version_size, version_output["patch"]) + commit_hash = version_output.get("commit", "noHash")[ :commit_hash_maximum_string_length ] - self.outputs[0].write( + txt = self.inputs[0].read(encoding="utf-8") + txt = txt.replace('#include "c.h"', '#include "version_cfg.h"') + doxygen_comment_tpl = [ + " * @file c.c", + " * @author foxBMS Team", + " * @date 2019-08-27 (date of creation)", + " * @updated 2022-05-30 (date of last update)", + " * @version vx.y.z", + " * @ingroup SOME_GROUP", + " * @prefix ABC", + " * @brief Implementation of some software", + ] + tmp = date.today().strftime("%Y-%m-%d") + doxygen_comment = [ + " * @file version_cfg.c", + " * @author foxBMS Team", + f" * @date {tmp} (date of creation)", + f" * @updated {tmp} (date of last update)", + f" * @version v{major}.{minor}.{patch}", + " * @ingroup GENERAL", + " * @prefix VER", + ( + " * @brief Header file for the version information that is " + "generated by the\n * toolchain." + ), + ] + for finding, _replacement in zip(doxygen_comment_tpl, doxygen_comment): + txt = txt.replace(finding, _replacement) + marker = "/*========== Static Constant and Variable Definitions =======================*/" + txt = txt.replace( + marker, os.linesep.join( [ - '#include "version_cfg.h"', - "const VERSION_s foxbmsVersionInfo VERSION_INFORMATION = {", + marker, + "const VER_VERSION_s ver_foxbmsVersionInformation VER_VERSION_INFORMATION = {", f" .underVersionControl = {is_git_repo},", f" .isDirty = {is_dirty},", - f" .major = {min(maximum_version_size, version_output['major'])},", - f" .minor = {min(maximum_version_size, version_output['minor'])},", - f" .patch = {min(maximum_version_size, version_output['patch'])},", + f" .major = {major},", + f" .minor = {minor},", + f" .patch = {patch},", f" .distanceFromLastRelease = {distance_int},", f' .commitHash = "{commit_hash}",', f' .gitRemote = "{git_remote[:git_remote_maximum_string_length]}",', "};", ] - ) - + os.linesep, - encoding="utf-8", + ), ) + self.outputs[0].write(txt, encoding="utf-8") + def sig_explicit_deps(self): """Defines how to get signature of this task (and thus when to rerun it)""" version_output = self.get_version_from_git() @@ -1229,8 +1289,10 @@ def create_version_file(self): else: Logs.warn("Git not available. Proceeding without version information.") repo = None + src = self.path.ctx.root.find_node(f"{self.env.PROJECT_ROOT[0]}/conf/tpl/c.c") tsk = self.create_task( "create_version_source", + src=src, tgt=[ self.path.find_or_declare("version_cfg.c"), ], @@ -1310,7 +1372,11 @@ def get_swi_aliases(self): self.swi_tasks = [] for i in self.files: self.swi_tasks.append( - self.create_task("search_swi", i, i.change_ext(f"{i.suffix()}.swi.json")) + self.create_task( + "search_swi", + src=i, + tgt=i.change_ext(f"{i.suffix()}.{self.idx}.swi.json"), + ) ) @@ -1353,13 +1419,21 @@ def run(self): ) self.outputs[0].write(all_info + os.linesep) + def keyword(self): + """displayed keyword when this check is run""" + return "Dump swi information" + @TaskGen.feature("swi-check") @TaskGen.after_method("process_source") def print_swi_aliases(self): """Find all swi aliases""" + if not self.jump_table_file: + self.bld.fatal("Could not find jump table file.") src = [self.jump_table_file] + [x.outputs[0] for x in self.swi_tasks] - self.create_task("print_swi", src=src, tgt=self.path.find_or_declare("swi.json")) + self.create_task( + "print_swi", src=src, tgt=self.path.find_or_declare(f"{self.idx}.swi.json") + ) @conf diff --git a/tools/waf-tools/f_ti_arm_helper.py b/tools/waf-tools/f_ti_arm_helper.py index 8965236a..4023ffd7 100644 --- a/tools/waf-tools/f_ti_arm_helper.py +++ b/tools/waf-tools/f_ti_arm_helper.py @@ -44,6 +44,8 @@ import os import traceback +from copy import deepcopy + from waflib import Context, Errors, Logs, Utils from waflib.Configure import conf @@ -140,11 +142,26 @@ def get_defines(self, *k, **kw): --confcache to have a good debug experience on the build process while not cluttering the output directory. """ - + programs = [] + for i in self.env: + if i.startswith("ARM"): + if self.env[i][0].endswith(".exe"): + programs.append(self.env[i][0]) + arguments = deepcopy(self.env.CFLAGS) + if "--strict_ansi" in self.env.CFLAGS_FOXBMS: + arguments.append("--strict_ansi") + debug_info = ( + "/*\nBuild information:\n " + + "\n ".join(programs) + + "\n\n " + + "\n ".join(arguments) + + f"\n\n using {self.env.PPM}" + + "\n*/" + ) testfile_basename = "predefined_defines" kw["features"] = "c" kw["idx"] = 0 - kw["fragment"] = "int main() {\n return 0;\n}\n" + kw["fragment"] = f"{debug_info}\nint main() {{\n return 0;\n}}\n" kw["out_name"] = testfile_basename kw["compile_filename"] = f"{testfile_basename}.c" kw["msg"] = "Getting predefined compiler defines" diff --git a/tools/waf-tools/f_vscode.py b/tools/waf-tools/f_vscode.py index 9f06494c..bc913a67 100644 --- a/tools/waf-tools/f_vscode.py +++ b/tools/waf-tools/f_vscode.py @@ -44,13 +44,11 @@ For information on VS Code see https://code.visualstudio.com/. """ -import json import os from pathlib import Path import re import jinja2 -import jsonschema from waflib import Context, Utils # This tool uses slash as path separator for the sake of simplicity as it @@ -207,7 +205,7 @@ def configure(conf): # pylint: disable=too-many-statements,too-many-branches PYTHON_ANALYSIS_EXTRA_PATHS=[waf_dir, waf_tools_dir, axivion_modules], PYLINT_PATH=pylint_exe, PYLINT_CONFIG=pylint_cfg, - BLACKPATH=black_exe, + BLACK_PATH=black_exe, BLACK_CONFIG=black_cfg, CLANG_FORMAT_EXECUTABLE=clang_format_executable, AXIVION_VS_CONFIG=axivion_vs_config, @@ -222,9 +220,7 @@ def configure(conf): # pylint: disable=too-many-statements,too-many-branches .read() .splitlines() ) - vscode_defines = [ - (f"FOXBMS_USES_{conf.env.CONF_OPERATING_SYSTEM_NAME[0].upper()}", 1) - ] + vscode_defines = [i.split("=") for i in conf.env.DEFINES] reg = re.compile(r"(#define)([ ])([a-zA-Z0-9_]{1,})([ ])([a-zA-Z0-9_\":. ]{1,})") for d in defines_read: define = d.split("/*")[0] @@ -236,69 +232,28 @@ def configure(conf): # pylint: disable=too-many-statements,too-many-branches if '"' in val: val = val.replace('"', '\\"') vscode_defines.append((def_name, val)) - - bms_config = json.loads( - conf.path.find_node(os.path.join("conf", "bms", "bms.json")).read() - ) - validator = conf.f_validator( - conf.path.find_node( - os.path.join("conf", "bms", "schema", "bms.schema.json") - ).abspath() - ) - try: - validator.validate(bms_config) - except jsonschema.exceptions.ValidationError as err: - good_values = ", ".join([f"'{i}'" for i in err.validator_value]) - conf.fatal( - f"Setting '{err.instance}' in '{'/'.join(list(err.path))}' is not " - f"supported.\nUse one of these: {good_values}." - ) - os_name = bms_config["operating-system"]["name"] - rtos_details = json.loads( - conf.path.find_node( - os.path.join("src", "os", os_name, f"{os_name}_cfg.json") - ).read() - ) - - os_includes = [ - Path(os.path.join("src", "os", os_name, i)).as_posix() - for i in rtos_details["include"] + rtos_includes = [ + Path(str(conf.root.find_node(i).path_from(conf.path))).as_posix() + for i in conf.env.INCLUDES_RTOS ] - bal = bms_config["slave-unit"]["balancing-strategy"] - soc = bms_config["application"]["algorithm"]["state-estimation"]["soc"] - soe = bms_config["application"]["algorithm"]["state-estimation"]["soe"] - soh = bms_config["application"]["algorithm"]["state-estimation"]["soh"] - - imd = bms_config["application"]["insulation-monitoring-device"] - imd_manufacturer = imd["manufacturer"] - imd_model = imd["model"] - - chip = bms_config["slave-unit"]["analog-front-end"]["chip"] - if chip in ("6804-1", "6811-1", "6812-1"): - chip = "6813-1" c_cpp_properties = template.render( ARMCL=Path(conf.env.CC[0]).as_posix(), - OS=os_name, - OS_INCLUDES=os_includes, - BALANCING_STRATEGY=bal, - AFE_MANUFACTURER=bms_config["slave-unit"]["analog-front-end"]["manufacturer"], - AFE_CHIP=chip, - TEMPERATURE_SENSOR_MANUFACTURER=bms_config["slave-unit"]["temperature-sensor"][ - "manufacturer" - ], - TEMPERATURE_SENSOR_MODEL=bms_config["slave-unit"]["temperature-sensor"][ - "model" - ], - TEMPERATURE_SENSOR_METHOD=bms_config["slave-unit"]["temperature-sensor"][ - "method" - ], - STATE_ESTIMATOR_SOC=soc, - STATE_ESTIMATOR_SOE=soe, - STATE_ESTIMATOR_SOH=soh, - IMD_MANUFACTURER=imd_manufacturer, - IMD_MODEL=imd_model, + RTOS=conf.env.RTOS_NAME[0], + RTOS_INCLUDES=rtos_includes, + BALANCING_STRATEGY=conf.env.balancing_strategy, + AFE_MANUFACTURER=conf.env.afe_manufacturer, + AFE_IC=conf.env.afe_ic, + TEMPERATURE_SENSOR_MANUFACTURER=conf.env.temperature_sensor_manuf, + TEMPERATURE_SENSOR_MODEL=conf.env.temperature_sensor_model, + TEMPERATURE_SENSOR_METHOD=conf.env.temperature_sensor_meth, + STATE_ESTIMATOR_SOC=conf.env.state_estimator_soc, + STATE_ESTIMATOR_SOE=conf.env.state_estimator_soe, + STATE_ESTIMATOR_SOF=conf.env.state_estimator_sof, + STATE_ESTIMATOR_SOH=conf.env.state_estimator_soh, + IMD_MANUFACTURER=conf.env.imd_manufacturer, + IMD_MODEL=conf.env.imd_model, INCLUDES=[Path(x).as_posix() for x in conf.env.INCLUDES], - CSTANDARD="c11", + C_STANDARD="c11", DEFINES=vscode_defines, ) vsc_c_cpp_properties_file = os.path.join( diff --git a/wscript b/wscript index 51fb1c2f..ae2e63b3 100644 --- a/wscript +++ b/wscript @@ -47,16 +47,16 @@ and running various checks on the source files. """ -import json import os import pathlib import shlex import sys import tarfile import linecache +from binascii import hexlify +import dataclasses import jsonschema -import tabulate from waflib import Build, Configure, Context, Errors, Logs, Options, Scripting, Utils from waflib.Build import ( BuildContext, @@ -77,7 +77,7 @@ top = "." # pylint:disable=invalid-name APPNAME = "foxBMS" """name of the application. This is used in various waf functions""" -VERSION = "1.3.0" +VERSION = "1.4.0" """version of the application. This is used in various waf functions. This version must match the version number defined in ``macros.txt``. Otherwise a configuration error is thrown.""" @@ -93,6 +93,22 @@ ALL_VARIANTS = {"binary": BIN_VARIANTS, "misc": MISC_VARIANTS} TOOLDIR = os.path.join("tools", "waf-tools") +BMS_CONFIG = os.path.join("conf", "bms", "bms.json") + + +@dataclasses.dataclass +class FoxBMSDefine: + """container for defines""" + + name: str + value: int = 0 + + +AFE_SETUP = { + "fsm": FoxBMSDefine("FOXBMS_AFE_DRIVER_TYPE_FSM", 0), + "no-fsm": FoxBMSDefine("FOXBMS_AFE_DRIVER_TYPE_NO_FSM", 0), +} + for target_type, target_val in ALL_VARIANTS.items(): contexts = (BuildContext, CleanContext) if target_type == "binary": @@ -184,7 +200,8 @@ def version_consistency_checker(ctx): if not all(i.read().find(f'__version__ = "{VERSION}"') > 0 for i in pys): ctx.fatal(f"Version information in {pys} is not correct.") all_c_sources = ctx.path.ant_glob( - "docs/**/*.c docs/**/*.h src/**/*.c src/**/*.c tests/**/*.c tests/**/*.c" + "docs/**/*.c docs/**/*.h src/**/*.c src/**/*.c tests/**/*.c tests/**/*.c", + excl=["tests/axivion/addon-test/**/*.c", "tests/axivion/addon-test/**/*.h"], ) version_line = -1 main_txt = ctx.path.find_node("src/app/main/main.c").read() @@ -281,6 +298,7 @@ def configure(conf): # pylint: disable=too-many-statements,too-many-branches """ if " " in conf.path.abspath(): conf.fatal(f"Project path must not contain spaces ({conf.path}).") + conf.env.append_unique("PROJECT_ROOT", pathlib.Path(conf.path.abspath()).as_posix()) known_max_depth = 133 if Utils.is_win32 and len(conf.path.abspath()) + known_max_depth > 260: conf.fatal( @@ -388,10 +406,12 @@ def configure(conf): # pylint: disable=too-many-statements,too-many-branches conf.load("f_lauterbach", tooldir=TOOLDIR) conf.load("f_axivion", tooldir=TOOLDIR) - # Configure the build for the correct operating system - bms_config = json.loads( - conf.path.find_node(os.path.join("conf", "bms", "bms.json")).read() + # Configure the build for the correct RTOS + bms_config_node = conf.path.find_node(BMS_CONFIG) + conf.env.append_unique( + "CONFIG_BMS_JSON_HASH", hexlify(bms_config_node.h_file()).decode("utf-8") ) + bms_config = bms_config_node.read_json() validator = conf.f_validator( conf.path.find_node( @@ -407,11 +427,99 @@ def configure(conf): # pylint: disable=too-many-statements,too-many-branches f"supported.\nUse one of these: {good_values}." ) + # parse conf/bms/bms.json to get all required defines, includes etc. + # needs to be done, prior to loading the VS Code tool! + # AFE on Slave unit: bms.json:slave-unit:analog-front-end + slave_afe = bms_config["slave-unit"]["analog-front-end"] + afe_man = slave_afe["manufacturer"] + afe_ic = slave_afe["ic"] + conf.env.afe_manufacturer = afe_man + conf.env.afe_ic = afe_ic + # vendor/ic includes and foxBMS specific driver adaptions + afe_ic_inc = slave_afe["ic"] + afe_driver_type = "fsm" + if slave_afe["manufacturer"] == "ltc": + if slave_afe["ic"] in ("6804-1", "6811-1", "6812-1"): + afe_ic_inc = "6813-1" + elif slave_afe["manufacturer"] == "nxp": + if slave_afe["ic"] == "mc33775a": + afe_driver_type = "no-fsm" + + # set the driver type implementation accordingly + AFE_SETUP[afe_driver_type].value = 1 + for _, i in AFE_SETUP.items(): + conf.define(i.name, i.value) + + # get AFE includes + afe_base_path = os.path.join("src", "app", "driver", "afe") + incs = os.path.join( + afe_base_path, afe_man, afe_ic_inc, f"{afe_man}_{afe_ic_inc}.json" + ) + afe_details = conf.path.find_node(incs).read_json() + afe_includes = [ + os.path.join(afe_base_path, afe_man, afe_ic_inc, i) + for i in afe_details["include"] + ] + for i in afe_includes: + if not os.path.isdir(i): + conf.fatal(f"'{i}' does not exist.") conf.env.append_unique( - "CONF_OPERATING_SYSTEM_NAME", bms_config["operating-system"]["name"] + "INCLUDES_AFE", [conf.path.find_node(i).abspath() for i in afe_includes] ) - # set define before loading the VS Code tool - conf.define(f"FOXBMS_USES_{conf.env.CONF_OPERATING_SYSTEM_NAME[0].upper()}", 1) + # temperature sensor on Slave unit: bms.json:slave-unit:temperature-sensor + slave_temp = bms_config["slave-unit"]["temperature-sensor"] + conf.env.temperature_sensor_manuf = slave_temp["manufacturer"] + conf.env.temperature_sensor_model = slave_temp["model"] + conf.env.temperature_sensor_meth = slave_temp["method"] + + # application setting: bms.json:application + # state estimation + app_cfg = bms_config["application"] + state_estimators = app_cfg["algorithm"]["state-estimation"] + conf.env.state_estimator_soc = state_estimators["soc"] + conf.env.state_estimator_soe = state_estimators["soe"] + conf.env.state_estimator_sof = state_estimators["sof"] + conf.env.state_estimator_soh = state_estimators["soh"] + + # balancing strategy + conf.env.balancing_strategy = app_cfg["balancing-strategy"] + # ltc 6806 (fuel cell monitoring ic) has no balancing support + if ( + afe_man == "ltc" + and afe_ic == "6806" + and not conf.env.balancing_strategy == "none" + ): + conf.fatal(f"{afe_man.upper()} {afe_ic} does not support balancing.") + + # insulation-monitoring-device + imd_cfg = app_cfg["insulation-monitoring-device"] + conf.env.imd_manufacturer = imd_cfg["manufacturer"] + conf.env.imd_model = imd_cfg["model"] + if conf.env.imd_manufacturer: + conf.env.append_unique( + "INCLUDES_IMD", + [ + conf.path.find_node(i) + for i in [ + conf.env.imd_manufacturer + conf.env.imd_model, + ] + ], + ) + + # rtos: bms.json:rtos + rtos_name = bms_config["rtos"]["name"] + rtos_base_path = os.path.join("src", "os", rtos_name) + conf.env.append_unique("RTOS_NAME", rtos_name) + rtos_details = conf.path.find_node( + os.path.join(rtos_base_path, f"{rtos_name}_cfg.json") + ).read_json() + + rtos_includes = [os.path.join(rtos_base_path, i) for i in rtos_details["include"]] + conf.env.append_unique( + "INCLUDES_RTOS", [conf.path.find_node(i).abspath() for i in rtos_includes] + ) + + conf.define(f"FOXBMS_USES_{bms_config['rtos']['name'].upper()}", 1) # load VS Code setup as last foxBMS specific tool to ensure that all # variables have a meaningful value @@ -468,140 +576,11 @@ def build(bld): # pylint: disable=too-many-branches,too-many-statements "CMD_FILES", [bld.path.find_node(os.path.join("conf", "cc", "remarks.txt")).abspath()], ) - bms_config = json.loads( - bld.path.find_node(os.path.join("conf", "bms", "bms.json")).read() - ) - validator = bld.f_validator( - bld.path.find_node( - os.path.join("conf", "bms", "schema", "bms.schema.json") - ).abspath() - ) - try: - validator.validate(bms_config) - except jsonschema.exceptions.ValidationError as err: - good_values = ", ".join([f"'{i}'" for i in err.validator_value]) - bld.fatal( - f"Setting '{err.instance}' in '{'/'.join(list(err.path))}' is not " - f"supported.\nUse one of these: {good_values}." - ) - - bld.env.append_unique( - "OPERATING_SYSTEM_NAME", bms_config["operating-system"]["name"] - ) - if not bld.env.OPERATING_SYSTEM_NAME[0] == bld.env.CONF_OPERATING_SYSTEM_NAME[0]: - bld.fatal("The operating system has changed. Re-configure the project.") - # get operating system includes - rtos_details = json.loads( - bld.path.find_node( - os.path.join( - "src", - "os", - bld.env.OPERATING_SYSTEM_NAME[0], - f"{bld.env.OPERATING_SYSTEM_NAME[0]}_cfg.json", - ) - ).read() - ) - - operating_system_includes = [ - os.path.join("src", "os", bms_config["operating-system"]["name"], i) - for i in rtos_details["include"] - ] - bld.env.append_unique( - "INCLUDES_OPERATING_SYSTEM", - [bld.path.find_node(i) for i in operating_system_includes], - ) - - slave_config = bms_config["slave-unit"] - afe = slave_config["analog-front-end"] - bld.env.afe_manufacturer = afe["manufacturer"] - bld.env.afe_chip = afe["chip"] - afe_ic_inc = afe["chip"] - if afe["chip"] in ("6804-1", "6811-1", "6812-1"): - afe_ic_inc = "6813-1" - # get AFE includes - incs = os.path.join( - "src", - "app", - "driver", - "afe", - afe["manufacturer"], - afe_ic_inc, - f"{afe['manufacturer']}_{afe_ic_inc}.json", - ) - afe_details = json.loads(bld.path.find_node(incs).read()) - afe_includes = [ - os.path.join("src", "app", "driver", "afe", afe["manufacturer"], afe["chip"], i) - for i in afe_details["include"] - ] - bld.env.append_unique("INCLUDES_AFE", [bld.path.find_node(i) for i in afe_includes]) - bld.env.balancing_strategy = slave_config["balancing-strategy"] - bld.env.balancing_possible = slave_config["balancing-strategy"] != "none" - - temperature_sensor_config = slave_config["temperature-sensor"] - bld.env.temperature_sensor_manuf = temperature_sensor_config["manufacturer"] - bld.env.temperature_sensor_model = temperature_sensor_config["model"] - bld.env.temperature_sensor_meth = temperature_sensor_config["method"] - - app_cfg = bms_config["application"] - # SOx includes - state_estimators = app_cfg["algorithm"]["state-estimation"] - bld.env.ALGORITHM_SOC = soc = state_estimators["soc"] - bld.env.ALGORITHM_SOE = soe = state_estimators["soe"] - bld.env.ALGORITHM_SOH = soh = state_estimators["soh"] - estimators_base_path = os.path.join( - "src", "app", "application", "algorithm", "state_estimation" - ) - for i, val in zip([soc, soe, soh], ["soc", "soe", "soh"]): - bld.env.append_unique( - f"INCLUDES_STATE_ESTIMATOR_+{val.upper()}", - [bld.path.find_node(os.path.join(estimators_base_path, val, i))], - ) - imd_cfg = app_cfg["insulation-monitoring-device"] - bld.env.imd_manufacturer = imd_cfg["manufacturer"] - bld.env.imd_model = imd_cfg["model"] - bld.env.append_unique( - "INCLUDES_IMD", - [bld.path.find_node(i) for i in [bld.env.imd_manufacturer + bld.env.imd_model]], - ) + if not bld.env.CONFIG_BMS_JSON_HASH[0] == hexlify( + bld.path.find_node(BMS_CONFIG).h_file() + ).decode("utf-8"): + bld.fatal(f"{BMS_CONFIG} has changed. Please run the configure command again.") if bld.variant == "bin": - bld( - features="swi-check", - files=bld.path.ant_glob("src/**/*.c src/**/*.h"), - jump_table_file=bld.path.find_node( - os.path.join( - "src", - "os", - "freertos", - "portable", - "ccs", - "arm_cortex-r5", - "portasm.asm", - ) - ), - ) - if Logs.verbose: - balancing_info_str = "Not supported by chip" - if bld.env.balancing_possible: - balancing_info_str = bld.env.balancing_strategy - info = tabulate.tabulate( - [ - ["Setting", "Value"], - ["Operating system", bld.env.OPERATING_SYSTEM_NAME[0]], - [ - "AFE", - f"{bld.env.afe_manufacturer} {bld.env.afe_chip}", - ], - ["Balancing strategy", balancing_info_str], - [ - "Battery pack temperature sensing", - f"{bld.env.temperature_sensor_manuf} {bld.env.temperature_sensor_model} " - f"({bld.env.temperature_sensor_meth})", - ], - ], - showindex=True, - headers="firstrow", - ) - print(info) bld.recurse("src") if bld.variant == "axivion": @@ -613,7 +592,7 @@ def build(bld): # pylint: disable=too-many-branches,too-many-statements bld.recurse("src") if bld.variant == "unit_test": - Options.commands = ["check_testfiles"] + Options.commands + Options.commands = ["check_test_files"] + Options.commands if bld.cmd.startswith("clean"): return if bld.cmd.startswith("build"): @@ -695,11 +674,11 @@ def build(bld): # pylint: disable=too-many-branches,too-many-statements bld.path.find_node(os.path.join("src", "os")), bld.path.find_node(os.path.join("src", "app", "driver", "afe", "ltc", "common", "ltc_pec.c")), bld.path.find_node(os.path.join("src", "app", "driver", "afe", "ltc", "common", "ltc_pec.h")), - bld.path.find_node(os.path.join("src", "app", "driver", "afe", "nxp", "common", "MC33775A.h")), + bld.path.find_node(os.path.join("src", "app", "driver", "afe", "nxp", "mc33775a","vendor")), ] _html_footer = bld.path.find_node(os.path.join("docs", "doxygen_footer.html")) _layout_file = bld.path.find_node(os.path.join("docs", "doxygen_layout.xml")) - _html_stylesheet = bld.path.find_node(os.path.join("docs", "stylesheetfile.css")) + _html_style_sheet = bld.path.find_node(os.path.join("docs", "style-sheet-file.css")) _html_extra_files = bld.path.find_node(os.path.join("docs", "_static", "cc.large.png")) _image_path = bld.path.find_node(os.path.join("docs", "_static", "cc.large.png")) # pylint: enable=line-too-long @@ -711,7 +690,7 @@ def build(bld): # pylint: disable=too-many-branches,too-many-statements _exclude[:], _html_footer, _layout_file, - _html_stylesheet, + _html_style_sheet, _html_extra_files, _image_path, ) @@ -727,11 +706,11 @@ def build(bld): # pylint: disable=too-many-branches,too-many-statements PROJECT_BRIEF=f'"The {APPNAME} Battery Management System API Documentation"', PROJECT_LOGO=_project_logo.abspath(), OUTPUT_DIRECTORY="_static/doxygen/src", - INPUT=" ".join([i.abspath() for i in _input]), - EXCLUDE=" ".join([i.abspath() for i in _exclude]), + INPUT=" ".join([i.abspath() for i in _input if i]), + EXCLUDE=" ".join([i.abspath() for i in _exclude if i]), HTML_FOOTER=_html_footer.abspath(), LAYOUT_FILE=_layout_file.abspath(), - HTML_STYLESHEET=_html_stylesheet.abspath(), + HTML_STYLESHEET=_html_style_sheet.abspath(), HTML_EXTRA_FILES=_html_extra_files.abspath(), IMAGE_PATH=_image_path.abspath(), ) @@ -749,11 +728,11 @@ def build(bld): # pylint: disable=too-many-branches,too-many-statements PROJECT_BRIEF=f'"The {APPNAME} Unit Tests API Documentation"', PROJECT_LOGO=_project_logo.abspath(), OUTPUT_DIRECTORY="_static/doxygen/tests", - INPUT=" ".join([i.abspath() for i in _input]), - EXCLUDE=" ".join([i.abspath() for i in _exclude]), + INPUT=" ".join([i.abspath() for i in _input if i]), + EXCLUDE=" ".join([i.abspath() for i in _exclude if i]), HTML_FOOTER=_html_footer.abspath(), LAYOUT_FILE=_layout_file.abspath(), - HTML_STYLESHEET=_html_stylesheet.abspath(), + HTML_STYLESHEET=_html_style_sheet.abspath(), HTML_EXTRA_FILES=_html_extra_files.abspath(), IMAGE_PATH=_image_path.abspath(), ) @@ -841,6 +820,7 @@ def build(bld): # pylint: disable=too-many-branches,too-many-statements os.path.join(doc_dir, "software", "modules", "driver", "mcu", "mcu.rst"), os.path.join(doc_dir, "software", "modules", "driver", "meas", "meas.rst"), os.path.join(doc_dir, "software", "modules", "driver", "afe", "supported-afes.rst"), + os.path.join(doc_dir, "software", "modules", "driver", "afe", "ltc", "6804-1.rst"), os.path.join(doc_dir, "software", "modules", "driver", "afe", "ltc", "6806.rst"), os.path.join(doc_dir, "software", "modules", "driver", "afe", "ltc", "6811-1.rst"), os.path.join(doc_dir, "software", "modules", "driver", "afe", "ltc", "6812-1.rst"), @@ -866,6 +846,7 @@ def build(bld): # pylint: disable=too-many-branches,too-many-statements os.path.join(doc_dir, "software", "modules", "engine", "diag", "diag_how-to.rst"), os.path.join(doc_dir, "software", "modules", "engine", "sys", "sys.rst"), os.path.join(doc_dir, "software", "modules", "engine", "sys_mon", "sys_mon.rst"), + os.path.join(doc_dir, "software", "modules", "main", "fassert.rst"), os.path.join(doc_dir, "software", "modules", "main", "fassert_how-to.rst"), os.path.join(doc_dir, "software", "modules", "main", "startup.rst"), os.path.join(doc_dir, "software", "modules", "main", "version.rst"), @@ -1036,7 +1017,7 @@ def distcheck_bin(conf): conf.excl = DIST_EXCLUDE -def check_testfiles(ctx): +def check_test_files(ctx): """Check if test files to corresponding source files exist.""" prefix = os.path.join(ctx.path.abspath(), "src") + os.pathsep sources = [ @@ -1045,6 +1026,7 @@ def check_testfiles(ctx): "src/app/**/*.c src/opt/**/*.c", excl=[ "src/app/driver/sbc/fs8x_driver/**", + "src/app/driver/afe/nxp/mc33775a/vendor/**", "src/app/driver/afe/ltc/common/ltc_pec.*", "src/hal/**", "src/os/**",