├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── pull_request_template.md └── workflows │ ├── build-documentation.yml │ ├── build-run-app.yml │ ├── codeql-build.yml │ ├── format-check.yml │ ├── static-analysis.yml │ └── unit-test-coverage.yml ├── CMakeLists.txt ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── arch_build.cmake ├── config ├── default_hs_fcncodes.h ├── default_hs_interface_cfg.h ├── default_hs_internal_cfg.h ├── default_hs_mission_cfg.h ├── default_hs_msg.h ├── default_hs_msgdefs.h ├── default_hs_msgids.h ├── default_hs_msgstruct.h ├── default_hs_platform_cfg.h ├── default_hs_tbl.h ├── default_hs_tbldefs.h ├── default_hs_tblstruct.h └── default_hs_topicids.h ├── docs ├── dox_src │ ├── CMakeLists.txt │ ├── cfs_hs.dox │ ├── hs-common.doxyfile.in │ └── hs-usersguide.doxyfile.in ├── hs-detaildesign.doxyfile.in ├── hs_FunctionalRequirements.csv └── users_guide_historical │ ├── CFS HS User Guide Doc No 582-2013-002.docx │ └── CFS HS User Guide Doc No 582-2013-002.pdf ├── eds └── HS.xml ├── fsw ├── inc │ ├── hs_eventids.h │ └── hs_perfids.h ├── src │ ├── hs_app.c │ ├── hs_app.h │ ├── hs_cmds.c │ ├── hs_cmds.h │ ├── hs_dispatch.c │ ├── hs_dispatch.h │ ├── hs_eds_dispatch.c │ ├── hs_monitors.c │ ├── hs_monitors.h │ ├── hs_sysmon.c │ ├── hs_sysmon.h │ ├── hs_utils.c │ ├── hs_utils.h │ ├── hs_verify.h │ └── hs_version.h └── tables │ ├── hs_amt.c │ ├── hs_emt.c │ ├── hs_mat.c │ └── hs_xct.c ├── mission_build.cmake └── unit-test ├── CMakeLists.txt ├── hs_app_tests.c ├── hs_cmds_tests.c ├── hs_dispatch_tests.c ├── hs_eds_dispatch_tests.c ├── hs_monitors_tests.c ├── hs_sysmon_tests.c ├── hs_utils_tests.c ├── stubs ├── hs_app_stubs.c ├── hs_cmds_stubs.c ├── hs_dispatch_stubs.c ├── hs_global_stubs.c ├── hs_monitors_stubs.c ├── hs_sysmon_stubs.c └── hs_utils_stubs.c └── utilities ├── hs_test_utils.c └── hs_test_utils.h /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Checklist (Please check before submitting)** 11 | 12 | * [ ] I reviewed the [Contributing Guide](https://github.com/nasa/HS/blob/main/CONTRIBUTING.md). 13 | * [ ] I performed a cursory search to see if the bug report is relevant, not redundant, nor in conflict with other tickets. 14 | 15 | **Describe the bug** 16 | A clear and concise description of what the bug is. 17 | 18 | **To Reproduce** 19 | Steps to reproduce the behavior: 20 | 1. Go to '...' 21 | 2. Click on '....' 22 | 3. Scroll down to '....' 23 | 4. See error 24 | 25 | **Expected behavior** 26 | A clear and concise description of what you expected to happen. 27 | 28 | **Code snips** 29 | If applicable, add references to the software. 30 | 31 | **System observed on:** 32 | - Hardware 33 | - OS: [e.g. Linux 4.4] 34 | - Versions [e.g. cFE 6.6, OSAL 4.2, PSP 1.3 for mcp750, any related apps] 35 | 36 | **Additional context** 37 | Add any other context about the problem here. 38 | 39 | **Reporter Info** 40 | Full name and company/organization if applicable 41 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Checklist (Please check before submitting)** 11 | 12 | * [ ] I reviewed the [Contributing Guide](https://github.com/nasa/HS/blob/main/CONTRIBUTING.md). 13 | * [ ] I reviewed the [README file](https://github.com/nasa/HS/blob/main/README.md) to see if the feature is in the major future work. 14 | * [ ] I performed a cursory search to see if the feature request is relevant, not redundant, nor in conflict with other tickets. 15 | 16 | **Is your feature request related to a problem? Please describe.** 17 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 18 | 19 | **Describe the solution you'd like** 20 | A clear and concise description of what you want to happen. 21 | 22 | **Describe alternatives you've considered** 23 | A clear and concise description of any alternative solutions or features you've considered. 24 | 25 | **Additional context** 26 | Add any other context about the feature request here. 27 | 28 | **Requester Info** 29 | Full name and company/organization if applicable 30 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | **Checklist (Please check before submitting)** 2 | 3 | * [ ] I reviewed the [Contributing Guide](https://github.com/nasa/HS/blob/main/CONTRIBUTING.md). 4 | * [ ] I signed and emailed the appropriate [Contributor License Agreement](https://github.com/nasa/cFS/blob/main/CONTRIBUTING.md#contributor-license-agreement-cla) to GSFC-SoftwareRelease@mail.nasa.gov and copied cfs-program@lists.nasa.gov. 5 | 6 | **Describe the contribution** 7 | A clear and concise description of what the contribution is. 8 | - Include explicitly what issue it addresses [e.g. Fixes #X] 9 | 10 | **Testing performed** 11 | Steps taken to test the contribution: 12 | 1. Build steps '...' 13 | 2. Execution steps '...' 14 | 15 | **Expected behavior changes** 16 | A clear and concise description of how this contribution will change behavior and level of impact. 17 | - API Change: xxx (if applicable) 18 | - Behavior Change: xxx (if applicable) 19 | - Or no impact to behavior 20 | 21 | **System(s) tested on** 22 | - Hardware: [e.g. PC, SP0, MCP750] 23 | - OS: [e.g. Ubuntu 18.04, RTEMS 4.11, VxWorks 6.9] 24 | - Versions: [e.g. cFE 6.6, OSAL 4.2, PSP 1.3 for mcp750, any related apps or tools] 25 | 26 | **Additional context** 27 | Add any other context about the contribution here. 28 | 29 | **Third party code** 30 | If included, identify any third party code and provide text file of license 31 | 32 | **Contributor Info - All information REQUIRED for consideration of pull request** 33 | Full name and company/organization/center of all contributors ("Personal" if individual work) 34 | - Note CLA's apply to software contributions. 35 | -------------------------------------------------------------------------------- /.github/workflows/build-documentation.yml: -------------------------------------------------------------------------------- 1 | name: Build and Deploy Documentation 2 | 3 | on: 4 | push: 5 | pull_request: 6 | 7 | jobs: 8 | build-documentation: 9 | name: Build and deploy cFS documents 10 | uses: nasa/cFS/.github/workflows/build-deploy-doc.yml@main 11 | with: 12 | target: "[\"hs-usersguide\"]" 13 | app-name: hs 14 | buildpdf: ${{ github.event_name == 'push' && contains(github.ref, 'main')}} 15 | deploy: ${{ github.event_name == 'push' && contains(github.ref, 'main')}} 16 | -------------------------------------------------------------------------------- /.github/workflows/build-run-app.yml: -------------------------------------------------------------------------------- 1 | name: Build and Run 2 | 3 | on: 4 | push: 5 | pull_request: 6 | 7 | jobs: 8 | build-run: 9 | name: Build and run with startup msg verification 10 | uses: nasa/cFS/.github/workflows/build-run-app.yml@main 11 | -------------------------------------------------------------------------------- /.github/workflows/codeql-build.yml: -------------------------------------------------------------------------------- 1 | name: CodeQl Analysis 2 | 3 | on: 4 | push: 5 | pull_request: 6 | 7 | 8 | jobs: 9 | codeql: 10 | name: Codeql Analysis 11 | uses: nasa/cFS/.github/workflows/codeql-reusable.yml@main 12 | with: 13 | component-path: apps/hs 14 | prep: 'make prep; make -C build/tools/elf2cfetbl' 15 | make: 'make -C build/native/default_cpu1/apps/hs' 16 | setup: | 17 | cp ./cfe/cmake/Makefile.sample Makefile && cp -r ./cfe/cmake/sample_defs sample_defs 18 | sed -i "/list(APPEND MISSION_GLOBAL_APPLIST/a list(APPEND MISSION_GLOBAL_APPLIST hs)" sample_defs/targets.cmake 19 | -------------------------------------------------------------------------------- /.github/workflows/format-check.yml: -------------------------------------------------------------------------------- 1 | name: Format Check 2 | 3 | # Run on all push and pull requests 4 | on: 5 | push: 6 | pull_request: 7 | 8 | jobs: 9 | format-check: 10 | name: Run format check 11 | uses: nasa/cFS/.github/workflows/format-check.yml@main 12 | -------------------------------------------------------------------------------- /.github/workflows/static-analysis.yml: -------------------------------------------------------------------------------- 1 | name: Static Analysis 2 | 3 | # Run on all push and pull requests 4 | on: 5 | push: 6 | pull_request: 7 | 8 | jobs: 9 | static-analysis: 10 | name: Run cppcheck 11 | uses: nasa/cFS/.github/workflows/static-analysis.yml@main 12 | with: 13 | strict-dir-list: './fsw' 14 | -------------------------------------------------------------------------------- /.github/workflows/unit-test-coverage.yml: -------------------------------------------------------------------------------- 1 | name: Unit Test and Coverage 2 | 3 | on: 4 | push: 5 | pull_request: 6 | 7 | jobs: 8 | unit-test-coverage: 9 | name: Run unit test and coverage 10 | uses: nasa/cFS/.github/workflows/unit-test-coverage.yml@main 11 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(CFS_HS C) 2 | 3 | set(APP_SRC_FILES 4 | fsw/src/hs_monitors.c 5 | fsw/src/hs_utils.c 6 | fsw/src/hs_sysmon.c 7 | fsw/src/hs_app.c 8 | fsw/src/hs_cmds.c 9 | ) 10 | 11 | if (CFE_EDS_ENABLED_BUILD) 12 | list(APPEND APP_SRC_FILES 13 | fsw/src/hs_eds_dispatch.c 14 | ) 15 | else() 16 | list(APPEND APP_SRC_FILES 17 | fsw/src/hs_dispatch.c 18 | ) 19 | endif() 20 | 21 | # Create the app module 22 | add_cfe_app(hs ${APP_SRC_FILES}) 23 | 24 | # This permits direct access to public headers in the fsw/inc directory 25 | target_include_directories(hs PUBLIC fsw/inc) 26 | add_cfe_app_dependency(hs iodriver) 27 | 28 | set(APP_TABLE_FILES 29 | fsw/tables/hs_mat.c 30 | fsw/tables/hs_xct.c 31 | fsw/tables/hs_amt.c 32 | fsw/tables/hs_emt.c 33 | ) 34 | 35 | add_cfe_tables(hs ${APP_TABLE_FILES}) 36 | 37 | # If UT is enabled, then add the tests from the subdirectory 38 | # Note that this is an app, and therefore does not provide 39 | # stub functions, as other entities would not typically make 40 | # direct function calls into this application. 41 | if(ENABLE_UNIT_TESTS) 42 | add_subdirectory(unit-test) 43 | endif() 44 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing Guide 2 | 3 | Please see our [top-level contributing guide](https://github.com/nasa/cFS/blob/main/CONTRIBUTING.md) for more information on how to contribute to cFS components. 4 | 5 | ## Contributor License Agreement (CLA) 6 | 7 | Before we can accept your code contributions we need a signed Contributor License Agreement (CLA). See the [instructions](https://github.com/nasa/cFS/blob/main/CONTRIBUTING.md#contributor-license-agreement-cla) for more information. 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # core Flight System (cFS) Health and Safety Application (HS) 2 | 3 | ## Introduction 4 | 5 | The Health and Safety application (HS) is a core Flight System (cFS) 6 | application that is a plug in to the Core Flight Executive (cFE) component 7 | of the cFS. 8 | 9 | The HS application provides functionality for Application Monitoring, 10 | Event Monitoring, Hardware Watchdog Servicing, Execution Counter Reporting 11 | (optional), and CPU Aliveness Indication (via UART). 12 | 13 | The HS application is written in C and depends on the cFS Operating System 14 | Abstraction Layer (OSAL) and cFE components. 15 | There is additional HS application-specific configuration information 16 | contained in the application user's guide. 17 | 18 | User's guide information can be generated using Doxygen (from top mission directory): 19 | ``` 20 | make prep 21 | make -C build/docs/hs-usersguide hs-usersguide 22 | ``` 23 | 24 | ## Software Required 25 | 26 | cFS Framework (cFE, OSAL, PSP) 27 | 28 | An integrated bundle including the cFE, OSAL, and PSP can 29 | be obtained at https://github.com/nasa/cfs 30 | 31 | ## About cFS 32 | 33 | The cFS is a platform and project independent reusable software framework and 34 | set of reusable applications developed by NASA Goddard Space Flight Center. 35 | This framework is used as the basis for the flight software for satellite data 36 | systems and instruments, but can be used on other embedded systems. More 37 | information on the cFS can be found at http://cfs.gsfc.nasa.gov 38 | -------------------------------------------------------------------------------- /arch_build.cmake: -------------------------------------------------------------------------------- 1 | ########################################################### 2 | # 3 | # HS App platform build setup 4 | # 5 | # This file is evaluated as part of the "prepare" stage 6 | # and can be used to set up prerequisites for the build, 7 | # such as generating header files 8 | # 9 | ########################################################### 10 | 11 | # The list of header files that control the HS configuration 12 | set(HS_PLATFORM_CONFIG_FILE_LIST 13 | hs_internal_cfg.h 14 | hs_msgids.h 15 | hs_platform_cfg.h 16 | ) 17 | 18 | # Create wrappers around the all the config header files 19 | # This makes them individually overridable by the missions, without modifying 20 | # the distribution default copies 21 | foreach(HS_CFGFILE ${HS_PLATFORM_CONFIG_FILE_LIST}) 22 | get_filename_component(CFGKEY "${HS_CFGFILE}" NAME_WE) 23 | if (DEFINED HS_CFGFILE_SRC_${CFGKEY}) 24 | set(DEFAULT_SOURCE GENERATED_FILE "${HS_CFGFILE_SRC_${CFGKEY}}") 25 | else() 26 | set(DEFAULT_SOURCE FALLBACK_FILE "${CMAKE_CURRENT_LIST_DIR}/config/default_${HS_CFGFILE}") 27 | endif() 28 | generate_config_includefile( 29 | FILE_NAME "${HS_CFGFILE}" 30 | ${DEFAULT_SOURCE} 31 | ) 32 | endforeach() 33 | -------------------------------------------------------------------------------- /config/default_hs_interface_cfg.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,920-1, and identified as “Core Flight 3 | * System (cFS) Health & Safety (HS) Application version 2.4.1” 4 | * 5 | * Copyright (c) 2021 United States Government as represented by the 6 | * Administrator of the National Aeronautics and Space Administration. 7 | * All Rights Reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 10 | * not use this file except in compliance with the License. You may obtain 11 | * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | ************************************************************************/ 19 | 20 | /** 21 | * @file 22 | * CFS Health and Safety (HS) Application Public Definitions 23 | * 24 | * This provides default values for configurable items that affect 25 | * the interface(s) of this module. This includes the CMD/TLM message 26 | * interface, tables definitions, and any other data products that 27 | * serve to exchange information with other entities. 28 | * 29 | * @note This file may be overridden/superceded by mission-provided definitions 30 | * either by overriding this header or by generating definitions from a command/data 31 | * dictionary tool. 32 | */ 33 | #ifndef HS_INTERFACE_CFG_H 34 | #define HS_INTERFACE_CFG_H 35 | 36 | /** 37 | * \defgroup cfshsplatformcfg CFS Health and Safety Platform Configuration 38 | * \{ 39 | */ 40 | 41 | /** 42 | * \brief Maximum reported execution counters 43 | * 44 | * \par Description: 45 | * Maximum number of execution counters that can be 46 | * specified to be reported in telemetry. 47 | * 48 | * \par Limits: 49 | * This parameter can't be larger than an unsigned 32 bit 50 | * integer (4294967295). 51 | * 52 | * This parameter will dictate the size of the Execution 53 | * Counter Table (XCT): 54 | * 55 | * XCT Size = HS_MAX_EXEC_CNT_SLOTS * sizeof(#HS_XCTEntry_t) 56 | * 57 | * The total size of this table should not exceed the 58 | * cFE size limit for a single buffered table set by the 59 | * #CFE_PLATFORM_TBL_MAX_SNGL_TABLE_SIZE parameter 60 | */ 61 | #define HS_MAX_EXEC_CNT_SLOTS 32 62 | 63 | /** 64 | * \brief Maximum message action types 65 | * 66 | * \par Description: 67 | * Maximum number of Message Action action types. 68 | * 69 | * \par Limits: 70 | * This parameter can't be larger than 4 less than an 71 | * unsigned 16 bit integer (65531). 72 | * 73 | * This parameter must be greater than 0. 74 | * 75 | * This parameter will influence the size of the Message 76 | * Action Table (MAT): 77 | * 78 | * MAT Size = HS_MAX_MSG_ACT_TYPES * (HS_MAX_MSG_ACT_SIZE + 4) 79 | * 80 | * The total size of this table should not exceed the 81 | * cFE size limit for a single buffered table set by the 82 | * #CFE_PLATFORM_TBL_MAX_SNGL_TABLE_SIZE parameter 83 | */ 84 | #define HS_MAX_MSG_ACT_TYPES 8 85 | 86 | /** 87 | * \brief Maximum message action size (in bytes) 88 | * 89 | * \par Description: 90 | * Size in bytes of maximum length of software bus message that 91 | * can be sent using a Message Action action type. 92 | * 93 | * \par Limits: 94 | * This parameter can't be larger than #CFE_MISSION_SB_MAX_SB_MSG_SIZE 95 | * 96 | * This parameter can't be smaller than a packet header 97 | * 98 | * This parameter will influence the size of the Message 99 | * Action Table (MAT): 100 | * 101 | * MAT Size = HS_MAX_MSG_ACT_TYPES * (HS_MAX_MSG_ACT_SIZE + 4) 102 | * 103 | * The total size of this table should not exceed the 104 | * cFE size limit for a single buffered table set by the 105 | * #CFE_PLATFORM_TBL_MAX_SNGL_TABLE_SIZE parameter 106 | */ 107 | #define HS_MAX_MSG_ACT_SIZE 16 108 | 109 | /** 110 | * \brief Maximum number of monitored applications 111 | * 112 | * \par Description: 113 | * Maximum number of applications that can be 114 | * monitored to assure check-ins 115 | * 116 | * \par Limits: 117 | * This parameter can't be larger than an unsigned 32 bit 118 | * integer (4294967295). 119 | * 120 | * This parameter must be greater than 0. 121 | * 122 | * This parameter will dictate the size of the Application 123 | * Monitor Table (AMT): 124 | * 125 | * AMT Size = HS_MAX_MONITORED_APPS * sizeof(#HS_AMTEntry_t) 126 | * 127 | * The total size of this table should not exceed the 128 | * cFE size limit for a single buffered table set by the 129 | * #CFE_PLATFORM_TBL_MAX_SNGL_TABLE_SIZE parameter 130 | */ 131 | #define HS_MAX_MONITORED_APPS 32 132 | 133 | /** 134 | * \brief Maximum number of monitored events 135 | * 136 | * \par Description: 137 | * Maximum number of events that can be 138 | * monitored 139 | * 140 | * \par Limits: 141 | * This parameter can't be larger than an unsigned 32 bit 142 | * integer (4294967295). 143 | * 144 | * This parameter must be greater than 0. 145 | * 146 | * This parameter will dictate the size of the Event 147 | * Monitor Table (EMT): 148 | * 149 | * EMT Size = HS_MAX_MONITORED_EVENTS * sizeof(#HS_EMTEntry_t) 150 | * 151 | * The total size of this table should not exceed the 152 | * cFE size limit for a single buffered table set by the 153 | * #CFE_PLATFORM_TBL_MAX_SNGL_TABLE_SIZE parameter 154 | */ 155 | #define HS_MAX_MONITORED_EVENTS 16 156 | 157 | /**\}*/ 158 | 159 | #endif 160 | -------------------------------------------------------------------------------- /config/default_hs_internal_cfg.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,920-1, and identified as “Core Flight 3 | * System (cFS) Health & Safety (HS) Application version 2.4.1” 4 | * 5 | * Copyright (c) 2021 United States Government as represented by the 6 | * Administrator of the National Aeronautics and Space Administration. 7 | * All Rights Reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 10 | * not use this file except in compliance with the License. You may obtain 11 | * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | ************************************************************************/ 19 | 20 | /** 21 | * @file 22 | * CFS Health and Safety (HS) Application Private Config Definitions 23 | * 24 | * This provides default values for configurable items that are internal 25 | * to this module and do NOT affect the interface(s) of this module. Changes 26 | * to items in this file only affect the local module and will be transparent 27 | * to external entities that are using the public interface(s). 28 | * 29 | * @note This file may be overridden/superceded by mission-provided definitions 30 | * either by overriding this header or by generating definitions from a command/data 31 | * dictionary tool. 32 | */ 33 | #ifndef HS_INTERNAL_CFG_H 34 | #define HS_INTERNAL_CFG_H 35 | 36 | /** 37 | * \defgroup cfshsplatformcfg CFS Health and Safety Platform Configuration 38 | * \{ 39 | */ 40 | 41 | /** 42 | * \brief Watchdog Timeout Value 43 | * 44 | * \par Description: 45 | * Number of milliseconds before a watchdog timeout occurs. 46 | * 47 | * \par Limits: 48 | * This parameter can't be larger than an unsigned 32 bit 49 | * integer (4294967295). 50 | * 51 | * This parameter must be greater than 0. 52 | */ 53 | #define HS_WATCHDOG_TIMEOUT_VALUE 10000 54 | 55 | /** 56 | * \brief Time to wait after performing processing (in milliseconds) 57 | * 58 | * \par Description: 59 | * Dictates the length of a task delay performed prior to checking 60 | * the Software Bus for a Wakeup Message. This ensures that HS will 61 | * run no more often than a certain rate. If this parameter is set to 0, 62 | * no task delay will be performed. Time is in milliseconds. 63 | * 64 | * \par Limits 65 | * This parameter can't be larger than an unsigned 32 bit 66 | * integer (4294967295). 67 | */ 68 | #define HS_POST_PROCESSING_DELAY 0 69 | 70 | /** 71 | * \brief Wakeup Message Software Bus Timeout 72 | * 73 | * \par Description: 74 | * This parameter is passed into #CFE_SB_ReceiveBuffer as the timeout value. 75 | * It can specify #CFE_SB_POLL, #CFE_SB_PEND_FOREVER, or a timeout 76 | * value in milliseconds. 77 | * 78 | * \par Limits 79 | * This Parameter must be #CFE_SB_POLL, #CFE_SB_PEND_FOREVER, 80 | * or greater than 0 and less than 2^31 - 1 81 | * 82 | * As a timeout, this parameter should be less than 83 | * (#HS_WATCHDOG_TIMEOUT_VALUE * 1000) - HS runtime in ms 84 | * otherwise HS may not be able to service the watchdog in time. 85 | */ 86 | #define HS_WAKEUP_TIMEOUT 1200 87 | 88 | /** 89 | * \brief CPU aliveness output string 90 | * 91 | * \par Description: 92 | * String that is output to via #OS_printf periodically if aliveness 93 | * is enabled. 94 | * 95 | * \par Limits: 96 | * None. 97 | * 98 | */ 99 | #define HS_CPU_ALIVE_STRING "." 100 | 101 | /** 102 | * \brief CPU aliveness output period 103 | * 104 | * \par Description: 105 | * Rate in number of HS cycles at which the HS_CPU_ALIVE_STRING 106 | * is output via the UART. 107 | * 108 | * \par Limits: 109 | * This parameter can't be larger than an unsigned 32 bit 110 | * integer (4294967295). 111 | * 112 | */ 113 | #define HS_CPU_ALIVE_PERIOD 5 114 | 115 | /** 116 | * \brief Max Number of Processor Resets that may be performed by HS 117 | * 118 | * \par Description: 119 | * Maximum number of times that the HS App will attempt a processor 120 | * reset as the result of either an Application Monitor or 121 | * Event Monitor Failure 122 | * 123 | * \par Limits: 124 | * This parameter can't be larger than an unsigned 16 bit 125 | * integer (65535). 126 | * 127 | * Although not enforced, if this parameter is greater than or 128 | * equal to #CFE_PLATFORM_ES_MAX_PROCESSOR_RESETS then a POWER-ON reset 129 | * will occur before the max count is reached, resetting the remaining 130 | * actions to the value set here. 131 | * 132 | */ 133 | #define HS_MAX_RESTART_ACTIONS 3 134 | 135 | /** 136 | * \brief Software bus command pipe depth 137 | * 138 | * \par Description: 139 | * Depth of the software bus pipe HS uses for commands and HK requests. 140 | * Used during initialization in the call to #CFE_SB_CreatePipe 141 | * 142 | * \par Limits: 143 | * This parameter must be greater than 0. 144 | */ 145 | #define HS_CMD_PIPE_DEPTH 12 146 | 147 | /** 148 | * \brief Software bus event pipe depth 149 | * 150 | * \par Description: 151 | * Depth of the software bus pipe HS uses for event monitoring. 152 | * This should be set to supply sufficient room for the expected event 153 | * message load per second. Used during initialization in the call to 154 | * #CFE_SB_CreatePipe 155 | * 156 | * \par Limits: 157 | * This parameter must be greater than 0. 158 | */ 159 | #define HS_EVENT_PIPE_DEPTH 32 160 | 161 | /** 162 | * \brief Software bus wakeup pipe depth 163 | * 164 | * \par Description: 165 | * Depth of the software bus pipe HS uses for wakeup messages. 166 | * Used during initialization in the call to #CFE_SB_CreatePipe 167 | * 168 | * \par Limits: 169 | * This parameter must be greater than 0. 170 | */ 171 | #define HS_WAKEUP_PIPE_DEPTH 1 172 | 173 | /** 174 | * \brief Time to wait before a processor reset (in milliseconds) 175 | * 176 | * \par Description: 177 | * Dictates the length of the task delay (milliseconds) performed prior 178 | * to calling #CFE_ES_ResetCFE to allow for any event message to go out. 179 | * 180 | * \par Limits 181 | * This parameter can't be larger than an unsigned 32 bit 182 | * integer (4294967295). 183 | */ 184 | #define HS_RESET_TASK_DELAY 50 185 | 186 | /** 187 | * \brief Time to wait for all apps to be started (in milliseconds) 188 | * 189 | * \par Description: 190 | * Dictates the timeout for the #CFE_ES_WaitForStartupSync call that 191 | * HS uses to wait for all of the Applications specified in the startup 192 | * script to finish initialization. HS will wait this amount of time 193 | * before assuming all startup script applications have been started and 194 | * will then begin nominal processing. 195 | * 196 | * \par Limits 197 | * This parameter can't be larger than an unsigned 32 bit 198 | * integer (4294967295). 199 | * 200 | * This should be greater than or equal to the Startup Sync timeout for 201 | * any application in the Application Monitor Table. 202 | */ 203 | #define HS_STARTUP_SYNC_TIMEOUT 65000 204 | 205 | /** 206 | * \brief Default State of the Application Monitor 207 | * 208 | * \par Description: 209 | * State the Application Monitor is set to when the HS 210 | * application starts. 211 | * 212 | * \par Limits: 213 | * Must be HS_STATE_ENABLED or HS_STATE_DISABLED 214 | */ 215 | #define HS_APPMON_DEFAULT_STATE HS_STATE_ENABLED 216 | 217 | /** 218 | * \brief Default State of the Event Monitor 219 | * 220 | * \par Description: 221 | * State the Event Monitor is set to when the HS 222 | * application starts. 223 | * 224 | * \par Limits: 225 | * Must be HS_STATE_ENABLED or HS_STATE_DISABLED 226 | */ 227 | #define HS_EVENTMON_DEFAULT_STATE HS_STATE_ENABLED 228 | 229 | /** 230 | * \brief Default State of the Aliveness Indicator 231 | * 232 | * \par Description: 233 | * State the Aliveness Indicator is set to when the HS application 234 | * starts. 235 | * 236 | * \par Limits: 237 | * Must be HS_STATE_ENABLED or HS_STATE_DISABLED 238 | */ 239 | #define HS_ALIVENESS_DEFAULT_STATE HS_STATE_ENABLED 240 | 241 | /** 242 | * \brief Default State of the CPU Hogging Indicator 243 | * 244 | * \par Description: 245 | * State the CPU Hogging Event Message is set to when the HS application 246 | * starts. 247 | * 248 | * \par Limits: 249 | * Must be HS_STATE_ENABLED or HS_STATE_DISABLED 250 | */ 251 | #define HS_CPUHOG_DEFAULT_STATE HS_STATE_ENABLED 252 | 253 | /** 254 | * \brief Application Monitor Table (AMT) filename 255 | * 256 | * \par Description: 257 | * Default file to load the Applications Monitor Table from 258 | * during a power-on reset sequence 259 | * 260 | * \par Limits: 261 | * This string shouldn't be longer than #OS_MAX_PATH_LEN for the 262 | * target platform in question 263 | */ 264 | #define HS_AMT_FILENAME "/cf/hs_amt.tbl" 265 | 266 | /** 267 | * \brief Event Monitor Table (EMT) filename 268 | * 269 | * \par Description: 270 | * Default file to load the Event Monitor Table from 271 | * during a power-on reset sequence 272 | * 273 | * \par Limits: 274 | * This string shouldn't be longer than #OS_MAX_PATH_LEN for the 275 | * target platform in question 276 | */ 277 | #define HS_EMT_FILENAME "/cf/hs_emt.tbl" 278 | 279 | /** 280 | * \brief Execution Counter Table (XCT) filename 281 | * 282 | * \par Description: 283 | * Default file to load the Execution Counters Table from 284 | * during a power-on reset sequence 285 | * 286 | * \par Limits: 287 | * This string shouldn't be longer than #OS_MAX_PATH_LEN for the 288 | * target platform in question 289 | */ 290 | #define HS_XCT_FILENAME "/cf/hs_xct.tbl" 291 | 292 | /** 293 | * \brief Message Actions Table (MAT) filename 294 | * 295 | * \par Description: 296 | * Default file to load the Message Actions Table from 297 | * during a power-on reset sequence 298 | * 299 | * \par Limits: 300 | * This string shouldn't be longer than #OS_MAX_PATH_LEN for the 301 | * target platform in question 302 | */ 303 | #define HS_MAT_FILENAME "/cf/hs_mat.tbl" 304 | 305 | /** 306 | * \brief System monitor PSP 307 | * 308 | * \par Description: 309 | * Variable to use for system monitor. If 310 | * the module name is not found, CPU monitoring 311 | * will be disabled. 312 | * 313 | * \par Limits: 314 | * Must be a name of a module that is implemented by the PSP 315 | */ 316 | #define HS_SYSTEM_MONITOR_DEVICE "linux_sysmon" 317 | 318 | /** 319 | * \brief CPU Utilization subsystem name 320 | * 321 | * \par Description: 322 | * Subsystem name to use for system CPU utilization monitor 323 | * Reverts to 0 if the name is not found. 324 | * 325 | */ 326 | #define HS_SYSTEM_MONITOR_SUBSYSTEM_NAME "aggregate" 327 | 328 | /** 329 | * \brief CPU Utilization subchannel name 330 | * 331 | * \par Description: 332 | * Subchannel name to use for system CPU utilization monitor 333 | * Reverts to 0 if the name is not found. 334 | * 335 | */ 336 | #define HS_SYSTEM_MONITOR_SUBCHANNEL_NAME "cpu-load" 337 | 338 | /** 339 | * \brief CPU Utilization Cycles per Interval 340 | * 341 | * \par Description: 342 | * Number of HS Cycles it takes to complete a CPU Utilization Interval. 343 | * HS will monitor the utilization after this number of HS wakeup cycles. 344 | * 345 | * \par Limits: 346 | * This parameter can't be larger than an unsigned 32 bit 347 | * integer (4294967295). 348 | * 349 | * This interval should not be less than the collection period of the 350 | * underlying PSP module, otherwise the same data will be reported. 351 | * 352 | */ 353 | #define HS_CPU_UTILIZATION_CYCLES_PER_INTERVAL 30 354 | 355 | /** 356 | * \brief CPU Utilization Maximum Range 357 | * 358 | * \par Description: 359 | * Number of steps equal to full utilization. This allows for higher 360 | * resolution than percentages, and non decimal based values. 361 | * 362 | * \par Limits: 363 | * This parameter can't be larger than an unsigned 32 bit 364 | * integer (4294967295). 365 | */ 366 | #define HS_CPU_UTILIZATION_MAX 10000 367 | 368 | /** 369 | * \brief CPU Utilization Hogging Utils Per Interval 370 | * 371 | * \par Description: 372 | * Number of Utils (counts) equal to utilization which is considered hogging 373 | * during one interval. A greater number of counts is also considered hogging. 374 | * 375 | * \par Limits: 376 | * This parameter can't be larger than #HS_CPU_UTILIZATION_MAX. 377 | */ 378 | #define HS_UTIL_PER_INTERVAL_HOGGING 7500 379 | 380 | /** 381 | * \brief CPU Utilization Hogging Timeout 382 | * 383 | * \par Description: 384 | * Number of intervals for which the hogging limit must be exceeded before hogging 385 | * is reported. 386 | * 387 | * \par Limits: 388 | * This parameter can't be larger than an unsigned 32 bit 389 | * integer (4294967295). 390 | */ 391 | #define HS_UTIL_HOGGING_TIMEOUT 5 392 | 393 | /** 394 | * \brief CPU Peak Utilization Number of Intervals 395 | * 396 | * \par Description: 397 | * Number of intervals over which the peak utilization is determined. 398 | * 399 | * \par Limits: 400 | * This parameter can't be larger than an unsigned 32 bit 401 | * integer (4294967295). 402 | * 403 | * This parameter controls the size of the array which stores 404 | * previously measured utilization values. 405 | */ 406 | #define HS_UTIL_PEAK_NUM_INTERVAL 64 407 | 408 | /** 409 | * \brief CPU Average Utilization Number of Intervals 410 | * 411 | * \par Description: 412 | * Number of intervals over which the average utilization is computed. 413 | * 414 | * \par Limits: 415 | * This parameter can't be larger than #HS_UTIL_PEAK_NUM_INTERVAL . 416 | */ 417 | #define HS_UTIL_AVERAGE_NUM_INTERVAL 4 418 | 419 | /** 420 | * \brief Mission specific version number for HS application 421 | * 422 | * \par Description: 423 | * An application version number consists of four parts: 424 | * major version number, minor version number, revision 425 | * number and mission specific revision number. The mission 426 | * specific revision number is defined here and the other 427 | * parts are defined in "hs_version.h". 428 | * 429 | * \par Limits: 430 | * Must be defined as a numeric value that is greater than 431 | * or equal to zero. 432 | */ 433 | #define HS_MISSION_REV 0 434 | 435 | /**\}*/ 436 | 437 | #endif 438 | -------------------------------------------------------------------------------- /config/default_hs_mission_cfg.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,920-1, and identified as “Core Flight 3 | * System (cFS) Health & Safety (HS) Application version 2.4.1” 4 | * 5 | * Copyright (c) 2021 United States Government as represented by the 6 | * Administrator of the National Aeronautics and Space Administration. 7 | * All Rights Reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 10 | * not use this file except in compliance with the License. You may obtain 11 | * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | ************************************************************************/ 19 | 20 | /** 21 | * @file 22 | * 23 | * CFS Health and Safety (HS) Application Mission Configuration Header File 24 | * 25 | * This is a compatibility header for the "mission_cfg.h" file that has 26 | * traditionally provided public config definitions for each CFS app. 27 | * 28 | * @note This file may be overridden/superceded by mission-provided definitions 29 | * either by overriding this header or by generating definitions from a command/data 30 | * dictionary tool. 31 | */ 32 | #ifndef HS_MISSION_CFG_H 33 | #define HS_MISSION_CFG_H 34 | 35 | #include "hs_interface_cfg.h" 36 | 37 | /** 38 | * \brief Application Name 39 | * 40 | * \par Description: 41 | * This definition must match the name used at startup by the cFE 42 | * Executive Services when creating the HS application. Note that 43 | * application names are also an argument to certain cFE commands. 44 | * For example, the application name is needed to access tables 45 | * via cFE Table Services commands. 46 | * 47 | * \par Limits: 48 | * HS requires that this name be defined, but otherwise places 49 | * no limits on the definition. Refer to CFE Executive Services 50 | * for specific information on limits related to application names. 51 | */ 52 | #define HS_APP_NAME "HS" 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /config/default_hs_msg.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,920-1, and identified as “Core Flight 3 | * System (cFS) Health & Safety (HS) Application version 2.4.1” 4 | * 5 | * Copyright (c) 2021 United States Government as represented by the 6 | * Administrator of the National Aeronautics and Space Administration. 7 | * All Rights Reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 10 | * not use this file except in compliance with the License. You may obtain 11 | * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | ************************************************************************/ 19 | 20 | /** 21 | * @file 22 | * Specification for the CFS Health and Safety (HS) command and telemetry 23 | * message data types. 24 | * 25 | * This is a compatibility header for the "hs_msg.h" file that has 26 | * traditionally provided the message definitions for cFS apps. 27 | * 28 | * @note This file may be overridden/superceded by mission-provided definitions 29 | * either by overriding this header or by generating definitions from a command/data 30 | * dictionary tool. 31 | */ 32 | #ifndef HK_MSG_H 33 | #define HK_MSG_H 34 | 35 | #include "hs_interface_cfg.h" 36 | #include "hs_msgdefs.h" 37 | #include "hs_msgstruct.h" 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /config/default_hs_msgdefs.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,920-1, and identified as “Core Flight 3 | * System (cFS) Health & Safety (HS) Application version 2.4.1” 4 | * 5 | * Copyright (c) 2021 United States Government as represented by the 6 | * Administrator of the National Aeronautics and Space Administration. 7 | * All Rights Reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 10 | * not use this file except in compliance with the License. You may obtain 11 | * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | ************************************************************************/ 19 | 20 | /** 21 | * @file 22 | * Specification for the CFS Health and Safety (HS) command and telemetry 23 | * message constant definitions. 24 | * 25 | * For HS this is only the function/command code definitions 26 | */ 27 | #ifndef HS_MSGDEFS_H 28 | #define HS_MSGDEFS_H 29 | 30 | #include "hs_fcncodes.h" 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /config/default_hs_msgids.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,920-1, and identified as “Core Flight 3 | * System (cFS) Health & Safety (HS) Application version 2.4.1” 4 | * 5 | * Copyright (c) 2021 United States Government as represented by the 6 | * Administrator of the National Aeronautics and Space Administration. 7 | * All Rights Reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 10 | * not use this file except in compliance with the License. You may obtain 11 | * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | ************************************************************************/ 19 | 20 | /** 21 | * @file 22 | * CFS Health and Safety (HS) Application Message IDs 23 | */ 24 | #ifndef HS_MSGIDS_H 25 | #define HS_MSGIDS_H 26 | 27 | #include "cfe_core_api_base_msgids.h" 28 | #include "hs_topicids.h" 29 | 30 | /** 31 | * \defgroup cfshscmdmid CFS Health and Safety Command Message IDs 32 | * \{ 33 | */ 34 | 35 | /** \brief Msg ID for cmds to HS */ 36 | #define HS_CMD_MID CFE_PLATFORM_CMD_TOPICID_TO_MIDV(CFE_MISSION_HS_CMD_TOPICID) 37 | 38 | /** \brief Msg ID to request HS housekeeping */ 39 | #define HS_SEND_HK_MID CFE_PLATFORM_CMD_TOPICID_TO_MIDV(CFE_MISSION_HS_SEND_HK_TOPICID) 40 | 41 | /** \brief Msg ID to wake up HS */ 42 | #define HS_WAKEUP_MID CFE_PLATFORM_CMD_TOPICID_TO_MIDV(CFE_MISSION_HS_WAKEUP_TOPICID) 43 | 44 | /**\}*/ 45 | 46 | /** 47 | * \defgroup cfshstlmmid CFS Health and Safety Telemetry Message IDs 48 | * \{ 49 | */ 50 | 51 | /** \brief HS Housekeeping Telemetry */ 52 | #define HS_HK_TLM_MID CFE_PLATFORM_TLM_TOPICID_TO_MIDV(CFE_MISSION_HS_HK_TLM_TOPICID) 53 | 54 | /**\}*/ 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /config/default_hs_msgstruct.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,920-1, and identified as “Core Flight 3 | * System (cFS) Health & Safety (HS) Application version 2.4.1” 4 | * 5 | * Copyright (c) 2021 United States Government as represented by the 6 | * Administrator of the National Aeronautics and Space Administration. 7 | * All Rights Reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 10 | * not use this file except in compliance with the License. You may obtain 11 | * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | ************************************************************************/ 19 | 20 | /** 21 | * @file 22 | * Specification for the CFS Health and Safety (HS) command and telemetry 23 | * message data types. 24 | * 25 | * @note 26 | * Constants and enumerated types related to these message structures 27 | * are defined in hs_msgdefs.h. 28 | */ 29 | #ifndef HS_MSGSTRUCT_H 30 | #define HS_MSGSTRUCT_H 31 | 32 | /************************************************************************ 33 | * Includes 34 | ************************************************************************/ 35 | #include "hs_msgdefs.h" 36 | #include "hs_mission_cfg.h" 37 | #include "cfe_msg_hdr.h" 38 | 39 | /************************************************************************ 40 | * Macro Definitions 41 | ************************************************************************/ 42 | 43 | #define HS_BITS_PER_APPMON_ENABLE 32 /**< \brief HS Bits per AppMon Enable entry */ 44 | 45 | /************************************************************************ 46 | * Type Definitions 47 | ************************************************************************/ 48 | 49 | /** 50 | * \defgroup cfshscmdstructs CFS Health and Safety Command Structures 51 | * \{ 52 | */ 53 | 54 | /** 55 | * \brief No Arguments Command 56 | * 57 | * For command details see #HS_NOOP_CC 58 | */ 59 | typedef struct 60 | { 61 | CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ 62 | } HS_NoopCmd_t; 63 | 64 | /** 65 | * \brief No Arguments Command 66 | * 67 | * For command details see #HS_RESET_CC 68 | */ 69 | typedef struct 70 | { 71 | CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ 72 | } HS_ResetCmd_t; 73 | 74 | /** 75 | * \brief No Arguments Command 76 | * 77 | * For command details see #HS_ENABLE_APP_MON_CC 78 | */ 79 | typedef struct 80 | { 81 | CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ 82 | } HS_EnableAppMonCmd_t; 83 | 84 | /** 85 | * \brief No Arguments Command 86 | * 87 | * For command details see #HS_DISABLE_APP_MON_CC 88 | */ 89 | typedef struct 90 | { 91 | CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ 92 | } HS_DisableAppMonCmd_t; 93 | 94 | /** 95 | * \brief No Arguments Command 96 | * 97 | * For command details see #HS_ENABLE_EVENT_MON_CC 98 | */ 99 | typedef struct 100 | { 101 | CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ 102 | } HS_EnableEventMonCmd_t; 103 | 104 | /** 105 | * \brief No Arguments Command 106 | * 107 | * For command details see #HS_DISABLE_EVENT_MON_CC 108 | */ 109 | typedef struct 110 | { 111 | CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ 112 | } HS_DisableEventMonCmd_t; 113 | 114 | /** 115 | * \brief No Arguments Command 116 | * 117 | * For command details see #HS_ENABLE_ALIVENESS_CC 118 | */ 119 | typedef struct 120 | { 121 | CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ 122 | } HS_EnableAlivenessCmd_t; 123 | 124 | /** 125 | * \brief No Arguments Command 126 | * 127 | * For command details see #HS_DISABLE_ALIVENESS_CC 128 | */ 129 | typedef struct 130 | { 131 | CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ 132 | } HS_DisableAlivenessCmd_t; 133 | 134 | /** 135 | * \brief No Arguments Command 136 | * 137 | * For command details see #HS_RESET_RESETS_PERFORMED_CC 138 | */ 139 | typedef struct 140 | { 141 | CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ 142 | } HS_ResetResetsPerformedCmd_t; 143 | 144 | /** 145 | * \brief No Arguments Command 146 | * 147 | * For command details see #HS_RESET_RESETS_PERFORMED_CC 148 | */ 149 | typedef struct 150 | { 151 | CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ 152 | } HS_EnableCpuHogCmd_t; 153 | 154 | /** 155 | * \brief No Arguments Command 156 | * 157 | * For command details see #HS_RESET_RESETS_PERFORMED_CC 158 | */ 159 | typedef struct 160 | { 161 | CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ 162 | } HS_DisableCpuHogCmd_t; 163 | 164 | /** 165 | * \brief Set Max Resets Payload 166 | */ 167 | typedef struct 168 | { 169 | uint16 MaxResets; /**< \brief Maximum Resets */ 170 | uint16 Padding; /**< \brief Structure padding */ 171 | } HS_SetMaxResets_Payload_t; 172 | 173 | /** 174 | * \brief Set Max Resets Command 175 | * 176 | * For command details see #HS_SET_MAX_RESETS_CC 177 | */ 178 | typedef struct 179 | { 180 | CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ 181 | 182 | HS_SetMaxResets_Payload_t Payload; 183 | } HS_SetMaxResetsCmd_t; 184 | 185 | /** 186 | * \brief No Arguments Command 187 | * 188 | * For command details see #HS_SEND_HK_MID 189 | */ 190 | typedef struct 191 | { 192 | CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ 193 | } HS_SendHkCmd_t; 194 | 195 | /**\}*/ 196 | 197 | /** 198 | * \defgroup cfshstlm CFS Health and Safety Telemetry 199 | * \{ 200 | */ 201 | 202 | /** 203 | * \brief Housekeeping Packet Payload 204 | */ 205 | typedef struct 206 | { 207 | uint8 CmdCount; /**< \brief HS Application Command Counter */ 208 | uint8 CmdErrCount; /**< \brief HS Application Command Error Counter */ 209 | uint8 CurrentAppMonState; /**< \brief Status of HS Application Monitor */ 210 | uint8 CurrentEventMonState; /**< \brief Status of HS Event Monitor */ 211 | uint8 CurrentAlivenessState; /**< \brief Status of HS Aliveness Indicator */ 212 | uint8 CurrentCPUHogState; /**< \brief Status of HS Hogging Indicator */ 213 | uint8 StatusFlags; /**< \brief Internal HS Error States */ 214 | uint8 SpareBytes; /**< \brief Alignment Spares */ 215 | uint16 ResetsPerformed; /**< \brief HS Performed Processor Reset Count */ 216 | uint16 MaxResets; /**< \brief HS Maximum Processor Reset Count */ 217 | uint32 EventsMonitoredCount; /**< \brief Total count of Event Messages Monitored */ 218 | uint32 InvalidEventMonCount; /**< \brief Total count of Invalid Event Monitors */ 219 | 220 | uint32 AppMonEnables[((HS_MAX_MONITORED_APPS - 1) / HS_BITS_PER_APPMON_ENABLE) + 1]; 221 | /**< \brief Enable states of App Monitor Entries */ 222 | 223 | uint32 MsgActExec; /**< \brief Number of Software Bus Message Actions Executed */ 224 | uint32 UtilCpuAvg; /**< \brief Current CPU Utilization Average */ 225 | uint32 UtilCpuPeak; /**< \brief Current CPU Utilization Peak */ 226 | 227 | uint32 ExeCounts[HS_MAX_EXEC_CNT_SLOTS]; /**< \brief Execution Counters */ 228 | } HS_HkTlm_Payload_t; 229 | 230 | /** 231 | * \brief Housekeeping Packet Structure 232 | */ 233 | typedef struct 234 | { 235 | CFE_MSG_TelemetryHeader_t TelemetryHeader; /**< \brief Telemetry Header */ 236 | 237 | HS_HkTlm_Payload_t Payload; 238 | } HS_HkPacket_t; 239 | 240 | /**\}*/ 241 | 242 | #endif 243 | -------------------------------------------------------------------------------- /config/default_hs_platform_cfg.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,920-1, and identified as “Core Flight 3 | * System (cFS) Health & Safety (HS) Application version 2.4.1” 4 | * 5 | * Copyright (c) 2021 United States Government as represented by the 6 | * Administrator of the National Aeronautics and Space Administration. 7 | * All Rights Reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 10 | * not use this file except in compliance with the License. You may obtain 11 | * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | ************************************************************************/ 19 | 20 | /** 21 | * @file 22 | * 23 | * CFS Health and Safety (HS) Application Platform Configuration Header File 24 | * 25 | * This is a compatibility header for the "platform_cfg.h" file that has 26 | * traditionally provided both public and private config definitions 27 | * for each CFS app. 28 | * 29 | * These definitions are now provided in two separate files, one for 30 | * the public/mission scope and one for internal scope. 31 | * 32 | * @note This file may be overridden/superceded by mission-provided definitions 33 | * either by overriding this header or by generating definitions from a command/data 34 | * dictionary tool. 35 | */ 36 | #ifndef HS_PLATFORM_CFG_H 37 | #define HS_PLATFORM_CFG_H 38 | 39 | #include "hs_mission_cfg.h" 40 | #include "hs_internal_cfg.h" 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /config/default_hs_tbl.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,920-1, and identified as “Core Flight 3 | * System (cFS) Health & Safety (HS) Application version 2.4.1” 4 | * 5 | * Copyright (c) 2021 United States Government as represented by the 6 | * Administrator of the National Aeronautics and Space Administration. 7 | * All Rights Reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 10 | * not use this file except in compliance with the License. You may obtain 11 | * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | ************************************************************************/ 19 | 20 | /** 21 | * @file 22 | * Specification for the CFS Health and Safety (HS) table structures 23 | * 24 | * @note 25 | * Constants and enumerated types related to these table structures 26 | * are defined in hs_tbldefs.h. 27 | */ 28 | #ifndef HS_TBL_H 29 | #define HS_TBL_H 30 | 31 | #include "hs_interface_cfg.h" 32 | #include "hs_tbldefs.h" 33 | #include "hs_tblstruct.h" 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /config/default_hs_tbldefs.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,920-1, and identified as “Core Flight 3 | * System (cFS) Health & Safety (HS) Application version 2.4.1” 4 | * 5 | * Copyright (c) 2021 United States Government as represented by the 6 | * Administrator of the National Aeronautics and Space Administration. 7 | * All Rights Reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 10 | * not use this file except in compliance with the License. You may obtain 11 | * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | ************************************************************************/ 19 | 20 | /** 21 | * @file 22 | * Specification for the CFS Health and Safety (HS) table related 23 | * constant definitions. 24 | * 25 | * @note 26 | * These Macro definitions have been put in this file (instead of 27 | * hs_tbl.h). DO NOT PUT ANY TYPEDEFS OR 28 | * STRUCTURE DEFINITIONS IN THIS FILE! 29 | * ADD THEM TO hs_tbl.h IF NEEDED! 30 | */ 31 | #ifndef HS_TBLDEFS_H 32 | #define HS_TBLDEFS_H 33 | 34 | /************************************************************************ 35 | * Macro Definitions 36 | ************************************************************************/ 37 | 38 | /* TODO: These flags may not really belong here, but this gets things working */ 39 | 40 | /** 41 | * \name HS Switch States (AppMon, EventMon, Aliveness) 42 | * \{ 43 | */ 44 | #define HS_STATE_DISABLED 0 45 | #define HS_STATE_ENABLED 1 46 | /**\}*/ 47 | 48 | /** 49 | * \name HS Invalid Execution Counter 50 | * \{ 51 | */ 52 | #define HS_INVALID_EXECOUNT 0xFFFFFFFF 53 | /**\}*/ 54 | 55 | /** 56 | * \name HS Internal Status Flags 57 | * \{ 58 | */ 59 | #define HS_LOADED_XCT 0x01 60 | #define HS_LOADED_MAT 0x02 61 | #define HS_LOADED_AMT 0x04 62 | #define HS_LOADED_EMT 0x08 63 | #define HS_CDS_IN_USE 0x10 64 | /**\}*/ 65 | 66 | /** 67 | * \name HS Table Name Strings 68 | * \{ 69 | */ 70 | #define HS_AMT_TABLENAME "AppMon_Tbl" /**< \brief AppMon Table Name */ 71 | #define HS_EMT_TABLENAME "EventMon_Tbl" /**< \brief EventMon Table Name */ 72 | #define HS_XCT_TABLENAME "ExeCount_Tbl" /**< \brief ExeCount Table Name */ 73 | #define HS_MAT_TABLENAME "MsgActs_Tbl" /**< \brief MsgAction Table Name */ 74 | /**\}*/ 75 | 76 | /** 77 | * \name Application Monitor Table (AMT) Action Types 78 | * \{ 79 | */ 80 | #define HS_AMT_ACT_NOACT 0 /**< \brief No action is taken */ 81 | #define HS_AMT_ACT_PROC_RESET 1 /**< \brief Generates Processor Reset on failure */ 82 | #define HS_AMT_ACT_APP_RESTART 2 /**< \brief Attempts to restart application on failure */ 83 | #define HS_AMT_ACT_EVENT 3 /**< \brief Generates event message on failure */ 84 | #define HS_AMT_ACT_LAST_NONMSG 3 /**< \brief Index for finding end of non-message actions */ 85 | /**\}*/ 86 | 87 | /** 88 | * \name Event Monitor Table (EMT) Action Types 89 | * \{ 90 | */ 91 | #define HS_EMT_ACT_NOACT 0 /**< \brief No action is taken */ 92 | #define HS_EMT_ACT_PROC_RESET 1 /**< \brief Generates Processor Reset on detection */ 93 | #define HS_EMT_ACT_APP_RESTART 2 /**< \brief Attempts to restart application on detection */ 94 | #define HS_EMT_ACT_APP_DELETE 3 /**< \brief Deletes application on detection */ 95 | #define HS_EMT_ACT_LAST_NONMSG 3 /**< \brief Index for finding end of non-message actions */ 96 | /**\}*/ 97 | 98 | /** 99 | * \name Execution Counters Table (XCT) Resource Types 100 | * \{ 101 | */ 102 | #define HS_XCT_TYPE_NOTYPE 0 /**< \brief No type */ 103 | #define HS_XCT_TYPE_APP_MAIN 1 /**< \brief Counter for Application Main task */ 104 | #define HS_XCT_TYPE_APP_CHILD 2 /**< \brief Counter for Application Child task */ 105 | #define HS_XCT_TYPE_DEVICE 3 /**< \brief Counter for Device Driver */ 106 | #define HS_XCT_TYPE_ISR 4 /**< \brief Counter for Interrupt Service Routine */ 107 | /**\}*/ 108 | 109 | /** 110 | * \name Message Actions Table (MAT) Enable State 111 | * \{ 112 | */ 113 | #define HS_MAT_STATE_DISABLED 0 /**< \brief Message Actions are Disabled */ 114 | #define HS_MAT_STATE_ENABLED 1 /**< \brief Message Actions are Enabled */ 115 | #define HS_MAT_STATE_NOEVENT 2 /**< \brief Message Actions are Enabled but produce no events */ 116 | /**\}*/ 117 | 118 | /** 119 | * \name Application Monitor Table (AMT) Validation Error Enumerated Types 120 | * \{ 121 | */ 122 | #define HS_AMTVAL_NO_ERR 0 /**< \brief No error */ 123 | #define HS_AMTVAL_ERR_ACT -1 /**< \brief Invalid ActionType specified */ 124 | #define HS_AMTVAL_ERR_NUL -2 /**< \brief Null Safety Buffer not Null */ 125 | /**\}*/ 126 | 127 | /** 128 | * \name Event Monitor Table (EMT) Validation Error Enumerated Types 129 | * \{ 130 | */ 131 | #define HS_EMTVAL_NO_ERR 0 /**< \brief No error */ 132 | #define HS_EMTVAL_ERR_ACT -1 /**< \brief Invalid ActionType specified */ 133 | #define HS_EMTVAL_ERR_NUL -2 /**< \brief Null Safety Buffer not Null */ 134 | /**\}*/ 135 | 136 | /** 137 | * \name Event Counter Table (XCT) Validation Error Enumerated Types 138 | * \{ 139 | */ 140 | #define HS_XCTVAL_NO_ERR 0 /**< \brief No error */ 141 | #define HS_XCTVAL_ERR_TYPE -1 /**< \brief Invalid Counter Type specified */ 142 | #define HS_XCTVAL_ERR_NUL -2 /**< \brief Null Safety Buffer not Null */ 143 | /**\}*/ 144 | 145 | /** 146 | * \name Message Actions Table (MAT) Validation Error Enumerated Types 147 | * \{ 148 | */ 149 | #define HS_MATVAL_NO_ERR 0 /**< \brief No error */ 150 | #define HS_MATVAL_ERR_ID -1 /**< \brief Invalid Message ID specified */ 151 | #define HS_MATVAL_ERR_LEN -2 /**< \brief Invalid Length specified */ 152 | #define HS_MATVAL_ERR_ENA -3 /**< \brief Invalid Enable State specified */ 153 | /**\}*/ 154 | 155 | #endif 156 | -------------------------------------------------------------------------------- /config/default_hs_tblstruct.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,920-1, and identified as “Core Flight 3 | * System (cFS) Health & Safety (HS) Application version 2.4.1” 4 | * 5 | * Copyright (c) 2021 United States Government as represented by the 6 | * Administrator of the National Aeronautics and Space Administration. 7 | * All Rights Reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 10 | * not use this file except in compliance with the License. You may obtain 11 | * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | ************************************************************************/ 19 | 20 | /** 21 | * @file 22 | * Specification for the CFS Health and Safety (HS) table structures 23 | * 24 | * Provides default definitions for HK table structures 25 | * 26 | * @note This file may be overridden/superceded by mission-provided definitions 27 | * either by overriding this header or by generating definitions from a command/data 28 | * dictionary tool. 29 | */ 30 | #ifndef HS_TBLSTRUCT_H 31 | #define HS_TBLSTRUCT_H 32 | 33 | /************************************************************************* 34 | * Includes 35 | *************************************************************************/ 36 | #include "hs_tbldefs.h" 37 | #include "hs_mission_cfg.h" 38 | #include "cfe_mission_cfg.h" 39 | #include "cfe_sb_api_typedefs.h" 40 | 41 | /************************************************************************ 42 | * Macro Definitions 43 | ************************************************************************/ 44 | 45 | /************************************************************************* 46 | * Type Definitions 47 | *************************************************************************/ 48 | 49 | /* 50 | ** In the following definitions, NullTerm may have a differing size for alignment purposes 51 | ** specifically it must be 32 bits in the XCT to align Resource Type, while it can be 16 bits 52 | ** in the other two. 53 | */ 54 | 55 | /** 56 | * \brief Application Monitor Table (AMT) Entry 57 | */ 58 | typedef struct 59 | { 60 | char AppName[CFE_MISSION_MAX_API_LEN]; /**< \brief Name of application to be monitored */ 61 | uint16 NullTerm; /**< \brief Buffer of nulls to terminate string */ 62 | uint16 CycleCount; /**< \brief Number of cycles before application is missing */ 63 | uint16 ActionType; /**< \brief Action to take if application is missing */ 64 | } HS_AMTEntry_t; 65 | 66 | /** 67 | * \brief Event Monitor Table (EMT) Entry 68 | */ 69 | typedef struct 70 | { 71 | char AppName[CFE_MISSION_MAX_API_LEN]; /**< \brief Name of application generating event */ 72 | uint16 NullTerm; /**< \brief Buffer of nulls to terminate string */ 73 | uint16 EventID; /**< \brief Event number of monitored event */ 74 | uint16 ActionType; /**< \brief Action to take if event is received */ 75 | } HS_EMTEntry_t; 76 | 77 | /** 78 | * \brief Execution Counters Table (XCT) Entry 79 | */ 80 | typedef struct 81 | { 82 | char ResourceName[CFE_MISSION_MAX_API_LEN]; /**< \brief Name of resource being monitored */ 83 | uint32 NullTerm; /**< \brief Buffer of nulls to terminate string */ 84 | uint32 ResourceType; /**< \brief Type of execution counter */ 85 | } HS_XCTEntry_t; 86 | 87 | /** 88 | * \brief Message Action Table buffer 89 | */ 90 | typedef union 91 | { 92 | uint8 Message[HS_MAX_MSG_ACT_SIZE]; /**< \brief Raw message array for sizing */ 93 | CFE_SB_Buffer_t Buffer; /**< \brief Message Buffer for alignment */ 94 | } HS_MATMsgBuf_t; 95 | 96 | /** 97 | * \brief Message Actions Table (MAT) Entry 98 | */ 99 | typedef struct 100 | { 101 | uint16 EnableState; /**< \brief If entry contains message */ 102 | uint16 Cooldown; /**< \brief Minimum rate at which message can be sent */ 103 | HS_MATMsgBuf_t MsgBuf; /**< \brief Message to be sent */ 104 | } HS_MATEntry_t; 105 | 106 | #endif 107 | -------------------------------------------------------------------------------- /config/default_hs_topicids.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,920-1, and identified as “Core Flight 3 | * System (cFS) Health & Safety (HS) Application version 2.4.1” 4 | * 5 | * Copyright (c) 2021 United States Government as represented by the 6 | * Administrator of the National Aeronautics and Space Administration. 7 | * All Rights Reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 10 | * not use this file except in compliance with the License. You may obtain 11 | * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | ************************************************************************/ 19 | 20 | /** 21 | * @file 22 | * CFS Health and Safety (HS) Application Topic IDs 23 | */ 24 | #ifndef HS_TOPICIDS_H 25 | #define HS_TOPICIDS_H 26 | 27 | #define CFE_MISSION_HS_CMD_TOPICID 0xAE /**< \brief Msg ID for cmds to HS */ 28 | #define CFE_MISSION_HS_SEND_HK_TOPICID 0xAF /**< \brief Msg ID to request HS housekeeping */ 29 | #define CFE_MISSION_HS_WAKEUP_TOPICID 0xB0 /**< \brief Msg ID to wake up HS */ 30 | #define CFE_MISSION_HS_HK_TLM_TOPICID 0xAD /**< \brief HS Housekeeping Telemetry */ 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /docs/dox_src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ######################################################## 2 | # 3 | # CMake Recipe to build doxygen documentation 4 | # 5 | ######################################################## 6 | 7 | # This CMake script currently defines a top-level target 8 | # to build the stand alone documentation. This may be invoked either 9 | # from the main CMakeLists.txt as a subdirectory (useful in the 10 | # case of a self-contained/standalone build) or by a separate script 11 | # (useful if integrating into a larger project with a separate doc build) 12 | 13 | cmake_minimum_required(VERSION 3.5) 14 | project(HS_DOCS NONE) 15 | 16 | # generate the configuration files 17 | configure_file( 18 | ${CMAKE_CURRENT_SOURCE_DIR}/hs-common.doxyfile.in 19 | ${CMAKE_BINARY_DIR}/docs/hs-common.doxyfile 20 | @ONLY 21 | ) 22 | 23 | configure_file( 24 | ${CMAKE_CURRENT_SOURCE_DIR}/hs-usersguide.doxyfile.in 25 | ${CMAKE_CURRENT_BINARY_DIR}/hs-usersguide.doxyfile 26 | @ONLY 27 | ) 28 | 29 | add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/html/index.html" "${CMAKE_CURRENT_BINARY_DIR}/ALWAYSBUILD" 30 | COMMAND doxygen ${CMAKE_CURRENT_BINARY_DIR}/hs-usersguide.doxyfile 31 | WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" 32 | ) 33 | 34 | add_custom_target(hs-usersguide 35 | COMMAND echo "HS UsersGuide: file://${CMAKE_CURRENT_BINARY_DIR}/html/index.html" 36 | DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/ALWAYSBUILD" 37 | ) 38 | -------------------------------------------------------------------------------- /docs/dox_src/hs-common.doxyfile.in: -------------------------------------------------------------------------------- 1 | #--------------------------------------------------------------------------- 2 | # Common doxygen configuration items 3 | #--------------------------------------------------------------------------- 4 | 5 | # Include front material followed by everything in fsw 6 | INPUT += @hs_MISSION_DIR@/docs/dox_src/cfs_hs.dox 7 | INPUT += @hs_MISSION_DIR@/fsw 8 | INPUT += @hs_MISSION_DIR@/config 9 | 10 | IMAGE_PATH += @hs_MISSION_DIR@/docs/dox_src 11 | -------------------------------------------------------------------------------- /docs/dox_src/hs-usersguide.doxyfile.in: -------------------------------------------------------------------------------- 1 | #--------------------------------------------------------------------------- 2 | # Stand-alone users guide doxyfile 3 | #--------------------------------------------------------------------------- 4 | 5 | # Allow overrides 6 | @INCLUDE_PATH = @MISSION_SOURCE_DIR@ 7 | 8 | # Common setup 9 | @INCLUDE = @MISSION_BINARY_DIR@/docs/hs-common.doxyfile 10 | 11 | # OSAL and cfe to resolve references and provide default settings 12 | @INCLUDE = @MISSION_BINARY_DIR@/docs/cfe-common.doxyfile 13 | @INCLUDE = @MISSION_BINARY_DIR@/docs/osal-common.doxyfile 14 | 15 | # Use sample definitions for generic users guide 16 | INPUT += @MISSION_SOURCE_DIR@/cfe/cmake/sample_defs 17 | 18 | PROJECT_NAME = "HS User's Guide" 19 | WARN_LOGFILE = hs-usersguide-warnings.log 20 | -------------------------------------------------------------------------------- /docs/hs-detaildesign.doxyfile.in: -------------------------------------------------------------------------------- 1 | #--------------------------------------------------------------------------- 2 | # Doxygen Configuration options for mission detailed documentation 3 | #--------------------------------------------------------------------------- 4 | 5 | # Common files 6 | @INCLUDE = @MISSION_BINARY_DIR@/docs/hs-common.doxyfile 7 | -------------------------------------------------------------------------------- /docs/users_guide_historical/CFS HS User Guide Doc No 582-2013-002.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nasa/HS/0f823e648458c532c50b5599da36c0a43892874d/docs/users_guide_historical/CFS HS User Guide Doc No 582-2013-002.docx -------------------------------------------------------------------------------- /docs/users_guide_historical/CFS HS User Guide Doc No 582-2013-002.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nasa/HS/0f823e648458c532c50b5599da36c0a43892874d/docs/users_guide_historical/CFS HS User Guide Doc No 582-2013-002.pdf -------------------------------------------------------------------------------- /eds/HS.xml: -------------------------------------------------------------------------------- 1 | 2 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | -------------------------------------------------------------------------------- /fsw/inc/hs_perfids.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,920-1, and identified as “Core Flight 3 | * System (cFS) Health & Safety (HS) Application version 2.4.1” 4 | * 5 | * Copyright (c) 2021 United States Government as represented by the 6 | * Administrator of the National Aeronautics and Space Administration. 7 | * All Rights Reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 10 | * not use this file except in compliance with the License. You may obtain 11 | * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | ************************************************************************/ 19 | 20 | /** 21 | * @file 22 | * CFS Health and Safety (HS) Application Performance IDs 23 | */ 24 | #ifndef HS_PERFIDS_H 25 | #define HS_PERFIDS_H 26 | 27 | /** 28 | * \defgroup cfshsmissioncfg CFS Health and Safety Mission Configuration 29 | * \{ 30 | */ 31 | 32 | #define HS_APPMAIN_PERF_ID 40 /**< \brief Main task performance ID */ 33 | 34 | /**\}*/ 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /fsw/src/hs_app.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,920-1, and identified as “Core Flight 3 | * System (cFS) Health & Safety (HS) Application version 2.4.1” 4 | * 5 | * Copyright (c) 2021 United States Government as represented by the 6 | * Administrator of the National Aeronautics and Space Administration. 7 | * All Rights Reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 10 | * not use this file except in compliance with the License. You may obtain 11 | * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | ************************************************************************/ 19 | 20 | /** 21 | * @file 22 | * Unit specification for the Core Flight System (CFS) 23 | * Health and Safety (HS) Application. 24 | */ 25 | #ifndef HS_APP_H 26 | #define HS_APP_H 27 | 28 | /************************************************************************ 29 | * Includes 30 | ************************************************************************/ 31 | #include "hs_msg.h" 32 | #include "hs_tbldefs.h" 33 | #include "hs_tbl.h" 34 | #include "hs_platform_cfg.h" 35 | #include "cfe.h" 36 | #include "cfe_msgids.h" 37 | 38 | /************************************************************************ 39 | * Macro Definitions 40 | ************************************************************************/ 41 | 42 | /** 43 | * \name HS Pipe Parameters 44 | * \{ 45 | */ 46 | #define HS_CMD_PIPE_NAME "HS_CMD_PIPE" 47 | #define HS_EVENT_PIPE_NAME "HS_EVENT_PIPE" 48 | #define HS_WAKEUP_PIPE_NAME "HS_WAKEUP_PIPE" 49 | /**\}*/ 50 | 51 | /** 52 | * \name HS CDS Buffer String 53 | * \{ 54 | */ 55 | #define HS_CDSNAME "HS_CDS" 56 | /**\}*/ 57 | 58 | #define HS_TBL_VAL_ERR (-1) 59 | 60 | /************************************************************************ 61 | * Type Definitions 62 | ************************************************************************/ 63 | 64 | /** 65 | * \brief HS CDS Data Structure 66 | */ 67 | typedef struct 68 | { 69 | uint16 ResetsPerformed; /**< \brief Number of Resets Performed */ 70 | uint16 ResetsPerformedNot; /**< \brief Inverted Resets Performed for validation */ 71 | uint16 MaxResets; /**< \brief Max Number of Resets Allowed */ 72 | uint16 MaxResetsNot; /**< \brief Inverted Max Number of Resets Allowed for validation */ 73 | } HS_CDSData_t; 74 | 75 | /** 76 | * \brief HS Global Data Structure 77 | */ 78 | typedef struct 79 | { 80 | CFE_SB_PipeId_t CmdPipe; /**< \brief Pipe Id for HS command pipe */ 81 | CFE_SB_PipeId_t WakeupPipe; /**< \brief Pipe Id for HS wakeup pipe */ 82 | CFE_SB_PipeId_t EventPipe; /**< \brief Pipe Id for HK event pipe */ 83 | 84 | uint8 ServiceWatchdogFlag; /**< \brief Flag of current watchdog servicing state */ 85 | 86 | uint8 CurrentAppMonState; /**< \brief Status of HS Application Monitor */ 87 | uint8 CurrentEventMonState; /**< \brief Status of HS Events Monitor */ 88 | uint8 CurrentAlivenessState; /**< \brief Status of HS Aliveness Indicator */ 89 | uint8 ExeCountState; /**< \brief Status of Execution Counter Table */ 90 | 91 | uint8 MsgActsState; /**< \brief Status of Message Actions Table */ 92 | uint8 CDSState; /**< \brief Status of Critical Data Storing */ 93 | uint8 AppMonLoaded; /**< \brief If AppMon Table is loaded */ 94 | uint8 EventMonLoaded; /**< \brief If EventMon Table is loaded */ 95 | 96 | uint8 CurrentCPUHogState; /**< \brief Status of HS CPU Hogging Indicator */ 97 | uint8 SpareBytes[3]; /**< \brief Spare bytes for 32 bit alignment padding */ 98 | 99 | uint8 CmdCount; /**< \brief Number of valid commands received */ 100 | uint8 CmdErrCount; /**< \brief Number of invalid commands received */ 101 | 102 | uint32 EventsMonitoredCount; /**< \brief Total count of event messages monitored */ 103 | 104 | uint16 MsgActCooldown[HS_MAX_MSG_ACT_TYPES]; /**< \brief Counts until Message Actions is available */ 105 | uint16 AppMonCheckInCountdown[HS_MAX_MONITORED_APPS]; /**< \brief Counts until Application Monitor times out */ 106 | 107 | uint32 AppMonEnables[((HS_MAX_MONITORED_APPS - 1) / HS_BITS_PER_APPMON_ENABLE) + 108 | 1]; /**< \brief AppMon state by monitor */ 109 | 110 | uint32 AppMonLastExeCount[HS_MAX_MONITORED_APPS]; /**< \brief Last Execution Count for application being checked */ 111 | 112 | uint32 AlivenessCounter; /**< \brief Current Count towards the CPU Aliveness output period */ 113 | 114 | uint32 MsgActExec; /**< \brief Number of Software Bus Message Actions Executed */ 115 | 116 | uint32 RunStatus; /**< \brief HS App run status */ 117 | 118 | uint32 SysMonPspModuleId; /**< \brief PSP module to track system health, cpu utilization */ 119 | uint16 SysMonSubsystemId; /**< \brief Subsystem ID for cpu utilization function */ 120 | uint16 SysMonSubchannelId; /**< \brief Subchannel ID for cpu utilization function */ 121 | 122 | uint32 UtilizationCycleCounter; /**< \brief Counter to run cpu utilization check */ 123 | 124 | uint32 CurrentCPUHoggingTime; /**< \brief Count of cycles that CPU utilization is above hogging threshold */ 125 | uint32 MaxCPUHoggingTime; /**< \brief Count of hogging cycles after which an event reports hogging */ 126 | uint32 CurrentCPUUtilIndex; /**< \brief Current index into the Utilization Tracker */ 127 | 128 | uint32 UtilizationTracker[HS_UTIL_PEAK_NUM_INTERVAL]; /**< \brief Utilization from previous intervals */ 129 | 130 | uint32 UtilCpuAvg; /**< \brief Current CPU Utilization Average */ 131 | uint32 UtilCpuPeak; /**< \brief Current CPU Utilization Peak */ 132 | 133 | CFE_TBL_Handle_t AMTableHandle; /**< \brief Apps Monitor table handle */ 134 | CFE_TBL_Handle_t EMTableHandle; /**< \brief Events Monitor table handle */ 135 | CFE_TBL_Handle_t MATableHandle; /**< \brief Message Actions table handle */ 136 | 137 | CFE_TBL_Handle_t XCTableHandle; /**< \brief Execution Counters table handle */ 138 | HS_XCTEntry_t * XCTablePtr; /**< \brief Ptr to Execution Counters table entry */ 139 | 140 | HS_AMTEntry_t *AMTablePtr; /**< \brief Ptr to Apps Monitor table entry */ 141 | HS_EMTEntry_t *EMTablePtr; /**< \brief Ptr to Events Monitor table entry */ 142 | HS_MATEntry_t *MATablePtr; /**< \brief Ptr to Message Actions table entry */ 143 | 144 | CFE_ES_CDSHandle_t MyCDSHandle; /* \brief Handle to CDS memory block */ 145 | HS_CDSData_t CDSData; /* \brief Copy of Critical Data */ 146 | 147 | HS_HkPacket_t HkPacket; /**< \brief HK Housekeeping Packet */ 148 | } HS_AppData_t; 149 | 150 | /************************************************************************ 151 | * Exported Data 152 | ************************************************************************/ 153 | extern HS_AppData_t HS_AppData; 154 | 155 | /************************************************************************ 156 | * Exported Functions 157 | ************************************************************************/ 158 | 159 | /** 160 | * \brief CFS Health and Safety (HS) application entry point 161 | * 162 | * \par Description 163 | * Health and Safety application entry point and main process loop. 164 | * 165 | * \par Assumptions, External Events, and Notes: 166 | * None 167 | */ 168 | void HS_AppMain(void); 169 | 170 | /** 171 | * \brief Initialize the CFS Health and Safety (HS) application 172 | * 173 | * \par Description 174 | * Health and Safety application initialization routine. This 175 | * function performs all the required startup steps to 176 | * initialize HS data structures and get the application 177 | * registered with the cFE services so it can begin to receive 178 | * command messages. 179 | * 180 | * \par Assumptions, External Events, and Notes: 181 | * None 182 | * 183 | * \return Execution status, see \ref CFEReturnCodes 184 | * \retval #CFE_SUCCESS \copybrief CFE_SUCCESS 185 | */ 186 | CFE_Status_t HS_AppInit(void); 187 | 188 | /** 189 | * \brief Initialize Software Bus 190 | * 191 | * \par Description 192 | * This function performs the steps required to setup the 193 | * cFE software bus for use by the HS application 194 | * 195 | * \par Assumptions, External Events, and Notes: 196 | * None 197 | * 198 | * \return Execution status, see \ref CFEReturnCodes 199 | * \retval #CFE_SUCCESS \copybrief CFE_SUCCESS 200 | */ 201 | CFE_Status_t HS_SbInit(void); 202 | 203 | /** 204 | * \brief Initialize cFE Table Services 205 | * 206 | * \par Description 207 | * This function performs those steps required to initialize the 208 | * relationship between the HS App and the cFE Table Services. 209 | * 210 | * \par Assumptions, External Events, and Notes: 211 | * None 212 | * 213 | * \return Execution status, see \ref CFEReturnCodes 214 | * \retval #CFE_SUCCESS \copybrief CFE_SUCCESS 215 | */ 216 | CFE_Status_t HS_TblInit(void); 217 | 218 | /** 219 | * \brief Perform Normal Periodic Processing 220 | * 221 | * \par Description 222 | * This function performs the normal Health and Safety monitoring 223 | * functions including application, event and execution counters, 224 | * as well as servicing the watchdog, outputing the aliveness 225 | * indicator, and receiving commands or HK requests. 226 | * 227 | * \par Assumptions, External Events, and Notes: 228 | * None 229 | * 230 | * \return Execution status, see \ref CFEReturnCodes 231 | * \retval #CFE_SUCCESS \copybrief CFE_SUCCESS 232 | */ 233 | CFE_Status_t HS_ProcessMain(void); 234 | 235 | /** 236 | * \brief Process commands received from cFE Software Bus 237 | * 238 | * \par Description 239 | * This function pulls messages from command pipe and processes 240 | * them accordingly. 241 | * 242 | * \par Assumptions, External Events, and Notes: 243 | * None 244 | * 245 | * \return Execution status, see \ref CFEReturnCodes 246 | * \retval #CFE_SUCCESS \copybrief CFE_SUCCESS 247 | */ 248 | CFE_Status_t HS_ProcessCommands(void); 249 | 250 | #endif 251 | -------------------------------------------------------------------------------- /fsw/src/hs_cmds.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,920-1, and identified as “Core Flight 3 | * System (cFS) Health & Safety (HS) Application version 2.4.1” 4 | * 5 | * Copyright (c) 2021 United States Government as represented by the 6 | * Administrator of the National Aeronautics and Space Administration. 7 | * All Rights Reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 10 | * not use this file except in compliance with the License. You may obtain 11 | * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | ************************************************************************/ 19 | 20 | /** 21 | * @file 22 | * Specification for the CFS Health and Safety (HS) routines that 23 | * handle command processing 24 | */ 25 | #ifndef HS_CMDS_H 26 | #define HS_CMDS_H 27 | 28 | /************************************************************************* 29 | * Includes 30 | ************************************************************************/ 31 | #include "cfe_error.h" 32 | #include "hs_msg.h" 33 | 34 | /************************************************************************* 35 | * Exported Functions 36 | ************************************************************************/ 37 | 38 | /** 39 | * \brief Reset counters 40 | * 41 | * \par Description 42 | * Utility function that resets housekeeping counters to zero 43 | * 44 | * \par Assumptions, External Events, and Notes: 45 | * None 46 | * 47 | * \sa #HS_ResetCmd 48 | */ 49 | void HS_ResetCounters(void); 50 | 51 | /** 52 | * \brief Manages HS tables 53 | * 54 | * \par Description 55 | * Manages load requests for the AppMon, EventMon, ExeCount and MsgActs 56 | * tables and update notification for the AppMon and MsgActs tables. 57 | * Also releases and acquires table addresses. Gets called at the start 58 | * of each processing cycle and on initialization. 59 | * 60 | * \par Assumptions, External Events, and Notes: 61 | * None 62 | * 63 | * \sa #CFE_TBL_Manage 64 | */ 65 | void HS_AcquirePointers(void); 66 | 67 | /** 68 | * \brief Housekeeping request 69 | * 70 | * \par Description 71 | * Processes an on-board housekeeping request message. 72 | * 73 | * \par Assumptions, External Events, and Notes: 74 | * This message does not affect the command execution counter 75 | * 76 | * \param[in] BufPtr Pointer to Software Bus buffer 77 | */ 78 | CFE_Status_t HS_SendHkCmd(const HS_SendHkCmd_t *BufPtr); 79 | 80 | /** 81 | * \brief Noop command 82 | * 83 | * \par Description 84 | * Processes a noop ground command. 85 | * 86 | * \par Assumptions, External Events, and Notes: 87 | * None 88 | * 89 | * \param[in] BufPtr Pointer to Software Bus buffer 90 | * 91 | * \sa #HS_NOOP_CC 92 | */ 93 | CFE_Status_t HS_NoopCmd(const HS_NoopCmd_t *BufPtr); 94 | 95 | /** 96 | * \brief Reset counters command 97 | * 98 | * \par Description 99 | * Processes a reset counters ground command which will reset 100 | * the following HS application counters to zero: 101 | * - Command counter 102 | * - Command error counter 103 | * 104 | * \par Assumptions, External Events, and Notes: 105 | * None 106 | * 107 | * \param[in] BufPtr Pointer to Software Bus buffer 108 | * 109 | * \sa #HS_RESET_CC 110 | */ 111 | CFE_Status_t HS_ResetCmd(const HS_ResetCmd_t *BufPtr); 112 | 113 | /** 114 | * \brief Process an enable critical applications monitor command 115 | * 116 | * \par Description 117 | * Allows the critical applications to be monitored. 118 | * 119 | * \par Assumptions, External Events, and Notes: 120 | * None 121 | * 122 | * \param[in] BufPtr Pointer to Software Bus buffer 123 | * 124 | * \sa #HS_ENABLE_APP_MON_CC 125 | */ 126 | CFE_Status_t HS_EnableAppMonCmd(const HS_EnableAppMonCmd_t *BufPtr); 127 | 128 | /** 129 | * \brief Process a disable critical applications monitor command 130 | * 131 | * \par Description 132 | * Stops the critical applications from be monitored. 133 | * 134 | * \par Assumptions, External Events, and Notes: 135 | * None 136 | * 137 | * \param[in] BufPtr Pointer to Software Bus buffer 138 | * 139 | * \sa #HS_DISABLE_APP_MON_CC 140 | */ 141 | CFE_Status_t HS_DisableAppMonCmd(const HS_DisableAppMonCmd_t *BufPtr); 142 | 143 | /** 144 | * \brief Process an enable critical events monitor command 145 | * 146 | * \par Description 147 | * Allows the critical events to be monitored. 148 | * 149 | * \par Assumptions, External Events, and Notes: 150 | * None 151 | * 152 | * \param[in] BufPtr Pointer to Software Bus buffer 153 | * 154 | * \sa #HS_ENABLE_EVENT_MON_CC 155 | */ 156 | CFE_Status_t HS_EnableEventMonCmd(const HS_EnableEventMonCmd_t *BufPtr); 157 | 158 | /** 159 | * \brief Process a disable critical events monitor command 160 | * 161 | * \par Description 162 | * Stops the critical events from be monitored. 163 | * 164 | * \par Assumptions, External Events, and Notes: 165 | * None 166 | * 167 | * \param[in] BufPtr Pointer to Software Bus buffer 168 | * 169 | * \sa #HS_DISABLE_EVENT_MON_CC 170 | */ 171 | CFE_Status_t HS_DisableEventMonCmd(const HS_DisableEventMonCmd_t *BufPtr); 172 | 173 | /** 174 | * \brief Process an enable aliveness indicator command 175 | * 176 | * \par Description 177 | * Allows the aliveness indicator to be output to the UART. 178 | * 179 | * \par Assumptions, External Events, and Notes: 180 | * None 181 | * 182 | * \param[in] BufPtr Pointer to Software Bus buffer 183 | * 184 | * \sa #HS_ENABLE_ALIVENESS_CC 185 | */ 186 | CFE_Status_t HS_EnableAlivenessCmd(const HS_EnableAlivenessCmd_t *BufPtr); 187 | 188 | /** 189 | * \brief Process a disable aliveness indicator command 190 | * 191 | * \par Description 192 | * Stops the aliveness indicator from being output on the UART. 193 | * 194 | * \par Assumptions, External Events, and Notes: 195 | * None 196 | * 197 | * \param[in] BufPtr Pointer to Software Bus buffer 198 | * 199 | * \sa #HS_DISABLE_ALIVENESS_CC 200 | */ 201 | CFE_Status_t HS_DisableAlivenessCmd(const HS_DisableAlivenessCmd_t *BufPtr); 202 | 203 | /** 204 | * \brief Process an enable CPU Hogging indicator command 205 | * 206 | * \par Description 207 | * Allows the CPU Hogging indicator to be output as an event. 208 | * 209 | * \par Assumptions, External Events, and Notes: 210 | * None 211 | * 212 | * \param[in] BufPtr Pointer to Software Bus buffer 213 | * 214 | * \sa #HS_ENABLE_CPU_HOG_CC 215 | */ 216 | CFE_Status_t HS_EnableCpuHogCmd(const HS_EnableCpuHogCmd_t *BufPtr); 217 | 218 | /** 219 | * \brief Process a disable CPU Hogging indicator command 220 | * 221 | * \par Description 222 | * Stops the CPU Hogging indicator from being output as an event. 223 | * 224 | * \par Assumptions, External Events, and Notes: 225 | * None 226 | * 227 | * \param[in] BufPtr Pointer to Software Bus buffer 228 | * 229 | * \sa #HS_DISABLE_CPU_HOG_CC 230 | */ 231 | CFE_Status_t HS_DisableCpuHogCmd(const HS_DisableCpuHogCmd_t *BufPtr); 232 | 233 | /** 234 | * \brief Process a reset resets performed command 235 | * 236 | * \par Description 237 | * Resets the count of HS performed resets maintained by HS. 238 | * 239 | * \par Assumptions, External Events, and Notes: 240 | * None 241 | * 242 | * \param[in] BufPtr Pointer to Software Bus buffer 243 | * 244 | * \sa #HS_SET_MAX_RESETS_CC 245 | */ 246 | CFE_Status_t HS_ResetResetsPerformedCmd(const HS_ResetResetsPerformedCmd_t *BufPtr); 247 | 248 | /** 249 | * \brief Process a set max resets command 250 | * 251 | * \par Description 252 | * Sets the max number of HS performed resets to the specified value. 253 | * 254 | * \par Assumptions, External Events, and Notes: 255 | * None 256 | * 257 | * \param[in] BufPtr Pointer to Software Bus buffer 258 | * 259 | * \sa #HS_RESET_RESETS_PERFORMED_CC 260 | */ 261 | CFE_Status_t HS_SetMaxResetsCmd(const HS_SetMaxResetsCmd_t *BufPtr); 262 | 263 | /** 264 | * \brief Refresh Critical Applications Monitor Status 265 | * 266 | * \par Description 267 | * This function gets called when HS detects that a new critical 268 | * applications monitor table has been loaded or when a command 269 | * to enable the critical applications monitor is received: it then 270 | * refreshes the timeouts for application being monitored 271 | * 272 | * \par Assumptions, External Events, and Notes: 273 | * None 274 | */ 275 | void HS_AppMonStatusRefresh(void); 276 | 277 | /** 278 | * \brief Refresh Message Actions Status 279 | * 280 | * \par Description 281 | * This function gets called when HS detects that a new 282 | * message actions table has been loaded: it then 283 | * resets the cooldowns for all actions. 284 | * 285 | * \par Assumptions, External Events, and Notes: 286 | * None 287 | */ 288 | void HS_MsgActsStatusRefresh(void); 289 | 290 | #endif 291 | -------------------------------------------------------------------------------- /fsw/src/hs_dispatch.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,920-1, and identified as “Core Flight 3 | * System (cFS) Health & Safety (HS) Application version 2.4.1” 4 | * 5 | * Copyright (c) 2021 United States Government as represented by the 6 | * Administrator of the National Aeronautics and Space Administration. 7 | * All Rights Reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 10 | * not use this file except in compliance with the License. You may obtain 11 | * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | ************************************************************************/ 19 | 20 | /** 21 | * @file 22 | * Specification for the CFS Health and Safety (HS) routines that 23 | * handle command processing 24 | */ 25 | #ifndef HS_DISPATCH_H 26 | #define HS_DISPATCH_H 27 | 28 | /************************************************************************* 29 | * Includes 30 | ************************************************************************/ 31 | #include "cfe.h" 32 | 33 | /************************************************************************* 34 | * Exported Functions 35 | ************************************************************************/ 36 | 37 | /** 38 | * \brief Process a command pipe message 39 | * 40 | * \par Description 41 | * Processes a single software bus command pipe message. Checks 42 | * the message and command IDs and calls the appropriate routine 43 | * to handle the message. 44 | * 45 | * \par Assumptions, External Events, and Notes: 46 | * None 47 | * 48 | * \param[in] BufPtr Pointer to Software Bus buffer 49 | */ 50 | void HS_AppPipe(const CFE_SB_Buffer_t *BufPtr); 51 | 52 | /** 53 | * \brief Verify message length 54 | * 55 | * \par Description 56 | * Checks if the actual length of a software bus message matches 57 | * the expected length and sends an error event if a mismatch 58 | * occurs 59 | * 60 | * \par Assumptions, External Events, and Notes: 61 | * None 62 | * 63 | * \param[in] MsgPtr Message Pointer 64 | * \param[in] ExpectedLength Expected length 65 | * 66 | * \return Boolean message length matches response 67 | * \retval true Length matches expected 68 | * \retval false Length does not match expected 69 | * 70 | * \sa #HS_CMD_LEN_ERR_EID 71 | */ 72 | bool HS_VerifyMsgLength(const CFE_MSG_Message_t *MsgPtr, size_t ExpectedLength); 73 | 74 | /** 75 | * \brief Housekeeping dispatcher 76 | * 77 | * Verifies and processes the received command 78 | */ 79 | void HS_SendHkVerifyDispatch(const CFE_SB_Buffer_t *BufPtr); 80 | 81 | /** 82 | * \brief Noop command dispatcher 83 | * 84 | * Verifies and processes the received command 85 | * 86 | * \sa #HS_NOOP_CC 87 | */ 88 | void HS_NoopVerifyDispatch(const CFE_SB_Buffer_t *BufPtr); 89 | 90 | /** 91 | * \brief Reset counters dispatcher 92 | * 93 | * Verifies and processes the received command 94 | * 95 | * \sa #HS_RESET_CC 96 | */ 97 | void HS_ResetVerifyDispatch(const CFE_SB_Buffer_t *BufPtr); 98 | 99 | /** 100 | * \brief Enable application monitor dispatcher 101 | * 102 | * Verifies and processes the received command 103 | * 104 | * \sa #HS_ENABLE_APP_MON_CC 105 | */ 106 | void HS_EnableAppMonVerifyDispatch(const CFE_SB_Buffer_t *BufPtr); 107 | 108 | /** 109 | * \brief Disable application monitor dispatcher 110 | * 111 | * Verifies and processes the received command 112 | * 113 | * \sa #HS_DISABLE_APP_MON_CC 114 | */ 115 | void HS_DisableAppMonVerifyDispatch(const CFE_SB_Buffer_t *BufPtr); 116 | 117 | /** 118 | * \brief Enable critical events monitor dispatcher 119 | * 120 | * Verifies and processes the received command 121 | * 122 | * \sa #HS_ENABLE_EVENT_MON_CC 123 | */ 124 | void HS_EnableEventMonVerifyDispatch(const CFE_SB_Buffer_t *BufPtr); 125 | 126 | /** 127 | * \brief Disable critical events monitor dispatcher 128 | * 129 | * Verifies and processes the received command 130 | * 131 | * \sa #HS_DISABLE_EVENT_MON_CC 132 | */ 133 | void HS_DisableEventMonVerifyDispatch(const CFE_SB_Buffer_t *BufPtr); 134 | 135 | /** 136 | * \brief Enable aliveness indicator dispatcher 137 | * 138 | * Verifies and processes the received command 139 | * 140 | * \sa #HS_ENABLE_ALIVENESS_CC 141 | */ 142 | void HS_EnableAlivenessVerifyDispatch(const CFE_SB_Buffer_t *BufPtr); 143 | 144 | /** 145 | * \brief Disable aliveness indicator dispatcher 146 | * 147 | * Verifies and processes the received command 148 | * 149 | * \sa #HS_DISABLE_ALIVENESS_CC 150 | */ 151 | void HS_DisableAlivenessVerifyDispatch(const CFE_SB_Buffer_t *BufPtr); 152 | 153 | /** 154 | * \brief Enable CPU Hogging indicator dispatcher 155 | * 156 | * Verifies and processes the received command 157 | * 158 | * \sa #HS_ENABLE_CPU_HOG_CC 159 | */ 160 | void HS_EnableCpuHogVerifyDispatch(const CFE_SB_Buffer_t *BufPtr); 161 | 162 | /** 163 | * \brief Disable CPU Hogging indicator dispatcher 164 | * 165 | * Verifies and processes the received command 166 | * 167 | * \sa #HS_DISABLE_CPU_HOG_CC 168 | */ 169 | void HS_DisableCpuHogVerifyDispatch(const CFE_SB_Buffer_t *BufPtr); 170 | 171 | /** 172 | * \brief Reset resets performed dispatcher 173 | * 174 | * Verifies and processes the received command 175 | * 176 | * \sa #HS_SET_MAX_RESETS_CC 177 | */ 178 | void HS_ResetResetsPerformedVerifyDispatch(const CFE_SB_Buffer_t *BufPtr); 179 | 180 | /** 181 | * \brief Set max resets dispatcher 182 | * 183 | * Verifies and processes the received command 184 | * 185 | * \sa #HS_RESET_RESETS_PERFORMED_CC 186 | */ 187 | void HS_SetMaxResetsVerifyDispatch(const CFE_SB_Buffer_t *BufPtr); 188 | 189 | #endif 190 | -------------------------------------------------------------------------------- /fsw/src/hs_eds_dispatch.c: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,920-1, and identified as “Core Flight 3 | * System (cFS) Health & Safety (HS) Application version 2.4.1” 4 | * 5 | * Copyright (c) 2021 United States Government as represented by the 6 | * Administrator of the National Aeronautics and Space Administration. 7 | * All Rights Reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 10 | * not use this file except in compliance with the License. You may obtain 11 | * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | ************************************************************************/ 19 | 20 | /** 21 | * @file 22 | * CFS Health and Safety (HS) command handling routines 23 | */ 24 | 25 | /************************************************************************ 26 | ** Includes 27 | *************************************************************************/ 28 | #include "hs_app.h" 29 | #include "hs_cmds.h" 30 | #include "hs_msgids.h" 31 | #include "hs_msgdefs.h" 32 | #include "hs_eventids.h" 33 | #include "hs_dispatch.h" 34 | #include "hs_version.h" 35 | 36 | #include "hs_eds_dispatcher.h" 37 | #include "hs_eds_dictionary.h" 38 | 39 | /* clang-format off */ 40 | /* 41 | * Define a lookup table for SAMPLE app command codes 42 | */ 43 | static const EdsDispatchTable_HS_Application_CFE_SB_Telecommand_t HS_TC_DISPATCH_TABLE = 44 | { 45 | .CMD = 46 | { 47 | .DisableAlivenessCmd_indication = HS_DisableAlivenessCmd, 48 | .DisableAppMonCmd_indication = HS_DisableAppMonCmd, 49 | .DisableCpuHogCmd_indication = HS_DisableCpuHogCmd, 50 | .DisableEventMonCmd_indication = HS_DisableEventMonCmd, 51 | .EnableAlivenessCmd_indication = HS_EnableAlivenessCmd, 52 | .EnableAppMonCmd_indication = HS_EnableAppMonCmd, 53 | .EnableCpuHogCmd_indication = HS_EnableCpuHogCmd, 54 | .EnableEventMonCmd_indication = HS_EnableEventMonCmd, 55 | .NoopCmd_indication = HS_NoopCmd, 56 | .ResetCmd_indication = HS_ResetCmd, 57 | .ResetResetsPerformedCmd_indication = HS_ResetResetsPerformedCmd, 58 | .SetMaxResetsCmd_indication = HS_SetMaxResetsCmd, 59 | }, 60 | .SEND_HK = 61 | { 62 | .indication = HS_SendHkCmd 63 | } 64 | }; 65 | /* clang-format on */ 66 | 67 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **/ 68 | /* */ 69 | /* Purpose: */ 70 | /* This routine will process any packet that is received on the SAMPLE */ 71 | /* command pipe. */ 72 | /* */ 73 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 74 | void HS_TaskPipe(const CFE_SB_Buffer_t *SBBufPtr) 75 | { 76 | CFE_Status_t Status; 77 | CFE_SB_MsgId_t MsgId; 78 | CFE_MSG_Size_t MsgSize; 79 | CFE_MSG_FcnCode_t MsgFc; 80 | 81 | Status = EdsDispatch_HS_Application_Telecommand(SBBufPtr, &HS_TC_DISPATCH_TABLE); 82 | 83 | if (Status != CFE_SUCCESS) 84 | { 85 | CFE_MSG_GetMsgId(&SBBufPtr->Msg, &MsgId); 86 | CFE_MSG_GetSize(&SBBufPtr->Msg, &MsgSize); 87 | CFE_MSG_GetFcnCode(&SBBufPtr->Msg, &MsgFc); 88 | 89 | if (Status == CFE_STATUS_UNKNOWN_MSG_ID) 90 | { 91 | CFE_EVS_SendEvent(HS_MID_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid command pipe message ID: 0x%08lX", 92 | (unsigned long)CFE_SB_MsgIdToValue(MsgId)); 93 | HS_AppData.CmdErrCount++; 94 | } 95 | else if (Status == CFE_STATUS_WRONG_MSG_LENGTH) 96 | { 97 | if (CFE_SB_MsgIdToValue(MsgId) == HS_SEND_HK_MID) 98 | { 99 | /* 100 | ** For a bad HK request, just send the event. We only increment 101 | ** the error counter for ground commands and not internal messages. 102 | */ 103 | CFE_EVS_SendEvent(HS_HKREQ_LEN_ERR_EID, CFE_EVS_EventType_ERROR, 104 | "Invalid HK request msg length: ID = 0x%08lX, CC = %d, Len = %d", 105 | (unsigned long)CFE_SB_MsgIdToValue(MsgId), (int)MsgFc, (int)MsgSize); 106 | } 107 | else 108 | { 109 | /* 110 | ** All other cases, increment error counter 111 | */ 112 | CFE_EVS_SendEvent(HS_CMD_LEN_ERR_EID, CFE_EVS_EventType_ERROR, 113 | "Invalid msg length: ID = 0x%08lX, CC = %d, Len = %d", 114 | (unsigned long)CFE_SB_MsgIdToValue(MsgId), (int)MsgFc, (int)MsgSize); 115 | HS_AppData.CmdErrCount++; 116 | } 117 | } 118 | else 119 | { 120 | CFE_EVS_SendEvent(HS_CC_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid command code: ID = 0x%08lX, CC = %d", 121 | (unsigned long)CFE_SB_MsgIdToValue(MsgId), (int)MsgFc); 122 | HS_AppData.CmdErrCount++; 123 | } 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /fsw/src/hs_monitors.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,920-1, and identified as “Core Flight 3 | * System (cFS) Health & Safety (HS) Application version 2.4.1” 4 | * 5 | * Copyright (c) 2021 United States Government as represented by the 6 | * Administrator of the National Aeronautics and Space Administration. 7 | * All Rights Reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 10 | * not use this file except in compliance with the License. You may obtain 11 | * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | ************************************************************************/ 19 | 20 | /** 21 | * @file 22 | * Specification for the CFS Health and Safety (HS) routines that 23 | * handle application and event monitoring 24 | */ 25 | #ifndef HS_MONITORS_H 26 | #define HS_MONITORS_H 27 | 28 | /************************************************************************* 29 | * Includes 30 | *************************************************************************/ 31 | #include "cfe.h" 32 | #include "cfe_evs_msg.h" 33 | 34 | /************************************************************************* 35 | * Exported Functions 36 | *************************************************************************/ 37 | 38 | /** 39 | * \brief Check execution status of each app in AppMon table 40 | * 41 | * \par Description 42 | * Cycles through the Application Monitor Table checking the current 43 | * execution count for each monitored application. If the count fails 44 | * to increment for the table specified duration, the table specified 45 | * action is taken. 46 | * 47 | * \par Assumptions, External Events, and Notes: 48 | * None 49 | */ 50 | void HS_MonitorApplications(void); 51 | 52 | /** 53 | * \brief Search the EventMon table for matches to the incoming event 54 | * 55 | * \par Description 56 | * Searches the Event Monitor Table for matches to the incoming 57 | * event message. If a match is found, the table specified action is 58 | * taken. 59 | * 60 | * \par Assumptions, External Events, and Notes: 61 | * None 62 | * 63 | * \param[in] EventPtr Pointer to the event message 64 | */ 65 | void HS_MonitorEvent(const CFE_EVS_LongEventTlm_t *EventPtr); 66 | 67 | /** 68 | * \brief Monitor the utilization tracker counter 69 | * 70 | * \par Description 71 | * Monitors the utilization tracker counter incremented by the Idle 72 | * Task, converting it into an estimated CPU Utilization for the 73 | * previous cycle. If the utilization is over a certain theshold 74 | * for a certain amount of time, an event is output. 75 | * 76 | * \par Assumptions, External Events, and Notes: 77 | * None 78 | */ 79 | void HS_MonitorUtilization(void); 80 | 81 | /** 82 | * \brief Validate application monitor table 83 | * 84 | * \par Description 85 | * This function is called by table services when a validation of 86 | * the application monitor table is required 87 | * 88 | * \par Assumptions, External Events, and Notes: 89 | * None 90 | * 91 | * \param [in] *TableData Pointer to the table data to validate 92 | * 93 | * \return Table validation status 94 | * \retval #CFE_SUCCESS \copydoc CFE_SUCCESS 95 | * \retval #HS_AMTVAL_ERR_ACT \copydoc HS_AMTVAL_ERR_ACT 96 | * \retval #HS_AMTVAL_ERR_NUL \copydoc HS_AMTVAL_ERR_NUL 97 | * 98 | * \sa #HS_ValidateEMTable, #HS_ValidateXCTable, #HS_ValidateMATable 99 | */ 100 | int32 HS_ValidateAMTable(void *TableData); 101 | 102 | /** 103 | * \brief Validate event monitor table 104 | * 105 | * \par Description 106 | * This function is called by table services when a validation of 107 | * the event monitor table is required 108 | * 109 | * \par Assumptions, External Events, and Notes: 110 | * None 111 | * 112 | * \param [in] *TableData Pointer to the table data to validate 113 | * 114 | * \return Table validation status 115 | * \retval #CFE_SUCCESS \copydoc CFE_SUCCESS 116 | * \retval #HS_EMTVAL_ERR_ACT \copydoc HS_EMTVAL_ERR_ACT 117 | * \retval #HS_EMTVAL_ERR_NUL \copydoc HS_EMTVAL_ERR_NUL 118 | * 119 | * \sa #HS_ValidateAMTable, #HS_ValidateXCTable, #HS_ValidateMATable 120 | */ 121 | int32 HS_ValidateEMTable(void *TableData); 122 | 123 | /** 124 | * \brief Validate execution counter table 125 | * 126 | * \par Description 127 | * This function is called by table services when a validation of 128 | * the execution counter table is required 129 | * 130 | * \par Assumptions, External Events, and Notes: 131 | * None 132 | * 133 | * \param [in] *TableData Pointer to the table data to validate 134 | * 135 | * \return Table validation status 136 | * \retval #CFE_SUCCESS \copydoc CFE_SUCCESS 137 | * \retval #HS_XCTVAL_ERR_TYPE \copydoc HS_XCTVAL_ERR_TYPE 138 | * \retval #HS_XCTVAL_ERR_NUL \copydoc HS_XCTVAL_ERR_NUL 139 | * 140 | * \sa #HS_ValidateAMTable, #HS_ValidateEMTable, #HS_ValidateMATable 141 | */ 142 | int32 HS_ValidateXCTable(void *TableData); 143 | 144 | /** 145 | * \brief Validate message actions table 146 | * 147 | * \par Description 148 | * This function is called by table services when a validation of 149 | * the message actions table is required 150 | * 151 | * \par Assumptions, External Events, and Notes: 152 | * None 153 | * 154 | * \param [in] *TableData Pointer to the table data to validate 155 | * 156 | * \return Table validation status 157 | * \retval #CFE_SUCCESS \copydoc CFE_SUCCESS 158 | * \retval #HS_MATVAL_ERR_ID \copydoc HS_MATVAL_ERR_ID 159 | * \retval #HS_MATVAL_ERR_LEN \copydoc HS_MATVAL_ERR_LEN 160 | * \retval #HS_MATVAL_ERR_ENA \copydoc HS_MATVAL_ERR_ENA 161 | * 162 | * \sa #HS_ValidateAMTable, #HS_ValidateEMTable, #HS_ValidateXCTable 163 | */ 164 | int32 HS_ValidateMATable(void *TableData); 165 | 166 | /** 167 | * \brief Update and store CDS data 168 | * 169 | * \par Description 170 | * This function is called to update and then store the data in the 171 | * critical data store. 172 | * 173 | * \par Assumptions, External Events, and Notes: 174 | * None 175 | * 176 | * \param [in] ResetsPerformed Number of HS caused processor resets 177 | * \param [in] MaxResets Max number of resets allowed 178 | */ 179 | void HS_SetCDSData(uint16 ResetsPerformed, uint16 MaxResets); 180 | 181 | #endif 182 | -------------------------------------------------------------------------------- /fsw/src/hs_sysmon.c: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,920-1, and identified as “Core Flight 3 | * System (cFS) Health & Safety (HS) Application version 2.4.1” 4 | * 5 | * Copyright (c) 2021 United States Government as represented by the 6 | * Administrator of the National Aeronautics and Space Administration. 7 | * All Rights Reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 10 | * not use this file except in compliance with the License. You may obtain 11 | * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | ************************************************************************/ 19 | 20 | /** 21 | * @file 22 | * Health and Safety (HS) application system monitor component. 23 | * 24 | * Access functions to read system monitor variables such as CPU utilization, 25 | * temperature, and other health metrics. Typically these go through the PSP 26 | * as they are platform-specific. 27 | */ 28 | 29 | /************************************************************************* 30 | ** Includes 31 | *************************************************************************/ 32 | #include "hs_sysmon.h" 33 | #include "hs_platform_cfg.h" 34 | #include "hs_app.h" 35 | 36 | #include "cfe.h" 37 | #include "cfe_psp.h" 38 | #include "iodriver_base.h" 39 | #include "iodriver_analog_io.h" 40 | #include "osapi.h" 41 | 42 | /* 43 | * -------------------------------------------------------- 44 | * Initialize The System Monitor functions 45 | * -------------------------------------------------------- 46 | */ 47 | CFE_Status_t HS_SysMonInit(void) 48 | { 49 | CFE_PSP_IODriver_Location_t Location; 50 | CFE_Status_t StatusCode; 51 | 52 | if (CFE_PSP_IODriver_FindByName(HS_SYSTEM_MONITOR_DEVICE, &HS_AppData.SysMonPspModuleId) != CFE_PSP_SUCCESS) 53 | { 54 | CFE_ES_WriteToSysLog("%s(): No system monitor device available, CPU usage will not be reported\n", __func__); 55 | StatusCode = CFE_SUCCESS; 56 | } 57 | else 58 | { 59 | CFE_ES_WriteToSysLog("%s(): System Monitor using PSP device ID %08lx\n", __func__, 60 | (unsigned long)HS_AppData.SysMonPspModuleId); 61 | 62 | Location.PspModuleId = HS_AppData.SysMonPspModuleId; 63 | Location.SubsystemId = 0; 64 | Location.SubchannelId = 0; 65 | 66 | if (CFE_PSP_IODriver_Command(&Location, CFE_PSP_IODriver_SET_RUNNING, CFE_PSP_IODriver_U32ARG(1)) != 67 | CFE_PSP_SUCCESS) 68 | { 69 | CFE_ES_WriteToSysLog("%s(): Unable to start device %08lx\n", __func__, 70 | (unsigned long)HS_AppData.SysMonPspModuleId); 71 | StatusCode = CFE_STATUS_EXTERNAL_RESOURCE_FAIL; 72 | } 73 | else 74 | { 75 | /* find the subsystem */ 76 | StatusCode = CFE_PSP_IODriver_Command(&Location, CFE_PSP_IODriver_LOOKUP_SUBSYSTEM, 77 | CFE_PSP_IODriver_CONST_STR(HS_SYSTEM_MONITOR_SUBSYSTEM_NAME)); 78 | 79 | if (StatusCode < 0) 80 | { 81 | CFE_ES_WriteToSysLog("%s(): Unable to find subsystem \'%s\'\n", __func__, 82 | HS_SYSTEM_MONITOR_SUBSYSTEM_NAME); 83 | HS_AppData.SysMonSubsystemId = 0; 84 | } 85 | else 86 | { 87 | HS_AppData.SysMonSubsystemId = StatusCode; 88 | } 89 | 90 | Location.SubsystemId = HS_AppData.SysMonSubsystemId; 91 | StatusCode = CFE_PSP_IODriver_Command(&Location, CFE_PSP_IODriver_LOOKUP_SUBCHANNEL, 92 | CFE_PSP_IODriver_CONST_STR(HS_SYSTEM_MONITOR_SUBCHANNEL_NAME)); 93 | 94 | if (StatusCode < 0) 95 | { 96 | CFE_ES_WriteToSysLog("%s(): Unable to find channel \'%s\'\n", __func__, 97 | HS_SYSTEM_MONITOR_SUBCHANNEL_NAME); 98 | HS_AppData.SysMonSubchannelId = 0; 99 | } 100 | else 101 | { 102 | HS_AppData.SysMonSubchannelId = StatusCode; 103 | } 104 | 105 | /* return success to caller */ 106 | StatusCode = CFE_SUCCESS; 107 | } 108 | } 109 | 110 | return StatusCode; 111 | } 112 | 113 | void HS_SysMonCleanup(void) 114 | { 115 | CFE_PSP_IODriver_Location_t Location; 116 | 117 | if (HS_AppData.SysMonPspModuleId != 0) 118 | { 119 | Location.PspModuleId = HS_AppData.SysMonPspModuleId; 120 | Location.SubsystemId = 0; 121 | Location.SubchannelId = 0; 122 | 123 | if (CFE_PSP_IODriver_Command(&Location, CFE_PSP_IODriver_SET_RUNNING, CFE_PSP_IODriver_U32ARG(0)) != 124 | CFE_PSP_SUCCESS) 125 | { 126 | CFE_ES_WriteToSysLog("%s(): Unable to stop device %08lx\n", __func__, 127 | (unsigned long)HS_AppData.SysMonPspModuleId); 128 | } 129 | } 130 | } 131 | 132 | /* 133 | * -------------------------------------------------------- 134 | * Obtain the System CPU utilization information 135 | * -------------------------------------------------------- 136 | */ 137 | CFE_Status_t HS_SysMonGetCpuUtilization(void) 138 | { 139 | const CFE_PSP_IODriver_Location_t Location = {.PspModuleId = HS_AppData.SysMonPspModuleId, 140 | .SubsystemId = HS_AppData.SysMonSubsystemId, 141 | .SubchannelId = HS_AppData.SysMonSubchannelId}; 142 | CFE_PSP_IODriver_AdcCode_t Sample = 0; 143 | CFE_PSP_IODriver_AnalogRdWr_t RdWr = {.NumChannels = 1, .Samples = &Sample}; 144 | CFE_Status_t StatusCode; 145 | int32 Value; 146 | 147 | if (HS_AppData.SysMonPspModuleId == 0) 148 | { 149 | /* No device to get info from */ 150 | StatusCode = CFE_PSP_ERROR_NOT_IMPLEMENTED; 151 | } 152 | else 153 | { 154 | StatusCode = CFE_PSP_IODriver_Command(&Location, CFE_PSP_IODriver_ANALOG_IO_READ_CHANNELS, 155 | CFE_PSP_IODriver_VPARG(&RdWr)); 156 | } 157 | 158 | if (StatusCode == CFE_PSP_SUCCESS) 159 | { 160 | Value = ((Sample >> 8) * HS_CPU_UTILIZATION_MAX) / 0xFFFF; 161 | } 162 | else 163 | { 164 | /* Unable to read value */ 165 | Value = -1; 166 | } 167 | 168 | return Value; 169 | } 170 | -------------------------------------------------------------------------------- /fsw/src/hs_sysmon.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,920-1, and identified as “Core Flight 3 | * System (cFS) Health & Safety (HS) Application version 2.4.1” 4 | * 5 | * Copyright (c) 2021 United States Government as represented by the 6 | * Administrator of the National Aeronautics and Space Administration. 7 | * All Rights Reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 10 | * not use this file except in compliance with the License. You may obtain 11 | * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | ************************************************************************/ 19 | 20 | /** 21 | * @file 22 | * Specification for the CFS Health and Safety (HS) system monitoring routines 23 | * 24 | * System health monitoring is inherently platform-specific and therefore should 25 | * be abstracted via the PSP. This provides local access methods to obtain the 26 | * information from the PSP. 27 | */ 28 | #ifndef HS_SYSMON_H 29 | #define HS_SYSMON_H 30 | 31 | /************************************************************************* 32 | * Includes 33 | ************************************************************************/ 34 | #include "cfe.h" 35 | #include "hs_platform_cfg.h" 36 | 37 | /************************************************************************* 38 | * Exported Functions 39 | *************************************************************************/ 40 | 41 | /** 42 | * \brief Initialize things needed for system monitoring 43 | * 44 | * \par Description 45 | * This function is intended to set up everything necessary for 46 | * System Monitoring at application startup. 47 | * 48 | * \par Assumptions, External Events, and Notes: 49 | * CFE_SUCCESS will be returned if all creation was performed 50 | * properly. 51 | * 52 | * \return Execution status, see \ref CFEReturnCodes 53 | * \retval #CFE_SUCCESS \copybrief CFE_SUCCESS 54 | */ 55 | CFE_Status_t HS_SysMonInit(void); 56 | 57 | /** 58 | * \brief De-Initialize system monitoring 59 | * 60 | * \par Description 61 | * This function stops everything that was started during HS_SysMonInit() 62 | * 63 | * \par Assumptions, External Events, and Notes: 64 | * 65 | */ 66 | void HS_SysMonCleanup(void); 67 | 68 | /** 69 | * \brief Read the system monitor CPU utilization 70 | * 71 | * \par Description 72 | * This function is used to read the current value of the cpu utilization 73 | * 74 | * \par Assumptions, External Events, and Notes: 75 | * The range of output is controlled by the #HS_CPU_UTILIZATION_MAX config 76 | * macro. Higher numbers represent higher usage, less idle time. 77 | * 78 | * \return Utilization value as fixed-point integer 79 | */ 80 | CFE_Status_t HS_SysMonGetCpuUtilization(void); 81 | 82 | #endif 83 | -------------------------------------------------------------------------------- /fsw/src/hs_utils.c: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,920-1, and identified as “Core Flight 3 | * System (cFS) Health & Safety (HS) Application version 2.4.1” 4 | * 5 | * Copyright (c) 2021 United States Government as represented by the 6 | * Administrator of the National Aeronautics and Space Administration. 7 | * All Rights Reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 10 | * not use this file except in compliance with the License. You may obtain 11 | * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | ************************************************************************/ 19 | 20 | /** 21 | * @file 22 | * Utility functions for the CFS Health and Safety (HS) application. 23 | */ 24 | 25 | /************************************************************************ 26 | ** Includes 27 | *************************************************************************/ 28 | #include "hs_app.h" 29 | #include "hs_utils.h" 30 | #include "hs_monitors.h" 31 | #include "hs_msgids.h" 32 | #include "hs_eventids.h" 33 | #include "hs_version.h" 34 | 35 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 36 | /* */ 37 | /* Verify AMT Action Type */ 38 | /* */ 39 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 40 | bool HS_AMTActionIsValid(uint16 ActionType) 41 | { 42 | bool IsValid = true; 43 | 44 | if (ActionType < HS_AMT_ACT_NOACT) 45 | { 46 | IsValid = false; 47 | } 48 | else if (ActionType > (HS_AMT_ACT_LAST_NONMSG + HS_MAX_MSG_ACT_TYPES)) 49 | { 50 | /* HS allows for HS_AMT_ACT_LAST_NONMSG actions by default and 51 | HS_MAX_MSG_ACT_TYPES message actions defined in the Message 52 | Action Table. */ 53 | IsValid = false; 54 | } 55 | 56 | return IsValid; 57 | } 58 | 59 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 60 | /* */ 61 | /* Verify EMT Action Type */ 62 | /* */ 63 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 64 | bool HS_EMTActionIsValid(uint16 ActionType) 65 | { 66 | bool IsValid = true; 67 | 68 | if (ActionType < HS_EMT_ACT_NOACT) 69 | { 70 | IsValid = false; 71 | } 72 | else if (ActionType > (HS_EMT_ACT_LAST_NONMSG + HS_MAX_MSG_ACT_TYPES)) 73 | { 74 | /* HS allows for HS_EMT_ACT_LAST_NONMSG actions by default and 75 | HS_MAX_MSG_ACT_TYPES message actions defined in the Message 76 | Action Table. */ 77 | IsValid = false; 78 | } 79 | 80 | return IsValid; 81 | } 82 | -------------------------------------------------------------------------------- /fsw/src/hs_utils.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,920-1, and identified as “Core Flight 3 | * System (cFS) Health & Safety (HS) Application version 2.4.1” 4 | * 5 | * Copyright (c) 2021 United States Government as represented by the 6 | * Administrator of the National Aeronautics and Space Administration. 7 | * All Rights Reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 10 | * not use this file except in compliance with the License. You may obtain 11 | * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | ************************************************************************/ 19 | 20 | /** 21 | * @file 22 | * Utility functions for the cFS Health and Safety (HS) application. 23 | */ 24 | #ifndef HS_UTILS_H 25 | #define HS_UTILS_H 26 | 27 | /************************************************************************* 28 | * Includes 29 | *************************************************************************/ 30 | #include "cfe.h" 31 | 32 | /** 33 | * \brief Verify AMT Action Type 34 | * 35 | * \par Description 36 | * Checks if the specified value is a valid AMT Action Type. 37 | * 38 | * \par Assumptions, External Events, and Notes: 39 | * None 40 | * 41 | * \param[in] ActionType Action type to validate 42 | * 43 | * \return Boolean action valid response 44 | * \retval true Action type valid 45 | * \retval false Action type not valid 46 | */ 47 | bool HS_AMTActionIsValid(uint16 ActionType); 48 | 49 | /** 50 | * \brief Verify EMT Action Type 51 | * 52 | * \par Description 53 | * Checks if the specified value is a valid EMT Action Type. 54 | * 55 | * \par Assumptions, External Events, and Notes: 56 | * None 57 | * 58 | * \param[in] ActionType Action type to validate 59 | * 60 | * \return Boolean action valid response 61 | * \retval true Action type valid 62 | * \retval false Action type not valid 63 | */ 64 | bool HS_EMTActionIsValid(uint16 ActionType); 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /fsw/src/hs_verify.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,920-1, and identified as “Core Flight 3 | * System (cFS) Health & Safety (HS) Application version 2.4.1” 4 | * 5 | * Copyright (c) 2021 United States Government as represented by the 6 | * Administrator of the National Aeronautics and Space Administration. 7 | * All Rights Reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 10 | * not use this file except in compliance with the License. You may obtain 11 | * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | ************************************************************************/ 19 | 20 | /** 21 | * @file 22 | * Contains CFS Health and Safety (HS) macros that run preprocessor checks 23 | * on mission and platform configurable parameters 24 | */ 25 | #ifndef HS_VERIFY_H 26 | #define HS_VERIFY_H 27 | 28 | /************************************************************************* 29 | * Macro Definitions 30 | *************************************************************************/ 31 | 32 | /* 33 | * Maximum number execution counters 34 | */ 35 | #if HS_MAX_EXEC_CNT_SLOTS < 1 36 | #error HS_MAX_EXEC_CNT_SLOTS cannot be less than 1 37 | #elif HS_MAX_EXEC_CNT_SLOTS > 4294967295 38 | #error HS_MAX_EXEC_CNT_SLOTS can not exceed 4294967295 39 | #endif 40 | 41 | /* 42 | * Maximum number of message actions 43 | */ 44 | #if HS_MAX_MSG_ACT_TYPES < 1 45 | #error HS_MAX_MSG_ACT_TYPES cannot be less than 1 46 | #elif HS_MAX_MSG_ACT_TYPES > 65531 47 | #error HS_MAX_MSG_ACT_TYPES can not exceed 65531 48 | #endif 49 | 50 | /* 51 | * Maximum length of message actions 52 | */ 53 | #ifdef MESSAGE_FORMAT_IS_CCSDS 54 | #if HS_MAX_MSG_ACT_SIZE < 7 55 | #error HS_MAX_MSG_ACT_SIZE cannot be less than 7 56 | #endif 57 | #else 58 | #if HS_MAX_MSG_ACT_SIZE < 1 59 | #error HS_MAX_MSG_ACT_SIZE cannot be less than 1 60 | #endif 61 | #endif 62 | 63 | #if HS_MAX_MSG_ACT_SIZE > CFE_MISSION_SB_MAX_SB_MSG_SIZE 64 | #error HS_MAX_MSG_ACT_SIZE can not exceed CFE_MISSION_SB_MAX_SB_MSG_SIZE 65 | #endif 66 | 67 | /* 68 | * Maximum number of monitored applications 69 | */ 70 | #if HS_MAX_MONITORED_APPS < 1 71 | #error HS_MAX_MONITORED_APPS cannot be less than 1 72 | #elif HS_MAX_MONITORED_APPS > 4294967295 73 | #error HS_MAX_MONITORED_APPS can not exceed 4294967295 74 | #endif 75 | 76 | /* 77 | * Maximum number of critical events 78 | */ 79 | #if HS_MAX_MONITORED_EVENTS < 1 80 | #error HS_MAX_MONITORED_EVENTS cannot be less than 1 81 | #elif HS_MAX_MONITORED_EVENTS > 4294967295 82 | #error HS_MAX_MONITORED_EVENTS can not exceed 4294967295 83 | #endif 84 | 85 | /* 86 | * JPH 2015-06-29 - Removed check of Watchdog timer values 87 | * 88 | * This is not a valid check anymore, as the HS app does not have knowledge 89 | * of PSP Watchdog definitions 90 | */ 91 | 92 | /* 93 | * Post Processing Delay 94 | */ 95 | #if HS_POST_PROCESSING_DELAY < 0 96 | #error HS_POST_PROCESSING_DELAY can not be less than 0 97 | #elif HS_POST_PROCESSING_DELAY > 4294967295 98 | #error HS_POST_PROCESSING_DELAY can not exceed 4294967295 99 | #endif 100 | 101 | /* 102 | * Wakeup Timeout 103 | */ 104 | #if (HS_WAKEUP_TIMEOUT < -1) || (HS_WAKEUP_TIMEOUT > 2147483647) 105 | #error HS_WAKEUP_TIMEOUT not defined as a proper SB Timeout value 106 | #endif 107 | 108 | /* 109 | * CPU Aliveness Period 110 | */ 111 | #if HS_CPU_ALIVE_PERIOD < 1 112 | #error HS_CPU_ALIVE_PERIOD cannot be less than 1 113 | #elif HS_CPU_ALIVE_PERIOD > 4294967295 114 | #error HS_CPU_ALIVE_PERIOD can not exceed 4294967295 115 | #endif 116 | 117 | /* 118 | * Maximum processor restart actions 119 | */ 120 | #if HS_MAX_RESTART_ACTIONS < 0 121 | #error HS_MAX_RESTART_ACTIONS can not be less than 0 122 | #elif HS_MAX_RESTART_ACTIONS > 65535 123 | #error HS_MAX_RESTART_ACTIONS can not exceed 65535 124 | #endif 125 | 126 | /* 127 | * Pipe depths 128 | */ 129 | #if HS_CMD_PIPE_DEPTH < 1 130 | #error HS_CMD_PIPE_DEPTH cannot be less than 1 131 | #endif 132 | 133 | /* 134 | * JPH 2015-06-29 - Removed check of: 135 | * HS_CMD_PIPE_DEPTH > CFE_SB_MAX_PIPE_DEPTH 136 | * 137 | * This is not a valid check anymore, as the HS app does not have knowledge 138 | * of CFE_SB_MAX_PIPE_DEPTH. But if the configuration violates this rule it will 139 | * show up as an obvious run-time error so the compile-time check is redundant. 140 | */ 141 | 142 | #if HS_EVENT_PIPE_DEPTH < 1 143 | #error HS_EVENT_PIPE_DEPTH cannot be less than 1 144 | #endif 145 | 146 | /* 147 | * JPH 2015-06-29 - Removed check of: 148 | * HS_EVENT_PIPE_DEPTH > CFE_SB_MAX_PIPE_DEPTH 149 | * 150 | * This is not a valid check anymore, as the HS app does not have knowledge 151 | * of CFE_SB_MAX_PIPE_DEPTH. But if the configuration violates this rule it will 152 | * show up as an obvious run-time error so the compile-time check is redundant. 153 | */ 154 | 155 | #if HS_WAKEUP_PIPE_DEPTH < 1 156 | #error HS_WAKEUP_PIPE_DEPTH cannot be less than 1 157 | #endif 158 | 159 | /* 160 | * JPH 2015-06-29 - Removed check of: 161 | * HS_WAKEUP_PIPE_DEPTH > CFE_SB_MAX_PIPE_DEPTH 162 | * 163 | * This is not a valid check anymore, as the HS app does not have knowledge 164 | * of CFE_SB_MAX_PIPE_DEPTH. But if the configuration violates this rule it will 165 | * show up as an obvious run-time error so the compile-time check is redundant. 166 | */ 167 | 168 | /* 169 | * Reset Task Delay 170 | */ 171 | #if HS_RESET_TASK_DELAY < 0 172 | #error HS_RESET_TASK_DELAY can not be less than 0 173 | #elif HS_RESET_TASK_DELAY > 4294967295 174 | #error HS_RESET_TASK_DELAY can not exceed 4294967295 175 | #endif 176 | 177 | /* 178 | * Startup Sync Timeout 179 | */ 180 | #if HS_STARTUP_SYNC_TIMEOUT < 0 181 | #error HS_STARTUP_SYNC_TIMEOUT can not be less than 0 182 | #elif HS_STARTUP_SYNC_TIMEOUT > 4294967295 183 | #error HS_STARTUP_SYNC_TIMEOUT can not exceed 4294967295 184 | #endif 185 | 186 | /* 187 | * Default Application Monitor State 188 | */ 189 | #if (HS_APPMON_DEFAULT_STATE != HS_STATE_DISABLED) && (HS_APPMON_DEFAULT_STATE != HS_STATE_ENABLED) 190 | #error HS_APPMON_DEFAULT_STATE not defined as a supported enumerated type 191 | #endif 192 | 193 | /* 194 | * Default Event Monitor State 195 | */ 196 | #if (HS_EVENTMON_DEFAULT_STATE != HS_STATE_DISABLED) && (HS_EVENTMON_DEFAULT_STATE != HS_STATE_ENABLED) 197 | #error HS_EVENTMON_DEFAULT_STATE not defined as a supported enumerated type 198 | #endif 199 | 200 | /* 201 | * Default Aliveness Indicator State 202 | */ 203 | #if (HS_ALIVENESS_DEFAULT_STATE != HS_STATE_DISABLED) && (HS_ALIVENESS_DEFAULT_STATE != HS_STATE_ENABLED) 204 | #error HS_ALIVENESS_DEFAULT_STATE not defined as a supported enumerated type 205 | #endif 206 | 207 | /* 208 | * Default CPU Hogging Indicator State 209 | */ 210 | #if (HS_CPUHOG_DEFAULT_STATE != HS_STATE_DISABLED) && (HS_CPUHOG_DEFAULT_STATE != HS_STATE_ENABLED) 211 | #error HS_CPUHOG_DEFAULT_STATE not defined as a supported enumerated type 212 | #endif 213 | 214 | /* 215 | * Total number of Utils per Interval 216 | */ 217 | #if HS_CPU_UTILIZATION_MAX < 1 218 | #error HS_CPU_UTILIZATION_MAX cannot be less than 1 219 | #elif HS_CPU_UTILIZATION_MAX > 4294967295 220 | #error HS_CPU_UTILIZATION_MAX can not exceed 4294967295 221 | #endif 222 | 223 | /* 224 | * Hogging number of Utils per Interval 225 | */ 226 | #if HS_UTIL_PER_INTERVAL_HOGGING < 1 227 | #error HS_UTIL_PER_INTERVAL_HOGGING cannot be less than 1 228 | #elif HS_UTIL_PER_INTERVAL_HOGGING > HS_CPU_UTILIZATION_MAX 229 | #error HS_UTIL_PER_INTERVAL_HOGGING can not exceed HS_CPU_UTILIZATION_MAX 230 | #endif 231 | 232 | /* 233 | * Hogging Timeout in Intervals 234 | */ 235 | #if HS_UTIL_HOGGING_TIMEOUT < 1 236 | #error HS_UTIL_HOGGING_TIMEOUT cannot be less than 1 237 | #elif HS_UTIL_HOGGING_TIMEOUT > 4294967295 238 | #error HS_UTIL_HOGGING_TIMEOUT can not exceed 4294967295 239 | #endif 240 | 241 | /* 242 | * Utilization Peak Number of Intervals 243 | */ 244 | #if HS_UTIL_PEAK_NUM_INTERVAL < 1 245 | #error HS_UTIL_PEAK_NUM_INTERVAL cannot be less than 1 246 | #elif HS_UTIL_PEAK_NUM_INTERVAL > 4294967295 247 | #error HS_UTIL_PEAK_NUM_INTERVAL can not exceed 4294967295 248 | #endif 249 | 250 | /* 251 | * Utilization Average Number of Intervals 252 | */ 253 | #if HS_UTIL_AVERAGE_NUM_INTERVAL < 1 254 | #error HS_UTIL_AVERAGE_NUM_INTERVAL cannot be less than 1 255 | #elif HS_UTIL_AVERAGE_NUM_INTERVAL > HS_UTIL_PEAK_NUM_INTERVAL 256 | #error HS_UTIL_AVERAGE_NUM_INTERVAL can not exceed HS_UTIL_PEAK_NUM_INTERVAL 257 | #endif 258 | 259 | #ifndef HS_MISSION_REV 260 | #error HS_MISSION_REV must be defined! 261 | #elif (HS_MISSION_REV < 0) 262 | #error HS_MISSION_REV must be greater than or equal to zero! 263 | #endif 264 | 265 | #endif 266 | -------------------------------------------------------------------------------- /fsw/src/hs_version.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,920-1, and identified as “Core Flight 3 | * System (cFS) Health & Safety (HS) Application version 2.4.1” 4 | * 5 | * Copyright (c) 2021 United States Government as represented by the 6 | * Administrator of the National Aeronautics and Space Administration. 7 | * All Rights Reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 10 | * not use this file except in compliance with the License. You may obtain 11 | * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | ************************************************************************/ 19 | 20 | /** 21 | * @file 22 | * Contains version tags for the Core Flight System (CFS) 23 | * Health and Safety (HS) Application. 24 | */ 25 | #ifndef HS_VERSION_H 26 | #define HS_VERSION_H 27 | 28 | /** 29 | * \defgroup cfshsversion CFS Health and Safety Version 30 | * \ref cfsversions 31 | * \{ 32 | */ 33 | 34 | #define HS_MAJOR_VERSION 2 /**< \brief Major version number */ 35 | #define HS_MINOR_VERSION 4 /**< \brief Minor version number */ 36 | #define HS_REVISION 99 /**< \brief Revision number */ 37 | 38 | /**\}*/ 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /fsw/tables/hs_amt.c: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,920-1, and identified as “Core Flight 3 | * System (cFS) Health & Safety (HS) Application version 2.4.1” 4 | * 5 | * Copyright (c) 2021 United States Government as represented by the 6 | * Administrator of the National Aeronautics and Space Administration. 7 | * All Rights Reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 10 | * not use this file except in compliance with the License. You may obtain 11 | * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | ************************************************************************/ 19 | 20 | /** 21 | * @file 22 | * The CFS Health and Safety (HS) Applications Monitor Table Definition 23 | */ 24 | 25 | /************************************************************************ 26 | ** Includes 27 | *************************************************************************/ 28 | #include "cfe.h" 29 | #include "hs_mission_cfg.h" 30 | #include "hs_tbl.h" 31 | #include "hs_tbldefs.h" 32 | #include "cfe_tbl_filedef.h" 33 | 34 | HS_AMTEntry_t HS_AppMon_Tbl[HS_MAX_MONITORED_APPS] = { 35 | /* AppName NullTerm CycleCount ActionType */ 36 | 37 | /* 0 */ {"CFE_ES", 0, 10, HS_AMT_ACT_NOACT}, 38 | /* 1 */ {"CFE_EVS", 0, 10, HS_AMT_ACT_NOACT}, 39 | /* 2 */ {"CFE_TIME", 0, 10, HS_AMT_ACT_NOACT}, 40 | /* 3 */ {"CFE_TBL", 0, 10, HS_AMT_ACT_NOACT}, 41 | /* 4 */ {"CFE_SB", 0, 10, HS_AMT_ACT_NOACT}, 42 | /* 5 */ {"", 0, 10, HS_AMT_ACT_NOACT}, 43 | /* 6 */ {"", 0, 10, HS_AMT_ACT_NOACT}, 44 | /* 7 */ {"", 0, 10, HS_AMT_ACT_NOACT}, 45 | /* 8 */ {"", 0, 10, HS_AMT_ACT_NOACT}, 46 | /* 9 */ {"", 0, 10, HS_AMT_ACT_NOACT}, 47 | /* 10 */ {"", 0, 10, HS_AMT_ACT_NOACT}, 48 | /* 11 */ {"", 0, 10, HS_AMT_ACT_NOACT}, 49 | /* 12 */ {"", 0, 10, HS_AMT_ACT_NOACT}, 50 | /* 13 */ {"", 0, 10, HS_AMT_ACT_NOACT}, 51 | /* 14 */ {"", 0, 10, HS_AMT_ACT_NOACT}, 52 | /* 15 */ {"", 0, 10, HS_AMT_ACT_NOACT}, 53 | /* 16 */ {"", 0, 10, HS_AMT_ACT_NOACT}, 54 | /* 17 */ {"", 0, 10, HS_AMT_ACT_NOACT}, 55 | /* 18 */ {"", 0, 10, HS_AMT_ACT_NOACT}, 56 | /* 19 */ {"", 0, 10, HS_AMT_ACT_NOACT}, 57 | /* 20 */ {"", 0, 10, HS_AMT_ACT_NOACT}, 58 | /* 21 */ {"", 0, 10, HS_AMT_ACT_NOACT}, 59 | /* 22 */ {"", 0, 10, HS_AMT_ACT_NOACT}, 60 | /* 23 */ {"", 0, 10, HS_AMT_ACT_NOACT}, 61 | /* 24 */ {"", 0, 10, HS_AMT_ACT_NOACT}, 62 | /* 25 */ {"", 0, 10, HS_AMT_ACT_NOACT}, 63 | /* 26 */ {"", 0, 10, HS_AMT_ACT_NOACT}, 64 | /* 27 */ {"", 0, 10, HS_AMT_ACT_NOACT}, 65 | /* 28 */ {"", 0, 10, HS_AMT_ACT_NOACT}, 66 | /* 29 */ {"", 0, 10, HS_AMT_ACT_NOACT}, 67 | /* 30 */ {"", 0, 10, HS_AMT_ACT_NOACT}, 68 | /* 31 */ {"", 0, 10, HS_AMT_ACT_NOACT}, 69 | }; 70 | 71 | CFE_TBL_FILEDEF(HS_AppMon_Tbl, HS.AppMon_Tbl, HS AppMon Table, hs_amt.tbl) 72 | -------------------------------------------------------------------------------- /fsw/tables/hs_emt.c: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,920-1, and identified as “Core Flight 3 | * System (cFS) Health & Safety (HS) Application version 2.4.1” 4 | * 5 | * Copyright (c) 2021 United States Government as represented by the 6 | * Administrator of the National Aeronautics and Space Administration. 7 | * All Rights Reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 10 | * not use this file except in compliance with the License. You may obtain 11 | * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | ************************************************************************/ 19 | 20 | /** 21 | * @file 22 | * The CFS Health and Safety (HS) Event Monitor Table Definition 23 | */ 24 | 25 | /************************************************************************ 26 | ** Includes 27 | *************************************************************************/ 28 | #include "cfe.h" 29 | #include "hs_mission_cfg.h" 30 | #include "hs_tbl.h" 31 | #include "hs_tbldefs.h" 32 | #include "cfe_tbl_filedef.h" 33 | 34 | CFE_TBL_FileDef_t CFE_TBL_FileDef = {"HS_EventMon_Tbl", HS_APP_NAME ".EventMon_Tbl", "HS EventMon Table", "hs_emt.tbl", 35 | (sizeof(HS_EMTEntry_t) * HS_MAX_MONITORED_EVENTS)}; 36 | 37 | HS_EMTEntry_t HS_EventMon_Tbl[HS_MAX_MONITORED_EVENTS] = { 38 | /* AppName NullTerm EventID ActionType */ 39 | 40 | /* 0 */ {"CFE_ES", 0, 10, HS_EMT_ACT_NOACT}, 41 | /* 1 */ {"CFE_EVS", 0, 10, HS_EMT_ACT_NOACT}, 42 | /* 2 */ {"CFE_TIME", 0, 10, HS_EMT_ACT_NOACT}, 43 | /* 3 */ {"CFE_TBL", 0, 10, HS_EMT_ACT_NOACT}, 44 | /* 4 */ {"CFE_SB", 0, 10, HS_EMT_ACT_NOACT}, 45 | /* 5 */ {"", 0, 10, HS_EMT_ACT_NOACT}, 46 | /* 6 */ {"", 0, 10, HS_EMT_ACT_NOACT}, 47 | /* 7 */ {"", 0, 10, HS_EMT_ACT_NOACT}, 48 | /* 8 */ {"", 0, 10, HS_EMT_ACT_NOACT}, 49 | /* 9 */ {"", 0, 10, HS_EMT_ACT_NOACT}, 50 | /* 10 */ {"", 0, 10, HS_EMT_ACT_NOACT}, 51 | /* 11 */ {"", 0, 10, HS_EMT_ACT_NOACT}, 52 | /* 12 */ {"", 0, 10, HS_EMT_ACT_NOACT}, 53 | /* 13 */ {"", 0, 10, HS_EMT_ACT_NOACT}, 54 | /* 14 */ {"", 0, 10, HS_EMT_ACT_NOACT}, 55 | /* 15 */ {"", 0, 10, HS_EMT_ACT_NOACT}, 56 | }; 57 | -------------------------------------------------------------------------------- /fsw/tables/hs_mat.c: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,920-1, and identified as “Core Flight 3 | * System (cFS) Health & Safety (HS) Application version 2.4.1” 4 | * 5 | * Copyright (c) 2021 United States Government as represented by the 6 | * Administrator of the National Aeronautics and Space Administration. 7 | * All Rights Reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 10 | * not use this file except in compliance with the License. You may obtain 11 | * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | ************************************************************************/ 19 | 20 | /** 21 | * @file 22 | * The CFS Health and Safety (HS) Message Actions Table Definition 23 | */ 24 | 25 | /************************************************************************ 26 | ** Includes 27 | *************************************************************************/ 28 | #include "cfe.h" 29 | #include "hs_mission_cfg.h" 30 | #include "hs_tbl.h" 31 | #include "hs_tbldefs.h" 32 | #include "cfe_tbl_filedef.h" 33 | 34 | #include "cfe_tbl_msg.h" 35 | #include "cfe_es_msg.h" 36 | #include "cfe_msgids.h" 37 | 38 | /* Checksum for each desired command - Note that if checksum is enabled, real values (non-zero) must be input */ 39 | #ifndef CFE_TBL_NOOP_CKSUM 40 | #define CFE_TBL_NOOP_CKSUM 0x00 41 | #endif 42 | 43 | #ifndef CFE_ES_NOOP_CKSUM 44 | #define CFE_ES_NOOP_CKSUM 0x00 45 | #endif 46 | 47 | /* Desired Command Types. Note - HS_MAX_MSG_ACT_SIZE should be sized appropriately given desired cmd types */ 48 | typedef union 49 | { 50 | CFE_TBL_NoopCmd_t cmd1; /**< \brief Desired cmd1 type */ 51 | CFE_ES_NoopCmd_t cmd2; /**< \brief Desired cmd2 type */ 52 | HS_MATMsgBuf_t MsgBuf; /**< \brief Message Buffer for alignment */ 53 | } HS_Message; 54 | 55 | /* MAT Table Entry Structure */ 56 | typedef struct 57 | { 58 | uint16 EnableState; /**< \brief If entry contains message */ 59 | uint16 Cooldown; /**< \brief Maximum rate at which message can be sent */ 60 | HS_Message HsMsg; /**< \brief HS Message/Command Entry */ 61 | } HS_MatTableEntry_t; 62 | 63 | /* Helper macro to get size of structure elements */ 64 | #define HS_MEMBER_SIZE(member) (sizeof(((HS_Message *)0)->member)) 65 | 66 | HS_MatTableEntry_t HS_MsgActs_Tbl[HS_MAX_MSG_ACT_TYPES] = { 67 | /* EnableState Cooldown Message */ 68 | 69 | /* 0 */ 70 | {.EnableState = HS_MAT_STATE_ENABLED, 71 | .Cooldown = 10, 72 | .HsMsg.cmd1 = {CFE_MSG_CMD_HDR_INIT(CFE_TBL_CMD_MID, HS_MEMBER_SIZE(cmd1), CFE_TBL_NOOP_CC, CFE_TBL_NOOP_CKSUM)}}, 73 | /* 1 */ 74 | {.EnableState = HS_MAT_STATE_ENABLED, 75 | .Cooldown = 10, 76 | .HsMsg.cmd2 = {CFE_MSG_CMD_HDR_INIT(CFE_ES_CMD_MID, HS_MEMBER_SIZE(cmd2), CFE_ES_NOOP_CC, CFE_ES_NOOP_CKSUM)}}, 77 | /* 2 */ 78 | {.EnableState = HS_MAT_STATE_DISABLED, 79 | .Cooldown = 10, 80 | .HsMsg.cmd1 = {CFE_MSG_CMD_HDR_INIT(CFE_TBL_CMD_MID, HS_MEMBER_SIZE(cmd1), CFE_TBL_NOOP_CC, CFE_TBL_NOOP_CKSUM)}}, 81 | /* 3 */ 82 | {.EnableState = HS_MAT_STATE_DISABLED, 83 | .Cooldown = 10, 84 | .HsMsg.cmd1 = {CFE_MSG_CMD_HDR_INIT(CFE_TBL_CMD_MID, HS_MEMBER_SIZE(cmd1), CFE_TBL_NOOP_CC, CFE_TBL_NOOP_CKSUM)}}, 85 | /* 4 */ 86 | {.EnableState = HS_MAT_STATE_DISABLED, 87 | .Cooldown = 10, 88 | .HsMsg.cmd1 = {CFE_MSG_CMD_HDR_INIT(CFE_TBL_CMD_MID, HS_MEMBER_SIZE(cmd1), CFE_TBL_NOOP_CC, CFE_TBL_NOOP_CKSUM)}}, 89 | /* 5 */ 90 | {.EnableState = HS_MAT_STATE_DISABLED, 91 | .Cooldown = 10, 92 | .HsMsg.cmd1 = {CFE_MSG_CMD_HDR_INIT(CFE_TBL_CMD_MID, HS_MEMBER_SIZE(cmd1), CFE_TBL_NOOP_CC, CFE_TBL_NOOP_CKSUM)}}, 93 | /* 6 */ 94 | {.EnableState = HS_MAT_STATE_DISABLED, 95 | .Cooldown = 10, 96 | .HsMsg.cmd1 = {CFE_MSG_CMD_HDR_INIT(CFE_TBL_CMD_MID, HS_MEMBER_SIZE(cmd1), CFE_TBL_NOOP_CC, CFE_TBL_NOOP_CKSUM)}}, 97 | /* 7 */ 98 | {.EnableState = HS_MAT_STATE_DISABLED, 99 | .Cooldown = 10, 100 | .HsMsg.cmd1 = {CFE_MSG_CMD_HDR_INIT(CFE_TBL_CMD_MID, HS_MEMBER_SIZE(cmd1), CFE_TBL_NOOP_CC, CFE_TBL_NOOP_CKSUM)}} 101 | 102 | }; 103 | 104 | CFE_TBL_FILEDEF(HS_MsgActs_Tbl, HS.MsgActs_Tbl, HS MsgActs Table, hs_mat.tbl) -------------------------------------------------------------------------------- /fsw/tables/hs_xct.c: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,920-1, and identified as “Core Flight 3 | * System (cFS) Health & Safety (HS) Application version 2.4.1” 4 | * 5 | * Copyright (c) 2021 United States Government as represented by the 6 | * Administrator of the National Aeronautics and Space Administration. 7 | * All Rights Reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 10 | * not use this file except in compliance with the License. You may obtain 11 | * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | ************************************************************************/ 19 | 20 | /** 21 | * @file 22 | * The CFS Health and Safety (HS) Execution Counters Table Definition 23 | */ 24 | 25 | /************************************************************************ 26 | ** Includes 27 | *************************************************************************/ 28 | #include "cfe.h" 29 | #include "hs_mission_cfg.h" 30 | #include "hs_tbl.h" 31 | #include "hs_tbldefs.h" 32 | #include "cfe_tbl_filedef.h" 33 | 34 | HS_XCTEntry_t HS_ExeCount_Tbl[HS_MAX_EXEC_CNT_SLOTS] = { 35 | /* ResourceName NullTerm ResourceType */ 36 | 37 | /* 0 */ {"CFE_ES", 0, HS_XCT_TYPE_APP_MAIN}, 38 | /* 1 */ {"CFE_EVS", 0, HS_XCT_TYPE_APP_MAIN}, 39 | /* 2 */ {"CFE_TIME", 0, HS_XCT_TYPE_APP_MAIN}, 40 | /* 3 */ {"CFE_TBL", 0, HS_XCT_TYPE_APP_MAIN}, 41 | /* 4 */ {"CFE_SB", 0, HS_XCT_TYPE_APP_MAIN}, 42 | /* 5 */ {"", 0, HS_XCT_TYPE_NOTYPE}, 43 | /* 6 */ {"", 0, HS_XCT_TYPE_NOTYPE}, 44 | /* 7 */ {"", 0, HS_XCT_TYPE_NOTYPE}, 45 | /* 8 */ {"", 0, HS_XCT_TYPE_NOTYPE}, 46 | /* 9 */ {"", 0, HS_XCT_TYPE_NOTYPE}, 47 | /* 10 */ {"", 0, HS_XCT_TYPE_NOTYPE}, 48 | /* 11 */ {"", 0, HS_XCT_TYPE_NOTYPE}, 49 | /* 12 */ {"", 0, HS_XCT_TYPE_NOTYPE}, 50 | /* 13 */ {"", 0, HS_XCT_TYPE_NOTYPE}, 51 | /* 14 */ {"", 0, HS_XCT_TYPE_NOTYPE}, 52 | /* 15 */ {"", 0, HS_XCT_TYPE_NOTYPE}, 53 | /* 16 */ {"", 0, HS_XCT_TYPE_NOTYPE}, 54 | /* 17 */ {"", 0, HS_XCT_TYPE_NOTYPE}, 55 | /* 18 */ {"", 0, HS_XCT_TYPE_NOTYPE}, 56 | /* 19 */ {"", 0, HS_XCT_TYPE_NOTYPE}, 57 | /* 20 */ {"", 0, HS_XCT_TYPE_NOTYPE}, 58 | /* 21 */ {"", 0, HS_XCT_TYPE_NOTYPE}, 59 | /* 22 */ {"", 0, HS_XCT_TYPE_NOTYPE}, 60 | /* 23 */ {"", 0, HS_XCT_TYPE_NOTYPE}, 61 | /* 24 */ {"", 0, HS_XCT_TYPE_NOTYPE}, 62 | /* 25 */ {"", 0, HS_XCT_TYPE_NOTYPE}, 63 | /* 26 */ {"", 0, HS_XCT_TYPE_NOTYPE}, 64 | /* 27 */ {"", 0, HS_XCT_TYPE_NOTYPE}, 65 | /* 28 */ {"", 0, HS_XCT_TYPE_NOTYPE}, 66 | /* 29 */ {"", 0, HS_XCT_TYPE_NOTYPE}, 67 | /* 30 */ {"", 0, HS_XCT_TYPE_NOTYPE}, 68 | /* 31 */ {"", 0, HS_XCT_TYPE_NOTYPE}, 69 | }; 70 | 71 | CFE_TBL_FILEDEF(HS_ExeCount_Tbl, HS.ExeCount_Tbl, HS ExeCount Table, hs_xct.tbl) 72 | -------------------------------------------------------------------------------- /mission_build.cmake: -------------------------------------------------------------------------------- 1 | ########################################################### 2 | # 3 | # HS App mission build setup 4 | # 5 | # This file is evaluated as part of the "prepare" stage 6 | # and can be used to set up prerequisites for the build, 7 | # such as generating header files 8 | # 9 | ########################################################### 10 | 11 | # Add stand alone documentation 12 | add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/docs/dox_src ${MISSION_BINARY_DIR}/docs/hs-usersguide) 13 | 14 | # The list of header files that control the HS configuration 15 | set(HS_MISSION_CONFIG_FILE_LIST 16 | hs_fcncodes.h 17 | hs_interface_cfg.h 18 | hs_mission_cfg.h 19 | hs_msgdefs.h 20 | hs_msg.h 21 | hs_msgstruct.h 22 | hs_tbldefs.h 23 | hs_tbl.h 24 | hs_tblstruct.h 25 | hs_topicids.h 26 | ) 27 | 28 | if (CFE_EDS_ENABLED_BUILD) 29 | 30 | # In an EDS-based build, these files come generated from the EDS tool 31 | set(HS_CFGFILE_SRC_hs_interface_cfg "hs_eds_designparameters.h") 32 | set(HS_CFGFILE_SRC_hs_fcncodes "hs_eds_cc.h") 33 | set(HS_CFGFILE_SRC_hs_msgstruct "hs_eds_typedefs.h") 34 | set(HS_CFGFILE_SRC_hs_tblstruct "hs_eds_typedefs.h") 35 | 36 | endif(CFE_EDS_ENABLED_BUILD) 37 | 38 | # Create wrappers around the all the config header files 39 | # This makes them individually overridable by the missions, without modifying 40 | # the distribution default copies 41 | foreach(HS_CFGFILE ${HS_MISSION_CONFIG_FILE_LIST}) 42 | get_filename_component(CFGKEY "${HS_CFGFILE}" NAME_WE) 43 | if (DEFINED HS_CFGFILE_SRC_${CFGKEY}) 44 | set(DEFAULT_SOURCE GENERATED_FILE "${HS_CFGFILE_SRC_${CFGKEY}}") 45 | else() 46 | set(DEFAULT_SOURCE FALLBACK_FILE "${CMAKE_CURRENT_LIST_DIR}/config/default_${HS_CFGFILE}") 47 | endif() 48 | generate_config_includefile( 49 | FILE_NAME "${HS_CFGFILE}" 50 | ${DEFAULT_SOURCE} 51 | ) 52 | endforeach() 53 | -------------------------------------------------------------------------------- /unit-test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ################################################################## 2 | # 3 | # Unit Test build recipe 4 | # 5 | # This CMake file contains the recipe for building cFS app unit tests. 6 | # It is invoked from the parent directory when unit tests are enabled. 7 | # 8 | ################################################################## 9 | 10 | add_cfe_coverage_stubs("hs_internal" 11 | utilities/hs_test_utils.c 12 | stubs/hs_global_stubs.c 13 | stubs/hs_app_stubs.c 14 | stubs/hs_cmds_stubs.c 15 | stubs/hs_dispatch_stubs.c 16 | stubs/hs_monitors_stubs.c 17 | stubs/hs_utils_stubs.c 18 | stubs/hs_sysmon_stubs.c 19 | ) 20 | 21 | # Link with the cfe core stubs and unit test assert libs 22 | target_link_libraries(coverage-hs_internal-stubs ut_core_api_stubs ut_assert) 23 | 24 | # Include and expose unit test utilities, fsw/inc, and fsw/src includes 25 | target_include_directories(coverage-hs_internal-stubs PUBLIC utilities) 26 | target_include_directories(coverage-hs_internal-stubs PUBLIC ../fsw/inc) 27 | target_include_directories(coverage-hs_internal-stubs PUBLIC ../fsw/src) 28 | 29 | # Generate a dedicated "testrunner" executable for each test file 30 | # Accomplish this by cycling through all the app's source files, there must be 31 | # a *_tests file for each 32 | foreach(SRCFILE ${APP_SRC_FILES}) 33 | 34 | # Get the base sourcefile name as a module name without path or the 35 | # extension, this will be used as the base name of the unit test file. 36 | get_filename_component(UNIT_NAME "${SRCFILE}" NAME_WE) 37 | 38 | # Use the module name to make the test name by adding _tests to the end 39 | set(TESTS_NAME "${UNIT_NAME}_tests") 40 | 41 | # Make the test sourcefile name with unit test path and extension 42 | set(TESTS_SOURCE_FILE "${PROJECT_SOURCE_DIR}/unit-test/${TESTS_NAME}.c") 43 | 44 | add_cfe_coverage_test(hs "${UNIT_NAME}" "${TESTS_SOURCE_FILE}" "${CFS_HS_SOURCE_DIR}/${SRCFILE}") 45 | 46 | add_cfe_coverage_dependency(hs "${UNIT_NAME}" hs_internal) 47 | 48 | endforeach() 49 | -------------------------------------------------------------------------------- /unit-test/hs_eds_dispatch_tests.c: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,920-1, and identified as “Core Flight 3 | * System (cFS) Health & Safety (HS) Application version 2.4.1” 4 | * 5 | * Copyright (c) 2021 United States Government as represented by the 6 | * Administrator of the National Aeronautics and Space Administration. 7 | * All Rights Reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 10 | * not use this file except in compliance with the License. You may obtain 11 | * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | ************************************************************************/ 19 | 20 | /* 21 | * Includes 22 | */ 23 | 24 | #include "hs_cmds.h" 25 | #include "hs_test_utils.h" 26 | #include "hs_dispatch.h" 27 | #include "hs_msgids.h" 28 | 29 | /* UT includes */ 30 | #include "uttest.h" 31 | #include "utassert.h" 32 | #include "utstubs.h" 33 | 34 | #include "cfe.h" 35 | #include "cfe_msg_dispatcher.h" 36 | 37 | /* 38 | ********************************************************************************** 39 | ** TEST CASE FUNCTIONS 40 | ********************************************************************************** 41 | */ 42 | 43 | void Test_HS_AppPipe(void) 44 | { 45 | /* 46 | * Test Case For: 47 | * void HS_AppPipe 48 | */ 49 | CFE_SB_Buffer_t UtBuf; 50 | 51 | UT_SetDeferredRetcode(UT_KEY(CFE_MSG_EdsDispatch), 1, CFE_SUCCESS); 52 | 53 | memset(&UtBuf, 0, sizeof(UtBuf)); 54 | UtAssert_VOIDCALL(HS_AppPipe(&UtBuf)); 55 | } 56 | 57 | /* 58 | * Register the test cases to execute with the unit test tool 59 | */ 60 | void UtTest_Setup(void) 61 | { 62 | UtTest_Add(Test_HS_AppPipe, HS_Test_Setup, HS_Test_TearDown, "Test_HS_AppPipe"); 63 | } 64 | -------------------------------------------------------------------------------- /unit-test/hs_sysmon_tests.c: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,920-1, and identified as “Core Flight 3 | * System (cFS) Health & Safety (HS) Application version 2.4.1” 4 | * 5 | * Copyright (c) 2021 United States Government as represented by the 6 | * Administrator of the National Aeronautics and Space Administration. 7 | * All Rights Reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 10 | * not use this file except in compliance with the License. You may obtain 11 | * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | ************************************************************************/ 19 | 20 | /* 21 | * Includes 22 | */ 23 | 24 | #include "hs_sysmon.h" 25 | #include "hs_app.h" 26 | #include "hs_platform_cfg.h" 27 | #include "hs_test_utils.h" 28 | 29 | #include "cfe_psp.h" 30 | #include "iodriver_base.h" 31 | 32 | /* UT includes */ 33 | #include "uttest.h" 34 | #include "utassert.h" 35 | #include "utstubs.h" 36 | 37 | #include 38 | 39 | void Test_HS_SysMonInit(void) 40 | { 41 | /* Test function for: 42 | * int32 HS_SysMonInit(void) 43 | */ 44 | 45 | /* nominal */ 46 | UtAssert_INT32_EQ(HS_SysMonInit(), CFE_SUCCESS); 47 | 48 | /* fail to find device - this is a non-fatal error */ 49 | UT_SetDeferredRetcode(UT_KEY(CFE_PSP_IODriver_FindByName), 1, CFE_PSP_ERROR); 50 | UtAssert_INT32_EQ(HS_SysMonInit(), CFE_SUCCESS); 51 | 52 | /* fail to start device - this is an error */ 53 | UT_SetDeferredRetcode(UT_KEY(CFE_PSP_IODriver_Command), 1, CFE_PSP_ERROR); 54 | UtAssert_INT32_EQ(HS_SysMonInit(), CFE_STATUS_EXTERNAL_RESOURCE_FAIL); 55 | 56 | /* fail to lookup subsystem - non-fatal */ 57 | UT_SetDeferredRetcode(UT_KEY(CFE_PSP_IODriver_Command), 2, CFE_PSP_ERROR); 58 | UtAssert_INT32_EQ(HS_SysMonInit(), CFE_SUCCESS); 59 | 60 | /* fail to lookup subchannel - non-fatal */ 61 | UT_SetDeferredRetcode(UT_KEY(CFE_PSP_IODriver_Command), 3, CFE_PSP_ERROR); 62 | UtAssert_INT32_EQ(HS_SysMonInit(), CFE_SUCCESS); 63 | } 64 | 65 | void Test_HS_SysMonCleanup(void) 66 | { 67 | /* Test function for: 68 | * void HS_SysMonCleanup(void) 69 | */ 70 | 71 | /* nominal - no psp module */ 72 | HS_AppData.SysMonPspModuleId = 0; 73 | UtAssert_VOIDCALL(HS_SysMonCleanup()); 74 | 75 | /* nominal - with psp module */ 76 | HS_AppData.SysMonPspModuleId = 0x1111; 77 | UtAssert_VOIDCALL(HS_SysMonCleanup()); 78 | 79 | /* Unable to stop */ 80 | UT_SetDeferredRetcode(UT_KEY(CFE_PSP_IODriver_Command), 1, CFE_PSP_ERROR); 81 | UtAssert_VOIDCALL(HS_SysMonCleanup()); 82 | } 83 | 84 | void Test_HS_SysMonGetCpuUtilization(void) 85 | { 86 | /* Test function for: 87 | * int32 HS_SysMonGetCpuUtilization(void) 88 | */ 89 | 90 | /* nominal - no psp module, reports -1 */ 91 | HS_AppData.SysMonPspModuleId = 0; 92 | UtAssert_INT32_EQ(HS_SysMonGetCpuUtilization(), -1); 93 | 94 | /* nominal - with psp module */ 95 | HS_AppData.SysMonPspModuleId = 0x1111; 96 | UtAssert_INT32_EQ(HS_SysMonGetCpuUtilization(), 0); 97 | 98 | /* error reading from psp module, reports -1 */ 99 | UT_SetDeferredRetcode(UT_KEY(CFE_PSP_IODriver_Command), 1, CFE_PSP_ERROR); 100 | UtAssert_INT32_EQ(HS_SysMonGetCpuUtilization(), -1); 101 | } 102 | 103 | /* 104 | * Register the test cases to execute with the unit test tool 105 | */ 106 | void UtTest_Setup(void) 107 | { 108 | UtTest_Add(Test_HS_SysMonInit, HS_Test_Setup, HS_Test_TearDown, "Test_HS_SysMonInit"); 109 | 110 | UtTest_Add(Test_HS_SysMonCleanup, HS_Test_Setup, HS_Test_TearDown, "Test_HS_SysMonCleanup"); 111 | UtTest_Add(Test_HS_SysMonGetCpuUtilization, HS_Test_Setup, HS_Test_TearDown, "Test_HS_SysMonGetCpuUtilization"); 112 | } 113 | -------------------------------------------------------------------------------- /unit-test/hs_utils_tests.c: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,920-1, and identified as “Core Flight 3 | * System (cFS) Health & Safety (HS) Application version 2.4.1” 4 | * 5 | * Copyright (c) 2021 United States Government as represented by the 6 | * Administrator of the National Aeronautics and Space Administration. 7 | * All Rights Reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 10 | * not use this file except in compliance with the License. You may obtain 11 | * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | ************************************************************************/ 19 | 20 | /* 21 | * Includes 22 | */ 23 | 24 | #include "hs_test_utils.h" 25 | #include "hs_msgids.h" 26 | 27 | /* UT includes */ 28 | #include "uttest.h" 29 | #include "utassert.h" 30 | #include "utstubs.h" 31 | 32 | #include 33 | #include 34 | #include "cfe.h" 35 | #include "cfe_msgids.h" 36 | 37 | /* hs_utils_tests globals */ 38 | uint8 call_count_CFE_EVS_SendEvent; 39 | 40 | /* 41 | * Function Definitions 42 | */ 43 | 44 | void HS_AMTActionIsValid_Valid(void) 45 | { 46 | uint16 Action = (HS_AMT_ACT_LAST_NONMSG + HS_MAX_MSG_ACT_TYPES); 47 | 48 | bool Result = HS_AMTActionIsValid(Action); 49 | 50 | UtAssert_True(Result == true, "Result == true"); 51 | } 52 | 53 | void HS_AMTActionIsValid_Invalid(void) 54 | { 55 | uint16 Action = (HS_AMT_ACT_LAST_NONMSG + HS_MAX_MSG_ACT_TYPES + 1); 56 | 57 | bool Result = HS_AMTActionIsValid(Action); 58 | 59 | UtAssert_True(Result == false, "Result == false"); 60 | } 61 | 62 | void HS_EMTActionIsValid_Valid(void) 63 | { 64 | uint16 Action = (HS_EMT_ACT_LAST_NONMSG + HS_MAX_MSG_ACT_TYPES); 65 | 66 | bool Result = HS_EMTActionIsValid(Action); 67 | 68 | UtAssert_True(Result == true, "Result == true"); 69 | } 70 | 71 | void HS_EMTActionIsValid_Invalid(void) 72 | { 73 | uint16 Action = (HS_EMT_ACT_LAST_NONMSG + HS_MAX_MSG_ACT_TYPES + 1); 74 | 75 | bool Result = HS_EMTActionIsValid(Action); 76 | 77 | UtAssert_True(Result == false, "Result == false"); 78 | } 79 | 80 | /* 81 | * Register the test cases to execute with the unit test tool 82 | */ 83 | void UtTest_Setup(void) 84 | { 85 | UtTest_Add(HS_AMTActionIsValid_Valid, HS_Test_Setup, HS_Test_TearDown, "HS_AMTActionIsValid_Valid"); 86 | 87 | UtTest_Add(HS_AMTActionIsValid_Invalid, HS_Test_Setup, HS_Test_TearDown, "HS_AMTActionIsValid_Invalid"); 88 | 89 | UtTest_Add(HS_EMTActionIsValid_Valid, HS_Test_Setup, HS_Test_TearDown, "HS_EMTActionIsValid_Valid"); 90 | 91 | UtTest_Add(HS_EMTActionIsValid_Invalid, HS_Test_Setup, HS_Test_TearDown, "HS_EMTActionIsValid_Invalid"); 92 | } 93 | -------------------------------------------------------------------------------- /unit-test/stubs/hs_app_stubs.c: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,920-1, and identified as “Core Flight 3 | * System (cFS) Health & Safety (HS) Application version 2.4.1” 4 | * 5 | * Copyright (c) 2021 United States Government as represented by the 6 | * Administrator of the National Aeronautics and Space Administration. 7 | * All Rights Reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 10 | * not use this file except in compliance with the License. You may obtain 11 | * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | ************************************************************************/ 19 | 20 | /** 21 | * @file 22 | * 23 | * Auto-Generated stub implementations for functions defined in hs_app header 24 | */ 25 | 26 | #include "hs_app.h" 27 | #include "utgenstub.h" 28 | 29 | /* 30 | * ---------------------------------------------------- 31 | * Generated stub function for HS_AppInit() 32 | * ---------------------------------------------------- 33 | */ 34 | CFE_Status_t HS_AppInit(void) 35 | { 36 | UT_GenStub_SetupReturnBuffer(HS_AppInit, CFE_Status_t); 37 | 38 | UT_GenStub_Execute(HS_AppInit, Basic, NULL); 39 | 40 | return UT_GenStub_GetReturnValue(HS_AppInit, CFE_Status_t); 41 | } 42 | 43 | /* 44 | * ---------------------------------------------------- 45 | * Generated stub function for HS_AppMain() 46 | * ---------------------------------------------------- 47 | */ 48 | void HS_AppMain(void) 49 | { 50 | 51 | UT_GenStub_Execute(HS_AppMain, Basic, NULL); 52 | } 53 | 54 | /* 55 | * ---------------------------------------------------- 56 | * Generated stub function for HS_ProcessCommands() 57 | * ---------------------------------------------------- 58 | */ 59 | CFE_Status_t HS_ProcessCommands(void) 60 | { 61 | UT_GenStub_SetupReturnBuffer(HS_ProcessCommands, CFE_Status_t); 62 | 63 | UT_GenStub_Execute(HS_ProcessCommands, Basic, NULL); 64 | 65 | return UT_GenStub_GetReturnValue(HS_ProcessCommands, CFE_Status_t); 66 | } 67 | 68 | /* 69 | * ---------------------------------------------------- 70 | * Generated stub function for HS_ProcessMain() 71 | * ---------------------------------------------------- 72 | */ 73 | CFE_Status_t HS_ProcessMain(void) 74 | { 75 | UT_GenStub_SetupReturnBuffer(HS_ProcessMain, CFE_Status_t); 76 | 77 | UT_GenStub_Execute(HS_ProcessMain, Basic, NULL); 78 | 79 | return UT_GenStub_GetReturnValue(HS_ProcessMain, CFE_Status_t); 80 | } 81 | 82 | /* 83 | * ---------------------------------------------------- 84 | * Generated stub function for HS_SbInit() 85 | * ---------------------------------------------------- 86 | */ 87 | CFE_Status_t HS_SbInit(void) 88 | { 89 | UT_GenStub_SetupReturnBuffer(HS_SbInit, CFE_Status_t); 90 | 91 | UT_GenStub_Execute(HS_SbInit, Basic, NULL); 92 | 93 | return UT_GenStub_GetReturnValue(HS_SbInit, CFE_Status_t); 94 | } 95 | 96 | /* 97 | * ---------------------------------------------------- 98 | * Generated stub function for HS_TblInit() 99 | * ---------------------------------------------------- 100 | */ 101 | CFE_Status_t HS_TblInit(void) 102 | { 103 | UT_GenStub_SetupReturnBuffer(HS_TblInit, CFE_Status_t); 104 | 105 | UT_GenStub_Execute(HS_TblInit, Basic, NULL); 106 | 107 | return UT_GenStub_GetReturnValue(HS_TblInit, CFE_Status_t); 108 | } 109 | -------------------------------------------------------------------------------- /unit-test/stubs/hs_cmds_stubs.c: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,920-1, and identified as “Core Flight 3 | * System (cFS) Health & Safety (HS) Application version 2.4.1” 4 | * 5 | * Copyright (c) 2021 United States Government as represented by the 6 | * Administrator of the National Aeronautics and Space Administration. 7 | * All Rights Reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 10 | * not use this file except in compliance with the License. You may obtain 11 | * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | ************************************************************************/ 19 | 20 | /** 21 | * @file 22 | * 23 | * Auto-Generated stub implementations for functions defined in hs_cmds header 24 | */ 25 | 26 | #include "hs_cmds.h" 27 | #include "utgenstub.h" 28 | 29 | /* 30 | * ---------------------------------------------------- 31 | * Generated stub function for HS_AcquirePointers() 32 | * ---------------------------------------------------- 33 | */ 34 | void HS_AcquirePointers(void) 35 | { 36 | 37 | UT_GenStub_Execute(HS_AcquirePointers, Basic, NULL); 38 | } 39 | 40 | /* 41 | * ---------------------------------------------------- 42 | * Generated stub function for HS_AppMonStatusRefresh() 43 | * ---------------------------------------------------- 44 | */ 45 | void HS_AppMonStatusRefresh(void) 46 | { 47 | 48 | UT_GenStub_Execute(HS_AppMonStatusRefresh, Basic, NULL); 49 | } 50 | 51 | /* 52 | * ---------------------------------------------------- 53 | * Generated stub function for HS_DisableAlivenessCmd() 54 | * ---------------------------------------------------- 55 | */ 56 | CFE_Status_t HS_DisableAlivenessCmd(const HS_DisableAlivenessCmd_t *BufPtr) 57 | { 58 | UT_GenStub_SetupReturnBuffer(HS_DisableAlivenessCmd, CFE_Status_t); 59 | 60 | UT_GenStub_AddParam(HS_DisableAlivenessCmd, const HS_DisableAlivenessCmd_t *, BufPtr); 61 | 62 | UT_GenStub_Execute(HS_DisableAlivenessCmd, Basic, NULL); 63 | 64 | return UT_GenStub_GetReturnValue(HS_DisableAlivenessCmd, CFE_Status_t); 65 | } 66 | 67 | /* 68 | * ---------------------------------------------------- 69 | * Generated stub function for HS_DisableAppMonCmd() 70 | * ---------------------------------------------------- 71 | */ 72 | CFE_Status_t HS_DisableAppMonCmd(const HS_DisableAppMonCmd_t *BufPtr) 73 | { 74 | UT_GenStub_SetupReturnBuffer(HS_DisableAppMonCmd, CFE_Status_t); 75 | 76 | UT_GenStub_AddParam(HS_DisableAppMonCmd, const HS_DisableAppMonCmd_t *, BufPtr); 77 | 78 | UT_GenStub_Execute(HS_DisableAppMonCmd, Basic, NULL); 79 | 80 | return UT_GenStub_GetReturnValue(HS_DisableAppMonCmd, CFE_Status_t); 81 | } 82 | 83 | /* 84 | * ---------------------------------------------------- 85 | * Generated stub function for HS_DisableCpuHogCmd() 86 | * ---------------------------------------------------- 87 | */ 88 | CFE_Status_t HS_DisableCpuHogCmd(const HS_DisableCpuHogCmd_t *BufPtr) 89 | { 90 | UT_GenStub_SetupReturnBuffer(HS_DisableCpuHogCmd, CFE_Status_t); 91 | 92 | UT_GenStub_AddParam(HS_DisableCpuHogCmd, const HS_DisableCpuHogCmd_t *, BufPtr); 93 | 94 | UT_GenStub_Execute(HS_DisableCpuHogCmd, Basic, NULL); 95 | 96 | return UT_GenStub_GetReturnValue(HS_DisableCpuHogCmd, CFE_Status_t); 97 | } 98 | 99 | /* 100 | * ---------------------------------------------------- 101 | * Generated stub function for HS_DisableEventMonCmd() 102 | * ---------------------------------------------------- 103 | */ 104 | CFE_Status_t HS_DisableEventMonCmd(const HS_DisableEventMonCmd_t *BufPtr) 105 | { 106 | UT_GenStub_SetupReturnBuffer(HS_DisableEventMonCmd, CFE_Status_t); 107 | 108 | UT_GenStub_AddParam(HS_DisableEventMonCmd, const HS_DisableEventMonCmd_t *, BufPtr); 109 | 110 | UT_GenStub_Execute(HS_DisableEventMonCmd, Basic, NULL); 111 | 112 | return UT_GenStub_GetReturnValue(HS_DisableEventMonCmd, CFE_Status_t); 113 | } 114 | 115 | /* 116 | * ---------------------------------------------------- 117 | * Generated stub function for HS_EnableAlivenessCmd() 118 | * ---------------------------------------------------- 119 | */ 120 | CFE_Status_t HS_EnableAlivenessCmd(const HS_EnableAlivenessCmd_t *BufPtr) 121 | { 122 | UT_GenStub_SetupReturnBuffer(HS_EnableAlivenessCmd, CFE_Status_t); 123 | 124 | UT_GenStub_AddParam(HS_EnableAlivenessCmd, const HS_EnableAlivenessCmd_t *, BufPtr); 125 | 126 | UT_GenStub_Execute(HS_EnableAlivenessCmd, Basic, NULL); 127 | 128 | return UT_GenStub_GetReturnValue(HS_EnableAlivenessCmd, CFE_Status_t); 129 | } 130 | 131 | /* 132 | * ---------------------------------------------------- 133 | * Generated stub function for HS_EnableAppMonCmd() 134 | * ---------------------------------------------------- 135 | */ 136 | CFE_Status_t HS_EnableAppMonCmd(const HS_EnableAppMonCmd_t *BufPtr) 137 | { 138 | UT_GenStub_SetupReturnBuffer(HS_EnableAppMonCmd, CFE_Status_t); 139 | 140 | UT_GenStub_AddParam(HS_EnableAppMonCmd, const HS_EnableAppMonCmd_t *, BufPtr); 141 | 142 | UT_GenStub_Execute(HS_EnableAppMonCmd, Basic, NULL); 143 | 144 | return UT_GenStub_GetReturnValue(HS_EnableAppMonCmd, CFE_Status_t); 145 | } 146 | 147 | /* 148 | * ---------------------------------------------------- 149 | * Generated stub function for HS_EnableCpuHogCmd() 150 | * ---------------------------------------------------- 151 | */ 152 | CFE_Status_t HS_EnableCpuHogCmd(const HS_EnableCpuHogCmd_t *BufPtr) 153 | { 154 | UT_GenStub_SetupReturnBuffer(HS_EnableCpuHogCmd, CFE_Status_t); 155 | 156 | UT_GenStub_AddParam(HS_EnableCpuHogCmd, const HS_EnableCpuHogCmd_t *, BufPtr); 157 | 158 | UT_GenStub_Execute(HS_EnableCpuHogCmd, Basic, NULL); 159 | 160 | return UT_GenStub_GetReturnValue(HS_EnableCpuHogCmd, CFE_Status_t); 161 | } 162 | 163 | /* 164 | * ---------------------------------------------------- 165 | * Generated stub function for HS_EnableEventMonCmd() 166 | * ---------------------------------------------------- 167 | */ 168 | CFE_Status_t HS_EnableEventMonCmd(const HS_EnableEventMonCmd_t *BufPtr) 169 | { 170 | UT_GenStub_SetupReturnBuffer(HS_EnableEventMonCmd, CFE_Status_t); 171 | 172 | UT_GenStub_AddParam(HS_EnableEventMonCmd, const HS_EnableEventMonCmd_t *, BufPtr); 173 | 174 | UT_GenStub_Execute(HS_EnableEventMonCmd, Basic, NULL); 175 | 176 | return UT_GenStub_GetReturnValue(HS_EnableEventMonCmd, CFE_Status_t); 177 | } 178 | 179 | /* 180 | * ---------------------------------------------------- 181 | * Generated stub function for HS_MsgActsStatusRefresh() 182 | * ---------------------------------------------------- 183 | */ 184 | void HS_MsgActsStatusRefresh(void) 185 | { 186 | 187 | UT_GenStub_Execute(HS_MsgActsStatusRefresh, Basic, NULL); 188 | } 189 | 190 | /* 191 | * ---------------------------------------------------- 192 | * Generated stub function for HS_NoopCmd() 193 | * ---------------------------------------------------- 194 | */ 195 | CFE_Status_t HS_NoopCmd(const HS_NoopCmd_t *BufPtr) 196 | { 197 | UT_GenStub_SetupReturnBuffer(HS_NoopCmd, CFE_Status_t); 198 | 199 | UT_GenStub_AddParam(HS_NoopCmd, const HS_NoopCmd_t *, BufPtr); 200 | 201 | UT_GenStub_Execute(HS_NoopCmd, Basic, NULL); 202 | 203 | return UT_GenStub_GetReturnValue(HS_NoopCmd, CFE_Status_t); 204 | } 205 | 206 | /* 207 | * ---------------------------------------------------- 208 | * Generated stub function for HS_ResetCmd() 209 | * ---------------------------------------------------- 210 | */ 211 | CFE_Status_t HS_ResetCmd(const HS_ResetCmd_t *BufPtr) 212 | { 213 | UT_GenStub_SetupReturnBuffer(HS_ResetCmd, CFE_Status_t); 214 | 215 | UT_GenStub_AddParam(HS_ResetCmd, const HS_ResetCmd_t *, BufPtr); 216 | 217 | UT_GenStub_Execute(HS_ResetCmd, Basic, NULL); 218 | 219 | return UT_GenStub_GetReturnValue(HS_ResetCmd, CFE_Status_t); 220 | } 221 | 222 | /* 223 | * ---------------------------------------------------- 224 | * Generated stub function for HS_ResetCounters() 225 | * ---------------------------------------------------- 226 | */ 227 | void HS_ResetCounters(void) 228 | { 229 | 230 | UT_GenStub_Execute(HS_ResetCounters, Basic, NULL); 231 | } 232 | 233 | /* 234 | * ---------------------------------------------------- 235 | * Generated stub function for HS_ResetResetsPerformedCmd() 236 | * ---------------------------------------------------- 237 | */ 238 | CFE_Status_t HS_ResetResetsPerformedCmd(const HS_ResetResetsPerformedCmd_t *BufPtr) 239 | { 240 | UT_GenStub_SetupReturnBuffer(HS_ResetResetsPerformedCmd, CFE_Status_t); 241 | 242 | UT_GenStub_AddParam(HS_ResetResetsPerformedCmd, const HS_ResetResetsPerformedCmd_t *, BufPtr); 243 | 244 | UT_GenStub_Execute(HS_ResetResetsPerformedCmd, Basic, NULL); 245 | 246 | return UT_GenStub_GetReturnValue(HS_ResetResetsPerformedCmd, CFE_Status_t); 247 | } 248 | 249 | /* 250 | * ---------------------------------------------------- 251 | * Generated stub function for HS_SendHkCmd() 252 | * ---------------------------------------------------- 253 | */ 254 | CFE_Status_t HS_SendHkCmd(const HS_SendHkCmd_t *BufPtr) 255 | { 256 | UT_GenStub_SetupReturnBuffer(HS_SendHkCmd, CFE_Status_t); 257 | 258 | UT_GenStub_AddParam(HS_SendHkCmd, const HS_SendHkCmd_t *, BufPtr); 259 | 260 | UT_GenStub_Execute(HS_SendHkCmd, Basic, NULL); 261 | 262 | return UT_GenStub_GetReturnValue(HS_SendHkCmd, CFE_Status_t); 263 | } 264 | 265 | /* 266 | * ---------------------------------------------------- 267 | * Generated stub function for HS_SetMaxResetsCmd() 268 | * ---------------------------------------------------- 269 | */ 270 | CFE_Status_t HS_SetMaxResetsCmd(const HS_SetMaxResetsCmd_t *BufPtr) 271 | { 272 | UT_GenStub_SetupReturnBuffer(HS_SetMaxResetsCmd, CFE_Status_t); 273 | 274 | UT_GenStub_AddParam(HS_SetMaxResetsCmd, const HS_SetMaxResetsCmd_t *, BufPtr); 275 | 276 | UT_GenStub_Execute(HS_SetMaxResetsCmd, Basic, NULL); 277 | 278 | return UT_GenStub_GetReturnValue(HS_SetMaxResetsCmd, CFE_Status_t); 279 | } 280 | -------------------------------------------------------------------------------- /unit-test/stubs/hs_dispatch_stubs.c: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,920-1, and identified as “Core Flight 3 | * System (cFS) Health & Safety (HS) Application version 2.4.1” 4 | * 5 | * Copyright (c) 2021 United States Government as represented by the 6 | * Administrator of the National Aeronautics and Space Administration. 7 | * All Rights Reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 10 | * not use this file except in compliance with the License. You may obtain 11 | * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | ************************************************************************/ 19 | 20 | /** 21 | * @file 22 | * 23 | * Auto-Generated stub implementations for functions defined in hs_dispatch header 24 | */ 25 | 26 | #include "hs_dispatch.h" 27 | #include "utgenstub.h" 28 | 29 | /* 30 | * ---------------------------------------------------- 31 | * Generated stub function for HS_AppPipe() 32 | * ---------------------------------------------------- 33 | */ 34 | void HS_AppPipe(const CFE_SB_Buffer_t *BufPtr) 35 | { 36 | UT_GenStub_AddParam(HS_AppPipe, const CFE_SB_Buffer_t *, BufPtr); 37 | 38 | UT_GenStub_Execute(HS_AppPipe, Basic, NULL); 39 | } 40 | 41 | /* 42 | * ---------------------------------------------------- 43 | * Generated stub function for HS_DisableAlivenessVerifyDispatch() 44 | * ---------------------------------------------------- 45 | */ 46 | void HS_DisableAlivenessVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) 47 | { 48 | UT_GenStub_AddParam(HS_DisableAlivenessVerifyDispatch, const CFE_SB_Buffer_t *, BufPtr); 49 | 50 | UT_GenStub_Execute(HS_DisableAlivenessVerifyDispatch, Basic, NULL); 51 | } 52 | 53 | /* 54 | * ---------------------------------------------------- 55 | * Generated stub function for HS_DisableAppMonVerifyDispatch() 56 | * ---------------------------------------------------- 57 | */ 58 | void HS_DisableAppMonVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) 59 | { 60 | UT_GenStub_AddParam(HS_DisableAppMonVerifyDispatch, const CFE_SB_Buffer_t *, BufPtr); 61 | 62 | UT_GenStub_Execute(HS_DisableAppMonVerifyDispatch, Basic, NULL); 63 | } 64 | 65 | /* 66 | * ---------------------------------------------------- 67 | * Generated stub function for HS_DisableCpuHogVerifyDispatch() 68 | * ---------------------------------------------------- 69 | */ 70 | void HS_DisableCpuHogVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) 71 | { 72 | UT_GenStub_AddParam(HS_DisableCpuHogVerifyDispatch, const CFE_SB_Buffer_t *, BufPtr); 73 | 74 | UT_GenStub_Execute(HS_DisableCpuHogVerifyDispatch, Basic, NULL); 75 | } 76 | 77 | /* 78 | * ---------------------------------------------------- 79 | * Generated stub function for HS_DisableEventMonVerifyDispatch() 80 | * ---------------------------------------------------- 81 | */ 82 | void HS_DisableEventMonVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) 83 | { 84 | UT_GenStub_AddParam(HS_DisableEventMonVerifyDispatch, const CFE_SB_Buffer_t *, BufPtr); 85 | 86 | UT_GenStub_Execute(HS_DisableEventMonVerifyDispatch, Basic, NULL); 87 | } 88 | 89 | /* 90 | * ---------------------------------------------------- 91 | * Generated stub function for HS_EnableAlivenessVerifyDispatch() 92 | * ---------------------------------------------------- 93 | */ 94 | void HS_EnableAlivenessVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) 95 | { 96 | UT_GenStub_AddParam(HS_EnableAlivenessVerifyDispatch, const CFE_SB_Buffer_t *, BufPtr); 97 | 98 | UT_GenStub_Execute(HS_EnableAlivenessVerifyDispatch, Basic, NULL); 99 | } 100 | 101 | /* 102 | * ---------------------------------------------------- 103 | * Generated stub function for HS_EnableAppMonVerifyDispatch() 104 | * ---------------------------------------------------- 105 | */ 106 | void HS_EnableAppMonVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) 107 | { 108 | UT_GenStub_AddParam(HS_EnableAppMonVerifyDispatch, const CFE_SB_Buffer_t *, BufPtr); 109 | 110 | UT_GenStub_Execute(HS_EnableAppMonVerifyDispatch, Basic, NULL); 111 | } 112 | 113 | /* 114 | * ---------------------------------------------------- 115 | * Generated stub function for HS_EnableCpuHogVerifyDispatch() 116 | * ---------------------------------------------------- 117 | */ 118 | void HS_EnableCpuHogVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) 119 | { 120 | UT_GenStub_AddParam(HS_EnableCpuHogVerifyDispatch, const CFE_SB_Buffer_t *, BufPtr); 121 | 122 | UT_GenStub_Execute(HS_EnableCpuHogVerifyDispatch, Basic, NULL); 123 | } 124 | 125 | /* 126 | * ---------------------------------------------------- 127 | * Generated stub function for HS_EnableEventMonVerifyDispatch() 128 | * ---------------------------------------------------- 129 | */ 130 | void HS_EnableEventMonVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) 131 | { 132 | UT_GenStub_AddParam(HS_EnableEventMonVerifyDispatch, const CFE_SB_Buffer_t *, BufPtr); 133 | 134 | UT_GenStub_Execute(HS_EnableEventMonVerifyDispatch, Basic, NULL); 135 | } 136 | 137 | /* 138 | * ---------------------------------------------------- 139 | * Generated stub function for HS_NoopVerifyDispatch() 140 | * ---------------------------------------------------- 141 | */ 142 | void HS_NoopVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) 143 | { 144 | UT_GenStub_AddParam(HS_NoopVerifyDispatch, const CFE_SB_Buffer_t *, BufPtr); 145 | 146 | UT_GenStub_Execute(HS_NoopVerifyDispatch, Basic, NULL); 147 | } 148 | 149 | /* 150 | * ---------------------------------------------------- 151 | * Generated stub function for HS_ResetResetsPerformedVerifyDispatch() 152 | * ---------------------------------------------------- 153 | */ 154 | void HS_ResetResetsPerformedVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) 155 | { 156 | UT_GenStub_AddParam(HS_ResetResetsPerformedVerifyDispatch, const CFE_SB_Buffer_t *, BufPtr); 157 | 158 | UT_GenStub_Execute(HS_ResetResetsPerformedVerifyDispatch, Basic, NULL); 159 | } 160 | 161 | /* 162 | * ---------------------------------------------------- 163 | * Generated stub function for HS_ResetVerifyDispatch() 164 | * ---------------------------------------------------- 165 | */ 166 | void HS_ResetVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) 167 | { 168 | UT_GenStub_AddParam(HS_ResetVerifyDispatch, const CFE_SB_Buffer_t *, BufPtr); 169 | 170 | UT_GenStub_Execute(HS_ResetVerifyDispatch, Basic, NULL); 171 | } 172 | 173 | /* 174 | * ---------------------------------------------------- 175 | * Generated stub function for HS_SendHkVerifyDispatch() 176 | * ---------------------------------------------------- 177 | */ 178 | void HS_SendHkVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) 179 | { 180 | UT_GenStub_AddParam(HS_SendHkVerifyDispatch, const CFE_SB_Buffer_t *, BufPtr); 181 | 182 | UT_GenStub_Execute(HS_SendHkVerifyDispatch, Basic, NULL); 183 | } 184 | 185 | /* 186 | * ---------------------------------------------------- 187 | * Generated stub function for HS_SetMaxResetsVerifyDispatch() 188 | * ---------------------------------------------------- 189 | */ 190 | void HS_SetMaxResetsVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) 191 | { 192 | UT_GenStub_AddParam(HS_SetMaxResetsVerifyDispatch, const CFE_SB_Buffer_t *, BufPtr); 193 | 194 | UT_GenStub_Execute(HS_SetMaxResetsVerifyDispatch, Basic, NULL); 195 | } 196 | 197 | /* 198 | * ---------------------------------------------------- 199 | * Generated stub function for HS_VerifyMsgLength() 200 | * ---------------------------------------------------- 201 | */ 202 | bool HS_VerifyMsgLength(const CFE_MSG_Message_t *MsgPtr, size_t ExpectedLength) 203 | { 204 | UT_GenStub_SetupReturnBuffer(HS_VerifyMsgLength, bool); 205 | 206 | UT_GenStub_AddParam(HS_VerifyMsgLength, const CFE_MSG_Message_t *, MsgPtr); 207 | UT_GenStub_AddParam(HS_VerifyMsgLength, size_t, ExpectedLength); 208 | 209 | UT_GenStub_Execute(HS_VerifyMsgLength, Basic, NULL); 210 | 211 | return UT_GenStub_GetReturnValue(HS_VerifyMsgLength, bool); 212 | } 213 | -------------------------------------------------------------------------------- /unit-test/stubs/hs_global_stubs.c: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,920-1, and identified as “Core Flight 3 | * System (cFS) Health & Safety (HS) Application version 2.4.1” 4 | * 5 | * Copyright (c) 2021 United States Government as represented by the 6 | * Administrator of the National Aeronautics and Space Administration. 7 | * All Rights Reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 10 | * not use this file except in compliance with the License. You may obtain 11 | * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | ************************************************************************/ 19 | 20 | #include "hs_app.h" 21 | 22 | /* UT includes */ 23 | #include "uttest.h" 24 | #include "utassert.h" 25 | #include "utstubs.h" 26 | 27 | HS_AppData_t HS_AppData; 28 | -------------------------------------------------------------------------------- /unit-test/stubs/hs_monitors_stubs.c: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,920-1, and identified as “Core Flight 3 | * System (cFS) Health & Safety (HS) Application version 2.4.1” 4 | * 5 | * Copyright (c) 2021 United States Government as represented by the 6 | * Administrator of the National Aeronautics and Space Administration. 7 | * All Rights Reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 10 | * not use this file except in compliance with the License. You may obtain 11 | * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | ************************************************************************/ 19 | 20 | /** 21 | * @file 22 | * 23 | * Auto-Generated stub implementations for functions defined in hs_monitors header 24 | */ 25 | 26 | #include "hs_monitors.h" 27 | #include "utgenstub.h" 28 | 29 | /* 30 | * ---------------------------------------------------- 31 | * Generated stub function for HS_MonitorApplications() 32 | * ---------------------------------------------------- 33 | */ 34 | void HS_MonitorApplications(void) 35 | { 36 | 37 | UT_GenStub_Execute(HS_MonitorApplications, Basic, NULL); 38 | } 39 | 40 | /* 41 | * ---------------------------------------------------- 42 | * Generated stub function for HS_MonitorEvent() 43 | * ---------------------------------------------------- 44 | */ 45 | void HS_MonitorEvent(const CFE_EVS_LongEventTlm_t *EventPtr) 46 | { 47 | UT_GenStub_AddParam(HS_MonitorEvent, const CFE_EVS_LongEventTlm_t *, EventPtr); 48 | 49 | UT_GenStub_Execute(HS_MonitorEvent, Basic, NULL); 50 | } 51 | 52 | /* 53 | * ---------------------------------------------------- 54 | * Generated stub function for HS_MonitorUtilization() 55 | * ---------------------------------------------------- 56 | */ 57 | void HS_MonitorUtilization(void) 58 | { 59 | 60 | UT_GenStub_Execute(HS_MonitorUtilization, Basic, NULL); 61 | } 62 | 63 | /* 64 | * ---------------------------------------------------- 65 | * Generated stub function for HS_SetCDSData() 66 | * ---------------------------------------------------- 67 | */ 68 | void HS_SetCDSData(uint16 ResetsPerformed, uint16 MaxResets) 69 | { 70 | UT_GenStub_AddParam(HS_SetCDSData, uint16, ResetsPerformed); 71 | UT_GenStub_AddParam(HS_SetCDSData, uint16, MaxResets); 72 | 73 | UT_GenStub_Execute(HS_SetCDSData, Basic, NULL); 74 | } 75 | 76 | /* 77 | * ---------------------------------------------------- 78 | * Generated stub function for HS_ValidateAMTable() 79 | * ---------------------------------------------------- 80 | */ 81 | int32 HS_ValidateAMTable(void *TableData) 82 | { 83 | UT_GenStub_SetupReturnBuffer(HS_ValidateAMTable, int32); 84 | 85 | UT_GenStub_AddParam(HS_ValidateAMTable, void *, TableData); 86 | 87 | UT_GenStub_Execute(HS_ValidateAMTable, Basic, NULL); 88 | 89 | return UT_GenStub_GetReturnValue(HS_ValidateAMTable, int32); 90 | } 91 | 92 | /* 93 | * ---------------------------------------------------- 94 | * Generated stub function for HS_ValidateEMTable() 95 | * ---------------------------------------------------- 96 | */ 97 | int32 HS_ValidateEMTable(void *TableData) 98 | { 99 | UT_GenStub_SetupReturnBuffer(HS_ValidateEMTable, int32); 100 | 101 | UT_GenStub_AddParam(HS_ValidateEMTable, void *, TableData); 102 | 103 | UT_GenStub_Execute(HS_ValidateEMTable, Basic, NULL); 104 | 105 | return UT_GenStub_GetReturnValue(HS_ValidateEMTable, int32); 106 | } 107 | 108 | /* 109 | * ---------------------------------------------------- 110 | * Generated stub function for HS_ValidateMATable() 111 | * ---------------------------------------------------- 112 | */ 113 | int32 HS_ValidateMATable(void *TableData) 114 | { 115 | UT_GenStub_SetupReturnBuffer(HS_ValidateMATable, int32); 116 | 117 | UT_GenStub_AddParam(HS_ValidateMATable, void *, TableData); 118 | 119 | UT_GenStub_Execute(HS_ValidateMATable, Basic, NULL); 120 | 121 | return UT_GenStub_GetReturnValue(HS_ValidateMATable, int32); 122 | } 123 | 124 | /* 125 | * ---------------------------------------------------- 126 | * Generated stub function for HS_ValidateXCTable() 127 | * ---------------------------------------------------- 128 | */ 129 | int32 HS_ValidateXCTable(void *TableData) 130 | { 131 | UT_GenStub_SetupReturnBuffer(HS_ValidateXCTable, int32); 132 | 133 | UT_GenStub_AddParam(HS_ValidateXCTable, void *, TableData); 134 | 135 | UT_GenStub_Execute(HS_ValidateXCTable, Basic, NULL); 136 | 137 | return UT_GenStub_GetReturnValue(HS_ValidateXCTable, int32); 138 | } 139 | -------------------------------------------------------------------------------- /unit-test/stubs/hs_sysmon_stubs.c: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,920-1, and identified as “Core Flight 3 | * System (cFS) Health & Safety (HS) Application version 2.4.1” 4 | * 5 | * Copyright (c) 2021 United States Government as represented by the 6 | * Administrator of the National Aeronautics and Space Administration. 7 | * All Rights Reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 10 | * not use this file except in compliance with the License. You may obtain 11 | * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | ************************************************************************/ 19 | 20 | /** 21 | * @file 22 | * 23 | * Auto-Generated stub implementations for functions defined in hs_sysmon header 24 | */ 25 | 26 | #include "hs_sysmon.h" 27 | #include "utgenstub.h" 28 | 29 | /* 30 | * ---------------------------------------------------- 31 | * Generated stub function for HS_SysMonCleanup() 32 | * ---------------------------------------------------- 33 | */ 34 | void HS_SysMonCleanup(void) 35 | { 36 | 37 | UT_GenStub_Execute(HS_SysMonCleanup, Basic, NULL); 38 | } 39 | 40 | /* 41 | * ---------------------------------------------------- 42 | * Generated stub function for HS_SysMonGetCpuUtilization() 43 | * ---------------------------------------------------- 44 | */ 45 | CFE_Status_t HS_SysMonGetCpuUtilization(void) 46 | { 47 | UT_GenStub_SetupReturnBuffer(HS_SysMonGetCpuUtilization, CFE_Status_t); 48 | 49 | UT_GenStub_Execute(HS_SysMonGetCpuUtilization, Basic, NULL); 50 | 51 | return UT_GenStub_GetReturnValue(HS_SysMonGetCpuUtilization, CFE_Status_t); 52 | } 53 | 54 | /* 55 | * ---------------------------------------------------- 56 | * Generated stub function for HS_SysMonInit() 57 | * ---------------------------------------------------- 58 | */ 59 | CFE_Status_t HS_SysMonInit(void) 60 | { 61 | UT_GenStub_SetupReturnBuffer(HS_SysMonInit, CFE_Status_t); 62 | 63 | UT_GenStub_Execute(HS_SysMonInit, Basic, NULL); 64 | 65 | return UT_GenStub_GetReturnValue(HS_SysMonInit, CFE_Status_t); 66 | } 67 | -------------------------------------------------------------------------------- /unit-test/stubs/hs_utils_stubs.c: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,920-1, and identified as “Core Flight 3 | * System (cFS) Health & Safety (HS) Application version 2.4.1” 4 | * 5 | * Copyright (c) 2021 United States Government as represented by the 6 | * Administrator of the National Aeronautics and Space Administration. 7 | * All Rights Reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 10 | * not use this file except in compliance with the License. You may obtain 11 | * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | ************************************************************************/ 19 | 20 | /** 21 | * @file 22 | * 23 | * Auto-Generated stub implementations for functions defined in hs_utils header 24 | */ 25 | 26 | #include "hs_utils.h" 27 | #include "utgenstub.h" 28 | 29 | /* 30 | * ---------------------------------------------------- 31 | * Generated stub function for HS_AMTActionIsValid() 32 | * ---------------------------------------------------- 33 | */ 34 | bool HS_AMTActionIsValid(uint16 ActionType) 35 | { 36 | UT_GenStub_SetupReturnBuffer(HS_AMTActionIsValid, bool); 37 | 38 | UT_GenStub_AddParam(HS_AMTActionIsValid, uint16, ActionType); 39 | 40 | UT_GenStub_Execute(HS_AMTActionIsValid, Basic, NULL); 41 | 42 | return UT_GenStub_GetReturnValue(HS_AMTActionIsValid, bool); 43 | } 44 | 45 | /* 46 | * ---------------------------------------------------- 47 | * Generated stub function for HS_EMTActionIsValid() 48 | * ---------------------------------------------------- 49 | */ 50 | bool HS_EMTActionIsValid(uint16 ActionType) 51 | { 52 | UT_GenStub_SetupReturnBuffer(HS_EMTActionIsValid, bool); 53 | 54 | UT_GenStub_AddParam(HS_EMTActionIsValid, uint16, ActionType); 55 | 56 | UT_GenStub_Execute(HS_EMTActionIsValid, Basic, NULL); 57 | 58 | return UT_GenStub_GetReturnValue(HS_EMTActionIsValid, bool); 59 | } 60 | -------------------------------------------------------------------------------- /unit-test/utilities/hs_test_utils.c: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,920-1, and identified as “Core Flight 3 | * System (cFS) Health & Safety (HS) Application version 2.4.1” 4 | * 5 | * Copyright (c) 2021 United States Government as represented by the 6 | * Administrator of the National Aeronautics and Space Administration. 7 | * All Rights Reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 10 | * not use this file except in compliance with the License. You may obtain 11 | * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | ************************************************************************/ 19 | 20 | /** 21 | * @file 22 | * This file contains unit test utilities for the HS application. 23 | */ 24 | 25 | /* 26 | * Includes 27 | */ 28 | 29 | #include "hs_tbldefs.h" 30 | #include "hs_app.h" 31 | #include "hs_verify.h" 32 | #include "hs_tbl.h" 33 | #include "hs_msgdefs.h" 34 | #include "hs_version.h" 35 | #include "hs_eventids.h" 36 | #include "hs_utils.h" 37 | #include "hs_cmds.h" 38 | #include "hs_monitors.h" 39 | #include "hs_msg.h" 40 | 41 | #include "hs_test_utils.h" 42 | 43 | /* UT includes */ 44 | #include "uttest.h" 45 | #include "utassert.h" 46 | #include "utstubs.h" 47 | 48 | #define UT_MAX_SENDEVENT_DEPTH 32 49 | CFE_EVS_SendEvent_context_t context_CFE_EVS_SendEvent[UT_MAX_SENDEVENT_DEPTH]; 50 | CFE_ES_WriteToSysLog_context_t context_CFE_ES_WriteToSysLog; 51 | 52 | UT_CmdBuf_t UT_CmdBuf; 53 | 54 | /* 55 | * Function Definitions 56 | */ 57 | void UT_Handler_CFE_EVS_SendEvent(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context, va_list va) 58 | { 59 | uint16 CallCount; 60 | uint16 idx; 61 | 62 | CallCount = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); 63 | 64 | if (CallCount > (sizeof(context_CFE_EVS_SendEvent) / sizeof(context_CFE_EVS_SendEvent[0]))) 65 | { 66 | UtAssert_Failed("CFE_EVS_SendEvent UT depth %u exceeded: %u, increase UT_MAX_SENDEVENT_DEPTH", 67 | UT_MAX_SENDEVENT_DEPTH, CallCount); 68 | } 69 | else 70 | { 71 | idx = CallCount - 1; 72 | context_CFE_EVS_SendEvent[idx].EventID = UT_Hook_GetArgValueByName(Context, "EventID", uint16); 73 | context_CFE_EVS_SendEvent[idx].EventType = UT_Hook_GetArgValueByName(Context, "EventType", uint16); 74 | 75 | strncpy(context_CFE_EVS_SendEvent[idx].Spec, UT_Hook_GetArgValueByName(Context, "Spec", const char *), 76 | CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); 77 | context_CFE_EVS_SendEvent[idx].Spec[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH - 1] = '\0'; 78 | } 79 | } 80 | 81 | void UT_Handler_CFE_ES_WriteToSysLog(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context, va_list va) 82 | { 83 | strncpy(context_CFE_ES_WriteToSysLog.Spec, UT_Hook_GetArgValueByName(Context, "SpecStringPtr", const char *), 84 | CFE_MISSION_EVS_MAX_MESSAGE_LENGTH - 1); 85 | context_CFE_ES_WriteToSysLog.Spec[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH - 1] = '\0'; 86 | } 87 | 88 | void CFE_PSP_WatchdogEnable(void) 89 | { 90 | UT_DEFAULT_IMPL(CFE_PSP_WatchdogEnable); 91 | } 92 | 93 | void CFE_PSP_WatchdogService(void) 94 | { 95 | UT_DEFAULT_IMPL(CFE_PSP_WatchdogService); 96 | } 97 | 98 | void CFE_PSP_WatchdogSet(uint32 WatchdogValue) 99 | { 100 | UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_PSP_WatchdogSet), WatchdogValue); 101 | UT_DEFAULT_IMPL(CFE_PSP_WatchdogSet); 102 | } 103 | 104 | void HS_Test_Setup(void) 105 | { 106 | /* initialize test environment to default state for every test */ 107 | UT_ResetState(0); 108 | 109 | memset(&HS_AppData, 0, sizeof(HS_AppData)); 110 | memset(context_CFE_EVS_SendEvent, 0, sizeof(context_CFE_EVS_SendEvent)); 111 | memset(&context_CFE_ES_WriteToSysLog, 0, sizeof(context_CFE_ES_WriteToSysLog)); 112 | memset(&UT_CmdBuf, 0, sizeof(UT_CmdBuf)); 113 | 114 | /* Register custom handlers */ 115 | UT_SetVaHandlerFunction(UT_KEY(CFE_EVS_SendEvent), UT_Handler_CFE_EVS_SendEvent, NULL); 116 | UT_SetVaHandlerFunction(UT_KEY(CFE_ES_WriteToSysLog), UT_Handler_CFE_ES_WriteToSysLog, NULL); 117 | } 118 | 119 | void HS_Test_TearDown(void) 120 | { 121 | /* cleanup test environment */ 122 | } 123 | -------------------------------------------------------------------------------- /unit-test/utilities/hs_test_utils.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,920-1, and identified as “Core Flight 3 | * System (cFS) Health & Safety (HS) Application version 2.4.1” 4 | * 5 | * Copyright (c) 2021 United States Government as represented by the 6 | * Administrator of the National Aeronautics and Space Administration. 7 | * All Rights Reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 10 | * not use this file except in compliance with the License. You may obtain 11 | * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | ************************************************************************/ 19 | 20 | /** 21 | * @file 22 | * This file contains the function prototypes and global variables for 23 | * the unit test utilities for the HS application. 24 | */ 25 | #ifndef HS_TEST_UTILS_H 26 | #define HS_TEST_UTILS_H 27 | 28 | /* 29 | * Includes 30 | */ 31 | 32 | #include "hs_tbldefs.h" 33 | #include "hs_app.h" 34 | #include "hs_verify.h" 35 | #include "hs_tbl.h" 36 | #include "hs_msgdefs.h" 37 | #include "hs_version.h" 38 | #include "hs_eventids.h" 39 | #include "hs_utils.h" 40 | #include "hs_cmds.h" 41 | #include "hs_monitors.h" 42 | #include "hs_msg.h" 43 | #include "utstubs.h" 44 | #include 45 | 46 | extern HS_AppData_t HS_AppData; 47 | 48 | /* 49 | * Global context structures 50 | */ 51 | typedef struct 52 | { 53 | uint16 EventID; 54 | uint16 EventType; 55 | char Spec[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH]; 56 | } CFE_EVS_SendEvent_context_t; 57 | 58 | typedef struct 59 | { 60 | char Spec[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH]; 61 | } CFE_ES_WriteToSysLog_context_t; 62 | 63 | extern CFE_EVS_SendEvent_context_t context_CFE_EVS_SendEvent[]; 64 | extern CFE_ES_WriteToSysLog_context_t context_CFE_ES_WriteToSysLog; 65 | 66 | /* Command buffer typedef for any handler */ 67 | typedef union 68 | { 69 | CFE_SB_Buffer_t Buf; 70 | CFE_MSG_Message_t Msg; 71 | 72 | HS_NoopCmd_t NoopCmd; 73 | HS_ResetCmd_t ResetCmd; 74 | HS_EnableAppMonCmd_t EnableAppMonCmd; 75 | HS_DisableAppMonCmd_t DisableAppMonCmd; 76 | HS_EnableEventMonCmd_t EnableEventMonCmd; 77 | HS_DisableEventMonCmd_t DisableEventMonCmd; 78 | HS_EnableAlivenessCmd_t EnableAlivenessCmd; 79 | HS_DisableAlivenessCmd_t DisableAlivenessCmd; 80 | HS_ResetResetsPerformedCmd_t ResetResetsPerformedCmd; 81 | HS_EnableCpuHogCmd_t EnableCpuHogCmd; 82 | HS_DisableCpuHogCmd_t DisableCpuHogCmd; 83 | HS_SetMaxResetsCmd_t SetMaxResetsCmd; 84 | HS_SendHkCmd_t SendHkCmd; 85 | } UT_CmdBuf_t; 86 | 87 | extern UT_CmdBuf_t UT_CmdBuf; 88 | 89 | /* Unit test ids */ 90 | #define HS_UT_PIPEID_1 CFE_SB_PIPEID_C(CFE_RESOURCEID_WRAP(1)) 91 | 92 | /* 93 | * Function Definitions 94 | */ 95 | 96 | void HS_Test_Setup(void); 97 | void HS_Test_TearDown(void); 98 | 99 | #endif 100 | --------------------------------------------------------------------------------