├── .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 ├── docs ├── cs-detaildesign.doxyfile.in ├── cs_FunctionalRequirements.csv └── dox_src │ ├── CMakeLists.txt │ ├── cfs_cs.dox │ ├── cs-common.doxyfile.in │ └── cs-usersguide.doxyfile.in ├── fsw ├── inc │ ├── cs_events.h │ ├── cs_mission_cfg.h │ ├── cs_msg.h │ ├── cs_msgdefs.h │ ├── cs_msgids.h │ ├── cs_perfids.h │ ├── cs_platform_cfg.h │ └── cs_tbldefs.h ├── src │ ├── cs_app.c │ ├── cs_app.h │ ├── cs_app_cmds.c │ ├── cs_app_cmds.h │ ├── cs_cmds.c │ ├── cs_cmds.h │ ├── cs_compute.c │ ├── cs_compute.h │ ├── cs_eeprom_cmds.c │ ├── cs_eeprom_cmds.h │ ├── cs_init.c │ ├── cs_init.h │ ├── cs_memory_cmds.c │ ├── cs_memory_cmds.h │ ├── cs_table_cmds.c │ ├── cs_table_cmds.h │ ├── cs_table_processing.c │ ├── cs_utils.c │ ├── cs_utils.h │ ├── cs_verify.h │ └── cs_version.h └── tables │ ├── cs_apptbl.c │ ├── cs_eepromtbl.c │ ├── cs_memorytbl.c │ └── cs_tablestbl.c ├── mission_build.cmake └── unit-test ├── CMakeLists.txt ├── cs_app_cmds_tests.c ├── cs_app_tests.c ├── cs_cmds_tests.c ├── cs_compute_tests.c ├── cs_eeprom_cmds_tests.c ├── cs_init_tests.c ├── cs_memory_cmds_tests.c ├── cs_table_cmds_tests.c ├── cs_table_processing_tests.c ├── cs_utils_tests.c ├── stubs ├── cs_app_cmds_stubs.c ├── cs_app_stubs.c ├── cs_cmds_stubs.c ├── cs_compute_stubs.c ├── cs_eeprom_cmds_stubs.c ├── cs_init_stubs.c ├── cs_memory_cmds_stubs.c ├── cs_table_cmds_stubs.c ├── cs_table_processing_stubs.c └── cs_utils_stubs.c └── utilities ├── cs_test_utils.c └── cs_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/CS/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/CS/blob/main/CONTRIBUTING.md). 13 | * [ ] I reviewed the [README file](https://github.com/nasa/CS/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/CS/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 | 1. 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: "[\"cs-usersguide\"]" 13 | app-name: cs 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/cs 14 | prep: 'make prep; make -C build/tools/elf2cfetbl' 15 | make: 'make -C build/native/default_cpu1/apps/cs' 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 cs)" 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_CS C) 2 | 3 | set(APP_SRC_FILES 4 | fsw/src/cs_cmds.c 5 | fsw/src/cs_table_processing.c 6 | fsw/src/cs_app.c 7 | fsw/src/cs_utils.c 8 | fsw/src/cs_table_cmds.c 9 | fsw/src/cs_app_cmds.c 10 | fsw/src/cs_memory_cmds.c 11 | fsw/src/cs_init.c 12 | fsw/src/cs_eeprom_cmds.c 13 | fsw/src/cs_compute.c 14 | ) 15 | 16 | # Create the app module 17 | add_cfe_app(cs ${APP_SRC_FILES}) 18 | 19 | # This permits direct access to public headers in the fsw/inc directory 20 | target_include_directories(cs PUBLIC fsw/inc) 21 | 22 | set(APP_TABLE_FILES 23 | fsw/tables/cs_apptbl.c 24 | fsw/tables/cs_eepromtbl.c 25 | fsw/tables/cs_memorytbl.c 26 | fsw/tables/cs_tablestbl.c 27 | ) 28 | 29 | add_cfe_tables(cs ${APP_TABLE_FILES}) 30 | 31 | # If UT is enabled, then add the tests from the subdirectory 32 | # Note that this is an app, and therefore does not provide 33 | # stub functions, as other entities would not typically make 34 | # direct function calls into this application. 35 | if(ENABLE_UNIT_TESTS) 36 | add_subdirectory(unit-test) 37 | endif() 38 | -------------------------------------------------------------------------------- /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. -------------------------------------------------------------------------------- /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) Checksum Application (CS) 2 | 3 | ## Introduction 4 | 5 | The Checksum application (CS) is a core Flight System (cFS) application that 6 | is a plug in to the Core Flight Executive (cFE) component of the cFS. 7 | 8 | The CS application is used for for ensuring the integrity of onboard memory. 9 | CS calculates Cyclic Redundancy Checks (CRCs) on the different memory regions 10 | and compares the CRC values with a baseline value calculated at system startup. 11 | CS has the ability to ensure the integrity of cFE applications, cFE tables, the 12 | cFE core, the onboard operating system (OS), onboard EEPROM, as well as, any 13 | memory regions ("Memory") specified by the users. 14 | 15 | The CS application is written in C and depends on the cFS Operating System 16 | Abstraction Layer (OSAL) and cFE components. There is additional CS application 17 | specific configuration information contained in the application user's guide. 18 | 19 | User's guide information can be generated using Doxygen (from top mission directory): 20 | ``` 21 | make prep 22 | make -C build/docs/cs-usersguide cs-usersguide 23 | ``` 24 | 25 | ## Software Required 26 | 27 | cFS Framework (cFE, OSAL, PSP) 28 | 29 | An integrated bundle including the cFE, OSAL, and PSP can 30 | be obtained at https://github.com/nasa/cfs 31 | 32 | ## About cFS 33 | 34 | The cFS is a platform and project independent reusable software framework and 35 | set of reusable applications developed by NASA Goddard Space Flight Center. 36 | This framework is used as the basis for the flight software for satellite data 37 | systems and instruments, but can be used on other embedded systems. More 38 | information on the cFS can be found at http://cfs.gsfc.nasa.gov 39 | -------------------------------------------------------------------------------- /docs/cs-detaildesign.doxyfile.in: -------------------------------------------------------------------------------- 1 | #--------------------------------------------------------------------------- 2 | # Doxygen Configuration options for mission detailed documentation 3 | #--------------------------------------------------------------------------- 4 | 5 | # Common files 6 | @INCLUDE = @MISSION_BINARY_DIR@/docs/cs-common.doxyfile 7 | -------------------------------------------------------------------------------- /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(CS_DOCS NONE) 15 | 16 | # generate the configuration files 17 | configure_file( 18 | ${CMAKE_CURRENT_SOURCE_DIR}/cs-common.doxyfile.in 19 | ${CMAKE_BINARY_DIR}/docs/cs-common.doxyfile 20 | @ONLY 21 | ) 22 | 23 | configure_file( 24 | ${CMAKE_CURRENT_SOURCE_DIR}/cs-usersguide.doxyfile.in 25 | ${CMAKE_CURRENT_BINARY_DIR}/cs-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}/cs-usersguide.doxyfile 31 | WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" 32 | ) 33 | 34 | add_custom_target(cs-usersguide 35 | COMMAND echo "CS UsersGuide: file://${CMAKE_CURRENT_BINARY_DIR}/html/index.html" 36 | DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/ALWAYSBUILD" 37 | ) 38 | -------------------------------------------------------------------------------- /docs/dox_src/cfs_cs.dox: -------------------------------------------------------------------------------- 1 | /** 2 | \page cfscsfrontpage CFS Checksum (CS) Documentation 3 | 16 | **/ 17 | 18 | /** 19 | * \page cfscseventspg CFS Checksum Events 20 | * 21 | * \ref cfscsevents 22 | */ 23 | 24 | /** 25 | * \page cfscscfgpg CFS Checksum Configuration 26 | * 27 | * \ref cfscsmissioncfg 28 | * 29 | * \ref cfscsplatformcfg 30 | */ 31 | 32 | /** 33 | * \page cfscscmdspg CFS Checksum Commands 34 | * 35 | * \ref cfscscmdmid 36 | * 37 | * \ref cfscscmdstructs 38 | * 39 | * \ref cfscscmdcodes 40 | */ 41 | 42 | /** 43 | * \page cfscstlmpg CFS Checksum Telemetry 44 | * 45 | * \ref cfscstlmmid 46 | * 47 | * \ref cfscstlm 48 | */ 49 | 50 | /** 51 | \page cfscsintro CFS Checksum Introduction 52 | 53 |

Scope

54 | 55 | This document provides a complete specification for the commands and telemetry associated 56 | with the CFS Checksum (CS) application software. The document is intended primarily 57 | for users of the software (operations personnel, test engineers, and maintenance personnel). 58 | The deployment guide section is intended for mission developers when deploying and 59 | configuring the application software for a mission flight software build environment. 60 | 61 | \ref cfscsversion 62 | 63 |

Acronyms

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 |
Acronym Description
API Application Programming Interface
ATP Absolute Time Processor
ATS Absolute Time tagged command Sequence
CCSDS Consultative Committee for Space Data Systems
C&DH Command and Data Handling
CFE Core Flight Executive
CFS Core Flight System
CI Command Ingest
Cmd Command
CPU Central Processing Unit
EDAC Error Detection and Correction
EEPROM Electrically Erasable Programmable Read-Only Memory
FDS Flight Data System
FM File Manager
FSW Flight Software
GN&C Guidance Navigation & Control
GSFC Goddard Space Flight Center
HK Housekeeping
HW, H/W Hardware
ICD Interface Control Document
ISR Interrupt Service Routine
OS Operating System
OSAL Operating System Abstraction Layer
Pkts Packets
RAM Random-Access Memory
RTOS Real Time Operating System
RTP Relative Time Processor
RTS Relative Time tagged command Sequence
SB Software Bus Service
SBC Single Board Computer
SC Stored Commands task
SW, S/W Software
TBD To Be Determined
TBL Table
TLM Telemetry
UTC Universal time code
104 | **/ 105 | 106 | /** 107 | \page cfscsovr CFS Checksum Overview 108 | 109 | The Checksum (CS) application of the Core Flight System (CFS) is responsible 110 | for ensuring the integrity of onboard memory. CS has the ability to ensure the 111 | integrity of Core Flight Executive (cFE) applications, cFE tables, the cFE 112 | core, the onboard operating system (OS), onboard EEPROM, as well as any 113 | memory regions ("Memory") specified by the users. 114 | 115 | All CS checksums regions are configurable allowing users to specify the 116 | enable/disable state for each region upon startup. 117 | 118 | The cFE core and the OS checksum regions are enabled by default. These are the only 119 | two checksum regions that are not table driven. Additionally, the user may select 120 | other table driven areas to checksum, including: 121 | 122 | 130 | 131 | All table driven checksum regions are also enabled by default. 132 | 133 | The CS application is both table and schedule driven. All of the applications, 134 | tables, areas of EEPROM, and other memory areas to be checksummed must be defined 135 | by the user in four separate tables that can be controlled independently. For each 136 | checksum region that is enabled, CS will checksum up to #CS_DEFAULT_BYTES_PER_CYCLE 137 | (a configuration parameter) bytes every time CS receives its background cycle MID 138 | from a scheduling application/source. 139 | 140 | The CS application uses two sets of tables: a set of definition tables 141 | which the user populates on the ground with the set of applications, 142 | tables, areas of EEPROM and other memory areas, and a set of results 143 | tables which are dump only tables. The results tables are populated by 144 | CS automatically from the definition tables, but also contain more 145 | information. The results tables contain the checksum values for each 146 | object in the table as well as other information for CS to use during 147 | runtime. For more information see \ref cfscstbl. 148 | **/ 149 | 150 | /** 151 | \page cfscsopr CFS Checksum Operation 152 | 153 |

Initialization

154 | 155 | Upon initialization CS will initialize its global memory area and proceed 156 | to populate its results tables (which are dump only tables) from the 157 | default definition tables located in non-volatile memory. Each table has 158 | a corresponding setting in the platform configuration of the enable/disabled 159 | state of each table, the OS code segments and cFE Core for checksumming. 160 | These values are used at initialization for power-on reset or if CS is 161 | not configured to preserve states via the CDS they will also be used for 162 | processor-reset. If CS is configured to preserve enable state of the tables 163 | on a proc reset, states from CDS will be used upon processor reset. 164 | 165 | If the default definition tables do not pass table 166 | validation, or they are nonexistent, blank definition tables are used 167 | from CS's memory and the table is disabled for checksumming. The purpose 168 | of loading a blank table from memory is so that another table can be loaded 169 | from the ground and be functional. The other purpose of loading a blank 170 | table from memory is so that if the table is accidentally enabled for 171 | checksumming, the table pointers for the results table point to good data. 172 | 173 | Since CS cannot operate without the operating system or the cFE core, CS 174 | automatically sets up checksumming for those areas and enables them for 175 | checksumming. 176 | 177 |

CDS Usage

178 | If the CS application is configured to preserve states across processor 179 | resets, the enable/disable state of each individual checksum region will 180 | be stored in the CDS. The CDS is updated each time an Enable or Disable 181 | ground command is processed for a specific checksum region. 182 | 183 | CS also includes a ground command to enable or disable all checksumming. This 184 | overall setting is not saved to the CDS. 185 | **/ 186 | 187 | /** 188 | \page cfscsdg CFS Checksum Deployment Guide 189 | 190 | To integrate the CS application with the cFE, follow the CFS App 191 | Integration Guide. 192 | 193 | Follow the general guidelines below for platform deployment of the Housekeeping app. 194 | 195 | There are two message IDs that must be included in the CFS Scheduler Table: 196 | #CS_SEND_HK_MID is sent out at the housekeeping request interval. 197 | #CS_BACKGROUND_CYCLE_MID is sent out at the desired rate for background checksumming. 198 | 199 | The Checksum app generates telemetry when it receives the housekeeping request. It 200 | telemetry message ID is #CS_HK_TLM_MID. 201 | 202 | The ES app uses the CS performance ID, #CS_APPMAIN_PERF_ID , to keep track of the performance 203 | of the CS app. 204 | 205 | The mission configuration file cs_mission_cfg.h contains mission-level parameters that can be adjusted across 206 | all platforms. 207 | 208 | See \ref cfscsmissioncfg 209 | 210 | The platform configuration file cs_platform_cfg.h contains parameters that can be adjusted to 211 | specific platforms. The defined parameters (and their default values) are: 212 | 213 | See \ref cfscsplatformcfg 214 | **/ 215 | 216 | /** 217 | \page cfscstbl CFS Checksum Table Definitions 218 | 219 | The Checksum application uses eight tables (four definition tables and four corresponding results tables). The CS App 220 | copies the data from each definition tables at initialization and during table updates, and stores the data in the 221 | corresponding results tables. The CS app accesses this data from each results table for processing, and saves its 222 | state in the same table. 223 | 224 | The definitions tables are load-dump tables, and the results tables are dump-only. 225 | 226 | EEPROM Definition Table and Memory Definition Table 227 | 228 | There are #CS_MAX_NUM_EEPROM_TABLE_ENTRIES entries defined for the EEPROM Definition Table, and 229 | #CS_MAX_NUM_MEMORY_TABLE_ENTRIES entries defined for the Memory Definition Table. 230 | 231 | The format of a single entry in the EEPROM Definition Table or the Memory Definition Table is 232 | defined by #CS_Def_EepromMemory_Table_Entry_t. 233 | 234 | Tables Definition Table 235 | 236 | There are #CS_MAX_NUM_TABLES_TABLE_ENTRIES entries defined for the Tables Definition Table. 237 | 238 | The format of a single entry in the Tables Definition Table is defined by 239 | #CS_Def_Tables_Table_Entry_t. 240 | 241 | Apps Definition Table 242 | 243 | There are #CS_MAX_NUM_APP_TABLE_ENTRIES entries defined for the Apps Definition Table. 244 | 245 | The format of a single entry in the Apps Definition Table is defined by 246 | #CS_Def_App_Table_Entry_t. 247 | 248 | EEPROM Results Table and Memory Results Table 249 | 250 | There are #CS_MAX_NUM_EEPROM_TABLE_ENTRIES entries defined for the EEPROM Results Table, and 251 | #CS_MAX_NUM_MEMORY_TABLE_ENTRIES entries defined for the Memory Results Table. 252 | 253 | The format of a single entry in the EEPROM Results Table or the Memory Results Table is 254 | defined by #CS_Res_EepromMemory_Table_Entry_t. 255 | 256 | Tables Results Table 257 | 258 | There are #CS_MAX_NUM_TABLES_TABLE_ENTRIES entries defined for the Tables Results Table. 259 | 260 | The format of a single entry in the Tables Results Table is defined by 261 | #CS_Res_Tables_Table_Entry_t. 262 | 263 | Apps Results Table 264 | 265 | There are #CS_MAX_NUM_APP_TABLE_ENTRIES entries defined for the Apps Results Table. 266 | 267 | The format of a single entry in the Apps Results Table is defined by 268 | #CS_Res_App_Table_Entry_t. 269 | **/ 270 | 271 | /** 272 | \page cfscscons CFS Checksum Constraints 273 | 274 |

Child Tasks

275 | 276 | The Checksum application only allows one child task to be used at a time. 277 | One child task is used during each of the CS_*Recompute commands and during 278 | the CS OneShot command. A child task is started when the command returns 279 | successfully (with a debug event message), and then ends when the child 280 | task finishes the recompute (an info event message is generated). While it 281 | is not possible to cancel a Recompute command's child task, the function- 282 | ality is provided to cancel a One Shot command's child task, because any 283 | length can be specified in the command, and the checksum may take longer 284 | than expected. 285 | 286 | What this means is that when a Recompute command (or One Shot command) is sent, 287 | the user has to wait until completion of the checksum to send another 288 | Recompute (or One Shot) command can be sent. If another Recompute (or One 289 | Shot) command is sent while the child task is in use, the command will get 290 | rejected. 291 | 292 |

Use On OS X and Linux

293 | 294 | Because of the way these two OS's are set up, it is not possible to checksum 295 | applications or the OS text segment with these two operating systems. CS 296 | will perform the rest of its functions without incident, but will issue an 297 | informational event message on startup when it determines the OS cannot be 298 | checksummed, and issue a debug event message. 299 | 300 |

Checksum application's tables

301 | 302 | It is worth a note to say that if the user wants CS's tables to be 303 | checksummed, they must be put in CS's table of tables to be checksummed. 304 | 305 |

Checksumming tables

306 | 307 | When creating CS's Table of tables to be checksummed, the 'Name' field must 308 | be the same name that cFE Table Services uses. That is it must be in the form 309 | of 'AppName.TableName', otherwise CS will not be able to find the table and 310 | it will not be checksummed. 311 | **/ 312 | 313 | /** 314 | \page cfscsfaqs CFS Checksum Frequently Asked Questions 315 | 316 | (Q) 317 | Can I set the max number of table entries to zero to not use checksumming of 318 | apps (or tables or EEPROM or user defined memory) ? 319 |

320 | No. The maximum number of entries must be at least one. This is to prevent 321 | null pointers from ever becoming an issue in CS. If you don't want to 322 | checksum a certain area ever, than the max can be set to 1 and no default 323 | table loaded, so CS will just use its default blank table and disable 324 | checksumming for that area. 325 | 326 | 327 | (Q) 328 | What is the procedure for updating a table that is being checksummed? 329 |

330 | The recommended procedure for updating a table that is being checksummed is to 331 | first disable the checksumming of that table, then load the new table via CFE 332 | TBL, then issue the CS Recompute Checksum command on that table, and finally 333 | re-enable the checksumming of that table. What this procedure does is ensures 334 | that no checksum miscompute errors get generated. 335 | 336 | 337 | (Q) 338 | What do I do if I want to see the checksums of my applications/tables/etc? 339 |

340 | The only way to see what the actual checksum value (Comparison Value) of an 341 | object is is to dump the results table that contains that object. For CS, 342 | knowing what the Comparison Value is isn't important for routine activities, 343 | only knowing when the Comparison Value has changed is important. That being 344 | said, having the Comparison Values on hand may be necessary, hence they are 345 | available by dumping the table. 346 | 347 | **/ 348 | -------------------------------------------------------------------------------- /docs/dox_src/cs-common.doxyfile.in: -------------------------------------------------------------------------------- 1 | #--------------------------------------------------------------------------- 2 | # Common doxygen configuration items 3 | #--------------------------------------------------------------------------- 4 | 5 | # Include front material followed by everything in fsw 6 | INPUT += @cs_MISSION_DIR@/docs/dox_src/cfs_cs.dox 7 | INPUT += @cs_MISSION_DIR@/fsw 8 | -------------------------------------------------------------------------------- /docs/dox_src/cs-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/cs-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 = "CS User's Guide" 19 | WARN_LOGFILE = cs-usersguide-warnings.log 20 | -------------------------------------------------------------------------------- /fsw/inc/cs_mission_cfg.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,915-1, and identified as “cFS Checksum 3 | * Application version 2.5.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 Checksum macro constants that can 23 | * be configured from one mission to another 24 | */ 25 | #ifndef CS_MISSION_CFG_H 26 | #define CS_MISSION_CFG_H 27 | 28 | #include 29 | 30 | /** 31 | * \defgroup cfscsmissioncfg CFS Checksum Mission Configuration 32 | * \{ 33 | */ 34 | 35 | /** 36 | * \brief default CRC algorithm 37 | * 38 | * \par Description: 39 | * This parameter is the algorithm used by CS to checksum 40 | * the requested data. 41 | * 42 | * \par Limits: 43 | * This parameter is limited to either #CFE_MISSION_ES_DEFAULT_CRC, 44 | * or #CFE_ES_CrcType_CRC_16 45 | */ 46 | #define CS_DEFAULT_ALGORITHM CFE_MISSION_ES_DEFAULT_CRC 47 | 48 | /**\}*/ 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /fsw/inc/cs_msg.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,915-1, and identified as “cFS Checksum 3 | * Application version 2.5.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 Checksum command and telemetry 23 | * messages. 24 | */ 25 | #ifndef CS_MSG_H 26 | #define CS_MSG_H 27 | 28 | #include 29 | 30 | /** 31 | * \defgroup cfscstlm CFS Checksum Telemetry 32 | * \{ 33 | */ 34 | 35 | /** 36 | * \brief Housekeeping Payload Structure 37 | */ 38 | typedef struct 39 | { 40 | uint8 CmdCounter; /**< \brief CS Application Command Counter */ 41 | uint8 CmdErrCounter; /**< \brief CS Application Command Error Counter */ 42 | uint8 ChecksumState; /**< \brief CS Application global checksum state */ 43 | uint8 EepromCSState; /**< \brief CS EEPROM table checksum state */ 44 | uint8 MemoryCSState; /**< \brief CS Memory table checksum state */ 45 | uint8 AppCSState; /**< \brief CS App table checksum state */ 46 | uint8 TablesCSState; /**< \brief CS Tables table checksum state */ 47 | uint8 OSCSState; /**< \brief OS code segment checksum state */ 48 | uint8 CfeCoreCSState; /**< \brief cFE Core code segment checksum stat e*/ 49 | uint8 RecomputeInProgress; /**< \brief CS "Recompute In Progress" flag */ 50 | uint8 OneShotInProgress; /**< \brief CS "OneShot In Progress" flag */ 51 | uint8 Filler8; /**< \brief 8 bit padding */ 52 | uint16 EepromCSErrCounter; /**< \brief EEPROM miscompare counter */ 53 | uint16 MemoryCSErrCounter; /**< \brief Memory miscompare counter */ 54 | uint16 AppCSErrCounter; /**< \brief App miscompare counter */ 55 | uint16 TablesCSErrCounter; /**< \brief Tables miscompare counter */ 56 | uint16 CfeCoreCSErrCounter; /**< \brief cFE core miscompare counter */ 57 | uint16 OSCSErrCounter; /**< \brief OS code segment miscopmare counter */ 58 | uint16 CurrentCSTable; /**< \brief Current table being checksummed */ 59 | uint16 CurrentEntryInTable; /**< \brief Current entry ID in table being checksummed */ 60 | uint32 EepromBaseline; /**< \brief Baseline checksum for all of EEPROM */ 61 | uint32 OSBaseline; /**< \brief Baseline checksum for the OS code segment */ 62 | uint32 CfeCoreBaseline; /**< \brief Basline checksum for the cFE core */ 63 | cpuaddr LastOneShotAddress; /**< \brief Address used in last one shot checksum command */ 64 | uint32 LastOneShotSize; /**< \brief Size used in the last one shot checksum command */ 65 | uint32 LastOneShotMaxBytesPerCycle; /**< \brief Max bytes per cycle for last one shot checksum command */ 66 | uint32 LastOneShotChecksum; /**< \brief Checksum of the last one shot checksum command */ 67 | uint32 PassCounter; /**< \brief Number of times CS has passed through all of its tables */ 68 | } CS_HkPacket_Payload_t; 69 | 70 | /** 71 | * \brief Housekeeping Packet Structure 72 | */ 73 | typedef struct 74 | { 75 | CFE_MSG_TelemetryHeader_t TelemetryHeader; /**< \brief cFE SB Tlm Msg Hdr */ 76 | CS_HkPacket_Payload_t Payload; /**< \brief CS HK Payload */ 77 | } CS_HkPacket_t; 78 | 79 | /**\}*/ 80 | 81 | /** 82 | * \defgroup cfscscmdstructs CFS Checksum Command Structures 83 | * \{ 84 | */ 85 | 86 | /** 87 | * \brief Get entry ID command payload 88 | */ 89 | typedef struct 90 | { 91 | cpuaddr Address; /**< \brief Address to get the ID for */ 92 | } CS_GetEntryIDCmd_Payload_t; 93 | 94 | /** 95 | * \brief Payload for commands using Memory or EEPROM tables 96 | */ 97 | typedef struct 98 | { 99 | uint32 EntryID; /**< \brief EntryID to perform a command on */ 100 | } CS_EntryCmd_Payload_t; 101 | 102 | /** 103 | * \brief Payload for commanding by table name 104 | */ 105 | typedef struct 106 | { 107 | char Name[CFE_TBL_MAX_FULL_NAME_LEN]; /**< \brief Table name to perform a command on */ 108 | } CS_TableNameCmd_Payload_t; 109 | 110 | /** 111 | * \brief Payload for commanding by app name 112 | */ 113 | typedef struct 114 | { 115 | char Name[OS_MAX_API_NAME]; /**< \brief App name to perform a command on */ 116 | } CS_AppNameCmd_Payload_t; 117 | 118 | /** 119 | * \brief Payload for sending one shot calculation 120 | */ 121 | typedef struct 122 | { 123 | cpuaddr Address; /**< \brief Address to start checksum */ 124 | uint32 Size; /**< \brief Number of bytes to checksum */ 125 | uint32 MaxBytesPerCycle; /**< \brief Max Number of bytes to compute per cycle. Value of Zero to use platform config 126 | value */ 127 | } CS_OneShotCmd_Payload_t; 128 | 129 | /** 130 | * \brief No arguments command data type 131 | * 132 | * For command details see #CS_NOOP_CC #CS_RESET_CC, #CS_ENABLE_ALL_CS_CC, 133 | * #CS_DISABLE_ALL_CS_CC, #CS_ENABLE_CFE_CORE_CC, #CS_DISABLE_CFE_CORE_CC, #CS_ENABLE_OS_CC, 134 | * #CS_DISABLE_OS_CC, #CS_ENABLE_EEPROM_CC, #CS_DISABLE_EEPROM_CC, #CS_ENABLE_MEMORY_CC, 135 | * #CS_DISABLE_MEMORY_CC, #CS_ENABLE_TABLES_CC, #CS_DISABLE_TABLES_CC 136 | * #CS_ENABLE_APPS_CC, #CS_DISABLE_APPS_CC, #CS_CANCEL_ONE_SHOT_CC 137 | */ 138 | typedef struct 139 | { 140 | CFE_MSG_CommandHeader_t CommandHeader; 141 | } CS_NoArgsCmd_t; 142 | 143 | /** 144 | * \brief Get entry ID command 145 | * 146 | * For command details see CS_GET_ENTRY_ID_EEPROM_CC, #CS_GET_ENTRY_ID_MEMORY_CC 147 | */ 148 | typedef struct 149 | { 150 | CFE_MSG_CommandHeader_t CommandHeader; 151 | CS_GetEntryIDCmd_Payload_t Payload; 152 | } CS_GetEntryIDCmd_t; 153 | 154 | /** 155 | * \brief Command type for commands using Memory or EEPROM tables 156 | * 157 | * For command details see #CS_ENABLE_ENTRY_EEPROM_CC, #CS_DISABLE_ENTRY_EEPROM_CC, 158 | * #CS_ENABLE_ENTRY_MEMORY_CC, #CS_DISABLE_ENTRY_MEMORY_CC 159 | */ 160 | typedef struct 161 | { 162 | CFE_MSG_CommandHeader_t CommandHeader; 163 | CS_EntryCmd_Payload_t Payload; 164 | } CS_EntryCmd_t; 165 | 166 | /** 167 | * \brief Command type for commanding by table name 168 | * 169 | * For command details see #CS_ENABLE_NAME_TABLE_CC, #CS_DISABLE_NAME_TABLE_CC, 170 | * #CS_RECOMPUTE_BASELINE_TABLE_CC, #CS_REPORT_BASELINE_TABLE_CC 171 | */ 172 | typedef struct 173 | { 174 | CFE_MSG_CommandHeader_t CommandHeader; 175 | CS_TableNameCmd_Payload_t Payload; 176 | } CS_TableNameCmd_t; 177 | 178 | /** 179 | * \brief Command type for commanding by app name 180 | * 181 | * For command details see e #CS_ENABLE_NAME_APP_CC, #CS_DISABLE_NAME_APP_CC, 182 | * #CS_RECOMPUTE_BASELINE_APP_CC, #CS_REPORT_BASELINE_APP_CC 183 | */ 184 | typedef struct 185 | { 186 | CFE_MSG_CommandHeader_t CommandHeader; 187 | CS_AppNameCmd_Payload_t Payload; 188 | } CS_AppNameCmd_t; 189 | 190 | /** 191 | * \brief Command type for sending one shot calculation 192 | * 193 | * For command details see #CS_ONE_SHOT_CC 194 | */ 195 | typedef struct 196 | { 197 | CFE_MSG_CommandHeader_t CommandHeader; 198 | CS_OneShotCmd_Payload_t Payload; 199 | } CS_OneShotCmd_t; 200 | 201 | /**\}*/ 202 | 203 | #endif 204 | -------------------------------------------------------------------------------- /fsw/inc/cs_msgids.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,915-1, and identified as “cFS Checksum 3 | * Application version 2.5.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 Checksum constants for message IDs 23 | */ 24 | #ifndef CS_MSGIDS_H 25 | #define CS_MSGIDS_H 26 | 27 | /** 28 | * \defgroup cfscscmdmid CFS Checksum Command Message IDs 29 | * \{ 30 | */ 31 | 32 | #define CS_CMD_MID (0x189F) /**< \brief CS Command Message ID */ 33 | #define CS_SEND_HK_MID (0x18A0) /**< \brief CS Housekeeping Request Message ID */ 34 | #define CS_BACKGROUND_CYCLE_MID (0x18A1) /**< \brief CS Background Cycle Message ID */ 35 | 36 | /**\}*/ 37 | 38 | /** 39 | * \defgroup cfscstlmmid CFS Checksum Telemetry Message IDs 40 | * \{ 41 | */ 42 | 43 | #define CS_HK_TLM_MID (0x08A4) /**< \brief CS Housekeeping Telemetry Message ID */ 44 | 45 | /**\}*/ 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /fsw/inc/cs_perfids.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,915-1, and identified as “cFS Checksum 3 | * Application version 2.5.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 Checksum performance ids. 23 | */ 24 | #ifndef CS_PERFIDS_H 25 | #define CS_PERFIDS_H 26 | 27 | /** 28 | * \ingroup cfscsmissioncfg 29 | * \{ 30 | */ 31 | 32 | #define CS_APPMAIN_PERF_ID 29 /**< \brief Main application performance ID */ 33 | 34 | /**\}*/ 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /fsw/inc/cs_platform_cfg.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,915-1, and identified as “cFS Checksum 3 | * Application version 2.5.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 Checksum constants that can 23 | * be configured from one platform to another 24 | */ 25 | #ifndef CS_PLATFORM_CFG_H 26 | #define CS_PLATFORM_CFG_H 27 | 28 | #include /* for CFE_ES_DEFAULT_STACK_SIZE */ 29 | 30 | /** 31 | * \defgroup cfscsplatformcfg CFS Checksum Platform Configuration 32 | * \{ 33 | */ 34 | 35 | /** 36 | * \brief EEPROM File Table -- default table filename 37 | * 38 | * \par Description: 39 | * This parameter defines the default filename for the 40 | * EEPROM addresses File Table. 41 | * 42 | * \par Limits: 43 | * The string length (including string terminator) cannot exceed 44 | * #OS_MAX_PATH_LEN. (limit is not verified) 45 | */ 46 | #define CS_DEF_EEPROM_TABLE_FILENAME "/cf/cs_eepromtbl.tbl" 47 | 48 | /** 49 | * \brief Memory Address File Table -- default table filename 50 | * 51 | * \par Description: 52 | * This parameter defines the default filename for the 53 | * Memory addresses File Table. 54 | * 55 | * \par Limits: 56 | * The string length (including string terminator) cannot exceed 57 | * #OS_MAX_PATH_LEN. (limit is not verified) 58 | */ 59 | #define CS_DEF_MEMORY_TABLE_FILENAME "/cf/cs_memorytbl.tbl" 60 | 61 | /** 62 | * \brief Tables File Table -- default table filename 63 | * 64 | * \par Description: 65 | * This parameter defines the default filename for the 66 | * Tables List File Table. 67 | * 68 | * \par Limits: 69 | * The string length (including string terminator) cannot exceed 70 | * #OS_MAX_PATH_LEN. (limit is not verified) 71 | */ 72 | #define CS_DEF_TABLES_TABLE_FILENAME "/cf/cs_tablestbl.tbl" 73 | 74 | /** 75 | * \brief Application File Table -- default table filename 76 | * 77 | * \par Description: 78 | * This parameter defines the default filename for the 79 | * Application List File Table. 80 | * 81 | * \par Limits: 82 | * The string length (including string terminator) cannot exceed 83 | * #OS_MAX_PATH_LEN. (limit is not verified) 84 | */ 85 | #define CS_DEF_APP_TABLE_FILENAME "/cf/cs_apptbl.tbl" 86 | 87 | /** 88 | * \brief Application Pipe Depth 89 | * 90 | * \par Description: 91 | * This parameter defines the depth of the CS input pipe. The 92 | * depth should be deep enough to accommodate all of the DS 93 | * command packets and all of the subscribed telemetry packets 94 | * that might be generated by applications with a priority 95 | * higher than the CS application. 96 | * 97 | * \par Limits: 98 | * The value must be greater than zero 99 | */ 100 | #define CS_PIPE_DEPTH (3 * CFE_PLATFORM_SB_DEFAULT_MSG_LIMIT) 101 | 102 | /** 103 | * \brief Maximum number of entries in the EEPROM table to checksum 104 | * 105 | * \par Description: 106 | * Maximum number of entries that can be in the table of 107 | * EEPROM areas to checksum. 108 | * 109 | * \par Limits: 110 | * This parameter is limited by the uint16 datatype that defines it. 111 | * This parameter is limited to 65535. 112 | */ 113 | #define CS_MAX_NUM_EEPROM_TABLE_ENTRIES 16 114 | 115 | /** 116 | * \brief Maximum number of entries in the Memory table to checksum 117 | * 118 | * \par Description: 119 | * Maximum number of entries that can be in the table of 120 | * Memory areas to checksum. 121 | * 122 | * \par Limits: 123 | * This parameter is limited by the uint16 datatype that defines it. 124 | * This parameter is limited to 65535. 125 | */ 126 | #define CS_MAX_NUM_MEMORY_TABLE_ENTRIES 16 127 | 128 | /** 129 | * \brief Maximum number of tables to checksum 130 | * 131 | * \par Description: 132 | * Maximum number of entries in the table of tables to checksum 133 | * 134 | * \par Limits: 135 | * This parameter is limited by the maximum number of tables allowed 136 | * in the system. This parameter is limited to #CFE_PLATFORM_TBL_MAX_NUM_TABLES 137 | */ 138 | #define CS_MAX_NUM_TABLES_TABLE_ENTRIES 24 139 | 140 | /** 141 | * \brief Maximum number of applications to checksum 142 | * 143 | * \par Description: 144 | * Maximum number of entries in the table of applications to checksum 145 | * 146 | * \par Limits: 147 | * This parameter is limited by the maximum number of applications allowed 148 | * in the system. This parameter is limited to #CFE_PLATFORM_ES_MAX_APPLICATIONS 149 | */ 150 | #define CS_MAX_NUM_APP_TABLE_ENTRIES 24 151 | 152 | /** 153 | * \brief Default number of bytes to checksum per cycle 154 | * 155 | * \par Description: 156 | * The default number of bytes that are checksummed in a single CS cycle 157 | * 158 | * \par Limits: 159 | * This parameter is limited by the maximum value allowed by the data type. 160 | * In this case, the data type is an unsigned 32-bit integer, so the valid 161 | * range is 0 to 0xFFFFFFFF. Note that "0" is a valid value, and will 162 | * result in a checksum of 0. 163 | */ 164 | #define CS_DEFAULT_BYTES_PER_CYCLE (1024 * 16) 165 | 166 | /** 167 | * \brief CS Child Task Priority 168 | * 169 | * \par Description: 170 | * Priority of child tasks created by CS. Lower numbers are higher priority, 171 | * with 1 being the highest priority in the case of a child task. 172 | * 173 | * \par Limits: 174 | * Valid range for a child task is 1 to 255 175 | */ 176 | #define CS_CHILD_TASK_PRIORITY 200 177 | 178 | /** 179 | * \brief Delay between checksumming cycles for child task 180 | * 181 | * \par Description: 182 | * CS child tasks perform checksum cycles like the main App. 183 | * Since the child tasks aren't scheduled, there needs to be 184 | * some other mechanism to prevent it from hogging the CPU. 185 | * This parameter specifies the number of milliseconds to delay 186 | * in between cycles. 187 | * 188 | * \par Limits: 189 | * CS does not place limits on this parameter. It is intended to 190 | * be configurable to prevent the child task from hogging the CPU 191 | */ 192 | #define CS_CHILD_TASK_DELAY 1000 193 | 194 | /** 195 | * \brief Timeout for waiting for other apps to start 196 | * 197 | * \par Description: 198 | * CS waits for all of the other applications that are listed in 199 | * the startup script to start before entering its main loop. If 200 | * not all of those apps start, CS can pend indefinitely without 201 | * a timeout. Once CS waits this amount of time ( in milliseconds) 202 | * it will start regardless of the status of the rest of the apps 203 | * in the startup script. 204 | * 205 | * \par Limits: 206 | * CS does not place limits on this parameter. It is intended to 207 | * be configurable to allow enough time for all apps to start. 208 | */ 209 | #define CS_STARTUP_TIMEOUT 60000 210 | 211 | /** 212 | * \brief Desired state of the checksumming of OS code segment at power on 213 | * 214 | * \par Description: 215 | * This determines the default state the checksumming of 216 | * OS code segment should be in at power on 217 | * 218 | * \par Limits: 219 | * This can either be CS_STATE_ENABLED or CS_STATE_DISABLED 220 | */ 221 | #define CS_OSCS_CHECKSUM_STATE CS_STATE_ENABLED 222 | 223 | /** 224 | * \brief Desired state of the checksumming of CFE core checksum at power on 225 | * 226 | * \par Description: 227 | * This determines the default state the checksumming of 228 | * CFE core should be in at power on 229 | * 230 | * \par Limits: 231 | * This can either be CS_STATE_ENABLED or CS_STATE_DISABLED 232 | */ 233 | #define CS_CFECORE_CHECKSUM_STATE CS_STATE_ENABLED 234 | 235 | /** 236 | * \brief Desired state of the EEPROM table at power on 237 | * 238 | * \par Description: 239 | * This determines the default state the EEPROM table should 240 | * be in at power on 241 | * 242 | * \par Limits: 243 | * This can either be CS_STATE_ENABLED or CS_STATE_DISABLED 244 | */ 245 | #define CS_EEPROM_TBL_POWERON_STATE CS_STATE_ENABLED 246 | 247 | /** 248 | * \brief Desired state of the Memory table at power on 249 | * 250 | * \par Description: 251 | * This determines the default state the Memory table should 252 | * be in at power on 253 | * 254 | * \par Limits: 255 | * This can either be CS_STATE_ENABLED or CS_STATE_DISABLED 256 | */ 257 | #define CS_MEMORY_TBL_POWERON_STATE CS_STATE_ENABLED 258 | 259 | /** 260 | * \brief Desired state of the Applications table at power on 261 | * 262 | * \par Description: 263 | * This determines the default state the EEPROM table should 264 | * be in at power on 265 | * 266 | * \par Limits: 267 | * This can either be CS_STATE_ENABLED or CS_STATE_DISABLED 268 | */ 269 | #define CS_APPS_TBL_POWERON_STATE CS_STATE_ENABLED 270 | 271 | /** 272 | * \brief Desired state of the Tables table at power on 273 | * 274 | * \par Description: 275 | * This determines the default state the EEPROM table should 276 | * be in at power on 277 | * 278 | * \par Limits: 279 | * This can either be CS_STATE_ENABLED or CS_STATE_DISABLED 280 | */ 281 | #define CS_TABLES_TBL_POWERON_STATE CS_STATE_ENABLED 282 | 283 | /** 284 | * \brief Whether to preserve checksum states on processor reset 285 | * 286 | * \par Description: 287 | * This determines whether to preserve checksum 288 | * enabled/disabled states on processor reset 289 | * 290 | * \par Limits: 291 | * None 292 | */ 293 | #define CS_PRESERVE_STATES_ON_PROCESSOR_RESET true 294 | 295 | /** 296 | * \brief Name of the Critical Data Store Used for CS 297 | * 298 | * \par Description: 299 | * Name of the Critical Data Store for CS 300 | * This CDS is used to preserve the checksum 301 | * enabled states for EERPOM, Memory, Apps, Tables tables 302 | * as well as OS code segment and cFE core states 303 | * 304 | * \par Limits: 305 | * Must be a unique string with regards to CDS 306 | */ 307 | #define CS_CDS_NAME "CS_CDS" 308 | 309 | /** 310 | * \brief Mission specific version number for CS application 311 | * 312 | * \par Description: 313 | * An application version number consists of four parts: 314 | * major version number, minor version number, revision 315 | * number and mission specific revision number. The mission 316 | * specific revision number is defined here and the other 317 | * parts are defined in "cs_version.h". 318 | * 319 | * \par Limits: 320 | * Must be defined as a numeric value that is greater than 321 | * or equal to zero. 322 | */ 323 | #define CS_MISSION_REV 0 324 | 325 | /**\}*/ 326 | 327 | #endif 328 | -------------------------------------------------------------------------------- /fsw/src/cs_app.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,915-1, and identified as “cFS Checksum 3 | * Application version 2.5.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 | * Checksum (CS) Application. 24 | */ 25 | #ifndef CS_APP_H 26 | #define CS_APP_H 27 | 28 | /************************************************************************** 29 | ** 30 | ** Include section 31 | ** 32 | **************************************************************************/ 33 | 34 | #include "cfe.h" 35 | #include "cs_tbldefs.h" 36 | #include "cs_msg.h" 37 | #include "cs_msgdefs.h" 38 | #include "cs_platform_cfg.h" 39 | #include "cs_mission_cfg.h" 40 | #include "cs_msgids.h" 41 | #include "cs_perfids.h" 42 | #include "cs_verify.h" 43 | #include "cs_version.h" 44 | 45 | /************************************************************************** 46 | ** 47 | ** Macro definitions 48 | ** 49 | **************************************************************************/ 50 | 51 | /** 52 | * \name CS Error Codes 53 | * \{ 54 | */ 55 | #define CS_ERROR (-1) /**< \brief Error code returned when a checksum compare failed */ 56 | #define CS_ERR_NOT_FOUND (-2) /**< \brief Error code returned the app or table requested could not be found */ 57 | #define CS_TABLE_ERROR (-3) /**< \brief Error code returned on table validation error */ 58 | /**\}*/ 59 | 60 | /** 61 | * \name CS Command Pipe Parameters 62 | * \{ 63 | */ 64 | #define CS_CMD_PIPE_NAME "CS_CMD_PIPE" 65 | #define CS_CMD_PIPE_NAME_LEN 16 66 | /**\}*/ 67 | 68 | /** 69 | * \name CS Name of Table Size 70 | * \{ 71 | */ 72 | #define CS_TABLETYPE_NAME_SIZE 10 73 | /**\}*/ 74 | 75 | /** 76 | * \name CS Child Task Names 77 | * \{ 78 | */ 79 | #define CS_RECOMP_OS_TASK_NAME "CS_RecmpOSTsk" 80 | #define CS_RECOMP_CFECORE_TASK_NAME "CS_RecmpCfeCoreTsk" 81 | #define CS_RECOMP_MEMORY_TASK_NAME "CS_RecmpMemoryTsk" 82 | #define CS_RECOMP_EEPROM_TASK_NAME "CS_RecmpEepromTsk" 83 | #define CS_RECOMP_APP_TASK_NAME "CS_RecmpAppTsk" 84 | #define CS_RECOMP_TABLES_TASK_NAME "CS_RecmpTableTsk" 85 | #define CS_ONESHOT_TASK_NAME "CS_OneShotTask" 86 | /**\}*/ 87 | 88 | /** 89 | * \brief Wakeup for CS 90 | * 91 | * \par Description 92 | * Wakes up CS every 1 second for routine maintenance whether a 93 | * message was received or not. 94 | */ 95 | #define CS_WAKEUP_TIMEOUT 1000 96 | 97 | /************************************************************************* 98 | ** 99 | ** Type definitions 100 | ** 101 | **************************************************************************/ 102 | 103 | /** 104 | * \brief CS global data structure 105 | */ 106 | typedef struct 107 | { 108 | CS_HkPacket_t HkPacket; /**< \brief Housekeeping telemetry packet */ 109 | 110 | char PipeName[CS_CMD_PIPE_NAME_LEN]; /**< \brief Command pipe name */ 111 | uint16 PipeDepth; /**< \brief Command pipe depth */ 112 | 113 | uint16 ChildTaskTable; /**< \brief Table for the child task to process */ 114 | uint16 ChildTaskEntryID; /**< \brief Entry in table for child task to process */ 115 | CFE_ES_TaskId_t ChildTaskID; /**< \brief Task ID for the child task */ 116 | 117 | uint32 MaxBytesPerCycle; /**< \brief Max number of bytes to process in a cycle */ 118 | 119 | uint32 RunStatus; /**< \brief Application run status */ 120 | 121 | CS_Res_EepromMemory_Table_Entry_t *RecomputeEepromMemoryEntryPtr; /**< \brief Pointer to an entry to recompute in 122 | the EEPROM or Memory table */ 123 | 124 | CS_Res_App_Table_Entry_t *RecomputeAppEntryPtr; /**< \brief Pointer to an entry to recompute in the 125 | Application table */ 126 | CS_Res_Tables_Table_Entry_t *RecomputeTablesEntryPtr; /**< \brief Pointer to an entry to recompute in the 127 | Tables table */ 128 | 129 | CFE_SB_PipeId_t CmdPipe; /**< \brief Command pipe ID */ 130 | 131 | CFE_TBL_Handle_t DefEepromTableHandle; /**< \brief Handle to the EEPROM definition table */ 132 | CFE_TBL_Handle_t ResEepromTableHandle; /**< \brief Handle to the EEPROM results table */ 133 | 134 | CFE_TBL_Handle_t DefMemoryTableHandle; /**< \brief Handle to the Memory definition table */ 135 | CFE_TBL_Handle_t ResMemoryTableHandle; /**< \brief Handle to the Memory results table */ 136 | 137 | CFE_TBL_Handle_t DefTablesTableHandle; /**< \brief Handle to the Tables definition table */ 138 | CFE_TBL_Handle_t ResTablesTableHandle; /**< \brief Handle to the Tables results table */ 139 | 140 | CFE_TBL_Handle_t DefAppTableHandle; /**< \brief Handle to the Apps definition table */ 141 | CFE_TBL_Handle_t ResAppTableHandle; /**< \brief Hanlde to the Apps results table */ 142 | 143 | CS_Def_EepromMemory_Table_Entry_t *DefEepromTblPtr; /**< \brief Pointer to the EEPROM definition table */ 144 | CS_Res_EepromMemory_Table_Entry_t *ResEepromTblPtr; /**< \brief Pointer to the EEPROM results table */ 145 | 146 | CS_Def_EepromMemory_Table_Entry_t *DefMemoryTblPtr; /**< \brief Pointer to the Memory definition table */ 147 | CS_Res_EepromMemory_Table_Entry_t *ResMemoryTblPtr; /**< \brief Pointer to the Memory results table */ 148 | 149 | CS_Def_Tables_Table_Entry_t *DefTablesTblPtr; /**< \brief Pointer to the Tables definition table */ 150 | CS_Res_Tables_Table_Entry_t *ResTablesTblPtr; /**< \brief Pointer to the Tables results table */ 151 | 152 | CS_Def_App_Table_Entry_t *DefAppTblPtr; /**< \brief Pointer to the Apps definition table */ 153 | CS_Res_App_Table_Entry_t *ResAppTblPtr; /**< \brief Pointer to the Apps results table */ 154 | 155 | CS_Res_EepromMemory_Table_Entry_t OSCodeSeg; /**< \brief OS code segment 'table' */ 156 | CS_Res_EepromMemory_Table_Entry_t CfeCoreCodeSeg; /**< \brief cFE core code segment 'table' */ 157 | 158 | CS_Def_EepromMemory_Table_Entry_t 159 | DefaultEepromDefTable[CS_MAX_NUM_EEPROM_TABLE_ENTRIES]; /**< \brief Default EEPROM definition table */ 160 | CS_Def_EepromMemory_Table_Entry_t 161 | DefaultMemoryDefTable[CS_MAX_NUM_MEMORY_TABLE_ENTRIES]; /**< \brief Default Memory definition table */ 162 | CS_Def_Tables_Table_Entry_t 163 | DefaultTablesDefTable[CS_MAX_NUM_TABLES_TABLE_ENTRIES]; /**< \brief Default Tables definition table */ 164 | CS_Def_App_Table_Entry_t 165 | DefaultAppDefTable[CS_MAX_NUM_APP_TABLE_ENTRIES]; /**< \brief Default Apps definition table */ 166 | 167 | /* The following pointers locate the results for CS tables that get checksummed because they are listed in the CS 168 | * Tables table */ 169 | 170 | CS_Res_Tables_Table_Entry_t *EepResTablesTblPtr; /**< \brief CS results entry for the CS eeprom */ 171 | CS_Res_Tables_Table_Entry_t *MemResTablesTblPtr; /**< \brief CS results entry for the CS memory */ 172 | CS_Res_Tables_Table_Entry_t *AppResTablesTblPtr; /**< \brief CS results entry for the CS apps */ 173 | CS_Res_Tables_Table_Entry_t *TblResTablesTblPtr; /**< \brief CS results table entry for the CS tables */ 174 | 175 | #if (CS_PRESERVE_STATES_ON_PROCESSOR_RESET == true) 176 | CFE_ES_CDSHandle_t DataStoreHandle; /**< \brief Handle to critical data store created by CS */ 177 | #endif 178 | } CS_AppData_t; 179 | 180 | /************************************************************************** 181 | ** 182 | ** Exported data 183 | ** 184 | **************************************************************************/ 185 | 186 | /** 187 | * \brief Extern the CS_AppData so all CS files can use it 188 | */ 189 | extern CS_AppData_t CS_AppData; 190 | 191 | /************************************************************************** 192 | ** 193 | ** Function Prototypes 194 | ** 195 | **************************************************************************/ 196 | 197 | /** 198 | * \brief CFS Checksum (CS) application entry point 199 | * 200 | * \par Description 201 | * Checksum application entry point and main process loop. 202 | * 203 | * \par Assumptions, External Events, and Notes: 204 | * None 205 | */ 206 | void CS_AppMain(void); 207 | 208 | #if (CS_PRESERVE_STATES_ON_PROCESSOR_RESET == true) 209 | 210 | /** 211 | * \brief CFS Checksum (CS) Critical Data Store Update 212 | * 213 | * \par Description 214 | * Checksum application entry point and main process loop. 215 | * 216 | * \par Assumptions, External Events, and Notes: 217 | * None 218 | */ 219 | void CS_UpdateCDS(void); 220 | 221 | #endif 222 | 223 | /** 224 | * \brief Initialize the Checksum CFS application 225 | * 226 | * \par Description 227 | * Checksum application initialization routine. This 228 | * function performs all the required startup steps to 229 | * get the application registered with the cFE services so 230 | * it can begin to receive command messages and begin 231 | * background checksumming. 232 | * 233 | * \par Assumptions, External Events, and Notes: 234 | * None 235 | * 236 | * \return Execution status, see \ref CFEReturnCodes 237 | * \retval #CFE_SUCCESS \copybrief CFE_SUCCESS 238 | */ 239 | CFE_Status_t CS_AppInit(void); 240 | 241 | /** 242 | * \brief Process a command pipe message 243 | * 244 | * \par Description 245 | * Processes a single software bus command pipe message. Checks 246 | * the message and command IDs and calls the appropriate routine 247 | * to handle the command. 248 | * 249 | * \par Assumptions, External Events, and Notes: 250 | * None 251 | * 252 | * \param [in] BufPtr A #CFE_SB_Buffer_t* pointer that 253 | * references the software bus message. The 254 | * calling function verifies that BufPtr is 255 | * non-null. 256 | * 257 | * \return Execution status, see \ref CFEReturnCodes 258 | * \retval #CFE_SUCCESS \copybrief CFE_SUCCESS 259 | */ 260 | CFE_Status_t CS_AppPipe(const CFE_SB_Buffer_t *BufPtr); 261 | 262 | /** 263 | * \brief Process housekeeping request 264 | * 265 | * \par Description 266 | * Processes an on-board housekeeping request message. 267 | * 268 | * \par Assumptions, External Events, and Notes: 269 | * This command does not affect the command execution counter 270 | * 271 | * \param[in] CmdPtr Command pointer, verified non-null in CS_AppMain 272 | */ 273 | void CS_HousekeepingCmd(const CS_NoArgsCmd_t *CmdPtr); 274 | 275 | /** 276 | * \brief Command packet processor 277 | * 278 | * \par Description 279 | * Processes all CS commands 280 | * 281 | * \param [in] BufPtr A CFE_SB_Buffer_t* pointer that 282 | * references the software bus pointer. The 283 | * BufPtr is verified non-null in CS_AppMain. 284 | */ 285 | void CS_ProcessCmd(const CFE_SB_Buffer_t *BufPtr); 286 | 287 | #if (CS_PRESERVE_STATES_ON_PROCESSOR_RESET == true) 288 | /** 289 | * \brief Restore tables states from CDS if enabled 290 | * 291 | * \par Description 292 | * Restore CS state of tables from CDS 293 | * 294 | * \par Assumptions, External Events, and Notes: 295 | * None 296 | * 297 | * \return Execution status, see \ref CFEReturnCodes 298 | * \retval #CFE_SUCCESS \copybrief CFE_SUCCESS 299 | */ 300 | CFE_Status_t CS_CreateRestoreStatesFromCDS(void); 301 | #endif 302 | 303 | #endif 304 | -------------------------------------------------------------------------------- /fsw/src/cs_app_cmds.c: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,915-1, and identified as “cFS Checksum 3 | * Application version 2.5.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 Checksum (CS) Application's commands for checking App 23 | */ 24 | 25 | /************************************************************************* 26 | ** 27 | ** Include section 28 | ** 29 | **************************************************************************/ 30 | #include "cfe.h" 31 | #include "cs_app.h" 32 | #include "cs_events.h" 33 | #include "cs_utils.h" 34 | #include "cs_compute.h" 35 | #include "cs_app_cmds.h" 36 | /************************************************************************** 37 | ** 38 | ** Functions 39 | ** 40 | **************************************************************************/ 41 | 42 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 43 | /* */ 44 | /* CS Disable background checking of App command */ 45 | /* */ 46 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 47 | void CS_DisableAppCmd(const CS_NoArgsCmd_t *CmdPtr) 48 | { 49 | if (CS_CheckRecomputeOneshot() == false) 50 | { 51 | CS_AppData.HkPacket.Payload.AppCSState = CS_STATE_DISABLED; 52 | CS_ZeroAppTempValues(); 53 | 54 | #if (CS_PRESERVE_STATES_ON_PROCESSOR_RESET == true) 55 | CS_UpdateCDS(); 56 | #endif 57 | 58 | CFE_EVS_SendEvent(CS_DISABLE_APP_INF_EID, CFE_EVS_EventType_INFORMATION, "Checksumming of App is Disabled"); 59 | CS_AppData.HkPacket.Payload.CmdCounter++; 60 | } 61 | } 62 | 63 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 64 | /* */ 65 | /* CS Enable background checking of App command */ 66 | /* */ 67 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 68 | void CS_EnableAppCmd(const CS_NoArgsCmd_t *CmdPtr) 69 | { 70 | if (CS_CheckRecomputeOneshot() == false) 71 | { 72 | CS_AppData.HkPacket.Payload.AppCSState = CS_STATE_ENABLED; 73 | 74 | #if (CS_PRESERVE_STATES_ON_PROCESSOR_RESET == true) 75 | CS_UpdateCDS(); 76 | #endif 77 | 78 | CFE_EVS_SendEvent(CS_ENABLE_APP_INF_EID, CFE_EVS_EventType_INFORMATION, "Checksumming of App is Enabled"); 79 | CS_AppData.HkPacket.Payload.CmdCounter++; 80 | } 81 | } 82 | 83 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 84 | /* */ 85 | /* CS Report the baseline checksum of an entry in the App table */ 86 | /* */ 87 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 88 | void CS_ReportBaselineAppCmd(const CS_AppNameCmd_t *CmdPtr) 89 | { 90 | /* command verification variables */ 91 | CS_Res_App_Table_Entry_t *ResultsEntry; 92 | uint32 Baseline; 93 | char Name[OS_MAX_API_NAME]; 94 | 95 | strncpy(Name, CmdPtr->Payload.Name, sizeof(Name) - 1); 96 | Name[sizeof(Name) - 1] = '\0'; 97 | 98 | if (CS_GetAppResTblEntryByName(&ResultsEntry, Name)) 99 | { 100 | if (ResultsEntry->ComputedYet == true) 101 | { 102 | Baseline = ResultsEntry->ComparisonValue; 103 | CFE_EVS_SendEvent(CS_BASELINE_APP_INF_EID, CFE_EVS_EventType_INFORMATION, 104 | "Report baseline of app %s is 0x%08X", Name, (unsigned int)Baseline); 105 | } 106 | else 107 | { 108 | CFE_EVS_SendEvent(CS_NO_BASELINE_APP_INF_EID, CFE_EVS_EventType_INFORMATION, 109 | "Report baseline of app %s has not been computed yet", Name); 110 | } 111 | CS_AppData.HkPacket.Payload.CmdCounter++; 112 | } 113 | else 114 | { 115 | CFE_EVS_SendEvent(CS_BASELINE_INVALID_NAME_APP_ERR_EID, CFE_EVS_EventType_ERROR, 116 | "App report baseline failed, app %s not found", Name); 117 | CS_AppData.HkPacket.Payload.CmdErrCounter++; 118 | } 119 | } 120 | 121 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 122 | /* */ 123 | /* CS Recompute the baseline of an entry in the App table cmd */ 124 | /* */ 125 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 126 | void CS_RecomputeBaselineAppCmd(const CS_AppNameCmd_t *CmdPtr) 127 | { 128 | /* command verification variables */ 129 | CFE_ES_TaskId_t ChildTaskID; 130 | CFE_Status_t Status; 131 | CS_Res_App_Table_Entry_t *ResultsEntry; 132 | char Name[OS_MAX_API_NAME]; 133 | 134 | if (CS_AppData.HkPacket.Payload.RecomputeInProgress == false && CS_AppData.HkPacket.Payload.OneShotInProgress == false) 135 | { 136 | strncpy(Name, CmdPtr->Payload.Name, sizeof(Name) - 1); 137 | Name[sizeof(Name) - 1] = '\0'; 138 | 139 | /* make sure the entry is a valid number and is defined in the table */ 140 | if (CS_GetAppResTblEntryByName(&ResultsEntry, Name)) 141 | { 142 | /* There is no child task running right now, we can use it*/ 143 | CS_AppData.HkPacket.Payload.RecomputeInProgress = true; 144 | 145 | /* fill in child task variables */ 146 | CS_AppData.ChildTaskTable = CS_APP_TABLE; 147 | 148 | CS_AppData.RecomputeAppEntryPtr = ResultsEntry; 149 | 150 | Status = CFE_ES_CreateChildTask(&ChildTaskID, CS_RECOMP_APP_TASK_NAME, CS_RecomputeAppChildTask, NULL, 151 | CFE_PLATFORM_ES_DEFAULT_STACK_SIZE, CS_CHILD_TASK_PRIORITY, 0); 152 | if (Status == CFE_SUCCESS) 153 | { 154 | CFE_EVS_SendEvent(CS_RECOMPUTE_APP_STARTED_DBG_EID, CFE_EVS_EventType_DEBUG, 155 | "Recompute baseline of app %s started", Name); 156 | CS_AppData.HkPacket.Payload.CmdCounter++; 157 | } 158 | else /* child task creation failed */ 159 | { 160 | CFE_EVS_SendEvent(CS_RECOMPUTE_APP_CREATE_CHDTASK_ERR_EID, CFE_EVS_EventType_ERROR, 161 | "Recompute baseline of app %s failed, CFE_ES_CreateChildTask returned: 0x%08X", 162 | Name, (unsigned int)Status); 163 | CS_AppData.HkPacket.Payload.CmdErrCounter++; 164 | CS_AppData.HkPacket.Payload.RecomputeInProgress = false; 165 | } 166 | } 167 | else 168 | { 169 | CFE_EVS_SendEvent(CS_RECOMPUTE_UNKNOWN_NAME_APP_ERR_EID, CFE_EVS_EventType_ERROR, 170 | "App recompute baseline failed, app %s not found", Name); 171 | CS_AppData.HkPacket.Payload.CmdErrCounter++; 172 | } 173 | } 174 | else 175 | { 176 | /*send event that we can't start another task right now */ 177 | CFE_EVS_SendEvent(CS_RECOMPUTE_APP_CHDTASK_ERR_EID, CFE_EVS_EventType_ERROR, 178 | "App recompute baseline for app %s failed: child task in use", Name); 179 | CS_AppData.HkPacket.Payload.CmdErrCounter++; 180 | } 181 | } 182 | 183 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 184 | /* */ 185 | /* CS Disable a specific entry in the App table command */ 186 | /* */ 187 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 188 | void CS_DisableNameAppCmd(const CS_AppNameCmd_t *CmdPtr) 189 | { 190 | /* command verification variables */ 191 | CS_Res_App_Table_Entry_t *ResultsEntry; 192 | CS_Def_App_Table_Entry_t *DefinitionEntry; 193 | char Name[OS_MAX_API_NAME]; 194 | 195 | if (CS_CheckRecomputeOneshot() == false) 196 | { 197 | strncpy(Name, CmdPtr->Payload.Name, sizeof(Name) - 1); 198 | Name[sizeof(Name) - 1] = '\0'; 199 | 200 | if (CS_GetAppResTblEntryByName(&ResultsEntry, Name)) 201 | { 202 | ResultsEntry->State = CS_STATE_DISABLED; 203 | ResultsEntry->TempChecksumValue = 0; 204 | ResultsEntry->ByteOffset = 0; 205 | 206 | CFE_EVS_SendEvent(CS_DISABLE_APP_NAME_INF_EID, CFE_EVS_EventType_INFORMATION, 207 | "Checksumming of app %s is Disabled", Name); 208 | 209 | if (CS_GetAppDefTblEntryByName(&DefinitionEntry, Name)) 210 | { 211 | DefinitionEntry->State = CS_STATE_DISABLED; 212 | CS_ResetTablesTblResultEntry(CS_AppData.AppResTablesTblPtr); 213 | CFE_TBL_Modified(CS_AppData.DefAppTableHandle); 214 | } 215 | else 216 | { 217 | CFE_EVS_SendEvent(CS_DISABLE_APP_DEF_NOT_FOUND_DBG_EID, CFE_EVS_EventType_DEBUG, 218 | "CS unable to update apps definition table for entry %s", Name); 219 | } 220 | 221 | CS_AppData.HkPacket.Payload.CmdCounter++; 222 | } 223 | 224 | else 225 | { 226 | CFE_EVS_SendEvent(CS_DISABLE_APP_UNKNOWN_NAME_ERR_EID, CFE_EVS_EventType_ERROR, 227 | "App disable app command failed, app %s not found", Name); 228 | CS_AppData.HkPacket.Payload.CmdErrCounter++; 229 | } 230 | } /* end InProgress if */ 231 | } 232 | 233 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 234 | /* */ 235 | /* CS Enable a specific entry in the App table command */ 236 | /* */ 237 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 238 | void CS_EnableNameAppCmd(const CS_AppNameCmd_t *CmdPtr) 239 | { 240 | /* command verification variables */ 241 | CS_Res_App_Table_Entry_t *ResultsEntry; 242 | CS_Def_App_Table_Entry_t *DefinitionEntry; 243 | char Name[OS_MAX_API_NAME]; 244 | 245 | if (CS_CheckRecomputeOneshot() == false) 246 | { 247 | strncpy(Name, CmdPtr->Payload.Name, sizeof(Name) - 1); 248 | Name[sizeof(Name) - 1] = '\0'; 249 | 250 | if (CS_GetAppResTblEntryByName(&ResultsEntry, Name)) 251 | { 252 | ResultsEntry->State = CS_STATE_ENABLED; 253 | 254 | CFE_EVS_SendEvent(CS_ENABLE_APP_NAME_INF_EID, CFE_EVS_EventType_INFORMATION, 255 | "Checksumming of app %s is Enabled", Name); 256 | 257 | if (CS_GetAppDefTblEntryByName(&DefinitionEntry, Name)) 258 | { 259 | DefinitionEntry->State = CS_STATE_ENABLED; 260 | CS_ResetTablesTblResultEntry(CS_AppData.AppResTablesTblPtr); 261 | CFE_TBL_Modified(CS_AppData.DefAppTableHandle); 262 | } 263 | else 264 | { 265 | CFE_EVS_SendEvent(CS_ENABLE_APP_DEF_NOT_FOUND_DBG_EID, CFE_EVS_EventType_DEBUG, 266 | "CS unable to update apps definition table for entry %s", Name); 267 | } 268 | 269 | CS_AppData.HkPacket.Payload.CmdCounter++; 270 | } 271 | else 272 | { 273 | CFE_EVS_SendEvent(CS_ENABLE_APP_UNKNOWN_NAME_ERR_EID, CFE_EVS_EventType_ERROR, 274 | "App enable app command failed, app %s not found", Name); 275 | CS_AppData.HkPacket.Payload.CmdErrCounter++; 276 | } 277 | } /* end InProgress if */ 278 | } 279 | -------------------------------------------------------------------------------- /fsw/src/cs_app_cmds.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,915-1, and identified as “cFS Checksum 3 | * Application version 2.5.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 app cmds 23 | */ 24 | #ifndef CS_APP_CMDS_H 25 | #define CS_APP_CMDS_H 26 | 27 | /************************************************************************** 28 | ** 29 | ** Include section 30 | ** 31 | **************************************************************************/ 32 | #include "cfe.h" 33 | #include "cs_msg.h" 34 | 35 | /** 36 | * \brief Process a disable background checking for the App 37 | * table command 38 | * 39 | * \par Description 40 | * Disables background checking for the App table 41 | * 42 | * \par Assumptions, External Events, and Notes: 43 | * In order for background checking of individual areas 44 | * to checksum (OS code segment, cFE core, EEPROM, Memory, 45 | * Tables, and App) to occur, the table must be enabled 46 | * and overall checksumming must be enabled. 47 | * 48 | * \param[in] CmdPtr Command pointer, verified non-null in CS_AppMain 49 | * 50 | * \sa #CS_DISABLE_APPS_CC 51 | */ 52 | void CS_DisableAppCmd(const CS_NoArgsCmd_t *CmdPtr); 53 | 54 | /** 55 | * \brief Process an enable background checking for the App 56 | * table command 57 | * 58 | * \par Description 59 | * Allows the App table to be background checksummed. 60 | * 61 | * \par Assumptions, External Events, and Notes: 62 | * In order for background checking of individual areas 63 | * to checksum (OS code segment, cFE core, EEPROM, Memory, 64 | * Tables, and App) to occur, the table must be enabled 65 | * and overall checksumming must be enabled. 66 | * 67 | * \param[in] CmdPtr Command pointer, verified non-null in CS_AppMain 68 | * 69 | * \sa #CS_ENABLE_APPS_CC 70 | */ 71 | void CS_EnableAppCmd(const CS_NoArgsCmd_t *CmdPtr); 72 | 73 | /** 74 | * \brief Process a report baseline of an App command 75 | * 76 | * \par Description 77 | * Reports the baseline checksum of the specified app 78 | * if it has already been computed 79 | * 80 | * \par Assumptions, External Events, and Notes: 81 | * None 82 | * 83 | * \param[in] CmdPtr Command pointer, verified non-null in CS_AppMain 84 | * 85 | * \sa #CS_REPORT_BASELINE_APP_CC 86 | */ 87 | void CS_ReportBaselineAppCmd(const CS_AppNameCmd_t *CmdPtr); 88 | 89 | /** 90 | * \brief Process a recopmute baseline of an app command 91 | * 92 | * \par Description 93 | * Recomputes the checksum of an app and use that 94 | * value as the new baseline for that entry. 95 | * 96 | * \par Assumptions, External Events, and Notes: 97 | * None 98 | * 99 | * \param[in] CmdPtr Command pointer, verified non-null in CS_AppMain 100 | * 101 | * \sa #CS_RECOMPUTE_BASELINE_APP_CC 102 | */ 103 | void CS_RecomputeBaselineAppCmd(const CS_AppNameCmd_t *CmdPtr); 104 | 105 | /** 106 | * \brief Process a disable background checking for an App 107 | * entry command 108 | * 109 | * \par Description 110 | * Disables the specified App entry to be background checksummed. 111 | * 112 | * \par Assumptions, External Events, and Notes: 113 | * In order for background checking of individual entries 114 | * to checksum to occur, the entry must be enabled, 115 | * the table must be enabled, and overall checksumming must be enabled. 116 | * This command updates both the results table and the definition table. 117 | * If the entry exists in the results table but not in the definition 118 | * table, the command is still successful, but the definition table 119 | * is not updated. If the entry does not exist in the results table, 120 | * neither table is updated. 121 | * 122 | * \param[in] CmdPtr Command pointer, verified non-null in CS_AppMain 123 | * 124 | * \sa #CS_DISABLE_NAME_APP_CC 125 | */ 126 | void CS_DisableNameAppCmd(const CS_AppNameCmd_t *CmdPtr); 127 | 128 | /** 129 | * \brief Process an enable background checking for an App 130 | * entry command 131 | * 132 | * \par Description 133 | * Allows the specified table to be background checksummed. 134 | * 135 | * \par Assumptions, External Events, and Notes: 136 | * In order for background checking of individual entries 137 | * to checksum to occur, the entry must be enabled, 138 | * the table must be enabled and, overall checksumming must be enabled. 139 | * This command updates both the results table and the definition table. 140 | * If the entry exists in the results table but not in the definition 141 | * table, the command is still successful, but the definition table 142 | * is not updated. If the entry does not exist in the results table, 143 | * neither table is updated. 144 | * 145 | * \param[in] CmdPtr Command pointer, verified non-null in CS_AppMain 146 | * 147 | * \sa #CS_ENABLE_NAME_APP_CC 148 | */ 149 | void CS_EnableNameAppCmd(const CS_AppNameCmd_t *CmdPtr); 150 | 151 | #endif 152 | -------------------------------------------------------------------------------- /fsw/src/cs_cmds.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,915-1, and identified as “cFS Checksum 3 | * Application version 2.5.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 generic cmds 23 | */ 24 | #ifndef CS_CMDS_H 25 | #define CS_CMDS_H 26 | 27 | /************************************************************************** 28 | ** 29 | ** Include section 30 | ** 31 | **************************************************************************/ 32 | #include "cfe.h" 33 | #include "cs_msg.h" 34 | 35 | /** 36 | * \brief Process noop command 37 | * 38 | * \par Description 39 | * Processes a noop ground command. 40 | * 41 | * \par Assumptions, External Events, and Notes: 42 | * None 43 | * 44 | * \param[in] CmdPtr Command pointer, verified non-null in CS_AppMain 45 | * 46 | * \sa #CS_NOOP_CC 47 | */ 48 | void CS_NoopCmd(const CS_NoArgsCmd_t *CmdPtr); 49 | 50 | /** 51 | * \brief Process reset counters command 52 | * 53 | * \par Description 54 | * Processes a reset counters ground command which will reset 55 | * the checksum commmand error and command execution counters 56 | * to zero. It also resets all checksum error counters and 57 | * the passes completed counter. 58 | * 59 | * \par Assumptions, External Events, and Notes: 60 | * None 61 | * 62 | * \param[in] CmdPtr Command pointer, verified non-null in CS_AppMain 63 | * 64 | * \sa #CS_RESET_CC 65 | */ 66 | void CS_ResetCmd(const CS_NoArgsCmd_t *CmdPtr); 67 | 68 | /** 69 | * \brief process a background checking cycle 70 | * 71 | * \par Description 72 | * Processes a background checking cycle when the scheduler 73 | * tell CS. 74 | * 75 | * \par Assumptions, External Events, and Notes: 76 | * None 77 | * 78 | * \param[in] CmdPtr Command pointer, verified non-null in CS_AppMain 79 | */ 80 | void CS_BackgroundCheckCycle(const CS_NoArgsCmd_t *CmdPtr); 81 | 82 | /** 83 | * \brief Process a disable overall background checking command 84 | * 85 | * \par Description 86 | * Disables all background checking in CS 87 | * 88 | * \par Assumptions, External Events, and Notes: 89 | * 90 | * \param[in] CmdPtr Command pointer, verified non-null in CS_AppMain 91 | * 92 | * \sa #CS_DISABLE_ALL_CS_CC 93 | */ 94 | void CS_DisableAllCSCmd(const CS_NoArgsCmd_t *CmdPtr); 95 | 96 | /** 97 | * \brief Process an enable overall background checking command 98 | * 99 | * \par Description 100 | * Allows background checking to take place. 101 | * 102 | * \par Assumptions, External Events, and Notes: 103 | * None 104 | * 105 | * \param[in] CmdPtr Command pointer, verified non-null in CS_AppMain 106 | * 107 | * \sa #CS_ENABLE_ALL_CS_CC 108 | */ 109 | void CS_EnableAllCSCmd(const CS_NoArgsCmd_t *CmdPtr); 110 | 111 | /** 112 | * \brief Process a disable background checking for the cFE core 113 | * code segment command 114 | * 115 | * \par Description 116 | * Disables background checking for the cFE core code segment 117 | * 118 | * \par Assumptions, External Events, and Notes: 119 | * In order for background checking of individual areas 120 | * to checksum (OS code segment, cFE core, EEPROM, Memory, 121 | * Apps, and Tables) to occurr, the table must be enabled 122 | * and overall checksumming must be enabled. 123 | * 124 | * \param[in] CmdPtr Command pointer, verified non-null in CS_AppMain 125 | * 126 | * \sa #CS_DISABLE_CFE_CORE_CC 127 | */ 128 | void CS_DisableCfeCoreCmd(const CS_NoArgsCmd_t *CmdPtr); 129 | 130 | /** 131 | * \brief Process an enable background checking for the cFE core code 132 | * segment command 133 | * 134 | * \par Description 135 | * Allows the cFE Core code segment to be background checksummed. 136 | * 137 | * \par Assumptions, External Events, and Notes: 138 | * In order for background checking of individual areas 139 | * to checksum (OS code segment, cFE core, EEPROM, Memory, 140 | * Apps, and Tables) to occurr, the table must be enabled 141 | * and overall checksumming must be enabled. 142 | * 143 | * \param[in] CmdPtr Command pointer, verified non-null in CS_AppMain 144 | * 145 | * \sa #CS_ENABLE_CFE_CORE_CC 146 | */ 147 | void CS_EnableCfeCoreCmd(const CS_NoArgsCmd_t *CmdPtr); 148 | 149 | /** 150 | * \brief Process a disable background checking for the OS code 151 | * segment command 152 | * 153 | * \par Description 154 | * Disables background checking for the OS code segment 155 | * 156 | * \par Assumptions, External Events, and Notes: 157 | * In order for background checking of individual areas 158 | * to checksum (OS code segment, cFE core, EEPROM, Memory, 159 | * Apps, and Tables) to occurr, the table must be enabled 160 | * and overall checksumming must be enabled. 161 | * 162 | * \param[in] CmdPtr Command pointer, verified non-null in CS_AppMain 163 | * 164 | * \sa #CS_DISABLE_OS_CC 165 | */ 166 | void CS_DisableOSCmd(const CS_NoArgsCmd_t *CmdPtr); 167 | 168 | /** 169 | * \brief Process an enable background checking for the OS code 170 | * segment command 171 | * 172 | * \par Description 173 | * Allows the OS code segment to be background checksummed. 174 | * 175 | * \par Assumptions, External Events, and Notes: 176 | * In order for background checking of individual areas 177 | * to checksum (OS code segment, cFE core, EEPROM, Memory, 178 | * Apps, and Tables) to occurr, the table must be enabled 179 | * and overall checksumming must be enabled. 180 | * 181 | * \param[in] CmdPtr Command pointer, verified non-null in CS_AppMain 182 | * 183 | * \sa #CS_ENABLE_OS_CC 184 | */ 185 | void CS_EnableOSCmd(const CS_NoArgsCmd_t *CmdPtr); 186 | 187 | /** 188 | * \brief Process a report baseline of the cFE Core command 189 | * 190 | * \par Description 191 | * Reports the baseline checksum of the cFE core code segment 192 | * if it has already been computed 193 | * 194 | * \par Assumptions, External Events, and Notes: 195 | * None 196 | * 197 | * \param[in] CmdPtr Command pointer, verified non-null in CS_AppMain 198 | * 199 | * \sa #CS_REPORT_BASELINE_CFE_CORE_CC 200 | */ 201 | void CS_ReportBaselineCfeCoreCmd(const CS_NoArgsCmd_t *CmdPtr); 202 | 203 | /** 204 | * \brief Process a report baseline of the OS command 205 | * 206 | * \par Description 207 | * Reports the baseline checksum of the OS code segment 208 | * if it has already been computed 209 | * 210 | * \par Assumptions, External Events, and Notes: 211 | * None 212 | * 213 | * \param[in] CmdPtr Command pointer, verified non-null in CS_AppMain 214 | * 215 | * \sa #CS_REPORT_BASELINE_OS_CC 216 | */ 217 | void CS_ReportBaselineOSCmd(const CS_NoArgsCmd_t *CmdPtr); 218 | 219 | /** 220 | * \brief Process a recopmute baseline of the cFE core code segment command 221 | * 222 | * \par Description 223 | * Recomputes the checksum of the cFE core code segment and use that 224 | * value as the new baseline for the cFE core. 225 | * 226 | * \par Assumptions, External Events, and Notes: 227 | * None 228 | * 229 | * \param[in] CmdPtr Command pointer, verified non-null in CS_AppMain 230 | * 231 | * \sa #CS_RECOMPUTE_BASELINE_CFE_CORE_CC 232 | */ 233 | void CS_RecomputeBaselineCfeCoreCmd(const CS_NoArgsCmd_t *CmdPtr); 234 | 235 | /** 236 | * \brief Process a recopmute baseline of the OS command 237 | * 238 | * \par Description 239 | * Recomputes the checksum of the OS code segment and use that 240 | * value as the new baseline for the OS. 241 | * 242 | * \par Assumptions, External Events, and Notes: 243 | * None 244 | * 245 | * \param[in] CmdPtr Command pointer, verified non-null in CS_AppMain 246 | * 247 | * \sa #CS_RECOMPUTE_BASELINE_OS_CC 248 | */ 249 | void CS_RecomputeBaselineOSCmd(const CS_NoArgsCmd_t *CmdPtr); 250 | 251 | /** 252 | * \brief Process a start a one shot checksum command 253 | * 254 | * \par Description 255 | * Starts a one shot checksum on given address and size, 256 | * and reports checksum in telemetry and an event message. 257 | * 258 | * \par Assumptions, External Events, and Notes: 259 | * 260 | * \param[in] CmdPtr Command pointer, verified non-null in CS_AppMain 261 | * 262 | * \sa #CS_ONE_SHOT_CC 263 | */ 264 | void CS_OneShotCmd(const CS_OneShotCmd_t *CmdPtr); 265 | 266 | /** 267 | * \brief Process a cancel one shot checksum command 268 | * 269 | * \par Description 270 | * Cancel a one shot command, if a one shot calculation is 271 | * taking place 272 | * 273 | * \par Assumptions, External Events, and Notes: 274 | * 275 | * \param[in] CmdPtr Command pointer, verified non-null in CS_AppMain 276 | * 277 | * \sa #CS_CANCEL_ONE_SHOT_CC 278 | */ 279 | void CS_CancelOneShotCmd(const CS_NoArgsCmd_t *CmdPtr); 280 | 281 | #endif 282 | -------------------------------------------------------------------------------- /fsw/src/cs_compute.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,915-1, and identified as “cFS Checksum 3 | * Application version 2.5.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 computation functions. 23 | */ 24 | #ifndef CS_COMPUTE_H 25 | #define CS_COMPUTE_H 26 | 27 | /************************************************************************** 28 | ** 29 | ** Include section 30 | ** 31 | **************************************************************************/ 32 | #include "cfe.h" 33 | #include "cs_tbldefs.h" 34 | 35 | /** 36 | * \brief Computes checksums on EEPROM or Memory types 37 | * 38 | * \par Description 39 | * Computes checksums up to MaxBytesPerCycle bytes every call. This 40 | * function is used to compute checksums for EEPROM, Memory, the 41 | * OS code segment and the cFE core code segment 42 | * 43 | * 44 | * \par Assumptions, External Events, and Notes: 45 | * None 46 | * 47 | * \param [in] ResultsEntry A pointer to the entry in a table 48 | * that we want to compute the 49 | * checksum on. Verified non-null by 50 | * calling function. 51 | * 52 | * \param [out] ComputedCSValue Value used to determine the computed 53 | * checksum, if completed 54 | * 55 | * \param [out] DoneWithEntry Value that specifies whether or not 56 | * the specified entry's checksum was 57 | * completed during this call. 58 | * 59 | * \return Execution status 60 | * \retval #CFE_SUCCESS \copybrief CFE_SUCCESS 61 | * \retval #CS_ERROR \copybrief CS_ERROR 62 | */ 63 | CFE_Status_t CS_ComputeEepromMemory(CS_Res_EepromMemory_Table_Entry_t *ResultsEntry, uint32 *ComputedCSValue, 64 | bool *DoneWithEntry); 65 | 66 | /** 67 | * \brief Computes checksums on tables 68 | * 69 | * \par Description 70 | * Computes checksums up to MaxBytesPerCycle bytes every call. This 71 | * function is used to compute checksums for tables. 72 | * 73 | * \par Assumptions, External Events, and Notes: 74 | * None 75 | * 76 | * \param [in] ResultsEntry A pointer to the entry in a table 77 | * that we want to compute the 78 | * checksum on. Verified non-null in 79 | * calling function. 80 | * 81 | * \param [out] ComputedCSValue Value used to determine the computed 82 | * checksum, if completed 83 | * 84 | * \param [out] DoneWithEntry Value that specifies whether or not 85 | * the specified entry's checksum was 86 | * completed during this call. 87 | * 88 | * \return Execution status 89 | * \retval #CFE_SUCCESS \copybrief CFE_SUCCESS 90 | * \retval #CS_ERROR \copybrief CS_ERROR 91 | * \retval #CS_ERR_NOT_FOUND \copydoc CS_ERR_NOT_FOUND 92 | */ 93 | CFE_Status_t CS_ComputeTables(CS_Res_Tables_Table_Entry_t *ResultsEntry, uint32 *ComputedCSValue, bool *DoneWithEntry); 94 | 95 | /** 96 | * \brief Computes checksums on applications 97 | * 98 | * \par Description 99 | * Computes checksums up to MaxBytesPerCycle bytes every call. This 100 | * function is used to compute checksums for applications. 101 | * 102 | * \par Assumptions, External Events, and Notes: 103 | * None 104 | * 105 | * \param [in] ResultsEntry A pointer to the entry in a table 106 | * that we want to compute the 107 | * checksum on. Verified non-null in 108 | * calling function. 109 | * 110 | * \param [out] ComputedCSValue Value used to determine the computed 111 | * checksum, if completed 112 | * 113 | * \param [out] DoneWithEntry Value that specifies whether or not 114 | * the specified entry's checksum was 115 | * completed during this call. 116 | * 117 | * \return Execution status 118 | * \retval #CFE_SUCCESS \copybrief CFE_SUCCESS 119 | * \retval #CS_ERROR \copybrief CS_ERROR 120 | * \retval #CS_ERR_NOT_FOUND \copydoc CS_ERR_NOT_FOUND 121 | */ 122 | CFE_Status_t CS_ComputeApp(CS_Res_App_Table_Entry_t *ResultsEntry, uint32 *ComputedCSValue, bool *DoneWithEntry); 123 | 124 | /** 125 | * \brief Child task main function for recomputing baselines for 126 | * EEPROM and Memory types 127 | * 128 | * \par Description 129 | * Child task main function that is spawned when a recompute 130 | * baseline command is received for EEPROM, Memory, OS code segment 131 | * or cFE core code segment. 132 | * 133 | * \par Assumptions, External Events, and Notes: 134 | * Only one child task for CS can be running at any one time. 135 | */ 136 | void CS_RecomputeEepromMemoryChildTask(void); 137 | 138 | /** 139 | * \brief Child task main function for recomputing baselines for 140 | * Tables 141 | * 142 | * \par Description 143 | * Child task main function that is spawned when a recompute 144 | baseline command is received for a table. 145 | * 146 | * \par Assumptions, External Events, and Notes: 147 | * Only one child task for CS can be running at any one time. 148 | */ 149 | void CS_RecomputeTablesChildTask(void); 150 | 151 | /** 152 | * \brief Child task main function for recomputing baselines for 153 | * Applications 154 | * 155 | * \par Description 156 | Child task main function that is spawned when a recompute 157 | * baseline command is received for Applications. 158 | * 159 | * \par Assumptions, External Events, and Notes: 160 | * Only one child task for CS can be running at any one time. 161 | */ 162 | void CS_RecomputeAppChildTask(void); 163 | 164 | /** 165 | * \brief Child task main function for computing a one shot calculatipn 166 | * 167 | * \par Description 168 | * Child task main function that is spawned when a one shot 169 | * command is received. 170 | * 171 | * \par Assumptions, External Events, and Notes: 172 | * Only one child task for CS can be running at any one time. 173 | */ 174 | void CS_OneShotChildTask(void); 175 | 176 | #endif 177 | -------------------------------------------------------------------------------- /fsw/src/cs_eeprom_cmds.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,915-1, and identified as “cFS Checksum 3 | * Application version 2.5.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 eeprom cmds 23 | */ 24 | #ifndef CS_EEPROM_CMDS_H 25 | #define CS_EEPROM_CMDS_H 26 | 27 | /************************************************************************** 28 | ** 29 | ** Include section 30 | ** 31 | **************************************************************************/ 32 | #include "cfe.h" 33 | #include "cs_msg.h" 34 | 35 | /** 36 | * \brief Process a disable background checking for the EEPROM 37 | * table command 38 | * 39 | * \par Description 40 | * Disables background checking for the EEPROM table 41 | * 42 | * \par Assumptions, External Events, and Notes: 43 | * In order for background checking of individual areas 44 | * to checksum (OS code segment, cFE core, EEPROM, Memory, 45 | * Apps, and Tables) to occur, the table must be enabled 46 | * and overall checksumming must be enabled. 47 | * 48 | * \param[in] CmdPtr Command pointer, verified non-null in CS_AppMain 49 | * 50 | * \sa #CS_DISABLE_EEPROM_CC 51 | */ 52 | void CS_DisableEepromCmd(const CS_NoArgsCmd_t *CmdPtr); 53 | 54 | /** 55 | * \brief Process an enable background checking for the EEPROM 56 | * table command 57 | * 58 | * \par Description 59 | * Allows the EEPROM table to be background checksummed. 60 | * 61 | * \par Assumptions, External Events, and Notes: 62 | * In order for background checking of individual areas 63 | * to checksum (OS code segment, cFE core, EEPROM, Memory, 64 | * Apps, and Tables) to occur, the table must be enabled 65 | * and overall checksumming must be enabled. 66 | * 67 | * \param[in] CmdPtr Command pointer, verified non-null in CS_AppMain 68 | * 69 | * \sa #CS_ENABLE_EEPROM_CC 70 | */ 71 | void CS_EnableEepromCmd(const CS_NoArgsCmd_t *CmdPtr); 72 | 73 | /** 74 | * \brief Proccess a report baseline of an EEPROM Entry command 75 | * 76 | * \par Description 77 | * Reports the baseline checksum of the specified EEPROM table 78 | * entry if it has already been computed 79 | * 80 | * \par Assumptions, External Events, and Notes: 81 | * None 82 | * 83 | * \param[in] CmdPtr Command pointer, verified non-null in CS_AppMain 84 | * 85 | * \sa #CS_REPORT_BASELINE_EEPROM_CC 86 | */ 87 | void CS_ReportBaselineEntryIDEepromCmd(const CS_EntryCmd_t *CmdPtr); 88 | 89 | /** 90 | * \brief Process a disable background checking for an EEPROM 91 | * entry command 92 | * 93 | * \par Description 94 | * Disables the specified EEPROM entry to be background checksummed. 95 | * 96 | * \par Assumptions, External Events, and Notes: 97 | * In order for background checking of individual entries 98 | * to checksum to occur, the entry must be enabled, 99 | * the table must be enabled, and overall checksumming must be enabled. 100 | * This command updates both the results table and the definition table. 101 | * If the entry exists in the results table but not in the definition 102 | * table, the command is still successful, but the definition table 103 | * is not updated. If the entry does not exist in the results table, 104 | * neither table is updated. 105 | * 106 | * \param[in] CmdPtr Command pointer, verified non-null in CS_AppMain 107 | * 108 | * \sa #CS_DISABLE_ENTRY_EEPROM_CC 109 | */ 110 | void CS_DisableEntryIDEepromCmd(const CS_EntryCmd_t *CmdPtr); 111 | 112 | /** 113 | * \brief Process a recopmute baseline of an EEPROM table entry command 114 | * 115 | * \par Description 116 | * Recomputes the checksum of an EEPROM table entry and use that 117 | * value as the new baseline for that entry. 118 | * 119 | * \par Assumptions, External Events, and Notes: 120 | * None 121 | * 122 | * \param[in] CmdPtr Command pointer, verified non-null in CS_AppMain 123 | * 124 | * \sa #CS_RECOMPUTE_BASELINE_EEPROM_CC 125 | */ 126 | void CS_RecomputeBaselineEepromCmd(const CS_EntryCmd_t *CmdPtr); 127 | 128 | /** 129 | * \brief Process an enable background checking for an EEPROM 130 | * entry command 131 | * 132 | * \par Description 133 | * Allows the specified EEPROM entry to be background checksummed. 134 | * 135 | * \par Assumptions, External Events, and Notes: 136 | * In order for background checking of individual entries 137 | * to checksum to occur, the entry must be enabled, 138 | * the table must be enabled and, overall checksumming must be enabled. 139 | * This command updates both the results table and the definition table. 140 | * If the entry exists in the results table but not in the definition 141 | * table, the command is still successful, but the definition table 142 | * is not updated. If the entry does not exist in the results table, 143 | * neither table is updated. 144 | * 145 | * \param[in] CmdPtr Command pointer, verified non-null in CS_AppMain 146 | * 147 | * \sa #CS_ENABLE_ENTRY_EEPROM_CC 148 | */ 149 | void CS_EnableEntryIDEepromCmd(const CS_EntryCmd_t *CmdPtr); 150 | 151 | /** 152 | * \brief Process a get EEPROM Entry by Address command 153 | * 154 | * \par Description 155 | * Send the entry ID of the specified address in an event message 156 | * 157 | * \par Assumptions, External Events, and Notes: 158 | * None 159 | * 160 | * \param[in] CmdPtr Command pointer, verified non-null in CS_AppMain 161 | * 162 | * \sa #CS_GET_ENTRY_ID_EEPROM_CC 163 | */ 164 | void CS_GetEntryIDEepromCmd(const CS_GetEntryIDCmd_t *CmdPtr); 165 | 166 | #endif 167 | -------------------------------------------------------------------------------- /fsw/src/cs_init.c: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,915-1, and identified as “cFS Checksum 3 | * Application version 2.5.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 21 | #include "cfe.h" 22 | #include "cs_app.h" 23 | 24 | #include "cs_platform_cfg.h" 25 | #include "cs_events.h" 26 | #include "cs_utils.h" 27 | #include "cs_compute.h" 28 | #include "cs_eeprom_cmds.h" 29 | #include "cs_table_cmds.h" 30 | #include "cs_memory_cmds.h" 31 | #include "cs_app_cmds.h" 32 | #include "cs_cmds.h" 33 | #include "cs_init.h" 34 | 35 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 36 | /* */ 37 | /* CS Software Bus Setup */ 38 | /* */ 39 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 40 | CFE_Status_t CS_SbInit(void) 41 | { 42 | CFE_Status_t Result = CFE_SUCCESS; 43 | 44 | /* Initialize app configuration data */ 45 | snprintf(CS_AppData.PipeName, sizeof(CS_AppData.PipeName), "%s", CS_CMD_PIPE_NAME); 46 | 47 | CS_AppData.PipeDepth = CS_PIPE_DEPTH; 48 | 49 | /* Initialize housekeeping packet */ 50 | CFE_MSG_Init(CFE_MSG_PTR(CS_AppData.HkPacket.TelemetryHeader), CFE_SB_ValueToMsgId(CS_HK_TLM_MID), 51 | sizeof(CS_HkPacket_t)); 52 | 53 | /* Create Software Bus message pipe */ 54 | Result = CFE_SB_CreatePipe(&CS_AppData.CmdPipe, CS_AppData.PipeDepth, CS_AppData.PipeName); 55 | if (Result != CFE_SUCCESS) 56 | { 57 | CFE_EVS_SendEvent(CS_CR_PIPE_ERR_EID, CFE_EVS_EventType_ERROR, 58 | "Software Bus Create Pipe for command returned: 0x%08X", (unsigned int)Result); 59 | } 60 | else 61 | { 62 | /* Subscribe to Housekeeping request commands */ 63 | Result = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(CS_SEND_HK_MID), CS_AppData.CmdPipe); 64 | 65 | if (Result != CFE_SUCCESS) 66 | { 67 | CFE_EVS_SendEvent(CS_INIT_SB_SUBSCRIBE_HK_ERR_EID, CFE_EVS_EventType_ERROR, 68 | "Software Bus subscribe to housekeeping returned: 0x%08X", (unsigned int)Result); 69 | } 70 | else 71 | { 72 | /* Subscribe to background checking schedule */ 73 | Result = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(CS_BACKGROUND_CYCLE_MID), CS_AppData.CmdPipe); 74 | 75 | if (Result != CFE_SUCCESS) 76 | { 77 | CFE_EVS_SendEvent(CS_INIT_SB_SUBSCRIBE_BACK_ERR_EID, CFE_EVS_EventType_ERROR, 78 | "Software Bus subscribe to background cycle returned: 0x%08X", (unsigned int)Result); 79 | } 80 | } 81 | 82 | if (Result == CFE_SUCCESS) 83 | { 84 | /* Subscribe to CS Internal command packets */ 85 | Result = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(CS_CMD_MID), CS_AppData.CmdPipe); 86 | if (Result != CFE_SUCCESS) 87 | { 88 | CFE_EVS_SendEvent(CS_INIT_SB_SUBSCRIBE_CMD_ERR_EID, CFE_EVS_EventType_ERROR, 89 | "Software Bus subscribe to command returned: 0x%08X", (unsigned int)Result); 90 | } 91 | } 92 | } 93 | return Result; 94 | } 95 | 96 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 97 | /* */ 98 | /* CS Table Initialization */ 99 | /* */ 100 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 101 | CFE_Status_t CS_InitAllTables(void) 102 | { 103 | CFE_Status_t ResultInit = CFE_SUCCESS; 104 | 105 | ResultInit = CS_TableInit(&CS_AppData.DefEepromTableHandle, &CS_AppData.ResEepromTableHandle, 106 | (void *)&CS_AppData.DefEepromTblPtr, (void *)&CS_AppData.ResEepromTblPtr, CS_EEPROM_TABLE, 107 | CS_DEF_EEPROM_TABLE_NAME, CS_RESULTS_EEPROM_TABLE_NAME, CS_MAX_NUM_EEPROM_TABLE_ENTRIES, 108 | CS_DEF_EEPROM_TABLE_FILENAME, &CS_AppData.DefaultEepromDefTable, 109 | sizeof(CS_Def_EepromMemory_Table_Entry_t), sizeof(CS_Res_EepromMemory_Table_Entry_t), 110 | CS_ValidateEepromChecksumDefinitionTable); 111 | 112 | if (ResultInit != CFE_SUCCESS) 113 | { 114 | CS_AppData.HkPacket.Payload.EepromCSState = CS_STATE_DISABLED; 115 | CFE_EVS_SendEvent(CS_INIT_EEPROM_ERR_EID, CFE_EVS_EventType_ERROR, 116 | "Table initialization failed for EEPROM: 0x%08X", (unsigned int)ResultInit); 117 | } 118 | else 119 | { 120 | ResultInit = CS_TableInit(&CS_AppData.DefMemoryTableHandle, &CS_AppData.ResMemoryTableHandle, 121 | (void *)&CS_AppData.DefMemoryTblPtr, (void *)&CS_AppData.ResMemoryTblPtr, 122 | CS_MEMORY_TABLE, CS_DEF_MEMORY_TABLE_NAME, CS_RESULTS_MEMORY_TABLE_NAME, 123 | CS_MAX_NUM_MEMORY_TABLE_ENTRIES, CS_DEF_MEMORY_TABLE_FILENAME, 124 | &CS_AppData.DefaultMemoryDefTable, sizeof(CS_Def_EepromMemory_Table_Entry_t), 125 | sizeof(CS_Res_EepromMemory_Table_Entry_t), CS_ValidateMemoryChecksumDefinitionTable); 126 | 127 | if (ResultInit != CFE_SUCCESS) 128 | { 129 | CS_AppData.HkPacket.Payload.MemoryCSState = CS_STATE_DISABLED; 130 | CFE_EVS_SendEvent(CS_INIT_MEMORY_ERR_EID, CFE_EVS_EventType_ERROR, 131 | "Table initialization failed for Memory: 0x%08X", (unsigned int)ResultInit); 132 | } 133 | } 134 | 135 | if (ResultInit == CFE_SUCCESS) 136 | { 137 | ResultInit = CS_TableInit( 138 | &CS_AppData.DefAppTableHandle, &CS_AppData.ResAppTableHandle, (void *)&CS_AppData.DefAppTblPtr, 139 | (void *)&CS_AppData.ResAppTblPtr, CS_APP_TABLE, CS_DEF_APP_TABLE_NAME, CS_RESULTS_APP_TABLE_NAME, 140 | CS_MAX_NUM_APP_TABLE_ENTRIES, CS_DEF_APP_TABLE_FILENAME, &CS_AppData.DefaultAppDefTable, 141 | sizeof(CS_Def_App_Table_Entry_t), sizeof(CS_Res_App_Table_Entry_t), CS_ValidateAppChecksumDefinitionTable); 142 | 143 | if (ResultInit != CFE_SUCCESS) 144 | { 145 | CS_AppData.HkPacket.Payload.AppCSState = CS_STATE_DISABLED; 146 | CFE_EVS_SendEvent(CS_INIT_APP_ERR_EID, CFE_EVS_EventType_ERROR, 147 | "Table initialization failed for Apps: 0x%08X", (unsigned int)ResultInit); 148 | } 149 | } 150 | 151 | if (ResultInit == CFE_SUCCESS) 152 | { 153 | ResultInit = CS_TableInit(&CS_AppData.DefTablesTableHandle, &CS_AppData.ResTablesTableHandle, 154 | (void *)&CS_AppData.DefTablesTblPtr, (void *)&CS_AppData.ResTablesTblPtr, 155 | CS_TABLES_TABLE, CS_DEF_TABLES_TABLE_NAME, CS_RESULTS_TABLES_TABLE_NAME, 156 | CS_MAX_NUM_TABLES_TABLE_ENTRIES, CS_DEF_TABLES_TABLE_FILENAME, 157 | &CS_AppData.DefaultTablesDefTable, sizeof(CS_Def_Tables_Table_Entry_t), 158 | sizeof(CS_Res_Tables_Table_Entry_t), CS_ValidateTablesChecksumDefinitionTable); 159 | 160 | if (ResultInit != CFE_SUCCESS) 161 | { 162 | CS_AppData.HkPacket.Payload.TablesCSState = CS_STATE_DISABLED; 163 | CFE_EVS_SendEvent(CS_INIT_TABLES_ERR_EID, CFE_EVS_EventType_ERROR, 164 | "Table initialization failed for Tables: 0x%08X", (unsigned int)ResultInit); 165 | } 166 | } 167 | 168 | return ResultInit; 169 | } 170 | 171 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 172 | /* */ 173 | /* CS Segment Initialization */ 174 | /* */ 175 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 176 | void CS_InitSegments(void) 177 | { 178 | int32 ResultSegment = OS_SUCCESS; 179 | uint32 CFESize; 180 | cpuaddr CFEAddress; 181 | uint32 KernelSize; 182 | cpuaddr KernelAddress; 183 | 184 | /* Initalize the CFE core segments */ 185 | ResultSegment = CFE_PSP_GetCFETextSegmentInfo(&CFEAddress, &CFESize); 186 | 187 | if (ResultSegment != OS_SUCCESS) 188 | { 189 | CS_AppData.CfeCoreCodeSeg.StartAddress = 0; 190 | CS_AppData.CfeCoreCodeSeg.NumBytesToChecksum = 0; 191 | CS_AppData.CfeCoreCodeSeg.ComputedYet = false; 192 | CS_AppData.CfeCoreCodeSeg.ComparisonValue = 0; 193 | CS_AppData.CfeCoreCodeSeg.ByteOffset = 0; 194 | CS_AppData.CfeCoreCodeSeg.TempChecksumValue = 0; 195 | CS_AppData.CfeCoreCodeSeg.State = CS_STATE_DISABLED; 196 | 197 | CFE_EVS_SendEvent(CS_CFE_TEXT_SEG_INF_EID, CFE_EVS_EventType_INFORMATION, "CFE Text Segment disabled"); 198 | } 199 | else 200 | { 201 | CS_AppData.CfeCoreCodeSeg.StartAddress = CFEAddress; 202 | CS_AppData.CfeCoreCodeSeg.NumBytesToChecksum = CFESize; 203 | CS_AppData.CfeCoreCodeSeg.ComputedYet = false; 204 | CS_AppData.CfeCoreCodeSeg.ComparisonValue = 0; 205 | CS_AppData.CfeCoreCodeSeg.ByteOffset = 0; 206 | CS_AppData.CfeCoreCodeSeg.TempChecksumValue = 0; 207 | CS_AppData.CfeCoreCodeSeg.State = CS_STATE_ENABLED; 208 | } 209 | 210 | /* Initialize the OS Core code segment*/ 211 | 212 | ResultSegment = CFE_PSP_GetKernelTextSegmentInfo(&KernelAddress, &KernelSize); 213 | 214 | if (ResultSegment != OS_SUCCESS) 215 | { 216 | CS_AppData.OSCodeSeg.StartAddress = 0; 217 | CS_AppData.OSCodeSeg.NumBytesToChecksum = 0; 218 | CS_AppData.OSCodeSeg.ComputedYet = false; 219 | CS_AppData.OSCodeSeg.ComparisonValue = 0; 220 | CS_AppData.OSCodeSeg.ByteOffset = 0; 221 | CS_AppData.OSCodeSeg.TempChecksumValue = 0; 222 | CS_AppData.OSCodeSeg.State = CS_STATE_DISABLED; 223 | 224 | CFE_EVS_SendEvent(CS_OS_TEXT_SEG_INF_EID, CFE_EVS_EventType_INFORMATION, 225 | "OS Text Segment disabled due to platform"); 226 | } 227 | else 228 | { 229 | CS_AppData.OSCodeSeg.StartAddress = KernelAddress; 230 | CS_AppData.OSCodeSeg.NumBytesToChecksum = KernelSize; 231 | CS_AppData.OSCodeSeg.ComputedYet = false; 232 | CS_AppData.OSCodeSeg.ComparisonValue = 0; 233 | CS_AppData.OSCodeSeg.ByteOffset = 0; 234 | CS_AppData.OSCodeSeg.TempChecksumValue = 0; 235 | CS_AppData.OSCodeSeg.State = CS_STATE_ENABLED; 236 | } 237 | } 238 | -------------------------------------------------------------------------------- /fsw/src/cs_init.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,915-1, and identified as “cFS Checksum 3 | * Application version 2.5.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 | * Initialization subroutines for CS. 23 | */ 24 | #ifndef CS_INIT_H 25 | #define CS_INIT_H 26 | 27 | /************************************************************************** 28 | ** 29 | ** Include section 30 | ** 31 | **************************************************************************/ 32 | #include "cfe.h" 33 | 34 | /** 35 | * \brief Initializes the Software Bus Pipes for the Checksum Application 36 | * 37 | * \par Description 38 | * Configures cFE Software Bus resources used by the Checksum 39 | * application. 40 | * 41 | * \par Assumptions, External Events, and Notes: 42 | * None 43 | * 44 | * \return Execution status, see \ref CFEReturnCodes 45 | * \retval #CFE_SUCCESS \copybrief CFE_SUCCESS 46 | */ 47 | CFE_Status_t CS_SbInit(void); 48 | 49 | /** 50 | * \brief Initializes the tables for the Checksum Application 51 | * 52 | * \par Description 53 | * Initializes all tables used by the Checksum application. 54 | * 55 | * \par Assumptions, External Events, and Notes: 56 | * None 57 | * 58 | * \return Execution status, see \ref CFEReturnCodes 59 | * \retval #CFE_SUCCESS \copybrief CFE_SUCCESS 60 | */ 61 | CFE_Status_t CS_InitAllTables(void); 62 | 63 | /** 64 | * \brief Initializes the cFE and OS segments for the Checksum Application 65 | * 66 | * \par Description 67 | * Initializes the cFE and OS segments for the Checksum Application. 68 | * 69 | * \par Assumptions, External Events, and Notes: 70 | * None 71 | */ 72 | void CS_InitSegments(void); 73 | 74 | #endif 75 | -------------------------------------------------------------------------------- /fsw/src/cs_memory_cmds.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,915-1, and identified as “cFS Checksum 3 | * Application version 2.5.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 Memory cmds 23 | */ 24 | #ifndef CS_MEMORY_CMDS_H 25 | #define CS_MEMORY_CMDS_H 26 | 27 | /************************************************************************** 28 | ** 29 | ** Include section 30 | ** 31 | **************************************************************************/ 32 | #include "cfe.h" 33 | #include "cs_msg.h" 34 | 35 | /** 36 | * \brief Process a disable background checking for the Memory 37 | * table command 38 | * 39 | * \par Description 40 | * Disables background checking for the Memory table 41 | * 42 | * \par Assumptions, External Events, and Notes: 43 | * In order for background checking of individual areas 44 | * to checksum (OS code segment, cFE core, EEPROM, Memory, 45 | * Apps, and Tables) to occur, the table must be enabled 46 | * and overall checksumming must be enabled. 47 | * 48 | * \param[in] CmdPtr Command pointer, verified non-null in CS_AppMain 49 | * 50 | * \sa #CS_DISABLE_MEMORY_CC 51 | */ 52 | void CS_DisableMemoryCmd(const CS_NoArgsCmd_t *CmdPtr); 53 | 54 | /** 55 | * \brief Process an enable background checking for the Memory 56 | * table command 57 | * 58 | * \par Description 59 | * Allows the Memory table to be background checksummed. 60 | * 61 | * \par Assumptions, External Events, and Notes: 62 | * In order for background checking of individual areas 63 | * to checksum (OS code segment, cFE core, EEPROM, Memory, 64 | * Apps, and Tables) to occur, the table must be enabled 65 | * and overall checksumming must be enabled. 66 | * 67 | * \param[in] CmdPtr Command pointer, verified non-null in CS_AppMain 68 | * 69 | * \sa #CS_ENABLE_MEMORY_CC 70 | */ 71 | void CS_EnableMemoryCmd(const CS_NoArgsCmd_t *CmdPtr); 72 | 73 | /** 74 | * \brief Proccess a report baseline of a Memory Entry command 75 | * 76 | * \par Description 77 | * Reports the baseline checksum of the specified Memory table 78 | * entry if it has already been computed 79 | * 80 | * \par Assumptions, External Events, and Notes: 81 | * None 82 | * 83 | * \param[in] CmdPtr Command pointer, verified non-null in CS_AppMain 84 | * 85 | * \sa #CS_REPORT_BASELINE_MEMORY_CC 86 | */ 87 | void CS_ReportBaselineEntryIDMemoryCmd(const CS_EntryCmd_t *CmdPtr); 88 | 89 | /** 90 | * \brief Process a disable background checking for a Memory 91 | * entry command 92 | * 93 | * \par Description 94 | * Disables the specified Memory entry to be background checksummed. 95 | * 96 | * \par Assumptions, External Events, and Notes: 97 | * In order for background checking of individual entries 98 | * to checksum to occur, the entry must be enabled, 99 | * the table must be enabled, and overall checksumming must be enabled. 100 | * This command updates both the results table and the definition table. 101 | * If the entry exists in the results table but not in the definition 102 | * table, the command is still successful, but the definition table 103 | * is not updated. If the entry does not exist in the results table, 104 | * neither table is updated. 105 | * 106 | * \param[in] CmdPtr Command pointer, verified non-null in CS_AppMain 107 | * 108 | * \sa #CS_DISABLE_ENTRY_MEMORY_CC 109 | */ 110 | void CS_DisableEntryIDMemoryCmd(const CS_EntryCmd_t *CmdPtr); 111 | 112 | /** 113 | * \brief Process a recopmute baseline of a Memory table entry command 114 | * 115 | * \par Description 116 | * Recomputes the checksum of a Memory table entry and use that 117 | * value as the new baseline for that entry. 118 | * 119 | * \par Assumptions, External Events, and Notes: 120 | * None 121 | * 122 | * \param[in] CmdPtr Command pointer, verified non-null in CS_AppMain 123 | * 124 | * \sa #CS_RECOMPUTE_BASELINE_MEMORY_CC 125 | */ 126 | void CS_RecomputeBaselineMemoryCmd(const CS_EntryCmd_t *CmdPtr); 127 | 128 | /** 129 | * \brief Process an enable background checking for a Memory 130 | * entry command 131 | * 132 | * \par Description 133 | * Allows the specified Memory entry to be background checksummed. 134 | * 135 | * \par Assumptions, External Events, and Notes: 136 | * In order for background checking of individual entries 137 | * to checksum to occur, the entry must be enabled, 138 | * the table must be enabled and, overall checksumming must be enabled. 139 | * This command updates both the results table and the definition table. 140 | * If the entry exists in the results table but not in the definition 141 | * table, the command is still successful, but the definition table 142 | * is not updated. If the entry does not exist in the results table, 143 | * neither table is updated. 144 | * 145 | * \param[in] CmdPtr Command pointer, verified non-null in CS_AppMain 146 | * 147 | * \sa #CS_ENABLE_ENTRY_MEMORY_CC 148 | */ 149 | void CS_EnableEntryIDMemoryCmd(const CS_EntryCmd_t *CmdPtr); 150 | 151 | /** 152 | * \brief Process a get Memory Entry by Address command 153 | * 154 | * \par Description 155 | * Send the entry ID of the specified address in an event message 156 | * 157 | * \par Assumptions, External Events, and Notes: 158 | * None 159 | * 160 | * 161 | * \param[in] CmdPtr Command pointer, verified non-null in CS_AppMain 162 | * 163 | * \sa #CS_GET_ENTRY_ID_MEMORY_CC 164 | */ 165 | void CS_GetEntryIDMemoryCmd(const CS_GetEntryIDCmd_t *CmdPtr); 166 | 167 | #endif 168 | -------------------------------------------------------------------------------- /fsw/src/cs_table_cmds.c: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,915-1, and identified as “cFS Checksum 3 | * Application version 2.5.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 Checksum (CS) Application's commands for checking Tables 23 | */ 24 | 25 | /************************************************************************* 26 | ** 27 | ** Include section 28 | ** 29 | **************************************************************************/ 30 | #include "cfe.h" 31 | #include "cs_app.h" 32 | #include "cs_events.h" 33 | #include "cs_utils.h" 34 | #include "cs_compute.h" 35 | #include "cs_table_cmds.h" 36 | /************************************************************************** 37 | ** 38 | ** Functions 39 | ** 40 | **************************************************************************/ 41 | 42 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 43 | /* */ 44 | /* CS Disable background checking of Tables command */ 45 | /* */ 46 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 47 | void CS_DisableTablesCmd(const CS_NoArgsCmd_t *CmdPtr) 48 | { 49 | if (CS_CheckRecomputeOneshot() == false) 50 | { 51 | CS_AppData.HkPacket.Payload.TablesCSState = CS_STATE_DISABLED; 52 | CS_ZeroTablesTempValues(); 53 | 54 | #if (CS_PRESERVE_STATES_ON_PROCESSOR_RESET == true) 55 | CS_UpdateCDS(); 56 | #endif 57 | 58 | CFE_EVS_SendEvent(CS_DISABLE_TABLES_INF_EID, CFE_EVS_EventType_INFORMATION, 59 | "Checksumming of Tables is Disabled"); 60 | CS_AppData.HkPacket.Payload.CmdCounter++; 61 | } 62 | } 63 | 64 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 65 | /* */ 66 | /* CS Enable background checking of Tables command */ 67 | /* */ 68 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 69 | void CS_EnableTablesCmd(const CS_NoArgsCmd_t *CmdPtr) 70 | { 71 | if (CS_CheckRecomputeOneshot() == false) 72 | { 73 | CS_AppData.HkPacket.Payload.TablesCSState = CS_STATE_ENABLED; 74 | 75 | #if (CS_PRESERVE_STATES_ON_PROCESSOR_RESET == true) 76 | CS_UpdateCDS(); 77 | #endif 78 | 79 | CFE_EVS_SendEvent(CS_ENABLE_TABLES_INF_EID, CFE_EVS_EventType_INFORMATION, 80 | "Checksumming of Tables is Enabled"); 81 | CS_AppData.HkPacket.Payload.CmdCounter++; 82 | } 83 | } 84 | 85 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 86 | /* */ 87 | /* CS Report the baseline checksum of an entry in the Tables table */ 88 | /* */ 89 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 90 | void CS_ReportBaselineTablesCmd(const CS_TableNameCmd_t *CmdPtr) 91 | { 92 | CS_Res_Tables_Table_Entry_t *ResultsEntry; 93 | uint32 Baseline; 94 | char Name[CFE_TBL_MAX_FULL_NAME_LEN]; 95 | 96 | strncpy(Name, CmdPtr->Payload.Name, sizeof(Name) - 1); 97 | Name[sizeof(Name) - 1] = '\0'; 98 | 99 | if (CS_GetTableResTblEntryByName(&ResultsEntry, Name)) 100 | { 101 | if (ResultsEntry->ComputedYet == true) 102 | { 103 | Baseline = ResultsEntry->ComparisonValue; 104 | CFE_EVS_SendEvent(CS_BASELINE_TABLES_INF_EID, CFE_EVS_EventType_INFORMATION, 105 | "Report baseline of table %s is 0x%08X", Name, (unsigned int)Baseline); 106 | } 107 | else 108 | { 109 | CFE_EVS_SendEvent(CS_NO_BASELINE_TABLES_INF_EID, CFE_EVS_EventType_INFORMATION, 110 | "Report baseline of table %s has not been computed yet", Name); 111 | } 112 | CS_AppData.HkPacket.Payload.CmdCounter++; 113 | } 114 | else 115 | { 116 | CFE_EVS_SendEvent(CS_BASELINE_INVALID_NAME_TABLES_ERR_EID, CFE_EVS_EventType_ERROR, 117 | "Tables report baseline failed, table %s not found", Name); 118 | CS_AppData.HkPacket.Payload.CmdErrCounter++; 119 | } 120 | } 121 | 122 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 123 | /* */ 124 | /* CS Recompute the baseline of an entry in the Tables table cmd */ 125 | /* */ 126 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 127 | void CS_RecomputeBaselineTablesCmd(const CS_TableNameCmd_t *CmdPtr) 128 | { 129 | CFE_ES_TaskId_t ChildTaskID; 130 | CFE_Status_t Status; 131 | CS_Res_Tables_Table_Entry_t *ResultsEntry; 132 | char Name[CFE_TBL_MAX_FULL_NAME_LEN]; 133 | 134 | if (CS_AppData.HkPacket.Payload.RecomputeInProgress == false && CS_AppData.HkPacket.Payload.OneShotInProgress == false) 135 | { 136 | strncpy(Name, CmdPtr->Payload.Name, sizeof(Name) - 1); 137 | Name[sizeof(Name) - 1] = '\0'; 138 | 139 | /* make sure the entry is a valid number and is defined in the table */ 140 | if (CS_GetTableResTblEntryByName(&ResultsEntry, Name)) 141 | { 142 | /* There is no child task running right now, we can use it*/ 143 | CS_AppData.HkPacket.Payload.RecomputeInProgress = true; 144 | 145 | /* fill in child task variables */ 146 | CS_AppData.ChildTaskTable = CS_TABLES_TABLE; 147 | 148 | CS_AppData.RecomputeTablesEntryPtr = ResultsEntry; 149 | 150 | Status = CFE_ES_CreateChildTask(&ChildTaskID, CS_RECOMP_TABLES_TASK_NAME, CS_RecomputeTablesChildTask, 151 | NULL, CFE_PLATFORM_ES_DEFAULT_STACK_SIZE, CS_CHILD_TASK_PRIORITY, 0); 152 | if (Status == CFE_SUCCESS) 153 | { 154 | CFE_EVS_SendEvent(CS_RECOMPUTE_TABLES_STARTED_DBG_EID, CFE_EVS_EventType_DEBUG, 155 | "Recompute baseline of table %s started", Name); 156 | CS_AppData.HkPacket.Payload.CmdCounter++; 157 | } 158 | else /* child task creation failed */ 159 | { 160 | CFE_EVS_SendEvent(CS_RECOMPUTE_TABLES_CREATE_CHDTASK_ERR_EID, CFE_EVS_EventType_ERROR, 161 | "Recompute baseline of table %s failed, CFE_ES_CreateChildTask returned: 0x%08X", 162 | Name, (unsigned int)Status); 163 | CS_AppData.HkPacket.Payload.CmdErrCounter++; 164 | CS_AppData.HkPacket.Payload.RecomputeInProgress = false; 165 | } 166 | } 167 | else 168 | { 169 | CFE_EVS_SendEvent(CS_RECOMPUTE_UNKNOWN_NAME_TABLES_ERR_EID, CFE_EVS_EventType_ERROR, 170 | "Tables recompute baseline failed, table %s not found", Name); 171 | CS_AppData.HkPacket.Payload.CmdErrCounter++; 172 | } 173 | } 174 | else 175 | { 176 | /*send event that we can't start another task right now */ 177 | CFE_EVS_SendEvent(CS_RECOMPUTE_TABLES_CHDTASK_ERR_EID, CFE_EVS_EventType_ERROR, 178 | "Tables recompute baseline for table %s failed: child task in use", Name); 179 | CS_AppData.HkPacket.Payload.CmdErrCounter++; 180 | } 181 | } 182 | 183 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 184 | /* */ 185 | /* CS Disable a specific entry in the Tables table command */ 186 | /* */ 187 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 188 | void CS_DisableNameTablesCmd(const CS_TableNameCmd_t *CmdPtr) 189 | { 190 | CS_Res_Tables_Table_Entry_t *ResultsEntry; 191 | CS_Def_Tables_Table_Entry_t *DefinitionEntry; 192 | char Name[CFE_TBL_MAX_FULL_NAME_LEN]; 193 | 194 | if (CS_CheckRecomputeOneshot() == false) 195 | { 196 | strncpy(Name, CmdPtr->Payload.Name, sizeof(Name) - 1); 197 | Name[sizeof(Name) - 1] = '\0'; 198 | 199 | if (CS_GetTableResTblEntryByName(&ResultsEntry, Name)) 200 | { 201 | ResultsEntry->State = CS_STATE_DISABLED; 202 | ResultsEntry->TempChecksumValue = 0; 203 | ResultsEntry->ByteOffset = 0; 204 | 205 | CFE_EVS_SendEvent(CS_DISABLE_TABLES_NAME_INF_EID, CFE_EVS_EventType_INFORMATION, 206 | "Checksumming of table %s is Disabled", Name); 207 | 208 | if (CS_GetTableDefTblEntryByName(&DefinitionEntry, Name)) 209 | { 210 | DefinitionEntry->State = CS_STATE_DISABLED; 211 | CS_ResetTablesTblResultEntry(CS_AppData.TblResTablesTblPtr); 212 | CFE_TBL_Modified(CS_AppData.DefTablesTableHandle); 213 | } 214 | else 215 | { 216 | CFE_EVS_SendEvent(CS_DISABLE_TABLE_DEF_NOT_FOUND_DBG_EID, CFE_EVS_EventType_DEBUG, 217 | "CS unable to update tables definition table for entry %s", Name); 218 | } 219 | 220 | CS_AppData.HkPacket.Payload.CmdCounter++; 221 | } 222 | else 223 | { 224 | CFE_EVS_SendEvent(CS_DISABLE_TABLES_UNKNOWN_NAME_ERR_EID, CFE_EVS_EventType_ERROR, 225 | "Tables disable table command failed, table %s not found", Name); 226 | CS_AppData.HkPacket.Payload.CmdErrCounter++; 227 | } 228 | } /* end InProgress if */ 229 | } 230 | 231 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 232 | /* */ 233 | /* CS Enable a specific entry in the Tables table command */ 234 | /* */ 235 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 236 | void CS_EnableNameTablesCmd(const CS_TableNameCmd_t *CmdPtr) 237 | { 238 | CS_Res_Tables_Table_Entry_t *ResultsEntry; 239 | CS_Def_Tables_Table_Entry_t *DefinitionEntry; 240 | char Name[CFE_TBL_MAX_FULL_NAME_LEN]; 241 | 242 | if (CS_CheckRecomputeOneshot() == false) 243 | { 244 | strncpy(Name, CmdPtr->Payload.Name, sizeof(Name) - 1); 245 | Name[sizeof(Name) - 1] = '\0'; 246 | 247 | if (CS_GetTableResTblEntryByName(&ResultsEntry, Name)) 248 | { 249 | ResultsEntry->State = CS_STATE_ENABLED; 250 | 251 | CFE_EVS_SendEvent(CS_ENABLE_TABLES_NAME_INF_EID, CFE_EVS_EventType_INFORMATION, 252 | "Checksumming of table %s is Enabled", Name); 253 | 254 | if (CS_GetTableDefTblEntryByName(&DefinitionEntry, Name)) 255 | { 256 | DefinitionEntry->State = CS_STATE_ENABLED; 257 | CS_ResetTablesTblResultEntry(CS_AppData.TblResTablesTblPtr); 258 | CFE_TBL_Modified(CS_AppData.DefTablesTableHandle); 259 | } 260 | else 261 | { 262 | CFE_EVS_SendEvent(CS_ENABLE_TABLE_DEF_NOT_FOUND_DBG_EID, CFE_EVS_EventType_DEBUG, 263 | "CS unable to update tables definition table for entry %s", Name); 264 | } 265 | 266 | CS_AppData.HkPacket.Payload.CmdCounter++; 267 | } 268 | else 269 | { 270 | CFE_EVS_SendEvent(CS_ENABLE_TABLES_UNKNOWN_NAME_ERR_EID, CFE_EVS_EventType_ERROR, 271 | "Tables enable table command failed, table %s not found", Name); 272 | CS_AppData.HkPacket.Payload.CmdErrCounter++; 273 | } 274 | } /* end InProgress if */ 275 | } 276 | -------------------------------------------------------------------------------- /fsw/src/cs_table_cmds.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,915-1, and identified as “cFS Checksum 3 | * Application version 2.5.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 table cmds 23 | */ 24 | #ifndef CS_TABLE_CMDS_H 25 | #define CS_TABLE_CMDS_H 26 | 27 | /************************************************************************** 28 | ** 29 | ** Include section 30 | ** 31 | **************************************************************************/ 32 | #include "cfe.h" 33 | #include "cs_msg.h" 34 | 35 | /** 36 | * \brief Process a disable background checking for the Tables 37 | * table command 38 | * 39 | * \par Description 40 | * Disables background checking for the Tables table 41 | * 42 | * \par Assumptions, External Events, and Notes: 43 | * In order for background checking of individual areas 44 | * to checksum (OS code segment, cFE core, EEPROM, Memory, 45 | * Apps, and Tables) to occur, the table must be enabled 46 | * and overall checksumming must be enabled. 47 | * 48 | * \param[in] CmdPtr Command pointer, verified non-null in CS_AppMain 49 | * 50 | * \sa #CS_DISABLE_TABLES_CC 51 | */ 52 | void CS_DisableTablesCmd(const CS_NoArgsCmd_t *CmdPtr); 53 | 54 | /** 55 | * \brief Process an enable background checking for the Tables 56 | * table command 57 | * 58 | * \par Description 59 | * Allows the Tables table to be background checksummed. 60 | * 61 | * \par Assumptions, External Events, and Notes: 62 | * In order for background checking of individual areas 63 | * to checksum (OS code segment, cFE core, EEPROM, Memory, 64 | * Apps, and Tables) to occur, the table must be enabled 65 | * and overall checksumming must be enabled. 66 | * 67 | * \param[in] CmdPtr Command pointer, verified non-null in CS_AppMain 68 | * 69 | * \sa #CS_ENABLE_TABLES_CC 70 | */ 71 | void CS_EnableTablesCmd(const CS_NoArgsCmd_t *CmdPtr); 72 | 73 | /** 74 | * \brief Proccess a report baseline of a Table command 75 | * 76 | * \par Description 77 | * Reports the baseline checksum of the specified table 78 | * if it has already been computed 79 | * 80 | * \par Assumptions, External Events, and Notes: 81 | * None 82 | * 83 | * \param[in] CmdPtr Command pointer, verified non-null in CS_AppMain 84 | * 85 | * \sa #CS_REPORT_BASELINE_TABLE_CC 86 | */ 87 | void CS_ReportBaselineTablesCmd(const CS_TableNameCmd_t *CmdPtr); 88 | 89 | /** 90 | * \brief Process a recompute baseline of a Table command 91 | * 92 | * \par Description 93 | * Recomputes the checksum of a table and use that 94 | * value as the new baseline for that entry. 95 | * 96 | * \par Assumptions, External Events, and Notes: 97 | * None 98 | * 99 | * \param[in] CmdPtr Command pointer, verified non-null in CS_AppMain 100 | * 101 | * \sa #CS_RECOMPUTE_BASELINE_TABLE_CC 102 | */ 103 | void CS_RecomputeBaselineTablesCmd(const CS_TableNameCmd_t *CmdPtr); 104 | 105 | /** 106 | * \brief Process a disable background checking for a Table 107 | * entry command 108 | * 109 | * \par Description 110 | * Disables the specified Tables entry to be background checksummed. 111 | * 112 | * \par Assumptions, External Events, and Notes: 113 | * In order for background checking of individual entries 114 | * to checksum to occur, the entry must be enabled, 115 | * the table must be enabled, and overall checksumming must be enabled. 116 | * This command updates both the results table and the definition table. 117 | * If the entry exists in the results table but not in the definition 118 | * table, the command is still successful, but the definition table 119 | * is not updated. If the entry does not exist in the results table, 120 | * neither table is updated. 121 | * 122 | * \param[in] CmdPtr Command pointer, verified non-null in CS_AppMain 123 | * 124 | * \sa #CS_DISABLE_NAME_TABLE_CC 125 | */ 126 | void CS_DisableNameTablesCmd(const CS_TableNameCmd_t *CmdPtr); 127 | 128 | /** 129 | * \brief Process an enable background checking for a Table 130 | * entry command 131 | * 132 | * \par Description 133 | * Allows the specified table to be background checksummed. 134 | * 135 | * \par Assumptions, External Events, and Notes: 136 | * In order for background checking of individual entries 137 | * to checksum to occur, the entry must be enabled, 138 | * the table must be enabled and, overall checksumming must be enabled. 139 | * This command updates both the results table and the definition table. 140 | * If the entry exists in the results table but not in the definition 141 | * table, the command is still successful, but the definition table 142 | * is not updated. If the entry does not exist in the results table, 143 | * neither table is updated. 144 | * 145 | * \param[in] CmdPtr Command pointer, verified non-null in CS_AppMain 146 | * 147 | * \sa #CS_ENABLE_NAME_TABLE_CC 148 | */ 149 | void CS_EnableNameTablesCmd(const CS_TableNameCmd_t *CmdPtr); 150 | 151 | #endif 152 | -------------------------------------------------------------------------------- /fsw/src/cs_verify.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,915-1, and identified as “cFS Checksum 3 | * Application version 2.5.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 Checksum macros that run preprocessor checks 23 | * on mission configurable parameters 24 | */ 25 | #ifndef CS_VERIFY_H 26 | #define CS_VERIFY_H 27 | 28 | /************************************************************************* 29 | ** Includes 30 | *************************************************************************/ 31 | #include "cs_platform_cfg.h" 32 | #include "cs_mission_cfg.h" 33 | #include 34 | 35 | /************************************************************************* 36 | ** Macro Definitions 37 | *************************************************************************/ 38 | 39 | #if CS_MAX_NUM_EEPROM_TABLE_ENTRIES > 65535 40 | #error CS_MAX_NUM_EEPROM_TABLE_ENTRIES cannot be greater than 65535! 41 | #endif 42 | 43 | #if CS_MAX_NUM_MEMORY_TABLE_ENTRIES > 65535 44 | #error CS_MAX_NUM_MEMORY_TABLE_ENTRIES cannot be greater than 65535! 45 | #endif 46 | 47 | /* 48 | * JPH 2015-06-29 - Removed checks of: 49 | * CS_MAX_NUM_APP_TABLE_ENTRIES > CFE_ES_MAX_APPLICATIONS 50 | * CS_MAX_NUM_TABLES_TABLE_ENTRIES > CFE_TBL_MAX_NUM_TABLES 51 | * 52 | * These are not valid checks anymore, as the CS app does not have knowledge 53 | * of either CFE_ES_MAX_APPLICATIONS nor CFE_TBL_MAX_NUM_TABLES. Also, if 54 | * these actually violate the rule, this will either show up as an obvious 55 | * run-time error OR it will still work perfectly fine. 56 | */ 57 | 58 | #if (CS_MAX_NUM_EEPROM_TABLE_ENTRIES < 1) 59 | #error CS_MAX_NUM_EEPROM_TABLE_ENTRIES must be at least 1! 60 | #endif 61 | 62 | #if (CS_MAX_NUM_MEMORY_TABLE_ENTRIES < 1) 63 | #error CS_MAX_NUM_MEMORY_TABLE_ENTRIES must be at least 1! 64 | #endif 65 | 66 | #if (CS_MAX_NUM_TABLES_TABLE_ENTRIES < 1) 67 | #error CS_MAX_NUM_TABLES_TABLE_ENTRIES must be at least 1! 68 | #endif 69 | 70 | #if (CS_MAX_NUM_APP_TABLE_ENTRIES < 1) 71 | #error CS_MAX_NUM_APP_TABLE_ENTRIES must be at least 1! 72 | #endif 73 | 74 | #if (CS_DEFAULT_BYTES_PER_CYCLE > 0xFFFFFFFF) 75 | #error CS_DEFAULT_BYTES_PER_CYCLE cannot be greater than 0xFFFFFFFF! 76 | #endif 77 | 78 | #if (CS_DEFAULT_BYTES_PER_CYCLE < 0) 79 | #error CS_DEFAULT_BYTES_PER_CYCLE cannot be less than 0! 80 | #endif 81 | 82 | #if (CS_CHILD_TASK_PRIORITY < 1) 83 | #error CS_CHILD_TASK_PRIORITY must be greater than 0! 84 | #endif 85 | 86 | #if (CS_CHILD_TASK_PRIORITY > 255) 87 | #error CS_CHILD_TASK_PRIORITY cannot be greater than 255! 88 | #endif 89 | 90 | #if (CS_DEFAULT_ALGORITHM != CFE_MISSION_ES_DEFAULT_CRC && CS_DEFAULT_ALGORITHM != CFE_ES_CRC_16) 91 | #error CS_DEFAULT_ALGORITHM is limited to either CFE_MISSION_ES_DEFAULT_CRC or CFE_ES_CRC_16! 92 | #endif 93 | 94 | #endif 95 | -------------------------------------------------------------------------------- /fsw/src/cs_version.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,915-1, and identified as “cFS Checksum 3 | * Application version 2.5.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 Checksum macros that specify CS's version 23 | */ 24 | #ifndef CS_VERSION_H 25 | #define CS_VERSION_H 26 | 27 | /** 28 | * \defgroup cfscsversion CFS Checksum Version 29 | * \ref cfsversions 30 | * \{ 31 | */ 32 | 33 | #define CS_MAJOR_VERSION 2 /**< \brief Major version number */ 34 | #define CS_MINOR_VERSION 5 /**< \brief Minor version number */ 35 | #define CS_REVISION 99 /**< \brief Revision number */ 36 | 37 | /**\}*/ 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /fsw/tables/cs_apptbl.c: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,915-1, and identified as “cFS Checksum 3 | * Application version 2.5.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 Checksum (CS) Application Default Apps Table Definition 23 | */ 24 | 25 | /************************************************************************ 26 | ** Includes 27 | *************************************************************************/ 28 | #include "cfe.h" 29 | #include "cfe_tbl_filedef.h" 30 | #include "cs_msgdefs.h" 31 | #include "cs_platform_cfg.h" 32 | #include "cs_tbldefs.h" 33 | 34 | CS_Def_App_Table_Entry_t CS_AppTable[CS_MAX_NUM_APP_TABLE_ENTRIES] = { 35 | /* State Name */ 36 | /* 0 */ {.State = CS_STATE_EMPTY, .Name = ""}, 37 | /* 1 */ {.State = CS_STATE_EMPTY, .Name = ""}, 38 | /* 2 */ {.State = CS_STATE_EMPTY, .Name = ""}, 39 | /* 3 */ {.State = CS_STATE_EMPTY, .Name = ""}, 40 | /* 4 */ {.State = CS_STATE_EMPTY, .Name = ""}, 41 | /* 5 */ {.State = CS_STATE_EMPTY, .Name = ""}, 42 | /* 6 */ {.State = CS_STATE_EMPTY, .Name = ""}, 43 | /* 7 */ {.State = CS_STATE_EMPTY, .Name = ""}, 44 | /* 8 */ {.State = CS_STATE_EMPTY, .Name = ""}, 45 | /* 9 */ {.State = CS_STATE_EMPTY, .Name = ""}, 46 | /* 10 */ {.State = CS_STATE_EMPTY, .Name = ""}, 47 | /* 11 */ {.State = CS_STATE_EMPTY, .Name = ""}, 48 | /* 12 */ {.State = CS_STATE_EMPTY, .Name = ""}, 49 | /* 13 */ {.State = CS_STATE_EMPTY, .Name = ""}, 50 | /* 14 */ {.State = CS_STATE_EMPTY, .Name = ""}, 51 | /* 15 */ {.State = CS_STATE_EMPTY, .Name = ""}, 52 | /* 16 */ {.State = CS_STATE_EMPTY, .Name = ""}, 53 | /* 17 */ {.State = CS_STATE_EMPTY, .Name = ""}, 54 | /* 18 */ {.State = CS_STATE_EMPTY, .Name = ""}, 55 | /* 19 */ {.State = CS_STATE_EMPTY, .Name = ""}, 56 | /* 20 */ {.State = CS_STATE_EMPTY, .Name = ""}, 57 | /* 21 */ {.State = CS_STATE_EMPTY, .Name = ""}, 58 | /* 22 */ {.State = CS_STATE_EMPTY, .Name = ""}, 59 | /* 23 */ {.State = CS_STATE_EMPTY, .Name = ""}}; 60 | 61 | /* 62 | ** Table file header 63 | */ 64 | CFE_TBL_FILEDEF(CS_AppTable, CS.DefAppTbl, CS App Tbl, cs_apptbl.tbl) 65 | -------------------------------------------------------------------------------- /fsw/tables/cs_eepromtbl.c: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,915-1, and identified as “cFS Checksum 3 | * Application version 2.5.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 Checksum (CS) Application Default EEPROM Table Definition 23 | */ 24 | 25 | /************************************************************************ 26 | ** Includes 27 | *************************************************************************/ 28 | #include "cfe.h" 29 | #include "cfe_tbl_filedef.h" 30 | #include "cs_msgdefs.h" 31 | #include "cs_platform_cfg.h" 32 | #include "cs_tbldefs.h" 33 | 34 | CS_Def_EepromMemory_Table_Entry_t CS_EepromTable[CS_MAX_NUM_EEPROM_TABLE_ENTRIES] = { 35 | /* State Filler StartAddress NumBytes */ 36 | /* 0 */ 37 | {.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000}, 38 | /* 1 */ 39 | {.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000}, 40 | /* 2 */ 41 | {.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000}, 42 | /* 3 */ 43 | {.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000}, 44 | /* 4 */ 45 | {.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000}, 46 | /* 5 */ 47 | {.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000}, 48 | /* 6 */ 49 | {.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000}, 50 | /* 7 */ 51 | {.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000}, 52 | /* 8 */ 53 | {.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000}, 54 | /* 9 */ 55 | {.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000}, 56 | /* 10 */ 57 | {.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000}, 58 | /* 11 */ 59 | {.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000}, 60 | /* 12 */ 61 | {.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000}, 62 | /* 13 */ 63 | {.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000}, 64 | /* 14 */ 65 | {.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000}, 66 | /* 15 */ 67 | {.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000}}; 68 | 69 | /* 70 | ** Table file header 71 | */ 72 | CFE_TBL_FILEDEF(CS_EepromTable, CS.DefEepromTbl, CS EEPROM Tbl, cs_eepromtbl.tbl) 73 | -------------------------------------------------------------------------------- /fsw/tables/cs_memorytbl.c: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,915-1, and identified as “cFS Checksum 3 | * Application version 2.5.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 Checksum (CS) Application Default Memory Table Definition 23 | */ 24 | 25 | /************************************************************************ 26 | ** Includes 27 | *************************************************************************/ 28 | #include "cfe.h" 29 | #include "cfe_tbl_filedef.h" 30 | #include "cs_msgdefs.h" 31 | #include "cs_platform_cfg.h" 32 | #include "cs_tbldefs.h" 33 | 34 | CS_Def_EepromMemory_Table_Entry_t CS_MemoryTable[CS_MAX_NUM_MEMORY_TABLE_ENTRIES] = { 35 | /* State Filler StartAddress NumBytes */ 36 | /* 0 */ 37 | {.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000}, 38 | /* 1 */ 39 | {.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000}, 40 | /* 2 */ 41 | {.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000}, 42 | /* 3 */ 43 | {.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000}, 44 | /* 4 */ 45 | {.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000}, 46 | /* 5 */ 47 | {.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000}, 48 | /* 6 */ 49 | {.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000}, 50 | /* 7 */ 51 | {.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000}, 52 | /* 8 */ 53 | {.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000}, 54 | /* 9 */ 55 | {.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000}, 56 | /* 10 */ 57 | {.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000}, 58 | /* 11 */ 59 | {.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000}, 60 | /* 12 */ 61 | {.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000}, 62 | /* 13 */ 63 | {.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000}, 64 | /* 14 */ 65 | {.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000}, 66 | /* 15 */ 67 | {.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000}}; 68 | 69 | /* 70 | ** Table file header 71 | */ 72 | CFE_TBL_FILEDEF(CS_MemoryTable, CS.DefMemoryTbl, CS Memory Tbl, cs_memorytbl.tbl) 73 | -------------------------------------------------------------------------------- /fsw/tables/cs_tablestbl.c: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,915-1, and identified as “cFS Checksum 3 | * Application version 2.5.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 Checksum (CS) Application Default Tables Table Definition 23 | */ 24 | 25 | /************************************************************************ 26 | ** Includes 27 | *************************************************************************/ 28 | #include "cfe.h" 29 | #include "cfe_tbl_filedef.h" 30 | #include "cs_msgdefs.h" 31 | #include "cs_platform_cfg.h" 32 | #include "cs_tbldefs.h" 33 | 34 | CS_Def_Tables_Table_Entry_t CS_TablesTable[CS_MAX_NUM_TABLES_TABLE_ENTRIES] = { 35 | /* State Name */ 36 | 37 | /* 0 */ {.State = CS_STATE_EMPTY, .Name = ""}, 38 | /* 1 */ {.State = CS_STATE_EMPTY, .Name = ""}, 39 | /* 2 */ {.State = CS_STATE_EMPTY, .Name = ""}, 40 | /* 3 */ {.State = CS_STATE_EMPTY, .Name = ""}, 41 | /* 4 */ {.State = CS_STATE_EMPTY, .Name = ""}, 42 | /* 5 */ {.State = CS_STATE_EMPTY, .Name = ""}, 43 | /* 6 */ {.State = CS_STATE_EMPTY, .Name = ""}, 44 | /* 7 */ {.State = CS_STATE_EMPTY, .Name = ""}, 45 | /* 8 */ {.State = CS_STATE_EMPTY, .Name = ""}, 46 | /* 9 */ {.State = CS_STATE_EMPTY, .Name = ""}, 47 | /* 10 */ {.State = CS_STATE_EMPTY, .Name = ""}, 48 | /* 11 */ {.State = CS_STATE_EMPTY, .Name = ""}, 49 | /* 12 */ {.State = CS_STATE_EMPTY, .Name = ""}, 50 | /* 13 */ {.State = CS_STATE_EMPTY, .Name = ""}, 51 | /* 14 */ {.State = CS_STATE_EMPTY, .Name = ""}, 52 | /* 15 */ {.State = CS_STATE_EMPTY, .Name = ""}, 53 | /* 16 */ {.State = CS_STATE_EMPTY, .Name = ""}, 54 | /* 17 */ {.State = CS_STATE_EMPTY, .Name = ""}, 55 | /* 18 */ {.State = CS_STATE_EMPTY, .Name = ""}, 56 | /* 19 */ {.State = CS_STATE_EMPTY, .Name = ""}, 57 | /* 20 */ {.State = CS_STATE_EMPTY, .Name = ""}, 58 | /* 21 */ {.State = CS_STATE_EMPTY, .Name = ""}, 59 | /* 22 */ {.State = CS_STATE_EMPTY, .Name = ""}, 60 | /* 23 */ {.State = CS_STATE_EMPTY, .Name = ""}}; 61 | 62 | /* 63 | ** Table file header 64 | */ 65 | CFE_TBL_FILEDEF(CS_TablesTable, CS.DefTablesTbl, CS Tables Tbl, cs_tablestbl.tbl) 66 | -------------------------------------------------------------------------------- /mission_build.cmake: -------------------------------------------------------------------------------- 1 | # App specific mission scope configuration 2 | 3 | # Add stand alone documentation 4 | add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/docs/dox_src ${MISSION_BINARY_DIR}/docs/cs-usersguide) 5 | -------------------------------------------------------------------------------- /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("cs_internal" 11 | utilities/cs_test_utils.c 12 | stubs/cs_utils_stubs.c 13 | stubs/cs_compute_stubs.c 14 | stubs/cs_table_processing_stubs.c 15 | stubs/cs_table_cmds_stubs.c 16 | stubs/cs_memory_cmds_stubs.c 17 | stubs/cs_app_stubs.c 18 | stubs/cs_app_cmds_stubs.c 19 | stubs/cs_cmds_stubs.c 20 | stubs/cs_init_stubs.c 21 | stubs/cs_eeprom_cmds_stubs.c 22 | ) 23 | 24 | # Link with the cfe core stubs and unit test assert libs 25 | target_link_libraries(coverage-cs_internal-stubs ut_core_api_stubs ut_assert) 26 | 27 | # Include and expose unit test utilities, fsw/inc, and fsw/src includes 28 | target_include_directories(coverage-cs_internal-stubs PUBLIC utilities) 29 | target_include_directories(coverage-cs_internal-stubs PUBLIC ../fsw/inc) 30 | target_include_directories(coverage-cs_internal-stubs PUBLIC ../fsw/src) 31 | 32 | # Generate a dedicated "testrunner" executable for each test file 33 | # Accomplish this by cycling through all the app's source files, there must be 34 | # a *_tests file for each 35 | foreach(SRCFILE ${APP_SRC_FILES}) 36 | 37 | # Get the base sourcefile name as a module name without path or the 38 | # extension, this will be used as the base name of the unit test file. 39 | get_filename_component(UNIT_NAME "${SRCFILE}" NAME_WE) 40 | 41 | # Use the module name to make the test name by adding _tests to the end 42 | set(TESTS_NAME "${UNIT_NAME}_tests") 43 | 44 | # Make the test sourcefile name with unit test path and extension 45 | set(TESTS_SOURCE_FILE "${PROJECT_SOURCE_DIR}/unit-test/${TESTS_NAME}.c") 46 | 47 | # Create the coverage test executable 48 | add_cfe_coverage_test(cs "${UNIT_NAME}" "${TESTS_SOURCE_FILE}" "${CFS_CS_SOURCE_DIR}/${SRCFILE}") 49 | 50 | # Add dependency to utilities and internal stubs 51 | add_cfe_coverage_dependency(cs "${UNIT_NAME}" cs_internal) 52 | 53 | endforeach() 54 | -------------------------------------------------------------------------------- /unit-test/stubs/cs_app_cmds_stubs.c: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,915-1, and identified as “cFS Checksum 3 | * Application version 2.5.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 "cs_app_cmds.h" 25 | 26 | /* UT includes */ 27 | #include "uttest.h" 28 | #include "utassert.h" 29 | #include "utstubs.h" 30 | 31 | void CS_DisableAppCmd(const CS_NoArgsCmd_t *CmdPtr) 32 | { 33 | UT_Stub_RegisterContext(UT_KEY(CS_DisableAppCmd), CmdPtr); 34 | UT_DEFAULT_IMPL(CS_DisableAppCmd); 35 | } 36 | 37 | void CS_EnableAppCmd(const CS_NoArgsCmd_t *CmdPtr) 38 | { 39 | UT_Stub_RegisterContext(UT_KEY(CS_EnableAppCmd), CmdPtr); 40 | UT_DEFAULT_IMPL(CS_EnableAppCmd); 41 | } 42 | 43 | void CS_ReportBaselineAppCmd(const CS_AppNameCmd_t *CmdPtr) 44 | { 45 | UT_Stub_RegisterContext(UT_KEY(CS_ReportBaselineAppCmd), CmdPtr); 46 | UT_DEFAULT_IMPL(CS_ReportBaselineAppCmd); 47 | } 48 | 49 | void CS_RecomputeBaselineAppCmd(const CS_AppNameCmd_t *CmdPtr) 50 | { 51 | UT_Stub_RegisterContext(UT_KEY(CS_RecomputeBaselineAppCmd), CmdPtr); 52 | UT_DEFAULT_IMPL(CS_RecomputeBaselineAppCmd); 53 | } 54 | 55 | void CS_DisableNameAppCmd(const CS_AppNameCmd_t *CmdPtr) 56 | { 57 | UT_Stub_RegisterContext(UT_KEY(CS_DisableNameAppCmd), CmdPtr); 58 | UT_DEFAULT_IMPL(CS_DisableNameAppCmd); 59 | } 60 | 61 | void CS_EnableNameAppCmd(const CS_AppNameCmd_t *CmdPtr) 62 | { 63 | UT_Stub_RegisterContext(UT_KEY(CS_EnableNameAppCmd), CmdPtr); 64 | UT_DEFAULT_IMPL(CS_EnableNameAppCmd); 65 | } 66 | -------------------------------------------------------------------------------- /unit-test/stubs/cs_app_stubs.c: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,915-1, and identified as “cFS Checksum 3 | * Application version 2.5.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 "cs_app.h" 25 | 26 | /* UT includes */ 27 | #include "uttest.h" 28 | #include "utassert.h" 29 | #include "utstubs.h" 30 | 31 | CS_AppData_t CS_AppData; 32 | 33 | #if (CS_PRESERVE_STATES_ON_PROCESSOR_RESET == true) 34 | void CS_UpdateCDS(void) 35 | { 36 | UT_DEFAULT_IMPL(CS_UpdateCDS); 37 | } 38 | #endif /* #if (CS_PRESERVE_STATES_ON_PROCESSOR_RESET == true) */ 39 | -------------------------------------------------------------------------------- /unit-test/stubs/cs_cmds_stubs.c: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,915-1, and identified as “cFS Checksum 3 | * Application version 2.5.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 "cfe.h" 25 | #include "cs_cmds.h" 26 | 27 | /* UT includes */ 28 | #include "uttest.h" 29 | #include "utassert.h" 30 | #include "utstubs.h" 31 | 32 | void CS_NoopCmd(const CS_NoArgsCmd_t *CmdPtr) 33 | { 34 | UT_Stub_RegisterContext(UT_KEY(CS_NoopCmd), CmdPtr); 35 | UT_DEFAULT_IMPL(CS_NoopCmd); 36 | } 37 | 38 | void CS_ResetCmd(const CS_NoArgsCmd_t *CmdPtr) 39 | { 40 | UT_Stub_RegisterContext(UT_KEY(CS_ResetCmd), CmdPtr); 41 | UT_DEFAULT_IMPL(CS_ResetCmd); 42 | } 43 | 44 | void CS_BackgroundCheckCycle(const CS_NoArgsCmd_t *CmdPtr) 45 | { 46 | UT_Stub_RegisterContext(UT_KEY(CS_BackgroundCheckCycle), CmdPtr); 47 | UT_DEFAULT_IMPL(CS_BackgroundCheckCycle); 48 | } 49 | 50 | void CS_DisableAllCSCmd(const CS_NoArgsCmd_t *CmdPtr) 51 | { 52 | UT_Stub_RegisterContext(UT_KEY(CS_DisableAllCSCmd), CmdPtr); 53 | UT_DEFAULT_IMPL(CS_DisableAllCSCmd); 54 | } 55 | 56 | void CS_EnableAllCSCmd(const CS_NoArgsCmd_t *CmdPtr) 57 | { 58 | UT_Stub_RegisterContext(UT_KEY(CS_EnableAllCSCmd), CmdPtr); 59 | UT_DEFAULT_IMPL(CS_EnableAllCSCmd); 60 | } 61 | 62 | void CS_DisableCfeCoreCmd(const CS_NoArgsCmd_t *CmdPtr) 63 | { 64 | UT_Stub_RegisterContext(UT_KEY(CS_DisableCfeCoreCmd), CmdPtr); 65 | UT_DEFAULT_IMPL(CS_DisableCfeCoreCmd); 66 | } 67 | 68 | void CS_EnableCfeCoreCmd(const CS_NoArgsCmd_t *CmdPtr) 69 | { 70 | UT_Stub_RegisterContext(UT_KEY(CS_EnableCfeCoreCmd), CmdPtr); 71 | UT_DEFAULT_IMPL(CS_EnableCfeCoreCmd); 72 | } 73 | 74 | void CS_DisableOSCmd(const CS_NoArgsCmd_t *CmdPtr) 75 | { 76 | UT_Stub_RegisterContext(UT_KEY(CS_DisableOSCmd), CmdPtr); 77 | UT_DEFAULT_IMPL(CS_DisableOSCmd); 78 | } 79 | 80 | void CS_EnableOSCmd(const CS_NoArgsCmd_t *CmdPtr) 81 | { 82 | UT_Stub_RegisterContext(UT_KEY(CS_EnableOSCmd), CmdPtr); 83 | UT_DEFAULT_IMPL(CS_EnableOSCmd); 84 | } 85 | 86 | void CS_ReportBaselineCfeCoreCmd(const CS_NoArgsCmd_t *CmdPtr) 87 | { 88 | UT_Stub_RegisterContext(UT_KEY(CS_ReportBaselineCfeCoreCmd), CmdPtr); 89 | UT_DEFAULT_IMPL(CS_ReportBaselineCfeCoreCmd); 90 | } 91 | 92 | void CS_ReportBaselineOSCmd(const CS_NoArgsCmd_t *CmdPtr) 93 | { 94 | UT_Stub_RegisterContext(UT_KEY(CS_ReportBaselineOSCmd), CmdPtr); 95 | UT_DEFAULT_IMPL(CS_ReportBaselineOSCmd); 96 | } 97 | 98 | void CS_RecomputeBaselineCfeCoreCmd(const CS_NoArgsCmd_t *CmdPtr) 99 | { 100 | UT_Stub_RegisterContext(UT_KEY(CS_RecomputeBaselineCfeCoreCmd), CmdPtr); 101 | UT_DEFAULT_IMPL(CS_RecomputeBaselineCfeCoreCmd); 102 | } 103 | 104 | void CS_RecomputeBaselineOSCmd(const CS_NoArgsCmd_t *CmdPtr) 105 | { 106 | UT_Stub_RegisterContext(UT_KEY(CS_RecomputeBaselineOSCmd), CmdPtr); 107 | UT_DEFAULT_IMPL(CS_RecomputeBaselineOSCmd); 108 | } 109 | 110 | void CS_OneShotCmd(const CS_OneShotCmd_t *CmdPtr) 111 | { 112 | UT_Stub_RegisterContext(UT_KEY(CS_OneShotCmd), CmdPtr); 113 | UT_DEFAULT_IMPL(CS_OneShotCmd); 114 | } 115 | 116 | void CS_CancelOneShotCmd(const CS_NoArgsCmd_t *CmdPtr) 117 | { 118 | UT_Stub_RegisterContext(UT_KEY(CS_CancelOneShotCmd), CmdPtr); 119 | UT_DEFAULT_IMPL(CS_CancelOneShotCmd); 120 | } 121 | -------------------------------------------------------------------------------- /unit-test/stubs/cs_compute_stubs.c: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,915-1, and identified as “cFS Checksum 3 | * Application version 2.5.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 "cs_compute.h" 25 | 26 | /* UT includes */ 27 | #include "uttest.h" 28 | #include "utassert.h" 29 | #include "utstubs.h" 30 | 31 | CFE_Status_t CS_ComputeEepromMemory(CS_Res_EepromMemory_Table_Entry_t *ResultsEntry, uint32 *ComputedCSValue, 32 | bool *DoneWithEntry) 33 | { 34 | UT_Stub_RegisterContext(UT_KEY(CS_ComputeEepromMemory), ResultsEntry); 35 | UT_Stub_RegisterContext(UT_KEY(CS_ComputeEepromMemory), ComputedCSValue); 36 | UT_Stub_RegisterContext(UT_KEY(CS_ComputeEepromMemory), DoneWithEntry); 37 | 38 | return UT_DEFAULT_IMPL(CS_ComputeEepromMemory); 39 | } 40 | 41 | CFE_Status_t CS_ComputeTables(CS_Res_Tables_Table_Entry_t *ResultsEntry, uint32 *ComputedCSValue, bool *DoneWithEntry) 42 | { 43 | UT_Stub_RegisterContext(UT_KEY(CS_ComputeTables), ResultsEntry); 44 | UT_Stub_RegisterContext(UT_KEY(CS_ComputeTables), ComputedCSValue); 45 | UT_Stub_RegisterContext(UT_KEY(CS_ComputeTables), DoneWithEntry); 46 | 47 | return UT_DEFAULT_IMPL(CS_ComputeTables); 48 | } 49 | 50 | CFE_Status_t CS_ComputeApp(CS_Res_App_Table_Entry_t *ResultsEntry, uint32 *ComputedCSValue, bool *DoneWithEntry) 51 | { 52 | UT_Stub_RegisterContext(UT_KEY(CS_ComputeApp), ResultsEntry); 53 | UT_Stub_RegisterContext(UT_KEY(CS_ComputeApp), ComputedCSValue); 54 | UT_Stub_RegisterContext(UT_KEY(CS_ComputeApp), DoneWithEntry); 55 | 56 | return UT_DEFAULT_IMPL(CS_ComputeApp); 57 | } 58 | 59 | void CS_RecomputeEepromMemoryChildTask(void) 60 | { 61 | UT_DEFAULT_IMPL(CS_RecomputeEepromMemoryChildTask); 62 | } 63 | 64 | void CS_RecomputeTablesChildTask(void) 65 | { 66 | UT_DEFAULT_IMPL(CS_RecomputeTablesChildTask); 67 | } 68 | 69 | void CS_RecomputeAppChildTask(void) 70 | { 71 | UT_DEFAULT_IMPL(CS_RecomputeAppChildTask); 72 | } 73 | 74 | void CS_OneShotChildTask(void) 75 | { 76 | UT_DEFAULT_IMPL(CS_OneShotChildTask); 77 | } 78 | -------------------------------------------------------------------------------- /unit-test/stubs/cs_eeprom_cmds_stubs.c: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,915-1, and identified as “cFS Checksum 3 | * Application version 2.5.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 "cs_eeprom_cmds.h" 25 | 26 | /* UT includes */ 27 | #include "uttest.h" 28 | #include "utassert.h" 29 | #include "utstubs.h" 30 | 31 | void CS_DisableEepromCmd(const CS_NoArgsCmd_t *CmdPtr) 32 | { 33 | UT_Stub_RegisterContext(UT_KEY(CS_DisableEepromCmd), CmdPtr); 34 | UT_DEFAULT_IMPL(CS_DisableEepromCmd); 35 | } 36 | 37 | void CS_EnableEepromCmd(const CS_NoArgsCmd_t *CmdPtr) 38 | { 39 | UT_Stub_RegisterContext(UT_KEY(CS_EnableEepromCmd), CmdPtr); 40 | UT_DEFAULT_IMPL(CS_EnableEepromCmd); 41 | } 42 | 43 | void CS_ReportBaselineEntryIDEepromCmd(const CS_EntryCmd_t *CmdPtr) 44 | { 45 | UT_Stub_RegisterContext(UT_KEY(CS_ReportBaselineEntryIDEepromCmd), CmdPtr); 46 | UT_DEFAULT_IMPL(CS_ReportBaselineEntryIDEepromCmd); 47 | } 48 | 49 | void CS_DisableEntryIDEepromCmd(const CS_EntryCmd_t *CmdPtr) 50 | { 51 | UT_Stub_RegisterContext(UT_KEY(CS_DisableEntryIDEepromCmd), CmdPtr); 52 | UT_DEFAULT_IMPL(CS_DisableEntryIDEepromCmd); 53 | } 54 | 55 | void CS_RecomputeBaselineEepromCmd(const CS_EntryCmd_t *CmdPtr) 56 | { 57 | UT_Stub_RegisterContext(UT_KEY(CS_RecomputeBaselineEepromCmd), CmdPtr); 58 | UT_DEFAULT_IMPL(CS_RecomputeBaselineEepromCmd); 59 | } 60 | 61 | void CS_EnableEntryIDEepromCmd(const CS_EntryCmd_t *CmdPtr) 62 | { 63 | UT_Stub_RegisterContext(UT_KEY(CS_EnableEntryIDEepromCmd), CmdPtr); 64 | UT_DEFAULT_IMPL(CS_EnableEntryIDEepromCmd); 65 | } 66 | 67 | void CS_GetEntryIDEepromCmd(const CS_GetEntryIDCmd_t *CmdPtr) 68 | { 69 | UT_Stub_RegisterContext(UT_KEY(CS_GetEntryIDEepromCmd), CmdPtr); 70 | UT_DEFAULT_IMPL(CS_GetEntryIDEepromCmd); 71 | } 72 | -------------------------------------------------------------------------------- /unit-test/stubs/cs_init_stubs.c: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,915-1, and identified as “cFS Checksum 3 | * Application version 2.5.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 "cs_app.h" 25 | 26 | /* UT includes */ 27 | #include "uttest.h" 28 | #include "utassert.h" 29 | #include "utstubs.h" 30 | 31 | CFE_Status_t CS_SbInit(void) 32 | { 33 | return UT_DEFAULT_IMPL(CS_SbInit); 34 | } 35 | 36 | CFE_Status_t CS_InitAllTables(void) 37 | { 38 | return UT_DEFAULT_IMPL(CS_InitAllTables); 39 | } 40 | 41 | CFE_Status_t CS_InitSegments(void) 42 | { 43 | return UT_DEFAULT_IMPL(CS_InitAllTables); 44 | } 45 | -------------------------------------------------------------------------------- /unit-test/stubs/cs_memory_cmds_stubs.c: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,915-1, and identified as “cFS Checksum 3 | * Application version 2.5.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 "cs_memory_cmds.h" 25 | 26 | /* UT includes */ 27 | #include "uttest.h" 28 | #include "utassert.h" 29 | #include "utstubs.h" 30 | 31 | void CS_DisableMemoryCmd(const CS_NoArgsCmd_t *CmdPtr) 32 | { 33 | UT_Stub_RegisterContext(UT_KEY(CS_DisableMemoryCmd), CmdPtr); 34 | UT_DEFAULT_IMPL(CS_DisableMemoryCmd); 35 | } 36 | 37 | void CS_EnableMemoryCmd(const CS_NoArgsCmd_t *CmdPtr) 38 | { 39 | UT_Stub_RegisterContext(UT_KEY(CS_EnableMemoryCmd), CmdPtr); 40 | UT_DEFAULT_IMPL(CS_EnableMemoryCmd); 41 | } 42 | 43 | void CS_ReportBaselineEntryIDMemoryCmd(const CS_EntryCmd_t *CmdPtr) 44 | { 45 | UT_Stub_RegisterContext(UT_KEY(CS_ReportBaselineEntryIDMemoryCmd), CmdPtr); 46 | UT_DEFAULT_IMPL(CS_ReportBaselineEntryIDMemoryCmd); 47 | } 48 | 49 | void CS_DisableEntryIDMemoryCmd(const CS_EntryCmd_t *CmdPtr) 50 | { 51 | UT_Stub_RegisterContext(UT_KEY(CS_DisableEntryIDMemoryCmd), CmdPtr); 52 | UT_DEFAULT_IMPL(CS_DisableEntryIDMemoryCmd); 53 | } 54 | 55 | void CS_RecomputeBaselineMemoryCmd(const CS_EntryCmd_t *CmdPtr) 56 | { 57 | UT_Stub_RegisterContext(UT_KEY(CS_RecomputeBaselineMemoryCmd), CmdPtr); 58 | UT_DEFAULT_IMPL(CS_RecomputeBaselineMemoryCmd); 59 | } 60 | 61 | void CS_EnableEntryIDMemoryCmd(const CS_EntryCmd_t *CmdPtr) 62 | { 63 | UT_Stub_RegisterContext(UT_KEY(CS_EnableEntryIDMemoryCmd), CmdPtr); 64 | UT_DEFAULT_IMPL(CS_EnableEntryIDMemoryCmd); 65 | } 66 | 67 | void CS_GetEntryIDMemoryCmd(const CS_GetEntryIDCmd_t *CmdPtr) 68 | { 69 | UT_Stub_RegisterContext(UT_KEY(CS_GetEntryIDMemoryCmd), CmdPtr); 70 | UT_DEFAULT_IMPL(CS_GetEntryIDMemoryCmd); 71 | } 72 | -------------------------------------------------------------------------------- /unit-test/stubs/cs_table_cmds_stubs.c: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,915-1, and identified as “cFS Checksum 3 | * Application version 2.5.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 "cs_table_cmds.h" 25 | 26 | /* UT includes */ 27 | #include "uttest.h" 28 | #include "utassert.h" 29 | #include "utstubs.h" 30 | 31 | void CS_DisableTablesCmd(const CS_NoArgsCmd_t *CmdPtr) 32 | { 33 | UT_Stub_RegisterContext(UT_KEY(CS_DisableTablesCmd), CmdPtr); 34 | UT_DEFAULT_IMPL(CS_DisableTablesCmd); 35 | } 36 | 37 | void CS_EnableTablesCmd(const CS_NoArgsCmd_t *CmdPtr) 38 | { 39 | UT_Stub_RegisterContext(UT_KEY(CS_EnableTablesCmd), CmdPtr); 40 | UT_DEFAULT_IMPL(CS_EnableTablesCmd); 41 | } 42 | 43 | void CS_ReportBaselineTablesCmd(const CS_TableNameCmd_t *CmdPtr) 44 | { 45 | UT_Stub_RegisterContext(UT_KEY(CS_ReportBaselineTablesCmd), CmdPtr); 46 | UT_DEFAULT_IMPL(CS_ReportBaselineTablesCmd); 47 | } 48 | 49 | void CS_RecomputeBaselineTablesCmd(const CS_TableNameCmd_t *CmdPtr) 50 | { 51 | UT_Stub_RegisterContext(UT_KEY(CS_RecomputeBaselineTablesCmd), CmdPtr); 52 | UT_DEFAULT_IMPL(CS_RecomputeBaselineTablesCmd); 53 | } 54 | 55 | void CS_DisableNameTablesCmd(const CS_TableNameCmd_t *CmdPtr) 56 | { 57 | UT_Stub_RegisterContext(UT_KEY(CS_DisableNameTablesCmd), CmdPtr); 58 | UT_DEFAULT_IMPL(CS_DisableNameTablesCmd); 59 | } 60 | 61 | void CS_EnableNameTablesCmd(const CS_TableNameCmd_t *CmdPtr) 62 | { 63 | UT_Stub_RegisterContext(UT_KEY(CS_EnableNameTablesCmd), CmdPtr); 64 | UT_DEFAULT_IMPL(CS_EnableNameTablesCmd); 65 | } 66 | -------------------------------------------------------------------------------- /unit-test/stubs/cs_table_processing_stubs.c: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,915-1, and identified as “cFS Checksum 3 | * Application version 2.5.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 "cs_tbldefs.h" 25 | 26 | /* UT includes */ 27 | #include "uttest.h" 28 | #include "utassert.h" 29 | #include "utstubs.h" 30 | 31 | CFE_Status_t CS_ValidateEepromChecksumDefinitionTable(void *TblPtr) 32 | { 33 | UT_Stub_RegisterContext(UT_KEY(CS_ValidateEepromChecksumDefinitionTable), TblPtr); 34 | 35 | return UT_DEFAULT_IMPL(CS_ValidateEepromChecksumDefinitionTable); 36 | } 37 | 38 | CFE_Status_t CS_ValidateMemoryChecksumDefinitionTable(void *TblPtr) 39 | { 40 | UT_Stub_RegisterContext(UT_KEY(CS_ValidateMemoryChecksumDefinitionTable), TblPtr); 41 | 42 | return UT_DEFAULT_IMPL(CS_ValidateMemoryChecksumDefinitionTable); 43 | } 44 | 45 | CFE_Status_t CS_ValidateTablesChecksumDefinitionTable(void *TblPtr) 46 | { 47 | UT_Stub_RegisterContext(UT_KEY(CS_ValidateTablesChecksumDefinitionTable), TblPtr); 48 | 49 | return UT_DEFAULT_IMPL(CS_ValidateTablesChecksumDefinitionTable); 50 | } 51 | 52 | CFE_Status_t CS_ValidateAppChecksumDefinitionTable(void *TblPtr) 53 | { 54 | UT_Stub_RegisterContext(UT_KEY(CS_ValidateAppChecksumDefinitionTable), TblPtr); 55 | 56 | return UT_DEFAULT_IMPL(CS_ValidateAppChecksumDefinitionTable); 57 | } 58 | 59 | void CS_ProcessNewEepromMemoryDefinitionTable(const CS_Def_EepromMemory_Table_Entry_t *DefinitionTblPtr, 60 | const CS_Res_EepromMemory_Table_Entry_t *ResultsTblPtr, 61 | const uint16 NumEntries, const uint16 Table) 62 | { 63 | UT_Stub_RegisterContext(UT_KEY(CS_ProcessNewEepromMemoryDefinitionTable), DefinitionTblPtr); 64 | UT_Stub_RegisterContext(UT_KEY(CS_ProcessNewEepromMemoryDefinitionTable), ResultsTblPtr); 65 | UT_Stub_RegisterContextGenericArg(UT_KEY(CS_ProcessNewEepromMemoryDefinitionTable), Table); 66 | UT_Stub_RegisterContextGenericArg(UT_KEY(CS_ProcessNewEepromMemoryDefinitionTable), NumEntries); 67 | 68 | UT_DEFAULT_IMPL(CS_ProcessNewEepromMemoryDefinitionTable); 69 | } 70 | 71 | void CS_ProcessNewTablesDefinitionTable(const CS_Def_Tables_Table_Entry_t *DefinitionTblPtr, 72 | const CS_Res_Tables_Table_Entry_t *ResultsTblPtr) 73 | 74 | { 75 | UT_Stub_RegisterContext(UT_KEY(CS_ProcessNewTablesDefinitionTable), DefinitionTblPtr); 76 | UT_Stub_RegisterContext(UT_KEY(CS_ProcessNewTablesDefinitionTable), ResultsTblPtr); 77 | 78 | UT_DEFAULT_IMPL(CS_ProcessNewTablesDefinitionTable); 79 | } 80 | 81 | void CS_ProcessNewAppDefinitionTable(const CS_Def_App_Table_Entry_t *DefinitionTblPtr, 82 | const CS_Res_App_Table_Entry_t *ResultsTblPtr) 83 | 84 | { 85 | UT_Stub_RegisterContext(UT_KEY(CS_ProcessNewAppDefinitionTable), DefinitionTblPtr); 86 | UT_Stub_RegisterContext(UT_KEY(CS_ProcessNewAppDefinitionTable), ResultsTblPtr); 87 | 88 | UT_DEFAULT_IMPL(CS_ProcessNewAppDefinitionTable); 89 | } 90 | 91 | CFE_Status_t CS_TableInit(CFE_TBL_Handle_t *DefinitionTableHandle, CFE_TBL_Handle_t *ResultsTableHandle, 92 | void *DefinitionTblPtr, void *ResultsTblPtr, const uint16 Table, 93 | const char *DefinitionTableName, const char *ResultsTableName, const uint16 NumEntries, 94 | const char *DefinitionTableFileName, const void *DefaultDefTableAddress, 95 | const uint16 SizeofDefinitionTableEntry, const uint16 SizeofResultsTableEntry, 96 | const CFE_TBL_CallbackFuncPtr_t CallBackFunction) 97 | 98 | { 99 | UT_Stub_RegisterContext(UT_KEY(CS_TableInit), DefinitionTableHandle); 100 | UT_Stub_RegisterContext(UT_KEY(CS_TableInit), ResultsTableHandle); 101 | UT_Stub_RegisterContext(UT_KEY(CS_TableInit), DefinitionTblPtr); 102 | UT_Stub_RegisterContext(UT_KEY(CS_TableInit), ResultsTblPtr); 103 | UT_Stub_RegisterContextGenericArg(UT_KEY(CS_TableInit), Table); 104 | UT_Stub_RegisterContext(UT_KEY(CS_TableInit), DefinitionTableName); 105 | UT_Stub_RegisterContext(UT_KEY(CS_TableInit), ResultsTableName); 106 | UT_Stub_RegisterContextGenericArg(UT_KEY(CS_TableInit), NumEntries); 107 | UT_Stub_RegisterContext(UT_KEY(CS_TableInit), DefinitionTableFileName); 108 | UT_Stub_RegisterContext(UT_KEY(CS_TableInit), DefaultDefTableAddress); 109 | UT_Stub_RegisterContextGenericArg(UT_KEY(CS_TableInit), SizeofDefinitionTableEntry); 110 | UT_Stub_RegisterContextGenericArg(UT_KEY(CS_TableInit), SizeofResultsTableEntry); 111 | UT_Stub_RegisterContextGenericArg(UT_KEY(CS_TableInit), CallBackFunction); 112 | 113 | return UT_DEFAULT_IMPL(CS_TableInit); 114 | } 115 | 116 | CFE_Status_t CS_HandleTableUpdate(void *DefinitionTblPtr, void *ResultsTblPtr, 117 | const CFE_TBL_Handle_t DefinitionTableHandle, 118 | const CFE_TBL_Handle_t ResultsTableHandle, const uint16 Table, 119 | const uint16 NumEntries) 120 | { 121 | UT_Stub_RegisterContext(UT_KEY(CS_HandleTableUpdate), DefinitionTblPtr); 122 | UT_Stub_RegisterContext(UT_KEY(CS_HandleTableUpdate), ResultsTblPtr); 123 | UT_Stub_RegisterContextGenericArg(UT_KEY(CS_HandleTableUpdate), DefinitionTableHandle); 124 | UT_Stub_RegisterContextGenericArg(UT_KEY(CS_HandleTableUpdate), ResultsTableHandle); 125 | UT_Stub_RegisterContextGenericArg(UT_KEY(CS_HandleTableUpdate), Table); 126 | UT_Stub_RegisterContextGenericArg(UT_KEY(CS_HandleTableUpdate), NumEntries); 127 | 128 | return UT_DEFAULT_IMPL(CS_HandleTableUpdate); 129 | } 130 | -------------------------------------------------------------------------------- /unit-test/stubs/cs_utils_stubs.c: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,915-1, and identified as “cFS Checksum 3 | * Application version 2.5.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 "cs_utils.h" 25 | 26 | /* UT includes */ 27 | #include "uttest.h" 28 | #include "utassert.h" 29 | #include "utstubs.h" 30 | 31 | void CS_ZeroEepromTempValues(void) 32 | { 33 | UT_DEFAULT_IMPL(CS_ZeroEepromTempValues); 34 | } 35 | 36 | void CS_ZeroMemoryTempValues(void) 37 | { 38 | UT_DEFAULT_IMPL(CS_ZeroMemoryTempValues); 39 | } 40 | 41 | void CS_ZeroTablesTempValues(void) 42 | { 43 | UT_DEFAULT_IMPL(CS_ZeroTablesTempValues); 44 | } 45 | 46 | void CS_ZeroAppTempValues(void) 47 | { 48 | UT_DEFAULT_IMPL(CS_ZeroAppTempValues); 49 | } 50 | 51 | void CS_ZeroCfeCoreTempValues(void) 52 | { 53 | UT_DEFAULT_IMPL(CS_ZeroCfeCoreTempValues); 54 | } 55 | 56 | void CS_ZeroOSTempValues(void) 57 | { 58 | UT_DEFAULT_IMPL(CS_ZeroOSTempValues); 59 | } 60 | 61 | void CS_InitializeDefaultTables(void) 62 | { 63 | UT_DEFAULT_IMPL(CS_InitializeDefaultTables); 64 | } 65 | 66 | void CS_GoToNextTable(void) 67 | { 68 | UT_DEFAULT_IMPL(CS_GoToNextTable); 69 | } 70 | 71 | bool CS_GetTableResTblEntryByName(CS_Res_Tables_Table_Entry_t **EntryPtr, const char *Name) 72 | { 73 | UT_Stub_RegisterContext(UT_KEY(CS_GetTableResTblEntryByName), EntryPtr); 74 | UT_Stub_RegisterContext(UT_KEY(CS_GetTableResTblEntryByName), Name); 75 | 76 | return UT_DEFAULT_IMPL(CS_GetTableResTblEntryByName); 77 | } 78 | 79 | bool CS_GetTableDefTblEntryByName(CS_Def_Tables_Table_Entry_t **EntryPtr, const char *Name) 80 | { 81 | UT_Stub_RegisterContext(UT_KEY(CS_GetTableDefTblEntryByName), EntryPtr); 82 | UT_Stub_RegisterContext(UT_KEY(CS_GetTableDefTblEntryByName), Name); 83 | 84 | return UT_DEFAULT_IMPL(CS_GetTableDefTblEntryByName); 85 | } 86 | 87 | bool CS_GetAppResTblEntryByName(CS_Res_App_Table_Entry_t **EntryPtr, const char *Name) 88 | { 89 | UT_Stub_RegisterContext(UT_KEY(CS_GetAppResTblEntryByName), EntryPtr); 90 | UT_Stub_RegisterContext(UT_KEY(CS_GetAppResTblEntryByName), Name); 91 | 92 | return UT_DEFAULT_IMPL(CS_GetAppResTblEntryByName); 93 | } 94 | 95 | bool CS_GetAppDefTblEntryByName(CS_Def_App_Table_Entry_t **EntryPtr, const char *Name) 96 | { 97 | UT_Stub_RegisterContext(UT_KEY(CS_GetAppDefTblEntryByName), EntryPtr); 98 | UT_Stub_RegisterContext(UT_KEY(CS_GetAppDefTblEntryByName), Name); 99 | 100 | return UT_DEFAULT_IMPL(CS_GetAppDefTblEntryByName); 101 | } 102 | 103 | bool CS_FindEnabledEepromEntry(uint16 *EnabledEntry) 104 | { 105 | UT_Stub_RegisterContext(UT_KEY(CS_FindEnabledEepromEntry), EnabledEntry); 106 | return UT_DEFAULT_IMPL(CS_FindEnabledEepromEntry); 107 | } 108 | 109 | bool CS_FindEnabledMemoryEntry(uint16 *EnabledEntry) 110 | { 111 | UT_Stub_RegisterContext(UT_KEY(CS_FindEnabledMemoryEntry), EnabledEntry); 112 | return UT_DEFAULT_IMPL(CS_FindEnabledMemoryEntry); 113 | } 114 | 115 | bool CS_FindEnabledTablesEntry(uint16 *EnabledEntry) 116 | { 117 | UT_Stub_RegisterContext(UT_KEY(CS_FindEnabledTablesEntry), EnabledEntry); 118 | return UT_DEFAULT_IMPL(CS_FindEnabledTablesEntry); 119 | } 120 | 121 | bool CS_FindEnabledAppEntry(uint16 *EnabledEntry) 122 | { 123 | UT_Stub_RegisterContext(UT_KEY(CS_FindEnabledAppEntry), EnabledEntry); 124 | return UT_DEFAULT_IMPL(CS_FindEnabledAppEntry); 125 | } 126 | 127 | bool CS_VerifyCmdLength(const CFE_MSG_Message_t *Msg, size_t ExpectedLength) 128 | { 129 | UT_Stub_RegisterContext(UT_KEY(CS_VerifyCmdLength), Msg); 130 | UT_Stub_RegisterContextGenericArg(UT_KEY(CS_VerifyCmdLength), ExpectedLength); 131 | 132 | return UT_DEFAULT_IMPL(CS_VerifyCmdLength); 133 | } 134 | 135 | bool CS_BackgroundOS(void) 136 | { 137 | return UT_DEFAULT_IMPL(CS_BackgroundOS); 138 | } 139 | 140 | bool CS_BackgroundCfeCore(void) 141 | { 142 | return UT_DEFAULT_IMPL(CS_BackgroundCfeCore); 143 | } 144 | 145 | bool CS_BackgroundEeprom(void) 146 | { 147 | return UT_DEFAULT_IMPL(CS_BackgroundEeprom); 148 | } 149 | 150 | bool CS_BackgroundMemory(void) 151 | { 152 | return UT_DEFAULT_IMPL(CS_BackgroundMemory); 153 | } 154 | 155 | bool CS_BackgroundTables(void) 156 | { 157 | return UT_DEFAULT_IMPL(CS_BackgroundTables); 158 | } 159 | 160 | bool CS_BackgroundApp(void) 161 | { 162 | return UT_DEFAULT_IMPL(CS_BackgroundApp); 163 | } 164 | 165 | void CS_ResetTablesTblResultEntry(CS_Res_Tables_Table_Entry_t *TablesTblResultEntry) 166 | { 167 | UT_Stub_RegisterContext(UT_KEY(CS_ResetTablesTblResultEntry), TablesTblResultEntry); 168 | 169 | UT_DEFAULT_IMPL(CS_ResetTablesTblResultEntry); 170 | } 171 | 172 | CFE_Status_t CS_HandleRoutineTableUpdates(void) 173 | { 174 | return UT_DEFAULT_IMPL(CS_HandleRoutineTableUpdates); 175 | } 176 | 177 | CFE_Status_t CS_AttemptTableReshare(CS_Res_Tables_Table_Entry_t *ResultsEntry, CFE_TBL_Handle_t *LocalTblHandle, 178 | CFE_TBL_Info_t *TblInfo, cpuaddr *LocalAddress, int32 *ResultGetInfo) 179 | { 180 | UT_Stub_RegisterContext(UT_KEY(CS_AttemptTableReshare), ResultsEntry); 181 | UT_Stub_RegisterContext(UT_KEY(CS_AttemptTableReshare), LocalTblHandle); 182 | UT_Stub_RegisterContext(UT_KEY(CS_AttemptTableReshare), TblInfo); 183 | UT_Stub_RegisterContext(UT_KEY(CS_AttemptTableReshare), LocalAddress); 184 | UT_Stub_RegisterContext(UT_KEY(CS_AttemptTableReshare), ResultGetInfo); 185 | 186 | return UT_DEFAULT_IMPL(CS_AttemptTableReshare); 187 | } 188 | 189 | bool CS_CheckRecomputeOneshot(void) 190 | { 191 | return UT_DEFAULT_IMPL(CS_CheckRecomputeOneshot); 192 | } 193 | -------------------------------------------------------------------------------- /unit-test/utilities/cs_test_utils.c: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,915-1, and identified as “cFS Checksum 3 | * Application version 2.5.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 "cs_test_utils.h" 25 | #include "cs_tbldefs.h" 26 | 27 | /* UT includes */ 28 | #include "uttest.h" 29 | #include "utassert.h" 30 | #include "utstubs.h" 31 | 32 | /* 33 | * Function Definitions 34 | */ 35 | 36 | CS_Res_EepromMemory_Table_Entry_t CS_DefaultEepromResTable[CS_MAX_NUM_EEPROM_TABLE_ENTRIES]; 37 | CS_Res_EepromMemory_Table_Entry_t CS_DefaultMemoryResTable[CS_MAX_NUM_MEMORY_TABLE_ENTRIES]; 38 | CS_Res_Tables_Table_Entry_t CS_DefaultTablesResTable[CS_MAX_NUM_TABLES_TABLE_ENTRIES]; 39 | CS_Res_App_Table_Entry_t CS_DefaultAppResTable[CS_MAX_NUM_APP_TABLE_ENTRIES]; 40 | 41 | #define UT_MAX_SENDEVENT_DEPTH 4 42 | CFE_EVS_SendEvent_context_t context_CFE_EVS_SendEvent[UT_MAX_SENDEVENT_DEPTH]; 43 | CFE_ES_WriteToSysLog_context_t context_CFE_ES_WriteToSysLog; 44 | 45 | void UT_Handler_CFE_EVS_SendEvent(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context, va_list va) 46 | { 47 | uint16 CallCount; 48 | uint16 idx; 49 | 50 | CallCount = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); 51 | 52 | if (CallCount > (sizeof(context_CFE_EVS_SendEvent) / sizeof(context_CFE_EVS_SendEvent[0]))) 53 | { 54 | UtAssert_Failed("CFE_EVS_SendEvent UT depth %u exceeded: %u, increase UT_MAX_SENDEVENT_DEPTH", 55 | UT_MAX_SENDEVENT_DEPTH, CallCount); 56 | } 57 | else 58 | { 59 | idx = CallCount - 1; 60 | context_CFE_EVS_SendEvent[idx].EventID = UT_Hook_GetArgValueByName(Context, "EventID", uint16); 61 | context_CFE_EVS_SendEvent[idx].EventType = UT_Hook_GetArgValueByName(Context, "EventType", uint16); 62 | 63 | strncpy(context_CFE_EVS_SendEvent[idx].Spec, UT_Hook_GetArgValueByName(Context, "Spec", const char *), 64 | CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); 65 | context_CFE_EVS_SendEvent[idx].Spec[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH - 1] = '\0'; 66 | } 67 | } 68 | 69 | void UT_Handler_CFE_ES_WriteToSysLog(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context, va_list va) 70 | { 71 | strncpy(context_CFE_ES_WriteToSysLog.Spec, UT_Hook_GetArgValueByName(Context, "SpecStringPtr", const char *), 72 | CFE_MISSION_EVS_MAX_MESSAGE_LENGTH - 1); 73 | context_CFE_ES_WriteToSysLog.Spec[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH - 1] = '\0'; 74 | } 75 | 76 | void CS_Test_Setup(void) 77 | { 78 | /* initialize test environment to default state for every test */ 79 | UT_ResetState(0); 80 | 81 | memset(&CS_AppData, 0, sizeof(CS_AppData)); 82 | memset(context_CFE_EVS_SendEvent, 0, sizeof(context_CFE_EVS_SendEvent)); 83 | memset(&context_CFE_ES_WriteToSysLog, 0, sizeof(context_CFE_ES_WriteToSysLog)); 84 | 85 | /* Register custom handlers */ 86 | UT_SetVaHandlerFunction(UT_KEY(CFE_EVS_SendEvent), UT_Handler_CFE_EVS_SendEvent, NULL); 87 | UT_SetVaHandlerFunction(UT_KEY(CFE_ES_WriteToSysLog), UT_Handler_CFE_ES_WriteToSysLog, NULL); 88 | 89 | CS_AppData.DefEepromTblPtr = &CS_AppData.DefaultEepromDefTable[0]; 90 | CS_AppData.ResEepromTblPtr = &CS_DefaultEepromResTable[0]; 91 | CS_AppData.DefMemoryTblPtr = &CS_AppData.DefaultMemoryDefTable[0]; 92 | CS_AppData.ResMemoryTblPtr = &CS_DefaultMemoryResTable[0]; 93 | CS_AppData.DefTablesTblPtr = &CS_AppData.DefaultTablesDefTable[0]; 94 | CS_AppData.ResTablesTblPtr = &CS_DefaultTablesResTable[0]; 95 | CS_AppData.DefAppTblPtr = &CS_AppData.DefaultAppDefTable[0]; 96 | CS_AppData.ResAppTblPtr = &CS_DefaultAppResTable[0]; 97 | 98 | memset(CS_DefaultEepromResTable, 0, sizeof(CS_DefaultEepromResTable)); 99 | memset(CS_DefaultMemoryResTable, 0, sizeof(CS_DefaultMemoryResTable)); 100 | memset(CS_DefaultTablesResTable, 0, sizeof(CS_DefaultTablesResTable)); 101 | memset(CS_DefaultAppResTable, 0, sizeof(CS_DefaultAppResTable)); 102 | } 103 | 104 | void CS_Test_TearDown(void) 105 | { 106 | /* cleanup test environment */ 107 | } 108 | -------------------------------------------------------------------------------- /unit-test/utilities/cs_test_utils.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * NASA Docket No. GSC-18,915-1, and identified as “cFS Checksum 3 | * Application version 2.5.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 | #ifndef CS_TEST_UTILS_H 21 | #define CS_TEST_UTILS_H 22 | 23 | /* 24 | * Includes 25 | */ 26 | 27 | #include "cs_app.h" 28 | 29 | extern CS_AppData_t CS_AppData; 30 | 31 | /* 32 | * Global context structures 33 | */ 34 | 35 | typedef struct 36 | { 37 | uint16 EventID; 38 | uint16 EventType; 39 | char Spec[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH]; 40 | } CFE_EVS_SendEvent_context_t; 41 | 42 | typedef struct 43 | { 44 | char Spec[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH]; 45 | } CFE_ES_WriteToSysLog_context_t; 46 | 47 | extern CFE_EVS_SendEvent_context_t context_CFE_EVS_SendEvent[]; 48 | extern CFE_ES_WriteToSysLog_context_t context_CFE_ES_WriteToSysLog; 49 | 50 | /* 51 | * Function Definitions 52 | */ 53 | 54 | void CS_Test_Setup(void); 55 | void CS_Test_TearDown(void); 56 | 57 | #endif 58 | --------------------------------------------------------------------------------