├── .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
├── dox_src
│ ├── CFS_DS_Context.jpg
│ ├── CMakeLists.txt
│ ├── cfs_ds.dox
│ ├── ds-common.doxyfile.in
│ └── ds-usersguide.doxyfile.in
├── ds-detaildesign.doxyfile.in
├── ds_FunctionalRequirements.csv
└── users_guide_historical
│ ├── CFS_DS_User_Guide_Doc_No_582-2013-001 Source Files.zip
│ ├── CFS_DS_User_Guide_Doc_No_582-2013-001.docx
│ └── CFS_DS_User_Guide_Doc_No_582-2013-001.pdf
├── fsw
├── inc
│ ├── ds_events.h
│ ├── ds_extern_typedefs.h
│ ├── ds_msg.h
│ ├── ds_msgdefs.h
│ ├── ds_msgids.h
│ ├── ds_perfids.h
│ └── ds_platform_cfg.h
├── src
│ ├── ds_app.c
│ ├── ds_app.h
│ ├── ds_appdefs.h
│ ├── ds_cmds.c
│ ├── ds_cmds.h
│ ├── ds_dispatch.c
│ ├── ds_dispatch.h
│ ├── ds_file.c
│ ├── ds_file.h
│ ├── ds_table.c
│ ├── ds_table.h
│ ├── ds_verify.h
│ └── ds_version.h
└── tables
│ ├── ds_file_tbl.c
│ └── ds_filter_tbl.c
├── mission_build.cmake
└── unit-test
├── CMakeLists.txt
├── ds_app_tests.c
├── ds_cmds_tests.c
├── ds_dispatch_tests.c
├── ds_file_tests.c
├── ds_table_tests.c
├── stubs
├── ds_app_stubs.c
├── ds_cmds_stubs.c
├── ds_dispatch_stubs.c
├── ds_file_stubs.c
├── ds_global_stubs.c
├── ds_table_stubs.c
├── override_inc
│ └── stdio.h
├── stub_basetypes.h
├── stub_libc_stdio.c
├── stub_stdarg.h
└── stub_stdio.h
└── utilities
├── ds_test_utils.c
└── ds_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/DS/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/DS/blob/main/CONTRIBUTING.md).
13 | * [ ] I reviewed the [README file](https://github.com/nasa/DS/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/DS/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: "[\"ds-usersguide\"]"
13 | app-name: ds
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 | with:
12 | startup-string: Application initialized
13 |
--------------------------------------------------------------------------------
/.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/ds
14 | prep: 'make prep; make -C build/tools/elf2cfetbl'
15 | make: 'make -C build/native/default_cpu1/apps/ds'
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 ds)" 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_DS C)
2 |
3 | set(APP_SRC_FILES
4 | fsw/src/ds_table.c
5 | fsw/src/ds_cmds.c
6 | fsw/src/ds_app.c
7 | fsw/src/ds_file.c
8 | fsw/src/ds_dispatch.c
9 | )
10 |
11 | # Create the app module
12 | add_cfe_app(ds ${APP_SRC_FILES})
13 |
14 | # This permits direct access to public headers in the fsw/inc directory
15 | target_include_directories(ds PUBLIC fsw/inc)
16 |
17 | set(APP_TABLE_FILES
18 | fsw/tables/ds_filter_tbl.c
19 | fsw/tables/ds_file_tbl.c
20 | )
21 |
22 | add_cfe_tables(ds ${APP_TABLE_FILES})
23 |
24 | # If UT is enabled, then add the tests from the subdirectory
25 | # Note that this is an app, and therefore does not provide
26 | # stub functions, as other entities would not typically make
27 | # direct function calls into this application.
28 | if(ENABLE_UNIT_TESTS)
29 | add_subdirectory(unit-test)
30 | endif()
31 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing Guide
2 |
3 | Please see our [top-level contributing guide](https://github.com/nasa/cFS/blob/main/CONTRIBUTING.md) for more information on how to contribute to cFS components.
4 |
5 | ## Contributor License Agreement (CLA)
6 |
7 | Before we can accept your code contributions we need a signed Contributor License Agreement (CLA). See the [instructions](https://github.com/nasa/cFS/blob/main/CONTRIBUTING.md#contributor-license-agreement-cla) for more information.
8 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "[]"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright [yyyy] [name of copyright owner]
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # core Flight System (cFS) Data Storage Application (DS)
2 |
3 | ## Introduction
4 |
5 | The Data Storage application (DS) is a core Flight System (cFS) application
6 | that is a plug in to the Core Flight Executive (cFE) component of the cFS.
7 | The DS application is used for storing software bus messages in files. These
8 | files are generally stored on a storage device such as a solid state recorder
9 | but they could be stored on any file system. Another cFS application such as
10 | CFDP (CF) must be used in order to transfer the files created by DS from
11 | their onboard storage location to where they will be viewed and processed.
12 |
13 | The DS application is written in C and depends on the cFS Operating System
14 | Abstraction Layer (OSAL) and cFE components. There is additional DS application
15 | specific configuration information contained in the application user's guide.
16 |
17 | Developer's guide information can be generated using Doxygen:
18 | ```
19 | make prep
20 | make -C build/docs/ds-usersguide ds-usersguide
21 | ```
22 |
23 | ## Software Required
24 |
25 | cFS Framework (cFE, OSAL, PSP)
26 |
27 | An integrated bundle including the cFE, OSAL, and PSP can
28 | be obtained at https://github.com/nasa/cfs
29 |
30 | ## About cFS
31 |
32 | The cFS is a platform and project independent reusable software framework and
33 | set of reusable applications developed by NASA Goddard Space Flight Center.
34 | This framework is used as the basis for the flight software for satellite data
35 | systems and instruments, but can be used on other embedded systems. More
36 | information on the cFS can be found at http://cfs.gsfc.nasa.gov
37 |
--------------------------------------------------------------------------------
/docs/dox_src/CFS_DS_Context.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nasa/DS/7404b975be4b4a2e2a51eab4c1fa6a9b7a8630c4/docs/dox_src/CFS_DS_Context.jpg
--------------------------------------------------------------------------------
/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(DS_DOCS NONE)
15 |
16 | # generate the configuration files
17 | configure_file(
18 | ${CMAKE_CURRENT_SOURCE_DIR}/ds-common.doxyfile.in
19 | ${CMAKE_BINARY_DIR}/docs/ds-common.doxyfile
20 | @ONLY
21 | )
22 |
23 | configure_file(
24 | ${CMAKE_CURRENT_SOURCE_DIR}/ds-usersguide.doxyfile.in
25 | ${CMAKE_CURRENT_BINARY_DIR}/ds-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}/ds-usersguide.doxyfile
31 | WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
32 | )
33 |
34 | add_custom_target(ds-usersguide
35 | COMMAND echo "DS UsersGuide: file://${CMAKE_CURRENT_BINARY_DIR}/html/index.html"
36 | DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/ALWAYSBUILD"
37 | )
38 |
--------------------------------------------------------------------------------
/docs/dox_src/cfs_ds.dox:
--------------------------------------------------------------------------------
1 | /**
2 | \page cfsdsfrontpage CFS Data Storage (DS) Documentation
3 |
4 |
5 | - \subpage cfsdsintro
6 |
- \subpage cfsdsovr
7 |
- \subpage cfsdsopr
8 |
- \subpage cfsdscmdspg
9 |
- \subpage cfsdstlmpg
10 |
- \subpage cfsdseventspg
11 |
- \subpage cfsdsdg
12 |
- \subpage cfsdscfgpg
13 |
- \subpage cfsdstbl
14 |
- \subpage cfsdscons
15 |
- \subpage cfsdsfaqs
16 |
17 | **/
18 |
19 | /**
20 | * \page cfsdseventspg CFS Data Storage Events
21 | *
22 | * \ref cfsdsevents
23 | */
24 |
25 | /**
26 | * \page cfsdscfgpg CFS Data Storage Configuration
27 | *
28 | * \ref cfsdsmissioncfg
29 | *
30 | * \ref cfsdsplatformcfg
31 | */
32 |
33 | /**
34 | * \page cfsdscmdspg CFS Data Storage Commands
35 | *
36 | * \ref cfsdscmdmid
37 | *
38 | * \ref cfsdscmdstructs
39 | *
40 | * \ref cfsdscmdcodes
41 | */
42 |
43 | /**
44 | * \page cfsdstlmpg CFS Data Storage Telemetry
45 | *
46 | * \ref cfsdstlmmid
47 | *
48 | * \ref cfsdstlm
49 | */
50 |
51 | /**
52 | \page cfsdsintro CFS Data Storage Introduction
53 |
54 | Scope
55 |
56 | This document provides a complete specification for the commands and telemetry associated
57 | with the CFS Data Storage (DS) application software. The document is intended primarily
58 | for users of the software (operations personnel, test engineers, and maintenance personnel).
59 | The last section of the document, the deployment guide section, is intended for mission
60 | developers when deploying and configuring the application software for a mission
61 | flight software build environment.
62 |
63 | \ref cfsdsversion
64 |
65 | Acronyms
66 |
67 |
68 | Acronym | Description |
69 |
DS | CFS Data Storage |
70 |
API | Application Programming Interface |
71 |
ATP | Absolute Time Processor |
72 |
ATS | Absolute Time tagged command Sequence |
73 |
CCSDS | Consultative Committee for Space Data Systems |
74 |
C&DH | Command and Data Handling |
75 |
CFE | Core Flight Executive |
76 |
CFS | Core Flight System |
77 |
CI | Command Ingest |
78 |
Cmd | Command |
79 |
CPU | Central Processing Unit |
80 |
EDAC | Error Detection and Correction |
81 |
FDS | Flight Data System |
82 |
FM | File Manager |
83 |
FSW | Flight Software |
84 |
GN&C | Guidance Navigation & Control |
85 |
GSFC | Goddard Space Flight Center |
86 |
HK | Housekeeping |
87 |
HW, H/W | Hardware |
88 |
ICD | Interface Control Document |
89 |
ISR | Interrupt Service Routine |
90 |
OS | Operating System |
91 |
OSAL | Operating System Abstraction Layer |
92 |
Pkts | Packets |
93 |
RAM | Random-Access Memory |
94 |
RTOS | Real Time Operating System |
95 |
RTP | Relative Time Processor |
96 |
RTS | Relative Time tagged command Sequence |
97 |
SB | Software Bus Service |
98 |
SBC | Single Board Computer |
99 |
SC | Stored Commands task |
100 |
SW, S/W | Software |
101 |
TBD | To Be Determined |
102 |
TBL | Table |
103 |
TDM | Time Data Multiplex |
104 |
TLM | Telemetry |
105 |
UTC | Universal time code |
106 |
107 | **/
108 |
109 | /**
110 | \page cfsdsovr CFS Data Storage Overview
111 |
112 | The CFS DS application is responsible for storing messages in files. These files are generally stored on a storage device such as a solid state recorder but they could be stored on any file system. Another application such as CFDP must be used in order to transfer the files created by DS to the ground. The DS software context diagram is shown in Figure DS-1.
113 |
114 | \image html CFS_DS_Context.jpg "Figure DS-1: Software Context Diagram"
115 | \image latex CFS_DS_Context.jpg "Figure DS-1: Software Context Diagram"
116 |
117 | During initialization, DS subscribes to messages from other applications as defined in the Data Storage Filter Table. The Scheduler applicaiton (SCH) sends periodic commands to DS as defined in the SCH Schedule Table which requests housekeeping from DS (note that a mission must define this request in the SCH table). Ground commands come from the Command Ingest task (CI). Messages are routed to DS by the cFE SB application. DS learns of ground updates to the DS tables throught the cFE Table Services application.
118 |
119 | DS defines two tables:
120 | - Filter Table - for each message ID, specifies filter scheme, filter parametes and which file or files to write the message to. Note that each message can be written to a maximum of #DS_FILTERS_PER_PACKET destination files.
121 |
122 | - File Table - specifies information about each destination file.
123 | **/
124 |
125 | /**
126 | \page cfsdsopr CFS Data Storage Operation
127 |
128 | When DS receives a message that passes the filtering algorithm, the message is stored in a file or files based upon the File Table information for that message ID. Once a message is stored, the DS Housekeeping packet displays information about the open file. Each houskeeping cycle, DS evaluates the open files to determine if their age has been exceeded. If this determination is true, the file is closed by the DS application. Also, each time a message is to be stored, DS determines if the message will fit in the open file. If the determination is false, the open file will be closed and a new file created containing the message. A minimum of one message will be stored each file.
129 |
130 | Filtering
131 | Filtering is based upon message IDs. The Filter Table determines what messages DS will store. The DS application supports two types of filtering:
132 | - Sequence number based filtering
133 | - Time based filtering.
134 |
135 | Each filtering type relies on three filter factors, N, X, and O where N of X messages will be stored starting at offset O.
136 | Sequence based Filtering
137 | This type of filtering uses the packet sequence number to determine if the message should be filtered or not. If X is greated than zero, the message shall be stored if and only if the sequence number modulo X is less than N. For example, N=4, X=6 and O=2 will store 4 of 6 messages starting at offset 2.
138 | Time based Filtering
139 | This type of filtering uses the spacecraft time code found in the CCSDS packet secondary header. Fifteen bits out of the 64-bit CCSDS time code field are used. The constructed 15-bit time stamp used for DS filtering consists of the 11 Least Significant Bits (LSB) of the seconds field and the 4 Most Significant Bits (MSB) of the sub-seconds field. Messages will be stored if and only if the constructed 15-bit time stamp modulo X is less than N. This type of filtering is rare in that the N value must be set to the desired 15-bit time stamp which is hard to specify. Testing used simulated values for the spacecraft time code.
140 | **/
141 |
142 | /**
143 | \page cfsdsdg CFS Data Storage Deployment Guide
144 |
145 | To integrate the DS application, follow the CFS App Integration Guide.
146 | Also, be sure to set up the configuration parameters and message IDs for
147 | the platform.
148 |
149 | Move File Capability
150 | If the DS_MOVE_FILES configuration parameter is set to TRUE, the telemetry
151 | database, Destination File table load images and the File Table display page
152 | require changes. The Destination File Table rdl file uses the DS_MOVE_FILES
153 | definition in the ds_platform_cfg.h file. However, in order to get the
154 | required parameter included in telemetry, this configuration parameter must be
155 | set to 1 rather than TRUE. The table images must include this parameter in
156 | order to load successfully and the display page must be modified to display
157 | this parameter.
158 | **/
159 |
160 | /**
161 | \page cfsdstbl CFS Data Storage Table Definitions
162 |
163 | Destination File Table
164 |
165 | The Destination File Table is defined by #DS_DestFileTable_t. This table
166 | contains a description and #DS_DEST_FILE_CNT entries. Each entry is defined by
167 | #DS_DestFileEntry_t.
168 |
169 | Filter Table
170 |
171 | The Filter Table is defined by #DS_FilterTable_t. This table contains a
172 | description and #DS_PACKETS_IN_FILTER_TABLE entries. Each entry is defined by
173 | #DS_PacketEntry_t. Each Packet entry contains the Message ID for DS to store
174 | and #DS_FILTERS_PER_PACKET entries defined by #DS_FilterParms_t.
175 |
176 | The Data Storage (DS) application attempts to load the File and Filter Tables from #DS_DEF_DEST_FILENAME and #DS_DEF_FILTER_FILENAME upon startup.
177 | If the load fails for either of these tables, DS will still start in the mode of operation as defined by the #DS_DEF_ENABLE_STATE configuration
178 | parameter. If this configuration parameter is set to ENABLED mode and either the File and/or Filter Table failed to load, DS will not store any
179 | messages until both tables are loaded with valid data. This can be accomplished by using the cFE Table Services commands after creating a table
180 | load image file and uploading it to the spacecraft's file system. Until both tables are loaded with valid data, DS will increment the
181 | #DS_HkTlm_Payload_t.IgnoredPktCounter for each received packet that is discarded.
182 | **/
183 |
184 | /**
185 | \page cfsdscons CFS Data Storage Operational Constraints
186 |
187 | DS is dependent on the associated OS/hardware file system and storage constraints.
188 | **/
189 |
190 | /**
191 | \page cfsdsfaqs CFS Data Storage Frequently Asked Questions
192 |
193 | (Q) How do I determine what message IDs are to be stored?
194 |
195 | The Message IDs to be stored are specified in the Filter Table. To determine what these are, you must dump the filter table. This can be done by displaying the Filter Table display page and clicking the Refresh button.
196 |
197 |
198 | (Q) Where are my files being stored?
199 |
200 | The locations of the files are determined by the File Table entry that the message ID is associated with. The Filter table indicates what File index is being used to store that message IDs data. To trace the message ID to the File entry, both tables must be dumped. This can be done by displaying the File and Filter Table display pages and clicking the Refresh buttons on each page.
201 |
202 |
203 | (Q) How are my files named?
204 |
205 | The files are named as follows:
206 | path + base + [time/seq characters] + extension.
207 | If the file is a Sequence based file, the sequence characters will be based upon the next sequence number. For example, if path = /ram and base = seq and extension = .dat, the file would be named /ram/seq00000100.dat
208 | If the file is time based, the characters will be in the form YYYYDDDHHMMSS. For example if the file was created on day 123 at 14:15:22 using path = /ram, base = tim and extension = .dat, the file would be named /ram/tim2010123141522.dat
209 | The path, base and extension can be determined by looking in the File Table for the appropriate entry. Finally, the entire length of the filename must not exceed the length specified by the #OS_MAX_PATH_LEN configuration parameter.
210 |
211 | **/
212 |
--------------------------------------------------------------------------------
/docs/dox_src/ds-common.doxyfile.in:
--------------------------------------------------------------------------------
1 | #---------------------------------------------------------------------------
2 | # Common doxygen configuration items
3 | #---------------------------------------------------------------------------
4 |
5 | # Include front material followed by everything in fsw
6 | INPUT += @ds_MISSION_DIR@/docs/dox_src/cfs_ds.dox
7 | INPUT += @ds_MISSION_DIR@/fsw
8 |
9 | IMAGE_PATH += @ds_MISSION_DIR@/docs/dox_src
10 |
--------------------------------------------------------------------------------
/docs/dox_src/ds-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/ds-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 = "DS User's Guide"
19 | WARN_LOGFILE = ds-usersguide-warnings.log
20 |
--------------------------------------------------------------------------------
/docs/ds-detaildesign.doxyfile.in:
--------------------------------------------------------------------------------
1 | #---------------------------------------------------------------------------
2 | # Doxygen Configuration options for mission detailed documentation
3 | #---------------------------------------------------------------------------
4 |
5 | # Common files
6 | @INCLUDE = @MISSION_BINARY_DIR@/docs/ds-common.doxyfile
7 |
--------------------------------------------------------------------------------
/docs/ds_FunctionalRequirements.csv:
--------------------------------------------------------------------------------
1 | Summary,Custom field (Requirement ID),Description,Custom field (Requirement Rationale)
2 | DS1000,DS1000,"Upon receipt of a No-Op command, DS shall increment the DS Valid Command Counter and generate an event message.",Debug command to verify application is alive.
3 | DS1001,DS1001,"Upon receipt of a Reset Counters command, DS shall reset the following housekeeping variables to a value of zero:
4 | a) Valid Command Counter
5 | b) Command Rejected Counter
6 | c) Packets discarded (DS was disabled) Counter
7 | d) Packets discarded (pkt has no filter) Counter
8 | e) Packets discarded (failed filter test) Counter
9 | f) Packets that passed filter test Counter
10 | g) Good destination file I/O Counter
11 | h) Bad destination file I/O Counter
12 | i) Good updates to secondary header Counter
13 | j) Bad updates to secondary header Counter
14 | k) Destination file table loads Counter
15 | l) Failed attempts to get table data pointer Counter
16 | m) Packet filter table loads Counter
17 | n) Failed attempts to get table data pointer Counter","Important for testing and on-orbit flight operations in order to start with
18 | a “clean slate”."
19 | DS1002,DS1002,"For all DS commands, if the length contained in the message header is not equal to the expected length, DS shall reject the command and issue an event message.",Basic command verification in the event of SEU or memory corruption
20 | DS1004,DS1004,"If DS accepts any command as valid, DS shall execute the command, increment the DS Valid Command Counter and issue an event message.",Operators require feedback on command execution.
21 | DS1005,DS1005,"If DS rejects any command, DS shall abort the command execution, increment the DS Command Rejected Counter and issue an error event message.",Operators require feedback on command execution.
22 | DS2000,DS2000,"Upon receipt of a message, if the Packet Processing State is ENABLED, DS shall determine if the message shall be stored based on the contents of the Packet Filter Table and the Destination File Table.",Specifies source for message storage criteria configuration
23 | DS2000.1,DS2000.1,"The Packet Filter Table contents shall include:
24 | a) Message ID
25 | b) Destination file table index
26 | c) Filter type (time/sequence count)
27 | d) Algorithm N value
28 | e) Algorithm X value
29 | f) Algorithm O value",Specifies minimum packet filter table contents which support operational configuration management
30 | DS2000.2,DS2000.2,"The Destination File Table contents shall include:
31 | a) Pathname
32 | b) Basename
33 | c) Extension
34 | d) Filename type (time/sequence)
35 | e) Default Destination enable state
36 | f) Max file size (in bytes)
37 | g) Max file age (in seconds)
38 | h) Initial Sequence Count",Specifies minimum Destination File Table contents which support operational configuration management
39 | DS2001,DS2001,"DS shall store ""N of X"" messages starting at offset O.",Specifies storage filtering method
40 | DS2001.1,DS2001.1,"If either the X value or the N value is zero, then the message shall not be stored.","Gracefully handle ""0"" parameters and provide a way to specify no storage."
41 | DS2002,DS2002,DS shall store each message in up to different destination files.,Support platform configuration of maximum number of files to store a message to
42 | DS2002.1,DS2002.1,Destination files shall be created when the first message is received that is passed by the filter algorithm for that particular message and selects that particular destination file.,Preserve space and create files only as needed.
43 | DS2003,DS2003,The input argument to the filter algorithm shall be determined by the Filter Type indicator.,Supports selectable filter type with unique input arguments
44 | DS2003.1,DS2003.1,If Filter Type indicates Sequence based filtering then the algorithm input argument is a value equal to the packet sequence count.,Specifies sequence based filtering input argument
45 | DS2003.2,DS2003.2,If Filter Type indicates Time based filtering then the algorithm input argument is a value created from the lower 11 bits of packet timestamp seconds plus the high 4 bits of timestamp subseconds.,Specifies time based filtering input argument
46 | DS3000,DS3000,DS shall construct unique filenames using either sequence count or time as selected within the Destination File Table.,Specifies operational control via table of unique data file name generation method.
47 | DS3000.1,DS3000.1,If Filename Type indicates naming based on Sequence the constructed filename will include a character representation of the Sequence Count value from the Destination File Table.,Unique file name generation using the file sequence count
48 | DS3000.1.1,DS3000.1.1,If Filename Type indicates naming based on Sequence the value of Sequence Count shall be incremented each time a file is created.,Sequence count behavior based on file creation
49 | DS3000.2,DS3000.2,If Filename Type indicates naming based on Time the constructed filename will include a character representation of the packet timestamp.,Unique file name construction based on time
50 | DS3000.2.1,DS3000.2.1,"If Filename Type indicates naming based on Time the file date and time shall be represented in the following format: ""YYYYDDDHHMMSS"".",Time format for unique file name creation
51 | DS3001,DS3001,"Prior to writing a packet to an existing destination file, DS shall verify that the resulting file size (after the write) shall not exceed the file size limit as defined in the Destination File Table.",Destination file size limit enforcement method
52 | DS3001.1,DS3001.1,If the resulting file size would exceed the file size limit then DS shall close the existing file and open another file.,Specifies behavior when reaching the destination file size limit
53 | DS3001.2,DS3001.2,A minimum of one packet shall be written to a file,Preserve space and create files only as needed.
54 | DS3002,DS3002,"Periodically, DS shall test the age of all open destination files. If any file age exceeds the maximum age defined for that file in the Destination File Table, then DS shall close the file.",Destination file age limit enforcement
55 | DS3002.1,DS3002.1,DS shall update file age and test age limits every time DS processes its housekeeping telemetry request command.,Specifies rate for destination file age limit check
56 | DS3003,DS3003,"Each DS destination file shall contain a primary cFE file header with the following information:
57 | a) Content Type
58 | b) SubType
59 | c) Primary header length
60 | d) Spacecraft ID
61 | e) Processor ID
62 | f) Application ID
63 | g) File creation time (seconds)
64 | h) File creation time (sub-seconds)",Standard cFE file header
65 | DS3004,DS3004,"Each DS destination file shall contain a secondary file header with the following information:
66 | a) File close time (seconds)
67 | b) File close time (sub-seconds)
68 | c) File table index
69 | d) Qualified Filename",Destination file secondary file header contents
70 | DS3005,DS3005,"For every file write error, DS shall:
71 | a) Send an event message
72 | b) Increment total number of file write errors
73 | c) Close the destination file
74 | d) Disable the destination",Notify operators of error and prevent ongoing future errors caused by writing to the same destination file.
75 | DS3006,DS3006,DS shall send a file information telemetry message when closing a data storage file.,Provides file information telemetry packet containing the current status for a closed destination file.
76 | DS5000,DS5000,"Upon receipt of a Disable command, DS shall stop filtering and storing messages.
77 | Note: This command will set the Packet Processing State to DISABLED.",Operational control of packet processing state (message storage)
78 | DS5001,DS5001,"Upon receipt of an Enable command, DS shall begin filtering and storing messages.
79 | Note: This command will set the Packet Processing State to ENABLED.",Operational control of packet processing state (message storage)
80 | DS5002,DS5002,"Upon receipt of a Close File Command, DS shall close the command-specified files.",Operational interface to manually close a destination file
81 | DS5003,DS5003,"Upon receipt of a Set File Basename command, DS shall set the file basename for the command-specified destination file.",Operational support to manually set file basename
82 | DS5004,DS5004,"Upon receipt of a Set Next File Sequence Counter command, DS shall set the command-specified file counter for the command-specified Destination File.",Operational support for manual control of the file counter
83 | DS5005,DS5005,"Upon receipt of an Enable Destination File command, DS shall enable file collection for the command-specified Destination File.",Operational control for managing destination file collection state
84 | DS5006,DS5006,"Upon receipt of a Disable Destination File command, DS disable file collection for the command-specified Destination File.",Operational control for managing destination file collection state
85 | DS5008,DS5008,"Upon receipt of a Set File Index for a Packet Filter Table entry command, DS shall update the destination file index.",Operational support for setting Packet Filter Table destination file index
86 | DS5009,DS5009,"Upon receipt of a Set Filter Type for a Packet Filter Table entry command, DS shall update the filter type to the command-specified filter type.",Operational support for setting Packet Filter Table entry filter type
87 | DS5010,DS5010,"Upon receipt of a Set Filter Parameter for a Packet Filter Table entry command, DS shall update the N, X, O Parameters to the command-specified values",Allow on-orbit modification of filtering parameters without requiring a table update.
88 | DS5011,DS5011,"Upon receipt of a Set Destination Type for a destination file type command, DS shall update the Destination type to the command-specified destination type.",Operational support for setting file destination type
89 | DS5012,DS5012,"Upon receipt of a Set Path for a destination filename command, DS shall update the path to the command-specified path.",Operational support to manually set the destination filename path
90 | DS5013,DS5013,"Upon receipt of a Set Extension for destination filename command, DS shall update the file extension to the command-specified extension.",Operational support to manually set the destination filename extension
91 | DS5014,DS5014,"Upon receipt of a Set Maximum Size for a destination file command, DS shall update the maximum file size to the command-specified maximum",Operational support to manually set the destination file maximum size
92 | DS5015,DS5015,"Upon receipt of a Set Maximum Age for a destination file command, DS shall update the maximum destination file age to the command-specified maximum age.",Operational support to manually set destination file maximum age limit
93 | DS5016,DS5016,"Upon receipt of an Add Message ID to Packet Filter Table command, DS shall add the command-specified Message ID to the next unused entry in the Packet Filter Table.",Allow on-orbit modification of Packet Filter Table without requiring a table update.
94 | DS5016.1,DS5016.1,If the command-specified Message ID is invalid DS will reject the command and send an event message.,Response to invalid message id in command
95 | DS5016.2,DS5016.2,If the Packet Filter table is not loaded DS will reject the command and send an event message.,Response to command without a loaded Packet Filter table
96 | DS5016.3,DS5016.3,If the command-specified Message ID is already specified in the Packet Filter Table DS will reject the command and send an event message,Response to commanding an already specified message ID in the Packet Filter Table
97 | DS5016.4,DS5016.4,If there are no unused entries in the Packet Filter Table DS will reject the command and send an event message,Response to a command to add an entry to a full Packet Filter Table
98 | DS5017,DS5017,"Upon Receipt of a Get File Info command, DS shall generate a telemetry packet containing the following information for each destination file:
99 | 1) File age
100 | 2) File size
101 | 3) File rate
102 | 4) Sequence count
103 | 5) Enable state
104 | 6) Open state
105 | 7) Filename ",Provides information on file status
106 | DS5018,DS5018,"Upon receipt of a Remove Message ID to Packet Filter Table command, DS shall remove the command-specified Message ID from the Packet Filter Table.",Allow on-orbit modification of Packet Filter Table without requiring a table update.
107 | DS5018.1,DS5018.1,If the command-specified Message ID is invalid DS will reject the command and send an event message.,Allow on-orbit modification of Packet Filter Table without requiring a table update.
108 | DS5018.2,DS5018.2,If the Packet Filter Table is not loaded DS will reject the command and send an event message.,Response to command without a loaded Packet Filter Table.
109 | DS5018.3,DS5018.3,If the command-specified Message ID is not specified in the Packet Filter Table DS will reject the command and send an event message.,Response to commanding a specified message ID that does not exist in the Packet Filter Table.
110 | DS8000,DS8000,"DS shall generate a housekeeping message containing the following:
111 | a) Valid Command Counter
112 | b) Command Rejected Counter
113 | c) Packets discarded (DS was disabled) Counter
114 | d) Packets discarded (pkt has no filter) Counter
115 | e) Packets discarded (failed filter test) Counter
116 | f) Packets that passed filter test Counter
117 | g) Good destination file I/O Counter
118 | h) Bad destination file I/O Counter
119 | i) Good updates to secondary header Counter
120 | j) Bad updates to secondary header Counter
121 | k) Destination file table loads Counter
122 | l) Failed attempts to get table data pointer Counter
123 | m) Packet filter table loads Counter
124 | n) Failed attempts to get table data pointer Counter
125 | o) Application State
126 | p) Filename of last loaded Filter Table",Housekeeping telemetry to indicate basic DS status.
127 | DS9000,DS9000,"Upon cFE Power-On DS shall initialize the following Housekeeping data to Zero (or value specified):
128 | a) Valid Command Counter
129 | b) Command Rejected Counter
130 | c) Packets discarded (DS was disabled) Counter
131 | d) Packets discarded (pkt has no filter) Counter
132 | e) Packets discarded (failed filter test) Counter
133 | f) Packets that passed filter test Counter
134 | g) Good destination file I/O Counter
135 | h) Bad destination file I/O Counter
136 | i) Good updates to secondary header Counter
137 | j) Bad updates to secondary header Counter
138 | k) Destination file table loads Counter
139 | l) Failed attempts to get table data pointer Counter
140 | m) Packet filter table loads Counter
141 | n) Failed attempts to get table data pointer Counter","Start from a known ""clean"" state."
142 | DS9001,DS9001,Upon cFE Power-On DS shall initialize the DS tables from the default files.,"Start from a known ""good"" state."
143 | DS9002,DS9002,"Upon a cFE Processor Reset or DS Application Reset, DS shall close all files.",Orderly shutdown of files in a reset.
144 | DS9003,DS9003,"Upon a cFE Processor Reset or DS Application Reset , DS shall restore the following if the associated Preserve Flag is set to TRUE:
145 | a) Packet Filter Table
146 | b) Destination File Table
147 | c) File Sequence number for all Destination File Sets
148 | d) Packet Processing State (ENABLED or DISABLED)",Processor or application reset behavior when preserve flag is set to TRUE
149 | DS9004,DS9004,"Upon a cFE Processor Reset or DS Application Reset , DS shall restore the following if the associated Preserve Flag is set to FALSE:
150 | a) File Sequence Counters
151 | b) Packet Processing State",Processor or Application reset behavior when Preserve Flag is set to FALSE
152 | DS9005,DS9005,"Upon any initialization and/or Packet Filter Table Update, DS shall validate the Packet Filter Table:
153 | a) message ID
154 | b) destination file table index
155 | c) filter type (time/sequence)
156 | d) filter parms (N,X,O)",Validate the items that can be validated when a table is updated (some items cannot be validated until runtime).
157 | DS9006,DS9006,"Upon any initialization and/or Packet Filter Table Update, DS shall subscribe to the messages defined in the Data Storage Packet Filter Table.",Must subscribe to all of the messages defined in the Data Storage Packet Filter Table after any reset.
158 | DS9007,DS9007,"Upon any initialization and/or Destination File Table Update, DS will validate the Destination File Table:
159 | a) filename type
160 | b) file enable/disable state
161 | c) max file size
162 | d) max file age
163 | e) sequence count",Valid the items that can be validated when a table is updated (some items cannot be validated until runtime).
164 | DS9008,DS9008,Upon cFE Power-On DS shall set the Packet Processing State to the state (ENABLED or DISABLED).,Power-on reset Packet Processing State behavior
165 |
--------------------------------------------------------------------------------
/docs/users_guide_historical/CFS_DS_User_Guide_Doc_No_582-2013-001 Source Files.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nasa/DS/7404b975be4b4a2e2a51eab4c1fa6a9b7a8630c4/docs/users_guide_historical/CFS_DS_User_Guide_Doc_No_582-2013-001 Source Files.zip
--------------------------------------------------------------------------------
/docs/users_guide_historical/CFS_DS_User_Guide_Doc_No_582-2013-001.docx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nasa/DS/7404b975be4b4a2e2a51eab4c1fa6a9b7a8630c4/docs/users_guide_historical/CFS_DS_User_Guide_Doc_No_582-2013-001.docx
--------------------------------------------------------------------------------
/docs/users_guide_historical/CFS_DS_User_Guide_Doc_No_582-2013-001.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nasa/DS/7404b975be4b4a2e2a51eab4c1fa6a9b7a8630c4/docs/users_guide_historical/CFS_DS_User_Guide_Doc_No_582-2013-001.pdf
--------------------------------------------------------------------------------
/fsw/inc/ds_extern_typedefs.h:
--------------------------------------------------------------------------------
1 | /************************************************************************
2 | * NASA Docket No. GSC-18,447-1, and identified as “CFS CFDP (CF)
3 | * Application version 3.0.0”
4 | *
5 | * Copyright (c) 2019 United States Government as represented by the
6 | * Administrator of the National Aeronautics and Space Administration.
7 | * All Rights Reserved.
8 | *
9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
10 | * not use this file except in compliance with the License. You may obtain
11 | * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | ************************************************************************/
19 |
20 | /**
21 | * @file
22 | *
23 | * Declarations and prototypes for ds_extern_typedefs module
24 | */
25 |
26 | #ifndef DS_EXTERN_TYPEDEFS_H
27 | #define DS_EXTERN_TYPEDEFS_H
28 |
29 | #include
30 |
31 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
32 | /* */
33 | /* DS common application macro definitions */
34 | /* */
35 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
36 |
37 | #define DS_UNUSED 0 /**< \brief Unused entries in DS tables */
38 | #define DS_DISABLED 0 /**< \brief Enable/disable state selection */
39 | #define DS_ENABLED 1 /**< \brief Enable/disable state selection */
40 |
41 | #define DS_BY_TIME 2 /**< \brief Action is based on packet timestamp */
42 |
43 | #define DS_BY_COUNT 1 /**< \brief Action is based on packet sequence count */
44 | #define DS_EMPTY_STRING "" /**< \brief Empty string buffer entries in DS tables */
45 |
46 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
47 | /* */
48 | /* DS application table structures */
49 | /* */
50 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
51 |
52 | /** \brief DS Packet Filter Parameters */
53 | typedef struct
54 | {
55 | uint8 FileTableIndex; /**< \brief Index into Destination File Table */
56 | uint8 FilterType; /**< \brief Filter type (packet count or time) */
57 |
58 | uint16 Algorithm_N; /**< \brief Algorithm value N (pass this many) */
59 | uint16 Algorithm_X; /**< \brief Algorithm value X (out of this many) */
60 | uint16 Algorithm_O; /**< \brief Algorithm value O (at this offset) */
61 | } DS_FilterParms_t;
62 |
63 | /** \brief DS Filter Table Packet Entry */
64 | typedef struct
65 | {
66 | CFE_SB_MsgId_t MessageID; /**< \brief Packet MessageID (may be cmd or tlm) */
67 |
68 | DS_FilterParms_t Filter[DS_FILTERS_PER_PACKET]; /**< \brief One entry for each packet destination */
69 | } DS_PacketEntry_t;
70 |
71 | /** \brief DS Filter Table */
72 | typedef struct
73 | {
74 | char Descriptor[DS_DESCRIPTOR_BUFSIZE]; /**< \brief Description such as "Safehold Filter Table" */
75 | DS_PacketEntry_t Packet[DS_PACKETS_IN_FILTER_TABLE]; /**< \brief One entry for each filtered packet */
76 | } DS_FilterTable_t;
77 |
78 | /**
79 | * \brief DS Destination File Table Entry
80 | *
81 | * Note that the sum of the string buffer sizes exceeds the max for a qualified filename (OS_MAX_PATH_LEN).
82 | * This allows a variable definition of how many characters may be used in the pathname versus the filename.
83 | * The qualified filename length will be verified at run-time as each filename is created.
84 | */
85 | typedef struct
86 | {
87 | char Movename[DS_PATHNAME_BUFSIZE]; /**< \brief Move files to this dir after close */
88 | char Pathname[DS_PATHNAME_BUFSIZE]; /**< \brief Path portion of filename */
89 | char Basename[DS_BASENAME_BUFSIZE]; /**< \brief Base portion of filename */
90 | char Extension[DS_EXTENSION_BUFSIZE]; /**< \brief Extension portion of filename */
91 |
92 | uint16 FileNameType; /**< \brief Filename type - count vs time */
93 | uint16 EnableState; /**< \brief File enable/disable state */
94 |
95 | uint32 MaxFileSize; /**< \brief Max file size (bytes) */
96 | uint32 MaxFileAge; /**< \brief Max file age (seconds) */
97 |
98 | uint32 SequenceCount; /**< \brief Sequence count portion of filename */
99 | } DS_DestFileEntry_t;
100 |
101 | /** \brief DS Destination File Table */
102 | typedef struct
103 | {
104 | char Descriptor[DS_DESCRIPTOR_BUFSIZE]; /**< \brief Description such as "HK Telemetry File" */
105 | DS_DestFileEntry_t File[DS_DEST_FILE_CNT]; /**< \brief One entry for each destination data file */
106 | } DS_DestFileTable_t;
107 |
108 | #endif /* DS_EXTERN_TYPEDEFS_H */
109 |
--------------------------------------------------------------------------------
/fsw/inc/ds_msg.h:
--------------------------------------------------------------------------------
1 | /************************************************************************
2 | * NASA Docket No. GSC-18,917-1, and identified as “CFS Data Storage
3 | * (DS) application version 2.6.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 Data Storage (DS) Message Definitions
23 | */
24 | #ifndef DS_MSG_H
25 | #define DS_MSG_H
26 |
27 | #include
28 | #include
29 |
30 | /**
31 | * \defgroup cfsdscmdstructs CFS Data Storage Command Structures
32 | * \{
33 | */
34 |
35 | /**
36 | * \brief Send HK Request
37 | */
38 | typedef struct
39 | {
40 | CFE_MSG_CommandHeader_t CommandHeader; /**< \brief cFE Software Bus command message header */
41 | } DS_SendHkCmd_t;
42 |
43 | /**
44 | * \brief No-Operation Command
45 | *
46 | * For command details see #DS_NOOP_CC
47 | */
48 | typedef struct
49 | {
50 | CFE_MSG_CommandHeader_t CommandHeader; /**< \brief cFE Software Bus command message header */
51 | } DS_NoopCmd_t;
52 |
53 | /**
54 | * \brief Reset Housekeeping Telemetry Command
55 | *
56 | * For command details see #DS_RESET_COUNTERS_CC
57 | */
58 | typedef struct
59 | {
60 | CFE_MSG_CommandHeader_t CommandHeader; /**< \brief cFE Software Bus command message header */
61 | } DS_ResetCountersCmd_t;
62 |
63 | /**
64 | * \brief Payload containing Ena/Dis State
65 | *
66 | * Used with #DS_AppStateCmd_t
67 | */
68 | typedef struct
69 | {
70 | uint16 EnableState; /**< \brief Application enable/disable state */
71 | uint16 Padding; /**< \brief Structure Padding on 32-bit boundaries */
72 | } DS_AppState_Payload_t;
73 |
74 | /**
75 | * \brief Set Ena/Dis State For DS Application
76 | *
77 | * For command details see #DS_SET_APP_STATE_CC
78 | */
79 | typedef struct
80 | {
81 | CFE_MSG_CommandHeader_t CommandHeader; /**< \brief cFE Software Bus command message header */
82 |
83 | DS_AppState_Payload_t Payload;
84 | } DS_AppStateCmd_t;
85 |
86 | /**
87 | * \brief Set File Selection Payload
88 | *
89 | * Used with #DS_FilterFileCmd_t
90 | */
91 | typedef struct
92 | {
93 | CFE_SB_MsgId_t MessageID; /**< \brief Message ID of existing entry in Packet Filter Table
94 | \details DS defines Message ID zero to be unused */
95 | uint16 FilterParmsIndex; /**< \brief Index into Filter Parms Array */
96 | uint16 FileTableIndex; /**< \brief Index into Destination File Table */
97 | } DS_FilterFile_Payload_t;
98 |
99 | /**
100 | * \brief Set File Selection For Packet Filter Table Entry
101 | *
102 | * For command details see #DS_SET_FILTER_FILE_CC
103 | */
104 | typedef struct
105 | {
106 | CFE_MSG_CommandHeader_t CommandHeader; /**< \brief cFE Software Bus command message header */
107 |
108 | DS_FilterFile_Payload_t Payload;
109 | } DS_FilterFileCmd_t;
110 |
111 | /**
112 | * \brief Set Filter Type Payload
113 | *
114 | * Used with #DS_FilterTypeCmd_t
115 | */
116 | typedef struct
117 | {
118 | CFE_SB_MsgId_t MessageID; /**< \brief Message ID of existing entry in Packet Filter Table
119 | \details DS defines Message ID zero to be unused */
120 | uint16 FilterParmsIndex; /**< \brief Index into Filter Parms Array */
121 | uint16 FilterType; /**< \brief Filter type (packet count or time) */
122 | } DS_FilterType_Payload_t;
123 |
124 | /**
125 | * \brief Set Filter Type For Packet Filter Table Entry
126 | *
127 | * For command details see #DS_SET_FILTER_TYPE_CC
128 | */
129 | typedef struct
130 | {
131 | CFE_MSG_CommandHeader_t CommandHeader; /**< \brief cFE Software Bus command message header */
132 |
133 | DS_FilterType_Payload_t Payload;
134 | } DS_FilterTypeCmd_t;
135 |
136 | /**
137 | * \brief Set Filter Parameters Payload
138 | *
139 | * Used with #DS_FilterParmsCmd_t
140 | */
141 | typedef struct
142 | {
143 | CFE_SB_MsgId_t MessageID; /**< \brief Message ID of existing entry in Packet Filter Table
144 | \details DS defines Message ID zero to be unused */
145 | uint16 FilterParmsIndex; /**< \brief Index into Filter Parms Array */
146 | uint16 Algorithm_N; /**< \brief Algorithm value N (pass this many) */
147 | uint16 Algorithm_X; /**< \brief Algorithm value X (out of this many) */
148 | uint16 Algorithm_O; /**< \brief Algorithm value O (at this offset) */
149 | } DS_FilterParms_Payload_t;
150 |
151 | /**
152 | * \brief Set Filter Parameters For Packet Filter Table Entry
153 | *
154 | * For command details see #DS_SET_FILTER_PARMS_CC
155 | */
156 | typedef struct
157 | {
158 | CFE_MSG_CommandHeader_t CommandHeader; /**< \brief cFE Software Bus command message header */
159 |
160 | DS_FilterParms_Payload_t Payload;
161 | } DS_FilterParmsCmd_t;
162 |
163 | /**
164 | * \brief Set Filename Type Payload
165 | *
166 | * Used with #DS_DestTypeCmd_t
167 | */
168 | typedef struct
169 | {
170 | uint16 FileTableIndex; /**< \brief Index into Destination File Table */
171 | uint16 FileNameType; /**< \brief Filename type - count vs time */
172 | } DS_DestType_Payload_t;
173 |
174 | /**
175 | * \brief Set Filename Type For Destination File Table Entry
176 | *
177 | * For command details see #DS_SET_DEST_TYPE_CC
178 | */
179 | typedef struct
180 | {
181 | CFE_MSG_CommandHeader_t CommandHeader; /**< \brief cFE Software Bus command message header */
182 |
183 | DS_DestType_Payload_t Payload;
184 | } DS_DestTypeCmd_t;
185 |
186 | /**
187 | * \brief Set Ena/Dis State For Destination File Table Entry
188 | * \brief Set Filename Type Payload
189 | *
190 | * Used with #DS_DestTypeCmd_t
191 | *
192 | * For command details see #DS_SET_DEST_STATE_CC
193 | */
194 | typedef struct
195 | {
196 | uint16 FileTableIndex; /**< \brief Index into Destination File Table */
197 | uint16 EnableState; /**< \brief File enable/disable state */
198 | } DS_DestState_Payload_t;
199 |
200 | /**
201 | * \brief Set Ena/Dis State For Destination File Table Entry
202 | *
203 | * For command details see #DS_SET_DEST_STATE_CC
204 | */
205 | typedef struct
206 | {
207 | CFE_MSG_CommandHeader_t CommandHeader; /**< \brief cFE Software Bus command message header */
208 |
209 | DS_DestState_Payload_t Payload;
210 | } DS_DestStateCmd_t;
211 |
212 | /**
213 | * \brief Set Path Portion Of Filename For Destination File Payload
214 | *
215 | * Used with #DS_DestPathCmd_t
216 | */
217 | typedef struct
218 | {
219 | uint16 FileTableIndex; /**< \brief Index into Destination File Table */
220 | uint16 Padding; /**< \brief Structure Padding on 32-bit boundaries */
221 | char Pathname[DS_PATHNAME_BUFSIZE]; /**< \brief Path portion of filename */
222 | } DS_DestPath_Payload_t;
223 |
224 | /**
225 | * \brief Set Path Portion Of Filename For Destination File Table Entry
226 | *
227 | * For command details see #DS_SET_DEST_PATH_CC
228 | */
229 | typedef struct
230 | {
231 | CFE_MSG_CommandHeader_t CommandHeader; /**< \brief cFE Software Bus command message header */
232 |
233 | DS_DestPath_Payload_t Payload;
234 | } DS_DestPathCmd_t;
235 |
236 | /**
237 | * \brief Set Base Portion Of Filename For Destination File Payload
238 | *
239 | * Used with #DS_DestBaseCmd_t
240 | */
241 | typedef struct
242 | {
243 | uint16 FileTableIndex; /**< \brief Index into Destination File Table */
244 | uint16 Padding; /**< \brief Structure Padding on 32-bit boundaries */
245 | char Basename[DS_BASENAME_BUFSIZE]; /**< \brief Base portion of filename */
246 | } DS_DestBase_Payload_t;
247 |
248 | /**
249 | * \brief Set Base Portion Of Filename For Destination File Table Entry
250 | *
251 | * For command details see #DS_SET_DEST_BASE_CC
252 | */
253 | typedef struct
254 | {
255 | CFE_MSG_CommandHeader_t CommandHeader; /**< \brief cFE Software Bus command message header */
256 |
257 | DS_DestBase_Payload_t Payload;
258 | } DS_DestBaseCmd_t;
259 |
260 | /**
261 | * \brief Set Extension Portion Of Filename For Destination File Payload
262 | *
263 | * Used with #DS_DestExtCmd_t
264 | */
265 | typedef struct
266 | {
267 | uint16 FileTableIndex; /**< \brief Index into Destination File Table */
268 | uint16 Padding; /**< \brief Structure Padding on 32-bit boundaries */
269 | char Extension[DS_EXTENSION_BUFSIZE]; /**< \brief Extension portion of filename */
270 | } DS_DestExt_Payload_t;
271 |
272 | /**
273 | * \brief Set Extension Portion Of Filename For Destination File Table Entry
274 | *
275 | * For command details see #DS_SET_DEST_EXT_CC
276 | */
277 | typedef struct
278 | {
279 | CFE_MSG_CommandHeader_t CommandHeader; /**< \brief cFE Software Bus command message header */
280 |
281 | DS_DestExt_Payload_t Payload;
282 | } DS_DestExtCmd_t;
283 |
284 | /**
285 | * \brief Set Max File Size For Destination File Table Payload
286 | *
287 | * Used with #DS_DestSizeCmd_t
288 | *
289 | * For command details see #DS_SET_DEST_SIZE_CC
290 | */
291 | typedef struct
292 | {
293 | uint16 FileTableIndex; /**< \brief Index into Destination File Table */
294 | uint16 Padding; /**< \brief Structure Padding on 32-bit boundaries */
295 | uint32 MaxFileSize; /**< \brief Max file size (bytes) before re-open */
296 | } DS_DestSize_Payload_t;
297 |
298 | /**
299 | * \brief Set Max File Size For Destination File Table Entry
300 | *
301 | * For command details see #DS_SET_DEST_SIZE_CC
302 | */
303 | typedef struct
304 | {
305 | CFE_MSG_CommandHeader_t CommandHeader; /**< \brief cFE Software Bus command message header */
306 |
307 | DS_DestSize_Payload_t Payload;
308 | } DS_DestSizeCmd_t;
309 |
310 | /**
311 | * \brief Set Max File Age For Destination File Table Payload
312 | *
313 | * Used with #DS_DestAgeCmd_t
314 | */
315 | typedef struct
316 | {
317 | uint16 FileTableIndex; /**< \brief Index into Destination File Table */
318 | uint16 Padding; /**< \brief Structure Padding on 32-bit boundaries */
319 |
320 | uint32 MaxFileAge; /**< \brief Max file age (seconds) */
321 | } DS_DestAge_Payload_t;
322 |
323 | /**
324 | * \brief Set Max File Age For Destination File Table Entry
325 | *
326 | * For command details see #DS_SET_DEST_AGE_CC
327 | */
328 | typedef struct
329 | {
330 | CFE_MSG_CommandHeader_t CommandHeader; /**< \brief cFE Software Bus command message header */
331 |
332 | DS_DestAge_Payload_t Payload;
333 | } DS_DestAgeCmd_t;
334 |
335 | /**
336 | * \brief Set Sequence Portion Of Filename For Destination File Table Payload
337 | *
338 | * Used with #DS_DestCountCmd_t
339 | */
340 | typedef struct
341 | {
342 | uint16 FileTableIndex; /**< \brief Index into Destination File Table */
343 | uint16 Padding; /**< \brief Structure Padding on 32-bit boundaries */
344 |
345 | uint32 SequenceCount; /**< \brief Sequence count portion of filename */
346 | } DS_DestCount_Payload_t;
347 |
348 | /**
349 | * \brief Set Sequence Portion Of Filename For Destination File Table Entry
350 | *
351 | * For command details see #DS_SET_DEST_COUNT_CC
352 | */
353 | typedef struct
354 | {
355 | CFE_MSG_CommandHeader_t CommandHeader; /**< \brief cFE Software Bus command message header */
356 |
357 | DS_DestCount_Payload_t Payload;
358 | } DS_DestCountCmd_t;
359 |
360 | /**
361 | * \brief Close Destination File Payload
362 | *
363 | * Used with #DS_CloseFileCmd_t
364 | */
365 | typedef struct
366 | {
367 | uint16 FileTableIndex; /**< \brief Index into Destination File Table */
368 | uint16 Padding; /**< \brief Structure Padding on 32-bit boundaries */
369 | } DS_CloseFile_Payload_t;
370 |
371 | /**
372 | * \brief Close Destination File
373 | *
374 | * For command details see #DS_CLOSE_FILE_CC
375 | */
376 | typedef struct
377 | {
378 | CFE_MSG_CommandHeader_t CommandHeader; /**< \brief cFE Software Bus command message header */
379 |
380 | DS_CloseFile_Payload_t Payload;
381 | } DS_CloseFileCmd_t;
382 |
383 | /**
384 | * \brief Close All Destination Files
385 | *
386 | * For command details see #DS_CLOSE_ALL_CC
387 | */
388 | typedef struct
389 | {
390 | CFE_MSG_CommandHeader_t CommandHeader; /**< \brief cFE Software Bus command message header */
391 | } DS_CloseAllCmd_t;
392 |
393 | /**
394 | * \brief Get File Info Command
395 | *
396 | * For command details see #DS_GET_FILE_INFO_CC
397 | */
398 | typedef struct
399 | {
400 | CFE_MSG_CommandHeader_t CommandHeader; /**< \brief cFE Software Bus command message header */
401 | } DS_GetFileInfoCmd_t;
402 |
403 | /**
404 | * \brief Message ID Payload
405 | *
406 | * Used with #DS_AddMidCmd_t, #DS_RemoveMidCmd_t
407 | */
408 | typedef struct
409 | {
410 | CFE_SB_MsgId_t MessageID; /**< \brief Message ID to add to Packet Filter Table */
411 | } DS_AddRemoveMid_Payload_t;
412 |
413 | /**
414 | * \brief Add Message ID To Packet Filter Table
415 | *
416 | * For command details see #DS_ADD_MID_CC
417 | */
418 | typedef struct
419 | {
420 | CFE_MSG_CommandHeader_t CommandHeader; /**< \brief cFE Software Bus command message header */
421 |
422 | DS_AddRemoveMid_Payload_t Payload;
423 | } DS_AddMidCmd_t;
424 |
425 | /**
426 | * \brief Remove Message ID from Packet Filter Table
427 | *
428 | * For command details see #DS_REMOVE_MID_CC
429 | */
430 | typedef struct
431 | {
432 | CFE_MSG_CommandHeader_t CommandHeader; /**< \brief cFE Software Bus command message header */
433 |
434 | DS_AddRemoveMid_Payload_t Payload;
435 | } DS_RemoveMidCmd_t;
436 |
437 | /**\}*/
438 |
439 | /**
440 | * \defgroup cfsdstlm CFS Data Storage Telemetry
441 | * \{
442 | */
443 |
444 | typedef struct
445 | {
446 | uint8 CmdAcceptedCounter; /**< \brief Count of valid commands received */
447 | uint8 CmdRejectedCounter; /**< \brief Count of invalid commands received */
448 | uint8 DestTblLoadCounter; /**< \brief Count of destination file table loads */
449 | uint8 DestTblErrCounter; /**< \brief Count of failed attempts to get table data pointer */
450 | uint8 FilterTblLoadCounter; /**< \brief Count of packet filter table loads */
451 | uint8 FilterTblErrCounter; /**< \brief Count of failed attempts to get table data pointer */
452 | uint8 AppEnableState; /**< \brief Application enable/disable state */
453 | uint8 Spare8; /**< \brief Structure alignment padding */
454 | uint16 FileWriteCounter; /**< \brief Count of good destination file writes */
455 | uint16 FileWriteErrCounter; /**< \brief Count of bad destination file writes */
456 | uint16 FileUpdateCounter; /**< \brief Count of good updates to secondary header */
457 | uint16 FileUpdateErrCounter; /**< \brief Count of bad updates to secondary header */
458 | uint32 DisabledPktCounter; /**< \brief Count of packets discarded (DS was disabled) */
459 | uint32 IgnoredPktCounter; /**< \brief Count of packets discarded
460 | *
461 | * Incoming packets will be discarded when:
462 | * - The File and/or Filter Table has failed to load
463 | * - A packet (that is not a DS HK or command packet) has been received
464 | * that is not listed in the Filter Table
465 | */
466 | uint32 FilteredPktCounter; /**< \brief Count of packets discarded (failed filter test) */
467 | uint32 PassedPktCounter; /**< \brief Count of packets that passed filter test */
468 | char FilterTblFilename[OS_MAX_PATH_LEN]; /**< \brief Name of filter table file */
469 | } DS_HkTlm_Payload_t;
470 |
471 | /**
472 | * \brief Application housekeeping packet
473 | */
474 | typedef struct
475 | {
476 | CFE_MSG_TelemetryHeader_t TelemetryHeader; /**< \brief cFE Software Bus telemetry message header */
477 |
478 | DS_HkTlm_Payload_t Payload;
479 | } DS_HkPacket_t;
480 |
481 | /**
482 | * \brief Current state of destination files
483 | */
484 | typedef struct
485 | {
486 | uint32 FileAge; /**< \brief Current file age in seconds */
487 | uint32 FileSize; /**< \brief Current file size in bytes */
488 | uint32 FileRate; /**< \brief Current file data rate (avg since HK) */
489 | uint32 SequenceCount; /**< \brief Sequence count portion of filename */
490 | uint16 EnableState; /**< \brief Current file enable/disable state */
491 | uint16 OpenState; /**< \brief Current file open/close state */
492 | char FileName[DS_TOTAL_FNAME_BUFSIZE]; /**< \brief Current filename (path+base+seq+ext) */
493 | } DS_FileInfo_t;
494 |
495 | /**
496 | * \brief Application file info packet
497 | */
498 | typedef struct
499 | {
500 | CFE_MSG_TelemetryHeader_t TelemetryHeader; /**< \brief cFE Software Bus telemetry message header */
501 |
502 | DS_FileInfo_t Payload[DS_DEST_FILE_CNT]; /**< \brief Current state of destination files */
503 | } DS_FileInfoPkt_t;
504 |
505 | /**
506 | * \brief Single application file info packet
507 | */
508 | typedef struct
509 | {
510 | CFE_MSG_TelemetryHeader_t TelemetryHeader; /**< \brief cFE Software Bus telemetry message header */
511 |
512 | DS_FileInfo_t Payload; /**< \brief Current state of destination file */
513 | } DS_FileCompletePkt_t;
514 |
515 | /**
516 | * \brief Single application file info packet buffer
517 | *
518 | * This typedef supports CFE_SB_AllocateMessageBuffer use with a DS_FileCompletePkt_t
519 | * that compiles with the alignment constraints of a CFE_SB_Buffer_t
520 | */
521 | typedef union
522 | {
523 | CFE_SB_Buffer_t SBBuf; /**< \brief Message buffer for alignment */
524 | DS_FileCompletePkt_t Pkt; /**< \brief Single application file info packet */
525 | } DS_FileCompletePktBuf_t;
526 |
527 | /**\}*/
528 |
529 | #endif
530 |
--------------------------------------------------------------------------------
/fsw/inc/ds_msgids.h:
--------------------------------------------------------------------------------
1 | /************************************************************************
2 | * NASA Docket No. GSC-18,917-1, and identified as “CFS Data Storage
3 | * (DS) application version 2.6.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 Data Storage (DS) Application Message IDs header file
23 | */
24 | #ifndef DS_MSGIDS_H
25 | #define DS_MSGIDS_H
26 |
27 | /**
28 | * \defgroup cfsdscmdmid CFS Data Storage Message IDs
29 | * \{
30 | */
31 |
32 | #define DS_CMD_MID 0x18BB /**< \brief DS Ground Commands Message ID */
33 | #define DS_SEND_HK_MID 0x18BC /**< \brief DS Send Hk Data Cmd Message ID*/
34 |
35 | /**\}*/
36 |
37 | /**
38 | * \defgroup cfsdstlmmid CFS Data Storage Message IDs
39 | * \{
40 | */
41 |
42 | #define DS_HK_TLM_MID 0x08B8 /**< \brief DS Hk Telemetry Message ID ****/
43 | #define DS_DIAG_TLM_MID 0x08B9 /**< \brief DS File Info Telemetry Message ID ****/
44 | #define DS_COMP_TLM_MID 0x08BA /**< \brief DS Completed File Info Telemetry Message ID ****/
45 |
46 | /**\}*/
47 |
48 | #endif
49 |
--------------------------------------------------------------------------------
/fsw/inc/ds_perfids.h:
--------------------------------------------------------------------------------
1 | /************************************************************************
2 | * NASA Docket No. GSC-18,917-1, and identified as “CFS Data Storage
3 | * (DS) application version 2.6.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 | * Define DS Performance IDs
23 | */
24 | #ifndef DS_PERFIDS_H
25 | #define DS_PERFIDS_H
26 |
27 | /**
28 | * \defgroup cfsdsmissioncfg CFS Data Storage Mission Configuration
29 | * \{
30 | */
31 |
32 | #define DS_APPMAIN_PERF_ID 38 /**< \brief Main application performance ID */
33 |
34 | /**\}*/
35 |
36 | #endif
37 |
--------------------------------------------------------------------------------
/fsw/inc/ds_platform_cfg.h:
--------------------------------------------------------------------------------
1 | /************************************************************************
2 | * NASA Docket No. GSC-18,917-1, and identified as “CFS Data Storage
3 | * (DS) application version 2.6.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 Data Storage (DS) Application platform configuration header file
23 | */
24 | #ifndef DS_PLATFORM_CFG_H
25 | #define DS_PLATFORM_CFG_H
26 |
27 | /**
28 | * \defgroup cfsdsplatformcfg CFS Data Storage Platform Configuration
29 | * \{
30 | */
31 |
32 | /**
33 | * \brief Destination File Table -- logical table name
34 | *
35 | * \par Description:
36 | * This parameter defines the name of the DS Destination File
37 | * Table when referenced via cFE Table Services. Note that this
38 | * parameter is not a filename, it is the table specific portion
39 | * of the logical name. The entire logical name for this table
40 | * is "DS.FILE_TBL".
41 | *
42 | * \par Limits:
43 | * The string length (including string terminator) cannot exceed
44 | * #CFE_MISSION_TBL_MAX_NAME_LENGTH. (limit is not verified)
45 | */
46 | #define DS_DESTINATION_TBL_NAME "FILE_TBL"
47 |
48 | /**
49 | * \brief Destination File Table -- default table filename
50 | *
51 | * \par Description:
52 | * This parameter defines the default filename for the
53 | * Destination 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 DS_DEF_DEST_FILENAME "/cf/ds_file_tbl.tbl"
60 |
61 | /**
62 | * \brief Destination File Table -- number of files
63 | *
64 | * \par Description:
65 | * This parameter defines the size of the DS Destination File
66 | * Table by setting the number of file entries in the table. The
67 | * number should be large enough to provide an entry for all the
68 | * destination files defined for the project. Maintenance will
69 | * be simplified if file index 'n' always describes the same
70 | * file - even if that file is not in use at the present time.
71 | *
72 | * \par Limits:
73 | * The number must be greater than zero but there is no upper
74 | * enforced limit for this parameter.
75 | */
76 | #define DS_DEST_FILE_CNT 16
77 |
78 | /**
79 | * \brief Destination File Table -- pathname buffer size
80 | *
81 | * \par Description:
82 | * This parameter further defines the size of the Destination
83 | * File Table by setting the size of the pathname buffer for
84 | * each file entry. Note that the buffer must contain both
85 | * the string and the string terminator - so the max string
86 | * length is one less than the buffer size.
87 | *
88 | * \par Limits:
89 | * The buffer size must be greater than zero and a multiple
90 | * of four bytes for alignment. The value cannot exceed the
91 | * maximum filename size allowed by the OS (#OS_MAX_PATH_LEN).
92 | */
93 | #define DS_PATHNAME_BUFSIZE OS_MAX_PATH_LEN
94 |
95 | /**
96 | * \brief Destination File Table -- basename buffer size
97 | *
98 | * \par Description:
99 | * This parameter further defines the size of the Destination
100 | * File Table by setting the size of the basename buffer for
101 | * each file entry. Note that the buffer must contain both
102 | * the string and the string terminator - so the max string
103 | * length is one less than the buffer size.
104 | *
105 | * \par Limits:
106 | * The buffer size must be greater than zero and a multiple
107 | * of four bytes for alignment. The value cannot exceed the
108 | * maximum filename size allowed by the OS (#OS_MAX_PATH_LEN).
109 | */
110 | #define DS_BASENAME_BUFSIZE OS_MAX_PATH_LEN
111 |
112 | /**
113 | * \brief Destination File Table -- extension buffer size
114 | *
115 | * \par Description:
116 | * This parameter further defines the size of the Destination
117 | * File Table by setting the size of the extension buffer for
118 | * each file entry. Note that the buffer must contain both
119 | * the string and the string terminator - so the max string
120 | * length is one less than the buffer size.
121 | *
122 | * \par Limits:
123 | * The buffer size must be greater than zero and a multiple
124 | * of four bytes for alignment. The value cannot exceed the
125 | * maximum filename size allowed by the OS (#OS_MAX_PATH_LEN).
126 | */
127 | #define DS_EXTENSION_BUFSIZE 8
128 |
129 | /**
130 | * \brief Packet Filter Table -- logical table name
131 | *
132 | * \par Description:
133 | * This parameter defines the name of the DS Packet Filter Table
134 | * when referenced via cFE Table Services. Note that this
135 | * parameter is not a filename, it is the table specific portion
136 | * of the logical name. The entire logical name for this table
137 | * is "DS.FILTER_TBL".
138 | *
139 | * \par Limits:
140 | * The string length (including string terminator) cannot exceed
141 | * #CFE_MISSION_TBL_MAX_NAME_LENGTH. (limit is not verified)
142 | */
143 | #define DS_FILTER_TBL_NAME "FILTER_TBL"
144 |
145 | /**
146 | * \brief Packet Filter Table -- default table filename
147 | *
148 | * \par Description:
149 | * This parameter defines the default filename for the
150 | * Packet Filter Table.
151 | *
152 | * \par Limits:
153 | * The string length (including string terminator) cannot exceed
154 | * #OS_MAX_PATH_LEN. (limit is not verified)
155 | */
156 | #define DS_DEF_FILTER_FILENAME "/cf/ds_filter_tbl.tbl"
157 |
158 | /**
159 | * \brief Packet Filter Table -- number of packets
160 | *
161 | * \par Description:
162 | * This parameter defines the size of the DS Packet Filter Table
163 | * by setting the number of packet entries in the table. The
164 | * number should be large enough to provide an entry for each
165 | * command and telemetry packet subject to data storage.
166 | *
167 | * \par Limits:
168 | * The number must be greater than zero but there is no upper
169 | * enforced limit for this parameter. However, setting the
170 | * size equal to the number of packets that might be subject
171 | * to data storage, rather than the total number of packets
172 | * defined for this project, will reduce the table file size,
173 | * possibly significantly.
174 | */
175 | #define DS_PACKETS_IN_FILTER_TABLE 256
176 |
177 | /**
178 | * \brief Packet Filter Table -- filters per packet
179 | *
180 | * \par Description:
181 | * This parameter further defines the size of the DS Packet
182 | * Filter Table by setting the number of filters per packet
183 | * entry. This is the maximum number of destination files
184 | * to which a single packet can be written (at one time).
185 | *
186 | * \par Limits:
187 | * The number of filters per packet must be greater than zero
188 | * and not greater than #DS_DEST_FILE_CNT.
189 | */
190 | #define DS_FILTERS_PER_PACKET 4
191 |
192 | /**
193 | * \brief Common Table File -- descriptor text buffer size
194 | *
195 | * \par Description:
196 | * This parameter defines the size of the Descriptor Text
197 | * fields in both the Destination File Table and the Packet
198 | * Filter Table. The buffer includes the string terminator.
199 | *
200 | * \par Limits:
201 | * The buffer size must be greater than zero and a multiple
202 | * of four bytes for alignment. There is no upper limit.
203 | */
204 | #define DS_DESCRIPTOR_BUFSIZE 32
205 |
206 | /**
207 | * \brief Filename Sequence Count -- number of digits
208 | *
209 | * \par Description:
210 | * This parameter defines the number of filename sequence
211 | * count digits used when the filename type has been set to
212 | * "count" rather than "time". Sequence counts are padded
213 | * with leading zero's to create fixed length strings.
214 | *
215 | * \par Limits:
216 | * The number of sequence count digits must be greater than
217 | * zero - even if there is no intention of later setting
218 | * the filename type to "count". This value should match
219 | * the definition for #DS_MAX_SEQUENCE_COUNT, below.
220 | */
221 | #define DS_SEQUENCE_DIGITS 8
222 |
223 | /**
224 | * \brief Filename Sequence Count -- max counter value
225 | *
226 | * \par Description:
227 | * This parameter defines the maximum value a file sequence
228 | * count will reach before rollover.
229 | *
230 | * \par Limits:
231 | * The value must be greater than zero and should not have
232 | * more digits than the number of sequence count digits
233 | * defined for #DS_SEQUENCE_DIGITS, above.
234 | */
235 | #define DS_MAX_SEQUENCE_COUNT 99999999
236 |
237 | /**
238 | * \brief Data Storage File -- total filename size
239 | *
240 | * \par Description:
241 | * This parameter defines the maximum size of a filename after
242 | * combining the pathname, basename, sequence and extension.
243 | *
244 | * \par Limits:
245 | * The buffer size must be greater than zero and a multiple
246 | * of four bytes for alignment. The buffer size (including
247 | * string terminator) cannot exceed #OS_MAX_PATH_LEN.
248 | */
249 | #define DS_TOTAL_FNAME_BUFSIZE OS_MAX_PATH_LEN
250 |
251 | /**
252 | * \brief Data Storage File -- cFE file header sub-type
253 | *
254 | * \par Description:
255 | * This parameter defines a mission-specific value that is used
256 | * to identify a Data Storage file.
257 | *
258 | * \par Limits:
259 | * The file header data type for the value is 32 bits unsigned,
260 | * thus the value can be anything from zero to 4,294,967,295.
261 | * (limit is not verified)
262 | */
263 | #define DS_FILE_HDR_SUBTYPE 0x2710
264 |
265 | /**
266 | * \brief Data Storage File -- cFE file header description
267 | *
268 | * \par Description:
269 | * This parameter defines a mission-specific text string that
270 | * may be used to identify Data Storage files.
271 | *
272 | * \par Limits:
273 | * The string length (including string terminator) cannot exceed
274 | * #CFE_FS_HDR_DESC_MAX_LEN. (limit is not verified)
275 | */
276 | #define DS_FILE_HDR_DESCRIPTION "DS data storage file"
277 |
278 | /**
279 | * \brief Data Storage File -- minimum size limit
280 | *
281 | * \par Description:
282 | * This parameter defines the lower limit for commands and
283 | * table entries that define the size (in bytes) when a data
284 | * storage file is automatically closed.
285 | *
286 | * \par Limits:
287 | * None -- however, the user should be cautioned that a very
288 | * small value will allow a size limit that closes files too
289 | * frequently, while a very large value will effectively
290 | * prevent files from ever being closed due to size.
291 | */
292 | #define DS_FILE_MIN_SIZE_LIMIT 1024
293 |
294 | /**
295 | * \brief Data Storage File -- minimum age limit
296 | *
297 | * \par Description:
298 | * This parameter defines the lower limit for commands and
299 | * table entries that define the age (in seconds) when a data
300 | * storage file is automatically closed.
301 | *
302 | * \par Limits:
303 | * None -- however, the user should be cautioned that a very
304 | * small value will allow an age limit that closes files too
305 | * frequently, while a very large value will effectively
306 | * prevent files from ever being closed due to age.
307 | */
308 | #define DS_FILE_MIN_AGE_LIMIT 60
309 |
310 | /**
311 | * \brief Application Pipe Name
312 | *
313 | * \par Description:
314 | * This parameter defines a portion of the logical name used
315 | * during the creation of the DS input pipe. The logical name
316 | * may also be used as an identifier when accessing status for
317 | * the pipe via cFE Software Bus Services. The entire logical
318 | * name is "DS.DS_CMD_PIPE".
319 | *
320 | * \par Limits:
321 | * The string length (including string terminator) cannot
322 | * exceed #OS_MAX_API_NAME. (limit is not verified)
323 | */
324 | #define DS_APP_PIPE_NAME "DS_CMD_PIPE"
325 |
326 | /**
327 | * \brief Application Pipe Depth
328 | *
329 | * \par Description:
330 | * This parameter defines the depth of the DS input pipe. The
331 | * depth should be deep enough to accommodate all of the DS
332 | * command packets and all of the subscribed telemetry packets
333 | * that might be generated by applications with a priority
334 | * higher than the DS application.
335 | *
336 | * \par Limits:
337 | * The value must be greater than zero and cannot exceed the
338 | * definition of #OS_QUEUE_MAX_DEPTH
339 | */
340 | #define DS_APP_PIPE_DEPTH 45
341 |
342 | /**
343 | * \brief Make DS Tables Critical
344 | *
345 | * \par Description:
346 | * Set this parameter to a value of one to make the DS tables critical,
347 | * otherwise set to zero.
348 | *
349 | * \par Limits
350 | * This parameter must be set to zero or one.
351 | */
352 | #define DS_MAKE_TABLES_CRITICAL 0
353 |
354 | /**
355 | * \brief Housekeeping Request Frequency
356 | *
357 | * \par Description:
358 | * Set this parameter equal to the number of seconds between
359 | * housekeeping request commands. This number is mission
360 | * specific and must match the frequency used by the source
361 | * of the command - often the scheduler task. The value is
362 | * used by the DS application to measure file age and also
363 | * as a factor in the calculation of file growth rates.
364 | *
365 | * \par Limits
366 | * This parameter must be greater than zero.
367 | */
368 | #define DS_SECS_PER_HK_CYCLE 4
369 |
370 | /**
371 | * \brief Default DS Packet Processor State
372 | *
373 | * \par Description:
374 | * Set this parameter to a value of one and DS will begin to
375 | * process packets immediately on startup. Set the value to
376 | * zero and DS will ignore data storage packets until receipt
377 | * of a valid #DS_SET_APP_STATE_CC command to enable.
378 | *
379 | * \par Limits
380 | * This parameter must be set to zero or one.
381 | */
382 | #define DS_DEF_ENABLE_STATE 1
383 |
384 | /**
385 | * \brief Save DS Packet Processor State in Critical Data Store
386 | *
387 | * \par Description:
388 | * Set this parameter to a value of one and DS will restore
389 | * the previous Packet Processor enable/disable state after
390 | * a processor reset. This setting does not affect the
391 | * Packet Processor enable/disable state set at power-on
392 | * which is controlled by #DS_DEF_ENABLE_STATE. Set the
393 | * value to zero and DS will set the enable/disable state
394 | * as described for #DS_DEF_ENABLE_STATE following any reset.
395 | *
396 | * \par Limits
397 | * This parameter must be set to zero or one.
398 | */
399 | #define DS_CDS_ENABLE_STATE 1
400 |
401 | /** \brief Mission specific version number for DS application
402 | *
403 | * \par Description:
404 | * An application version number consists of four parts:
405 | * major version number, minor version number, revision
406 | * number and mission specific revision number. The mission
407 | * specific revision number is defined here and the other
408 | * parts are defined in "ds_version.h".
409 | *
410 | * \par Limits:
411 | * Must be defined as a numeric value that is greater than
412 | * or equal to zero.
413 | */
414 | #define DS_MISSION_REV 0
415 |
416 | /**
417 | * \brief File Header Type Selection
418 | *
419 | * \par Description:
420 | * Set this parameter to select the type of file header that
421 | * will be the first record written to each Data Storage File.
422 | *
423 | * \par Limits
424 | * This parameter must be set to one of the following:
425 | * 0 = none -- set this value to have no file header
426 | * 1 = CFE -- set this value to use CFE file headers
427 | */
428 | #define DS_FILE_HEADER_TYPE 1
429 |
430 | /**
431 | * \brief Move Files to Downlink Directory After Close Selection
432 | *
433 | * \par Description:
434 | * Set this parameter to enable the code and structures to
435 | * automatically move DS files to another directory after
436 | * closing the files. The intended use for this setting is
437 | * to move files from a working directory into a directory
438 | * from which the files can be downlinked. Note that even
439 | * after enabling this feature, files will not be moved if
440 | * the move pathname in the Destination File Table is null.
441 | *
442 | * \par Limits
443 | * This parameter must be set to one of the following:
444 | * true = add move pathname field to Destination File Table
445 | * false = do not add move pathname to Destination File Table
446 | */
447 | #define DS_MOVE_FILES true
448 |
449 | /**
450 | * \brief Application Per Packet Pipe Limit
451 | *
452 | * \par Description:
453 | * This parameter defines the per packet pipe limit. This is
454 | * the max number of packets with the same Message ID that may
455 | * be in the DS input pipe at any one time. This value should
456 | * be large enough to accommodate a burst of packets (usually
457 | * event packets) plus a suitable margin.
458 | *
459 | * \par Limits:
460 | * The value must be greater than zero and cannot exceed the
461 | * definition of #DS_APP_PIPE_DEPTH.
462 | */
463 | #define DS_PER_PACKET_PIPE_LIMIT 45
464 |
465 | /**\}*/
466 |
467 | #endif
468 |
--------------------------------------------------------------------------------
/fsw/src/ds_app.c:
--------------------------------------------------------------------------------
1 | /************************************************************************
2 | * NASA Docket No. GSC-18,917-1, and identified as “CFS Data Storage
3 | * (DS) application version 2.6.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 Data Storage (DS) Application file containing the application
23 | * initialization routines, the main routine and the command interface.
24 | */
25 |
26 | #include "cfe.h"
27 |
28 | #include "ds_perfids.h"
29 | #include "ds_msgids.h"
30 |
31 | #include "ds_platform_cfg.h"
32 | #include "ds_verify.h"
33 |
34 | #include "ds_appdefs.h"
35 |
36 | #include "ds_msg.h"
37 | #include "ds_app.h"
38 | #include "ds_dispatch.h"
39 | #include "ds_cmds.h"
40 | #include "ds_file.h"
41 | #include "ds_table.h"
42 | #include "ds_events.h"
43 | #include "ds_msgdefs.h"
44 | #include "ds_version.h"
45 |
46 | #include
47 |
48 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
49 | /* */
50 | /* Application global data structure */
51 | /* */
52 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
53 |
54 | DS_AppData_t DS_AppData;
55 |
56 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
57 | /* */
58 | /* Application entry point and main process loop */
59 | /* */
60 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
61 |
62 | void DS_AppMain(void)
63 | {
64 | CFE_SB_Buffer_t *BufPtr = NULL;
65 | int32 Result;
66 | uint32 RunStatus = CFE_ES_RunStatus_APP_RUN;
67 |
68 | /*
69 | ** Performance Log (start time counter)...
70 | */
71 | CFE_ES_PerfLogEntry(DS_APPMAIN_PERF_ID);
72 |
73 | /*
74 | ** Perform application-specific initialization...
75 | */
76 | Result = DS_AppInitialize();
77 |
78 | /*
79 | ** Check for start-up error...
80 | */
81 | if (Result != CFE_SUCCESS)
82 | {
83 | /*
84 | ** Set request to terminate main loop...
85 | */
86 | RunStatus = CFE_ES_RunStatus_APP_ERROR;
87 | }
88 |
89 | /*
90 | ** Main process loop...
91 | */
92 | while (CFE_ES_RunLoop(&RunStatus))
93 | {
94 | /*
95 | ** Performance Log (stop time counter)...
96 | */
97 | CFE_ES_PerfLogExit(DS_APPMAIN_PERF_ID);
98 |
99 | /*
100 | ** Wait for next Software Bus message...
101 | */
102 | Result = CFE_SB_ReceiveBuffer(&BufPtr, DS_AppData.CmdPipe, DS_SB_TIMEOUT);
103 |
104 | /*
105 | ** Performance Log (start time counter)...
106 | */
107 | CFE_ES_PerfLogEntry(DS_APPMAIN_PERF_ID);
108 |
109 | /*
110 | ** Process Software Bus messages...
111 | */
112 | if (Result == CFE_SUCCESS)
113 | {
114 | DS_AppProcessMsg(BufPtr);
115 | }
116 | else if (Result == CFE_SB_TIME_OUT)
117 | {
118 | /*
119 | * Check for table updates. This is usually done during the
120 | * housekeeping cycle, but if housekeeping requests are
121 | * coming at a rate slower than 1Hz, we perform the operations
122 | * here.
123 | */
124 | DS_TableManageDestFile();
125 | DS_TableManageFilter();
126 | }
127 | else
128 | {
129 | /*
130 | ** Set request to terminate main loop...
131 | */
132 | RunStatus = CFE_ES_RunStatus_APP_ERROR;
133 | }
134 |
135 | /*
136 | ** Note: If there were some reason to exit normally
137 | ** (without error) then we would set
138 | ** RunStatus = CFE_ES_APP_EXIT
139 | */
140 | }
141 |
142 | /*
143 | ** Check for "fatal" process error...
144 | */
145 | if (Result != CFE_SUCCESS)
146 | {
147 | /*
148 | ** Send an event describing the reason for the termination...
149 | */
150 | CFE_EVS_SendEvent(DS_EXIT_ERR_EID, CFE_EVS_EventType_CRITICAL, "Application terminating, err = 0x%08X",
151 | (unsigned int)Result);
152 |
153 | /*
154 | ** In case cFE Event Services is not working...
155 | */
156 | CFE_ES_WriteToSysLog("DS application terminating, err = 0x%08X\n", (unsigned int)Result);
157 | }
158 |
159 | /*
160 | ** Performance Log (stop time counter)...
161 | */
162 | CFE_ES_PerfLogExit(DS_APPMAIN_PERF_ID);
163 |
164 | /*
165 | ** Let cFE kill the application (and any child tasks)...
166 | */
167 | CFE_ES_ExitApp(RunStatus);
168 | }
169 |
170 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
171 | /* */
172 | /* Application initialization */
173 | /* */
174 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
175 |
176 | CFE_Status_t DS_AppInitialize(void)
177 | {
178 | CFE_Status_t Result;
179 | int32 i = 0;
180 |
181 | /*
182 | ** Initialize global data structure...
183 | */
184 | memset(&DS_AppData, 0, sizeof(DS_AppData));
185 |
186 | DS_AppData.AppEnableState = DS_DEF_ENABLE_STATE;
187 | DS_AppData.EnableMoveFiles = DS_MOVE_FILES;
188 |
189 | /*
190 | ** Mark files as closed
191 | */
192 | for (i = 0; i < DS_DEST_FILE_CNT; i++)
193 | {
194 | DS_AppData.FileStatus[i].FileHandle = OS_OBJECT_ID_UNDEFINED;
195 | }
196 |
197 | /*
198 | ** Initialize interface to cFE Event Services...
199 | */
200 | Result = CFE_EVS_Register(NULL, 0, 0);
201 |
202 | if (Result != CFE_SUCCESS)
203 | {
204 | CFE_ES_WriteToSysLog("DS App: Error registering for Event Services, RC = 0x%08X\n", (unsigned int)Result);
205 | }
206 | else
207 | {
208 | Result = CFE_SB_CreatePipe(&DS_AppData.CmdPipe, DS_APP_PIPE_DEPTH, DS_APP_PIPE_NAME);
209 | if (Result != CFE_SUCCESS)
210 | {
211 | CFE_EVS_SendEvent(DS_INIT_ERR_EID, CFE_EVS_EventType_ERROR, "Unable to create input pipe, err = 0x%08X",
212 | (unsigned int)Result);
213 | }
214 | }
215 |
216 | /*
217 | ** Subscribe to application housekeeping request command...
218 | */
219 | if (Result == CFE_SUCCESS)
220 | {
221 | Result = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(DS_SEND_HK_MID), DS_AppData.CmdPipe);
222 |
223 | if (Result != CFE_SUCCESS)
224 | {
225 | CFE_EVS_SendEvent(DS_INIT_ERR_EID, CFE_EVS_EventType_ERROR,
226 | "Unable to subscribe to HK request, err = 0x%08X", (unsigned int)Result);
227 | }
228 | }
229 |
230 | /*
231 | ** Subscribe to application commands...
232 | */
233 | if (Result == CFE_SUCCESS)
234 | {
235 | Result = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(DS_CMD_MID), DS_AppData.CmdPipe);
236 |
237 | if (Result != CFE_SUCCESS)
238 | {
239 | CFE_EVS_SendEvent(DS_INIT_ERR_EID, CFE_EVS_EventType_ERROR,
240 | "Unable to subscribe to DS commands, err = 0x%08X", (unsigned int)Result);
241 | }
242 | }
243 |
244 | /*
245 | ** Initialize application tables...
246 | */
247 | if (Result == CFE_SUCCESS)
248 | {
249 | Result = DS_TableInit();
250 | }
251 |
252 | /*
253 | ** Initialize access to Critical Data Store (CDS)...
254 | */
255 | if (Result == CFE_SUCCESS)
256 | {
257 | Result = DS_TableCreateCDS();
258 | }
259 |
260 | /*
261 | ** Generate application startup event message...
262 | */
263 | if (Result == CFE_SUCCESS)
264 | {
265 | CFE_EVS_SendEvent(DS_INIT_INF_EID, CFE_EVS_EventType_INFORMATION,
266 | "Application initialized, version %d.%d.%d.%d, data at %p", DS_MAJOR_VERSION,
267 | DS_MINOR_VERSION, DS_REVISION, DS_MISSION_REV, (void *)&DS_AppData);
268 | }
269 |
270 | return Result;
271 | }
272 |
273 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
274 | /* */
275 | /* Process HK request command */
276 | /* */
277 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
278 |
279 | void DS_AppSendHkCmd(void)
280 | {
281 | DS_HkPacket_t HkPacket;
282 | int32 i = 0;
283 | CFE_Status_t Status = 0;
284 | char FilterTblName[CFE_MISSION_TBL_MAX_NAME_LENGTH] = {0};
285 | CFE_TBL_Info_t FilterTblInfo;
286 |
287 | DS_HkTlm_Payload_t *PayloadPtr;
288 |
289 | memset(&HkPacket, 0, sizeof(HkPacket));
290 |
291 | /*
292 | ** Initialize housekeeping packet...
293 | */
294 | CFE_MSG_Init(CFE_MSG_PTR(HkPacket.TelemetryHeader), CFE_SB_ValueToMsgId(DS_HK_TLM_MID), sizeof(DS_HkPacket_t));
295 |
296 | /*
297 | ** Process data storage file age limits...
298 | */
299 | DS_FileTestAge(DS_SECS_PER_HK_CYCLE);
300 |
301 | /*
302 | ** Take this opportunity to check for table updates...
303 | */
304 | DS_TableManageDestFile();
305 | DS_TableManageFilter();
306 |
307 | /* Get internal payload substructure */
308 | PayloadPtr = &HkPacket.Payload;
309 |
310 | /*
311 | ** Copy application command counters to housekeeping telemetry packet...
312 | */
313 | PayloadPtr->CmdAcceptedCounter = DS_AppData.CmdAcceptedCounter;
314 | PayloadPtr->CmdRejectedCounter = DS_AppData.CmdRejectedCounter;
315 |
316 | /*
317 | ** Copy packet storage counters to housekeeping telemetry packet...
318 | */
319 | PayloadPtr->DisabledPktCounter = DS_AppData.DisabledPktCounter;
320 | PayloadPtr->IgnoredPktCounter = DS_AppData.IgnoredPktCounter;
321 | PayloadPtr->FilteredPktCounter = DS_AppData.FilteredPktCounter;
322 | PayloadPtr->PassedPktCounter = DS_AppData.PassedPktCounter;
323 |
324 | /*
325 | ** Copy file I/O counters to housekeeping telemetry packet...
326 | */
327 | PayloadPtr->FileWriteCounter = DS_AppData.FileWriteCounter;
328 | PayloadPtr->FileWriteErrCounter = DS_AppData.FileWriteErrCounter;
329 | PayloadPtr->FileUpdateCounter = DS_AppData.FileUpdateCounter;
330 | PayloadPtr->FileUpdateErrCounter = DS_AppData.FileUpdateErrCounter;
331 |
332 | /*
333 | ** Copy configuration table counters to housekeeping telemetry packet...
334 | */
335 | PayloadPtr->DestTblLoadCounter = DS_AppData.DestTblLoadCounter;
336 | PayloadPtr->DestTblErrCounter = DS_AppData.DestTblErrCounter;
337 | PayloadPtr->FilterTblLoadCounter = DS_AppData.FilterTblLoadCounter;
338 | PayloadPtr->FilterTblErrCounter = DS_AppData.FilterTblErrCounter;
339 |
340 | /*
341 | ** Copy app enable/disable state to housekeeping telemetry packet...
342 | */
343 | PayloadPtr->AppEnableState = DS_AppData.AppEnableState;
344 |
345 | /*
346 | ** Compute file growth rate from the number of bytes since the last HK request...
347 | */
348 | for (i = 0; i < DS_DEST_FILE_CNT; i++)
349 | {
350 | DS_AppData.FileStatus[i].FileRate = DS_AppData.FileStatus[i].FileGrowth / DS_SECS_PER_HK_CYCLE;
351 | DS_AppData.FileStatus[i].FileGrowth = 0;
352 | }
353 |
354 | /* Get the filter table info, put the file name in the HK pkt. */
355 | Status = snprintf(FilterTblName, CFE_MISSION_TBL_MAX_NAME_LENGTH, "DS.%s", DS_FILTER_TBL_NAME);
356 | if (Status >= 0)
357 | {
358 | Status = CFE_TBL_GetInfo(&FilterTblInfo, FilterTblName);
359 | if (Status == CFE_SUCCESS)
360 | {
361 | snprintf(PayloadPtr->FilterTblFilename, OS_MAX_PATH_LEN, "%s", FilterTblInfo.LastFileLoaded);
362 | }
363 | else
364 | {
365 | /* If the filter table name is invalid, send an event and erase any
366 | * stale/misleading filename from the HK packet */
367 | CFE_EVS_SendEvent(DS_APPHK_FILTER_TBL_ERR_EID, CFE_EVS_EventType_ERROR,
368 | "Invalid filter tbl name in DS_AppSendHkCmd. Name=%s, Err=0x%08X", FilterTblName,
369 | (unsigned int)Status);
370 |
371 | memset(PayloadPtr->FilterTblFilename, 0, sizeof(PayloadPtr->FilterTblFilename));
372 | }
373 | }
374 | else
375 | {
376 | /* If the filter table name couldn't be copied, send an event and erase
377 | * any stale/misleading filename from the HK packet */
378 | CFE_EVS_SendEvent(DS_APPHK_FILTER_TBL_PRINT_ERR_EID, CFE_EVS_EventType_ERROR,
379 | "Filter tbl name copy fail in DS_AppSendHkCmd. Err=%d", (int)Status);
380 |
381 | memset(PayloadPtr->FilterTblFilename, 0, sizeof(PayloadPtr->FilterTblFilename));
382 | }
383 |
384 | /*
385 | ** Timestamp and send housekeeping telemetry packet...
386 | */
387 | CFE_SB_TimeStampMsg(CFE_MSG_PTR(HkPacket.TelemetryHeader));
388 | CFE_SB_TransmitMsg(CFE_MSG_PTR(HkPacket.TelemetryHeader), true);
389 | }
390 |
391 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
392 | /* */
393 | /* Packet storage pre-processor */
394 | /* */
395 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
396 |
397 | void DS_AppStorePacket(CFE_SB_MsgId_t MessageID, const CFE_SB_Buffer_t *BufPtr)
398 | {
399 | if (DS_AppData.AppEnableState == DS_DISABLED)
400 | {
401 | /*
402 | ** Application must be enabled in order to store data...
403 | */
404 | DS_AppData.DisabledPktCounter++;
405 | }
406 | else if ((DS_AppData.FilterTblPtr == (DS_FilterTable_t *)NULL) ||
407 | (DS_AppData.DestFileTblPtr == (DS_DestFileTable_t *)NULL))
408 | {
409 | /*
410 | ** Must have both tables loaded in order to store data...
411 | */
412 | DS_AppData.IgnoredPktCounter++;
413 | }
414 | else
415 | {
416 | /*
417 | ** Store packet (if permitted by filter table)...
418 | */
419 | DS_FileStorePacket(MessageID, BufPtr);
420 | }
421 | }
422 |
--------------------------------------------------------------------------------
/fsw/src/ds_app.h:
--------------------------------------------------------------------------------
1 | /************************************************************************
2 | * NASA Docket No. GSC-18,917-1, and identified as “CFS Data Storage
3 | * (DS) application version 2.6.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 Data Storage (DS) Application header file
23 | */
24 | #ifndef DS_APP_H
25 | #define DS_APP_H
26 |
27 | #include "cfe.h"
28 |
29 | #include "ds_appdefs.h"
30 |
31 | #include "ds_platform_cfg.h"
32 |
33 | #include "ds_table.h"
34 |
35 | #include "ds_extern_typedefs.h"
36 |
37 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
38 | /* */
39 | /* DS application data structures */
40 | /* */
41 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
42 |
43 | /**
44 | * \brief Wakeup for DS
45 | *
46 | * \par Description
47 | * Wakes up DS every 1 second for routine maintenance whether a
48 | * message was received or not.
49 | */
50 | #define DS_SB_TIMEOUT 1000
51 | #define DS_SECS_PER_TIMEOUT (DS_SB_TIMEOUT / 1000)
52 |
53 | /**
54 | * \brief Current state of destination files
55 | */
56 | typedef struct
57 | {
58 | osal_id_t FileHandle; /**< \brief Current file handle */
59 | uint32 FileAge; /**< \brief Current file age in seconds */
60 | uint32 FileSize; /**< \brief Current file size in bytes */
61 | uint32 FileGrowth; /**< \brief Current file growth in bytes (since HK) */
62 | uint32 FileRate; /**< \brief File growth rate in bytes (at last HK) */
63 | uint32 FileCount; /**< \brief Current file sequence count */
64 | uint16 FileState; /**< \brief Current file enable/disable state */
65 | uint16 Unused; /**< \brief Unused - structure padding */
66 | char FileName[DS_TOTAL_FNAME_BUFSIZE]; /**< \brief Current filename (path+base+seq+ext) */
67 | } DS_AppFileStatus_t;
68 |
69 | /**
70 | * \brief DS global data structure definition
71 | */
72 | typedef struct
73 | {
74 | CFE_SB_PipeId_t CmdPipe; /**< \brief Pipe Id for DS command pipe */
75 |
76 | CFE_ES_CDSHandle_t DataStoreHandle; /**< \brief Critical Data Store (CDS) handle */
77 |
78 | CFE_TBL_Handle_t FilterTblHandle; /**< \brief Packet filter table handle */
79 | CFE_TBL_Handle_t DestFileTblHandle; /**< \brief Destination file table handle */
80 |
81 | DS_FilterTable_t * FilterTblPtr; /**< \brief Packet filter table data pointer */
82 | DS_DestFileTable_t *DestFileTblPtr; /**< \brief Destination file table data pointer */
83 |
84 | uint8 CmdAcceptedCounter; /**< \brief Count of valid commands received */
85 | uint8 CmdRejectedCounter; /**< \brief Count of invalid commands received */
86 | uint8 DestTblLoadCounter; /**< \brief Count of destination file table loads */
87 | uint8 DestTblErrCounter; /**< \brief Count of failed attempts to get table data pointer */
88 | uint8 FilterTblLoadCounter; /**< \brief Count of packet filter table loads */
89 | uint8 FilterTblErrCounter; /**< \brief Count of failed attempts to get table data pointer */
90 | uint8 AppEnableState; /**< \brief Application enable/disable state */
91 | uint8 Spare8; /**< \brief Structure alignment padding */
92 |
93 | uint16 FileWriteCounter; /**< \brief Count of good destination file writes */
94 | uint16 FileWriteErrCounter; /**< \brief Count of bad destination file writes */
95 | uint16 FileUpdateCounter; /**< \brief Count of good updates to secondary header */
96 | uint16 FileUpdateErrCounter; /**< \brief Count of bad updates to secondary header */
97 |
98 | uint32 DisabledPktCounter; /**< \brief Count of packets discarded (DS app disabled) */
99 | uint32 IgnoredPktCounter; /**< \brief Count of packets discarded (pkt has no filter) */
100 | uint32 FilteredPktCounter; /**< \brief Count of packets discarded (failed filter test) */
101 | uint32 PassedPktCounter; /**< \brief Count of packets that passed filter test */
102 |
103 | DS_AppFileStatus_t FileStatus[DS_DEST_FILE_CNT]; /**< \brief Current state of destination files */
104 |
105 | DS_HashLink_t HashLinks[DS_PACKETS_IN_FILTER_TABLE]; /**< \brief Hash table linked list elements */
106 | DS_HashLink_t *HashTable[DS_HASH_TABLE_ENTRIES]; /**< \brief Each hash table entry is a linked list */
107 |
108 | uint8 EnableMoveFiles; /**< \brief Whether to move files to downlink directory after close */
109 | } DS_AppData_t;
110 |
111 | /** \brief DS global data structure reference */
112 | extern DS_AppData_t DS_AppData;
113 |
114 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
115 | /* */
116 | /* Prototypes for functions defined in ds_app.c */
117 | /* */
118 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
119 |
120 | /**
121 | * \brief CFS Data Storage (DS) application entry point
122 | *
123 | * \par Description
124 | * DS application entry point and main process loop.
125 | *
126 | * \par Assumptions, External Events, and Notes:
127 | * None
128 | */
129 | void DS_AppMain(void);
130 |
131 | /**
132 | * \brief Application initialization function
133 | *
134 | * \par Description
135 | * Performs the following startup initialization:
136 | * - register DS application for cFE Event Services
137 | * - create a cFE Software Bus message pipe
138 | * - subscribe to DS commands via message pipe
139 | * - register DS filter and file destination tables
140 | * - load default filter and file destination tables
141 | * - subscribe to packets referenced in DS filter table
142 | * - generate startup initialization event message
143 | *
144 | * \par Assumptions, External Events, and Notes:
145 | * (none)
146 | *
147 | * \return Execution status, see \ref CFEReturnCodes
148 | * \retval #CFE_SUCCESS \copybrief CFE_SUCCESS
149 | */
150 | CFE_Status_t DS_AppInitialize(void);
151 |
152 | /**
153 | * \brief Application housekeeping request command handler
154 | *
155 | * \par Description
156 | * Check with cFE Table Services for table updates
157 | * Generate application housekeeping telemetry packet
158 | *
159 | * \par Assumptions, External Events, and Notes:
160 | * (none)
161 | *
162 | * \sa #DS_HkPacket_t
163 | */
164 | void DS_AppSendHkCmd(void);
165 |
166 | /**
167 | * \brief Application packet storage pre-processor
168 | *
169 | * \par Description
170 | * This function verifies that DS storage is enabled and that
171 | * both DS tables (filter and file) are loaded before calling
172 | * the file storage function (#DS_FileStorePacket).
173 | *
174 | * \par Assumptions, External Events, and Notes:
175 | * (none)
176 | *
177 | * \param[in] MessageID Message ID
178 | * \param[in] BufPtr Software Bus message pointer
179 | *
180 | * \sa #CFE_SB_Buffer_t*
181 | */
182 | void DS_AppStorePacket(CFE_SB_MsgId_t MessageID, const CFE_SB_Buffer_t *BufPtr);
183 |
184 | #endif
185 |
--------------------------------------------------------------------------------
/fsw/src/ds_appdefs.h:
--------------------------------------------------------------------------------
1 | /************************************************************************
2 | * NASA Docket No. GSC-18,917-1, and identified as “CFS Data Storage
3 | * (DS) application version 2.6.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 Data Storage (DS) Application header file
23 | */
24 | #ifndef DS_APPDEFS_H
25 | #define DS_APPDEFS_H
26 |
27 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
28 | /* */
29 | /* DS common application macro definitions */
30 | /* */
31 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
32 |
33 | #define DS_CLOSED 0 /**< \brief File is closed */
34 | #define DS_OPEN 1 /**< \brief File is open */
35 |
36 | #define DS_STRING_REQUIRED true /**< \brief String text is required */
37 | #define DS_STRING_OPTIONAL false /**< \brief String text is optional */
38 |
39 | #define DS_FILENAME_TEXT true /**< \brief String text is part of a filename */
40 | #define DS_DESCRIPTIVE_TEXT false /**< \brief String text is not part of a filename */
41 |
42 | #define DS_INDEX_NONE -1 /**< \brief Packet filter table look-up = not found */
43 |
44 | #define DS_PATH_SEPARATOR '/' /**< \brief File system path separator */
45 |
46 | #define DS_TABLE_VERIFY_ERR -1 /**< \brief Table verification error return value */
47 |
48 | #define DS_FILE_HEADER_NONE 0 /**< \brief File header type is NONE */
49 | #define DS_FILE_HEADER_CFE 1 /**< \brief File header type is CFE */
50 |
51 | #endif
52 |
--------------------------------------------------------------------------------
/fsw/src/ds_dispatch.h:
--------------------------------------------------------------------------------
1 | /************************************************************************
2 | * NASA Docket No. GSC-18,917-1, and identified as “CFS Data Storage
3 | * (DS) application version 2.6.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 Data Storage (DS) dispatch header file
23 | */
24 | #ifndef DS_DISPATCH_H
25 | #define DS_DISPATCH_H
26 |
27 | #include "cfe.h"
28 | #include "ds_platform_cfg.h"
29 |
30 | /**
31 | * \brief Software Bus message handler
32 | *
33 | * \par Description
34 | * Process packets received via Software Bus message pipe
35 | * - may call application housekeeping request command handler
36 | * - may call 1Hz wakeup command handler (if enabled)
37 | * - may call application ground command handler
38 | * All packets are processed for possible data storage
39 | *
40 | * \par Assumptions, External Events, and Notes:
41 | * (none)
42 | *
43 | * \param[in] BufPtr Software Bus message pointer
44 | */
45 | void DS_AppProcessMsg(const CFE_SB_Buffer_t *BufPtr);
46 |
47 | /**
48 | * \brief Application ground command handler
49 | *
50 | * \par Description
51 | * Call command code specific DS command handler function
52 | * Generate command error event for unknown command codes
53 | *
54 | * \par Assumptions, External Events, and Notes:
55 | * (none)
56 | *
57 | * \param[in] BufPtr Software Bus message pointer
58 | */
59 | void DS_AppProcessCmd(const CFE_SB_Buffer_t *BufPtr);
60 |
61 | #endif
62 |
--------------------------------------------------------------------------------
/fsw/src/ds_file.h:
--------------------------------------------------------------------------------
1 | /************************************************************************
2 | * NASA Docket No. GSC-18,917-1, and identified as “CFS Data Storage
3 | * (DS) application version 2.6.1”
4 | *
5 | * Copyright (c) 2021 United States Government as represented by the
6 | * Administrator of the National Aeronautics and Space Administration.
7 | * All Rights Reserved.
8 | *
9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
10 | * not use this file except in compliance with the License. You may obtain
11 | * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | ************************************************************************/
19 |
20 | /**
21 | * @file
22 | * CFS Data Storage (DS) file storage header file
23 | */
24 | #ifndef DS_FILE_H
25 | #define DS_FILE_H
26 |
27 | #include "cfe.h"
28 |
29 | #include "ds_platform_cfg.h"
30 | #include "ds_app.h"
31 |
32 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
33 | /* */
34 | /* DS file header definitions */
35 | /* */
36 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
37 |
38 | /**
39 | * \brief DS File Header (follows cFE file header at start of file)
40 | */
41 | typedef struct
42 | {
43 | uint32 CloseSeconds; /**< \brief Time when file was closed */
44 | uint32 CloseSubsecs;
45 |
46 | uint16 FileTableIndex; /**< \brief Destination file table index */
47 | uint16 FileNameType; /**< \brief Filename type - count vs time */
48 |
49 | char FileName[DS_TOTAL_FNAME_BUFSIZE]; /**< \brief On-board filename */
50 | } DS_FileHeader_t;
51 |
52 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
53 | /* */
54 | /* Prototypes for functions defined in ds_file.c */
55 | /* */
56 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
57 |
58 | /**
59 | * \brief Data Storage packet processor
60 | *
61 | * \par Description
62 | * This function searches for a packet filter table entry that
63 | * matches the input argument Message ID. If no matching packet
64 | * filter table entry is found, the packet referenced via the
65 | * Message Pointer is discarded (filtered). When a matching
66 | * packet table entry is found, each of the multiple filters
67 | * defined for the packet are tested by applying the common
68 | * CFS filter algorithm to the table defined filter parameters.
69 | * Packets that are passed by any filter continue with the
70 | * write process. Next step: prepare to write data to a file.
71 | *
72 | * \par Assumptions, External Events, and Notes:
73 | * (none)
74 | *
75 | * \param[in] MessageID Message ID
76 | * \param[in] BufPtr Software Bus message pointer
77 | *
78 | * \sa #DS_PacketEntry_t, #DS_FilterParms_t, #DS_DestFileEntry_t
79 | */
80 | void DS_FileStorePacket(CFE_SB_MsgId_t MessageID, const CFE_SB_Buffer_t *BufPtr);
81 |
82 | /**
83 | * \brief Prepare to write to a data storage destination file
84 | *
85 | * \par Description
86 | * This function is called for packets that have passed the
87 | * common CFS filter algorithm. The function first queries the
88 | * packet length and determines whether writing the packet to
89 | * an existing data storage file would exceed the max file size
90 | * limit. If so, the existing destination file header is updated
91 | * and the file is closed. Then the function determines whether
92 | * a new file needs to be opened and if so, creates the file.
93 | * Files may be closed due to size or by command, and files may
94 | * have not yet been created because this is the first packet
95 | * destined for that file. Next step: write data to file.
96 | *
97 | * \par Assumptions, External Events, and Notes:
98 | * (none)
99 | *
100 | * \param[in] FileIndex Destination file index
101 | * \param[in] BufPtr Software Bus message pointer
102 | *
103 | * \sa #DS_AppFileStatus_t, #DS_DestFileEntry_t
104 | */
105 | void DS_FileSetupWrite(int32 FileIndex, const CFE_SB_Buffer_t *BufPtr);
106 |
107 | /**
108 | * \brief Write data (packet) to file
109 | *
110 | * \par Description
111 | * This function writes data to an existing data storage
112 | * destination file and updates the associated data rate
113 | * counters. If necessary, the function will invoke a
114 | * file write error handler.
115 | *
116 | * \par Assumptions, External Events, and Notes:
117 | * (none)
118 | *
119 | * \param[in] FileIndex Destination file index
120 | * \param[in] FileData Pointer to packet data
121 | * \param[in] DataLength Length of packet data
122 | *
123 | * \sa #DS_AppFileStatus_t, #DS_DestFileEntry_t
124 | */
125 | void DS_FileWriteData(int32 FileIndex, const void *FileData, uint32 DataLength);
126 |
127 | /**
128 | * \brief Write data storage file header
129 | *
130 | * \par Description
131 | * This function is called just after opening a new data storage
132 | * destination file. The purpose of the function is to write
133 | * a file header and initialize those elements in the file
134 | * header that can be known in advance, such as the filename
135 | * or file type. Any seek or write errors will result in the
136 | * execution of the common file write error handler.
137 | *
138 | * \par Assumptions, External Events, and Notes:
139 | * (none)
140 | *
141 | * \param[in] FileIndex Destination file index
142 | *
143 | * \sa #DS_FileUpdateHeader
144 | */
145 | void DS_FileWriteHeader(int32 FileIndex);
146 |
147 | /**
148 | * \brief File write error handler
149 | *
150 | * \par Description
151 | * This function is called upon detection of a file I/O error
152 | * that occurred while writing to a data storage destination
153 | * file. The function sends an event describing the error,
154 | * closes the file and disables the destination. If DS tables
155 | * have been defined as "critical", the version of the table
156 | * in the Critical Data Store (CDS) will be updated to reflect
157 | * the change in enable/disable state for the destination.
158 | *
159 | * \par Assumptions, External Events, and Notes:
160 | * (none)
161 | *
162 | * \param[in] FileIndex Destination file index
163 | * \param[in] DataLength Length of data being written to file
164 | * \param[in] WriteResult Result of file write
165 | */
166 | void DS_FileWriteError(uint32 FileIndex, uint32 DataLength, int32 WriteResult);
167 |
168 | /**
169 | * \brief Create a new data storage destination file
170 | *
171 | * \par Description
172 | * This function is called when a packet has passed the filter
173 | * test and the destination file does not exist. The file may
174 | * not yet have been created - if this is the first packet for
175 | * this destination to pass the filter test - or the previous
176 | * file may have been closed by command or file size/age test.
177 | * Note that destination files are not created until there is
178 | * a packet ready to be written.
179 | *
180 | * \par Assumptions, External Events, and Notes:
181 | * (none)
182 | *
183 | * \param[in] FileIndex Destination file index
184 | */
185 | void DS_FileCreateDest(uint32 FileIndex);
186 |
187 | /**
188 | * \brief Construct the next filename for a destination file
189 | *
190 | * \par Description
191 | * The filename is constructed using data from the Destination
192 | * File Table. First, the pathname and basename fields from
193 | * the table are combined. Then, based on the filename type
194 | * from the table, a sequence string is created and appended
195 | * to the filename. Finally, the file extension from the table
196 | * is appended to complete the filename.
197 | *
198 | * \par Assumptions, External Events, and Notes:
199 | * (none)
200 | *
201 | * \param[in] FileIndex Destination file index
202 | *
203 | * \sa #DS_DestFileEntry_t
204 | */
205 | void DS_FileCreateName(uint32 FileIndex);
206 |
207 | /**
208 | * \brief Construct the sequence portion of a filename
209 | *
210 | * \par Description
211 | * The filename sequence string will be constructed to contain
212 | * either the current date and time, or a file sequence count
213 | * value. If the filename type is "time" then the sequence
214 | * string will have the format "YYYYDDDHHMMSS". Or, if the
215 | * filename type is "count" then the sequence string will be
216 | * a fixed number of text digits, where the string length is a
217 | * platform defined value.
218 | *
219 | * \par Assumptions, External Events, and Notes:
220 | * (none)
221 | *
222 | * \param[in] Buffer Pointer to buffer for sequence portion of filename
223 | * \param[in] Type Filename type (date and time vs sequence count)
224 | * \param[in] Count Sequence counter (used only if type is sequence)
225 | *
226 | * \sa #DS_DestFileEntry_t
227 | */
228 | void DS_FileCreateSequence(char *Buffer, uint32 Type, uint32 Count);
229 |
230 | /**
231 | * \brief Update destination file header (prior to closing)
232 | *
233 | * \par Description
234 | * This function is called just before closing a data storage
235 | * destination file. The purpose of the function is to update
236 | * portions of the file header that cannot be known in advance,
237 | * such as the file size or the file close time. During the
238 | * update process, seek and write errors are counted but
239 | * otherwise ignored as the file is about to be closed.
240 | *
241 | * \par Assumptions, External Events, and Notes:
242 | * (none)
243 | *
244 | * \param[in] FileIndex Destination file index
245 | *
246 | * \sa #DS_FileWriteHeader
247 | */
248 | void DS_FileUpdateHeader(int32 FileIndex);
249 |
250 | /**
251 | * \brief Close selected destination file
252 | *
253 | * \par Description
254 | * This function may be called from the DS Close File command
255 | * handler, from the file age processor, from the file size
256 | * processor and from the file write error handler.
257 | * The function closes the selected destination file and updates
258 | * the file status data to indicate that the file handle is not
259 | * in use and that the file age, size and name fields are reset.
260 | *
261 | * \par Assumptions, External Events, and Notes:
262 | * (none)
263 | *
264 | * \param[in] FileIndex Destination file index
265 | */
266 | void DS_FileCloseDest(int32 FileIndex);
267 |
268 | /**
269 | * \brief File age processor
270 | *
271 | * \par Description
272 | * This function is called upon receipt of the DS 1Hz command
273 | * (if defined) or upon receipt of the DS housekeeping request
274 | * command (if the 1Hz cmd is not defined).
275 | * The function increments the elapsed file age for all open
276 | * data storage files by the amount specified.
277 | * Files that exceed the age limit set in the destination file
278 | * definition table will be closed.
279 | * If this destination remains enabled, another file will be
280 | * opened when the next packet is written to this destination.
281 | *
282 | * \par Assumptions, External Events, and Notes:
283 | * (none)
284 | *
285 | * \param[in] ElapsedSeconds Elapsed seconds since previous call
286 | */
287 | void DS_FileTestAge(uint32 ElapsedSeconds);
288 |
289 | /**
290 | * \brief Transmit file information telemetry handler
291 | *
292 | * \par Description
293 | * Create and send a telemetry packet containing the current
294 | * status for a closed destination file.
295 | *
296 | * \par Assumptions, External Events, and Notes:
297 | * (none)
298 | *
299 | * \param[in] FileStatus Current state of destination file
300 | *
301 | * \sa #DS_FileCompletePktBuf_t
302 | */
303 | void DS_FileTransmit(DS_AppFileStatus_t *FileStatus);
304 |
305 | /**
306 | * \brief Determine whether Software Bus message packet is filtered
307 | *
308 | * \par Description
309 | * This routine will apply the DS filter algorithm to the packet
310 | * to determine whether the packet should be filtered.
311 | *
312 | * \par Assumptions, External Events, and Notes:
313 | * None
314 | *
315 | * \param[in] MessagePtr Pointer to a Software Bus message packet
316 | * \param[in] FilterType Packet sequence count (1) or timestamp (2)
317 | * \param[in] Algorithm_N Algorithm parameter N "pass this many"
318 | * \param[in] Algorithm_X Algorithm parameter X "out of this many"
319 | * \param[in] Algorithm_O Algorithm parameter O "at this offset"
320 | *
321 | * \return Boolean packet filtered response
322 | * \retval true The packet should be filtered (not used)
323 | * \retval false The packet should not be filtered (used)
324 | */
325 | bool DS_IsPacketFiltered(CFE_MSG_Message_t *MessagePtr, uint16 FilterType, uint16 Algorithm_N, uint16 Algorithm_X,
326 | uint16 Algorithm_O);
327 |
328 | #endif
329 |
--------------------------------------------------------------------------------
/fsw/src/ds_verify.h:
--------------------------------------------------------------------------------
1 | /************************************************************************
2 | * NASA Docket No. GSC-18,917-1, and identified as “CFS Data Storage
3 | * (DS) application version 2.6.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 | * Define the CFS Data Storage (DS) Application compile-time checks
23 | */
24 | #ifndef DS_VERIFY_H
25 | #define DS_VERIFY_H
26 |
27 | #include "cfe.h"
28 |
29 | #include "ds_platform_cfg.h"
30 |
31 | #ifndef DS_DESTINATION_TBL_NAME
32 | #error DS_DESTINATION_TBL_NAME must be defined!
33 | #endif
34 |
35 | #ifndef DS_DEF_FILTER_FILENAME
36 | #error DS_DEF_FILTER_FILENAME must be defined!
37 | #endif
38 |
39 | #ifndef DS_DEST_FILE_CNT
40 | #error DS_DEST_FILE_CNT must be defined!
41 | #elif (DS_DEST_FILE_CNT < 1)
42 | #error DS_DEST_FILE_CNT cannot be less than 1!
43 | #endif
44 |
45 | #ifndef DS_PATHNAME_BUFSIZE
46 | #error DS_PATHNAME_BUFSIZE must be defined!
47 | #elif (DS_PATHNAME_BUFSIZE < 1)
48 | #error DS_PATHNAME_BUFSIZE cannot be less than 1!
49 | #elif ((DS_PATHNAME_BUFSIZE % 4) != 0)
50 | #error DS_PATHNAME_BUFSIZE must be a multiple of 4!
51 | #elif (DS_PATHNAME_BUFSIZE > OS_MAX_PATH_LEN)
52 | #error DS_PATHNAME_BUFSIZE cannot be greater than OS_MAX_PATH_LEN!
53 | #endif
54 |
55 | #ifndef DS_BASENAME_BUFSIZE
56 | #error DS_BASENAME_BUFSIZE must be defined!
57 | #elif (DS_BASENAME_BUFSIZE < 1)
58 | #error DS_BASENAME_BUFSIZE cannot be less than 1!
59 | #elif ((DS_BASENAME_BUFSIZE % 4) != 0)
60 | #error DS_BASENAME_BUFSIZE must be a multiple of 4!
61 | #elif (DS_BASENAME_BUFSIZE > OS_MAX_PATH_LEN)
62 | #error DS_BASENAME_BUFSIZE cannot be greater than OS_MAX_PATH_LEN!
63 | #endif
64 |
65 | #ifndef DS_EXTENSION_BUFSIZE
66 | #error DS_EXTENSION_BUFSIZE must be defined!
67 | #elif (DS_EXTENSION_BUFSIZE < 1)
68 | #error DS_EXTENSION_BUFSIZE cannot be less than 1!
69 | #elif ((DS_EXTENSION_BUFSIZE % 4) != 0)
70 | #error DS_EXTENSION_BUFSIZE must be a multiple of 4!
71 | #elif (DS_EXTENSION_BUFSIZE > OS_MAX_PATH_LEN)
72 | #error DS_EXTENSION_BUFSIZE cannot be greater than OS_MAX_PATH_LEN!
73 | #endif
74 |
75 | #ifndef DS_FILTER_TBL_NAME
76 | #error DS_FILTER_TBL_NAME must be defined!
77 | #endif
78 |
79 | #ifndef DS_DEF_DEST_FILENAME
80 | #error DS_DEF_DEST_FILENAME must be defined!
81 | #endif
82 |
83 | #ifndef DS_PACKETS_IN_FILTER_TABLE
84 | #error DS_PACKETS_IN_FILTER_TABLE must be defined!
85 | #elif (DS_PACKETS_IN_FILTER_TABLE < 1)
86 | #error DS_PACKETS_IN_FILTER_TABLE cannot be less than 1!
87 | #endif
88 |
89 | #ifndef DS_FILTERS_PER_PACKET
90 | #error DS_FILTERS_PER_PACKET must be defined!
91 | #elif (DS_FILTERS_PER_PACKET < 1)
92 | #error DS_FILTERS_PER_PACKET cannot be less than 1!
93 | #elif (DS_FILTERS_PER_PACKET > DS_DEST_FILE_CNT)
94 | #error DS_FILTERS_PER_PACKET cannot be greater than DS_DEST_FILE_CNT!
95 | #endif
96 |
97 | #ifndef DS_DESCRIPTOR_BUFSIZE
98 | #error DS_DESCRIPTOR_BUFSIZE must be defined!
99 | #elif (DS_DESCRIPTOR_BUFSIZE < 1)
100 | #error DS_DESCRIPTOR_BUFSIZE cannot be less than 1!
101 | #elif ((DS_DESCRIPTOR_BUFSIZE % 4) != 0)
102 | #error DS_DESCRIPTOR_BUFSIZE must be a multiple of 4!
103 | #endif
104 |
105 | #ifndef DS_SEQUENCE_DIGITS
106 | #error DS_SEQUENCE_DIGITS must be defined!
107 | #elif (DS_SEQUENCE_DIGITS < 1)
108 | #error DS_SEQUENCE_DIGITS cannot be less than 1!
109 | #endif
110 |
111 | #ifndef DS_MAX_SEQUENCE_COUNT
112 | #error DS_MAX_SEQUENCE_COUNT must be defined!
113 | #elif (DS_MAX_SEQUENCE_COUNT < 1)
114 | #error DS_MAX_SEQUENCE_COUNT cannot be less than 1!
115 | #endif
116 |
117 | #ifndef DS_TOTAL_FNAME_BUFSIZE
118 | #error DS_TOTAL_FNAME_BUFSIZE must be defined!
119 | #elif (DS_TOTAL_FNAME_BUFSIZE < 1)
120 | #error DS_TOTAL_FNAME_BUFSIZE cannot be less than 1!
121 | #elif ((DS_TOTAL_FNAME_BUFSIZE % 4) != 0)
122 | #error DS_TOTAL_FNAME_BUFSIZE must be a multiple of 4!
123 | #elif (DS_TOTAL_FNAME_BUFSIZE > OS_MAX_PATH_LEN)
124 | #error DS_TOTAL_FNAME_BUFSIZE cannot be greater than OS_MAX_PATH_LEN!
125 | #endif
126 |
127 | #ifndef DS_FILE_HDR_SUBTYPE
128 | #error DS_FILE_HDR_SUBTYPE must be defined!
129 | #endif
130 |
131 | #ifndef DS_FILE_HDR_DESCRIPTION
132 | #error DS_FILE_HDR_DESCRIPTION must be defined!
133 | #endif
134 |
135 | #ifndef DS_FILE_MIN_SIZE_LIMIT
136 | #error DS_FILE_MIN_SIZE_LIMIT must be defined!
137 | #elif (DS_FILE_MIN_SIZE_LIMIT < 1)
138 | #error DS_FILE_MIN_SIZE_LIMIT cannot be less than 1!
139 | #endif
140 |
141 | #ifndef DS_FILE_MIN_AGE_LIMIT
142 | #error DS_FILE_MIN_AGE_LIMIT must be defined!
143 | #elif (DS_FILE_MIN_AGE_LIMIT < 1)
144 | #error DS_FILE_MIN_AGE_LIMIT cannot be less than 1!
145 | #endif
146 |
147 | #ifndef DS_APP_PIPE_NAME
148 | #error DS_APP_PIPE_NAME must be defined!
149 | #endif
150 |
151 | #ifndef DS_APP_PIPE_DEPTH
152 | #error DS_APP_PIPE_DEPTH must be defined!
153 | #elif (DS_APP_PIPE_DEPTH < 1)
154 | #error DS_APP_PIPE_DEPTH cannot be less than 1!
155 | #elif (DS_APP_PIPE_DEPTH > OS_QUEUE_MAX_DEPTH)
156 | #error DS_APP_PIPE_DEPTH cannot exceed OS_QUEUE_MAX_DEPTH!
157 | #endif
158 |
159 | #ifndef DS_MAKE_TABLES_CRITICAL
160 | #error DS_MAKE_TABLES_CRITICAL must be defined!
161 | #elif ((DS_MAKE_TABLES_CRITICAL != 0) && (DS_MAKE_TABLES_CRITICAL != 1))
162 | #error DS_MAKE_TABLES_CRITICAL must be 0 or 1!
163 | #endif
164 |
165 | #if (DS_SECS_PER_HK_CYCLE < 1)
166 | #error DS_SECS_PER_HK_CYCLE cannot be less than 1!
167 | #endif
168 |
169 | #ifndef DS_DEF_ENABLE_STATE
170 | #error DS_DEF_ENABLE_STATE must be defined!
171 | #elif ((DS_DEF_ENABLE_STATE != 0) && (DS_DEF_ENABLE_STATE != 1))
172 | #error DS_DEF_ENABLE_STATE must be 0 or 1!
173 | #endif
174 |
175 | #ifndef DS_CDS_ENABLE_STATE
176 | #error DS_CDS_ENABLE_STATE must be defined!
177 | #elif ((DS_CDS_ENABLE_STATE != 0) && (DS_CDS_ENABLE_STATE != 1))
178 | #error DS_CDS_ENABLE_STATE must be 0 or 1!
179 | #endif
180 |
181 | #ifndef DS_MISSION_REV
182 | #error DS_MISSION_REV must be defined!
183 | #elif (DS_MISSION_REV < 0)
184 | #error DS_MISSION_REV must be greater than or equal to zero!
185 | #endif
186 |
187 | #ifndef DS_FILE_HEADER_TYPE
188 | #error DS_FILE_HEADER_TYPE must be defined!
189 | #elif ((DS_FILE_HEADER_TYPE != 0) && (DS_FILE_HEADER_TYPE != 1))
190 | #error DS_FILE_HEADER_TYPE must be 0 or 1!
191 | #endif
192 |
193 | #ifndef DS_MOVE_FILES
194 | #error DS_MOVE_FILES must be defined!
195 | #elif ((DS_MOVE_FILES != true) && (DS_MOVE_FILES != false))
196 | #error DS_MOVE_FILES must be true or false!
197 | #endif
198 |
199 | #ifndef DS_PER_PACKET_PIPE_LIMIT
200 | #error DS_PER_PACKET_PIPE_LIMIT must be defined!
201 | #elif (DS_PER_PACKET_PIPE_LIMIT < 1)
202 | #error DS_PER_PACKET_PIPE_LIMIT cannot be less than 1!
203 | #elif (DS_PER_PACKET_PIPE_LIMIT > DS_APP_PIPE_DEPTH)
204 | #error DS_PER_PACKET_PIPE_LIMIT cannot be greater than DS_APP_PIPE_DEPTH!
205 | #endif
206 |
207 | #endif
208 |
--------------------------------------------------------------------------------
/fsw/src/ds_version.h:
--------------------------------------------------------------------------------
1 | /************************************************************************
2 | * NASA Docket No. GSC-18,917-1, and identified as “CFS Data Storage
3 | * (DS) application version 2.6.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 Data Storage (DS) Application header file containing version number
23 | */
24 | #ifndef DS_VERSION_H
25 | #define DS_VERSION_H
26 |
27 | /**
28 | * \defgroup cfsdsversion CFS Data Storage Version
29 | * \ref cfsversions
30 | * \{
31 | */
32 |
33 | #define DS_MAJOR_VERSION 2 /**< \brief Major version number */
34 | #define DS_MINOR_VERSION 6 /**< \brief Minor version number */
35 | #define DS_REVISION 99 /**< \brief Revision number */
36 |
37 | /**\}*/
38 |
39 | #endif
40 |
--------------------------------------------------------------------------------
/fsw/tables/ds_file_tbl.c:
--------------------------------------------------------------------------------
1 | /************************************************************************
2 | * NASA Docket No. GSC-18,917-1, and identified as “CFS Data Storage
3 | * (DS) application version 2.6.1”
4 | *
5 | * Copyright (c) 2021 United States Government as represented by the
6 | * Administrator of the National Aeronautics and Space Administration.
7 | * All Rights Reserved.
8 | *
9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
10 | * not use this file except in compliance with the License. You may obtain
11 | * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | ************************************************************************/
19 |
20 | /**
21 | * @file
22 | * CFS Data Storage (DS) sample destination file table
23 | *
24 | * @note
25 | * This source file creates a sample table that defines several
26 | * data storage destination files using a variety of the options
27 | * available. None of the file system details (name, size, etc.)
28 | * are known at this time for the target platform. Therefore,
29 | * the file pathnames are set to "set_by_cmd_b4_enable" which
30 | * indicates that pathnames must be set by command before trying
31 | * to enable any of the destination files. Max file size values
32 | * should also be modified via command before using this table.
33 | *
34 | * Obviously, a better solution is to replace this sample table
35 | * and the sample packet filter table (which references this
36 | * table) with mission specific versions that define the data
37 | * storage behavior appropriate for the platform.
38 | *
39 | * But, as long as the target platform has a file system, the
40 | * sample data storage tables may be used to demonstrate data
41 | * storage.
42 | */
43 |
44 | #include "cfe.h"
45 | #include "cfe_tbl_filedef.h"
46 | #include "ds_platform_cfg.h"
47 | #include "ds_extern_typedefs.h"
48 | #include "ds_msg.h"
49 |
50 | /*
51 | ** Note: It is suggested that missions pre-define their file table
52 | ** index numbers in a public header file to be included by
53 | ** both the packet filter table source file and the destination
54 | ** file table source file. Common definitions may also be used
55 | ** when creating ground system database entries that require
56 | ** file index numbers for command arguments.
57 | */
58 | #define FILE_ALL_EVENTS 0
59 |
60 | #define FILE_ALL_APP_HK_PKTS 1
61 | #define FILE_ALL_APP_TLM_PKTS 2
62 |
63 | #define FILE_ALL_HW_TLM_PKTS 3
64 |
65 | #define FILE_CFE_APP_HK_PKTS 4
66 | #define FILE_CFE_APP_TLM_PKTS 5
67 |
68 | /*
69 | ** Sample Destination File Table Data
70 | */
71 | DS_DestFileTable_t DS_DestFileTable = {
72 | /* .Descriptor = */ "Sample File Table Data",
73 | /* .File = */
74 | {
75 | /* File Index 00 -- event packets only */
76 | {
77 | /* .Movename = */ DS_EMPTY_STRING,
78 | /* .Pathname = */ "set_by_cmd_b4_enable",
79 | /* .Basename = */ "events",
80 | /* .Extension = */ ".dat",
81 |
82 | /* .FileNameType = */ DS_BY_COUNT,
83 | /* .EnableState = */ DS_DISABLED,
84 | /* .MaxFileSize = */ (1024 * 32), /* 32 K-bytes */
85 | /* .MaxFileAge = */ (60 * 45), /* 45 minutes */
86 | /* .SequenceCount = */ 1000,
87 | },
88 | /* File Index 01 -- application housekeeping packets */
89 | {
90 | /* .Movename = */ DS_EMPTY_STRING,
91 | /* .Pathname = */ "set_by_cmd_b4_enable",
92 | /* .Basename = */ "app",
93 | /* .Extension = */ ".hk",
94 |
95 | /* .FileNameType = */ DS_BY_TIME,
96 | /* .EnableState = */ DS_DISABLED,
97 | /* .MaxFileSize = */ (1024 * 1024 * 2), /* 2 M-bytes */
98 | /* .MaxFileAge = */ (60 * 60 * 2), /* 2 hours */
99 | /* .SequenceCount = */ DS_UNUSED,
100 | },
101 | /* File Index 02 -- application telemetry packets */
102 | {
103 | /* .Movename = */ DS_EMPTY_STRING,
104 | /* .Pathname = */ "set_by_cmd_b4_enable",
105 | /* .Basename = */ "app",
106 | /* .Extension = */ ".tlm",
107 |
108 | /* .FileNameType = */ DS_BY_COUNT,
109 | /* .EnableState = */ DS_DISABLED,
110 | /* .MaxFileSize = */ (1024 * 1024 * 1024 * 1), /* 1 G-byte */
111 | /* .MaxFileAge = */ (60 * 60 * 2), /* 2 hours */
112 | /* .SequenceCount = */ 2000,
113 | },
114 | /* File Index 03 -- hardware telemetry packets */
115 | {
116 | /* .Movename = */ DS_EMPTY_STRING,
117 | /* .Pathname = */ "set_by_cmd_b4_enable",
118 | /* .Basename = */ "hw",
119 | /* .Extension = */ "tlm",
120 |
121 | /* .FileNameType = */ DS_BY_COUNT,
122 | /* .EnableState = */ DS_DISABLED,
123 | /* .MaxFileSize = */ (1024 * 1024 * 2), /* 2 M-bytes */
124 | /* .MaxFileAge = */ (60 * 60 * 2), /* 2 hours */
125 | /* .SequenceCount = */ 3000,
126 | },
127 | /* File Index 04 -- cFE housekeeping packets */
128 | {
129 | /* .Movename = */ DS_EMPTY_STRING,
130 | /* .Pathname = */ "set_by_cmd_b4_enable",
131 | /* .Basename = */ "cfe",
132 | /* .Extension = */ "hk",
133 |
134 | /* .FileNameType = */ DS_BY_COUNT,
135 | /* .EnableState = */ DS_DISABLED,
136 | /* .MaxFileSize = */ (1024 * 1024 * 2), /* 2 M-bytes */
137 | /* .MaxFileAge = */ (60 * 60 * 2), /* 2 hours */
138 | /* .SequenceCount = */ 4000,
139 | },
140 | /* File Index 05 -- cFE telemetry packets */
141 | {
142 | /* .Movename = */ DS_EMPTY_STRING,
143 | /* .Pathname = */ "set_by_cmd_b4_enable",
144 | /* .Basename = */ "cfe",
145 | /* .Extension = */ "tlm",
146 |
147 | /* .FileNameType = */ DS_BY_COUNT,
148 | /* .EnableState = */ DS_DISABLED,
149 | /* .MaxFileSize = */ (1024 * 1024 * 2), /* 2 M-bytes */
150 | /* .MaxFileAge = */ (60 * 60 * 2), /* 2 hours */
151 | /* .SequenceCount = */ 5000,
152 | },
153 | /* File Index 06 */
154 | {
155 | /* .Movename = */ DS_EMPTY_STRING,
156 | /* .Pathname = */ DS_EMPTY_STRING,
157 | /* .Basename = */ DS_EMPTY_STRING,
158 | /* .Extension = */ DS_EMPTY_STRING,
159 |
160 | /* .FileNameType = */ DS_UNUSED,
161 | /* .EnableState = */ DS_UNUSED,
162 | /* .MaxFileSize = */ DS_UNUSED,
163 | /* .MaxFileAge = */ DS_UNUSED,
164 | /* .SequenceCount = */ DS_UNUSED,
165 | },
166 | /* File Index 07 */
167 | {
168 | /* .Movename = */ DS_EMPTY_STRING,
169 | /* .Pathname = */ DS_EMPTY_STRING,
170 | /* .Basename = */ DS_EMPTY_STRING,
171 | /* .Extension = */ DS_EMPTY_STRING,
172 |
173 | /* .FileNameType = */ DS_UNUSED,
174 | /* .EnableState = */ DS_UNUSED,
175 | /* .MaxFileSize = */ DS_UNUSED,
176 | /* .MaxFileAge = */ DS_UNUSED,
177 | /* .SequenceCount = */ DS_UNUSED,
178 | },
179 | /* File Index 08 */
180 | {
181 | /* .Movename = */ DS_EMPTY_STRING,
182 | /* .Pathname = */ DS_EMPTY_STRING,
183 | /* .Basename = */ DS_EMPTY_STRING,
184 | /* .Extension = */ DS_EMPTY_STRING,
185 |
186 | /* .FileNameType = */ DS_UNUSED,
187 | /* .EnableState = */ DS_UNUSED,
188 | /* .MaxFileSize = */ DS_UNUSED,
189 | /* .MaxFileAge = */ DS_UNUSED,
190 | /* .SequenceCount = */ DS_UNUSED,
191 | },
192 | /* File Index 09 */
193 | {
194 | /* .Movename = */ DS_EMPTY_STRING,
195 | /* .Pathname = */ DS_EMPTY_STRING,
196 | /* .Basename = */ DS_EMPTY_STRING,
197 | /* .Extension = */ DS_EMPTY_STRING,
198 |
199 | /* .FileNameType = */ DS_UNUSED,
200 | /* .EnableState = */ DS_UNUSED,
201 | /* .MaxFileSize = */ DS_UNUSED,
202 | /* .MaxFileAge = */ DS_UNUSED,
203 | /* .SequenceCount = */ DS_UNUSED,
204 | },
205 | /* File Index 10 */
206 | {
207 | /* .Movename = */ DS_EMPTY_STRING,
208 | /* .Pathname = */ DS_EMPTY_STRING,
209 | /* .Basename = */ DS_EMPTY_STRING,
210 | /* .Extension = */ DS_EMPTY_STRING,
211 |
212 | /* .FileNameType = */ DS_UNUSED,
213 | /* .EnableState = */ DS_UNUSED,
214 | /* .MaxFileSize = */ DS_UNUSED,
215 | /* .MaxFileAge = */ DS_UNUSED,
216 | /* .SequenceCount = */ DS_UNUSED,
217 | },
218 | /* File Index 11 */
219 | {
220 | /* .Movename = */ DS_EMPTY_STRING,
221 | /* .Pathname = */ DS_EMPTY_STRING,
222 | /* .Basename = */ DS_EMPTY_STRING,
223 | /* .Extension = */ DS_EMPTY_STRING,
224 |
225 | /* .FileNameType = */ DS_UNUSED,
226 | /* .EnableState = */ DS_UNUSED,
227 | /* .MaxFileSize = */ DS_UNUSED,
228 | /* .MaxFileAge = */ DS_UNUSED,
229 | /* .SequenceCount = */ DS_UNUSED,
230 | },
231 | /* File Index 12 */
232 | {
233 | /* .Movename = */ DS_EMPTY_STRING,
234 | /* .Pathname = */ DS_EMPTY_STRING,
235 | /* .Basename = */ DS_EMPTY_STRING,
236 | /* .Extension = */ DS_EMPTY_STRING,
237 |
238 | /* .FileNameType = */ DS_UNUSED,
239 | /* .EnableState = */ DS_UNUSED,
240 | /* .MaxFileSize = */ DS_UNUSED,
241 | /* .MaxFileAge = */ DS_UNUSED,
242 | /* .SequenceCount = */ DS_UNUSED,
243 | },
244 | /* File Index 13 */
245 | {
246 | /* .Movename = */ DS_EMPTY_STRING,
247 | /* .Pathname = */ DS_EMPTY_STRING,
248 | /* .Basename = */ DS_EMPTY_STRING,
249 | /* .Extension = */ DS_EMPTY_STRING,
250 |
251 | /* .FileNameType = */ DS_UNUSED,
252 | /* .EnableState = */ DS_UNUSED,
253 | /* .MaxFileSize = */ DS_UNUSED,
254 | /* .MaxFileAge = */ DS_UNUSED,
255 | /* .SequenceCount = */ DS_UNUSED,
256 | },
257 | /* File Index 14 */
258 | {
259 | /* .Movename = */ DS_EMPTY_STRING,
260 | /* .Pathname = */ DS_EMPTY_STRING,
261 | /* .Basename = */ DS_EMPTY_STRING,
262 | /* .Extension = */ DS_EMPTY_STRING,
263 |
264 | /* .FileNameType = */ DS_UNUSED,
265 | /* .EnableState = */ DS_UNUSED,
266 | /* .MaxFileSize = */ DS_UNUSED,
267 | /* .MaxFileAge = */ DS_UNUSED,
268 | /* .SequenceCount = */ DS_UNUSED,
269 | },
270 | /* File Index 15 */
271 | {
272 | /* .Movename = */ DS_EMPTY_STRING,
273 | /* .Pathname = */ DS_EMPTY_STRING,
274 | /* .Basename = */ DS_EMPTY_STRING,
275 | /* .Extension = */ DS_EMPTY_STRING,
276 |
277 | /* .FileNameType = */ DS_UNUSED,
278 | /* .EnableState = */ DS_UNUSED,
279 | /* .MaxFileSize = */ DS_UNUSED,
280 | /* .MaxFileAge = */ DS_UNUSED,
281 | /* .SequenceCount = */ DS_UNUSED,
282 | },
283 | }};
284 |
285 | /*
286 | ** Sample Destination File Table Header
287 | */
288 | CFE_TBL_FILEDEF(DS_DestFileTable, DS.FILE_TBL, DS Destination File Table, ds_file_tbl.tbl)
289 |
290 | /************************/
291 | /* End of File Comment */
292 | /************************/
293 |
--------------------------------------------------------------------------------
/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/ds-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("ds_internal"
11 | utilities/ds_test_utils.c
12 | stubs/ds_app_stubs.c
13 | stubs/ds_cmds_stubs.c
14 | stubs/ds_dispatch_stubs.c
15 | stubs/ds_file_stubs.c
16 | stubs/ds_global_stubs.c
17 | stubs/ds_table_stubs.c
18 | stubs/stub_libc_stdio.c
19 | )
20 |
21 | # Link with the cfe core stubs and unit test assert libs
22 | target_link_libraries(coverage-ds_internal-stubs ut_core_api_stubs ut_assert)
23 |
24 | # Include and expose unit test utilities, fsw/inc, and fsw/src includes
25 | target_include_directories(coverage-ds_internal-stubs PUBLIC utilities)
26 | target_include_directories(coverage-ds_internal-stubs PUBLIC ../fsw/inc)
27 | target_include_directories(coverage-ds_internal-stubs PUBLIC ../fsw/src)
28 |
29 | # Stub includes needed for all targets
30 | include_directories(stubs)
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(ds "${UNIT_NAME}" "${TESTS_SOURCE_FILE}" "${CFS_DS_SOURCE_DIR}/${SRCFILE}")
49 |
50 | # Add dependency to utilities and internal stubs
51 | add_cfe_coverage_dependency(ds "${UNIT_NAME}" ds_internal)
52 |
53 | # Include overrides for unit under test
54 | target_include_directories(coverage-ds-${UNIT_NAME}-object BEFORE PRIVATE
55 | stubs/override_inc
56 | )
57 |
58 | endforeach()
59 |
--------------------------------------------------------------------------------
/unit-test/stubs/ds_app_stubs.c:
--------------------------------------------------------------------------------
1 | /************************************************************************
2 | * NASA Docket No. GSC-18,917-1, and identified as “CFS Data Storage
3 | * (DS) application version 2.6.1”
4 | *
5 | * Copyright (c) 2021 United States Government as represented by the
6 | * Administrator of the National Aeronautics and Space Administration.
7 | * All Rights Reserved.
8 | *
9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
10 | * not use this file except in compliance with the License. You may obtain
11 | * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | ************************************************************************/
19 |
20 | /**
21 | * @file
22 | *
23 | * Auto-Generated stub implementations for functions defined in ds_app header
24 | */
25 |
26 | #include "ds_app.h"
27 | #include "utgenstub.h"
28 |
29 | /*
30 | * ----------------------------------------------------
31 | * Generated stub function for DS_AppInitialize()
32 | * ----------------------------------------------------
33 | */
34 | CFE_Status_t DS_AppInitialize(void)
35 | {
36 | UT_GenStub_SetupReturnBuffer(DS_AppInitialize, CFE_Status_t);
37 |
38 | UT_GenStub_Execute(DS_AppInitialize, Basic, NULL);
39 |
40 | return UT_GenStub_GetReturnValue(DS_AppInitialize, CFE_Status_t);
41 | }
42 |
43 | /*
44 | * ----------------------------------------------------
45 | * Generated stub function for DS_AppMain()
46 | * ----------------------------------------------------
47 | */
48 | void DS_AppMain(void)
49 | {
50 |
51 | UT_GenStub_Execute(DS_AppMain, Basic, NULL);
52 | }
53 |
54 | /*
55 | * ----------------------------------------------------
56 | * Generated stub function for DS_AppSendHkCmd()
57 | * ----------------------------------------------------
58 | */
59 | void DS_AppSendHkCmd(void)
60 | {
61 |
62 | UT_GenStub_Execute(DS_AppSendHkCmd, Basic, NULL);
63 | }
64 |
65 | /*
66 | * ----------------------------------------------------
67 | * Generated stub function for DS_AppStorePacket()
68 | * ----------------------------------------------------
69 | */
70 | void DS_AppStorePacket(CFE_SB_MsgId_t MessageID, const CFE_SB_Buffer_t *BufPtr)
71 | {
72 | UT_GenStub_AddParam(DS_AppStorePacket, CFE_SB_MsgId_t, MessageID);
73 | UT_GenStub_AddParam(DS_AppStorePacket, const CFE_SB_Buffer_t *, BufPtr);
74 |
75 | UT_GenStub_Execute(DS_AppStorePacket, Basic, NULL);
76 | }
77 |
--------------------------------------------------------------------------------
/unit-test/stubs/ds_cmds_stubs.c:
--------------------------------------------------------------------------------
1 | /************************************************************************
2 | * NASA Docket No. GSC-18,917-1, and identified as “CFS Data Storage
3 | * (DS) application version 2.6.1”
4 | *
5 | * Copyright (c) 2021 United States Government as represented by the
6 | * Administrator of the National Aeronautics and Space Administration.
7 | * All Rights Reserved.
8 | *
9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
10 | * not use this file except in compliance with the License. You may obtain
11 | * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | ************************************************************************/
19 |
20 | /**
21 | * @file
22 | *
23 | * Auto-Generated stub implementations for functions defined in ds_cmds header
24 | */
25 |
26 | #include "ds_cmds.h"
27 | #include "utgenstub.h"
28 |
29 | /*
30 | * ----------------------------------------------------
31 | * Generated stub function for DS_AddMIDCmd()
32 | * ----------------------------------------------------
33 | */
34 | void DS_AddMIDCmd(const CFE_SB_Buffer_t *BufPtr)
35 | {
36 | UT_GenStub_AddParam(DS_AddMIDCmd, const CFE_SB_Buffer_t *, BufPtr);
37 |
38 | UT_GenStub_Execute(DS_AddMIDCmd, Basic, NULL);
39 | }
40 |
41 | /*
42 | * ----------------------------------------------------
43 | * Generated stub function for DS_CloseAllCmd()
44 | * ----------------------------------------------------
45 | */
46 | void DS_CloseAllCmd(const CFE_SB_Buffer_t *BufPtr)
47 | {
48 | UT_GenStub_AddParam(DS_CloseAllCmd, const CFE_SB_Buffer_t *, BufPtr);
49 |
50 | UT_GenStub_Execute(DS_CloseAllCmd, Basic, NULL);
51 | }
52 |
53 | /*
54 | * ----------------------------------------------------
55 | * Generated stub function for DS_CloseFileCmd()
56 | * ----------------------------------------------------
57 | */
58 | void DS_CloseFileCmd(const CFE_SB_Buffer_t *BufPtr)
59 | {
60 | UT_GenStub_AddParam(DS_CloseFileCmd, const CFE_SB_Buffer_t *, BufPtr);
61 |
62 | UT_GenStub_Execute(DS_CloseFileCmd, Basic, NULL);
63 | }
64 |
65 | /*
66 | * ----------------------------------------------------
67 | * Generated stub function for DS_GetFileInfoCmd()
68 | * ----------------------------------------------------
69 | */
70 | void DS_GetFileInfoCmd(const CFE_SB_Buffer_t *BufPtr)
71 | {
72 | UT_GenStub_AddParam(DS_GetFileInfoCmd, const CFE_SB_Buffer_t *, BufPtr);
73 |
74 | UT_GenStub_Execute(DS_GetFileInfoCmd, Basic, NULL);
75 | }
76 |
77 | /*
78 | * ----------------------------------------------------
79 | * Generated stub function for DS_NoopCmd()
80 | * ----------------------------------------------------
81 | */
82 | void DS_NoopCmd(const CFE_SB_Buffer_t *BufPtr)
83 | {
84 | UT_GenStub_AddParam(DS_NoopCmd, const CFE_SB_Buffer_t *, BufPtr);
85 |
86 | UT_GenStub_Execute(DS_NoopCmd, Basic, NULL);
87 | }
88 |
89 | /*
90 | * ----------------------------------------------------
91 | * Generated stub function for DS_RemoveMIDCmd()
92 | * ----------------------------------------------------
93 | */
94 | void DS_RemoveMIDCmd(const CFE_SB_Buffer_t *BufPtr)
95 | {
96 | UT_GenStub_AddParam(DS_RemoveMIDCmd, const CFE_SB_Buffer_t *, BufPtr);
97 |
98 | UT_GenStub_Execute(DS_RemoveMIDCmd, Basic, NULL);
99 | }
100 |
101 | /*
102 | * ----------------------------------------------------
103 | * Generated stub function for DS_ResetCountersCmd()
104 | * ----------------------------------------------------
105 | */
106 | void DS_ResetCountersCmd(const CFE_SB_Buffer_t *BufPtr)
107 | {
108 | UT_GenStub_AddParam(DS_ResetCountersCmd, const CFE_SB_Buffer_t *, BufPtr);
109 |
110 | UT_GenStub_Execute(DS_ResetCountersCmd, Basic, NULL);
111 | }
112 |
113 | /*
114 | * ----------------------------------------------------
115 | * Generated stub function for DS_SetAppStateCmd()
116 | * ----------------------------------------------------
117 | */
118 | void DS_SetAppStateCmd(const CFE_SB_Buffer_t *BufPtr)
119 | {
120 | UT_GenStub_AddParam(DS_SetAppStateCmd, const CFE_SB_Buffer_t *, BufPtr);
121 |
122 | UT_GenStub_Execute(DS_SetAppStateCmd, Basic, NULL);
123 | }
124 |
125 | /*
126 | * ----------------------------------------------------
127 | * Generated stub function for DS_SetDestAgeCmd()
128 | * ----------------------------------------------------
129 | */
130 | void DS_SetDestAgeCmd(const CFE_SB_Buffer_t *BufPtr)
131 | {
132 | UT_GenStub_AddParam(DS_SetDestAgeCmd, const CFE_SB_Buffer_t *, BufPtr);
133 |
134 | UT_GenStub_Execute(DS_SetDestAgeCmd, Basic, NULL);
135 | }
136 |
137 | /*
138 | * ----------------------------------------------------
139 | * Generated stub function for DS_SetDestBaseCmd()
140 | * ----------------------------------------------------
141 | */
142 | void DS_SetDestBaseCmd(const CFE_SB_Buffer_t *BufPtr)
143 | {
144 | UT_GenStub_AddParam(DS_SetDestBaseCmd, const CFE_SB_Buffer_t *, BufPtr);
145 |
146 | UT_GenStub_Execute(DS_SetDestBaseCmd, Basic, NULL);
147 | }
148 |
149 | /*
150 | * ----------------------------------------------------
151 | * Generated stub function for DS_SetDestCountCmd()
152 | * ----------------------------------------------------
153 | */
154 | void DS_SetDestCountCmd(const CFE_SB_Buffer_t *BufPtr)
155 | {
156 | UT_GenStub_AddParam(DS_SetDestCountCmd, const CFE_SB_Buffer_t *, BufPtr);
157 |
158 | UT_GenStub_Execute(DS_SetDestCountCmd, Basic, NULL);
159 | }
160 |
161 | /*
162 | * ----------------------------------------------------
163 | * Generated stub function for DS_SetDestExtCmd()
164 | * ----------------------------------------------------
165 | */
166 | void DS_SetDestExtCmd(const CFE_SB_Buffer_t *BufPtr)
167 | {
168 | UT_GenStub_AddParam(DS_SetDestExtCmd, const CFE_SB_Buffer_t *, BufPtr);
169 |
170 | UT_GenStub_Execute(DS_SetDestExtCmd, Basic, NULL);
171 | }
172 |
173 | /*
174 | * ----------------------------------------------------
175 | * Generated stub function for DS_SetDestPathCmd()
176 | * ----------------------------------------------------
177 | */
178 | void DS_SetDestPathCmd(const CFE_SB_Buffer_t *BufPtr)
179 | {
180 | UT_GenStub_AddParam(DS_SetDestPathCmd, const CFE_SB_Buffer_t *, BufPtr);
181 |
182 | UT_GenStub_Execute(DS_SetDestPathCmd, Basic, NULL);
183 | }
184 |
185 | /*
186 | * ----------------------------------------------------
187 | * Generated stub function for DS_SetDestSizeCmd()
188 | * ----------------------------------------------------
189 | */
190 | void DS_SetDestSizeCmd(const CFE_SB_Buffer_t *BufPtr)
191 | {
192 | UT_GenStub_AddParam(DS_SetDestSizeCmd, const CFE_SB_Buffer_t *, BufPtr);
193 |
194 | UT_GenStub_Execute(DS_SetDestSizeCmd, Basic, NULL);
195 | }
196 |
197 | /*
198 | * ----------------------------------------------------
199 | * Generated stub function for DS_SetDestStateCmd()
200 | * ----------------------------------------------------
201 | */
202 | void DS_SetDestStateCmd(const CFE_SB_Buffer_t *BufPtr)
203 | {
204 | UT_GenStub_AddParam(DS_SetDestStateCmd, const CFE_SB_Buffer_t *, BufPtr);
205 |
206 | UT_GenStub_Execute(DS_SetDestStateCmd, Basic, NULL);
207 | }
208 |
209 | /*
210 | * ----------------------------------------------------
211 | * Generated stub function for DS_SetDestTypeCmd()
212 | * ----------------------------------------------------
213 | */
214 | void DS_SetDestTypeCmd(const CFE_SB_Buffer_t *BufPtr)
215 | {
216 | UT_GenStub_AddParam(DS_SetDestTypeCmd, const CFE_SB_Buffer_t *, BufPtr);
217 |
218 | UT_GenStub_Execute(DS_SetDestTypeCmd, Basic, NULL);
219 | }
220 |
221 | /*
222 | * ----------------------------------------------------
223 | * Generated stub function for DS_SetFilterFileCmd()
224 | * ----------------------------------------------------
225 | */
226 | void DS_SetFilterFileCmd(const CFE_SB_Buffer_t *BufPtr)
227 | {
228 | UT_GenStub_AddParam(DS_SetFilterFileCmd, const CFE_SB_Buffer_t *, BufPtr);
229 |
230 | UT_GenStub_Execute(DS_SetFilterFileCmd, Basic, NULL);
231 | }
232 |
233 | /*
234 | * ----------------------------------------------------
235 | * Generated stub function for DS_SetFilterParmsCmd()
236 | * ----------------------------------------------------
237 | */
238 | void DS_SetFilterParmsCmd(const CFE_SB_Buffer_t *BufPtr)
239 | {
240 | UT_GenStub_AddParam(DS_SetFilterParmsCmd, const CFE_SB_Buffer_t *, BufPtr);
241 |
242 | UT_GenStub_Execute(DS_SetFilterParmsCmd, Basic, NULL);
243 | }
244 |
245 | /*
246 | * ----------------------------------------------------
247 | * Generated stub function for DS_SetFilterTypeCmd()
248 | * ----------------------------------------------------
249 | */
250 | void DS_SetFilterTypeCmd(const CFE_SB_Buffer_t *BufPtr)
251 | {
252 | UT_GenStub_AddParam(DS_SetFilterTypeCmd, const CFE_SB_Buffer_t *, BufPtr);
253 |
254 | UT_GenStub_Execute(DS_SetFilterTypeCmd, Basic, NULL);
255 | }
256 |
--------------------------------------------------------------------------------
/unit-test/stubs/ds_dispatch_stubs.c:
--------------------------------------------------------------------------------
1 | /************************************************************************
2 | * NASA Docket No. GSC-18,917-1, and identified as “CFS Data Storage
3 | * (DS) application version 2.6.1”
4 | *
5 | * Copyright (c) 2021 United States Government as represented by the
6 | * Administrator of the National Aeronautics and Space Administration.
7 | * All Rights Reserved.
8 | *
9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
10 | * not use this file except in compliance with the License. You may obtain
11 | * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | ************************************************************************/
19 |
20 | /**
21 | * @file
22 | *
23 | * Auto-Generated stub implementations for functions defined in ds_dispatch header
24 | */
25 |
26 | #include "ds_dispatch.h"
27 | #include "utgenstub.h"
28 |
29 | /*
30 | * ----------------------------------------------------
31 | * Generated stub function for DS_AppProcessCmd()
32 | * ----------------------------------------------------
33 | */
34 | void DS_AppProcessCmd(const CFE_SB_Buffer_t *BufPtr)
35 | {
36 | UT_GenStub_AddParam(DS_AppProcessCmd, const CFE_SB_Buffer_t *, BufPtr);
37 |
38 | UT_GenStub_Execute(DS_AppProcessCmd, Basic, NULL);
39 | }
40 |
41 | /*
42 | * ----------------------------------------------------
43 | * Generated stub function for DS_AppProcessMsg()
44 | * ----------------------------------------------------
45 | */
46 | void DS_AppProcessMsg(const CFE_SB_Buffer_t *BufPtr)
47 | {
48 | UT_GenStub_AddParam(DS_AppProcessMsg, const CFE_SB_Buffer_t *, BufPtr);
49 |
50 | UT_GenStub_Execute(DS_AppProcessMsg, Basic, NULL);
51 | }
52 |
--------------------------------------------------------------------------------
/unit-test/stubs/ds_file_stubs.c:
--------------------------------------------------------------------------------
1 | /************************************************************************
2 | * NASA Docket No. GSC-18,917-1, and identified as “CFS Data Storage
3 | * (DS) application version 2.6.1”
4 | *
5 | * Copyright (c) 2021 United States Government as represented by the
6 | * Administrator of the National Aeronautics and Space Administration.
7 | * All Rights Reserved.
8 | *
9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
10 | * not use this file except in compliance with the License. You may obtain
11 | * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | ************************************************************************/
19 |
20 | /**
21 | * @file
22 | *
23 | * Auto-Generated stub implementations for functions defined in ds_file header
24 | */
25 |
26 | #include "ds_file.h"
27 | #include "utgenstub.h"
28 |
29 | /*
30 | * ----------------------------------------------------
31 | * Generated stub function for DS_FileCloseDest()
32 | * ----------------------------------------------------
33 | */
34 | void DS_FileCloseDest(int32 FileIndex)
35 | {
36 | UT_GenStub_AddParam(DS_FileCloseDest, int32, FileIndex);
37 |
38 | UT_GenStub_Execute(DS_FileCloseDest, Basic, NULL);
39 | }
40 |
41 | /*
42 | * ----------------------------------------------------
43 | * Generated stub function for DS_FileCreateDest()
44 | * ----------------------------------------------------
45 | */
46 | void DS_FileCreateDest(uint32 FileIndex)
47 | {
48 | UT_GenStub_AddParam(DS_FileCreateDest, uint32, FileIndex);
49 |
50 | UT_GenStub_Execute(DS_FileCreateDest, Basic, NULL);
51 | }
52 |
53 | /*
54 | * ----------------------------------------------------
55 | * Generated stub function for DS_FileCreateName()
56 | * ----------------------------------------------------
57 | */
58 | void DS_FileCreateName(uint32 FileIndex)
59 | {
60 | UT_GenStub_AddParam(DS_FileCreateName, uint32, FileIndex);
61 |
62 | UT_GenStub_Execute(DS_FileCreateName, Basic, NULL);
63 | }
64 |
65 | /*
66 | * ----------------------------------------------------
67 | * Generated stub function for DS_FileCreateSequence()
68 | * ----------------------------------------------------
69 | */
70 | void DS_FileCreateSequence(char *Buffer, uint32 Type, uint32 Count)
71 | {
72 | UT_GenStub_AddParam(DS_FileCreateSequence, char *, Buffer);
73 | UT_GenStub_AddParam(DS_FileCreateSequence, uint32, Type);
74 | UT_GenStub_AddParam(DS_FileCreateSequence, uint32, Count);
75 |
76 | UT_GenStub_Execute(DS_FileCreateSequence, Basic, NULL);
77 | }
78 |
79 | /*
80 | * ----------------------------------------------------
81 | * Generated stub function for DS_FileSetupWrite()
82 | * ----------------------------------------------------
83 | */
84 | void DS_FileSetupWrite(int32 FileIndex, const CFE_SB_Buffer_t *BufPtr)
85 | {
86 | UT_GenStub_AddParam(DS_FileSetupWrite, int32, FileIndex);
87 | UT_GenStub_AddParam(DS_FileSetupWrite, const CFE_SB_Buffer_t *, BufPtr);
88 |
89 | UT_GenStub_Execute(DS_FileSetupWrite, Basic, NULL);
90 | }
91 |
92 | /*
93 | * ----------------------------------------------------
94 | * Generated stub function for DS_FileStorePacket()
95 | * ----------------------------------------------------
96 | */
97 | void DS_FileStorePacket(CFE_SB_MsgId_t MessageID, const CFE_SB_Buffer_t *BufPtr)
98 | {
99 | UT_GenStub_AddParam(DS_FileStorePacket, CFE_SB_MsgId_t, MessageID);
100 | UT_GenStub_AddParam(DS_FileStorePacket, const CFE_SB_Buffer_t *, BufPtr);
101 |
102 | UT_GenStub_Execute(DS_FileStorePacket, Basic, NULL);
103 | }
104 |
105 | /*
106 | * ----------------------------------------------------
107 | * Generated stub function for DS_FileTestAge()
108 | * ----------------------------------------------------
109 | */
110 | void DS_FileTestAge(uint32 ElapsedSeconds)
111 | {
112 | UT_GenStub_AddParam(DS_FileTestAge, uint32, ElapsedSeconds);
113 |
114 | UT_GenStub_Execute(DS_FileTestAge, Basic, NULL);
115 | }
116 |
117 | /*
118 | * ----------------------------------------------------
119 | * Generated stub function for DS_FileTransmit()
120 | * ----------------------------------------------------
121 | */
122 | void DS_FileTransmit(DS_AppFileStatus_t *FileStatus)
123 | {
124 | UT_GenStub_AddParam(DS_FileTransmit, DS_AppFileStatus_t *, FileStatus);
125 |
126 | UT_GenStub_Execute(DS_FileTransmit, Basic, NULL);
127 | }
128 |
129 | /*
130 | * ----------------------------------------------------
131 | * Generated stub function for DS_FileUpdateHeader()
132 | * ----------------------------------------------------
133 | */
134 | void DS_FileUpdateHeader(int32 FileIndex)
135 | {
136 | UT_GenStub_AddParam(DS_FileUpdateHeader, int32, FileIndex);
137 |
138 | UT_GenStub_Execute(DS_FileUpdateHeader, Basic, NULL);
139 | }
140 |
141 | /*
142 | * ----------------------------------------------------
143 | * Generated stub function for DS_FileWriteData()
144 | * ----------------------------------------------------
145 | */
146 | void DS_FileWriteData(int32 FileIndex, const void *FileData, uint32 DataLength)
147 | {
148 | UT_GenStub_AddParam(DS_FileWriteData, int32, FileIndex);
149 | UT_GenStub_AddParam(DS_FileWriteData, const void *, FileData);
150 | UT_GenStub_AddParam(DS_FileWriteData, uint32, DataLength);
151 |
152 | UT_GenStub_Execute(DS_FileWriteData, Basic, NULL);
153 | }
154 |
155 | /*
156 | * ----------------------------------------------------
157 | * Generated stub function for DS_FileWriteError()
158 | * ----------------------------------------------------
159 | */
160 | void DS_FileWriteError(uint32 FileIndex, uint32 DataLength, int32 WriteResult)
161 | {
162 | UT_GenStub_AddParam(DS_FileWriteError, uint32, FileIndex);
163 | UT_GenStub_AddParam(DS_FileWriteError, uint32, DataLength);
164 | UT_GenStub_AddParam(DS_FileWriteError, int32, WriteResult);
165 |
166 | UT_GenStub_Execute(DS_FileWriteError, Basic, NULL);
167 | }
168 |
169 | /*
170 | * ----------------------------------------------------
171 | * Generated stub function for DS_FileWriteHeader()
172 | * ----------------------------------------------------
173 | */
174 | void DS_FileWriteHeader(int32 FileIndex)
175 | {
176 | UT_GenStub_AddParam(DS_FileWriteHeader, int32, FileIndex);
177 |
178 | UT_GenStub_Execute(DS_FileWriteHeader, Basic, NULL);
179 | }
180 |
181 | /*
182 | * ----------------------------------------------------
183 | * Generated stub function for DS_IsPacketFiltered()
184 | * ----------------------------------------------------
185 | */
186 | bool DS_IsPacketFiltered(CFE_MSG_Message_t *MessagePtr, uint16 FilterType, uint16 Algorithm_N, uint16 Algorithm_X,
187 | uint16 Algorithm_O)
188 | {
189 | UT_GenStub_SetupReturnBuffer(DS_IsPacketFiltered, bool);
190 |
191 | UT_GenStub_AddParam(DS_IsPacketFiltered, CFE_MSG_Message_t *, MessagePtr);
192 | UT_GenStub_AddParam(DS_IsPacketFiltered, uint16, FilterType);
193 | UT_GenStub_AddParam(DS_IsPacketFiltered, uint16, Algorithm_N);
194 | UT_GenStub_AddParam(DS_IsPacketFiltered, uint16, Algorithm_X);
195 | UT_GenStub_AddParam(DS_IsPacketFiltered, uint16, Algorithm_O);
196 |
197 | UT_GenStub_Execute(DS_IsPacketFiltered, Basic, NULL);
198 |
199 | return UT_GenStub_GetReturnValue(DS_IsPacketFiltered, bool);
200 | }
201 |
--------------------------------------------------------------------------------
/unit-test/stubs/ds_global_stubs.c:
--------------------------------------------------------------------------------
1 | /************************************************************************
2 | * NASA Docket No. GSC-18,917-1, and identified as “CFS Data Storage
3 | * (DS) application version 2.6.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 testing stubs for the ds_app.c file.
23 | */
24 |
25 | #include "ds_app.h"
26 |
27 | /* UT includes */
28 | #include "uttest.h"
29 | #include "utassert.h"
30 | #include "utstubs.h"
31 |
32 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
33 | /* */
34 | /* Application global data structure */
35 | /* */
36 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
37 |
38 | DS_AppData_t DS_AppData;
39 |
--------------------------------------------------------------------------------
/unit-test/stubs/ds_table_stubs.c:
--------------------------------------------------------------------------------
1 | /************************************************************************
2 | * NASA Docket No. GSC-18,917-1, and identified as “CFS Data Storage
3 | * (DS) application version 2.6.1”
4 | *
5 | * Copyright (c) 2021 United States Government as represented by the
6 | * Administrator of the National Aeronautics and Space Administration.
7 | * All Rights Reserved.
8 | *
9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
10 | * not use this file except in compliance with the License. You may obtain
11 | * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | ************************************************************************/
19 |
20 | /**
21 | * @file
22 | *
23 | * Auto-Generated stub implementations for functions defined in ds_table header
24 | */
25 |
26 | #include "ds_table.h"
27 | #include "utgenstub.h"
28 |
29 | /*
30 | * ----------------------------------------------------
31 | * Generated stub function for DS_TableAddMsgID()
32 | * ----------------------------------------------------
33 | */
34 | int32 DS_TableAddMsgID(CFE_SB_MsgId_t MessageID, int32 FilterIndex)
35 | {
36 | UT_GenStub_SetupReturnBuffer(DS_TableAddMsgID, int32);
37 |
38 | UT_GenStub_AddParam(DS_TableAddMsgID, CFE_SB_MsgId_t, MessageID);
39 | UT_GenStub_AddParam(DS_TableAddMsgID, int32, FilterIndex);
40 |
41 | UT_GenStub_Execute(DS_TableAddMsgID, Basic, NULL);
42 |
43 | return UT_GenStub_GetReturnValue(DS_TableAddMsgID, int32);
44 | }
45 |
46 | /*
47 | * ----------------------------------------------------
48 | * Generated stub function for DS_TableCreateCDS()
49 | * ----------------------------------------------------
50 | */
51 | CFE_Status_t DS_TableCreateCDS(void)
52 | {
53 | UT_GenStub_SetupReturnBuffer(DS_TableCreateCDS, CFE_Status_t);
54 |
55 | UT_GenStub_Execute(DS_TableCreateCDS, Basic, NULL);
56 |
57 | return UT_GenStub_GetReturnValue(DS_TableCreateCDS, CFE_Status_t);
58 | }
59 |
60 | /*
61 | * ----------------------------------------------------
62 | * Generated stub function for DS_TableCreateHash()
63 | * ----------------------------------------------------
64 | */
65 | void DS_TableCreateHash(void)
66 | {
67 |
68 | UT_GenStub_Execute(DS_TableCreateHash, Basic, NULL);
69 | }
70 |
71 | /*
72 | * ----------------------------------------------------
73 | * Generated stub function for DS_TableEntryUnused()
74 | * ----------------------------------------------------
75 | */
76 | bool DS_TableEntryUnused(const void *TableEntry, int32 BufferSize)
77 | {
78 | UT_GenStub_SetupReturnBuffer(DS_TableEntryUnused, bool);
79 |
80 | UT_GenStub_AddParam(DS_TableEntryUnused, const void *, TableEntry);
81 | UT_GenStub_AddParam(DS_TableEntryUnused, int32, BufferSize);
82 |
83 | UT_GenStub_Execute(DS_TableEntryUnused, Basic, NULL);
84 |
85 | return UT_GenStub_GetReturnValue(DS_TableEntryUnused, bool);
86 | }
87 |
88 | /*
89 | * ----------------------------------------------------
90 | * Generated stub function for DS_TableFindMsgID()
91 | * ----------------------------------------------------
92 | */
93 | int32 DS_TableFindMsgID(CFE_SB_MsgId_t MessageID)
94 | {
95 | UT_GenStub_SetupReturnBuffer(DS_TableFindMsgID, int32);
96 |
97 | UT_GenStub_AddParam(DS_TableFindMsgID, CFE_SB_MsgId_t, MessageID);
98 |
99 | UT_GenStub_Execute(DS_TableFindMsgID, Basic, NULL);
100 |
101 | return UT_GenStub_GetReturnValue(DS_TableFindMsgID, int32);
102 | }
103 |
104 | /*
105 | * ----------------------------------------------------
106 | * Generated stub function for DS_TableHashFunction()
107 | * ----------------------------------------------------
108 | */
109 | uint32 DS_TableHashFunction(CFE_SB_MsgId_t MessageID)
110 | {
111 | UT_GenStub_SetupReturnBuffer(DS_TableHashFunction, uint32);
112 |
113 | UT_GenStub_AddParam(DS_TableHashFunction, CFE_SB_MsgId_t, MessageID);
114 |
115 | UT_GenStub_Execute(DS_TableHashFunction, Basic, NULL);
116 |
117 | return UT_GenStub_GetReturnValue(DS_TableHashFunction, uint32);
118 | }
119 |
120 | /*
121 | * ----------------------------------------------------
122 | * Generated stub function for DS_TableInit()
123 | * ----------------------------------------------------
124 | */
125 | CFE_Status_t DS_TableInit(void)
126 | {
127 | UT_GenStub_SetupReturnBuffer(DS_TableInit, CFE_Status_t);
128 |
129 | UT_GenStub_Execute(DS_TableInit, Basic, NULL);
130 |
131 | return UT_GenStub_GetReturnValue(DS_TableInit, CFE_Status_t);
132 | }
133 |
134 | /*
135 | * ----------------------------------------------------
136 | * Generated stub function for DS_TableManageDestFile()
137 | * ----------------------------------------------------
138 | */
139 | void DS_TableManageDestFile(void)
140 | {
141 |
142 | UT_GenStub_Execute(DS_TableManageDestFile, Basic, NULL);
143 | }
144 |
145 | /*
146 | * ----------------------------------------------------
147 | * Generated stub function for DS_TableManageFilter()
148 | * ----------------------------------------------------
149 | */
150 | void DS_TableManageFilter(void)
151 | {
152 |
153 | UT_GenStub_Execute(DS_TableManageFilter, Basic, NULL);
154 | }
155 |
156 | /*
157 | * ----------------------------------------------------
158 | * Generated stub function for DS_TableSubscribe()
159 | * ----------------------------------------------------
160 | */
161 | void DS_TableSubscribe(void)
162 | {
163 |
164 | UT_GenStub_Execute(DS_TableSubscribe, Basic, NULL);
165 | }
166 |
167 | /*
168 | * ----------------------------------------------------
169 | * Generated stub function for DS_TableUnsubscribe()
170 | * ----------------------------------------------------
171 | */
172 | void DS_TableUnsubscribe(void)
173 | {
174 |
175 | UT_GenStub_Execute(DS_TableUnsubscribe, Basic, NULL);
176 | }
177 |
178 | /*
179 | * ----------------------------------------------------
180 | * Generated stub function for DS_TableUpdateCDS()
181 | * ----------------------------------------------------
182 | */
183 | void DS_TableUpdateCDS(void)
184 | {
185 |
186 | UT_GenStub_Execute(DS_TableUpdateCDS, Basic, NULL);
187 | }
188 |
189 | /*
190 | * ----------------------------------------------------
191 | * Generated stub function for DS_TableVerifyAge()
192 | * ----------------------------------------------------
193 | */
194 | bool DS_TableVerifyAge(uint32 MaxFileAge)
195 | {
196 | UT_GenStub_SetupReturnBuffer(DS_TableVerifyAge, bool);
197 |
198 | UT_GenStub_AddParam(DS_TableVerifyAge, uint32, MaxFileAge);
199 |
200 | UT_GenStub_Execute(DS_TableVerifyAge, Basic, NULL);
201 |
202 | return UT_GenStub_GetReturnValue(DS_TableVerifyAge, bool);
203 | }
204 |
205 | /*
206 | * ----------------------------------------------------
207 | * Generated stub function for DS_TableVerifyCount()
208 | * ----------------------------------------------------
209 | */
210 | bool DS_TableVerifyCount(uint32 SequenceCount)
211 | {
212 | UT_GenStub_SetupReturnBuffer(DS_TableVerifyCount, bool);
213 |
214 | UT_GenStub_AddParam(DS_TableVerifyCount, uint32, SequenceCount);
215 |
216 | UT_GenStub_Execute(DS_TableVerifyCount, Basic, NULL);
217 |
218 | return UT_GenStub_GetReturnValue(DS_TableVerifyCount, bool);
219 | }
220 |
221 | /*
222 | * ----------------------------------------------------
223 | * Generated stub function for DS_TableVerifyDestFile()
224 | * ----------------------------------------------------
225 | */
226 | CFE_Status_t DS_TableVerifyDestFile(const void *TableData)
227 | {
228 | UT_GenStub_SetupReturnBuffer(DS_TableVerifyDestFile, CFE_Status_t);
229 |
230 | UT_GenStub_AddParam(DS_TableVerifyDestFile, const void *, TableData);
231 |
232 | UT_GenStub_Execute(DS_TableVerifyDestFile, Basic, NULL);
233 |
234 | return UT_GenStub_GetReturnValue(DS_TableVerifyDestFile, CFE_Status_t);
235 | }
236 |
237 | /*
238 | * ----------------------------------------------------
239 | * Generated stub function for DS_TableVerifyDestFileEntry()
240 | * ----------------------------------------------------
241 | */
242 | bool DS_TableVerifyDestFileEntry(DS_DestFileEntry_t *DestFileEntry, uint8 TableIndex, int32 ErrorCount)
243 | {
244 | UT_GenStub_SetupReturnBuffer(DS_TableVerifyDestFileEntry, bool);
245 |
246 | UT_GenStub_AddParam(DS_TableVerifyDestFileEntry, DS_DestFileEntry_t *, DestFileEntry);
247 | UT_GenStub_AddParam(DS_TableVerifyDestFileEntry, uint8, TableIndex);
248 | UT_GenStub_AddParam(DS_TableVerifyDestFileEntry, int32, ErrorCount);
249 |
250 | UT_GenStub_Execute(DS_TableVerifyDestFileEntry, Basic, NULL);
251 |
252 | return UT_GenStub_GetReturnValue(DS_TableVerifyDestFileEntry, bool);
253 | }
254 |
255 | /*
256 | * ----------------------------------------------------
257 | * Generated stub function for DS_TableVerifyFileIndex()
258 | * ----------------------------------------------------
259 | */
260 | bool DS_TableVerifyFileIndex(uint16 FileTableIndex)
261 | {
262 | UT_GenStub_SetupReturnBuffer(DS_TableVerifyFileIndex, bool);
263 |
264 | UT_GenStub_AddParam(DS_TableVerifyFileIndex, uint16, FileTableIndex);
265 |
266 | UT_GenStub_Execute(DS_TableVerifyFileIndex, Basic, NULL);
267 |
268 | return UT_GenStub_GetReturnValue(DS_TableVerifyFileIndex, bool);
269 | }
270 |
271 | /*
272 | * ----------------------------------------------------
273 | * Generated stub function for DS_TableVerifyFilter()
274 | * ----------------------------------------------------
275 | */
276 | CFE_Status_t DS_TableVerifyFilter(const void *TableData)
277 | {
278 | UT_GenStub_SetupReturnBuffer(DS_TableVerifyFilter, CFE_Status_t);
279 |
280 | UT_GenStub_AddParam(DS_TableVerifyFilter, const void *, TableData);
281 |
282 | UT_GenStub_Execute(DS_TableVerifyFilter, Basic, NULL);
283 |
284 | return UT_GenStub_GetReturnValue(DS_TableVerifyFilter, CFE_Status_t);
285 | }
286 |
287 | /*
288 | * ----------------------------------------------------
289 | * Generated stub function for DS_TableVerifyFilterEntry()
290 | * ----------------------------------------------------
291 | */
292 | bool DS_TableVerifyFilterEntry(DS_PacketEntry_t *PacketEntry, int32 TableIndex, int32 ErrorCount)
293 | {
294 | UT_GenStub_SetupReturnBuffer(DS_TableVerifyFilterEntry, bool);
295 |
296 | UT_GenStub_AddParam(DS_TableVerifyFilterEntry, DS_PacketEntry_t *, PacketEntry);
297 | UT_GenStub_AddParam(DS_TableVerifyFilterEntry, int32, TableIndex);
298 | UT_GenStub_AddParam(DS_TableVerifyFilterEntry, int32, ErrorCount);
299 |
300 | UT_GenStub_Execute(DS_TableVerifyFilterEntry, Basic, NULL);
301 |
302 | return UT_GenStub_GetReturnValue(DS_TableVerifyFilterEntry, bool);
303 | }
304 |
305 | /*
306 | * ----------------------------------------------------
307 | * Generated stub function for DS_TableVerifyParms()
308 | * ----------------------------------------------------
309 | */
310 | bool DS_TableVerifyParms(uint16 Algorithm_N, uint16 Algorithm_X, uint16 Algorithm_O)
311 | {
312 | UT_GenStub_SetupReturnBuffer(DS_TableVerifyParms, bool);
313 |
314 | UT_GenStub_AddParam(DS_TableVerifyParms, uint16, Algorithm_N);
315 | UT_GenStub_AddParam(DS_TableVerifyParms, uint16, Algorithm_X);
316 | UT_GenStub_AddParam(DS_TableVerifyParms, uint16, Algorithm_O);
317 |
318 | UT_GenStub_Execute(DS_TableVerifyParms, Basic, NULL);
319 |
320 | return UT_GenStub_GetReturnValue(DS_TableVerifyParms, bool);
321 | }
322 |
323 | /*
324 | * ----------------------------------------------------
325 | * Generated stub function for DS_TableVerifySize()
326 | * ----------------------------------------------------
327 | */
328 | bool DS_TableVerifySize(uint32 MaxFileSize)
329 | {
330 | UT_GenStub_SetupReturnBuffer(DS_TableVerifySize, bool);
331 |
332 | UT_GenStub_AddParam(DS_TableVerifySize, uint32, MaxFileSize);
333 |
334 | UT_GenStub_Execute(DS_TableVerifySize, Basic, NULL);
335 |
336 | return UT_GenStub_GetReturnValue(DS_TableVerifySize, bool);
337 | }
338 |
339 | /*
340 | * ----------------------------------------------------
341 | * Generated stub function for DS_TableVerifyState()
342 | * ----------------------------------------------------
343 | */
344 | bool DS_TableVerifyState(uint16 EnableState)
345 | {
346 | UT_GenStub_SetupReturnBuffer(DS_TableVerifyState, bool);
347 |
348 | UT_GenStub_AddParam(DS_TableVerifyState, uint16, EnableState);
349 |
350 | UT_GenStub_Execute(DS_TableVerifyState, Basic, NULL);
351 |
352 | return UT_GenStub_GetReturnValue(DS_TableVerifyState, bool);
353 | }
354 |
355 | /*
356 | * ----------------------------------------------------
357 | * Generated stub function for DS_TableVerifyType()
358 | * ----------------------------------------------------
359 | */
360 | bool DS_TableVerifyType(uint16 TimeVsCount)
361 | {
362 | UT_GenStub_SetupReturnBuffer(DS_TableVerifyType, bool);
363 |
364 | UT_GenStub_AddParam(DS_TableVerifyType, uint16, TimeVsCount);
365 |
366 | UT_GenStub_Execute(DS_TableVerifyType, Basic, NULL);
367 |
368 | return UT_GenStub_GetReturnValue(DS_TableVerifyType, bool);
369 | }
370 |
--------------------------------------------------------------------------------
/unit-test/stubs/override_inc/stdio.h:
--------------------------------------------------------------------------------
1 | /************************************************************************
2 | * NASA Docket No. GSC-18,917-1, and identified as “CFS Data Storage
3 | * (DS) application version 2.6.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 | * Coverage stub replacement for stdio.h
23 | */
24 |
25 | #ifndef OVERRIDE_STDIO_H
26 | #define OVERRIDE_STDIO_H
27 |
28 | #include "stub_stdio.h"
29 |
30 | /* ----------------------------------------- */
31 | /* mappings for declarations in stdio.h */
32 | /* ----------------------------------------- */
33 |
34 | #define FILE stub_FILE
35 | #define fclose stub_fclose
36 | #define fgets stub_fgets
37 | #define fopen stub_fopen
38 | #define fputs stub_fputs
39 | #define remove stub_remove
40 | #define rename stub_rename
41 | #define snprintf stub_snprintf
42 | #define vsnprintf stub_vsnprintf
43 | #define printf(...) stub_printf(__VA_ARGS__)
44 | #define fprintf(...) stub_fprintf(__VA_ARGS__)
45 | #define putchar stub_putchar
46 |
47 | #define stdin stub_stdin
48 | #define stdout stub_stdout
49 | #define stderr stub_stderr
50 |
51 | #endif
52 |
--------------------------------------------------------------------------------
/unit-test/stubs/stub_basetypes.h:
--------------------------------------------------------------------------------
1 | /************************************************************************
2 | * NASA Docket No. GSC-18,917-1, and identified as “CFS Data Storage
3 | * (DS) application version 2.6.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 | * Coverage stub basic data types
23 | */
24 |
25 | #ifndef STUB_BASETYPES_H
26 | #define STUB_BASETYPES_H
27 |
28 | /*
29 | * NOTE: These header files are intentionally _not_ overridden
30 | * in the replacement/override header directory, so this should
31 | * pull in the actual (native system) version of these files.
32 | *
33 | * It is important to pull in these definitions first before any
34 | * potential re-mapping (#define) statements are done.
35 | */
36 |
37 | #include /* for correct size_t and ptrdiff_t types */
38 | #include /* for correct fixed-width integer types */
39 | #include /* for correct INT_MAX, etc. */
40 | #include /* for correct boolean semantics */
41 |
42 | #endif
43 |
--------------------------------------------------------------------------------
/unit-test/stubs/stub_libc_stdio.c:
--------------------------------------------------------------------------------
1 | /************************************************************************
2 | * NASA Docket No. GSC-18,917-1, and identified as “CFS Data Storage
3 | * (DS) application version 2.6.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 | * Coverage stub replacement for stdio.h
23 | */
24 | #include
25 | #include
26 | #include
27 | #include "utstubs.h"
28 |
29 | #include "stub_stdio.h"
30 |
31 | struct stub_FILE
32 | {
33 | int f;
34 | };
35 |
36 | #define stub_STDIO_MAX_SIZE 0x01000000
37 |
38 | int stub_fclose(stub_FILE *stream)
39 | {
40 | int32 Status;
41 |
42 | Status = UT_DEFAULT_IMPL(stub_fclose);
43 |
44 | return Status;
45 | }
46 |
47 | char *stub_fgets(char *s, int n, stub_FILE *stream)
48 | {
49 | int32 Status;
50 | size_t CopySize;
51 |
52 | Status = UT_DEFAULT_IMPL_RC(stub_fgets, stub_STDIO_MAX_SIZE);
53 |
54 | if (Status > 0)
55 | {
56 | if (Status > n)
57 | {
58 | CopySize = n;
59 | }
60 | else
61 | {
62 | CopySize = Status;
63 | }
64 |
65 | CopySize = UT_Stub_CopyToLocal(UT_KEY(stub_fgets), s, CopySize);
66 |
67 | if (CopySize != 0)
68 | {
69 | Status = CopySize;
70 | }
71 | else if (Status <= n)
72 | {
73 | memset(s, 'x', Status);
74 | }
75 | else if (UT_GetStubCount(UT_KEY(stub_fgets) < 4))
76 | {
77 | memset(s, 'x', n);
78 | Status = n;
79 | }
80 | else
81 | {
82 | Status = 0;
83 | }
84 | }
85 |
86 | if (Status <= 0)
87 | {
88 | return NULL;
89 | }
90 |
91 | return s;
92 | }
93 |
94 | stub_FILE *stub_fopen(const char *filename, const char *modes)
95 | {
96 | int32 Status;
97 | stub_FILE * retval;
98 | static stub_FILE FOPEN_FP = {0};
99 |
100 | Status = UT_DEFAULT_IMPL(stub_fopen);
101 |
102 | if (Status == 0)
103 | {
104 | retval = &FOPEN_FP;
105 | }
106 | else
107 | {
108 | retval = NULL;
109 | }
110 |
111 | return retval;
112 | }
113 |
114 | int stub_fputs(const char *s, stub_FILE *stream)
115 | {
116 | int32 Status;
117 |
118 | Status = UT_DEFAULT_IMPL(stub_fputs);
119 |
120 | return Status;
121 | }
122 |
123 | int stub_putchar(int c)
124 | {
125 | int32 Status;
126 |
127 | Status = UT_DEFAULT_IMPL(stub_putchar);
128 |
129 | return Status;
130 | }
131 |
132 | int stub_remove(const char *filename)
133 | {
134 | int32 Status;
135 |
136 | Status = UT_DEFAULT_IMPL(stub_remove);
137 |
138 | return Status;
139 | }
140 |
141 | int stub_rename(const char *old, const char *nw)
142 | {
143 | int32 Status;
144 |
145 | Status = UT_DEFAULT_IMPL(stub_rename);
146 |
147 | return Status;
148 | }
149 |
150 | int stub_snprintf(char *s, size_t maxlen, const char *format, ...)
151 | {
152 | int32 Status;
153 | int actual = 0;
154 | va_list ap;
155 |
156 | Status = UT_DEFAULT_IMPL(stub_snprintf);
157 |
158 | /* need to actually _do_ the snprintf */
159 | if (Status >= 0)
160 | {
161 | va_start(ap, format);
162 | actual = vsnprintf(s, maxlen, format, ap);
163 | va_end(ap);
164 | }
165 |
166 | if (Status != 0)
167 | {
168 | actual = Status;
169 | }
170 |
171 | return actual;
172 | }
173 |
174 | int stub_vsnprintf(char *s, size_t maxlen, const char *format, stub_va_list arg)
175 | {
176 | int32 Status;
177 | int actual = 0;
178 |
179 | Status = UT_DEFAULT_IMPL(stub_vsnprintf);
180 |
181 | /* need to actually _do_ something here -
182 | * cannot do the real vsnprintf because we lost the args. */
183 | if (Status >= 0)
184 | {
185 | actual = snprintf(s, maxlen, "%s", format);
186 | }
187 |
188 | if (Status != 0)
189 | {
190 | actual = Status;
191 | }
192 |
193 | return actual;
194 | }
195 |
196 | int stub_printf(const char *format, ...)
197 | {
198 | return UT_DEFAULT_IMPL(stub_printf);
199 | }
200 |
201 | int stub_fprintf(stub_FILE *fp, const char *format, ...)
202 | {
203 | return UT_DEFAULT_IMPL(stub_fprintf);
204 | }
205 |
206 | static stub_FILE LOCAL_FP[3] = {{10}, {11}, {12}};
207 |
208 | stub_FILE *stub_stdin = &LOCAL_FP[0];
209 | stub_FILE *stub_stdout = &LOCAL_FP[1];
210 | stub_FILE *stub_stderr = &LOCAL_FP[2];
211 |
--------------------------------------------------------------------------------
/unit-test/stubs/stub_stdarg.h:
--------------------------------------------------------------------------------
1 | /************************************************************************
2 | * NASA Docket No. GSC-18,917-1, and identified as “CFS Data Storage
3 | * (DS) application version 2.6.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 | * Coverage stub replacement for stdarg.h
23 | */
24 |
25 | #ifndef STUB_STDARG_H
26 | #define STUB_STDARG_H
27 |
28 | #include "stub_basetypes.h"
29 |
30 | /* ----------------------------------------- */
31 | /* constants normally defined in stdarg.h */
32 | /* ----------------------------------------- */
33 |
34 | /* ----------------------------------------- */
35 | /* types normally defined in stdarg.h */
36 | /* ----------------------------------------- */
37 | typedef struct
38 | {
39 | void *p;
40 | } stub_va_list;
41 |
42 | /* ----------------------------------------- */
43 | /* prototypes normally declared in stdarg.h */
44 | /* ----------------------------------------- */
45 |
46 | #define stub_va_start(ap, last) ap.p = &last
47 | #define stub_va_end(ap)
48 |
49 | #endif
50 |
--------------------------------------------------------------------------------
/unit-test/stubs/stub_stdio.h:
--------------------------------------------------------------------------------
1 | /************************************************************************
2 | * NASA Docket No. GSC-18,917-1, and identified as “CFS Data Storage
3 | * (DS) application version 2.6.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 | * Coverage stub replacement for stdio.h
23 | */
24 |
25 | #ifndef STUB_STDIO_H
26 | #define STUB_STDIO_H
27 |
28 | #include "stub_basetypes.h"
29 | #include "stub_stdarg.h"
30 |
31 | /* ----------------------------------------- */
32 | /* constants normally defined in stdio.h */
33 | /* ----------------------------------------- */
34 |
35 | /* ----------------------------------------- */
36 | /* types normally defined in stdio.h */
37 | /* ----------------------------------------- */
38 | typedef struct stub_FILE stub_FILE;
39 |
40 | /* ----------------------------------------- */
41 | /* prototypes normally declared in stdio.h */
42 | /* ----------------------------------------- */
43 |
44 | extern int stub_fclose(stub_FILE *stream);
45 | extern char * stub_fgets(char *s, int n, stub_FILE *stream);
46 | extern stub_FILE *stub_fopen(const char *filename, const char *modes);
47 | extern int stub_fputs(const char *s, stub_FILE *stream);
48 | extern int stub_remove(const char *filename);
49 | extern int stub_rename(const char *old, const char *nw);
50 | extern int stub_snprintf(char *s, size_t maxlen, const char *format, ...);
51 | extern int stub_vsnprintf(char *s, size_t maxlen, const char *format, stub_va_list arg);
52 | extern int stub_printf(const char *format, ...);
53 | extern int stub_fprintf(stub_FILE *fp, const char *format, ...);
54 | extern int stub_putchar(int c);
55 |
56 | extern stub_FILE *stub_stdin;
57 | extern stub_FILE *stub_stdout;
58 | extern stub_FILE *stub_stderr;
59 |
60 | #endif
61 |
--------------------------------------------------------------------------------
/unit-test/utilities/ds_test_utils.c:
--------------------------------------------------------------------------------
1 | /************************************************************************
2 | * NASA Docket No. GSC-18,917-1, and identified as “CFS Data Storage
3 | * (DS) application version 2.6.1”
4 | *
5 | * Copyright (c) 2021 United States Government as represented by the
6 | * Administrator of the National Aeronautics and Space Administration.
7 | * All Rights Reserved.
8 | *
9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
10 | * not use this file except in compliance with the License. You may obtain
11 | * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | ************************************************************************/
19 |
20 | /**
21 | * @file
22 | * This file contains unit test utilities for the DS application.
23 | */
24 |
25 | /*
26 | * Includes
27 | */
28 |
29 | #include "ds_test_utils.h"
30 | #include "ds_app.h"
31 |
32 | /* UT includes */
33 | #include "uttest.h"
34 | #include "utassert.h"
35 | #include "utstubs.h"
36 |
37 | #define UT_MAX_SENDEVENT_DEPTH 4
38 | CFE_EVS_SendEvent_context_t context_CFE_EVS_SendEvent[UT_MAX_SENDEVENT_DEPTH];
39 | CFE_ES_WriteToSysLog_context_t context_CFE_ES_WriteToSysLog;
40 |
41 | UT_CmdBuf_t UT_CmdBuf;
42 |
43 | /*
44 | * Function Definitions
45 | */
46 | void UT_Handler_CFE_EVS_SendEvent(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context, va_list va)
47 | {
48 | uint16 CallCount;
49 | uint16 idx;
50 |
51 | CallCount = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
52 |
53 | if (CallCount > (sizeof(context_CFE_EVS_SendEvent) / sizeof(context_CFE_EVS_SendEvent[0])))
54 | {
55 | UtAssert_Failed("CFE_EVS_SendEvent UT depth %u exceeded: %u, increase UT_MAX_SENDEVENT_DEPTH",
56 | UT_MAX_SENDEVENT_DEPTH, CallCount);
57 | }
58 | else
59 | {
60 | idx = CallCount - 1;
61 | context_CFE_EVS_SendEvent[idx].EventID = UT_Hook_GetArgValueByName(Context, "EventID", uint16);
62 | context_CFE_EVS_SendEvent[idx].EventType = UT_Hook_GetArgValueByName(Context, "EventType", uint16);
63 |
64 | strncpy(context_CFE_EVS_SendEvent[idx].Spec, UT_Hook_GetArgValueByName(Context, "Spec", const char *),
65 | CFE_MISSION_EVS_MAX_MESSAGE_LENGTH);
66 | context_CFE_EVS_SendEvent[idx].Spec[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH - 1] = '\0';
67 | }
68 | }
69 |
70 | void UT_Handler_CFE_ES_WriteToSysLog(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context, va_list va)
71 | {
72 | strncpy(context_CFE_ES_WriteToSysLog.Spec, UT_Hook_GetArgValueByName(Context, "SpecStringPtr", const char *),
73 | CFE_MISSION_EVS_MAX_MESSAGE_LENGTH - 1);
74 | context_CFE_ES_WriteToSysLog.Spec[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH - 1] = '\0';
75 | }
76 |
77 | void DS_Test_Setup(void)
78 | {
79 | static DS_FilterTable_t FilterTable;
80 | static DS_DestFileTable_t DestFileTable;
81 |
82 | /* initialize test environment to default state for every test */
83 | UT_ResetState(0);
84 |
85 | memset(&DS_AppData, 0, sizeof(DS_AppData));
86 | memset(context_CFE_EVS_SendEvent, 0, sizeof(context_CFE_EVS_SendEvent));
87 | memset(&context_CFE_ES_WriteToSysLog, 0, sizeof(context_CFE_ES_WriteToSysLog));
88 | memset(&UT_CmdBuf, 0, sizeof(UT_CmdBuf));
89 | memset(&FilterTable, 0, sizeof(FilterTable));
90 | memset(&DestFileTable, 0, sizeof(DestFileTable));
91 |
92 | /* Set up the default table pointers */
93 | DS_AppData.FilterTblPtr = &FilterTable;
94 | DS_AppData.DestFileTblPtr = &DestFileTable;
95 |
96 | /* Register custom handlers */
97 | UT_SetVaHandlerFunction(UT_KEY(CFE_EVS_SendEvent), UT_Handler_CFE_EVS_SendEvent, NULL);
98 | UT_SetVaHandlerFunction(UT_KEY(CFE_ES_WriteToSysLog), UT_Handler_CFE_ES_WriteToSysLog, NULL);
99 | }
100 |
101 | void DS_Test_TearDown(void)
102 | {
103 | /* cleanup test environment */
104 | }
105 |
--------------------------------------------------------------------------------
/unit-test/utilities/ds_test_utils.h:
--------------------------------------------------------------------------------
1 | /************************************************************************
2 | * NASA Docket No. GSC-18,917-1, and identified as “CFS Data Storage
3 | * (DS) application version 2.6.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 DS_TEST_UTILS_H
21 | #define DS_TEST_UTILS_H
22 |
23 | #include "ds_app.h"
24 | #include "ds_msg.h"
25 | #include "cfe_msgids.h"
26 | #include "utstubs.h"
27 |
28 | /*
29 | * Allow UT access to the global "DS_AppData" object.
30 | */
31 | extern DS_AppData_t DS_AppData;
32 |
33 | /*
34 | * Global context structures
35 | */
36 | typedef struct
37 | {
38 | uint16 EventID;
39 | uint16 EventType;
40 | char Spec[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH];
41 | } CFE_EVS_SendEvent_context_t;
42 |
43 | typedef struct
44 | {
45 | char Spec[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH];
46 | } CFE_ES_WriteToSysLog_context_t;
47 |
48 | extern CFE_EVS_SendEvent_context_t context_CFE_EVS_SendEvent[];
49 | extern CFE_ES_WriteToSysLog_context_t context_CFE_ES_WriteToSysLog;
50 |
51 | /* Command buffer typedef for any handler */
52 | typedef union
53 | {
54 | CFE_SB_Buffer_t Buf;
55 | DS_NoopCmd_t NoopCmd;
56 | DS_ResetCountersCmd_t ResetCmd;
57 | DS_AppStateCmd_t AppStateCmd;
58 | DS_FilterFileCmd_t FilterFileCmd;
59 | DS_FilterTypeCmd_t FilterTypeCmd;
60 | DS_FilterParmsCmd_t FilterParmsCmd;
61 | DS_DestTypeCmd_t DestTypeCmd;
62 | DS_DestStateCmd_t DestStateCmd;
63 | DS_DestPathCmd_t DestPathCmd;
64 | DS_DestBaseCmd_t DestBaseCmd;
65 | DS_DestExtCmd_t DestExtCmd;
66 | DS_DestSizeCmd_t DestSizeCmd;
67 | DS_DestAgeCmd_t DestAgeCmd;
68 | DS_DestCountCmd_t DestCountCmd;
69 | DS_CloseFileCmd_t CloseFileCmd;
70 | DS_CloseAllCmd_t CloseAllCmd;
71 | DS_GetFileInfoCmd_t GetFileInfoCmd;
72 | DS_AddMidCmd_t AddMidCmd;
73 | DS_RemoveMidCmd_t RemoveMidCmd;
74 | } UT_CmdBuf_t;
75 |
76 | extern UT_CmdBuf_t UT_CmdBuf;
77 |
78 | /*
79 | * Macro to add a test case to the list of tests to execute
80 | */
81 | #define UT_DS_TEST_ADD(test) UtTest_Add(test, DS_Test_Setup, DS_Test_TearDown, #test)
82 |
83 | /* Unit test MID */
84 | #define DS_UT_MID_1 CFE_SB_ValueToMsgId(1)
85 | #define DS_UT_MID_2 CFE_SB_ValueToMsgId(2)
86 |
87 | /* Unit test osal ID, generic w/ no type */
88 | #define DS_UT_OBJID_1 OS_ObjectIdFromInteger(1)
89 |
90 | /* Unit test CDS handle */
91 | #define DS_UT_CDSHANDLE_1 CFE_ES_CDSHANDLE_C(CFE_RESOURCEID_WRAP(1))
92 |
93 | /*
94 | * Setup function prior to every test
95 | */
96 | void DS_Test_Setup(void);
97 |
98 | /*
99 | * Teardown function after every test
100 | */
101 | void DS_Test_TearDown(void);
102 |
103 | #endif
104 |
--------------------------------------------------------------------------------