diff --git a/.github/workflows/README.md b/.github/workflows/README.md deleted file mode 100644 index 3f8b5ef..0000000 --- a/.github/workflows/README.md +++ /dev/null @@ -1,81 +0,0 @@ -# Our Workflows - -## Reusable Workflows - -To reduce duplication, the workflows CodeQL Analysis, Static Analysis, and Format Checker are placed in cFS to be reused in the subrepositories. - -CodeQL Analysis and Static Analysis require inputs, therefore, they are called in an additional workflow in cFS to be utilized. Format checker does not need to be reused in cFS because it does not require inputs. - -Provided is a diagram of the architecture of the reusable workflows. - -![Reusable Workflows Architecture](./Reusable-Workflows-Architecture.svg) - -## Deprecated Build, Test, and Run -[![Deprecated Build, Test, and Run](https://github.com/nasa/cfs/actions/workflows/build-cfs-deprecated.yml/badge.svg)](https://github.com/nasa/cfs/actions/workflows/build-cfs-deprecated.yml) - -This action builds, tests, and runs the cFS bundle using deprecated code. The flag OMIT_DEPRECATED is set to false. For more information on the OMIT_DEPRECATED flag, see [global_build_options.cmake](https://github.com/nasa/cFE/blob/063b4d8a9c4a7e822af5f3e4017599159b985bb0/cmake/sample_defs/global_build_options.cmake). - -Build, Test, and Run runs for every push and every pull request on all branches of cFS in Github Actions. - -## Build, Test, and Run [OMIT_DEPRECATED=true] -[![Build, Test, and Run %5B OMIT_DEPRECATED=true %5B](https://github.com/nasa/cfs/actions/workflows/build-cfs.yml/badge.svg)](https://github.com/nasa/cfs/actions/workflows/build-cfs.yml) - -This action builds, tests, and runs the cFS bundle omitting deprecated code. - -Build, Test, and Run [OMIT_DEPRECATED=true] runs for every push and every pull request on all branches of cFS in Github Actions. For more information on the OMIT_DEPRECATED flag, see [global_build_options.cmake](https://github.com/nasa/cFE/blob/063b4d8a9c4a7e822af5f3e4017599159b985bb0/cmake/sample_defs/global_build_options.cmake). - -## Build and Test in RTEMS [OMIT_DEPRECATED=true] -[![Build and Test rtems 4.11 [OMIT_DEPRECATED=true]](https://github.com/nasa/cFS/actions/workflows/build-cfs-rtems4.11.yml/badge.svg)](https://github.com/nasa/cFS/actions/workflows/build-cfs-rtems4.11.yml) -[![Build and Test rtems 5 [OMIT_DEPRECATED=true]](https://github.com/nasa/cFS/actions/workflows/build-cfs-rtems5.yml/badge.svg)](https://github.com/nasa/cFS/actions/workflows/build-cfs-rtems5.yml) - -This action builds and tests the cFS bundle omitting deprecated code in both RTEMS 4.11 and RTEMS 5. - -Build and Test in RTEMS 4.11 and 5 runs for every push and every pull request on all branches of cFS in Github Actions. - -## CodeQL Analysis -[![CodeQL Analysis](https://github.com/nasa/cfs/actions/workflows/codeql-build.yml/badge.svg)](https://github.com/nasa/cfs/actions/workflows/codeql-build.yml) - -This action runs GitHub's static analysis engine, CodeQL, against our repository's source code to find security vulnerabilities. It then automatically uploads the results to GitHub so they can be displayed in the repository's code scanning alerts found under the security tab. CodeQL runs an extensible set of [queries](https://github.com/github/codeql), which have been developed by the community and the [GitHub Security Lab](https://securitylab.github.com/) to find common vulnerabilities in your code. - -CodeQL runs for every push and pull-request on all branches of cFS in GitHub Actions. - -For the CodeQL GitHub Actions setup, visit https://github.com/github/codeql-action. - -Our CodeQL action uses a configuration file to use specific queries, which can be found at [.github/codeql](https://github.com/nasa/cFS/tree/main/.github/codeql). - -## Static Analysis -[![Static Analysis](https://github.com/nasa/cfs/actions/workflows/static-analysis.yml/badge.svg)](https://github.com/nasa/cfs/actions/workflows/static-analysis.yml) - -This action runs a static analysis tool for C/C++ code known as cppcheck. Cppcheck is designed to be able to analyze C/C++ code even if it has non-standard syntax, which is common in embedded projects. - -The cFS Cppcheck GitHub Actions workflow and results are available to the public. To view the results, select a workflow and download the artifacts. - -Cppcheck runs for every push on the main branch and every pull request on all branches of cFS in Github Actions. - -For more information about Cppcheck, visit http://cppcheck.sourceforge.net/. - -## Local Unit Test -[![Local Unit Test](https://github.com/nasa/osal/actions/workflows/local_unit_test.yml/badge.svg)](https://github.com/nasa/osal/actions/workflows/local_unit_test.yml) - -This action tests our code using GCC's coverage testing tool gcov. - -Local Unit Test runs for every push and every pull request on all branches of cFS in Github Actions. - -## Documentation and Guides -[![Documentation and Guides](https://github.com/nasa/cfs/actions/workflows/build-documentation.yml/badge.svg)](https://github.com/nasa/cfs/actions/workflows/build-documentation.yml) - -This action creates doxygen documents for cFE, cFS users guide, and osal guide. - -Documentation and Guides runs for every push and every pull request on all branches of cFS in Github Actions. The workflow pushes the PDFs for every push on the main branch. The PDFs can be found at https://github.com/nasa/cfs/tree/gh-pages. - -## Changelog -[![Changelog](https://github.com/nasa/cfs/actions/workflows/changelog.yml/badge.svg)](https://github.com/nasa/cfs/actions/workflows/changelog.yml) - -This action creates a changelog file which documents all the issues in cFS. - -The Changelog action runs manually. - -## Format Check -[![Format Check](https://github.com/nasa/osal/actions/workflows/format-check.yml/badge.svg)](https://github.com/nasa/osal/actions/workflows/format-check.yml) - -This action uses [clang-format-10](https://github.com/nasa/cFS/blob/main/.clang-format) to check for format errors. diff --git a/.github/workflows/Reusable-Workflows-Architecture.svg b/.github/workflows/Reusable-Workflows-Architecture.svg deleted file mode 100644 index bfa2248..0000000 --- a/.github/workflows/Reusable-Workflows-Architecture.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml new file mode 100644 index 0000000..3f14102 --- /dev/null +++ b/.github/workflows/build-and-test.yml @@ -0,0 +1,56 @@ +# Builds the F Prime CFS reference (native simulation) and runs the GDS integration tests + +name: "Build and Test" + +on: + push: + branches: [ devel, main ] + pull_request: + branches: [ devel, main ] + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +permissions: + contents: read + +jobs: + build-and-test: + name: "Build and Integration Tests" + runs-on: ubuntu-22.04 + steps: + - name: "Make Space" + uses: nasa/fprime-actions/make-space@devel + - name: "Checkout" + uses: actions/checkout@v4 + with: + submodules: recursive + - name: "Setup F´ environment" + uses: nasa/fprime-actions/setup@devel + with: + location: ./libs/fprime + - name: "Build" + run: | + make SIMULATION=native prep + make + make install + - name: "Run Integration Tests" + uses: nasa/fprime-actions/run-integration-tests@devel + with: + gds-working-directory: build-artifacts/exe/cpu1 + test-working-directory: test/int + binary: ./core-cpu1 + binary-args: "" + gds-args: >- + --ip-client --ip-port 15010 + --dictionary ${{ github.workspace }}/build-artifacts/exe/Linux/fprime_app/dict/FPrimeDeploymentTopologyDictionary.json + pytest-args: >- + --dictionary ${{ github.workspace }}/build-artifacts/exe/Linux/fprime_app/dict/FPrimeDeploymentTopologyDictionary.json + - name: "Archive logs" + uses: actions/upload-artifact@v4 + if: always() + with: + name: cfs-reference-logs + path: build-artifacts/exe/cpu1/gds-logs + retention-days: 5 diff --git a/.github/workflows/build-cfs-deprecated.yml b/.github/workflows/build-cfs-deprecated.yml deleted file mode 100644 index fbd048f..0000000 --- a/.github/workflows/build-cfs-deprecated.yml +++ /dev/null @@ -1,229 +0,0 @@ -name: Build, Test, and Run [OMIT_DEPRECATED = false] - -# Run every time a new commit pushed or for pull requests -on: - push: - branches: - - dev - - main - pull_request: - types: - - opened - - reopened - - synchronize - workflow_dispatch: - -env: - SIMULATION: native - OMIT_DEPRECATED: false - ENABLE_UNIT_TESTS: true - CTEST_OUTPUT_ON_FAILURE: true - REPO_NAME: ${{ github.event.repository.name }} - -# Force bash to apply pipefail option so pipeline failures aren't masked -defaults: - run: - shell: bash - -jobs: - #Checks for duplicate actions. Skips push actions if there is a matching or duplicate pull-request action. - check-for-duplicates: - runs-on: ubuntu-latest - # Map a step output to a job output - outputs: - should_skip: ${{ steps.skip_check.outputs.should_skip }} - steps: - - id: skip_check - uses: fkirc/skip-duplicate-actions@master - with: - concurrent_skipping: 'same_content' - skip_after_successful_duplicate: 'true' - do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]' - - build-cfs-omit-deprecated-false: - name: "[Deprecated] Build" - needs: check-for-duplicates - if: ${{ needs.check-for-duplicates.outputs.should_skip != 'true' }} - runs-on: ubuntu-22.04 - - strategy: - fail-fast: false - matrix: - buildtype: [debug, release] - - # Set the type of machine to run on - env: - BUILDTYPE: ${{ matrix.buildtype }} - - steps: - - name: Cache Source and Build - id: cache-src-bld - uses: actions/cache@v4 - with: - path: /home/runner/work/${{ env.REPO_NAME }}/${{ env.REPO_NAME }}/* - key: deprecated-build-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.buildtype }} - - - name: Checkout cFS - if: steps.cache-src-bld.outputs.cache-hit != 'true' - uses: actions/checkout@v4 - with: - submodules: true - - - name: Check versions - run: git submodule - - - name: Copy Makefile - run: | - cp ./cfe/cmake/Makefile.sample Makefile - cp -r ./cfe/cmake/sample_defs sample_defs - - - name: Prep Build - run: make prep - - - name: Make - run: make install - - tests-and-coverage-omit-deprecated-false: - name: "[Deprecated] Run Unit Tests and Check Coverage" - needs: build-cfs-omit-deprecated-false - runs-on: ubuntu-22.04 - - strategy: - fail-fast: false - matrix: - buildtype: [debug, release] - - # Set the type of machine to run on - env: - BUILDTYPE: ${{ matrix.buildtype }} - ENABLE_UNIT_TESTS: true - - steps: - - name: Install Dependencies - run: sudo apt-get install lcov -y - - - name: Cache Source and Deprecated Build - id: cache-src-bld - uses: actions/cache@v4 - with: - path: /home/runner/work/${{ env.REPO_NAME }}/${{ env.REPO_NAME }}/* - key: deprecated-build-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.buildtype }} - - - name: Run Tests - run: make test - - - name: Check Coverage - run: make lcov - - run-cfs-omit-deprecated-false: - name: "[Deprecated] Run cFS" - needs: build-cfs-omit-deprecated-false - runs-on: ubuntu-22.04 - - strategy: - fail-fast: false - matrix: - buildtype: [debug, release] - - # Set the type of machine to run on - env: - BUILDTYPE: ${{ matrix.buildtype }} - - steps: - - name: Cache Source and Deprecated Build - id: cache-src-bld - uses: actions/cache@v4 - with: - path: /home/runner/work/${{ env.REPO_NAME }}/${{ env.REPO_NAME }}/* - key: deprecated-build-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.buildtype }} - - - - name: List cpu1 - run: ls build/exe/cpu1/ - - - name: Run cFS - run: | - ./core-cpu1 > cFS_startup_cpu1.txt & - sleep 30 - ../host/cmdUtil --endian=LE --pktid=0x1806 --cmdcode=2 --half=0x0002 - working-directory: ./build/exe/cpu1/ - - - name: Archive cFS Startup Artifacts - uses: actions/upload-artifact@v4 - with: - name: cFS-startup-log-omit-deprecate-false${{ matrix.buildtype }} - path: ./build/exe/cpu1/cFS_startup_cpu1.txt - - - name: Check for cFS Warnings - run: | - if [[ -n $(grep -i "warn\|err\|fail" cFS_startup_cpu1.txt) ]]; then - echo "Must resolve warn|err|fail in cFS startup before submitting a pull request" - echo "" - grep -i 'warn\|err\|fail' cFS_startup_cpu1.txt - exit -1 - fi - working-directory: ./build/exe/cpu1/ - - run-functional-test-app-omit-deprecated-false: - #Continue if check-for-duplicates found no duplicates. Always runs for pull-requests. - needs: run-cfs-omit-deprecated-false - name: "[DEPRECATED] cFS Functional Tests" - runs-on: ubuntu-22.04 - timeout-minutes: 15 - - strategy: - fail-fast: false - matrix: - buildtype: [debug, release] - - steps: - - name: Cache Source and Deprecated Build - id: cache-src-bld - uses: actions/cache@v4 - with: - path: /home/runner/work/${{ env.REPO_NAME }}/${{ env.REPO_NAME }}/* - key: deprecated-build-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.buildtype }} - - - name: List cpu1 - run: ls build/exe/cpu1/ - - # Run cFS, send commands to set perf trigger and start perf data, and run functional tests - - name: Run cFS Functional Tests - run: | - ./core-cpu1 & - sleep 10 - ../host/cmdUtil --pktid=0x1806 --cmdcode=17 --endian=LE --uint32=3 --uint32=0x40000000 - ../host/cmdUtil --pktid=0x1806 --cmdcode=14 --endian=LE --uint32=2 - ../host/cmdUtil --pktid=0x1806 --cmdcode=4 --endian=LE --string="20:CFE_TEST" --string="20:CFE_TestMain" --string="64:cfe_testcase" --uint64=16384 --uint8=0 --uint8=0 --uint16=100 --uint32=0 - sleep 30 - counter=0 - while [[ ! -f cf/cfe_test.log ]]; do - temp=$(grep -c "BEGIN" cf/cfe_test.tmp) - - if [ $temp -eq $counter ]; then - echo "Test is frozen. Quiting" - break - fi - counter=$(grep -c "BEGIN" cf/cfe_test.tmp) - echo "Waiting for CFE Tests" - sleep 120 - done - - ../host/cmdUtil --endian=LE --pktid=0x1806 --cmdcode=2 --half=0x0002 - working-directory: ./build/exe/cpu1/ - - - name: Archive Functional Test Artifacts - uses: actions/upload-artifact@v4 - with: - name: cFS-functional-test-log-omit-deprecate-false-${{ matrix.buildtype }} - path: ./build/exe/cpu1/cf/cfe_test.log - - - name: Check for cFS Warnings - run: | - if [[ -z $(grep -i "SUMMARY.*FAIL::0.*TSF::0.*TTF::0" cf/cfe_test.log) ]]; then - echo "Must resolve Test Failures in cFS Test App before submitting a pull request" - echo "" - grep -i '\[ FAIL]\|\[ TSF]\|\[ TTF]' cf/cfe_test.log - exit -1 - fi - working-directory: ./build/exe/cpu1/ diff --git a/.github/workflows/build-cfs-rtems5.yml b/.github/workflows/build-cfs-rtems5.yml deleted file mode 100644 index 33eba69..0000000 --- a/.github/workflows/build-cfs-rtems5.yml +++ /dev/null @@ -1,140 +0,0 @@ -name: Build and Test rtems 5 [OMIT_DEPRECATED=true] - -# Run every time a new commit pushed or for pull requests -on: - push: - branches: - - dev - - main - pull_request: - types: - - opened - - reopened - - synchronize - workflow_dispatch: - -env: - OMIT_DEPRECATED: true - CTEST_OUTPUT_ON_FAILURE: true - -# Force bash to apply pipefail option so pipeline failures aren't masked -defaults: - run: - shell: bash - -jobs: - #Checks for duplicate actions. Skips push actions if there is a matching or duplicate pull-request action. - check-for-duplicates: - runs-on: ubuntu-latest - # Map a step output to a job output - outputs: - should_skip: ${{ steps.skip_check.outputs.should_skip }} - steps: - - id: skip_check - uses: fkirc/skip-duplicate-actions@master - with: - concurrent_skipping: 'same_content' - skip_after_successful_duplicate: 'true' - do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]' - - build-cfs: - #Continue if check-for-duplicates found no duplicates. Always runs for pull-requests. - needs: check-for-duplicates - if: ${{ needs.check-for-duplicates.outputs.should_skip != 'true' }} - name: Build - runs-on: ubuntu-22.04 - container: ghcr.io/core-flight-system/qemu-rtems-5:latest - - strategy: - fail-fast: false - matrix: - buildtype: [debug, release] - - # Set the type of machine to run on - env: - BUILDTYPE: ${{ matrix.buildtype }} - # Set home to where rtems is located - HOME: /root - - steps: - # Check out the cfs bundle - - name: Checkout code - uses: actions/checkout@v4 - with: - submodules: true - - # Setup the build system - - name: Copy Files - run: | - cp ./cfe/cmake/Makefile.sample Makefile - cp -r ./cfe/cmake/sample_defs sample_defs - ln -s /root/rtems-5 /opt/rtems-5 - - # Setup the build system - - name: Make Prep - run: make SIMULATION=i686-rtems5 prep - - - name: Make - run: make - - test-cfs: - name: Test - runs-on: ubuntu-22.04 - container: ghcr.io/core-flight-system/qemu-rtems-5:latest - - needs: build-cfs - - strategy: - fail-fast: false - matrix: - buildtype: [debug, release] - - # Set the type of machine to run on - env: - BUILDTYPE: ${{ matrix.buildtype }} - ENABLE_UNIT_TESTS: true - # Set home to where rtems is located - HOME: /root - # Disable mcopy check otherwise disk image build fails - MTOOLS_SKIP_CHECK: 1 - - steps: - # Checks out a copy of your repository on the ubuntu-latest machine - - name: Checkout code - uses: actions/checkout@v4 - with: - submodules: true - - # Setup the build system - - name: Copy Files - run: | - cp ./cfe/cmake/Makefile.sample Makefile - cp -r ./cfe/cmake/sample_defs sample_defs - ln -s /root/rtems-5 /opt/rtems-5 - - # Setup the build system - - name: Make - run: | - make SIMULATION=i686-rtems5 prep - make install - - - name: Test - #run: .github/scripts/qemu_test.sh && .github/scripts/log_failed_tests.sh - run: make O=build SKIP_NET_TESTS=true RTEMS_VERSION=i686-rtems5 -f .github/scripts/rtems-test.mk all_tests -k - - - name: Output Failed Tests - run: | - # Check if failed-tests is empty or not - if [ -s ./build/exe/cpu1/failed-tests.log ]; then - echo "Failing tests found:" - cat ./build/exe/cpu1/failed-tests.log - fi - - # Always archive test logs - - name: Archive cFS Test Artifacts - uses: actions/upload-artifact@v4 - # Runs even if previous steps have failed - if: always() - with: - name: cFS-rtems-log-summary-${{ matrix.buildtype }} - path: ./build/exe/cpu1/*.log diff --git a/.github/workflows/build-cfs.yml b/.github/workflows/build-cfs.yml deleted file mode 100644 index 5024b02..0000000 --- a/.github/workflows/build-cfs.yml +++ /dev/null @@ -1,227 +0,0 @@ -name: Build, Test, and Run [OMIT_DEPRECATED = true] - -# Run every time a new commit pushed or for pull requests -on: - push: - branches: - - dev - - main - pull_request: - types: - - opened - - reopened - - synchronize - workflow_dispatch: - -env: - SIMULATION: native - OMIT_DEPRECATED: true - ENABLE_UNIT_TESTS: true - CTEST_OUTPUT_ON_FAILURE: true - REPO_NAME: ${{ github.event.repository.name }} - -# Force bash to apply pipefail option so pipeline failures aren't masked -defaults: - run: - shell: bash - -jobs: - #Checks for duplicate actions. Skips push actions if there is a matching or duplicate pull-request action. - check-for-duplicates: - runs-on: ubuntu-latest - # Map a step output to a job output - outputs: - should_skip: ${{ steps.skip_check.outputs.should_skip }} - steps: - - id: skip_check - uses: fkirc/skip-duplicate-actions@master - with: - concurrent_skipping: 'same_content' - skip_after_successful_duplicate: 'true' - do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]' - - build-cfs-omit-deprecated-true: - name: Build - needs: check-for-duplicates - if: ${{ needs.check-for-duplicates.outputs.should_skip != 'true' }} - runs-on: ubuntu-22.04 - - strategy: - fail-fast: false - matrix: - buildtype: [debug, release] - - # Set the type of machine to run on - env: - BUILDTYPE: ${{ matrix.buildtype }} - - steps: - - name: Cache Source and Build - id: cache-src-bld - uses: actions/cache@v4 - with: - path: /home/runner/work/${{ env.REPO_NAME }}/${{ env.REPO_NAME }}/* - key: build-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.buildtype }} - - - name: Checkout cFS - if: steps.cache-src-bld.outputs.cache-hit != 'true' - uses: actions/checkout@v4 - with: - submodules: true - - - name: Check versions - run: git submodule - - - name: Copy Makefile - run: | - cp ./cfe/cmake/Makefile.sample Makefile - cp -r ./cfe/cmake/sample_defs sample_defs - - name: Prep Build - run: make prep - - - name: Make - run: make install - - tests-and-coverage-omit-deprecated-true: - name: Run Unit Tests and Check Coverage - needs: build-cfs-omit-deprecated-true - runs-on: ubuntu-22.04 - - strategy: - fail-fast: false - matrix: - buildtype: [debug, release] - - # Set the type of machine to run on - env: - BUILDTYPE: ${{ matrix.buildtype }} - ENABLE_UNIT_TESTS: true - - steps: - - name: Install Dependencies - run: sudo apt-get install lcov -y - - - name: Cache Source and Build - id: cache-src-bld - uses: actions/cache@v4 - with: - path: /home/runner/work/${{ env.REPO_NAME }}/${{ env.REPO_NAME }}/* - key: build-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.buildtype }} - - - name: Run Tests - run: make test - - - name: Check Coverage - run: make lcov - - run-cfs-omit-deprecated-true: - name: Run - needs: build-cfs-omit-deprecated-true - runs-on: ubuntu-22.04 - - strategy: - fail-fast: false - matrix: - buildtype: [debug, release] - - # Set the type of machine to run on - env: - BUILDTYPE: ${{ matrix.buildtype }} - - steps: - - name: Cache Source and Build - id: cache-src-bld - uses: actions/cache@v4 - with: - path: /home/runner/work/${{ env.REPO_NAME }}/${{ env.REPO_NAME }}/* - key: build-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.buildtype }} - - - - name: List cpu1 - run: ls build/exe/cpu1/ - - - name: Run cFS - run: | - ./core-cpu1 > cFS_startup_cpu1.txt & - sleep 30 - ../host/cmdUtil --endian=LE --pktid=0x1806 --cmdcode=2 --half=0x0002 - working-directory: ./build/exe/cpu1/ - - - name: Archive cFS Startup Artifacts - uses: actions/upload-artifact@v4 - with: - name: cFS-startup-log-omit-deprecate-true-${{ matrix.buildtype }} - path: ./build/exe/cpu1/cFS_startup_cpu1.txt - - - name: Check for cFS Warnings - run: | - if [[ -n $(grep -i "warn\|err\|fail" cFS_startup_cpu1.txt) ]]; then - echo "Must resolve warn|err|fail in cFS startup before submitting a pull request" - echo "" - grep -i 'warn\|err\|fail' cFS_startup_cpu1.txt - exit -1 - fi - working-directory: ./build/exe/cpu1/ - - run-functional-test-app-omit-deprecated-true: - #Continue if check-for-duplicates found no duplicates. Always runs for pull-requests. - needs: run-cfs-omit-deprecated-true - runs-on: ubuntu-22.04 - timeout-minutes: 15 - - strategy: - fail-fast: false - matrix: - buildtype: [debug, release] - - steps: - - name: Cache Source and Build - id: cache-src-bld - uses: actions/cache@v4 - with: - path: /home/runner/work/${{ env.REPO_NAME }}/${{ env.REPO_NAME }}/* - key: build-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.buildtype }} - - - name: List cpu1 - run: ls build/exe/cpu1/ - - # Run cFS, send commands to set perf trigger and start perf data, and run functional tests - - name: Run cFS Functional Tests - run: | - ./core-cpu1 & - sleep 10 - ../host/cmdUtil --pktid=0x1806 --cmdcode=17 --endian=LE --uint32=3 --uint32=0x40000000 - ../host/cmdUtil --pktid=0x1806 --cmdcode=14 --endian=LE --uint32=2 - ../host/cmdUtil --pktid=0x1806 --cmdcode=4 --endian=LE --string="20:CFE_TEST" --string="20:CFE_TestMain" --string="64:cfe_testcase" --uint64=16384 --uint8=0 --uint8=0 --uint16=100 --uint32=0 - sleep 30 - counter=0 - while [[ ! -f cf/cfe_test.log ]]; do - temp=$(grep -c "BEGIN" cf/cfe_test.tmp) - - if [ $temp -eq $counter ]; then - echo "Test is frozen. Quiting" - break - fi - counter=$(grep -c "BEGIN" cf/cfe_test.tmp) - echo "Waiting for CFE Tests" - sleep 120 - done - - ../host/cmdUtil --endian=LE --pktid=0x1806 --cmdcode=2 --half=0x0002 - working-directory: ./build/exe/cpu1/ - - - name: Archive cFS Startup Artifacts - uses: actions/upload-artifact@v4 - with: - name: cFS-functional-test-log-omit-deprecate-true-${{ matrix.buildtype }} - path: ./build/exe/cpu1/cf/cfe_test.log - - - name: Check for cFS Warnings - run: | - if [[ -z $(grep -i "SUMMARY.*FAIL::0.*TSF::0.*TTF::0" cf/cfe_test.log) ]]; then - echo "Must resolve Test Failures in cFS Test App before submitting a pull request" - echo "" - grep -i '\[ FAIL]\|\[ TSF]\|\[ TTF]' cf/cfe_test.log - exit -1 - fi - working-directory: ./build/exe/cpu1/ diff --git a/.github/workflows/build-deploy-doc.yml b/.github/workflows/build-deploy-doc.yml deleted file mode 100644 index 7f94e71..0000000 --- a/.github/workflows/build-deploy-doc.yml +++ /dev/null @@ -1,173 +0,0 @@ -name: Build Document - -on: - workflow_call: - inputs: - # Required - target: - description: Document target name(s) as stringified JSON matrix list # Matrix example "[\"x\", \"y\"]" - type: string - required: true - # Optional - app-name: - description: Application name, leave blank if using cache - type: string - required: false - default: '' - cache-key: - description: Cache key to use - type: string - required: false - default: '' - buildpdf: - description: Build the PDF - type: boolean - required: false - default: true - deploy: - description: Deploy archived PDF to gh-pages - type: boolean - required: false - default: true - needs_osal_api: - description: Whether this depends on the osal public api (compatibility bridge) - type: boolean - required: false - default: true - -# Force bash to apply pipefail option so pipeline failures aren't masked -defaults: - run: - shell: bash - -jobs: - # Checks for duplicate actions. Skips push actions if there is a matching or - # duplicate pull-request action. - checks-for-duplicates: - runs-on: ubuntu-latest - # Map a step output to a job output - outputs: - should_skip: ${{ steps.skip_check.outputs.should_skip }} - steps: - - id: skip_check - uses: fkirc/skip-duplicate-actions@master - with: - concurrent_skipping: 'same_content' - skip_after_successful_duplicate: 'true' - do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]' - - build-doc: - needs: checks-for-duplicates - if: ${{ needs.checks-for-duplicates.outputs.should_skip != 'true' || contains(github.ref, 'main') }} - name: Build Documentation - runs-on: ubuntu-22.04 - - strategy: - fail-fast: false - matrix: - target: ${{ fromJson(inputs.target) }} - - steps: - - name: Reject non-compatible deployment settings - if: ${{ inputs.deploy == true && inputs.cache-key != '' }} - run: | - echo "Deployment when using cache not supported due to password fail issue" - exit -1 - - - name: Get cache if supplied - id: cache-src-bld - if: ${{ inputs.cache-key != '' }} - uses: actions/cache@v4 - with: - path: /home/runner/work/${{ github.event.repository.name }}/${{ github.event.repository.name }}/* - key: ${{ inputs.cache-key }} - - - name: Checkout Bundle Main - if: ${{ inputs.app-name != '' }} - uses: actions/checkout@v4 - with: - submodules: true - repository: nasa/cFS - - - name: Checkout Repo - if: ${{ inputs.app-name != '' }} - uses: actions/checkout@v4 - with: - path: apps/${{ inputs.app-name }} - - - name: Copy Files - run: | - cp ./cfe/cmake/Makefile.sample Makefile - cp -r ./cfe/cmake/sample_defs sample_defs - - - name: Add Repo To Build - if: ${{ inputs.app-name != '' }} - run: echo 'set(MISSION_GLOBAL_APPLIST ${{ inputs.app-name }})' >> sample_defs/targets.cmake - - - name: Make Prep - run: make prep - - - name: Install Doxygen Dependencies - run: sudo apt-get update && sudo apt-get install doxygen graphviz -y - - - name: Install PDF Generation Dependencies - if: ${{ inputs.buildpdf == true }} - run: | - sudo apt-get install texlive-latex-base texlive-fonts-recommended texlive-fonts-extra texlive-latex-extra - - - name: Generate OSAL header list - if: ${{ inputs.needs_osal_api == true }} - run: make -C build osal_public_api_headerlist - - - name: Build Document - run: | - make -C build ${{ matrix.target }} 2>&1 > ${{ matrix.target }}_stdout.txt | tee ${{ matrix.target }}_stderr.txt - mv build/docs/${{ matrix.target }}/${{ matrix.target }}-warnings.log . - - - name: Archive Document Build Logs - uses: actions/upload-artifact@v4 - with: - name: ${{ matrix.target }}_doc_build_logs - path: | - ${{ matrix.target }}_stdout.txt - ${{ matrix.target }}_stderr.txt - ${{ matrix.target }}-warnings.log - - - name: Check For Document Build Errors - run: | - if [[ -s ${{ matrix.target }}_stderr.txt ]]; then - cat ${{ matrix.target }}_stderr.txt - exit -1 - fi - - - name: Check For Document Warnings - run: | - if [[ -s ${{ matrix.target }}-warnings.log ]]; then - cat ${{ matrix.target }}-warnings.log - exit -1 - fi - - - name: Generate PDF - if: ${{ inputs.buildpdf == true }} - run: | - make -C ./build/docs/${{ matrix.target }}/latex - mkdir deploy - mv ./build/docs/${{ matrix.target }}/latex/refman.pdf ./deploy/${{ matrix.target }}.pdf - # Could add pandoc and convert to github markdown - # pandoc ${{ matrix.target }}.pdf -t gfm - - - name: Archive PDF - if: ${{ inputs.buildpdf == true }} - uses: actions/upload-artifact@v4 - with: - name: ${{ matrix.target }}_pdf - path: ./deploy/${{ matrix.target }}.pdf - - - name: Deploy to GitHub - if: ${{ inputs.deploy == true }} - uses: JamesIves/github-pages-deploy-action@v4 - with: - token: ${{ secrets.GITHUB_TOKEN }} - branch: gh-pages - folder: deploy - single-commit: true diff --git a/.github/workflows/build-documentation.yml b/.github/workflows/build-documentation.yml deleted file mode 100644 index ab68bda..0000000 --- a/.github/workflows/build-documentation.yml +++ /dev/null @@ -1,87 +0,0 @@ -name: cFS Documentation and Guides - -on: - push: - branches: - - dev - - main - pull_request: - types: - - opened - - reopened - - synchronize - workflow_dispatch: - -# Force bash to apply pipefail option so pipeline failures aren't masked -defaults: - run: - shell: bash - -jobs: - # Checks for duplicate actions. Skips push actions if there is a matching or - # duplicate pull-request action. - checks-for-duplicates: - runs-on: ubuntu-latest - # Map a step output to a job output - outputs: - should_skip: ${{ steps.skip_check.outputs.should_skip }} - steps: - - id: skip_check - uses: fkirc/skip-duplicate-actions@master - with: - concurrent_skipping: 'same_content' - skip_after_successful_duplicate: 'true' - do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]' - - checkout-and-cache: - name: Custom checkout and cache for cFS documents - needs: checks-for-duplicates - if: ${{ needs.checks-for-duplicates.outputs.should_skip != 'true' || contains(github.ref, 'main') }} - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - submodules: true - - - name: Cache Source and Build - id: cache-src-bld - uses: actions/cache@v4 - with: - path: /home/runner/work/${{ github.event.repository.name }}/${{ github.event.repository.name }}/* - key: cfs-doc-${{ github.run_id }}-${{ github.run_attempt }} - - build-cfs-documentation: - needs: checkout-and-cache - name: Build cFS documents - uses: nasa/cFS/.github/workflows/build-deploy-doc.yml@main - with: - target: "[\"cfe-usersguide\", \"osal-apiguide\"]" - cache-key: cfs-doc-${{ github.run_id }}-${{ github.run_attempt }} - deploy: false - - deploy-documentation: - needs: build-cfs-documentation - if: ${{ github.event_name == 'push' && contains(github.ref, 'main') }} - name: Deploy documentation to gh-pages - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - uses: actions/download-artifact@v4 - - - name: Display structure of downloaded files - run: ls -R - - - name: Move pdfs to deployment directory - run: mkdir deploy; mv */*.pdf deploy - - - name: Deploy to GitHub - uses: JamesIves/github-pages-deploy-action@v4 - with: - token: ${{ secrets.GITHUB_TOKEN }} - branch: gh-pages - folder: deploy - single-commit: true diff --git a/.github/workflows/build-run-app.yml b/.github/workflows/build-run-app.yml deleted file mode 100644 index e6249c5..0000000 --- a/.github/workflows/build-run-app.yml +++ /dev/null @@ -1,119 +0,0 @@ -name: Build And Run - -on: - workflow_call: - inputs: - # Optional inputs - app-name: - description: Application name, if different from repo name - type: string - required: false - default: ${{ github.event.repository.name }} - startup-string: - description: Startup string to confirm, default will use " Initialized." - type: string - required: false - default: '' - -# Force bash to apply pipefail option so pipeline failures aren't masked -defaults: - run: - shell: bash - -jobs: - # Checks for duplicate actions. Skips push actions if there is a matching or - # duplicate pull-request action. - checks-for-duplicates: - runs-on: ubuntu-latest - # Map a step output to a job output - outputs: - should_skip: ${{ steps.skip_check.outputs.should_skip }} - steps: - - id: skip_check - uses: fkirc/skip-duplicate-actions@master - with: - concurrent_skipping: 'same_content' - skip_after_successful_duplicate: 'true' - do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]' - - build-and-run: - needs: checks-for-duplicates - if: ${{ needs.checks-for-duplicates.outputs.should_skip != 'true' || contains(github.ref, 'main') }} - name: Build and run app, confirm startup message - runs-on: ubuntu-22.04 - - steps: - - name: Set up environment variables - # Apps typically use lowercase targets and uppercase names, this logic is fragile but works - run: | - echo "APP_UPPER=$(echo ${{ inputs.app-name }} | sed 's/[a-z]/\U&/g')" >> $GITHUB_ENV - echo "APP_LOWER=$(echo ${{ inputs.app-name }} | sed 's/[A-Z]/\L&/g')" >> $GITHUB_ENV - - - name: Set up start string for verification - run: | - if [[ "${{ inputs.startup-string }}" == '' ]]; then - echo "START_STRING=$APP_UPPER Initialized." >> $GITHUB_ENV - else - echo "START_STRING=${{ inputs.startup-string }}" >> $GITHUB_ENV - fi - - - name: Checkout Bundle Main - uses: actions/checkout@v4 - with: - submodules: true - repository: nasa/cFS - - - name: Checkout Repo - uses: actions/checkout@v4 - with: - path: apps/${{ env.APP_LOWER }} - - - name: Copy Files - run: | - cp ./cfe/cmake/Makefile.sample Makefile - cp -r ./cfe/cmake/sample_defs sample_defs - - - name: Add To Build - run: | - sed -i "/list(APPEND MISSION_GLOBAL_APPLIST/a list(APPEND MISSION_GLOBAL_APPLIST $APP_LOWER)" sample_defs/targets.cmake - - - name: Add To Startup - run: | - sed -i "1i CFE_APP, $APP_LOWER, ${APP_UPPER}_AppMain, $APP_UPPER, 80, 16384, 0x0, 0;" sample_defs/cpu1_cfe_es_startup.scr - cat sample_defs/cpu1_cfe_es_startup.scr - - - name: Make install - run: make SIMULATION=native BUILDTYPE=release OMIT_DEPRECATED=true install - - - name: Run cFS - working-directory: ./build/exe/cpu1 - run: | - ./core-cpu1 > ../../../cFS_startup_cpu1.txt & - sleep 30 - ../host/cmdUtil --endian=LE --pktid=0x1806 --cmdcode=2 --half=0x0002 - - - name: Archive results - uses: actions/upload-artifact@v4 - with: - name: cFS_startup_log - path: cFS_startup_cpu1.txt - - - name: Confirm startup string - run: | - if [[ -z $(grep "$START_STRING" cFS_startup_cpu1.txt) ]]; then - echo "Startup verification string not found in log: $START_STRING" - echo "" - echo "Possible related event messages:" - grep "/$APP_UPPER " cFS_startup_cpu1.txt - exit -1 - fi - - - name: Check for cFS Warnings - if: success() || failure() - run: | - if [[ -n $(grep -i "warn\|err\|fail" cFS_startup_cpu1.txt) ]]; then - echo "cFS startup warn|err|fail:" - echo "" - grep -i 'warn\|err\|fail' cFS_startup_cpu1.txt - exit -1 - fi diff --git a/.github/workflows/cfs-wiki.yml b/.github/workflows/cfs-wiki.yml deleted file mode 100644 index f3186d1..0000000 --- a/.github/workflows/cfs-wiki.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Update wiki - -on: - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -# Force bash to apply pipefail option so pipeline failures aren't masked -defaults: - run: - shell: bash - -jobs: - build: - runs-on: ubuntu-latest - - steps: - # Checks out a copy of your repository on the ubuntu-latest machine - - name: Checkout code - uses: actions/checkout@v4 - with: - submodules: true - - - name: create CCB agenda - run: python3 .github/scripts/create_ccb_agenda.py - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Archive CCB agenda artifact - uses: actions/upload-artifact@v4 - with: - name: ccb-agenda - path: ./CCBAgenda.md \ No newline at end of file diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml deleted file mode 100644 index 761cc08..0000000 --- a/.github/workflows/changelog.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Changelog - -# Controls when the action will run. -on: - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -# Force bash to apply pipefail option so pipeline failures aren't masked -defaults: - run: - shell: bash - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - name: Run Changelog - uses: heinrichreimer/github-changelog-generator-action@v2.1.1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - issuesLabel: "### Closed issues" - breakingLabel: "### Breaking changes" - enhancementLabel: "### Implemented enhancements" - bugsLabel: "### Fixed bugs" - deprecatedLabel: "### Deprecated" - removedLabel: "### Removed" - securityLabel: "### Security fixes" - pullRequests: false - author: false - - - name: "Upload changelog" - uses: actions/upload-artifact@v4 - with: - name: "Changelog" - path: CHANGELOG.md diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml deleted file mode 100644 index 0e1e1b0..0000000 --- a/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: "CodeQL Analysis: cFS-Bundle" - -on: - push: - branches: - - dev - - main - pull_request: - types: - - opened - - reopened - - synchronize - workflow_dispatch: - -jobs: - codeql: - uses: nasa/cFS/.github/workflows/codeql-reusable.yml@main - with: - component-path: cFS - make: make -j8 - test: true diff --git a/.github/workflows/codeql-reusable.yml b/.github/workflows/codeql-reusable.yml deleted file mode 100644 index 641e1c6..0000000 --- a/.github/workflows/codeql-reusable.yml +++ /dev/null @@ -1,160 +0,0 @@ -name: "CodeQL Reusable Workflow" - -on: - workflow_call: - inputs: - # REQUIRED Inputs - component-path: - description: 'Path to repo being tested in a cFS bundle setup' - type: string - required: true - default: cFS - - # Optional inputs - category: - description: 'Analysis Category' - required: false - type: string - - make: - description: 'Build Command' - default: '' #Typically `make` or `make install`. Default is blank for workflows that don't need to build source - required: false - type: string - - prep: - description: 'Make Prep' - default: make prep - required: false - type: string - - setup: - description: 'Build Prep Commands' - type: string - default: cp ./cfe/cmake/Makefile.sample Makefile && cp -r ./cfe/cmake/sample_defs sample_defs - required: false - - test: - description: 'Value for ENABLE_UNIT_TESTS flag' - type: string - default: false - required: false - -# Force bash to apply pipefail option so pipeline failures aren't masked -defaults: - run: - shell: bash - -env: - SIMULATION: native - ENABLE_UNIT_TESTS: ${{inputs.test}} - OMIT_DEPRECATED: true - BUILDTYPE: release - REPO: ${{github.event.repository.name}} - -jobs: - #Checks for duplicate actions. Skips push actions if there is a matching or duplicate pull-request action. - check-for-duplicates: - runs-on: ubuntu-22.04 - # Map a step output to a job output - outputs: - should_skip: ${{ steps.skip_check.outputs.should_skip }} - steps: - - id: skip_check - uses: fkirc/skip-duplicate-actions@master - with: - concurrent_skipping: 'same_content' - skip_after_successful_duplicate: 'true' - do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]' - - Analysis: - #Continue if check-for-duplicates found no duplicates. Always runs for pull-requests. - needs: check-for-duplicates - if: ${{ needs.check-for-duplicates.outputs.should_skip != 'true' }} - runs-on: ubuntu-22.04 - timeout-minutes: 15 - - strategy: - fail-fast: false - matrix: - scan-type: [security, coding-standard] - - permissions: - security-events: write - - steps: - # Setup Bundle directory - - name: Setup cFS-Bundle directory (component-path = cFS) - if: inputs.component-path == 'cFS' - run: - echo "BUILD_DIRECTORY=${{github.workspace}}" >> $GITHUB_ENV - - - name: Setup cFS-Bundle directory (component-path != cFS) - if: inputs.component-path != 'cFS' - run: | - cd .. - git clone https://github.com/nasa/cFS.git --recurse-submodules - cd cFS - echo "BUILD_DIRECTORY=$(pwd)" >> $GITHUB_ENV - git log -1 --pretty=oneline - git submodule - rm -r .git - rm -rf ${{ inputs.component-path }} - ln -s ${{github.workspace}} ${{ inputs.component-path }} - - - - name: Checkout ${{ github.repository }} - uses: actions/checkout@v4 - with: - submodules: recursive - - # Setup the build system - - name: cFS Build Setup - run: | - ${{ inputs.setup }} - ${{ inputs.prep }} - working-directory: ${{env.BUILD_DIRECTORY}} - - - name: Initialize CodeQL - uses: github/codeql-action/init@v3 - with: - languages: cpp - config-file: nasa/cFS/.github/codeql/codeql-${{matrix.scan-type}}.yml@main - - - name: Build - run: ${{ inputs.make }} - working-directory: ${{env.BUILD_DIRECTORY}} - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v3 - with: - add-snippets: true - category: ${{matrix.scan-type}} - upload: false - output: CodeQL-Sarif-${{ matrix.scan-type }} - - - name: Rename Sarif - run: | - mv CodeQL-Sarif-${{ matrix.scan-type }}/cpp.sarif CodeQL-Sarif-${{ matrix.scan-type }}/Codeql-${{ matrix.scan-type }}.sarif - sed -i 's/"name" : "CodeQL"/"name" : "CodeQL-${{ matrix.scan-type }}"/g' CodeQL-Sarif-${{ matrix.scan-type }}/Codeql-${{ matrix.scan-type }}.sarif - - - name: filter-sarif - uses: zbazztian/filter-sarif@master - with: - patterns: | - -**/*.md - -**/*.txt - -**/*.dox - input: CodeQL-Sarif-${{ matrix.scan-type }}/Codeql-${{ matrix.scan-type }}.sarif - output: CodeQL-Sarif-${{ matrix.scan-type }}/Codeql-${{ matrix.scan-type }}.sarif - - - name: Archive Sarif - uses: actions/upload-artifact@v4 - with: - name: CodeQL-Sarif-${{ matrix.scan-type }} - path: CodeQL-Sarif-${{ matrix.scan-type }} - - - name: Upload SARIF - uses: github/codeql-action/upload-sarif@v3 - with: - sarif_file: CodeQL-Sarif-${{ matrix.scan-type }}/Codeql-${{ matrix.scan-type }}.sarif diff --git a/.github/workflows/format-check.yml b/.github/workflows/format-check.yml deleted file mode 100644 index f0bf34c..0000000 --- a/.github/workflows/format-check.yml +++ /dev/null @@ -1,84 +0,0 @@ -name: Format Check - -# Run on all push and pull requests -on: - pull_request: - types: - - opened - - reopened - - synchronize - -# Force bash to apply pipefail option so pipeline failures aren't masked -defaults: - run: - shell: bash - -jobs: - #Checks for duplicate actions. Skips push actions if there is a matching or duplicate pull-request action. - check-for-duplicates: - runs-on: ubuntu-latest - # Map a step output to a job output - outputs: - should_skip: ${{ steps.skip_check.outputs.should_skip }} - steps: - - id: skip_check - uses: fkirc/skip-duplicate-actions@master - with: - concurrent_skipping: 'same_content' - skip_after_successful_duplicate: 'true' - do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]' - - format-checker: - name: Run format check - #Continue if check-for-duplicates found no duplicates. Always runs for pull-requests. - needs: check-for-duplicates - if: ${{ needs.check-for-duplicates.outputs.should_skip != 'true' }} - runs-on: ubuntu-22.04 - timeout-minutes: 15 - - steps: - - name: Install format checker - run: | - sudo apt-get update && sudo apt-get install clang-format - - - name: Checkout bundle - uses: actions/checkout@v4 - with: - repository: nasa/cFS - - - name: Checkout - uses: actions/checkout@v4 - with: - path: repo - - - name: Generate format differences - run: | - cd repo - find . -name "*.[ch]" -exec clang-format -i -style=file {} + - git diff > $GITHUB_WORKSPACE/style_differences.txt - - - name: Archive Static Analysis Artifacts - uses: actions/upload-artifact@v4 - with: - name: style_differences - path: style_differences.txt - - check-commit-message: - name: Check Commit Message - needs: check-for-duplicates - # Only run for pull-requests. - if: ${{ github.event_name == 'pull_request' }} - runs-on: ubuntu-22.04 - timeout-minutes: 15 - steps: - # Check each commit message associated with the pull-request against the pattern. - - name: Check each commit message - uses: gsactions/commit-message-checker@v2 - if: always() - with: - pattern: '^((Fix|HotFix|Part)\s\#[0-9]+,\s[a-zA-Z0-9]+|Merge\spull\srequest\s\#[0-9]+\s[a-zA-Z0-9]+|IC:\s[a-zA-Z0-9]+)' - error: 'You need at least one "Fix|HotFix|Part #, " line in the commit message.' - excludeDescription: 'true' - excludeTitle: 'true' - checkAllCommitMessages: 'true' - accessToken: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/static-analysis-misra.yml b/.github/workflows/static-analysis-misra.yml deleted file mode 100644 index 928d33a..0000000 --- a/.github/workflows/static-analysis-misra.yml +++ /dev/null @@ -1,131 +0,0 @@ -name: Static Analysis with MISRA - -# Run this workflow manually from the Actions tab -on: - workflow_dispatch: - -# Force bash to apply pipefail option so pipeline failures aren't masked -defaults: - run: - shell: bash - -jobs: - #Checks for duplicate actions. Skips push actions if there is a matching or duplicate pull-request action. - check-for-duplicates: - runs-on: ubuntu-latest - # Map a step output to a job output - outputs: - should_skip: ${{ steps.skip_check.outputs.should_skip }} - steps: - - id: skip_check - uses: fkirc/skip-duplicate-actions@master - with: - concurrent_skipping: 'same_content' - skip_after_successful_duplicate: 'true' - do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]' - - misra-analysis: - #Continue if check-for-duplicates found no duplicates. Always runs for pull-requests. - needs: check-for-duplicates - if: ${{ needs.check-for-duplicates.outputs.should_skip != 'true' }} - name: Run cppcheck with misra - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - cppcheck: [bundle, cfe, osal, psp] - - steps: - - name: Install cppcheck - run: sudo apt-get install cppcheck -y - - # Checks out a copy of the cfs bundle - - name: Checkout code - uses: actions/checkout@v4 - with: - submodules: true - - - name: Get MISRA addon - run: | - sudo apt-get install git -y - git clone https://github.com/danmar/cppcheck.git - cp cppcheck/addons/misra.py misra.py - cp cppcheck/addons/cppcheckdata.py cppcheckdata.py - cp cppcheck/addons/misra_9.py misra_9.py - - - name: Run bundle cppcheck - if: ${{matrix.cppcheck =='bundle'}} - run: | - cppcheck --addon=misra --force --inline-suppr --quiet . --xml 2> ${{matrix.cppcheck}}_cppcheck_err.xml - cppcheck --addon=misra --force --inline-suppr --quiet . 2> ${{matrix.cppcheck}}_cppcheck_err.txt - - # Run strict static analysis for embedded portions of cfe, osal, and psp - - name: cfe strict cppcheck - if: ${{matrix.cppcheck =='cfe'}} - run: | - cd ${{matrix.cppcheck}} - cppcheck --addon=misra --force --inline-suppr --std=c99 --language=c --enable=warning,performance,portability,style --suppress=variableScope --inconclusive ./modules/core_api/fsw ./modules/core_private/fsw ./modules/es/fsw ./modules/evs/fsw ./modules/fs/fsw ./modules/msg/fsw ./modules/resourceid/fsw ./modules/sb/fsw ./modules/sbr/fsw ./modules/tbl/fsw ./modules/time/fsw -UCFE_PLATFORM_TIME_CFG_CLIENT -DCFE_PLATFORM_TIME_CFG_SERVER --xml 2> ${{matrix.cppcheck}}_cppcheck_err.xml - cppcheck --addon=misra --force --inline-suppr --std=c99 --language=c --enable=warning,performance,portability,style --suppress=variableScope --inconclusive ./modules/core_api/fsw ./modules/core_private/fsw ./modules/es/fsw ./modules/evs/fsw ./modules/fs/fsw ./modules/msg/fsw ./modules/resourceid/fsw ./modules/sb/fsw ./modules/sbr/fsw ./modules/tbl/fsw ./modules/time/fsw -UCFE_PLATFORM_TIME_CFG_CLIENT -DCFE_PLATFORM_TIME_CFG_SERVER 2> ${{matrix.cppcheck}}_cppcheck_err.txt - - - name: osal strict cppcheck - if: ${{matrix.cppcheck =='osal'}} - run: | - cd ${{matrix.cppcheck}} - cppcheck --addon=misra --force --inline-suppr --std=c99 --language=c --enable=warning,performance,portability,style --suppress=variableScope --inconclusive ./src/bsp ./src/os --xml 2> ${{matrix.cppcheck}}_cppcheck_err.xml - cppcheck --addon=misra --force --inline-suppr --std=c99 --language=c --enable=warning,performance,portability,style --suppress=variableScope --inconclusive ./src/bsp ./src/os 2> ${{matrix.cppcheck}}_cppcheck_err.txt - - - name: psp strict cppcheck - if: ${{matrix.cppcheck =='psp'}} - run: | - cd ${{matrix.cppcheck}} - cppcheck --addon=misra --force --inline-suppr --std=c99 --language=c --enable=warning,performance,portability,style --suppress=variableScope --inconclusive ./fsw --xml 2> ${{matrix.cppcheck}}_cppcheck_err.xml - cppcheck --addon=misra --force --inline-suppr --std=c99 --language=c --enable=warning,performance,portability,style --suppress=variableScope --inconclusive ./fsw 2> ${{matrix.cppcheck}}_cppcheck_err.txt - - - name: Convert bundle cppcheck to sarif - uses: airtower-luna/convert-to-sarif@v0.2.0 - if: ${{matrix.cppcheck =='bundle'}} - with: - tool: 'CppCheck' - input_file: '${{matrix.cppcheck}}_cppcheck_err.xml' - sarif_file: '${{matrix.cppcheck}}_cppcheck_err.sarif' - - - name: Convert cfe, osal, psp cppcheck to sarif - uses: airtower-luna/convert-to-sarif@v0.2.0 - if: ${{matrix.cppcheck !='bundle'}} - with: - tool: 'CppCheck' - input_file: '${{matrix.cppcheck}}/${{matrix.cppcheck}}_cppcheck_err.xml' - sarif_file: '${{matrix.cppcheck}}_cppcheck_err.sarif' - - - name: Define workspace - run: | - echo "CONTAINER_WORKSPACE=${PWD}" >> ${GITHUB_ENV} - - - name: Archive bundle static analysis artifacts - uses: actions/upload-artifact@v4 - if: ${{matrix.cppcheck =='bundle'}} - with: - name: ${{matrix.cppcheck}}-cppcheck-err - path: ./*cppcheck_err.* - - - name: Archive osal, cfe, and psp static analysis artifacts - uses: actions/upload-artifact@v4 - if: ${{matrix.cppcheck !='bundle'}} - with: - name: ${{matrix.cppcheck}}-cppcheck-err - path: ./${{matrix.cppcheck}}/*cppcheck_err.* - - - name: Upload sarif results - uses: github/codeql-action/upload-sarif@v3 - with: - sarif_file: '${{matrix.cppcheck}}_cppcheck_err.sarif' - checkout_path: ${{ env.CONTAINER_WORKSPACE }} - - - name: Check for errors - run: | - if [[ -s ${{matrix.cppcheck}}_cppcheck_err.txt ]]; - then - cat ${{matrix.cppcheck}}_cppcheck_err.txt - exit -1 - fi diff --git a/.github/workflows/static-analysis-reuse.yml b/.github/workflows/static-analysis-reuse.yml deleted file mode 100644 index 225b4a2..0000000 --- a/.github/workflows/static-analysis-reuse.yml +++ /dev/null @@ -1,9 +0,0 @@ -name: Bundle Static Analysis - -on: - workflow_dispatch: - -jobs: - static-analysis: - name: Static Analysis - uses: nasa/cFS/.github/workflows/static-analysis.yml@main diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml deleted file mode 100644 index ec2a8c9..0000000 --- a/.github/workflows/static-analysis.yml +++ /dev/null @@ -1,122 +0,0 @@ -name: Static Analysis - -on: - workflow_call: - inputs: - strict-dir-list: - description: 'Directory List' - type: string - default: '' - cmake-project-options: - description: 'Command line options to pass to CMake' - type: string - default: '' - cppcheck-xslt-path: - description: 'Path to XSLT file for translating cppcheck XML output' - type: string - default: 'nasa/cFS/main/.github/scripts' - -# Force bash to apply pipefail option so pipeline failures aren't masked -defaults: - run: - shell: bash - -jobs: - #Checks for duplicate actions. Skips push actions if there is a matching or duplicate pull-request action. - check-for-duplicates: - name: Check for Duplicates - runs-on: ubuntu-latest - # Map a step output to a job output - outputs: - should_skip: ${{ steps.skip_check.outputs.should_skip }} - steps: - - id: skip_check - uses: fkirc/skip-duplicate-actions@master - with: - concurrent_skipping: 'same_content' - skip_after_successful_duplicate: 'true' - do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]' - - static-analysis: - #Continue if check-for-duplicates found no duplicates. Always runs for pull-requests. - needs: check-for-duplicates - if: ${{ needs.check-for-duplicates.outputs.should_skip != 'true' }} - name: Run cppcheck - runs-on: ubuntu-22.04 - - strategy: - fail-fast: false - - steps: - - name: Install cppcheck - run: | - sudo apt-get update - sudo apt-get install cppcheck xsltproc -y - - - name: Install sarif tool - run: npm install @microsoft/sarif-multitool - - - name: Fetch conversion XSLT - run: | - wget -O cppcheck-xml2text.xslt https://raw.githubusercontent.com/${{ inputs.cppcheck-xslt-path }}/cppcheck-xml2text.xslt - wget -O cppcheck-merge.xslt https://raw.githubusercontent.com/${{ inputs.cppcheck-xslt-path }}/cppcheck-merge.xslt - - # Checks out a copy of the reference repository - - name: Checkout subject repository - uses: actions/checkout@v4 - with: - path: source - submodules: true - - # For a CMake-based project, get the list of files by setting up a build with CMAKE_EXPORT_COMPILE_COMMANDS=ON and - # referencing the compile_commands.json file produced by the tool. This will capture the correct include paths and - # compile definitions based on how the source is actually compiled. - - name: CMake Setup - if: ${{ inputs.cmake-project-options != '' }} - run: | - cmake -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/staging -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=debug ${{ inputs.cmake-project-options }} -S source -B build - echo CPPCHECK_OPTS=--project="$GITHUB_WORKSPACE/build/compile_commands.json" >> $GITHUB_ENV - - # For a Non-CMake project, just pass the base source directory of the repo. This will examine all .c files in the repo, - # but it will not see the macro definitions, and thus may not correctly interpret macro usage. - - name: Non-CMake Setup - if: ${{ inputs.cmake-project-options == '' }} - run: | - echo CPPCHECK_OPTS="$GITHUB_WORKSPACE/source" >> $GITHUB_ENV - - - name: Run general cppcheck - run: cppcheck --force --inline-suppr --xml $CPPCHECK_OPTS 2> cppcheck_err.xml - - # Run strict static analysis for selected portions of source code - - name: Run Strict cppcheck - if: ${{ inputs.strict-dir-list !='' }} - working-directory: ${{ github.workspace }}/source - run: cppcheck --force --inline-suppr --std=c99 --language=c --enable=warning,performance,portability,style --suppress=variableScope --inconclusive --xml ${{ inputs.strict-dir-list }} 2> ../strict_cppcheck_err.xml - - - name: Merge cppcheck results - if: ${{ inputs.strict-dir-list !='' }} - run: | - mv cppcheck_err.xml general_cppcheck_err.xml - xsltproc --stringparam merge_file strict_cppcheck_err.xml cppcheck-merge.xslt general_cppcheck_err.xml > cppcheck_err.xml - - - name: Convert cppcheck results to SARIF - run: npx "@microsoft/sarif-multitool" convert "cppcheck_err.xml" --tool "CppCheck" --output "cppcheck_err.sarif" - - - name: Convert cppcheck results to Markdown - run: xsltproc cppcheck-xml2text.xslt cppcheck_err.xml | tee $GITHUB_STEP_SUMMARY cppcheck_err.txt - - - name: Upload SARIF results - uses: github/codeql-action/upload-sarif@v3 - with: - sarif_file: ${{ github.workspace }}/cppcheck_err.sarif - checkout_path: ${{ github.workspace }}/source - category: 'cppcheck' - - - name: Archive static analysis artifacts - uses: actions/upload-artifact@v4 - with: - name: cppcheck-errors - path: ./*cppcheck_err.* - - - name: Check for reported errors - run: tail -n 1 cppcheck_err.txt | grep -q '^\*\*0 error(s) reported\*\*$' diff --git a/.github/workflows/unit-test-coverage.yml b/.github/workflows/unit-test-coverage.yml deleted file mode 100644 index c3e0753..0000000 --- a/.github/workflows/unit-test-coverage.yml +++ /dev/null @@ -1,125 +0,0 @@ -name: Unit Test and Coverage - -on: - workflow_call: - inputs: - # Optional inputs - app-name: - description: Application name, if different from repo name - type: string - required: false - default: ${{ github.event.repository.name }} - max-missed-branches: - description: Maximum number of missed branches - type: number - required: false - default: 0 - max-missed-lines: - description: Maximum number of missed lines - type: number - required: false - default: 0 - -# Force bash to apply pipefail option so pipeline failures aren't masked -defaults: - run: - shell: bash - -jobs: - # Checks for duplicate actions. Skips push actions if there is a matching or - # duplicate pull-request action. - checks-for-duplicates: - runs-on: ubuntu-latest - # Map a step output to a job output - outputs: - should_skip: ${{ steps.skip_check.outputs.should_skip }} - steps: - - id: skip_check - uses: fkirc/skip-duplicate-actions@master - with: - concurrent_skipping: 'same_content' - skip_after_successful_duplicate: 'true' - do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]' - - unit-test-coverage: - needs: checks-for-duplicates - if: ${{ needs.checks-for-duplicates.outputs.should_skip != 'true' || contains(github.ref, 'main') }} - name: Build, run unit tests and enforce coverage - runs-on: ubuntu-22.04 - - steps: - - name: Install coverage tools - run: sudo apt-get install lcov -y - - - name: Set up environment variables - # Apps typically use lowercase targets and uppercase names, this logic is fragile but works - run: | - echo "APP_UPPER=$(echo ${{ inputs.app-name }} | sed 's/[a-z]/\U&/g')" >> $GITHUB_ENV - echo "APP_LOWER=$(echo ${{ inputs.app-name }} | sed 's/[A-Z]/\L&/g')" >> $GITHUB_ENV - - - name: Checkout Bundle Main - uses: actions/checkout@v4 - with: - submodules: true - repository: nasa/cFS - - - name: Checkout Repo - uses: actions/checkout@v4 - with: - path: apps/${{ env.APP_LOWER }} - - - name: Copy Files - run: | - cp ./cfe/cmake/Makefile.sample Makefile - cp -r ./cfe/cmake/sample_defs sample_defs - - - name: Add Repo To Build - run: | - sed -i "/list(APPEND MISSION_GLOBAL_APPLIST/a list(APPEND MISSION_GLOBAL_APPLIST $APP_LOWER)" sample_defs/targets.cmake - - - name: Make Prep - run: make SIMULATION=native ENABLE_UNIT_TESTS=true OMIT_DEPRECATED=true prep - - - name: Build app build dependencies - run: make -C build/tools/elf2cfetbl - - - name: Build app target - run: | - make -C build/native/default_cpu1/apps/$APP_LOWER - - - name: Capture initial lcov and run test - run: | - lcov --capture --initial --directory build --output-file coverage_base.info - (cd build/native/default_cpu1/apps/$APP_LOWER; ctest --verbose) | tee test_results.txt - - - name: Calculate coverage - run: | - lcov --capture --rc lcov_branch_coverage=1 --directory build --output-file coverage_test.info - lcov --rc lcov_branch_coverage=1 --add-tracefile coverage_base.info --add-tracefile coverage_test.info --output-file coverage_total.info - genhtml coverage_total.info --branch-coverage --output-directory lcov | tee lcov_out.txt - - - name: Confirm minimum coverage - run: | - branch_nums=$(grep -A 3 "Overall coverage rate" lcov_out.txt | grep branches | grep -oP "[0-9]+[0-9]*") - line_nums=$(grep -A 3 "Overall coverage rate" lcov_out.txt | grep lines | grep -oP "[0-9]+[0-9]*") - - branch_diff=$(echo $branch_nums | awk '{ print $4 - $3 }') - line_diff=$(echo $line_nums | awk '{ print $4 - $3 }') - if [ $branch_diff -gt ${{ inputs.max-missed-branches }} ] || [ $line_diff -gt ${{ inputs.max-missed-lines }} ] - then - grep -A 3 "Overall coverage rate" lcov_out.txt - echo "$branch_diff branches missed, ${{ inputs.max-missed-branches }} allowed" - echo "$line_diff lines missed, ${{ inputs.max-missed-lines }} allowed" - exit -1 - fi - - - name: Archive results - # Upload if success or failure which supports skipping, unlike always() - if: success() || failure() - uses: actions/upload-artifact@v4 - with: - name: Unit test and coverage results - path: | - test_results.txt - lcov_out.txt - lcov diff --git a/.gitmodules b/.gitmodules index addbce0..8dab019 100644 --- a/.gitmodules +++ b/.gitmodules @@ -27,7 +27,9 @@ url = https://github.com/nasa/fprime.git [submodule "fprime_app"] path = apps/fprime_app - url = https://github.com/fprime-community/fprime_app.git + # Temporarily points at the PR fork (fprime-community/fprime_app#6); + # revert to fprime-community/fprime_app once merged + url = https://github.com/lestarch-autobot/fprime_app.git [submodule "fprime_gds"] path = apps/fprime_gds url = https://github.com/fprime-community/fprime_gds.git diff --git a/apps/fprime_app b/apps/fprime_app index 2f98c40..e2d5ad5 160000 --- a/apps/fprime_app +++ b/apps/fprime_app @@ -1 +1 @@ -Subproject commit 2f98c405cdaf0451eba867a2f36ecc7f413aef69 +Subproject commit e2d5ad5b9975d285b607ee7bc3772668688d92f3 diff --git a/apps/fprime_gds b/apps/fprime_gds index f9c3e33..1d9f7c9 160000 --- a/apps/fprime_gds +++ b/apps/fprime_gds @@ -1 +1 @@ -Subproject commit f9c3e33e4967c9119f7c4705c0727b782ffe68e2 +Subproject commit 1d9f7c917c798d8a4fc6dc9c86641884073b12cd diff --git a/apps/sch/.gitattributes b/apps/sch/.gitattributes new file mode 100644 index 0000000..a950de2 --- /dev/null +++ b/apps/sch/.gitattributes @@ -0,0 +1,6 @@ +*.h linguist-language=c + +*.css linguist-documentation=true +*.htm linguist-documentation=true +*.html linguist-documentation=true +*.prc linguist-documentation=true diff --git a/apps/sch/CMakeLists.txt b/apps/sch/CMakeLists.txt new file mode 100644 index 0000000..2382711 --- /dev/null +++ b/apps/sch/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 2.6.4) +project(CFS_SCH C) + +include_directories(fsw/public_inc) +include_directories(fsw/mission_inc) +include_directories(fsw/platform_inc) +include_directories(fsw/src) + +aux_source_directory(fsw/src APP_SRC_FILES) + +# Create the app module +add_cfe_app(sch ${APP_SRC_FILES}) + +# Default schedule and message definition tables +add_cfe_tables(sch fsw/tables/sch_def_schtbl.c fsw/tables/sch_def_msgtbl.c) diff --git a/apps/sch/README.md b/apps/sch/README.md new file mode 100644 index 0000000..9ea0d48 --- /dev/null +++ b/apps/sch/README.md @@ -0,0 +1,16 @@ +# Scheduler + +NASA core Flight System Scheduler Application + +## Description + +The Scheduler application (SCH) is a core Flight System (cFS) application that is a plug in to the Core Flight Executive (cFE) component of the cFS. + +The cFS is a platform and project independent reusable software framework and set of reusable applications developed by NASA Goddard Space Flight Center. This framework is used as the basis for the flight software for satellite data systems and instruments, but can be used on other embedded systems. More information on the cFS can be found at [http://cfs.gsfc.nasa.gov](http://cfs.gsfc.nasa.gov) + +The SCH application provides a method of generating software bus messages at pre-determined timing intervals. This allows the system to operate in a Time Division Multiplexed (TDM) fashion with deterministic behavior. The TDM major frame is defined by the Major Time Synchronization Signal used by the +cFE TIME Services (typically 1 Hz). The Minor Frame timing (number of slots executed within each Major Frame) is also configurable. + +## License + +This software is licensed under the NASA Open Source Agreement. http://ti.arc.nasa.gov/opensource/nosa diff --git a/apps/sch/cfs-sch-app-OSS-readme.txt b/apps/sch/cfs-sch-app-OSS-readme.txt new file mode 100644 index 0000000..7af4c00 --- /dev/null +++ b/apps/sch/cfs-sch-app-OSS-readme.txt @@ -0,0 +1,89 @@ +core Flight System (cFS) Scheduler Application (SCH) +Open Source Release Readme + +SCH Release 2.2.1 + +Date: +July 5, 2017 + +Introduction: + The Scheduler application (SCH) is a core Flight System (cFS) application + that is a plug in to the Core Flight Executive (cFE) component of the cFS. + + The cFS is a platform and project independent reusable software framework and + set of reusable applications developed by NASA Goddard Space Flight Center. + This framework is used as the basis for the flight software for satellite data + systems and instruments, but can be used on other embedded systems. More + information on the cFS can be found at http://cfs.gsfc.nasa.gov + + The SCH application provides a method of generating software bus messages + at pre-determined timing intervals. This allows the system to operate in a + Time Division Multiplexed (TDM) fashion with deterministic behavior. The TDM + major frame is defined by the Major Time Synchronization Signal used by the + cFE TIME Services (typically 1 Hz) and the Minor Frame timing is defined + via a SCH Configuration Parameter that identifies the number of Minor Frame + Slots that are executed within each Major Frame. + + The SCH application is written in C and depends on the cFS Operating System + Abstraction Layer (OSAL) and cFE components. To build and run the SCH + application, follow the cFS Deployment Guide instructions contained in + cFE-6.5.0a-OSS-release/docs. There is additional SCH application specific + configuration information contained in the application user's guide + available in cfs-sch-2.2.1-OSS-release/docs/users_guide + + There are also "Quick start" instructions provided in + cFE-6.5.0a-OSS-release/cfe-OSS-readme.txt + + The OSAL is available at http://sourceforge.net/projects/osal/ and + github.com/nasa/ + + The cFE is available at http://sourceforge.net/projects/coreflightexec + + This software is licensed under the NASA Open Source Agreement. + http://ti.arc.nasa.gov/opensource/nosa + + +Software Included: + Scheduler application (SCH) 2.2.1 + + +Software Required: + + Operating System Abstraction Layer 4.2.0 or higher can be + obtained at http://sourceforge.net/projects/osal or + github.com/nasa/osal + + core Flight Executive 6.5.0 or higher can be obtained at + http://sorceforge.net/projects/coreflightexec + + +Runtime Targets Supported: + The "out of the box" targets in the cFE 6.5.0 distribution include: + 1. 32 bit x86 Linux ( CentOS 6.x ) + 2. Motorola MCP750 PowerPC vxWorks 6.4 + +Other targets: + Other targets are included, but may take additional work to + run. They are included as examples of other target + environments. + 1. mcf5235-rtems - This is for the Axiom MCF5235 Coldfire board running + RTEMS 4.10. It requires a static loader component for the + OS abstraction layer. The static loader is currently + not available as open source, so this target is not + considered complete. RTEMS 4.11 will have a dynamic + loader which will be supported by a future release + of the OS Abstraction Layer, completing the RTEMS support + for the cFE. + + Once RTEMS 4.11 is released, the goal is to support + an RTEMS simulator platform such as SPARC/sis or + quemu. + + 2. mac-osx and pc-cygwin - These targets are included for examples. They + will most likely be removed in the future. + The pc-linux target is highly recommended. If you + have a windows or mac computer it is relatively easy to + set up a free virtual machine environment with 32 bit + Cent OS 5.x. + +EOF \ No newline at end of file diff --git a/apps/sch/fsw/mission_inc/sch_perfids.h b/apps/sch/fsw/mission_inc/sch_perfids.h new file mode 100644 index 0000000..c8e46a0 --- /dev/null +++ b/apps/sch/fsw/mission_inc/sch_perfids.h @@ -0,0 +1,28 @@ +/************************************************************************ +** File: sch_perfids.h +** +** Copyright (c) 2007-2014 United States Government as represented by the +** Administrator of the National Aeronautics and Space Administration. +** All Other Rights Reserved. +** +** This software was created at NASA's Goddard Space Flight Center. +** This software is governed by the NASA Open Source Agreement and may be +** used, distributed and modified only pursuant to the terms of that +** agreement. +** +** Purpose: +** Define SCH Performance IDs +** +** Notes: +** +*************************************************************************/ +#ifndef _sch_perfids_h_ +#define _sch_perfids_h_ + +#define SCH_APPMAIN_PERF_ID 36 + +#endif /* _sch_perfids_h_ */ + +/************************/ +/* End of File Comment */ +/************************/ diff --git a/apps/sch/fsw/platform_inc/sch_msgids.h b/apps/sch/fsw/platform_inc/sch_msgids.h new file mode 100644 index 0000000..f6b1007 --- /dev/null +++ b/apps/sch/fsw/platform_inc/sch_msgids.h @@ -0,0 +1,48 @@ +/************************************************************************ +** File: +** $Id: sch_msgids.h 1.3 2017/06/21 15:28:57EDT mdeschu Exp $ +** +** Copyright (c) 2007-2014 United States Government as represented by the +** Administrator of the National Aeronautics and Space Administration. +** All Other Rights Reserved. +** +** This software was created at NASA's Goddard Space Flight Center. +** This software is governed by the NASA Open Source Agreement and may be +** used, distributed and modified only pursuant to the terms of that +** agreement. +** +** Purpose: +** The CFS Scheduler (SCH) Application Message IDs header file +** +** Notes: +** +*************************************************************************/ +#ifndef _sch_msgids_h_ +#define _sch_msgids_h_ + +/************************** +** SCH Command Message IDs +***************************/ +#define SCH_CMD_MID 0x1895 /**< \brief SCH Ground Commands Message ID */ +#define SCH_SEND_HK_MID 0x1896 /**< \brief SCH Send Housekeeping Message ID */ +#define SCH_UNUSED_MID 0x1897 /**< \brief SCH MDT Unused Message Message ID */ +/* +#define SCH_SPARE1 0x1898 +#define SCH_SPARE2 0x1899 +*/ + +/*************************** +** SCH Telemetry Message IDs +****************************/ +#define SCH_HK_TLM_MID 0x0897 /**< \brief SCH Housekeeping Telemetry Message ID */ +#define SCH_DIAG_TLM_MID 0x0898 /**< \brief SCH Diagnostic Telemetry Message ID */ +/* +#define SCH_TLM_SPARE1 0x0899 +#define SCH_TLM_SPARE2 0x089A +*/ + +#endif /* _sch_msgids_h_ */ + +/************************/ +/* End of File Comment */ +/************************/ diff --git a/apps/sch/fsw/platform_inc/sch_platform_cfg.h b/apps/sch/fsw/platform_inc/sch_platform_cfg.h new file mode 100644 index 0000000..83d049e --- /dev/null +++ b/apps/sch/fsw/platform_inc/sch_platform_cfg.h @@ -0,0 +1,303 @@ +/************************************************************************ +** File: +** $Id: sch_platform_cfg.h 1.4 2017/06/21 15:28:58EDT mdeschu Exp $ +** +** Copyright (c) 2007-2014 United States Government as represented by the +** Administrator of the National Aeronautics and Space Administration. +** All Other Rights Reserved. +** +** This software was created at NASA's Goddard Space Flight Center. +** This software is governed by the NASA Open Source Agreement and may be +** used, distributed and modified only pursuant to the terms of that +** agreement. +** +** Purpose: +** The CFS Scheduler (SCH) Application platform configuration header file +** +** Notes: +** +*************************************************************************/ +#ifndef _sch_platform_cfg_h_ +#define _sch_platform_cfg_h_ + + + +/************************************************************************* +** Macro definitions +**************************************************************************/ + +/** +** \schcfg Software Bus Command Pipe Depth +** +** \par Description: +** Dictates the number of messages to SCH that can be queued while awaiting +** processing by the SCH Application. +** +** \par Limits +** Must be greater than zero +*/ +#define SCH_PIPE_DEPTH 12 /**< \brief SCH Command Pipe Depth */ + +/* +** Schedule table definitions... +*/ +/** +** \schcfg Minor Frame Frequency (in Hz) +** +** \par Description: +** Dictates the number of minor frame slots within each Major Frame. +** +** \par Limits +** Must be 2 or more and less than 65536 +*/ +#define SCH_TOTAL_SLOTS 100 /* SCH wake-up rate (Hz) */ + + +/** +** \schcfg Maximum number of Activities per Minor Frame +** +** \par Description: +** Dictates the number of activities that can be defined for each Minor Frame. +** +** \par Limits +** Must be at least one +*/ +#define SCH_ENTRIES_PER_SLOT 5 + + +/** +** \schcfg Maximum Number of Message Definitions in Message Definition Table +** +** \par Description: +** Dictates the number of messages that can be defined in Message Definition Table. +** +** \par Limits +** Must be at least one +*/ +#define SCH_MAX_MESSAGES 128 + +/** +** \schcfg Minimum Message ID allowed in Message Definition Table +** +** \par Description: +** Dictates the minimum message ID that can be used in the Message Definition Table. +** +** \par Limits +** Must be less than or equal to SCH_MDT_MAX_MSG_ID and greater than or equal to 0 +*/ +#define SCH_MDT_MIN_MSG_ID 0 + +/** +** \schcfg Maximum Message ID allowed in Message Definition Table +** +** \par Description: +** Dictates the maximum message ID that can be used in the Message Definition Table. +** +** \par Limits +** Must be less than or equal to #CFE_PLATFORM_SB_HIGHEST_VALID_MSGID and greater than +*SCH_MDT_MIN_MSG_ID +*/ + +#define SCH_MDT_MAX_MSG_ID CFE_PLATFORM_SB_HIGHEST_VALID_MSGID + +/** +** \schcfg Maximum Length, in Words, of a Message +** +** \par Description: +** Dictates the maximum number of words that can be assigned to a particular message +** in the Message Definition Table. +** +** \par Limits +** Must be at least large enough to hold the smallest possible message header +* ** (see #CFE_SB_TLM_HDR_SIZE and #CFE_SB_CMD_HDR_SIZE) +*/ +#define SCH_MAX_MSG_WORDS 64 /* max message length (in words) */ + + +/* +** Limits for how far we can get behind and how much we can do at once... +*/ +/** +** \schcfg Maximum Number of slots allowed for catch-up before skipping +** +** \par Description: +** Dictates the number of Minor Frames that will be processed in "Catch Up" +** mode before giving up and skipping ahead. +** +** \par Limits +** +*/ +#define SCH_MAX_LAG_COUNT (SCH_TOTAL_SLOTS / 2) + + +/** +** \schcfg Maximum Number of Slots to be processed when in "Catch Up" mode +** +** \par Description: +** Dictates the maximum number of slots SCH will process when trying to +** "Catch Up" to the correct slot for the current time. +** +** \par Limits +** Must be at least one +*/ +#define SCH_MAX_SLOTS_PER_WAKEUP 5 + +/* +** Conversion factor for how many microseconds in a wake-up period... +*/ +/** +** \schcfg Major Frame Period (in microseconds) +** +** \par Description: +** Dictates the number microseconds in a Major Frame. +** +** \par Limits +** Must be greater than zero +*/ +#define SCH_MICROS_PER_MAJOR_FRAME 1000000 + + +/** +** \schcfg Additional time allowed in Sync Slot to wait for Major Frame Sync (in microseconds) +** +** \par Description: +** Dictates the additional time allowed in the Syncronization Slot +** to allow the Major Frame Sync signal to be received and re-synchronize +** processing. +** +** \par Limits +** Must be less than the normal slot period +*/ +#define SCH_SYNC_SLOT_DRIFT_WINDOW 5000 + + +/** +** \schcfg Time, in milliseconds, to wait for all applications to be started and ready to run +** +** \par Description: +** Dictates the timeout for the #CFE_ES_WaitForStartupSync call that SCH uses to wait +** for all of the Applications specified in the startup script to finish initialization. +** SCH will wait this amount of time before assuming all startup script applications have +** been started and will then begin nominal schedule processing. +** +** \par Limits +** None +*/ +#define SCH_STARTUP_SYNC_TIMEOUT 50000 + + +/** +** \schcfg Time, in microseconds, to wait for first Major Frame Sync to arrive +** +** \par Description: +** Dictates the time allowed for the first Major Frame sync signal to arrive +** before assuming it is not going to occur and switching to a freewheeling +** mode. +** +** \par Limits +** Must be greater than or equal to the Major Frame Period +*/ +#define SCH_STARTUP_PERIOD (5*SCH_MICROS_PER_MAJOR_FRAME) + + +/* +** Specifies the limit on the number of consecutive noisy Major Frame signals +** before we begin to ignore them. +*/ +/** +** \schcfg Maximum Number of consecutive Noisy Major Frame signals before they are ignored +** +** \par Description: +** Dictates the number of consecutive "Noisy" Major Frame Signals (i.e. - signals that +** occur outside the expected window of their occurence) until the Major Frame signal +** is automatically ignored and the Minor Frame Timer is used instead. +** +** \par Limits +** This value should never be set to less than two because a single "noisy" Major +** Frame signal is likely when turning on or switching the 1 Hz signal on the spacecraft. +*/ +#define SCH_MAX_NOISY_MAJORF 2 + + +/** +** \schcfg Scheduler API Library Usage Status +** +** \par Description: +** Determines whether or not the Scheduler application is using the API library allowing +** for external tasks to disable and enable schedule processing. Note that if the library +** is to be used it must be generated as a separate object, and loaded prior to the +** appplication. +** +** \par Limits +** This value must either be 0 when not using or including the library, or 1 if the library +** is going to be used. +*/ +#define SCH_LIB_PRESENCE 1 + + +/** +** \schcfg Scheduler API Library Initial Inhibition Count +** +** \par Description: +** Sets the number of times the scheduler must be enabled following library initialization. +** This allows the scheduler to come up either enabled (set to 0) or disabled (set to +** a value greater than or equal to 1) +** +** \par Limits +** This value must be an unsigned 32 bit integer. +*/ +#define SCH_LIB_DIS_CTR 0 + + +/** +** \schcfg Default SCH Schedule Definition Table Filename +** +** \par Description: +** The value of this constant defines the default filename of +** the SCH Schedule Definition Table +** +** \par Limits +** The length of each string, including the NULL terminator cannot exceed +** the #OS_MAX_PATH_LEN value. +*/ + +#define SCH_SCHEDULE_FILENAME "/cf/sch_def_schtbl.tbl" + + +/** +** \schcfg Default SCH Message Definition Table Filename +** +** \par Description: +** The value of this constant defines the default filename of the +** SCH Message Definition Table +** +** \par Limits +** The length of each string, including the NULL terminator cannot exceed +** the #OS_MAX_PATH_LEN value. +*/ + +#define SCH_MESSAGE_FILENAME "/cf/sch_def_msgtbl.tbl" + + +/** \schcfg Mission specific version number for SCH application +** +** \par Description: +** An application version number consists of four parts: +** major version number, minor version number, revision +** number and mission specific revision number. The mission +** specific revision number is defined here and the other +** parts are defined in "sch_version.h". +** +** \par Limits: +** Must be defined as a numeric value that is greater than +** or equal to zero. +*/ + +#define SCH_MISSION_REV 0 + + +#endif /* _sch_platform_cfg_h_ */ + +/************************/ +/* End of File Comment */ +/************************/ diff --git a/apps/sch/fsw/public_inc/sch_api.h b/apps/sch/fsw/public_inc/sch_api.h new file mode 100644 index 0000000..28b3e44 --- /dev/null +++ b/apps/sch/fsw/public_inc/sch_api.h @@ -0,0 +1,92 @@ +/* +** $Id: sch_api.h 1.3 2017/06/21 15:28:57EDT mdeschu Exp $ +** +** Copyright (c) 2007-2014 United States Government as represented by the +** Administrator of the National Aeronautics and Space Administration. +** All Other Rights Reserved. +** +** This software was created at NASA's Goddard Space Flight Center. +** This software is governed by the NASA Open Source Agreement and may be +** used, distributed and modified only pursuant to the terms of that +** agreement. +** +** Purpose: This file contains api functions to change and obtain SCH Schedule Processing Enable State +** +** Author: +** +** References: +** +*/ + +#ifndef _sch_api_h_ +#define _sch_api_h_ + +/* +** Includes +*/ + +#include "cfe.h" + +/* +** Exported Functions +*/ + +/*****************************************************************************/ +/** +** \brief Informs SCH Application that processing of schedule table can resume +** +** \par Description +** This API decrements the disable schedule table processing reference count. +** Once all disable references have been eliminated, the SCH application will +** resume schedule table processing. +** +** \par Assumptions, External Events, and Notes: +** None +** +******************************************************************************/ +void SCH_EnableProcessing(void); + + +/*****************************************************************************/ +/** +** \brief Informs SCH Application that processing of schedule table should halt +** +** \par Description +** This API increments the disable schedule table processing reference count. +** Each time this API is called must be matched with a similar call to the +** SCH_EnableProcessing API before the SCH Application will resume +** processing of the schedule table. +** +** \par Assumptions, External Events, and Notes: +** None +** +******************************************************************************/ +void SCH_DisableProcessing(void); + + +/*****************************************************************************/ +/** +** \brief Obtains SCH Application processing state +** +** \par Description +** This API returns a TRUE/FALSE indication as to whether the SCH Application +** is allowed to process the contents of the Schedule table. +** +** \par Assumptions, External Events, and Notes: +** None +** +** \returns +** \retcode #TRUE \retdesc Schedule Table Processing is Enabled \endcode +** \retcode #FALSE \retdesc Schedule Table Processing is Disabled \endcode +** \endreturns +** +** +******************************************************************************/ +bool SCH_GetProcessingState(void); + +#endif /* _sch_api_ */ + +/************************/ +/* End of File Comment */ +/************************/ + diff --git a/apps/sch/fsw/src/sch_api.c b/apps/sch/fsw/src/sch_api.c new file mode 100644 index 0000000..8697157 --- /dev/null +++ b/apps/sch/fsw/src/sch_api.c @@ -0,0 +1,85 @@ +/* +** $Id: sch_api.c 1.3 2017/06/21 15:28:59EDT mdeschu Exp $ +** +** Copyright (c) 2007-2014 United States Government as represented by the +** Administrator of the National Aeronautics and Space Administration. +** All Other Rights Reserved. +** +** This software was created at NASA's Goddard Space Flight Center. +** This software is governed by the NASA Open Source Agreement and may be +** used, distributed and modified only pursuant to the terms of that +** agreement. +** +** Purpose: This file contains api functions to modify and obtain the current +** SCH Schedule Processing state. +** +** Author: +** +** References: +** +*/ + +/* +** Includes +*/ + +#include "sch_api.h" +#include "sch_apipriv.h" +#include "sch_platform_cfg.h" + +/* +** Exported data +*/ + +SCH_LibData_t SCH_LibData; + +/******************************************************************* +** +** SCH_LibInit() -- Initializes the SCH Library +** +** NOTE: For complete prolog information, see 'sch_apipriv.h'. +********************************************************************/ +int32 SCH_LibInit(void) +{ + SCH_LibData.ProcessingDisabledCtr = SCH_LIB_DIS_CTR; + return OS_SUCCESS; +} + +/******************************************************************* +** +** SCH_EnableProcessing() -- Enables SCH schedule processing +** +** NOTE: For complete prolog information, see 'sch_api.h'. +********************************************************************/ +void SCH_EnableProcessing(void) +{ + if (SCH_LibData.ProcessingDisabledCtr > 0) + { + SCH_LibData.ProcessingDisabledCtr--; + } +} + + +/******************************************************************* +** +** SCH_DisableProcessing() -- Disables SCH schedule processing +** +** NOTE: For complete prolog information, see 'sch_api.h'. +********************************************************************/ +void SCH_DisableProcessing(void) +{ + SCH_LibData.ProcessingDisabledCtr++; +} + + +/******************************************************************* +** +** SCH_GetProcessingState() -- Obtains the current SCH schedule +** table processing state +** +** NOTE: For complete prolog information, see 'sch_api.h'. +********************************************************************/ +bool SCH_GetProcessingState(void) +{ + return (SCH_LibData.ProcessingDisabledCtr == 0); +} diff --git a/apps/sch/fsw/src/sch_apipriv.h b/apps/sch/fsw/src/sch_apipriv.h new file mode 100644 index 0000000..a765f0f --- /dev/null +++ b/apps/sch/fsw/src/sch_apipriv.h @@ -0,0 +1,111 @@ +/************************************************************************ +** File: +** $Id: sch_apipriv.h 1.4 2017/06/21 15:29:01EDT mdeschu Exp $ +** +** Copyright (c) 2007-2014 United States Government as represented by the +** Administrator of the National Aeronautics and Space Administration. +** All Other Rights Reserved. +** +** This software was created at NASA's Goddard Space Flight Center. +** This software is governed by the NASA Open Source Agreement and may be +** used, distributed and modified only pursuant to the terms of that +** agreement. +** +** Purpose: +** The CFS Scheduler (SCH) API header file +** +** Notes: +** +*************************************************************************/ +#ifndef _sch_apipriv_ +#define _sch_apipriv_ + +/************************************************************************* +** +** Include section +** +**************************************************************************/ + +#include "cfe.h" + +/************************************************************************* +** +** Type definitions +** +**************************************************************************/ + +/* +** Type definition (SCH lib global data) +*/ +typedef struct +{ + uint32 ProcessingDisabledCtr; /**< \brief Processing disable if greater than zero */ +} SCH_LibData_t; + +/************************************************************************* +** +** Exported data +** +**************************************************************************/ + +extern SCH_LibData_t SCH_LibData; + +/************************************************************************* +** +** Exported functions +** +**************************************************************************/ + +/************************************************************************/ +/** \brief CFS Scheduler (SCH) Library Entry Point +** +** \par Description +** Scheduler library entry point for initialization. +** +** \par Assumptions, External Events, and Notes: +** None +** +*************************************************************************/ +int32 SCH_LibInit(void); + +/************************************************************************/ +/** \brief SCH_EnableProcessing() +** +** \par Description +** Enables SCH schedule processing. +** +** \par Assumptions, External Events, and Notes: +** None +** +*************************************************************************/ +void SCH_EnableProcessing(void); + +/************************************************************************/ +/** \brief SCH_DisableProcessing() +** +** \par Description +** Disables SCH schedule processing. +** +** \par Assumptions, External Events, and Notes: +** None +** +*************************************************************************/ +void SCH_DisableProcessing(void); + +/************************************************************************/ +/** \brief SCH_GetProcessingState() +** +** \par Description +** Obtains the current SCH schedule table processing state. +** +** \par Assumptions, External Events, and Notes: +** None +** +*************************************************************************/ +bool SCH_GetProcessingState(void); + +#endif /* _sch_apipriv_ */ + +/************************/ +/* End of File Comment */ +/************************/ diff --git a/apps/sch/fsw/src/sch_app.c b/apps/sch/fsw/src/sch_app.c new file mode 100644 index 0000000..eee4f09 --- /dev/null +++ b/apps/sch/fsw/src/sch_app.c @@ -0,0 +1,1315 @@ +/* +** $Id: sch_app.c 1.5 2017/06/21 15:29:02EDT mdeschu Exp $ +** +** Copyright (c) 2007-2014 United States Government as represented by the +** Administrator of the National Aeronautics and Space Administration. +** All Other Rights Reserved. +** +** This software was created at NASA's Goddard Space Flight Center. +** This software is governed by the NASA Open Source Agreement and may be +** used, distributed and modified only pursuant to the terms of that +** agreement. +** +** Purpose: Scheduler (SCH) application +** +** Author: +** +** Notes: +** +*/ + +/************************************************************************* +** +** Include section +** +**************************************************************************/ + +#include "cfe.h" + +#include "sch_msgids.h" +#include "sch_perfids.h" +#include "sch_platform_cfg.h" + +#if SCH_LIB_PRESENCE == 1 +#include "sch_api.h" +#endif + +#include "sch_custom.h" +#include "sch_msg.h" +#include "sch_events.h" +#include "sch_app.h" +#include "sch_cmds.h" +#include "sch_version.h" + +#include "sch_verify.h" +#include "cfe_platform_cfg.h" /* for CFE_PLATFORM_SB_HIGHEST_VALID_MSGID */ + +/************************************************************************* +** +** Macro definitions +** +**************************************************************************/ + +/* +** Time Semaphore Characteristics +*/ +#define SCH_SEM_NAME "SCH_TIME_SEM" +#define SCH_SEM_VALUE 0 +#define SCH_SEM_OPTIONS 0 + +/* +** SDT Table Validation Error Codes +*/ +#define SCH_SDT_GARBAGE_ENTRY (-1) +#define SCH_SDT_NO_FREQUENCY (-2) +#define SCH_SDT_BAD_REMAINDER (-3) +#define SCH_SDT_BAD_ACTIVITY (-4) +#define SCH_SDT_BAD_MSG_INDEX (-5) +#define SCH_SDT_BAD_ENABLE_STATE (-6) + +/* +** MDT Table Validation Error Codes +*/ +#define SCH_MDT_GARBAGE_ENTRY (-1) +#define SCH_MDT_INVALID_LENGTH (-2) +#define SCH_MDT_BAD_MSG_ID (-3) + +/************************************************************************* +** +** Type definitions +** +**************************************************************************/ + +/* +** (none) +*/ + +/************************************************************************* +** +** Imported data +** +**************************************************************************/ + +/* +** (none) +*/ + +/************************************************************************* +** +** Exported data +** +**************************************************************************/ + +/* +** Application global data +*/ +SCH_AppData_t SCH_AppData; + +/************************************************************************* +** +** Function definitions +** +**************************************************************************/ + +/******************************************************************* +** +** SCH_AppMain +** +** NOTE: For complete prolog information, see 'sch_app.h' +********************************************************************/ + +void SCH_AppMain(void) +{ + int32 Status = CFE_SUCCESS; + uint32 RunStatus = CFE_ES_RunStatus_APP_RUN; + + /* + ** Performance Log (start time counter) + */ + CFE_ES_PerfLogEntry(SCH_APPMAIN_PERF_ID); + + /* + ** Perform application specific initialization + */ + if (Status == CFE_SUCCESS) + { + Status = SCH_AppInit(); + } + + /* If no errors were detected during initialization, then wait for everyone to start */ + if (Status == CFE_SUCCESS) + { + Status = SCH_CustomLateInit(); + if (Status != CFE_SUCCESS) + { + CFE_EVS_SendEvent(SCH_MAJOR_FRAME_SUB_ERR_EID, + CFE_EVS_EventType_ERROR, + "Error initializing Timers (RC=0x%08X)", + (unsigned int)Status); + } + } + + /* + ** Check for start-up error + */ + if (Status != CFE_SUCCESS) + { + /* + ** Set request to terminate main loop + */ + RunStatus = CFE_ES_RunStatus_APP_ERROR; + } + + /* + ** Main process loop + */ + while (CFE_ES_RunLoop(&RunStatus)) + { + /* + ** Performance Log (stop time counter) + */ + CFE_ES_PerfLogExit(SCH_APPMAIN_PERF_ID); + + /* + ** Wait for the next slot (Major or Minor Frame) + */ + Status = OS_BinSemTake(SCH_AppData.TimeSemaphore); + + /* + ** Performance Log (start time counter) + */ + CFE_ES_PerfLogEntry(SCH_APPMAIN_PERF_ID); + + /* + ** Report if during the previous frame the major has determined to be unstable + */ + if (SCH_AppData.IgnoreMajorFrame == true) + { + if (SCH_AppData.IgnoreMajorFrameMsgSent == false) + { + CFE_EVS_SendEvent( + SCH_NOISY_MAJOR_FRAME_ERR_EID, + CFE_EVS_EventType_ERROR, + "Major Frame Sync too noisy (Slot %d). Disabling synchronization.", + SCH_AppData.MinorFramesSinceTone); + SCH_AppData.IgnoreMajorFrameMsgSent = true; + } + } + else + { + SCH_AppData.IgnoreMajorFrameMsgSent = false; + } + + /* + ** Process schedule table activities + */ +#if SCH_LIB_PRESENCE == 1 + if ((Status == OS_SUCCESS) && (SCH_GetProcessingState() == true)) + { + Status = SCH_ProcessScheduleTable(); + } +#else + if (Status == OS_SUCCESS) + { + Status = SCH_ProcessScheduleTable(); + } +#endif + + /* + ** Note: If there were some reason to exit the task + ** normally (without error) then we would set + ** RunStatus = CFE_ES_APP_EXIT + */ + if (Status != SCH_SUCCESS) + { + /* + ** Set request to terminate main loop + */ + RunStatus = CFE_ES_RunStatus_APP_ERROR; + } + + } /* End of while */ + + /* + ** Check for "fatal" process error + */ + if ((Status != OS_SUCCESS) || (Status != SCH_SUCCESS)) + { + /* + ** Send an event describing the reason for the termination + */ + CFE_EVS_SendEvent(SCH_APP_EXIT_EID, + CFE_EVS_EventType_CRITICAL, + "SCH App: terminating, err = 0x%08X", + (unsigned int)Status); + + /* + ** In case cFE Event Services is not working + */ + CFE_ES_WriteToSysLog("SCH App terminating, err = 0x%08X\n", (unsigned int)Status); + } + + /* + ** Perform any custom cleanup + */ + SCH_CustomCleanup(); + + /* + ** Performance Log (stop time counter) + */ + CFE_ES_PerfLogExit(SCH_APPMAIN_PERF_ID); + + /* + ** Let cFE kill the task (and any child tasks) + */ + CFE_ES_ExitApp(RunStatus); + +} /* End of SH_AppMain() */ + + +/******************************************************************* +** +** SCH_AppInit +** +** NOTE: For complete prolog information, see above +********************************************************************/ + +int32 SCH_AppInit(void) +{ + int32 Status = CFE_SUCCESS; + + /* + ** Initialize Application Processing Counters + */ + SCH_AppData.SlotsProcessedCount = 0; + SCH_AppData.SkippedSlotsCount = 0; + SCH_AppData.MultipleSlotsCount = 0; + SCH_AppData.SameSlotCount = 0; + SCH_AppData.ScheduleActivitySuccessCount = 0; + SCH_AppData.ScheduleActivityFailureCount = 0; + + /* + ** Initialize Command Counters + */ + SCH_AppData.CmdCounter = 0; + SCH_AppData.ErrCounter = 0; + + /* + ** Get our assigned Application ID + */ + Status = CFE_ES_GetAppID(&SCH_AppData.AppID); + if (Status != CFE_SUCCESS) + { + CFE_ES_WriteToSysLog("SCH App: Unable to obtain own AppID, RC=0x%08X\n", (unsigned int)Status); + return(Status); + } + + /* + ** Initialize Event Services Interface + */ + Status = SCH_EvsInit(); + if (Status != CFE_SUCCESS) + { + return(Status); + } + + Status = SCH_SbInit(); + if (Status != CFE_SUCCESS) + { + return(Status); + } + + /* + ** Initialize application tables + */ + Status = SCH_TblInit(); + if (Status != CFE_SUCCESS) + { + return(Status); + } + + /* + ** Initialize timer interfaces + */ + Status = SCH_TimerInit(); + if (Status != CFE_SUCCESS) + { + return(Status); + } + + /* + ** Application startup event message + */ + Status = CFE_EVS_SendEvent(SCH_INITSTATS_INF_EID, + CFE_EVS_EventType_INFORMATION, + "SCH Initialized. Version %d.%d.%d.%d", + SCH_MAJOR_VERSION, + SCH_MINOR_VERSION, + SCH_REVISION, + SCH_MISSION_REV); + + return(Status); + +} /* End of SCH_AppInit() */ + + +/******************************************************************* +** +** SCH_EvsInit +** +** NOTE: For complete prolog information, see above +********************************************************************/ + +int32 SCH_EvsInit(void) +{ + int32 Status = CFE_SUCCESS; + + SCH_AppData.EventFilters[0].EventID = SCH_SAME_SLOT_EID; + SCH_AppData.EventFilters[0].Mask = CFE_EVS_FIRST_ONE_STOP; + + SCH_AppData.EventFilters[1].EventID = SCH_MULTI_SLOTS_EID; + SCH_AppData.EventFilters[1].Mask = CFE_EVS_FIRST_ONE_STOP; + + SCH_AppData.EventFilters[2].EventID = SCH_SKIPPED_SLOTS_EID; + SCH_AppData.EventFilters[2].Mask = CFE_EVS_FIRST_ONE_STOP; + + SCH_AppData.EventFilters[3].EventID = SCH_CORRUPTION_EID; + SCH_AppData.EventFilters[3].Mask = CFE_EVS_FIRST_TWO_STOP; + + SCH_AppData.EventFilters[4].EventID = SCH_PACKET_SEND_EID; + SCH_AppData.EventFilters[4].Mask = CFE_EVS_FIRST_ONE_STOP; + + /* + ** Register for event services + */ + Status = CFE_EVS_Register(SCH_AppData.EventFilters, SCH_FILTER_COUNT, CFE_EVS_EventFilter_BINARY); + if (Status != CFE_SUCCESS) + { + CFE_ES_WriteToSysLog("SCH App: Error Registering For Event Services, RC=0x%08X\n", (unsigned int)Status); + } + + return(Status); + +} /* End of SCH_EvsInit() */ + + +/******************************************************************* +** +** SCH_SbInit +** +** NOTE: For complete prolog information, see above +********************************************************************/ + +int32 SCH_SbInit(void) +{ + int32 Status = CFE_SUCCESS; + + SCH_AppData.MsgPtr = NULL; + SCH_AppData.CmdPipe = 0; + + + /* + ** Initialize housekeeping packet (clear user data area) + */ + CFE_MSG_Init(CFE_MSG_PTR(SCH_AppData.HkPacket.TlmHeader), CFE_SB_ValueToMsgId(SCH_HK_TLM_MID), sizeof(SCH_HkPacket_t)); + + /* + ** Initialize diagnostic packet (clear user data area) + */ + CFE_MSG_Init(CFE_MSG_PTR(SCH_AppData.DiagPacket.TlmHeader), CFE_SB_ValueToMsgId(SCH_DIAG_TLM_MID), sizeof(SCH_DiagPacket_t)); + + /* + ** Create Software Bus message pipe + */ + Status = CFE_SB_CreatePipe(&SCH_AppData.CmdPipe, SCH_PIPE_DEPTH, SCH_PIPE_NAME); + if (Status != CFE_SUCCESS) + { + CFE_EVS_SendEvent(SCH_CR_PIPE_ERR_EID, + CFE_EVS_EventType_ERROR, + "Error Creating SB Pipe, RC=0x%08X", + (unsigned int)Status); + return (Status); + } + + /* + ** Subscribe to Housekeeping request commands + */ + Status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(SCH_SEND_HK_MID), SCH_AppData.CmdPipe); + if (Status != CFE_SUCCESS) + { + CFE_EVS_SendEvent(SCH_SUB_HK_REQ_ERR_EID, + CFE_EVS_EventType_ERROR, + "Error Subscribing to HK Request(MID=0x%04X), RC=0x%08X", + SCH_SEND_HK_MID, + (unsigned int)Status); + return (Status); + } + + /* + ** Subscribe to SCH ground command packets + */ + Status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(SCH_CMD_MID), SCH_AppData.CmdPipe); + if (Status != CFE_SUCCESS) + { + CFE_EVS_SendEvent(SCH_SUB_GND_CMD_ERR_EID, + CFE_EVS_EventType_ERROR, + "Error Subscribing to GND CMD(MID=0x%04X), RC=0x%08X", + SCH_CMD_MID, + (unsigned int)Status); + return (Status); + } + + return(Status); + +} /* End of SCH_SbInit() */ + + +/******************************************************************* +** +** SCH_TblInit +** +** NOTE: For complete prolog information, see above +********************************************************************/ + +int32 SCH_TblInit(void) +{ + uint32 TableSize = 0; + int32 Status = CFE_SUCCESS; + + /* + ** Initialize SCH table variables + */ + SCH_AppData.ScheduleTable = (SCH_ScheduleEntry_t *)NULL; + SCH_AppData.MessageTable = (SCH_MessageEntry_t *)NULL; + + SCH_AppData.ScheduleTableHandle = CFE_TBL_BAD_TABLE_HANDLE; + SCH_AppData.MessageTableHandle = CFE_TBL_BAD_TABLE_HANDLE; + + SCH_AppData.BadTableDataCount = 0; + SCH_AppData.TableVerifySuccessCount = 0; + SCH_AppData.TableVerifyFailureCount = 0; + SCH_AppData.TablePassCount = 0; + + /* + ** Register schedule definition table + */ + TableSize = SCH_TABLE_ENTRIES * sizeof (SCH_ScheduleEntry_t); + + Status = CFE_TBL_Register(&SCH_AppData.ScheduleTableHandle, + SCH_SCHEDULE_TABLE_NAME, + TableSize, + CFE_TBL_OPT_DEFAULT, + SCH_ValidateScheduleData); + + if (Status != CFE_SUCCESS) + { + CFE_EVS_SendEvent(SCH_SDT_REG_ERR_EID, + CFE_EVS_EventType_ERROR, + "Error Registering SDT, RC=0x%08X", + (unsigned int)Status); + return (Status); + } + + /* + ** Register message definition table + */ + TableSize = SCH_MAX_MESSAGES * sizeof (SCH_MessageEntry_t); + + Status = CFE_TBL_Register(&SCH_AppData.MessageTableHandle, + SCH_MESSAGE_TABLE_NAME, + TableSize, + CFE_TBL_OPT_DEFAULT, + SCH_ValidateMessageData); + + if (Status != CFE_SUCCESS) + { + CFE_EVS_SendEvent(SCH_MDT_REG_ERR_EID, + CFE_EVS_EventType_ERROR, + "Error Registering MDT, RC=0x%08X", + (unsigned int)Status); + return (Status); + } + + /* + ** Load default schedule definition table data + */ + Status = CFE_TBL_Load(SCH_AppData.ScheduleTableHandle, + CFE_TBL_SRC_FILE, + (const void *) SCH_SCHEDULE_FILENAME); + + if (Status != CFE_SUCCESS) + { + CFE_EVS_SendEvent(SCH_SDT_LOAD_ERR_EID, + CFE_EVS_EventType_ERROR, + "Error (RC=0x%08X) Loading SDT with %s", + (unsigned int)Status, + SCH_SCHEDULE_FILENAME); + return (Status); + } + + /* + ** Load default message definition table data + */ + Status = CFE_TBL_Load(SCH_AppData.MessageTableHandle, + CFE_TBL_SRC_FILE, + (const void *) SCH_MESSAGE_FILENAME); + + if (Status != CFE_SUCCESS) + { + CFE_EVS_SendEvent(SCH_MDT_LOAD_ERR_EID, + CFE_EVS_EventType_ERROR, + "Error (RC=0x%08X) Loading MDT with %s", + (unsigned int)Status, + SCH_MESSAGE_FILENAME); + return (Status); + } + + + /* + ** Get pointers to table data + */ + Status = SCH_AcquirePointers(); + + if (Status != CFE_SUCCESS) + { + CFE_EVS_SendEvent(SCH_ACQ_PTR_ERR_EID, + CFE_EVS_EventType_ERROR, + "Error Acquiring Tbl Ptrs (RC=0x%08X)", + (unsigned int)Status); + return (Status); + } + + return(Status); + +} /* End of SCH_TblInit() */ + + +/******************************************************************* +** +** SCH_TimerInit +** +** NOTE: For complete prolog information, see above +********************************************************************/ + +int32 SCH_TimerInit(void) +{ + int32 Status = CFE_SUCCESS; + + /* + ** Start off assuming Major Frame synch is normal + ** and should be coming at any moment + */ + SCH_AppData.SyncToMET = SCH_NOT_SYNCHRONIZED; + SCH_AppData.MajorFrameSource = SCH_MAJOR_FS_NONE; + SCH_AppData.NextSlotNumber = 0; + SCH_AppData.MinorFramesSinceTone = SCH_TIME_SYNC_SLOT; + SCH_AppData.LastSyncMETSlot = 0; + SCH_AppData.SyncAttemptsLeft = 0; + + SCH_AppData.IgnoreMajorFrame = false; + SCH_AppData.IgnoreMajorFrameMsgSent = false; + SCH_AppData.UnexpectedMajorFrame = false; + + SCH_AppData.UnexpectedMajorFrameCount = 0; + SCH_AppData.MissedMajorFrameCount = 0; + SCH_AppData.ValidMajorFrameCount = 0; + SCH_AppData.WorstCaseSlotsPerMinorFrame = 1; + + /* + ** Configure Major Frame and Minor Frame sources + */ + SCH_AppData.ClockAccuracy = SCH_WORST_CLOCK_ACCURACY; + /* + ** Create the timer to be used for minor frames + */ + Status = SCH_CustomEarlyInit(); + + if (Status != CFE_SUCCESS) + { + CFE_EVS_SendEvent(SCH_MINOR_FRAME_TIMER_CREATE_ERR_EID, + CFE_EVS_EventType_ERROR, + "Error creating Timer (RC=0x%08X)", + (unsigned int)Status); + return (Status); + } + + /* + ** Determine if the timer has an acceptable clock accuracy + */ + if (SCH_AppData.ClockAccuracy > SCH_WORST_CLOCK_ACCURACY) + { + CFE_EVS_SendEvent(SCH_MINOR_FRAME_TIMER_ACC_WARN_EID, + CFE_EVS_EventType_INFORMATION, + "OS Timer Accuracy (%d > reqd %d usec) requires Minor Frame MET sync", + (int)SCH_AppData.ClockAccuracy, SCH_WORST_CLOCK_ACCURACY); + + /* Synchronize Minor Frame Timing with Mission Elapsed Time to keep from losing slots */ + SCH_AppData.SyncToMET = SCH_MINOR_SYNCHRONIZED; + + /* Calculate how many slots we may have to routinely process on each Minor Frame Wakeup */ + SCH_AppData.WorstCaseSlotsPerMinorFrame = ((SCH_AppData.ClockAccuracy * 2) / SCH_NORMAL_SLOT_PERIOD) + 1; + } + + /* + ** Create main task semaphore (given by MajorFrameCallback and MinorFrameCallback) + */ + Status = OS_BinSemCreate(&SCH_AppData.TimeSemaphore, SCH_SEM_NAME, SCH_SEM_VALUE, SCH_SEM_OPTIONS); + if (Status != CFE_SUCCESS) + { + CFE_EVS_SendEvent(SCH_SEM_CREATE_ERR_EID, + CFE_EVS_EventType_ERROR, + "Error creating Main Loop Timing Semaphore (RC=0x%08X)", + (unsigned int)Status); + return (Status); + } + + return(Status); + +} /* End of SCH_TimerInit() */ + + +/******************************************************************* +** +** SCH_ProcessScheduleTable +** +** NOTE: For complete prolog information, see above +********************************************************************/ + +int32 SCH_ProcessScheduleTable(void) +{ + uint32 CurrentSlot; + uint32 ProcessCount; + int32 Result = CFE_SUCCESS; + + /* + ** Get the slot we should be at + */ + CurrentSlot = SCH_CustomGetCurrentSlotNumber(); + + /* + ** Compute the number of slots we need to process (watch for rollover) + */ + if (CurrentSlot < SCH_AppData.NextSlotNumber) + { + ProcessCount = SCH_TOTAL_SLOTS - SCH_AppData.NextSlotNumber; + ProcessCount += (CurrentSlot + 1); + } + else + { + ProcessCount = (CurrentSlot - SCH_AppData.NextSlotNumber) + 1; + } + + /* + ** Correct for the following conditions observed when minor frame driven + ** by a clock with poor accuracy + ** + ** 1) Wake up a little too late for just 1 slot + ** symptom = multi slots event followed by same slot event + ** + ** 2) Wake up a little too early for just 1 slot + ** symptom = same slot event followed by multi slots event + */ + if (ProcessCount == 2) + { + /* + ** If we want to do 2 slots but last time was OK then assume we + ** are seeing condition #1 above. By doing just 1 slot now, + ** there will still be 1 to do when the next wakeup occurs + ** and we will avoid both events. But, if we really are in + ** a delayed state, we will process both slots when we wake + ** up next time because then the last time will NOT be OK. + */ + if (SCH_AppData.LastProcessCount == 1) + { + ProcessCount = 1; + } + SCH_AppData.LastProcessCount = 2; + } + else if (ProcessCount == SCH_TOTAL_SLOTS) + { + /* + ** Same as previous comment except in reverse order. + */ + if (SCH_AppData.LastProcessCount != SCH_TOTAL_SLOTS) + { + ProcessCount = 1; + } + SCH_AppData.LastProcessCount = SCH_TOTAL_SLOTS; + } + else + { + SCH_AppData.LastProcessCount = ProcessCount; + } + + /* + ** If current slot = next slot - 1, assume current slot did not increment + */ + if (ProcessCount == SCH_TOTAL_SLOTS) + { + SCH_AppData.SameSlotCount++; + + CFE_EVS_SendEvent(SCH_SAME_SLOT_EID, + CFE_EVS_EventType_DEBUG, + "Slot did not increment: slot = %d", + (int)CurrentSlot); + ProcessCount = 0; + } + + /* + ** If we are too far behind, jump forward and do just the current slot + */ + if (ProcessCount > SCH_MAX_LAG_COUNT) + { + SCH_AppData.SkippedSlotsCount++; + + CFE_EVS_SendEvent(SCH_SKIPPED_SLOTS_EID, + CFE_EVS_EventType_ERROR, + "Slots skipped: slot = %d, count = %d", + SCH_AppData.NextSlotNumber, + (int)(ProcessCount - 1)); + + /* + ** Update the pass counter if we are skipping the rollover slot + */ + if (CurrentSlot < SCH_AppData.NextSlotNumber) + { + SCH_AppData.TablePassCount++; + } + + /* + ** Process ground commands if we are skipping the time synch slot + ** NOTE: This assumes the Time Synch Slot is the LAST Schedule slot + ** (see definition of SCH_TIME_SYNC_SLOT in sch_app.h) + ** Ground commands should only be processed at the end of the schedule table + ** so that Group Enable/Disable commands do not change the state of entries + ** in the middle of a schedule. + */ + if ((SCH_AppData.NextSlotNumber + ProcessCount) > SCH_TIME_SYNC_SLOT) + { + Result = SCH_ProcessCommands(); + } + + SCH_AppData.NextSlotNumber = CurrentSlot; + ProcessCount = 1; + } + + /* + ** Don't try to catch up all at once, just do a couple + */ + if (ProcessCount > SCH_MAX_SLOTS_PER_WAKEUP) + { + ProcessCount = SCH_MAX_SLOTS_PER_WAKEUP; + } + + /* + ** Keep track of multi-slot processing + */ + if (ProcessCount > 1) + { + SCH_AppData.MultipleSlotsCount++; + + /* Generate an event message if not syncing to MET or when there is more than two being + * processed */ + if ((ProcessCount > SCH_AppData.WorstCaseSlotsPerMinorFrame) || + (SCH_AppData.SyncToMET == SCH_NOT_SYNCHRONIZED)) + { + CFE_EVS_SendEvent(SCH_MULTI_SLOTS_EID, + CFE_EVS_EventType_INFORMATION, + "Multiple slots processed: slot = %d, count = %d", + SCH_AppData.NextSlotNumber, + (int)ProcessCount); + } + } + + /* + ** Process the slots (most often this will be just one) + */ + while ((ProcessCount != 0) && (Result == CFE_SUCCESS)) + { + Result = SCH_ProcessNextSlot(); + + ProcessCount--; + } + + return(Result); + +} /* End of SCH_ProcessScheduleTable() */ + + +/******************************************************************* +** +** SCH_ProcessNextSlot +** +** NOTE: For complete prolog information, see above +********************************************************************/ + +int32 SCH_ProcessNextSlot(void) +{ + int32 Result = CFE_SUCCESS; + int32 EntryNumber; + int32 SlotIndex; + SCH_ScheduleEntry_t *NextEntry; + + SlotIndex = SCH_AppData.NextSlotNumber * SCH_ENTRIES_PER_SLOT; + NextEntry = &SCH_AppData.ScheduleTable[SlotIndex]; + + /* + ** Process each (enabled) entry in the schedule table slot + */ + for (EntryNumber = 0; EntryNumber < SCH_ENTRIES_PER_SLOT; EntryNumber++) + { + if (NextEntry->EnableState == SCH_ENABLED) + { + SCH_ProcessNextEntry(NextEntry, EntryNumber); + } + + NextEntry++; + } + + /* + ** Process ground commands in the slot reserved for time synch + ** Ground commands should only be processed at the end of the schedule table + ** so that Group Enable/Disable commands do not change the state of entries + ** in the middle of a schedule. + */ + if (SCH_AppData.NextSlotNumber == SCH_TIME_SYNC_SLOT) + { + Result = SCH_ProcessCommands(); + } + + /* + ** Maintain "next" schedule table slot index + */ + SCH_AppData.NextSlotNumber++; + + if (SCH_AppData.NextSlotNumber == SCH_TOTAL_SLOTS) + { + SCH_AppData.NextSlotNumber = 0; + SCH_AppData.TablePassCount++; + } + + /* + ** Maintain "total slots processed" counter + */ + SCH_AppData.SlotsProcessedCount++; + + return(Result); + +} /* End of SCH_ProcessNextSlot() */ + + +/******************************************************************* +** +** SCH_ProcessNextEntry +** +** NOTE: For complete prolog information, see above +********************************************************************/ + +void SCH_ProcessNextEntry(SCH_ScheduleEntry_t *NextEntry, int32 EntryNumber) +{ + int32 Status; + uint32 Remainder; + uint16 *Message; + + /* + ** Check for invalid table entry + ** + ** (run time corruption -- data was verified at table load) + */ + if ((NextEntry->MessageIndex >= SCH_MAX_MESSAGES) || + (NextEntry->Frequency == SCH_UNUSED) || + (NextEntry->Type != SCH_ACTIVITY_SEND_MSG) || + (NextEntry->Remainder >= NextEntry->Frequency)) + { + SCH_AppData.BadTableDataCount++; + + /* + ** Too much data for just one event + */ + CFE_EVS_SendEvent(SCH_CORRUPTION_EID, + CFE_EVS_EventType_ERROR, + "Corrupt data error (1): slot = %d, entry = %d", + SCH_AppData.NextSlotNumber, (int)EntryNumber); + + CFE_EVS_SendEvent(SCH_CORRUPTION_EID, + CFE_EVS_EventType_ERROR, + "Corrupt data error (2): msg = %d, freq = %d, type = %d, rem = %d", + NextEntry->MessageIndex, + NextEntry->Frequency, + NextEntry->Type, + NextEntry->Remainder); + + /* + ** Disable entry to avoid repeating this error + */ + NextEntry->EnableState = SCH_DISABLED; + CFE_TBL_Modified(SCH_AppData.ScheduleTableHandle); + } + else + { + /* + ** Look for entry active on this particular pass through table + */ + Remainder = SCH_AppData.TablePassCount % NextEntry->Frequency; + + if (Remainder == NextEntry->Remainder) + { + Message = SCH_AppData.MessageTable[NextEntry->MessageIndex].MessageBuffer; + Status = CFE_SB_TransmitMsg((CFE_MSG_Message_t *)Message, true); + + /* If additional activity types are added in the future, a switch statement */ + /* would be useful, as shown below: */ + /* NOTE: The "default" clause should never be able to be executed but is */ + /* required by Flight Software Branch Coding Standards */ + /* + * switch(NextEntry->Type) + * { + * case SCH_ACTIVITY_SEND_MSG: + * Message = SCH_AppData.MessageTable[NextEntry->MessageIndex].MessageBuffer; + * Status = CFE_SB_SendMsg((CFE_SB_Msg_t *) Message); + * break; + * + * default: + * Status = SCH_UNKNOWN_ACTIVITY; + * break; + * } + */ + if (Status == CFE_SUCCESS) + { + SCH_AppData.ScheduleActivitySuccessCount++; + } + else + { + SCH_AppData.ScheduleActivityFailureCount++; + + CFE_EVS_SendEvent(SCH_PACKET_SEND_EID, + CFE_EVS_EventType_ERROR, + "Activity error: slot = %d, entry = %d, err = 0x%08X", + SCH_AppData.NextSlotNumber, + (int)EntryNumber, + (unsigned int)Status); + } + } + } + + return; + +} /* End of SCH_ProcessNextEntry() */ + + +/******************************************************************* +** +** SCH_ProcessCommands +** +** NOTE: For complete prolog information, see above +********************************************************************/ + +int32 SCH_ProcessCommands(void) +{ + int32 Status = CFE_SUCCESS; + + while (Status == CFE_SUCCESS) + { + /* + ** Process pending Software Bus messages + */ + Status = CFE_SB_ReceiveBuffer(&SCH_AppData.MsgPtr, SCH_AppData.CmdPipe, CFE_SB_POLL); + + if (Status == CFE_SUCCESS) + { + Status = SCH_AppPipe(SCH_AppData.MsgPtr); + } + } + + if (Status == CFE_SB_NO_MESSAGE) + { + /* + ** It's OK to not get a message -- we are polling + */ + Status = CFE_SUCCESS; + } + + return(Status); + +} /* End of SCH_ProcessCommands() */ + + +/******************************************************************* +** +** SCH_ValidateScheduleData +** +** NOTE: For complete prolog information, see above +********************************************************************/ + +int32 SCH_ValidateScheduleData(void *TableData) +{ + SCH_ScheduleEntry_t *TableArray = (SCH_ScheduleEntry_t *) TableData; + int32 EntryResult = CFE_SUCCESS; + int32 TableResult = CFE_SUCCESS; + int32 TableIndex; + + uint8 EnableState; + uint8 Type; + uint16 Frequency; + uint16 Remainder; + uint16 MessageIndex; + uint32 GroupData; + + int32 GoodCount = 0; + int32 BadCount = 0; + int32 UnusedCount = 0; + + /* + ** Verify each entry in pending SCH schedule table + */ + for (TableIndex = 0; TableIndex < SCH_TABLE_ENTRIES; TableIndex++) + { + EnableState = TableArray[TableIndex].EnableState; + Type = TableArray[TableIndex].Type; + Frequency = TableArray[TableIndex].Frequency; + Remainder = TableArray[TableIndex].Remainder; + MessageIndex = TableArray[TableIndex].MessageIndex; + GroupData = TableArray[TableIndex].GroupData; + + EntryResult = CFE_SUCCESS; + + if (EnableState == SCH_UNUSED) + { + /* + ** If enable state is unused, then all fields must be unused + */ + if ((Frequency != SCH_UNUSED) || + (Remainder != SCH_UNUSED) || + (GroupData != SCH_UNUSED) || + (Type != SCH_UNUSED) || + (MessageIndex != SCH_UNUSED)) + { + EntryResult = SCH_SDT_GARBAGE_ENTRY; + BadCount++; + } + else + { + UnusedCount++; + } + } + else if ((EnableState == SCH_ENABLED) || (EnableState == SCH_DISABLED)) + { + /* + ** If enable state is used, then verify all fields + ** + ** - Frequency must be non-zero + ** - Remainder must be < Frequency + ** - Type must be SCH_ACTIVITY_SEND_MSG + ** - MessageIndex must be non-zero (reserved value = "unused") + ** - MessageIndex must be < SCH_MAX_MESSAGES + */ + if (Frequency == SCH_UNUSED) + { + EntryResult = SCH_SDT_NO_FREQUENCY; + } + else if (Remainder >= Frequency) + { + EntryResult = SCH_SDT_BAD_REMAINDER; + } + else if (Type != SCH_ACTIVITY_SEND_MSG) + { + EntryResult = SCH_SDT_BAD_ACTIVITY; + } + else if (MessageIndex == 0) + { + EntryResult = SCH_SDT_BAD_MSG_INDEX; + } + else if (MessageIndex >= SCH_MAX_MESSAGES) + { + EntryResult = SCH_SDT_BAD_MSG_INDEX; + } + + if (EntryResult != CFE_SUCCESS) + { + BadCount++; + } + else + { + GoodCount++; + } + } + else + { + EntryResult = SCH_SDT_BAD_ENABLE_STATE; + BadCount++; + } + + /* + ** Send event for "first" error found + */ + if ((EntryResult != CFE_SUCCESS) && (TableResult == CFE_SUCCESS)) + { + TableResult = EntryResult; + + CFE_EVS_SendEvent(SCH_SCHEDULE_TBL_ERR_EID, + CFE_EVS_EventType_ERROR, + "Schedule tbl verify error - idx[%d] ena[%d] typ[%d] fre[%d] rem[%d] " + "msg[%d] grp[0x%08X]", + (int)TableIndex, + EnableState, + Type, + Frequency, + Remainder, + MessageIndex, + (unsigned int)GroupData); + } + } + + /* + ** Send event describing results + */ + CFE_EVS_SendEvent(SCH_SCHEDULE_TABLE_EID, + CFE_EVS_EventType_DEBUG, + "Schedule table verify results -- good[%d] bad[%d] unused[%d]", + (int)GoodCount, (int)BadCount, (int)UnusedCount); + /* + ** Maintain table verification statistics + */ + if (TableResult == CFE_SUCCESS) + { + SCH_AppData.TableVerifySuccessCount++; + } + else + { + SCH_AppData.TableVerifyFailureCount++; + } + + return(TableResult); + +} /* End of SCH_ValidateScheduleData() */ + + +/******************************************************************* +** +** SCH_ValidateMessageData +** +** NOTE: For complete prolog information, see above +********************************************************************/ + +int32 SCH_ValidateMessageData(void *TableData) +{ + SCH_MessageEntry_t *TableArray = (SCH_MessageEntry_t *) TableData; + int32 EntryResult = CFE_SUCCESS; + int32 TableResult = CFE_SUCCESS; + int32 TableIndex; + int32 BufferIndex; + + + uint16 *MessageBuffer; + uint16 *UserDataPtr; + + CFE_MSG_Size_t MessageLength; + CFE_SB_MsgId_t MessageID; + CFE_SB_MsgId_t MaxValue = CFE_SB_ValueToMsgId(SCH_MDT_MAX_MSG_ID); + CFE_SB_MsgId_t MinValue = CFE_SB_ValueToMsgId(SCH_MDT_MIN_MSG_ID); + + int32 GoodCount = 0; + int32 BadCount = 0; + int32 UnusedCount = 0; + + /* + ** Verify each entry in pending SCH Message table + */ + for (TableIndex = 0; TableIndex < SCH_MAX_MESSAGES; TableIndex++) + { + EntryResult = CFE_SUCCESS; + BufferIndex = 0; + + MessageBuffer = &TableArray[TableIndex].MessageBuffer[0]; + CFE_MSG_Message_t *const MessagePtr = (CFE_MSG_Message_t *)MessageBuffer; + + CFE_MSG_GetMsgId(MessagePtr, &MessageID); + CFE_MSG_GetSize(MessagePtr, &MessageLength); + + if (MessageID.Value == SCH_UNUSED_MID) + { + /* + ** If message ID is unused, then look for junk in user data portion + */ + UnusedCount++; + UserDataPtr = (uint16 *)CFE_SB_GetUserData(MessagePtr); + while (UserDataPtr < &TableArray[TableIndex + 1].MessageBuffer[0]) + { + if (*UserDataPtr != SCH_UNUSED) + { + EntryResult = SCH_MDT_GARBAGE_ENTRY; + BadCount++; + UnusedCount--; + break; + } + UserDataPtr++; + } + } + else if ((MessageID.Value <= MaxValue.Value) && (MessageID.Value >= MinValue.Value)) + { + /* + ** If message ID is valid, then check message length + */ + if ((MessageLength > (SCH_MAX_MSG_WORDS * 2)) || + (MessageLength < (SCH_MIN_MSG_WORDS * 2)) || + ((MessageLength & 1) != 0)) + { + EntryResult = SCH_MDT_INVALID_LENGTH; + BadCount++; + } + else + { + GoodCount++; + } + } + else + { + EntryResult = SCH_MDT_BAD_MSG_ID; + BadCount++; + } + + /* + ** Save index of "first" error found + */ + if ((EntryResult != CFE_SUCCESS) && (TableResult == CFE_SUCCESS)) + { + TableResult = EntryResult; + + CFE_EVS_SendEvent(SCH_MESSAGE_TBL_ERR_EID, + CFE_EVS_EventType_ERROR, + "Message tbl verify err - idx[0x%02X] mid[0x%X] len[%zu] buf[%d]", + (int)TableIndex, + MessageID.Value, + MessageLength, + (int)BufferIndex); + } + } + + /* + ** Send event describing results + */ + CFE_EVS_SendEvent(SCH_MESSAGE_TABLE_EID, + CFE_EVS_EventType_DEBUG, + "Message tbl verify results - good[%d] bad[%d] unused[%d]", + (int)GoodCount, (int)BadCount, (int)UnusedCount); + /* + ** Maintain table verification statistics + */ + if (TableResult == CFE_SUCCESS) + { + SCH_AppData.TableVerifySuccessCount++; + } + else + { + SCH_AppData.TableVerifyFailureCount++; + } + + return(TableResult); + +} /* End of SCH_ValidateMessageData() */ + + +/************************/ +/* End of File Comment */ +/************************/ + diff --git a/apps/sch/fsw/src/sch_app.h b/apps/sch/fsw/src/sch_app.h new file mode 100644 index 0000000..7f3a424 --- /dev/null +++ b/apps/sch/fsw/src/sch_app.h @@ -0,0 +1,492 @@ +/************************************************************************ +** File: +** $Id: sch_app.h 1.4 2017/06/21 15:29:01EDT mdeschu Exp $ +** +** Copyright (c) 2007-2014 United States Government as represented by the +** Administrator of the National Aeronautics and Space Administration. +** All Other Rights Reserved. +** +** This software was created at NASA's Goddard Space Flight Center. +** This software is governed by the NASA Open Source Agreement and may be +** used, distributed and modified only pursuant to the terms of that +** agreement. +** +** Purpose: +** The CFS Scheduler (SCH) Application header file +** +** Notes: +** +*************************************************************************/ +#ifndef _sch_app_ +#define _sch_app_ + +/************************************************************************* +** +** Include section +** +**************************************************************************/ + +#include "cfe.h" +#include "sch_msg.h" +#include "sch_tbldefs.h" + +/************************************************************************* +** +** Macro definitions +** +**************************************************************************/ + +/*************************************************************************/ +/*************************************************************************/ + +/* +** Computed Scheduler Parameters +*/ +#define SCH_WORST_CLOCK_ACCURACY (SCH_NORMAL_SLOT_PERIOD/(SCH_TOTAL_SLOTS-1)) + /**< \brief Maximum allowed error in minor frame timing */ + /**< Worst accuracy determined to be the amount of drift that would + cause the loss of a minor frame over one major frame */ +#define SCH_MAX_SYNC_ATTEMPTS (SCH_TOTAL_SLOTS * 3) + /**< \brief Maximum number of minor frames to sample looking for subsecs = 0 */ + /**< Maximum number of minor frame timer expirations to allow before giving up + on finding the slot whose MET subseconds field is zero. It is assumed that + three complete major frames should be sufficient for finding such a slot. */ +/* +** Command pipe definitions +*/ +/** \name Scheduler App Pipe Characteristics */ +/** \{ */ +#define SCH_PIPE_NAME "SCH_CMD_PIPE" /**< \brief SCH Command Pipe Name */ +/** \} */ + +/* +** Event filter table definitions +*/ +/** \name Scheduler App Event Filter Characteristics */ +/** \{ */ +#define SCH_FILTER_COUNT 5 +/** \} */ + +/* +** Minor Frame Slot Characteristics +*/ +/** \name Scheduler App Minor Frame Characteristics */ +/** \{ */ +#define SCH_TIME_SYNC_SLOT (SCH_TOTAL_SLOTS-1) /**< NOTE: If this is set to anything other than the last slot, + logic in SCH_ProcessScheduleTable will need to change */ +#define SCH_NORMAL_SLOT_PERIOD (SCH_MICROS_PER_MAJOR_FRAME / SCH_TOTAL_SLOTS) +#define SCH_SYNC_SLOT_PERIOD (SCH_NORMAL_SLOT_PERIOD + SCH_SYNC_SLOT_DRIFT_WINDOW) +#define SCH_SHORT_SLOT_PERIOD (SCH_NORMAL_SLOT_PERIOD - SCH_SYNC_SLOT_DRIFT_WINDOW) +/** \} */ + +/* +** Table names +*/ +/** \name Scheduler App Table Names */ +/** \{ */ +#define SCH_SCHEDULE_TABLE_NAME "SCHED_DEF" /**< \brief Schedule Definition Table Name */ +#define SCH_MESSAGE_TABLE_NAME "MSG_DEFS" /**< \brief Message Definition Table Name */ +/** \} */ + +/* +** Internal Function Return Codes +*/ +/** \name Scheduler App Internal Error Codes */ +/** \{ */ +#define SCH_SUCCESS (0) /**< \brief SCH return code for success */ +#define SCH_ERROR (-1) /**< \brief SCH return code for general error */ +#define SCH_BAD_MSG_LENGTH_RC (-2) /**< \brief SCH return code for unexpected cmd length */ +#define SCH_UNKNOWN_ACTIVITY (-3) /**< \brief SCH return code for unknown Entry Activity Type */ +/** \} */ + +/* +** Time Semaphore Characteristics +*/ +#define SCH_SEM_NAME "SCH_TIME_SEM" +#define SCH_SEM_VALUE 0 +#define SCH_SEM_OPTIONS 0 + +/* +** SDT Table Validation Error Codes +*/ +#define SCH_SDT_GARBAGE_ENTRY (-1) +#define SCH_SDT_NO_FREQUENCY (-2) +#define SCH_SDT_BAD_REMAINDER (-3) +#define SCH_SDT_BAD_ACTIVITY (-4) +#define SCH_SDT_BAD_MSG_INDEX (-5) +#define SCH_SDT_BAD_ENABLE_STATE (-6) + +/* +** MDT Table Validation Error Codes +*/ +#define SCH_MDT_GARBAGE_ENTRY (-1) +#define SCH_MDT_INVALID_LENGTH (-2) +#define SCH_MDT_BAD_MSG_ID (-3) + +/************************************************************************* +** +** Type definitions +** +**************************************************************************/ + +/* +** Type definition (SCH app global data) +*/ +typedef struct +{ + /* + ** Operational data + */ + CFE_SB_Buffer_t *MsgPtr; /**< \brief Ptr to most recently received cmd message */ + CFE_SB_PipeId_t CmdPipe; /**< \brief Pipe ID for SCH Command Pipe */ + + SCH_MessageEntry_t *MessageTable; /**< \brief Ptr to Message Table contents */ + SCH_ScheduleEntry_t *ScheduleTable; /**< \brief Ptr to Schedule Table contents */ + + CFE_TBL_Handle_t ScheduleTableHandle; /**< \brief Handle for Schedule Definition Table */ + CFE_TBL_Handle_t MessageTableHandle; /**< \brief Handle for Message Definition Table */ + + CFE_EVS_BinFilter_t EventFilters[SCH_FILTER_COUNT]; /**< \brief Array of Event Filters */ + + SCH_HkPacket_t HkPacket; /**< \brief Housekeeping Telemetry Packet */ + SCH_DiagPacket_t DiagPacket; /**< \brief Diagnostic Telemetry Packet */ + + uint32 LastProcessCount; /**< \brief Number of Slots Processed Last Cycle */ + + uint32 TimerId; /**< \brief OSAL assigned timer ID for minor frame timer */ + uint32 TimeSemaphore; /**< \brief Semaphore used by time references to control main loop */ + uint32 ClockAccuracy; /**< \brief Accuracy of Minor Frame Timer */ + uint32 WorstCaseSlotsPerMinorFrame; /**< \brief When syncing to MET, worst case # of slots that may need */ + /* to be processed upon each Minor Frame signal */ + + + uint32 AppID; /**< \brief SCH Application's Application ID */ + + /* + ** Command execution counters (ground commands) + */ + uint8 CmdCounter; /**< \brief Number of successful ground cmds received */ + uint8 ErrCounter; /**< \brief Number of unsuccessful ground cmds received */ + uint8 SyncToMET; /**< \brief Slots should be aligned with subseconds */ + uint8 MajorFrameSource; /**< \brief Major Frame Signal source identifier */ + + /* + ** Messages sent by schedule table processor + */ + uint32 ScheduleActivitySuccessCount; /**< \brief Number of successfully performed activities */ + uint32 ScheduleActivityFailureCount; /**< \brief Number of unsuccessful activities attempted */ + + /* + ** Total schedule table slots processed + */ + uint32 SlotsProcessedCount; /**< \brief Total # of Schedule Slots (Minor Frames) Processed */ + + /* + ** The number of times that slots were skipped + ** (not the number of slots that were skipped) + */ + uint16 SkippedSlotsCount; /**< \brief Number of times that slots were skipped */ + /**< The number of times that a slot (minor frame) was skipped. + \c Note: This is NOT the number of slots that were skipped */ + + /* + ** The number of times that multiple slots were processed + ** (not the number of slots that were processed) + */ + uint16 MultipleSlotsCount; /**< \brief Number of times that multiple slots processed */ + /**< The number of times that multiple slots (minor frames) + were processed in the same minor frame. + \c Note: This is NOT the number of slots that were processed */ + + /* + ** The number of times that SCH woke up in the same slot as last time + */ + uint16 SameSlotCount; /**< \brief # of times SCH woke up in the same slot as last time */ + + /* + ** The number of times that a table entry with bad data was processed + ** (the entry previously passed validation but then somehow went bad) + */ + uint16 BadTableDataCount; /**< \brief # of times corrupted table entries were processed */ + + /* + ** The number of tables verified prior to table load + */ + uint16 TableVerifySuccessCount; /**< \brief # of times table loads successfully verified */ + uint16 TableVerifyFailureCount; /**< \brief # of times table loads unsuccessfully verified */ + + uint32 ValidMajorFrameCount; /**< \brief # of valid Major Frame tones received */ + uint32 MissedMajorFrameCount; /**< \brief # of missing Major Frame tones */ + uint32 UnexpectedMajorFrameCount; /**< \brief # of unexpected Major Frame tones */ + + uint32 TablePassCount; /**< \brief # of times Schedule Table has been processed */ + uint32 ConsecutiveNoisyFrameCounter; /**< \brief # of consecutive noisy Major Frames */ + + uint16 MinorFramesSinceTone; /**< \brief # of Minor Frames since last Major Frame tone */ + uint16 NextSlotNumber; /**< \brief Next Minor Frame to be processed */ + uint16 LastSyncMETSlot; /**< \brief MET Slot # where Time Sync last occurred */ + uint16 SyncAttemptsLeft; /**< \brief Timeout counter used when syncing Major Frame to MET */ + + bool IgnoreMajorFrame; /**< \brief Major Frame too noisy to trust */ + bool IgnoreMajorFrameMsgSent; /**< \brief Major Frame Event Message has been sent */ + bool UnexpectedMajorFrame; /**< \brief Major Frame signal was unexpected */ + +} SCH_AppData_t; + +/************************************************************************* +** +** Exported data +** +**************************************************************************/ + +extern SCH_AppData_t SCH_AppData; + +/************************************************************************* +** +** Exported functions +** +**************************************************************************/ + +/* +** Application entry point and main process loop +*/ +/************************************************************************/ +/** \brief CFS Scheduler (SCH) Application Entry Point +** +** \par Description +** Scheduler application entry point and main process loop. +** +** \par Assumptions, External Events, and Notes: +** None +** +*************************************************************************/ +void SCH_AppMain(void); + +/************************************************************************* +** Local function prototypes +**************************************************************************/ + +/************************************************************************/ +/** \brief Initialize the Scheduler CFS application +** +** \par Description +** Scheduler application initialization routine. This +** function performs all the required startup steps to +** get the application registered with the cFE services so +** it can begin to receive command messages. +** +** \par Assumptions, External Events, and Notes: +** None +** +** \returns +** \retcode #CFE_SUCCESS \retdesc \copydoc CFE_SUCCESS \endcode +** \retstmt Return codes from #CFE_EVS_Register \endcode +** \retstmt Return codes from #CFE_SB_CreatePipe \endcode +** \retstmt Return codes from #CFE_SB_Subscribe \endcode +** \endreturns +** +*************************************************************************/ +int32 SCH_AppInit(void); + +/************************************************************************/ +/** \brief Initialize the cFE Events with CFS Scheduler Application +** +** \par Description +** This function performs those steps required to initialize the +** relationship between the CFS Scheduler and the cFE Events Services. +** +** \par Assumptions, External Events, and Notes: +** None +** +** \returns +** \retcode #CFE_SUCCESS \retdesc \copydoc CFE_SUCCESS \endcode +** \retstmt Return codes from #CFE_EVS_Register \endcode +** \retstmt Return codes from #CFE_SB_CreatePipe \endcode +** \retstmt Return codes from #CFE_SB_Subscribe \endcode +** \endreturns +** +*************************************************************************/ +int32 SCH_EvsInit(void); + +/************************************************************************/ +/** \brief Initialize cFE Software Bus with CFS Scheduler Application +** +** \par Description +** This function performs those steps required to initialize the +** relationship between the CFS Scheduler and the cFE Software Bus. +** +** \par Assumptions, External Events, and Notes: +** None +** +** \returns +** \retcode #CFE_SUCCESS \retdesc \copydoc CFE_SUCCESS \endcode +** \retstmt Return codes from #CFE_EVS_Register \endcode +** \retstmt Return codes from #CFE_SB_CreatePipe \endcode +** \retstmt Return codes from #CFE_SB_Subscribe \endcode +** \endreturns +** +*************************************************************************/ +int32 SCH_SbInit(void); + +/************************************************************************/ +/** \brief Initialize cFE Table Services with CFS Scheduler Application +** +** \par Description +** This function performs those steps required to initialize the +** relationship between the CFS Scheduler and the cFE Table Services. +** +** \par Assumptions, External Events, and Notes: +** None +** +** \returns +** \retcode #CFE_SUCCESS \retdesc \copydoc CFE_SUCCESS \endcode +** \retstmt Return codes from #CFE_EVS_Register \endcode +** \retstmt Return codes from #CFE_SB_CreatePipe \endcode +** \retstmt Return codes from #CFE_SB_Subscribe \endcode +** \endreturns +** +*************************************************************************/ +int32 SCH_TblInit(void); + +/************************************************************************/ +/** \brief Initialize cFE Table Services with cFE Time Services and OSAL timer +** +** \par Description +** This function performs those steps required to initialize the +** relationship between the CFS Scheduler and cFE Time Services as +** well as with the OS Abstraction Layer Timer Interface. +** +** \par Assumptions, External Events, and Notes: +** None +** +** \returns +** \retcode #CFE_SUCCESS \retdesc \copydoc CFE_SUCCESS \endcode +** \retstmt Return codes from #CFE_EVS_Register \endcode +** \retstmt Return codes from #CFE_SB_CreatePipe \endcode +** \retstmt Return codes from #CFE_SB_Subscribe \endcode +** \endreturns +** +*************************************************************************/ +int32 SCH_TimerInit(void); + +/************************************************************************/ +/** \brief Processes the Schedule Table to determine next Minor Frame +** +** \par Description +** This function performs the highest level operations associated with +** processing the Schedule Definition Table. It determines which +** minor frame schedule definitions are to be processed during this +** cycle. +** +** \par Assumptions, External Events, and Notes: +** None +** +** \returns +** \retcode #CFE_SUCCESS \retdesc \copydoc CFE_SUCCESS \endcode +** \retstmt Return codes from #CFE_EVS_Register \endcode +** \retstmt Return codes from #CFE_SB_CreatePipe \endcode +** \retstmt Return codes from #CFE_SB_Subscribe \endcode +** \endreturns +** +*************************************************************************/ +int32 SCH_ProcessScheduleTable(void); + +/************************************************************************/ +/** \brief Processes the next minor frame in schedule definition table +** +** \par Description +** This function performs the high level operations associated with +** processing a minor frame definition in the Schedule Definition +** Table. +** +** \par Assumptions, External Events, and Notes: +** None +** +** \returns +** \retcode #CFE_SUCCESS \retdesc \copydoc CFE_SUCCESS \endcode +** \retstmt Return codes from #CFE_EVS_Register \endcode +** \retstmt Return codes from #CFE_SB_CreatePipe \endcode +** \retstmt Return codes from #CFE_SB_Subscribe \endcode +** \endreturns +** +*************************************************************************/ +int32 SCH_ProcessNextSlot(void); + +/************************************************************************/ +/** \brief Processes the next entry in the current minor frame +** +** \par Description +** This function processes the next entry in the current minor frame +** as defined in the schedule definition table. +** +** \par Assumptions, External Events, and Notes: +** None +** +*************************************************************************/ +void SCH_ProcessNextEntry(SCH_ScheduleEntry_t *NextEntry, int32 EntryNumber); + +/************************************************************************/ +/** \brief Processes commands received from cFE Software Bus +** +** \par Description +** This function pulls messages from command pipe and processes +** them accordingly. +** +** \par Assumptions, External Events, and Notes: +** None +** +** \returns +** \retcode #CFE_SUCCESS \retdesc \copydoc CFE_SUCCESS \endcode +** \retstmt Return codes from #CFE_EVS_Register \endcode +** \retstmt Return codes from #CFE_SB_CreatePipe \endcode +** \retstmt Return codes from #CFE_SB_Subscribe \endcode +** \endreturns +** +*************************************************************************/ +int32 SCH_ProcessCommands(void); + +/************************************************************************/ +/** \brief Validates contents of Schedule Definition Table +** +** \par Description +** This function is called by table services when a validation of +** the Schedule Definition Table is required. +** +** \par Assumptions, External Events, and Notes: +** None +** +** \returns +** \retcode #CFE_SUCCESS \retdesc \copydoc CFE_SUCCESS \endcode +** \retstmt Return codes from #CFE_EVS_Register \endcode +** \retstmt Return codes from #CFE_SB_CreatePipe \endcode +** \retstmt Return codes from #CFE_SB_Subscribe \endcode +** \endreturns +** +*************************************************************************/ +int32 SCH_ValidateScheduleData(void *TableData); + +/************************************************************************/ +/** \brief Validates contents of Message Definition Table +** +** \par Description +** This function is called by table services when a validation of +** the Message Definition Table is required. +** +** \par Assumptions, External Events, and Notes: +** None +** +** \returns +** \retcode #CFE_SUCCESS \retdesc \copydoc CFE_SUCCESS \endcode +** \retstmt Return codes from #CFE_EVS_Register \endcode +** \retstmt Return codes from #CFE_SB_CreatePipe \endcode +** \retstmt Return codes from #CFE_SB_Subscribe \endcode +** \endreturns +** +*************************************************************************/ +int32 SCH_ValidateMessageData(void *TableData); + +#endif /* _sch_app_ */ + +/************************/ +/* End of File Comment */ +/************************/ diff --git a/apps/sch/fsw/src/sch_cmds.c b/apps/sch/fsw/src/sch_cmds.c new file mode 100644 index 0000000..b6842a8 --- /dev/null +++ b/apps/sch/fsw/src/sch_cmds.c @@ -0,0 +1,859 @@ +/* +** $Id: sch_cmds.c 1.5 2017/06/21 15:29:02EDT mdeschu Exp $ +** +** Copyright (c) 2007-2014 United States Government as represented by the +** Administrator of the National Aeronautics and Space Administration. +** All Other Rights Reserved. +** +** This software was created at NASA's Goddard Space Flight Center. +** This software is governed by the NASA Open Source Agreement and may be +** used, distributed and modified only pursuant to the terms of that +** agreement. +** +** Purpose: Scheduler (SCH) application command handling +** +** Author: +** +** Notes: +** +*/ + +/************************************************************************* +** +** Include section +** +**************************************************************************/ + +#include "cfe.h" +#include "sch_msgids.h" + +#include "sch_msg.h" +#include "sch_events.h" +#include "sch_app.h" +#include "sch_cmds.h" +#include "sch_version.h" + +/************************************************************************* +** +** Exported data +** +**************************************************************************/ + +/* +** Application global data +*/ +extern SCH_AppData_t SCH_AppData; + +/************************************************************************* +** +** File data +** +**************************************************************************/ + +/* +** (none) +*/ + +/******************************************************************* +** +** SCH_AppPipe +** +** NOTE: For complete prolog information, see 'sch_cmds.h' +********************************************************************/ + +int32 SCH_AppPipe(CFE_SB_Buffer_t *SBBufPtr) +{ + int32 Result = CFE_SUCCESS; + CFE_MSG_FcnCode_t CommandCode = 0; + + CFE_MSG_Message_t *MessagePtr = &SBBufPtr->Msg; + + CFE_SB_MsgId_t MessageID = CFE_SB_INVALID_MSG_ID; + CFE_MSG_GetMsgId(MessagePtr, &MessageID); + + switch (MessageID.Value) + { + /* + ** Housekeeping telemetry request + */ + case SCH_SEND_HK_MID: + Result = SCH_HousekeepingCmd(MessagePtr); + break; + + /* + ** SCH ground commands + */ + case SCH_CMD_MID: + + CFE_MSG_GetFcnCode(MessagePtr, &CommandCode); + switch (CommandCode) + { + case SCH_NOOP_CC: + SCH_NoopCmd(MessagePtr); + break; + + case SCH_RESET_CC: + SCH_ResetCmd(MessagePtr); + break; + + case SCH_ENABLE_CC: + SCH_EnableCmd(MessagePtr); + break; + + case SCH_DISABLE_CC: + SCH_DisableCmd(MessagePtr); + break; + + case SCH_ENABLE_GROUP_CC: + SCH_EnableGroupCmd(MessagePtr); + break; + + case SCH_DISABLE_GROUP_CC: + SCH_DisableGroupCmd(MessagePtr); + break; + + case SCH_ENABLE_SYNC_CC: + SCH_EnableSyncCmd(MessagePtr); + break; + + case SCH_SEND_DIAG_TLM_CC: + SCH_SendDiagTlmCmd(MessagePtr); + break; + + /* + ** SCH ground commands with unknown command codes... + */ + default: + CFE_EVS_SendEvent(SCH_CC_ERR_EID, + CFE_EVS_EventType_ERROR, + "Invalid command code: ID = 0x%04X, CC = %d", + MessageID.Value, + CommandCode); + + SCH_AppData.ErrCounter++; + break; + } + break; + + /* + ** Unknown message ID's + */ + default: + CFE_EVS_SendEvent(SCH_MD_ERR_EID, + CFE_EVS_EventType_ERROR, + "Msg with Invalid message ID Rcvd -- ID = 0x%04X", + MessageID.Value); + break; + } + + return(Result); + +} /* End of SCH_AppPipe() */ + + +/******************************************************************* +** +** SCH_HousekeepingCmd +** +** NOTE: For complete prolog information, see above +********************************************************************/ + +int32 SCH_HousekeepingCmd(CFE_MSG_Message_t *MessagePtr) +{ + int32 TableResult = SCH_SUCCESS; + + if (SCH_VerifyCmdLength(MessagePtr, sizeof(SCH_NoArgsCmd_t)) == SCH_SUCCESS) + { + /* + ** Update contents of Housekeeping Packet + */ + SCH_AppData.HkPacket.CmdCounter = SCH_AppData.CmdCounter; + SCH_AppData.HkPacket.ErrCounter = SCH_AppData.ErrCounter; + SCH_AppData.HkPacket.ScheduleActivitySuccessCount = SCH_AppData.ScheduleActivitySuccessCount; + SCH_AppData.HkPacket.ScheduleActivityFailureCount = SCH_AppData.ScheduleActivityFailureCount; + SCH_AppData.HkPacket.SlotsProcessedCount = SCH_AppData.SlotsProcessedCount; + SCH_AppData.HkPacket.SkippedSlotsCount = SCH_AppData.SkippedSlotsCount; + SCH_AppData.HkPacket.MultipleSlotsCount = SCH_AppData.MultipleSlotsCount; + SCH_AppData.HkPacket.SameSlotCount = SCH_AppData.SameSlotCount; + SCH_AppData.HkPacket.BadTableDataCount = SCH_AppData.BadTableDataCount; + SCH_AppData.HkPacket.TableVerifySuccessCount = SCH_AppData.TableVerifySuccessCount; + SCH_AppData.HkPacket.TableVerifyFailureCount = SCH_AppData.TableVerifyFailureCount; + SCH_AppData.HkPacket.TablePassCount = SCH_AppData.TablePassCount; + SCH_AppData.HkPacket.ValidMajorFrameCount = SCH_AppData.ValidMajorFrameCount; + SCH_AppData.HkPacket.MissedMajorFrameCount = SCH_AppData.MissedMajorFrameCount; + SCH_AppData.HkPacket.UnexpectedMajorFrameCount = SCH_AppData.UnexpectedMajorFrameCount; + SCH_AppData.HkPacket.MinorFramesSinceTone = SCH_AppData.MinorFramesSinceTone; + SCH_AppData.HkPacket.NextSlotNumber = SCH_AppData.NextSlotNumber; + SCH_AppData.HkPacket.LastSyncMETSlot = SCH_AppData.LastSyncMETSlot; + SCH_AppData.HkPacket.IgnoreMajorFrame = SCH_AppData.IgnoreMajorFrame; + SCH_AppData.HkPacket.UnexpectedMajorFrame = SCH_AppData.UnexpectedMajorFrame; + SCH_AppData.HkPacket.SyncToMET = SCH_AppData.SyncToMET; + SCH_AppData.HkPacket.MajorFrameSource = SCH_AppData.MajorFrameSource; + + /* + ** Timestamps and send housekeeping packet + */ + CFE_SB_TimeStampMsg((CFE_MSG_Message_t *)&SCH_AppData.HkPacket); + CFE_SB_TransmitMsg((CFE_MSG_Message_t *)&SCH_AppData.HkPacket, true); + + /* + ** Reset "high rate" event filters + */ + CFE_EVS_ResetAllFilters(); + } + + /* + ** Note: + ** + ** The following table functions will give the cFE Table Manager + ** a chance to update the tables used by this application. If + ** there is an error (very unlikely) the return value will cause + ** us to fall out of the main process loop and terminate the SCH + ** task. It may sound extreme but there is nothing for the + ** Scheduler to do if it cannot access both the message + ** and schedule tables. + */ + CFE_TBL_ReleaseAddress(SCH_AppData.ScheduleTableHandle); + CFE_TBL_ReleaseAddress(SCH_AppData.MessageTableHandle); + + TableResult = SCH_AcquirePointers(); + + return(TableResult); + +} /* End of SCH_HousekeepingCmd() */ + + +/******************************************************************* +** +** SCH_NoopCmd +** +** NOTE: For complete prolog information, see above +********************************************************************/ + +void SCH_NoopCmd(CFE_MSG_Message_t *MessagePtr) +{ + if (SCH_VerifyCmdLength(MessagePtr, sizeof(SCH_NoArgsCmd_t)) != SCH_SUCCESS) + { + SCH_AppData.ErrCounter++; + } + else + { + /* + ** This command is used primarily for "aliveness" testing + */ + SCH_AppData.CmdCounter++; + + CFE_EVS_SendEvent(SCH_NOOP_CMD_EID, + CFE_EVS_EventType_INFORMATION, + "NO-op command. Version %d.%d.%d.%d", + SCH_MAJOR_VERSION, + SCH_MINOR_VERSION, + SCH_REVISION, + SCH_MISSION_REV); + } + + return; + +} /* End of SCH_NoopCmd() */ + + +/******************************************************************* +** +** SCH_ResetCmd +** +** NOTE: For complete prolog information, see above +********************************************************************/ + +void SCH_ResetCmd(CFE_MSG_Message_t *MessagePtr) +{ + if (SCH_VerifyCmdLength(MessagePtr, sizeof(SCH_NoArgsCmd_t)) != SCH_SUCCESS) + { + SCH_AppData.ErrCounter++; + } + else + { + /* + ** Reset housekeeping counters + */ + SCH_AppData.CmdCounter = 0; + SCH_AppData.ErrCounter = 0; + + SCH_AppData.ScheduleActivitySuccessCount = 0; + SCH_AppData.ScheduleActivityFailureCount = 0; + + SCH_AppData.SlotsProcessedCount = 0; + SCH_AppData.SkippedSlotsCount = 0; + SCH_AppData.MultipleSlotsCount = 0; + SCH_AppData.SameSlotCount = 0; + SCH_AppData.BadTableDataCount = 0; + + SCH_AppData.TableVerifySuccessCount = 0; + SCH_AppData.TableVerifyFailureCount = 0; + + SCH_AppData.ValidMajorFrameCount = 0; + SCH_AppData.MissedMajorFrameCount = 0; + SCH_AppData.UnexpectedMajorFrameCount = 0; + + CFE_EVS_SendEvent(SCH_RESET_CMD_EID, CFE_EVS_EventType_DEBUG, "RESET command"); + } + + return; + +} /* End of SCH_ResetCmd() */ + + +/******************************************************************* +** +** SCH_EnableCmd +** +** NOTE: For complete prolog information, see above +********************************************************************/ + +void SCH_EnableCmd(CFE_MSG_Message_t *MessagePtr) +{ + bool GoodCommand = false; + SCH_EntryCmd_t *EnableCmd = NULL; + uint16 SlotNumber = 0; + uint16 EntryNumber = 0; + uint16 TableIndex = 0; + + /* + ** Extract contents of command + */ + EnableCmd = (SCH_EntryCmd_t *) MessagePtr; + + if(SCH_VerifyCmdLength(MessagePtr, sizeof(SCH_EntryCmd_t)) == SCH_SUCCESS) + { + SlotNumber = EnableCmd->SlotNumber; + EntryNumber = EnableCmd->EntryNumber; + TableIndex = (SlotNumber * SCH_ENTRIES_PER_SLOT) + EntryNumber; + + if ((SlotNumber >= SCH_TOTAL_SLOTS) || (EntryNumber >= SCH_ENTRIES_PER_SLOT)) + { + /* + ** Invalid command packet argument + */ + CFE_EVS_SendEvent(SCH_ENABLE_CMD_ARG_ERR_EID, + CFE_EVS_EventType_ERROR, + "ENABLE cmd: invalid argument, slot=%d (<%d), entry=%d (<%d)", + SlotNumber, + SCH_TOTAL_SLOTS, + EntryNumber, + SCH_ENTRIES_PER_SLOT); + } + else if ((SCH_AppData.ScheduleTable[TableIndex].EnableState != SCH_ENABLED) && + (SCH_AppData.ScheduleTable[TableIndex].EnableState != SCH_DISABLED)) + { + /* + ** Invalid schedule table enable state (unused or corrupt) + */ + CFE_EVS_SendEvent(SCH_ENABLE_CMD_ENTRY_ERR_EID, + CFE_EVS_EventType_ERROR, + "ENABLE command: invalid state = %d, slot = %d, entry = %d", + SCH_AppData.ScheduleTable[TableIndex].EnableState, + SlotNumber, + EntryNumber); + } + else + { + /* + ** Success + */ + GoodCommand = true; + + SCH_AppData.ScheduleTable[TableIndex].EnableState = SCH_ENABLED; + CFE_TBL_Modified(SCH_AppData.ScheduleTableHandle); + + CFE_EVS_SendEvent(SCH_ENABLE_CMD_EID, + CFE_EVS_EventType_DEBUG, + "ENABLE command: slot = %d, entry = %d", + SlotNumber, + EntryNumber); + } + } + + SCH_PostCommandResult(GoodCommand); + + return; + +} /* End of SCH_EnableCmd() */ + + +/******************************************************************* +** +** SCH_DisableCmd +** +** NOTE: For complete prolog information, see above +********************************************************************/ + +void SCH_DisableCmd(CFE_MSG_Message_t *MessagePtr) +{ + bool GoodCommand = false; + SCH_EntryCmd_t *DisableCmd = NULL; + uint16 SlotNumber = 0; + uint16 EntryNumber = 0; + uint16 TableIndex = 0; + + /* + ** Extract contents of command + */ + DisableCmd = (SCH_EntryCmd_t *) MessagePtr; + + if (SCH_VerifyCmdLength(MessagePtr, sizeof(SCH_EntryCmd_t)) == SCH_SUCCESS) + { + SlotNumber = DisableCmd->SlotNumber; + EntryNumber = DisableCmd->EntryNumber; + TableIndex = (SlotNumber * SCH_ENTRIES_PER_SLOT) + EntryNumber; + + if ((SlotNumber >= SCH_TOTAL_SLOTS) || (EntryNumber >= SCH_ENTRIES_PER_SLOT)) + { + /* + ** Invalid command packet argument + */ + CFE_EVS_SendEvent(SCH_DISABLE_CMD_ARG_ERR_EID, + CFE_EVS_EventType_ERROR, + "DISABLE cmd: invalid argument, slot=%d (<%d), entry=%d (<%d)", + SlotNumber, + SCH_TOTAL_SLOTS, + EntryNumber, + SCH_ENTRIES_PER_SLOT); + } + else if ((SCH_AppData.ScheduleTable[TableIndex].EnableState != SCH_ENABLED) && + (SCH_AppData.ScheduleTable[TableIndex].EnableState != SCH_DISABLED)) + { + /* + ** Invalid schedule table enable state (unused or corrupt) + */ + CFE_EVS_SendEvent(SCH_DISABLE_CMD_ENTRY_ERR_EID, + CFE_EVS_EventType_ERROR, + "DISABLE command: invalid state = %d, slot = %d, entry = %d", + SCH_AppData.ScheduleTable[TableIndex].EnableState, + SlotNumber, + EntryNumber); + } + else + { + /* + ** Success + */ + GoodCommand = true; + + SCH_AppData.ScheduleTable[TableIndex].EnableState = SCH_DISABLED; + CFE_TBL_Modified(SCH_AppData.ScheduleTableHandle); + + CFE_EVS_SendEvent(SCH_DISABLE_CMD_EID, + CFE_EVS_EventType_DEBUG, + "DISABLE command: slot = %d, entry = %d", + SlotNumber, + EntryNumber); + } + } + + SCH_PostCommandResult(GoodCommand); + + return; + +} /* End of SCH_DisableCmd() */ + + +/******************************************************************* +** +** SCH_EnableGroupCmd +** +** NOTE: For complete prolog information, see above +********************************************************************/ + +void SCH_EnableGroupCmd(CFE_MSG_Message_t *MessagePtr) +{ + bool GoodCommand = false; + uint32 TblGroupNumber = 0; + uint32 TblMultiGroup = 0; + int32 LoopCount = 0; + int32 MatchCount = 0; + SCH_GroupCmd_t *EnableCmd = NULL; + SCH_ScheduleEntry_t *TableEntry = NULL; + uint32 CmdGroupNumber = 0; + uint32 CmdMultiGroup = 0; + + /* + ** Extract command parameters + */ + EnableCmd = (SCH_GroupCmd_t *)MessagePtr; + + if (SCH_VerifyCmdLength(MessagePtr, sizeof(SCH_GroupCmd_t)) == SCH_SUCCESS) + { + TableEntry = &SCH_AppData.ScheduleTable[0]; + CmdGroupNumber = EnableCmd->GroupData & SCH_GROUP_NUMBER_BIT_MASK; + CmdMultiGroup = EnableCmd->GroupData & SCH_MULTI_GROUP_BIT_MASK; + + if ((CmdGroupNumber == SCH_UNUSED) && (CmdMultiGroup == SCH_UNUSED)) + { + /* + ** No groups selected + */ + CFE_EVS_SendEvent(SCH_ENA_GRP_CMD_ERR_EID, + CFE_EVS_EventType_ERROR, + "ENABLE GROUP command: invalid argument, no groups selected"); + } + else + { + /* + ** Search entire schedule table for group members + */ + for (LoopCount = 0; LoopCount < SCH_TABLE_ENTRIES; LoopCount++) + { + /* + ** Skip unused table entries + */ + if (TableEntry->GroupData != SCH_UNUSED) + { + TblGroupNumber = TableEntry->GroupData & SCH_GROUP_NUMBER_BIT_MASK; + TblMultiGroup = TableEntry->GroupData & SCH_MULTI_GROUP_BIT_MASK; + + /* + ** Look for matching table entries + */ + if (((CmdGroupNumber != SCH_UNUSED) && (CmdGroupNumber == TblGroupNumber)) || + ((CmdMultiGroup & TblMultiGroup) != SCH_UNUSED)) + { + MatchCount++; + TableEntry->EnableState = SCH_ENABLED; + } + } + + TableEntry++; + } + + if (MatchCount > 0) + { + CFE_TBL_Modified(SCH_AppData.ScheduleTableHandle); + CFE_EVS_SendEvent(SCH_ENA_GRP_CMD_EID, + CFE_EVS_EventType_DEBUG, + "ENABLE GROUP command: match count = %d", + (int)MatchCount); + GoodCommand = true; + } + else + { + CFE_EVS_SendEvent( + SCH_ENA_GRP_NOT_FOUND_ERR_EID, + CFE_EVS_EventType_ERROR, + "ENABLE GROUP command: Neither Group %d nor Multi-Group 0x%06X found", + (int)(CmdGroupNumber >> 24), + (unsigned int)CmdMultiGroup); + } + } + } + + SCH_PostCommandResult(GoodCommand); + + return; + +} /* End of SCH_EnableGroupCmd() */ + + +/******************************************************************* +** +** SCH_DisableGroupCmd +** +** NOTE: For complete prolog information, see above +********************************************************************/ + +void SCH_DisableGroupCmd(CFE_MSG_Message_t *MessagePtr) +{ + bool GoodCommand = false; + uint32 TblGroupNumber = 0; + uint32 TblMultiGroup = 0; + int32 LoopCount = 0; + int32 MatchCount = 0; + SCH_GroupCmd_t *DisableCmd = NULL; + SCH_ScheduleEntry_t *TableEntry = NULL; + uint32 CmdGroupNumber = 0; + uint32 CmdMultiGroup = 0; + + /* + ** Extract command parameters + */ + DisableCmd = (SCH_GroupCmd_t *)MessagePtr; + + if (SCH_VerifyCmdLength(MessagePtr, sizeof(SCH_GroupCmd_t)) == SCH_SUCCESS) + { + TableEntry = &SCH_AppData.ScheduleTable[0]; + CmdGroupNumber = DisableCmd->GroupData & SCH_GROUP_NUMBER_BIT_MASK; + CmdMultiGroup = DisableCmd->GroupData & SCH_MULTI_GROUP_BIT_MASK; + + if ((CmdGroupNumber == SCH_UNUSED) && (CmdMultiGroup == SCH_UNUSED)) + { + /* + ** No groups selected + */ + CFE_EVS_SendEvent(SCH_DIS_GRP_CMD_ERR_EID, + CFE_EVS_EventType_ERROR, + "DISABLE GROUP command: invalid argument, no groups selected"); + } + else + { + /* + ** Search entire schedule table for group members + */ + for (LoopCount = 0; LoopCount < SCH_TABLE_ENTRIES; LoopCount++) + { + /* + ** Skip unused table entries + */ + if (TableEntry->GroupData != SCH_UNUSED) + { + TblGroupNumber = TableEntry->GroupData & SCH_GROUP_NUMBER_BIT_MASK; + TblMultiGroup = TableEntry->GroupData & SCH_MULTI_GROUP_BIT_MASK; + + /* + ** Look for matching table entries + */ + if (((CmdGroupNumber != SCH_UNUSED) && (CmdGroupNumber == TblGroupNumber)) || + ((CmdMultiGroup & TblMultiGroup) != SCH_UNUSED)) + { + MatchCount++; + TableEntry->EnableState = SCH_DISABLED; + } + } + + TableEntry++; + } + + if (MatchCount > 0) + { + CFE_TBL_Modified(SCH_AppData.ScheduleTableHandle); + CFE_EVS_SendEvent(SCH_DIS_GRP_CMD_EID, + CFE_EVS_EventType_DEBUG, + "DISABLE GROUP command: match count = %d", + (int)MatchCount); + GoodCommand = true; + } + else + { + CFE_EVS_SendEvent( + SCH_DIS_GRP_NOT_FOUND_ERR_EID, + CFE_EVS_EventType_ERROR, + "DISABLE GROUP command: Neither Group %d nor Multi-Group 0x%06X found", + (int)(CmdGroupNumber >> 24), + (unsigned int)CmdMultiGroup); + } + } + } + + SCH_PostCommandResult(GoodCommand); + + return; + +} /* End of SCH_DisableGroupCmd() */ + + +/******************************************************************* +** +** SCH_EnableSyncCmd +** +** NOTE: For complete prolog information, see above +********************************************************************/ + +void SCH_EnableSyncCmd(CFE_MSG_Message_t *MessagePtr) +{ + bool GoodCommand = false; + + if (SCH_VerifyCmdLength(MessagePtr, sizeof(SCH_NoArgsCmd_t)) == SCH_SUCCESS) + { + GoodCommand = true; + + SCH_AppData.IgnoreMajorFrame = false; + SCH_AppData.UnexpectedMajorFrame = false; + SCH_AppData.ConsecutiveNoisyFrameCounter = 0; + + CFE_EVS_SendEvent( + SCH_ENA_SYNC_CMD_EID, CFE_EVS_EventType_DEBUG, "Major Frame Synchronization Enabled"); + } + + SCH_PostCommandResult(GoodCommand); + + return; + +} /* End of SCH_EnableSyncCmd() */ + + + + +/******************************************************************* +** +** SCH_SendDiagTlmCmd +** +** NOTE: For complete prolog information, see above +********************************************************************/ + +void SCH_SendDiagTlmCmd(CFE_MSG_Message_t *MessagePtr) +{ + uint32 TblIndex = 0; + uint32 WordIndex = 0; + uint32 BitIndex = 0; + SCH_ScheduleEntry_t *TableEntry = NULL; + bool GoodCommand = false; + + if (SCH_VerifyCmdLength(MessagePtr, sizeof(SCH_NoArgsCmd_t)) == SCH_SUCCESS) + { + GoodCommand = true; + + /* Zero out the previous entry states */ + CFE_PSP_MemSet(&SCH_AppData.DiagPacket.EntryStates[0], 0x0, SCH_NUM_STATUS_BYTES_REQD); + + for (TblIndex = 0; TblIndex < SCH_TABLE_ENTRIES; TblIndex++) + { + TableEntry = &SCH_AppData.ScheduleTable[TblIndex]; + WordIndex = TblIndex/8; /* 8 states can fit in each word */ + BitIndex = (7-(TblIndex%8))*2; /* Determine bit pair, MSBs contain lowest index */ + + if (TableEntry->EnableState == SCH_ENABLED) + { + SCH_AppData.DiagPacket.EntryStates[WordIndex] |= (1 << BitIndex); + CFE_MSG_GetMsgId( + (CFE_MSG_Message_t *)&SCH_AppData + .MessageTable[SCH_AppData.ScheduleTable[TblIndex].MessageIndex], + &SCH_AppData.DiagPacket.MsgIDs[TblIndex] + ); + } + else if (TableEntry->EnableState == SCH_DISABLED) + { + SCH_AppData.DiagPacket.EntryStates[WordIndex] |= (2 << BitIndex); + CFE_MSG_GetMsgId( + (CFE_MSG_Message_t *)&SCH_AppData + .MessageTable[SCH_AppData.ScheduleTable[TblIndex].MessageIndex], + &SCH_AppData.DiagPacket.MsgIDs[TblIndex] + ); + } + else + { + SCH_AppData.DiagPacket.MsgIDs[TblIndex] = CFE_SB_ValueToMsgId(0x0000); + } + } + /* + ** Timestamp and send diagnostic packet + */ + CFE_SB_TimeStampMsg((CFE_MSG_Message_t *)&SCH_AppData.DiagPacket); + CFE_SB_TransmitMsg((CFE_MSG_Message_t *)&SCH_AppData.DiagPacket, true); + + CFE_EVS_SendEvent(SCH_SEND_DIAG_CMD_EID, CFE_EVS_EventType_DEBUG, "Transmitting Diagnostic Message"); + } + + SCH_PostCommandResult(GoodCommand); + + return; + +} /* End of SCH_SendDiagTlmCmd() */ + + +/******************************************************************* +** +** SCH_AcquirePointers +** +** NOTE: For complete prolog information, see 'sch_cmds.h' +********************************************************************/ + +int32 SCH_AcquirePointers(void) +{ + int32 Result; + + /* + ** Let cFE manage the tables + */ + CFE_TBL_Manage(SCH_AppData.ScheduleTableHandle); + CFE_TBL_Manage(SCH_AppData.MessageTableHandle); + + /* + ** Get a pointer to the schedule table + */ + Result = CFE_TBL_GetAddress((void *)&SCH_AppData.ScheduleTable, + SCH_AppData.ScheduleTableHandle); + + if (Result > CFE_SUCCESS) + { + /* + ** Change warning results to indicate "success" + */ + Result = CFE_SUCCESS; + } + + /* + ** Repeat the process for the message table + */ + if (Result == CFE_SUCCESS) + { + Result = CFE_TBL_GetAddress((void *)&SCH_AppData.MessageTable, + SCH_AppData.MessageTableHandle); + if (Result > CFE_SUCCESS) + { + Result = CFE_SUCCESS; + } + } + + return(Result); + +} /* End of SCH_AcquirePointers() */ + + +/******************************************************************* +** +** SCH_VerifyCmdLength +** +** NOTE: For complete prolog information, see above +********************************************************************/ + +int32 SCH_VerifyCmdLength (CFE_MSG_Message_t *MessagePtr, uint32 ExpectedLength) +{ + int32 Status = SCH_SUCCESS; + CFE_SB_MsgId_t MessageID = CFE_SB_INVALID_MSG_ID; + CFE_MSG_FcnCode_t CommandCode = 0; + size_t ActualLength = 0; + + CFE_MSG_GetSize(MessagePtr, &ActualLength); + + if (ExpectedLength != ActualLength) + { + CFE_MSG_GetMsgId(MessagePtr, &MessageID); + CFE_MSG_GetFcnCode(MessagePtr, &CommandCode); + + CFE_EVS_SendEvent(SCH_CMD_LEN_ERR_EID, CFE_EVS_EventType_ERROR, + "Cmd Msg with Bad length Rcvd: ID = 0x%04X, CC = %d, Exp Len = %d, Len = %d", + (unsigned int)CFE_SB_MsgIdToValue(MessageID), (int)CommandCode, (int)ExpectedLength, (int)ActualLength); + + Status = SCH_BAD_MSG_LENGTH_RC; + } + + return Status; + +} /* End of SCH_VerifyCmdLength () */ + + +/******************************************************************* +** +** SCH_PostCommandResult +** +** NOTE: For complete prolog information, see above +********************************************************************/ + +void SCH_PostCommandResult(bool GoodCommand) +{ + if (GoodCommand) + { + SCH_AppData.CmdCounter++; + } + else + { + SCH_AppData.ErrCounter++; + } + + return; + +} /* End of SCH_PostCommandResult() */ + + + +/************************/ +/* End of File Comment */ +/************************/ + diff --git a/apps/sch/fsw/src/sch_cmds.h b/apps/sch/fsw/src/sch_cmds.h new file mode 100644 index 0000000..a38fae8 --- /dev/null +++ b/apps/sch/fsw/src/sch_cmds.h @@ -0,0 +1,320 @@ +/************************************************************************ +** File: +** $Id: sch_cmds.h 1.4 2017/06/21 15:29:00EDT mdeschu Exp $ +** +** Copyright (c) 2007-2014 United States Government as represented by the +** Administrator of the National Aeronautics and Space Administration. +** All Other Rights Reserved. +** +** This software was created at NASA's Goddard Space Flight Center. +** This software is governed by the NASA Open Source Agreement and may be +** used, distributed and modified only pursuant to the terms of that +** agreement. +** +** Purpose: +** The CFS Scheduler (SCH) Application header file +** +** Notes: +** +** +*************************************************************************/ +#ifndef _sch_cmds_ +#define _sch_cmds_ + +/************************************************************************* +** +** Include section +** +**************************************************************************/ + +#include "cfe.h" + +/************************************************************************* +** +** Macro definitions +** +**************************************************************************/ + +/************************************************************************* +** +** Type definitions +** +**************************************************************************/ + +/************************************************************************* +** +** Exported data +** +**************************************************************************/ + +/************************************************************************* +** +** Exported functions +** +**************************************************************************/ +/************************************************************************/ +/** \brief Process a command pipe message +** +** \par Description +** Processes a single software bus command pipe message. Checks +** the message and command IDs and calls the appropriate routine +** to handle the command. +** +** \par Assumptions, External Events, and Notes: +** None +** +** \param [in] MessagePtr A #CFE_SB_MsgPtr_t pointer that +** references the software bus message +** +** \returns +** \retcode #CFE_SUCCESS \retdesc \copydoc CFE_SUCCESS \endcode +** \retstmt Return codes from #CFE_EVS_Register \endcode +** \retstmt Return codes from #CFE_SB_CreatePipe \endcode +** \retstmt Return codes from #CFE_SB_Subscribe \endcode +** \endreturns +** +** \sa #CFE_SB_RcvMsg +** +*************************************************************************/ +int32 SCH_AppPipe(CFE_SB_Buffer_t *MessagePtr); + +/************************************************************************/ +/** \brief Manages Scheduler's Schedule and Message Definition Tables +** +** \par Description +** This function manages the contents of the Schedule and Message +** Definition Tables. +** +** \par Assumptions, External Events, and Notes: +** None +** +** \returns +** \retcode #CFE_SUCCESS \retdesc \copydoc CFE_SUCCESS \endcode +** \retstmt Return codes from #CFE_EVS_Register \endcode +** \retstmt Return codes from #CFE_SB_CreatePipe \endcode +** \retstmt Return codes from #CFE_SB_Subscribe \endcode +** \endreturns +** +*************************************************************************/ +int32 SCH_AcquirePointers(void); + +/************************************************************************/ +/** \brief Process housekeeping request +** +** \par Description +** Processes an on-board housekeeping request message. +** +** \par Assumptions, External Events, and Notes: +** This command does not affect the command execution counter +** +** \param [in] MessagePtr A #CFE_SB_MsgId_t pointer that +** references the software bus message +** +** \returns +** \retcode #CFE_SUCCESS \retdesc \copydoc CFE_SUCCESS \endcode +** \retstmt Return codes from #CFE_EVS_Register \endcode +** \retstmt Return codes from #CFE_SB_CreatePipe \endcode +** \retstmt Return codes from #CFE_SB_Subscribe \endcode +** \endreturns +** +*************************************************************************/ +int32 SCH_HousekeepingCmd(CFE_MSG_Message_t *MessagePtr); + +/* +** Application command handlers +*/ +/************************************************************************/ +/** \brief Process noop command +** +** \par Description +** Processes a noop ground command. +** +** \par Assumptions, External Events, and Notes: +** None +** +** \param [in] MessagePtr A #CFE_SB_MsgId_t pointer that +** references the software bus message +** +** \sa #SCH_NOOP_CC +** +*************************************************************************/ +void SCH_NoopCmd(CFE_MSG_Message_t *MessagePtr); + +/************************************************************************/ +/** \brief Process reset counters command +** +** \par Description +** Processes a reset counters ground command which will reset +** the Scheduler commmand error, command execution and performance +** statistics counters to zero. +** +** \par Assumptions, External Events, and Notes: +** None +** +** \param [in] MessagePtr A #CFE_SB_MsgId_t pointer that +** references the software bus message +** +** \sa #SCH_RESET_CC +** +*************************************************************************/ +void SCH_ResetCmd(CFE_MSG_Message_t *MessagePtr); + +/************************************************************************/ +/** \brief Enable a Single Activity Command +** +** \par Description +** Command to Enable a specific activity in the Schedule +** Definition Table. +** +** \par Assumptions, External Events, and Notes: +** None +** +** \param [in] MessagePtr A #CFE_SB_MsgId_t pointer that +** references the software bus message +** +** \sa #SCH_ENABLE_CC, #SCH_DISABLE_CC, #SCH_ENABLE_GROUP_CC, #SCH_DISABLE_GROUP_CC +** +*************************************************************************/ +void SCH_EnableCmd(CFE_MSG_Message_t *MessagePtr); + +/************************************************************************/ +/** \brief Disable a Single Activity Command +** +** \par Description +** Command to Disable a specific activity in the Schedule +** Definition Table. +** +** \par Assumptions, External Events, and Notes: +** None +** +** \param [in] MessagePtr A #CFE_SB_MsgId_t pointer that +** references the software bus message +** +** \sa #SCH_ENABLE_CC, #SCH_DISABLE_CC, #SCH_ENABLE_GROUP_CC, #SCH_DISABLE_GROUP_CC +** +*************************************************************************/ +void SCH_DisableCmd(CFE_MSG_Message_t *MessagePtr); + +/************************************************************************/ +/** \brief Enable a Group and/or Multi-Group(s) Command +** +** \par Description +** Command to Enable a single Group and/or one or more Multi-Groups +** of activities. +** +** \par Assumptions, External Events, and Notes: +** None +** +** \param [in] MessagePtr A #CFE_SB_MsgId_t pointer that +** references the software bus message +** +** \sa #SCH_ENABLE_CC, #SCH_DISABLE_CC, #SCH_ENABLE_GROUP_CC, #SCH_DISABLE_GROUP_CC +** +*************************************************************************/ +void SCH_EnableGroupCmd(CFE_MSG_Message_t *MessagePtr); + +/************************************************************************/ +/** \brief Disable a Group and/or Multi-Group(s) Command +** +** \par Description +** Command to Disable a single Group and/or one or more Multi-Groups +** of activities. +** +** \par Assumptions, External Events, and Notes: +** None +** +** \param [in] MessagePtr A #CFE_SB_MsgId_t pointer that +** references the software bus message +** +** \sa #SCH_ENABLE_CC, #SCH_DISABLE_CC, #SCH_ENABLE_GROUP_CC, #SCH_DISABLE_GROUP_CC +** +*************************************************************************/ +void SCH_DisableGroupCmd(CFE_MSG_Message_t *MessagePtr); + +/************************************************************************/ +/** \brief Enables Major Frame Synchronization +** +** \par Description +** Command to enable synchronization of Schedule Definition Table to +** the Major Frame Sync signal. The synchronization can become +** unsynchronized when the Major Frame signal becomes noisy. +** +** \par Assumptions, External Events, and Notes: +** None +** +** \param [in] MessagePtr A #CFE_SB_MsgId_t pointer that +** references the software bus message +** +** \sa #SCH_ENABLE_CC, #SCH_DISABLE_CC, #SCH_ENABLE_GROUP_CC, #SCH_DISABLE_GROUP_CC +** +*************************************************************************/ +void SCH_EnableSyncCmd(CFE_MSG_Message_t *MessagePtr); + +/************************************************************************/ +/** \brief Creates and sends diagnostic message packet +** +** \par Description +** Command to send the Scheduler diagnostic message. +** +** \par Assumptions, External Events, and Notes: +** None +** +** \param [in] MessagePtr A #CFE_SB_MsgId_t pointer that +** references the software bus message +** +*************************************************************************/ +void SCH_SendDiagTlmCmd(CFE_MSG_Message_t *MessagePtr); + +/************************************************************************/ +/** \brief Updates appropriate command counters following command execution +** +** \par Description +** This function updates the ground or on-board command counter or +** command error counter depending upon the success of the command +** and where it originated. +** +** \par Assumptions, External Events, and Notes: +** None +** +** \param [in] GoodCommand Indicates the command was successfully +** performed (=TRUE) or contained an error +** (=FALSE). +** +*************************************************************************/ +void SCH_PostCommandResult(bool GoodCommand); + +/************************************************************************/ +/** \brief Verifies the length of the specified message +** +** \par Description +** This function determines whether the specified message is of the +** specified expected length. If not, an event message is generated +** and the appropriate command error counter is incremented. If the +** message length is appropriate, then the appropriate command counter +** is incremented. +** +** \par Assumptions, External Events, and Notes: +** None +** +** +** \param [in] MessagePtr A #CFE_SB_MsgId_t pointer that +** references the software bus message +** +** \param [in] ExpectedLength The size, in bytes, that the specified +** message should be equal to. +** +** \returns +** \retcode #CFE_SUCCESS \retdesc \copydoc CFE_SUCCESS \endcode +** \retstmt Return codes from #CFE_EVS_Register \endcode +** \retstmt Return codes from #CFE_SB_CreatePipe \endcode +** \retstmt Return codes from #CFE_SB_Subscribe \endcode +** \endreturns +** +*************************************************************************/ +int32 SCH_VerifyCmdLength(CFE_MSG_Message_t *MessagePtr, uint32 ExpectedLength); + +#endif /* _sch_cmds_ */ + +/************************/ +/* End of File Comment */ +/************************/ diff --git a/apps/sch/fsw/src/sch_custom.c b/apps/sch/fsw/src/sch_custom.c new file mode 100644 index 0000000..4abb349 --- /dev/null +++ b/apps/sch/fsw/src/sch_custom.c @@ -0,0 +1,448 @@ +/* +** $Id: sch_custom.c 1.5 2017/06/21 15:29:41EDT mdeschu Exp $ +** +** Copyright (c) 2007-2014 United States Government as represented by the +** Administrator of the National Aeronautics and Space Administration. +** All Other Rights Reserved. +** +** This software was created at NASA's Goddard Space Flight Center. +** This software is governed by the NASA Open Source Agreement and may be +** used, distributed and modified only pursuant to the terms of that +** agreement. +** +** Purpose: Scheduler (SCH) application custom component +** +** Author: +** +** Notes: +** +*/ + +/************************************************************************* +** +** Include section +** +**************************************************************************/ + +#include "cfe.h" +#include "sch_platform_cfg.h" + +#include "sch_app.h" +#include "sch_custom.h" + +/************************************************************************* +** +** Macro definitions +** +**************************************************************************/ + +/************************************************************************* +** Local function prototypes +**************************************************************************/ + + +/************************************************************************* +** +** Function definitions +** +**************************************************************************/ + + + + +/******************************************************************* +** +** SCH_CustomEarlyInit +** +** NOTE: For complete prolog information, see 'sch_custom.h' +** +** This function MUST update SCH_AppData.ClockAccuracy to the +** resolution of the minor frame timer. +********************************************************************/ + +int32 SCH_CustomEarlyInit(void) +{ + int32 Status = CFE_SUCCESS; + + Status = OS_TimerCreate(&SCH_AppData.TimerId, + SCH_TIMER_NAME, + &SCH_AppData.ClockAccuracy, + SCH_MinorFrameCallback); + + return Status; + +} /* End of CustomEarlyInit() */ + + +/******************************************************************* +** +** SCH_CustomLateInit +** +** NOTE: For complete prolog information, see 'sch_custom.h' +** +** This function MUST perform any startup synchronization required, +** and MUST finish setting up the major and minor frame timers. +********************************************************************/ + +int32 SCH_CustomLateInit(void) +{ + int32 Status = CFE_SUCCESS; + + CFE_ES_WaitForStartupSync(SCH_STARTUP_SYNC_TIMEOUT); + + /* + ** Connect to cFE TIME's time reference marker (typically 1 Hz) + ** to use it as the Major Frame synchronization source + */ + Status = CFE_TIME_RegisterSynchCallback((CFE_TIME_SynchCallbackPtr_t)&SCH_MajorFrameCallback); + if (Status == CFE_SUCCESS) + { + /* + ** Start the Minor Frame Timer with an extended delay to allow a Major Frame Sync + ** to start processing. If the Major Frame Sync fails to arrive, then we will + ** start when this timer expires and synch ourselves to the MET clock. + */ + Status = OS_TimerSet(SCH_AppData.TimerId, SCH_STARTUP_PERIOD, 0); + } + + return Status; + +} /* End of SH_CustomLateInit() */ + + +/******************************************************************* +** +** SCH_CustomGetCurrentSlotNumber +** +** NOTE: For complete prolog information, see 'sch_custom.h' +********************************************************************/ + +uint32 SCH_CustomGetCurrentSlotNumber(void) +{ + uint32 CurrentSlot; + + if (SCH_AppData.SyncToMET != SCH_NOT_SYNCHRONIZED) + { + CurrentSlot = SCH_GetMETSlotNumber(); + + /* + ** If we are only concerned with synchronizing the minor frames to an MET, + ** then we need to adjust the current slot by whatever MET time is prevalent + ** when the Major Frame Signal is received. + ** If we are synchronizing the Major Frame, then, by definition, LastSyncMETSlot + ** would be a zero and the current slot would be appropriate. + */ + if (CurrentSlot < SCH_AppData.LastSyncMETSlot) + { + CurrentSlot = CurrentSlot + SCH_TOTAL_SLOTS - SCH_AppData.LastSyncMETSlot; + } + else + { + CurrentSlot = CurrentSlot - SCH_AppData.LastSyncMETSlot; + } + } + else + { + CurrentSlot = SCH_AppData.MinorFramesSinceTone; + } + + return CurrentSlot; +} /* End of SH_CustomGetCurrentSlotNumber() */ + +/******************************************************************* +** +** SCH_CustomCleanup +** +** NOTE: For complete prolog information, see 'sch_custom.h' +********************************************************************/ + +void SCH_CustomCleanup(void) +{ + /* unregister the TIME callback for the major frame */ + CFE_TIME_UnregisterSynchCallback((CFE_TIME_SynchCallbackPtr_t)&SCH_MajorFrameCallback); + +} /* End of SH_CustomCleanup() */ + + +/******************************************************************* +** +** SCH_GetMETSlotNumber +** +** NOTE: For complete prolog information, see above +********************************************************************/ + +uint32 SCH_GetMETSlotNumber(void) +{ + uint32 SubSeconds = 0; + uint32 MicroSeconds; + uint32 Remainder; + uint32 METSlot; + + /* + ** Use MET rather than current time to avoid time changes + */ + SubSeconds = CFE_TIME_GetMETsubsecs(); + + /* + ** Convert sub-seconds to micro-seconds + */ + MicroSeconds = CFE_TIME_Sub2MicroSecs(SubSeconds); + + /* + ** Calculate schedule table slot number + */ + METSlot = (MicroSeconds / SCH_NORMAL_SLOT_PERIOD); + + /* + ** Check to see if close enough to round up to next slot + */ + Remainder = MicroSeconds - (METSlot * SCH_NORMAL_SLOT_PERIOD); + + /* + ** Add one more microsecond and see if it is sufficient to add another slot + */ + Remainder += 1; + METSlot += (Remainder / SCH_NORMAL_SLOT_PERIOD); + + /* + ** Check to see if the Current Slot number needs to roll over + */ + if (METSlot == SCH_TOTAL_SLOTS) + { + METSlot = 0; + } + + return METSlot; + +} + + +/******************************************************************* +** +** SCH_MajorFrameCallback +** +** NOTE: For complete prolog information, see above +********************************************************************/ + +void SCH_MajorFrameCallback(void) +{ + /* + ** Synchronize slot zero to the external tone signal + */ + uint16 StateFlags; + + /* + ** If cFE TIME is in FLYWHEEL mode, then ignore all synchronization signals + */ + StateFlags = CFE_TIME_GetClockInfo(); + + if ((StateFlags & CFE_TIME_FlagBit_FLYING) == 0) + { + /* + ** Determine whether the major frame is noisy or not + ** + ** Conditions below are as follows: + ** If we are NOT synchronized to the MET (i.e. - the Minor Frame timer + ** has an acceptable resolution), then the Major Frame signal should + ** only occur in the last slot of the schedule table. + ** + ** If we ARE synchronized to the MET (i.e. - the Minor Frame timer is + ** not as good as we would like), then the Major Frame signal should + ** occur within a window of slots at the end of the table. + */ + if (((SCH_AppData.SyncToMET == SCH_NOT_SYNCHRONIZED) && + (SCH_AppData.MinorFramesSinceTone != SCH_TIME_SYNC_SLOT)) || + ((SCH_AppData.SyncToMET == SCH_MINOR_SYNCHRONIZED) && + (SCH_AppData.NextSlotNumber != 0) && + (SCH_AppData.NextSlotNumber < + (SCH_TOTAL_SLOTS - SCH_AppData.WorstCaseSlotsPerMinorFrame - 1)))) + { + /* + ** Count the number of consecutive noisy major frames and the Total number + ** of noisy major frames. Also, indicate in telemetry that this particular + ** Major Frame signal is considered noisy. + */ + SCH_AppData.UnexpectedMajorFrame = true; + SCH_AppData.UnexpectedMajorFrameCount++; + + /* + ** If the Major Frame is not being ignored yet, then increment the consecutive noisy + ** Major Frame counter. + */ + if (!SCH_AppData.IgnoreMajorFrame) + { + SCH_AppData.ConsecutiveNoisyFrameCounter++; + + /* + ** If the major frame is too "noisy", then send event message and ignore future signals + */ + if (SCH_AppData.ConsecutiveNoisyFrameCounter >= SCH_MAX_NOISY_MAJORF) + { + SCH_AppData.IgnoreMajorFrame = true; + } + } + } + else /* Major Frame occurred when expected */ + { + SCH_AppData.UnexpectedMajorFrame = false; + SCH_AppData.ConsecutiveNoisyFrameCounter = 0; + } + + /* + ** Ignore this callback if SCH has detected a noisy Major Frame Synch signal + */ + if (SCH_AppData.IgnoreMajorFrame == false) + { + /* + ** Stop Minor Frame Timer (which should be waiting for an unusually long + ** time to allow the Major Frame source to resynchronize timing) and start + ** it again with nominal Minor Frame timing + */ + OS_TimerSet(SCH_AppData.TimerId, SCH_NORMAL_SLOT_PERIOD, SCH_NORMAL_SLOT_PERIOD); + + /* + ** Increment Major Frame process counter + */ + SCH_AppData.ValidMajorFrameCount++; + + /* + ** Set current slot = zero to synchronize activities + */ + SCH_AppData.MinorFramesSinceTone = 0; + + /* + ** Major Frame Source is now from CFE TIME + */ + SCH_AppData.MajorFrameSource = SCH_MAJOR_FS_CFE_TIME; + + /* Clear any Major Frame In Sync with MET flags */ + /* But keep the Minor Frame In Sync with MET flag if it is set */ + SCH_AppData.SyncToMET &= SCH_MINOR_SYNCHRONIZED; + + /* + ** Give "wakeup SCH" semaphore + */ + OS_BinSemGive(SCH_AppData.TimeSemaphore); + } + } + + /* + ** We should assume that the next Major Frame will be in the same MET slot as this + */ + SCH_AppData.LastSyncMETSlot = SCH_GetMETSlotNumber(); + + return; + +} /* End of SCH_MajorFrameCallback() */ + + +/******************************************************************* +** +** SCH_MinorFrameCallback +** +** NOTE: For complete prolog information, see above +********************************************************************/ + +void SCH_MinorFrameCallback(uint32 TimerId) +{ + uint32 CurrentSlot; + + /* + ** If this is the very first timer interrupt, then the initial + ** Major Frame Synchronization timed out. This can occur when + ** either the signal is not arriving or the clock has gone into + ** FLYWHEEL mode. We should synchronize to the MET time instead. + */ + if (SCH_AppData.MajorFrameSource == SCH_MAJOR_FS_NONE) + { + SCH_AppData.MajorFrameSource = SCH_MAJOR_FS_MINOR_FRAME_TIMER; + + /* Synchronize timing to MET */ + SCH_AppData.SyncToMET |= SCH_PENDING_MAJOR_SYNCH; + SCH_AppData.SyncAttemptsLeft = SCH_MAX_SYNC_ATTEMPTS; + SCH_AppData.LastSyncMETSlot = 0; + } + + /* If attempting to synchronize the Major Frame with MET, then wait for zero subsecs before starting */ + if (((SCH_AppData.SyncToMET & SCH_PENDING_MAJOR_SYNCH) != 0) && + (SCH_AppData.MajorFrameSource == SCH_MAJOR_FS_MINOR_FRAME_TIMER)) + { + /* Whether we have found the Major Frame Start or not, wait another slot */ + OS_TimerSet(SCH_AppData.TimerId, SCH_NORMAL_SLOT_PERIOD, SCH_NORMAL_SLOT_PERIOD); + + /* Determine if this was the last attempt */ + SCH_AppData.SyncAttemptsLeft--; + + CurrentSlot = SCH_GetMETSlotNumber(); + if ((CurrentSlot != 0) && (SCH_AppData.SyncAttemptsLeft > 0)) + { + return; + } + else /* Synchronization achieved (or at least, aborted) */ + { + /* Clear the pending synchronization flag and set the "Major In Sync" flag */ + SCH_AppData.SyncToMET &= ~SCH_PENDING_MAJOR_SYNCH; + SCH_AppData.SyncToMET |= SCH_MAJOR_SYNCHRONIZED; + + /* CurrentSlot should be equal to zero. If not, this is the best estimate we can use */ + SCH_AppData.MinorFramesSinceTone = CurrentSlot; + SCH_AppData.LastSyncMETSlot = 0; + } + } + else + { + /* + ** If we are already synchronized with MET or don't care to be, increment current slot + */ + SCH_AppData.MinorFramesSinceTone++; + } + + if (SCH_AppData.MinorFramesSinceTone >= SCH_TOTAL_SLOTS) + { + /* + ** If we just rolled over from the last slot to slot zero, + ** It means that the Major Frame Callback did not cancel the + ** "long slot" timer that was started in the last slot + ** + ** It also means that we may now need a "short slot" + ** timer to make up for the previous long one + */ + OS_TimerSet(SCH_AppData.TimerId, SCH_SHORT_SLOT_PERIOD, SCH_NORMAL_SLOT_PERIOD); + + SCH_AppData.MinorFramesSinceTone = 0; + + SCH_AppData.MissedMajorFrameCount++; + } + + /* + ** Determine the timer delay value for the next slot + */ + if (SCH_AppData.MinorFramesSinceTone == SCH_TIME_SYNC_SLOT) + { + /* + ** Start "long slot" timer (should be stopped by Major Frame Callback) + */ + OS_TimerSet(SCH_AppData.TimerId, SCH_SYNC_SLOT_PERIOD, 0); + } + + /* + ** Note that if this is neither the first "short" minor frame nor the + ** last "long" minor frame, the timer is not modified. This should + ** provide more stable timing than introducing the dither associated + ** with software response times to timer interrupts. + */ + + /* + ** Give "wakeup SCH" semaphore + */ + OS_BinSemGive(SCH_AppData.TimeSemaphore); + + return; + +} /* End of SCH_MinorFrameCallback() */ + + +/************************/ +/* End of File Comment */ +/************************/ + diff --git a/apps/sch/fsw/src/sch_custom.h b/apps/sch/fsw/src/sch_custom.h new file mode 100644 index 0000000..f281466 --- /dev/null +++ b/apps/sch/fsw/src/sch_custom.h @@ -0,0 +1,174 @@ +/************************************************************************* +** File: +** $Id: sch_custom.h 1.5 2017/06/21 15:29:23EDT mdeschu Exp $ +** +** Copyright (c) 2007-2014 United States Government as represented by the +** Administrator of the National Aeronautics and Space Administration. +** All Other Rights Reserved. +** +** This software was created at NASA's Goddard Space Flight Center. +** This software is governed by the NASA Open Source Agreement and may be +** used, distributed and modified only pursuant to the terms of that +** agreement. +** +** Purpose: +** Specification for the CFS Scheduler (SCH) mission specific +** custom function interface +** +** Notes: +** +**************************************************************************/ +#ifndef _sch_custom_ +#define _sch_custom_ + +/************************************************************************* +** Includes +*************************************************************************/ +#include "cfe.h" + +/************************************************************************* +** Macro definitions +**************************************************************************/ + +/* +** Timer Characteristics +*/ +#define SCH_TIMER_NAME "SCH_MINOR_TIMER" + +/************************************************************************* +** Exported Functions +*************************************************************************/ + +/************************************************************************/ +/** \brief Custom Early Initialization +** +** \par Description +** This function is intended to perform the creation of the +** minor frame timer. It is called during #SCH_TimerInit +** It may be updated to include other initializations, or +** modifications to already set scheduler parameters. +** +** \par Assumptions, External Events, and Notes: +** SCH_AppData.ClockAccuracy will be set to the clock resolution +** in microseconds. +** CFE_SUCCESS will be returned if all creation was performed +** properly. +** +** \returns +** \retcode #CFE_SUCCESS \retdesc \copydoc CFE_SUCCESS \endcode +** \retstmt Return codes from #CFE_PSP_TimerInit \endcode +** \endreturns +** +*************************************************************************/ +int32 SCH_CustomEarlyInit(void); + +/************************************************************************/ +/** \brief Custom Late Initialization +** +** \par Description +** This function is intended to perform a wait for startup sync +** followed by the initialization and starting of the major frame +** timer, and the starting of the minor frame timer. It may be +** updated to include other initializations, or modifications to +** already set scheduler parameters, or remove actions previously +** performed in #SCH_CustomEarlyInit . This function is called +** following the completion of #SCH_AppInit +** +** \par Assumptions, External Events, and Notes: +** Any startup synchronization is included in this function +** CFE_SUCCESS will be returned if all initialization was performed +** properly. +** +** \returns +** \retcode #CFE_SUCCESS \retdesc \copydoc CFE_SUCCESS \endcode +** \retstmt Return codes from #CFE_PSP_TimerInit \endcode +** \endreturns +** +*************************************************************************/ +int32 SCH_CustomLateInit(void); + +/************************************************************************/ +/** \brief Obtains the Current Slot (Minor Frame) number +** +** \par Description +** This function determines the current slot (minor frame) number. +** It corrects for any minor frame overlap caused by poor minor frame +** timing, if necessary. This function and associated subfunction +** was added to the customizable section as on slower platforms +** this function can have noticible overhead, and several simplifying +** assumptions can be made on a platform specific basis. +** +** \par Assumptions, External Events, and Notes: +** None +** +** \returns +** \retstmt Returns slot index from zero to (#SCH_TOTAL_SLOTS-1) \endcode +** \endreturns +** +*************************************************************************/ +uint32 SCH_CustomGetCurrentSlotNumber(void); + +/************************************************************************/ +/** \brief Custom Cleanup +** +** \par Description +** This function is intended to perform any clean up of custom +** initialization that would be necessary on an application exit +** +** \par Assumptions, External Events, and Notes: +** Any resources that will not be cleaned up automatically be CFE +** need to be cleaned up in this function. +** +*************************************************************************/ +void SCH_CustomCleanup(void); + +/************************************************************************/ +/** \brief Computes a minor slot number from a MET subseconds zero point +** +** \par Description +** This function determines the current slot (minor frame) number if +** one were to assume that slot zero started when the MET microseconds +** are equal to zero. +** +** \par Assumptions, External Events, and Notes: +** None +** +** \returns +** \retstmt Returns slot index from zero to (#SCH_TOTAL_SLOTS-1) \endcode +** \endreturns +** +*************************************************************************/ +uint32 SCH_GetMETSlotNumber(void); + +/************************************************************************/ +/** \brief Performs Major Frame Synchronization +** +** \par Description +** This function is called by cFE TIME services when a Major Frame +** synchronization signal is received. It then synchronizes the +** minor frame (slot) processing of the Schedule Definition Table. +** +** \par Assumptions, External Events, and Notes: +** None +** +*************************************************************************/ +void SCH_MajorFrameCallback(void); + +/************************************************************************/ +/** \brief Performs Minor Frame time step +** +** \par Description +** This function is called by an OSAL timer when the minor frame +** timing reference sends a signal. The Scheduler Application uses +** this to drive the Application's processing of each minor frame. +** +** \par Assumptions, External Events, and Notes: +** None +** +*************************************************************************/ +void SCH_MinorFrameCallback(uint32 TimerId); + +#endif /* _sch_custom_ */ +/************************/ +/* End of File Comment */ +/************************/ diff --git a/apps/sch/fsw/src/sch_events.h b/apps/sch/fsw/src/sch_events.h new file mode 100644 index 0000000..5cc285f --- /dev/null +++ b/apps/sch/fsw/src/sch_events.h @@ -0,0 +1,713 @@ +/* +** $Id: sch_events.h 1.3 2017/06/21 15:29:22EDT mdeschu Exp $ +** +** Copyright (c) 2007-2014 United States Government as represented by the +** Administrator of the National Aeronautics and Space Administration. +** All Other Rights Reserved. +** +** This software was created at NASA's Goddard Space Flight Center. +** This software is governed by the NASA Open Source Agreement and may be +** used, distributed and modified only pursuant to the terms of that +** agreement. +** +** Subsystem: Scheduler (SCH) event message ID's +** +** Author: +** +** Notes: +** +*/ + +#ifndef _sch_events_ +#define _sch_events_ + +/************************************************************************* +** +** Include section +** +**************************************************************************/ + +/* +** (none) +*/ + +/************************************************************************* +** +** Macro definitions +** +**************************************************************************/ + +/** \brief 'SCH Initialized. Version %d.%d.%d.%d' +** \event 'SCH Initialized. Version %d.%d.%d.%d' +** +** \par Type: INFORMATION +** +** \par Cause: +** +** This event message is issued when the Scheduler App completes its +** initialization. +** +** The first \c %d field contains the Application's Major Version Number +** The second \c %d field contains the Application's Minor Version Number +** The third \c %d field contains the Application's Revision Number +** The fourth \c %d field contains the Application's Mission Revision Number +**/ +#define SCH_INITSTATS_INF_EID 1 + +/** \brief 'SCH App: terminating, err = 0x%08X' +** \event 'SCH App: terminating, err = 0x%08X' +** +** \par Type: CRITICAL +** +** \par Cause: +** +** This event message is always issued whenever the Scheduler Application +** exits. Exiting can be caused by an error during initialization, while +** loading a table or on command via the ES. +**/ +#define SCH_APP_EXIT_EID 2 + +/** \brief 'Error Creating SB Pipe, RC=0x%08X' +** \event 'Error Creating SB Pipe, RC=0x%08X' +** +** \par Type: ERROR +** +** \par Cause: +** +** This event message is issued when Scheduler is unable to create its +** command pipe via the #CFE_SB_CreatePipe API. +** +** The \c RC field contains the return code from the #CFE_SB_CreatePipe API. +**/ +#define SCH_CR_PIPE_ERR_EID 3 + +/** \brief 'Error Subscribing to HK Request(MID=0x%04X), RC=0x%08X' +** \event 'Error Subscribing to HK Request(MID=0x%04X), RC=0x%08X' +** +** \par Type: ERROR +** +** \par Cause: +** +** This event message is issued when Scheduler is unable to subscribe to its +** Housekeeping Request message via the #CFE_SB_Subscribe API. +** +** The \c MID value identifies the Message ID that Scheduler was attempting to +** subscribe to. The \c RC value contains the return code that was obtained from +** the #CFE_SB_Subscribe API. +**/ +#define SCH_SUB_HK_REQ_ERR_EID 4 + +/** \brief 'Error Subscribing to GND CMD(MID=0x%04X), RC=0x%08X' +** \event 'Error Subscribing to GND CMD(MID=0x%04X), RC=0x%08X' +** +** \par Type: ERROR +** +** \par Cause: +** +** This event message is issued when Scheduler is unable to subscribe to its +** Ground commands via the #CFE_SB_Subscribe API. +** +** The \c MID value identifies the Message ID that Scheduler was attempting to +** subscribe to. The \c RC value contains the return code that was obtained from +** the #CFE_SB_Subscribe API. +**/ +#define SCH_SUB_GND_CMD_ERR_EID 5 + +/** \brief 'Error Registering SDT, RC=0x%08X' +** \event 'Error Registering SDT, RC=0x%08X' +** +** \par Type: ERROR +** +** \par Cause: +** +** This event message is issued when Scheduler is unable to register its +** Schedule Definition Table with cFE Table Services via the #CFE_TBL_Register API. +** +** The \c RC value is the return code from the #CFE_TBL_Register API call. +**/ +#define SCH_SDT_REG_ERR_EID 7 + +/** \brief 'Error Registering MDT, RC=0x%08X' +** \event 'Error Registering MDT, RC=0x%08X' +** +** \par Type: ERROR +** +** \par Cause: +** +** This event message is issued when Scheduler is unable to register its +** Message Definition Table with cFE Table Services via the #CFE_TBL_Register API. +** +** The \c RC value is the return code from the #CFE_TBL_Register API call. +**/ +#define SCH_MDT_REG_ERR_EID 8 + +/** \brief 'Error (RC=0x%08X) Loading SDT with %s' +** \event 'Error (RC=0x%08X) Loading SDT with %s' +** +** \par Type: ERROR +** +** \par Cause: +** +** This event message is issued when Scheduler is unable to load its +** Schedule Definition Table with cFE Table Services via the #CFE_TBL_Load API. +** +** The \c RC value is the return code from the #CFE_TBL_Load API call +** and \c %s is the filename that was used for the load attempt. +**/ +#define SCH_SDT_LOAD_ERR_EID 9 + +/** \brief 'Error (RC=0x%08X) Loading MDT with %s' +** \event 'Error (RC=0x%08X) Loading MDT with %s' +** +** \par Type: ERROR +** +** \par Cause: +** +** This event message is issued when Scheduler is unable to load its +** Message Definition Table with cFE Table Services via the #CFE_TBL_Load API. +** +** The \c RC value is the return code from the #CFE_TBL_Load API call +** and \c %s is the filename that was used for the load attempt. +**/ +#define SCH_MDT_LOAD_ERR_EID 10 + +/** \brief 'Error Acquiring Tbl Ptrs (RC=0x%08X)' +** \event 'Error Acquiring Tbl Ptrs (RC=0x%08X)' +** +** \par Type: ERROR +** +** \par Cause: +** +** This event message is issued when Scheduler is unable to obtain pointers to +** the contents of either the Schedule Definition Table or the Message +** Definition Table with cFE Table Services via the #CFE_TBL_GetAddress API. +** +** The \c RC value is the return code from the #CFE_TBL_GetAddress API. +**/ +#define SCH_ACQ_PTR_ERR_EID 11 + +/** \brief 'Error creating Timer (RC=0x%08X)' +** \event 'Error creating Timer (RC=0x%08X)' +** +** \par Type: ERROR +** +** \par Cause: +** +** This event message is generated when an error is detected while +** creating the Timer via the #SCH_CustomEarlyInit call. +** +** The \c RC value is the return code from the #SCH_CustomEarlyInit call. +**/ +#define SCH_MINOR_FRAME_TIMER_CREATE_ERR_EID 12 + +/** \brief 'OS Timer Accuracy (%d > reqd %d usec) requires Minor Frame MET sync' +** \event 'OS Timer Accuracy (%d > reqd %d usec) requires Minor Frame MET sync' +** +** \par Type: INFORMATION +** +** \par Cause: +** +** This event message is generated when the minor frame timer obtained from OSAL +** has a specified clock accuracy that is not adequate enough for the Scheduler +** to maintain precise enough timing. The Scheduler will try to maintain conistent +** timing by implementing an additional minor frame synchronization to the MET clock. +** This means the Scheduler may end up needing to process more than one minor frame at +** a time if the minor frame timer does not stay close enough to required time. +** +** The first \c %d field specifies the clock accuracy (in microseconds) obtained for the +** minor frame timer and the second \c %d field specifies the clock accuracy (in +** microseconds) that Scheduler has determined is necessary to maintain adequate timing. +**/ +#define SCH_MINOR_FRAME_TIMER_ACC_WARN_EID 13 + +/** \brief 'Error initializing Timers (RC=0x%08X)' +** \event 'Error initializing Timers (RC=0x%08X)' +** +** \par Type: ERROR +** +** \par Cause: +** +** This event message is generated during initialization when the Scheduler Application +** is attempting to attach to the cFE TIME Services Time Synchronization Signal and start +** the minor frame timer. +** +** The \c RC field identifies the return code from the #SCH_CustomLateInit function. +**/ +#define SCH_MAJOR_FRAME_SUB_ERR_EID 14 + +/** \brief 'Error creating Main Loop Timing Semaphore (RC=0x%08X)' +** \event 'Error creating Main Loop Timing Semaphore (RC=0x%08X)' +** +** \par Type: ERROR +** +** \par Cause: +** +** This event message is generated when Scheduler is unable to create the necessary +** semaphore used to synchronize itself with the Major and Minor Frame timing sources. +** +** The \c RC value is the return code obtained from the #OS_BinSemCreate API. +**/ +#define SCH_SEM_CREATE_ERR_EID 15 + +/** \brief 'Slot did not increment: slot = %d' +** \event 'Slot did not increment: slot = %d' +** +** \par Type: DEBUG +** +** \par Cause: +** +** This event message is issued when the Scheduler has determined that it has awoken +** in the same minor frame slot as the last cycle. It will not perform any activities +** this cycle and may need to perform two sets of activities next cycle to make up for +** the lost time. +** +** The \c %d field identifies the Minor Frame (slot) since the last Major Frame Signal. +**/ +#define SCH_SAME_SLOT_EID 16 + +/** \brief 'Slots skipped: slot = %d, count = %d' +** \event 'Slots skipped: slot = %d, count = %d' +** +** \par Type: ERROR +** +** \par Cause: +** +** This event message is generated when a significant jump in minor frame timing has +** occurred and the Scheduler has determined that catching up is not feasible. +** +** The \c slot value identifies what the minor frame to be executed is. The \c count +** field identifies the number of minor frames that were skipped in order to get to +** the current minor frame. +**/ +#define SCH_SKIPPED_SLOTS_EID 17 + +/** \brief 'Multiple slots processed: slot = %d, count = %d' +** \event 'Multiple slots processed: slot = %d, count = %d' +** +** \par Type: INFORMATION +** +** \par Cause: +** +** This event message is generated when the Scheduler determines that more than one +** minor frame needs to be processed in order to keep up with the current time. +** +** The \c slot value identifies the current minor frame. The \c count field +** specifies the number of minor frames processed on this cycle. +**/ +#define SCH_MULTI_SLOTS_EID 18 + +/** \brief 'Corrupt data error (1): slot = %d, entry = %d' +** \event 'Corrupt data error (1): slot = %d, entry = %d' +** \event 'Corrupt data error (2): msg = %d, freq = %d, type = %d, rem = %d' +** +** \par Type: ERROR +** +** \par Cause: +** +** This event message is generated when an Activity is found in the Schedule Definition +** Table that has inappropriate values. The table must have become corrupt since being +** loaded since the value(s) that are incorrect were verified before the table was loaded. +** +** The \c slot value identifies the minor frame containing the error. +** The \c entry value identifies which entry for the specified minor frame is in error. +** The \c msg value specifies the index into the Message Definition Table. +** The \c freq value specifies the activity's frequency (in seconds) +** The \c type value specifies the activity's type +** The \c rem value specifies the activity's remainder (used to stagger items with the +** same frequency value. +**/ +#define SCH_CORRUPTION_EID 19 + +/** \brief 'Activity error: slot = %d, entry = %d, err = 0x%08X' +** \event 'Activity error: slot = %d, entry = %d, err = 0x%08X' +** +** \par Type: ERROR +** +** \par Cause: +** +** This event message is generated when an Send Message Activity fails to send +** the message via the #CFE_SB_SendMsg API. +** +** The \c slot field identifies the minor frame in the Schedule Definition Table +** containing the activity that failed. +** The \c entry field identifies the entry in the minor frame that failed. +** The \c err field specifies the return code from the #CFE_SB_SendMsg API. +**/ +#define SCH_PACKET_SEND_EID 20 + +/** \brief 'Major Frame Sync too noisy (Slot %d). Disabling synchronization.' +** \event 'Major Frame Sync too noisy (Slot %d). Disabling synchronization.' +** +** \par Type: ERROR +** +** \par Cause: +** +** This event message is generated when two consecutive Major Frame Signals are +** received significantly earlier than expected. +** +** The \c Slot field identifies the current slot when the Major Frame Signal arrived. It +** should have been the last slot in the schedule. +**/ +#define SCH_NOISY_MAJOR_FRAME_ERR_EID 21 + +/** \brief 'Schedule tbl verify error - idx[%d] ena[%d] typ[%d] fre[%d] rem[%d] msg[%d] grp[0x%08X]' +** \event 'Schedule tbl verify error - idx[%d] ena[%d] typ[%d] fre[%d] rem[%d] msg[%d] grp[0x%08X]' +** +** \par Type: ERROR +** +** \par Cause: +** +** This event message is generated when the operator has requested validation +** of a new Schedule Definition Table and it contains an error. +** +** The \c idx field specifies the index into the Schedule Definition Table containing the error. +** The index is a linear count with the first entry in the table being index zero. +** The \c ena field specifies the contents of the Enable/Disable field for the entry in error. +** The \c typ field specifies the contents of the Activity Type field for the entry in error. +** The \c fre field specifies the contents of the Frequency field for the entry in error. +** The \c rem field specifies the contents of the Remainder field for the entry in error. +** The \c msg field specifies the contents of the Message Index for the entry in error. +** The \c grp field specifies the contents of the Group/Multi-Group field for the entry in error. +**/ +#define SCH_SCHEDULE_TBL_ERR_EID 30 + +/** \brief 'Schedule table verify results -- good[%d] bad[%d] unused[%d]' +** \event 'Schedule table verify results -- good[%d] bad[%d] unused[%d]' +** +** \par Type: DEBUG +** +** \par Cause: +** +** This event message provides a statistics summary of the results of validating the +** contents of a new Schedule Definition Table. +** +** The \c good field specifies the number of entries that were deemed correct. +** The \c bad field specifies the number of entries that contained an error. +** The \c unused field specifies the number of entries that are empty. +**/ +#define SCH_SCHEDULE_TABLE_EID 31 + +/** \brief 'Message tbl verify err - idx[%d] mid[0x%X] len[%d] buf[%d]' +** \event 'Message tbl verify err - idx[%d] mid[0x%X] len[%d] buf[%d]' +** +** \par Type: ERROR +** +** \par Cause: +** +** This event message is generated when the operator has requested validation +** of a new Message Definition Table and it contains an error. +** +** The \c idx field specifies the index into the Message Definition Table containing the error. +** The index is a linear count with the first entry in the table being index zero. +** The \c mid field specifies the contents of the Message ID field for the entry in error. +** The \c len field specifies the contents of the Message Length field for the entry in error. +** The \c buf field specifies the index into an empty message that contains data. +**/ +#define SCH_MESSAGE_TBL_ERR_EID 32 + +/** \brief 'Message tbl verify results - good[%d] bad[%d] unused[%d]' +** \event 'Message tbl verify results - good[%d] bad[%d] unused[%d]' +** +** \par Type: DEBUG +** +** \par Cause: +** +** This event message provides a statistics summary of the results of validating the +** contents of a new Message Definition Table. +** +** The \c good field specifies the number of entries that were deemed correct. +** The \c bad field specifies the number of entries that contained an error. +** The \c unused field specifies the number of entries that are empty. +**/ +#define SCH_MESSAGE_TABLE_EID 33 + +/** \brief 'NO-op command. Version %d.%d.%d.%d' +** \event 'NO-op command. Version %d.%d.%d.%d' +** +** \par Type: INFORMATION +** +** \par Cause: +** +** This event message is always automatically issued when Scheduler receives +** the \link #SCH_NOOP_CC Scheduler NO-OP Command \endlink. +** +** The first \c %d field contains the Application's Major Version Number +** The second \c %d field contains the Application's Minor Version Number +** The third \c %d field contains the Application's Revision Number +** The fourth \c %d field contains the Application's Mission Revision Number +**/ +#define SCH_NOOP_CMD_EID 40 + +/** \brief 'RESET command' +** \event 'RESET command' +** +** \par Type: DEBUG +** +** \par Cause: +** +** This event message is always automatically issued in response +** to a Scheduler \link #SCH_RESET_CC Reset Counters command \endlink +**/ +#define SCH_RESET_CMD_EID 41 + +/** \brief 'ENABLE command: slot = %d, entry = %d' +** \event 'ENABLE command: slot = %d, entry = %d' +** +** \par Type: DEBUG +** +** \par Cause: +** +** This event message is generated when a \link #SCH_ENABLE_CC Enable Entry Command \endlink +** is received and successfully processed. +** +** The \c slot field specifies the slot index from the Enable command. +** The \c entry field specifies the entry index from the Enable command. +**/ +#define SCH_ENABLE_CMD_EID 42 + +/** \brief 'DISABLE command: slot = %d, entry = %d' +** \event 'DISABLE command: slot = %d, entry = %d' +** +** \par Type: DEBUG +** +** \par Cause: +** +** This event message is generated when a \link #SCH_DISABLE_CC Disable Entry Command \endlink +** is received and successfully processed. +** +** The \c slot field specifies the slot index from the Disable command. +** The \c entry field specifies the entry index from the Disable command. +**/ +#define SCH_DISABLE_CMD_EID 43 + +/** \brief 'ENABLE GROUP command: match count = %d' +** \event 'ENABLE GROUP command: match count = %d' +** +** \par Type: DEBUG +** +** \par Cause: +** +** This event message is generated when a \link #SCH_ENABLE_GROUP_CC Enable Group Command \endlink +** is received and successfully processed. +** +** The \c count field specifies the number of Activities in the Schedule Definition Table +** that were Enabled due to this command. +**/ +#define SCH_ENA_GRP_CMD_EID 44 + +/** \brief 'DISABLE GROUP command: match count = %d' +** \event 'DISABLE GROUP command: match count = %d' +** +** \par Type: DEBUG +** +** \par Cause: +** +** This event message is generated when a \link #SCH_DISABLE_GROUP_CC Disable Group Command \endlink +** is received and successfully processed. +** +** The \c count field specifies the number of Activities in the Schedule Definition Table +** that were Disabled due to this command. +**/ +#define SCH_DIS_GRP_CMD_EID 45 + +/** \brief 'Major Frame Synchronization Enabled' +** \event 'Major Frame Synchronization Enabled' +** +** \par Type: DEBUG +** +** \par Cause: +** +** This event message is always automatically issued when the Scheduler receives +** a \link #SCH_ENABLE_SYNC_CC Enable Sync Command \endlink. +**/ +#define SCH_ENA_SYNC_CMD_EID 46 + +/** \brief 'Transmitting Diagnostic Message' +** \event 'Transmitting Diagnostic Message' +** +** \par Type: DEBUG +** +** \par Cause: +** +** This event message is always automatically issued when the Scheduler receives +** a \link #SCH_SEND_DIAG_TLM_CC Send Diagnostic Telemetry Command \endlink. +**/ +#define SCH_SEND_DIAG_CMD_EID 47 + +/** \brief 'ENABLE cmd: invalid argument, slot=%d (<%d), entry=%d (<%d)' +** \event 'ENABLE cmd: invalid argument, slot=%d (<%d), entry=%d (<%d)' +** +** \par Type: ERROR +** +** \par Cause: +** +** This event message is generated when a \link #SCH_ENABLE_CC Enable Entry Command \endlink +** is received that contains either a slot or entry index that is out of the acceptable range. +** +** The \c slot parameters identify first-the slot in the command, second-the maximum allowed slot +** The \c entry parameters identify first-the entry index in the command, second-the maximum +** allowed entry index. +**/ +#define SCH_ENABLE_CMD_ARG_ERR_EID 50 + +/** \brief 'ENABLE command: invalid state = %d, slot = %d, entry = %d' +** \event 'ENABLE command: invalid state = %d, slot = %d, entry = %d' +** +** \par Type: ERROR +** +** \par Cause: +** +** This event message is generated when a \link #SCH_ENABLE_CC Enable Entry Command \endlink +** is received that specifies a slot that does not have an appropriate State. +** +** The \c state parameter identifies the current state of the specified table entry. The +** state should be either #SCH_ENABLED, or #SCH_DISABLED. If it is #SCH_UNUSED, the operator +** is not allowed to enable it. Any other value represents a corrupted table. +** The \c slot parameter identifies the slot specified in the Enable command. +** The \c entry parameter identifies the entry index specified in the Enable command. +**/ +#define SCH_ENABLE_CMD_ENTRY_ERR_EID 51 + +/** \brief 'DISABLE cmd: invalid argument, slot=%d (<%d), entry=%d (<%d)' +** \event 'DISABLE cmd: invalid argument, slot=%d (<%d), entry=%d (<%d)' +** +** \par Type: ERROR +** +** \par Cause: +** +** This event message is generated when a \link #SCH_DISABLE_CC Disable Entry Command \endlink +** is received that contains either a slot or entry index that is out of the acceptable range. +** +** The \c slot parameters identify first-the slot in the command, second-the maximum allowed slot +** The \c entry parameters identify first-the entry index in the command, second-the maximum +** allowed entry index. +**/ +#define SCH_DISABLE_CMD_ARG_ERR_EID 52 + +/** \brief 'DISABLE command: invalid state = %d, slot = %d, entry = %d' +** \event 'DISABLE command: invalid state = %d, slot = %d, entry = %d' +** +** \par Type: ERROR +** +** \par Cause: +** +** This event message is generated when a \link #SCH_DISABLE_CC Disable Entry Command \endlink +** is received that specifies a slot that does not have an appropriate State. +** +** The \c state parameter identifies the current state of the specified table entry. The +** state should be either #SCH_ENABLED, or #SCH_DISABLED. If it is #SCH_UNUSED, the operator +** is not allowed to disable it. Any other value represents a corrupted table. +** The \c slot parameter identifies the slot specified in the Disable command. +** The \c entry parameter identifies the entry index specified in the Disable command. +**/ +#define SCH_DISABLE_CMD_ENTRY_ERR_EID 53 + +/** \brief 'ENABLE GROUP command: invalid argument, no groups selected' +** \event 'ENABLE GROUP command: invalid argument, no groups selected' +** +** \par Type: ERROR +** +** \par Cause: +** +** This event message is generated when a \link #SCH_ENABLE_GROUP_CC Enable Group Command \endlink +** is received that does not specify either a group or a multi-group. +**/ +#define SCH_ENA_GRP_CMD_ERR_EID 54 + +/** \brief 'ENABLE GROUP command: Neither Group %d nor Multi-Group 0x%06X found' +** \event 'ENABLE GROUP command: Neither Group %d nor Multi-Group 0x%06X found' +** +** \par Type: ERROR +** +** \par Cause: +** +** This event message is generated when a \link #SCH_ENABLE_GROUP_CC Enable Group Command \endlink +** is received that specifies either a group and/or multi-group that cannot be located as being +** associated with any Activities defined in the Schedule Definition Table. +** +** The \c Group field identifies the Group ID number that was in the received Enable Group command. +** The \c Multi-Group field identifies the Multi-Group bit mask that was in the received Enable Group command. +**/ +#define SCH_ENA_GRP_NOT_FOUND_ERR_EID 55 + +/** \brief 'DISABLE GROUP command: invalid argument, no groups selected' +** \event 'DISABLE GROUP command: invalid argument, no groups selected' +** +** \par Type: ERROR +** +** \par Cause: +** +** This event message is generated when a \link #SCH_DISABLE_GROUP_CC Disable Group Command \endlink +** is received that does not specify either a group or a multi-group. +**/ +#define SCH_DIS_GRP_CMD_ERR_EID 56 + +/** \brief 'DISABLE GROUP command: Neither Group %d nor Multi-Group 0x%06X found' +** \event 'DISABLE GROUP command: Neither Group %d nor Multi-Group 0x%06X found' +** +** \par Type: ERROR +** +** \par Cause: +** +** This event message is generated when a \link #SCH_DISABLE_GROUP_CC Disable Group Command \endlink +** is received that specifies either a group and/or multi-group that cannot be located as being +** associated with any Activities defined in the Schedule Definition Table. +** +** The \c Group field identifies the Group ID number that was in the received Disable Group command. +** The \c Multi-Group field identifies the Multi-Group bit mask that was in the received Disable Group command. +**/ +#define SCH_DIS_GRP_NOT_FOUND_ERR_EID 57 + +/** \brief 'Invalid command code: ID = 0x%04X, CC = %d' +** \event 'Invalid command code: ID = 0x%04X, CC = %d' +** +** \par Type: ERROR +** +** \par Cause: +** +** This event message is generated when Scheduler obtains a message from its +** command pipe that does not have a valid command code for either the Ground +** Message ID or the Flight Message ID. +** +** The \c ID field identifies the Message ID of the message with the inappropriate +** command code. +** The \c CC field identifies the Command Code found in the message. +**/ +#define SCH_CC_ERR_EID 58 + +/** \brief 'Msg with Invalid message ID Rcvd -- ID = 0x%04X' +** \event 'Msg with Invalid message ID Rcvd -- ID = 0x%04X' +** +** \par Type: ERROR +** +** \par Cause: +** +** This event message is generated when Scheduler obtains a message from its +** command pipe with a message ID that it did not subscribe to. +** +** The \c ID field identifies the Message ID of the obtained message. +**/ +#define SCH_MD_ERR_EID 59 + +/** \brief 'Cmd Msg with Bad length Rcvd: ID = 0x%04X, CC = %d, Exp Len = %d, Len = %d' +** \event 'Cmd Msg with Bad length Rcvd: ID = 0x%04X, CC = %d, Exp Len = %d, Len = %d' +** +** \par Type: ERROR +** +** \par Cause: +** +** This event message is generated whenever the Scheduler receives a command message whose +** length does not correctly correspond to the length expected for a message with its command code. +** +** The \c ID field specifies the Message ID of the message in error. +** The \c CC field specifies the Command Code. +** The Exp Len field specifies the Expected Length for a command with this command code. +** The \c Len field specifies the actual length of the command received. +**/ +#define SCH_CMD_LEN_ERR_EID 60 + +#endif /* _sch_events_ */ + +/************************/ +/* End of File Comment */ +/************************/ diff --git a/apps/sch/fsw/src/sch_msg.h b/apps/sch/fsw/src/sch_msg.h new file mode 100644 index 0000000..d5e5141 --- /dev/null +++ b/apps/sch/fsw/src/sch_msg.h @@ -0,0 +1,249 @@ +/* +** $Id: sch_msg.h 1.3 2017/06/21 15:29:01EDT mdeschu Exp $ +** +** Copyright (c) 2007-2014 United States Government as represented by the +** Administrator of the National Aeronautics and Space Administration. +** All Other Rights Reserved. +** +** This software was created at NASA's Goddard Space Flight Center. +** This software is governed by the NASA Open Source Agreement and may be +** used, distributed and modified only pursuant to the terms of that +** agreement. +** +** Subsystem: Scheduler (SCH) packet definitions +** +** Author: +** +** Notes: +** +*/ + +/************************************************************************* +** +** Ensure that "this" header is included only once +** +**************************************************************************/ + +#ifndef _sch_msg_ +#define _sch_msg_ + +/************************************************************************* +** +** Include section +** +**************************************************************************/ + +#include "common_types.h" +#include "sch_msgdefs.h" + +/************************************************************************* +** +** SCH command packet structure definitions +** +**************************************************************************/ + +/* +** SCH_SEND_HK_MID, SCH_NOOP_CC, SCH_RESET_CC, +** SCH_ENABLE_SYNC_CC, SCH_SEND_DIAG_TLM_CC +*/ +/** +** \brief No Arguments Command +** +** For command details see #SCH_NOOP_CC, #SCH_RESET_CC, +** #SCH_ENABLE_SYNC_CC or #SCH_SEND_DIAG_TLM_CC +*/ +typedef struct +{ + CFE_MSG_CommandHeader_t CmdHeader; +} SCH_NoArgsCmd_t; + +/* +** SCH_ENABLE_CC, SCH_DISABLE_CC +*/ +/** +** \brief Entry Enable/Disable Commands +** +** For command details see #SCH_ENABLE_CC, #SCH_DISABLE_CC +*/ +typedef struct +{ + CFE_MSG_CommandHeader_t CmdHeader; + + uint16 SlotNumber; /**< \brief Slot Number of Activity whose state is to change */ + /**< \details Valid Range is zero to (#SCH_TOTAL_SLOTS - 1) */ + uint16 EntryNumber; /**< \brief Entry Number of Activity whose state is to change + \details Valid Range is zero to (#SCH_ENTRIES_PER_SLOT - 1) */ +} SCH_EntryCmd_t; + +/* +** SCH_ENABLE_GROUP_CC, SCH_DISABLE_GROUP_CC +*/ +/** +** \brief Entry Enable/Disable Commands +** +** For command details see #SCH_ENABLE_GROUP_CC, #SCH_DISABLE_GROUP_CC +*/ +typedef struct +{ + CFE_MSG_CommandHeader_t CmdHeader; + + uint32 GroupData; /**< \brief Group and Multi-Group Identifiers + \details Most Significant Byte contains a Group ID of 1 to 255, + remaining 24 bits identify 24 Multi-Group Identifiers */ +} SCH_GroupCmd_t; + + +/************************************************************************* +** +** SCH housekeeping telemetry packet definition +** +**************************************************************************/ + +/** +** \schtlm Scheduler HK Telemetry format +**/ + +typedef struct +{ + CFE_MSG_TelemetryHeader_t TlmHeader; + + /* + ** Command execution counters (ground commands) + */ + uint8 CmdCounter; /**< \schtlmmnemonic \SCH_CMDPC + \brief Command Counter + \details \ref SCHHK_CmdCounter "Click for more" */ + uint8 ErrCounter; /**< \schtlmmnemonic \SCH_CMDEC + \brief Command Error Counter + \details \ref SCHHK_ErrCounter "Click for more" */ + uint8 SyncToMET; /**< \schtlmmnemonic \SCH_SYNCTOMET + \brief Status indicating whether slots are synched to MET + \details \ref SCHHK_SyncToMET "Click for more" */ + uint8 MajorFrameSource; /**< \schtlmmnemonic \SCH_MAJORFRAMESOURCE + \brief Major Frame Signal source identifier + \details \ref SCHHK_MajorFrameSource "Click for more" */ + + /* + ** Messages sent by schedule table processor + */ + uint32 ScheduleActivitySuccessCount; /**< \schtlmmnemonic \SCH_ACTSUCCESSCTR + \brief Number of successfully performed activities + \details \ref SCHHK_ScheduleActivitySuccessCount "Click for more" */ + uint32 ScheduleActivityFailureCount; /**< \schtlmmnemonic \SCH_ACTFAILURECTR + \brief Number of unsuccessful activities attempted + \details \ref SCHHK_ScheduleActivityFailureCount "Click for more" */ + + /* + ** Total schedule table slots processed + */ + uint32 SlotsProcessedCount; /**< \schtlmmnemonic \SCH_SLOTPROCCTR + \brief Total # of Schedule Slots (Minor Frames) Processed + \details \ref SCHHK_SlotsProcessedCount "Click for more" */ + + /* + ** The number of times that slots were skipped + ** (not the number of slots that were skipped) + */ + uint16 SkippedSlotsCount; /**< \schtlmmnemonic \SCH_SKIPSLOTCTR + \brief Number of times that slots were skipped + \details The number of times that a slot (minor frame) was skipped. + \ref SCHHK_SkippedSlotsCount "Click for more" + \b Note: This is NOT the number of slots that were skipped */ + + /* + ** The number of times that multiple slots were processed + ** (not the number of slots that were processed) + */ + uint16 MultipleSlotsCount; /**< \schtlmmnemonic \SCH_MULTSLOTCTR + \brief Number of times that multiple slots processed + \details The number of times that multiple slots (minor frames) + were processed in the same minor frame. + \ref SCHHK_MultipleSlotsCount "Click for more" + \b Note: This is NOT the number of slots that were processed */ + + /* + ** The number of times that SH woke up in the same slot as last time + */ + uint16 SameSlotCount; /**< \schtlmmnemonic \SCH_SAMESLOTCTR + \brief # of times SCH woke up in the same slot as last time + \details \ref SCHHK_SameSlotCount "Click for more" */ + + /* + ** The number of times that a table entry with bad data was processed + ** (the entry previously passed validation but then somehow went bad) + */ + uint16 BadTableDataCount; /**< \schtlmmnemonic \SCH_BADTBLDATACTR + \brief # of times corrupted table entries were processed + \details \ref SCHHK_BadTableDataCount "Click for more" */ + + /* + ** The number of tables verified prior to table load + */ + uint16 TableVerifySuccessCount; /**< \schtlmmnemonic \SCH_TBLPASSVERIFYCTR + \brief # of times table loads successfully verified + \details \ref SCHHK_TableVerifySuccessCount "Click for more" */ + uint16 TableVerifyFailureCount; /**< \schtlmmnemonic \SCH_TBLFAILVERIFYCTR + \brief # of times table loads unsuccessfully verified + \details \ref SCHHK_TableVerifyFailureCount "Click for more" */ + uint32 TablePassCount; /**< \schtlmmnemonic \SCH_TBLPROCCTR + \brief # of times Schedule Table has been processed + \details \ref SCHHK_TablePassCount "Click for more" */ + uint32 ValidMajorFrameCount; /**< \schtlmmnemonic \SCH_VALIDMFCTR + \brief # of valid Major Frame tones received + \details \ref SCHHK_ValidMajorFrameCount "Click for more" */ + uint32 MissedMajorFrameCount; /**< \schtlmmnemonic \SCH_MISSMFCTR + \brief # of missing Major Frame tones + \details \ref SCHHK_MissedMajorFrameCount "Click for more" */ + uint32 UnexpectedMajorFrameCount; /**< \schtlmmnemonic \SCH_UNEXPCTDMFCTR + \brief # of unexpected Major Frame tones + \details \ref SCHHK_UnexpectedMajorFrameCount "Click for more" */ + uint16 MinorFramesSinceTone; /**< \schtlmmnemonic \SCH_MINORSINCETONE + \brief # of Minor Frames since last Major Frame tone + \details \ref SCHHK_MinorFramesSinceTone "Click for more" */ + uint16 NextSlotNumber; /**< \schtlmmnemonic \SCH_NEXTSLOT + \brief Next Minor Frame to be processed + \details \ref SCHHK_NextSlotNumber "Click for more" */ + uint16 LastSyncMETSlot; /**< \schtlmmnemonic \SCH_LASTSYNCMETSLOT + \brief Slot number where Time Sync last occurred + \details \ref SCHHK_LastSyncMETSlot "Click for more" */ + bool IgnoreMajorFrame; /**< \schtlmmnemonic \SCH_IGNOREMF + \brief Major Frame too noisy to trust + \details \ref SCHHK_IgnoreMajorFrame "Click for more" */ + bool UnexpectedMajorFrame; /**< \schtlmmnemonic \SCH_UNEXPCTDMAJORFRAME + \brief Most Recent Major Frame signal was unexpected + \details \ref SCHHK_UnexpectedMajorFrame "Click for more" */ +} SCH_HkPacket_t; + + +/************************************************************************* +** +** SCH diagnostic telemetry packet definition +** +**************************************************************************/ + +/** +** \schtlm Scheduler Diagnostic Telemetry format +**/ + +typedef struct +{ + CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief cFE Software Bus Telemetry Message Header */ + + uint16 EntryStates[SCH_NUM_STATUS_BYTES_REQD/2]; + /**< \schtlmmnemonic \SCH_ENTRYSTATES + \brief States of each Schedule Entry + \details Each two bits represents the state for + a single entry in Schedule Definition Table. + Unused=0, Enabled=1, Disabled=2 + MSBs are the lowest numbered entry */ + CFE_SB_MsgId_t MsgIDs[SCH_TABLE_ENTRIES]; + /**< \schtlmmnemonic \SCH_MSGIDS + \brief Message ID of msg associated with each entry */ +} SCH_DiagPacket_t; + +#endif /* _sch_msg_ */ + +/************************/ +/* End of File Comment */ +/************************/ + diff --git a/apps/sch/fsw/src/sch_msgdefs.h b/apps/sch/fsw/src/sch_msgdefs.h new file mode 100644 index 0000000..e932b5c --- /dev/null +++ b/apps/sch/fsw/src/sch_msgdefs.h @@ -0,0 +1,414 @@ +/* +** $Id: sch_msgdefs.h 1.3 2017/06/21 15:28:58EDT mdeschu Exp $ +** +** Copyright (c) 2007-2014 United States Government as represented by the +** Administrator of the National Aeronautics and Space Administration. +** All Other Rights Reserved. +** +** This software was created at NASA's Goddard Space Flight Center. +** This software is governed by the NASA Open Source Agreement and may be +** used, distributed and modified only pursuant to the terms of that +** agreement. +** +** Subsystem: Scheduler (SCH) packet macro definitions +** +** Author: David Kobe +** +** Notes: +** These Macro definitions have been put in this file (instead of +** sch_msg.h) so this file can be included directly into ASIST build +** test scripts. ASIST RDL files can accept C language #defines but +** can't handle type definitions. As a result: DO NOT PUT ANY +** TYPEDEFS OR STRUCTURE DEFINITIONS IN THIS FILE! +** ADD THEM TO sch_msg.h IF NEEDED! +** +** +*/ + +#ifndef _sch_msgdefs_ +#define _sch_msgdefs_ + +/************************************************************************* +** +** Include section +** +**************************************************************************/ + +#include "sch_platform_cfg.h" + + +/************************************************************************* +** +** SCH application definitions +** +**************************************************************************/ + +/* +** Table value definitions +*/ +/** \name Scheduler App Entry States */ +/** \{ */ +#define SCH_UNUSED 0 +#define SCH_ENABLED 1 +#define SCH_DISABLED 2 +/** \} */ + +/* +** Table Entry Activity Types +*/ +/** \name Scheduler App Entry Types */ +/** \{ */ +#define SCH_ACTIVITY_NONE 0 +#define SCH_ACTIVITY_SEND_MSG 1 +/** \} */ + +/* +** Synchronized to Mission Elapsed Time States +*/ +/** \name Synchronized to MET States */ +/** \{ */ +#define SCH_NOT_SYNCHRONIZED 0 +#define SCH_MINOR_SYNCHRONIZED 1 +#define SCH_PENDING_MAJOR_SYNCH 2 +#define SCH_MAJOR_SYNCHRONIZED 4 +/** \} */ + +/* +** Major Frame Signal Source Identifiers +*/ +/** \name Major Frame Signal Source Identifiers */ +/** \{ */ +#define SCH_MAJOR_FS_NONE 0 +#define SCH_MAJOR_FS_CFE_TIME 1 +#define SCH_MAJOR_FS_MINOR_FRAME_TIMER 2 +/** \} */ + +/* +** Schedule table group data field masks +*/ +/** \name Scheduler App Entry Group Bit Masks */ +/** \{ */ +#define SCH_GROUP_NUMBER_BIT_MASK 0xFF000000 +#define SCH_MULTI_GROUP_BIT_MASK 0x00FFFFFF +/** \} */ + +/* +** Message table definitions +*/ +/** \name Scheduler App Miscellaneous Limits */ +/** \{ */ +#define SCH_MIN_MSG_WORDS (sizeof(CFE_MSG_CommandHeader_t) / 2) +#define SCH_TABLE_ENTRIES (SCH_TOTAL_SLOTS * SCH_ENTRIES_PER_SLOT) +/** \} */ + +#define SCH_NUM_STATUS_BYTES_REQD (((SCH_TABLE_ENTRIES+7)/8)*2) + /**< \brief Num Bytes req'd to store entry states in diag pkt + (2-bits per entry rounded up to nearest 16-bit word) */ + +/* +** SCH command packet command codes +** (SCH_GND_CMD_MID and SCH_SC_CMD_MID) +*/ +/** \name CFS Scheduler Command Codes */ +/** \{ */ + +/** \schcmd Scheduler No-Op +** +** \par Description +** This command performs no other function than to increment the +** command execution counter. The command may be used to verify +** general aliveness of the Scheduler Application. +** +** \schcmdmnemonic \SCH_NOOP +** +** \par Command Structure +** #SCH_NoArgsCmd_t +** +** \par Command Verification +** Successful execution of this command may be verified with the +** following telemetry: +** - \b \c \SCH_CMDPC - command execution +** counter will increment +** - The #SCH_NOOP_CMD_EID informational event message will +** be generated +** +** \par Error Conditions +** There are no error conditions for this command. If the Scheduler +** receives the command, the event is sent (although it +** may be filtered by EVS) and the counter is incremented +** unconditionally. +** +** \par Criticality +** None +** +** \sa +*/ +#define SCH_NOOP_CC 0 /* no-op command */ + +/** \schcmd Scheduler Reset Counters +** +** \par Description +** This command resets the following counters within the +** Scheduler housekeeping telemetry: +** - Command Execution Counter (\SCH_CMDPC) +** - Command Error Counter (\SCH_CMDEC) +** - Schedule Activities Success Counter (\SCH_ACTSUCCESSCTR) +** - Schedule Activities Failure Counter (\SCH_ACTFAILURECTR) +** - Schedule Slots Processed Counter (\SCH_SLOTPROCCTR) +** - Schedule Skipping Slots Counter (\SCH_SKIPSLOTCTR) +** - Multiple Schedule Slots Processed Counter (\SCH_MULTSLOTCTR) +** - Awoke in Same Slot Counter (\SCH_SAMESLOTCTR) +** - Corrupted Table Data Counter (\SCH_BADTBLDATACTR) +** - Table Loads Successfully Verified Counter (\SCH_TBLPASSVERIFYCTR) +** - Table Loads Unsuccessfully Verified Counter (\SCH_TBLFAILVERIFYCTR) +** - Valid Major Frames Received Counter (\SCH_VALIDMFCTR) +** - Missed Major Frames Received Counter (\SCH_MISSMFCTR) +** - Unexpected Major Frames Received Counter (\SCH_UNEXPCTDMFCTR) +** +** \schcmdmnemonic \SCH_RESETCTRS +** +** \par Command Structure +** #SCH_NoArgsCmd_t +** +** \par Command Verification +** Successful execution of this command may be verified with the +** following telemetry: +** - \b \c \SCH_CMDPC - command execution +** counter will increment +** - The #SCH_RESET_CMD_EID debug event message will +** be generated +** +** \par Error Conditions +** There are no error conditions for this command. If the Scheduler +** receives the command, the event is sent (although it +** may be filtered by EVS) and the counter is incremented +** unconditionally. +** +** \par Criticality +** This command is not inherently dangerous. However, it is +** possible for ground systems and on-board safing procedures +** to be designed such that they react to changes in the counter +** values that are reset by this command. +** +** \sa +*/ +#define SCH_RESET_CC 1 /* Reset HK counters */ + +/** \schcmd Enable Schedule Table Entry +** +** \par Description +** This command enables a single activity in the Schedule Definition Table. +** +** \schcmdmnemonic \SCH_ENABLEENTRY +** +** \par Command Structure +** #SCH_EntryCmd_t +** +** \par Command Verification +** Successful execution of this command may be verified with the +** following telemetry: +** - \b \c \SCH_CMDPC - command execution +** counter will increment +** - The #SCH_ENABLE_CMD_EID debug event message will +** be generated +** +** \par Error Conditions +** This command can fail for the following reasons: +** - Invalid Slot (Minor Frame) specified in the command +** - Invalid Entry ID specified in the command +** - Current state is neither Enabled or Disabled (i.e. - it is corrupted or empty) +** +** Evidence of failure may be found in the following telemetry: +** - \b \c \SCH_CMDEC - command error counter will increment +** - Command specific error event messages are issued for all error cases +** +** \par Criticality +** Criticality is dependent entirely on the contents +** of the Schedule Definition Table entry being enabled +** +** \sa #SCH_DISABLE_CC, #SCH_ENABLE_GROUP_CC, #SCH_DISABLE_GROUP_CC +*/ +#define SCH_ENABLE_CC 2 /* Enable Schedule Table Entry */ + +/** \schcmd Disable Schedule Entry +** +** \par Description +** This command disables a single activity in the Schedule Definition Table. +** +** \schcmdmnemonic \SCH_DISABLEENTRY +** +** \par Command Structure +** #SCH_EntryCmd_t +** +** \par Command Verification +** Successful execution of this command may be verified with the +** following telemetry: +** - \b \c \SCH_CMDPC - command execution +** counter will increment +** - The #SCH_DISABLE_CMD_EID debug event message will +** be generated +** +** \par Error Conditions +** This command can fail for the following reasons: +** - Invalid Slot (Minor Frame) specified in the command +** - Invalid Entry ID specified in the command +** - Current state is neither Enabled or Disabled (i.e. - it is corrupted or empty) +** +** Evidence of failure may be found in the following telemetry: +** - \b \c \SCH_CMDEC - command error counter will increment +** - Command specific error event messages are issued for all error cases +** +** \par Criticality +** Criticality is dependent entirely on the contents +** of the Schedule Definition Table entry being disabled +** +** \sa #SCH_ENABLE_CC, #SCH_ENABLE_GROUP_CC, #SCH_DISABLE_GROUP_CC +*/ +#define SCH_DISABLE_CC 3 /* disable schedule table entry */ + +/** \schcmd Enable Group and/or Multi-Groups of Schedule Activities +** +** \par Description +** This command enables a single group and/or a collection of +** Multi-Group Activities in the Schedule Definition Table. +** +** \schcmdmnemonic \SCH_ENABLEGROUP +** +** \par Command Structure +** #SCH_GroupCmd_t +** +** \par Command Verification +** Successful execution of this command may be verified with the +** following telemetry: +** - \b \c \SCH_CMDPC - command execution +** counter will increment +** - The #SCH_ENA_GRP_CMD_EID debug event message will +** be generated +** +** \par Error Conditions +** This command can fail for the following reasons: +** - No Group nor any Multi-Group was specified in the command +** - No activities with the specified Group and Multi-Group was located +** +** Evidence of failure may be found in the following telemetry: +** - \b \c \SCH_CMDEC - command error counter will increment +** - Command specific error event messages are issued for all error cases +** +** \par Criticality +** Criticality is dependent entirely on the contents +** of the Schedule Definition Table entries being enabled +** +** \sa #SCH_ENABLE_CC, SCH_DISABLE_CC, #SCH_DISABLE_GROUP_CC +*/ +#define SCH_ENABLE_GROUP_CC 4 /* enable group of entries */ + +/** \schcmd Disable Group and/or Multi-Groups of Schedule Activities +** +** \par Description +** This command disables a single group and/or a collection of +** Multi-Group Activities in the Schedule Definition Table. +** +** \schcmdmnemonic \SCH_DISABLEGROUP +** +** \par Command Structure +** #SCH_GroupCmd_t +** +** \par Command Verification +** Successful execution of this command may be verified with the +** following telemetry: +** - \b \c \SCH_CMDPC - command execution +** counter will increment +** - The #SCH_DIS_GRP_CMD_EID debug event message will +** be generated +** +** \par Error Conditions +** This command can fail for the following reasons: +** - No Group nor any Multi-Group was specified in the command +** - No activities with the specified Group and Multi-Group was located +** +** Evidence of failure may be found in the following telemetry: +** - \b \c \SCH_CMDEC - command error counter will increment +** - Command specific error event messages are issued for all error cases +** +** \par Criticality +** Criticality is dependent entirely on the contents +** of the Schedule Definition Table entries being disabled +** +** \sa #SCH_ENABLE_CC, SCH_DISABLE_CC, #SCH_ENABLE_GROUP_CC +*/ +#define SCH_DISABLE_GROUP_CC 5 /* disable group of entries */ + +/** \schcmd Enable Major Frame Synchronization +** +** \par Description +** This command allows the operator to enable processing and +** synchronization of the Major Frame Signal to the processing +** of the Schedule Definition Table. +** +** \schcmdmnemonic \SCH_ENABLESYNC +** +** \par Command Structure +** #SCH_NoArgsCmd_t +** +** \par Command Verification +** Successful execution of this command may be verified with the +** following telemetry: +** - \b \c \SCH_CMDPC - command execution +** counter will increment +** - The #SCH_ENA_SYNC_CMD_EID debug event message will +** be generated +** +** \par Error Conditions +** There are no error conditions for this command. If the Scheduler +** receives the command, the event is sent (although it +** may be filtered by EVS) and the counter is incremented +** unconditionally. +** +** \par Criticality +** May cause a number of minor frames to be skipped when the major frame +** synchronization signal is received and acted upon. +** +** \sa +*/ +#define SCH_ENABLE_SYNC_CC 6 /* enable major frame synchronization */ + +/** \schcmd Telemeter Scheduler Diagnostic Packet +** +** \par Description +** This command generates and sends the Scheduler Application's +** Diagnostic Telemetry packet. +** +** \schcmdmnemonic \SCH_SENDDIAG +** +** \par Command Structure +** #SCH_NoArgsCmd_t +** +** \par Command Verification +** Successful execution of this command may be verified with the +** following telemetry: +** - \b \c \SCH_CMDPC - command execution +** counter will increment +** - The #SCH_SEND_DIAG_CMD_EID debug event message will +** be generated +** +** \par Error Conditions +** There are no error conditions for this command. If the Scheduler +** receives the command, the event is sent (although it +** may be filtered by EVS) and the counter is incremented +** unconditionally. +** +** \par Criticality +** None +** +** \sa +*/ +#define SCH_SEND_DIAG_TLM_CC 7 /* sends diagnostic message packet */ +/** \} */ + + +#endif /* _sch_msgdefs_ */ + +/************************/ +/* End of File Comment */ +/************************/ + diff --git a/apps/sch/fsw/src/sch_tbldefs.h b/apps/sch/fsw/src/sch_tbldefs.h new file mode 100644 index 0000000..9c16393 --- /dev/null +++ b/apps/sch/fsw/src/sch_tbldefs.h @@ -0,0 +1,61 @@ +/* +** $Id: sch_tbldefs.h 1.3 2017/06/21 15:29:42EDT mdeschu Exp $ +** +** Copyright (c) 2007-2014 United States Government as represented by the +** Administrator of the National Aeronautics and Space Administration. +** All Other Rights Reserved. +** +** This software was created at NASA's Goddard Space Flight Center. +** This software is governed by the NASA Open Source Agreement and may be +** used, distributed and modified only pursuant to the terms of that +** agreement. +** +** Subsystem: Scheduler (SCH) table definitions +** +** Author: +** +** Notes: +** +*/ + +/************************************************************************* +** +** Ensure that "this" header is included only once +** +**************************************************************************/ + +#ifndef _sch_tbldefs_ +#define _sch_tbldefs_ + +/************************************************************************* +** +** SCH table structure definitions +** +**************************************************************************/ + +/* +** Schedule definition table entry +*/ +typedef struct +{ + uint8 EnableState; /**< \brief State may be #SCH_UNUSED, #SCH_ENABLED, #SCH_DISABLED */ + uint8 Type; /**< \brief Activity Type may be #SCH_ACTIVITY_NONE or #SCH_ACTIVITY_SEND_MSG */ + uint16 Frequency; /**< \brief Number of seconds between Activity execution */ + uint16 Remainder; /**< \brief Seconds offset to perform Activity */ + uint16 MessageIndex; /**< \brief Byte index into Message Definition Table */ + + uint32 GroupData; /**< \brief Group and Multi-Group membership definitions */ + +} SCH_ScheduleEntry_t; + +/* +** Message definition table entry +*/ +typedef struct +{ + uint16 MessageBuffer[SCH_MAX_MSG_WORDS]; /**< \brief Packed Messages */ + +} SCH_MessageEntry_t; + + +#endif /* _sch_tbldefs_ */ diff --git a/apps/sch/fsw/src/sch_verify.h b/apps/sch/fsw/src/sch_verify.h new file mode 100644 index 0000000..d449339 --- /dev/null +++ b/apps/sch/fsw/src/sch_verify.h @@ -0,0 +1,131 @@ +/* +** $Id: sch_verify.h 1.3 2017/06/21 15:29:22EDT mdeschu Exp $ +** +** Copyright (c) 2007-2014 United States Government as represented by the +** Administrator of the National Aeronautics and Space Administration. +** All Other Rights Reserved. +** +** This software was created at NASA's Goddard Space Flight Center. +** This software is governed by the NASA Open Source Agreement and may be +** used, distributed and modified only pursuant to the terms of that +** agreement. +** +** Purpose: CFS Scheduler (SCH) configuration verification +** +** Notes: +** +*/ + +#ifndef _sch_verify_ +#define _sch_verify_ + +/*************************************************************************/ + +#if SCH_PIPE_DEPTH < 1 + #error SCH_PIPE_DEPTH must be greater than zero. +#endif + +#if SCH_ENTRIES_PER_SLOT < 1 + #error SCH_ENTRIES_PER_SLOT must be greater than zero. Schedule Definition Table must have at least one entry per slot. +#endif + +#if SCH_MAX_MESSAGES < 1 + #error SCH_MAX_MESSAGES must be greater than zero. Message Definition Table must have at least one message definition. +#endif + +#if SCH_MAX_MESSAGES < 1 + #error SCH_MAX_MESSAGES must be greater than zero. Message Definition Table must have at least one message definition. +#endif + +#if SCH_MDT_MIN_MSG_ID < 0 + #error SCH_MDT_MIN_MSG_ID must be at least 0. +#endif + +#if SCH_MDT_MAX_MSG_ID < SCH_MDT_MIN_MSG_ID + #error SCH_MDT_MAX_MSG_ID must be at least SCH_MDT_MIN_MSG_ID. +#endif + +#if SCH_MDT_MAX_MSG_ID > CFE_PLATFORM_SB_HIGHEST_VALID_MSGID + #error SCH_MDT_MAX_MSG_ID must be less than or equal to CFE_PLATFORM_SB_HIGHEST_VALID_MSGID. +#endif + +#if SCH_MAX_LAG_COUNT < 1 + #error SCH_MAX_LAG_COUNT must be at least 1. +#endif + +#if SCH_MAX_LAG_COUNT > SCH_TOTAL_SLOTS + #error SCH_MAX_LAG_COUNT cannot be greater than SCH_TOTAL_SLOTS. +#endif + + +#if SCH_MAX_SLOTS_PER_WAKEUP < 1 + #error SCH_MAX_SLOTS_PER_WAKEUP must be at least 1. +#endif + +#if SCH_MICROS_PER_MAJOR_FRAME < SCH_TOTAL_SLOTS + #error SCH_MICROS_PER_MAJOR_FRAME must be greater than SCH_TOTAL_SLOTS (i.e. - a normal slot period must be at least 1 microsecond) +#endif + +#if SCH_STARTUP_SYNC_TIMEOUT < 0 + #error SCH_STARTUP_SYNC_TIMEOUT must be greater than or equal to zero. +#endif + +#if SCH_STARTUP_PERIOD < SCH_MICROS_PER_MAJOR_FRAME + #error SCH_STARTUP_PERIOD must be greater than or equal to SCH_MICROS_PER_MAJOR_FRAME. +#endif + +/* +** Make sure Diagnostic Packet does not exceed mission packet size +** NOTE: The "2" below is for the current size of a CFE_SB_MsgId_t in bytes. "sizeof" cannot be used in #if statements. +** and the "14" is the size of a CCSDS Telemetry Header +*/ +#ifdef MESSAGE_FORMAT_IS_CCSDS +#if (SCH_NUM_STATUS_BYTES_REQD + 2*SCH_TABLE_ENTRIES + 12 ) > CFE_SB_MAX_SB_MSG_SIZE + #error SCH Diagnostic Packet exceeds maximum allowed message size (see CFE_SB_MAX_SB_MSG_SIZE) +#endif +#endif + +/* +** Validate Number of Minor Frames per Major Frame +*/ +#if SCH_TOTAL_SLOTS > 65535 + #error SCH_TOTAL_SLOTS cannot specify more than 65535 minor frames per major frame +#endif + +#if SCH_TOTAL_SLOTS < 2 + #error SCH_TOTAL_SLOTS must specify at least 2 minor frames per major frame +#endif + +/* +** Ensure Allowed Drift is not larger than a single slot +*/ +#if SCH_SYNC_SLOT_DRIFT_WINDOW >= (SCH_MICROS_PER_MAJOR_FRAME/SCH_TOTAL_SLOTS) + #error SCH_SYNC_SLOT_DRIFT_WINDOW must be less than one normal slot period +#endif + +#if SCH_SYNC_SLOT_DRIFT_WINDOW < 0 + #error SCH_SYNC_SLOT_DRIFT_WINDOW must be greater than or equal to zero +#endif + +/* +** Noisy Major Frame +*/ + +#if SCH_MAX_NOISY_MAJORF < 2 + #error SCH_MAX_NOISY_MAJORF must specify at least 2 noisy frames before disregarding +#endif + +#ifndef SCH_MISSION_REV + #error SCH_MISSION_REV must be defined! +#elif (SCH_MISSION_REV < 0) + #error SCH_MISSION_REV must be greater than or equal to zero! +#endif + + +/*************************************************************************/ + +#endif /* _sch_verify_ */ + +/************************/ +/* End of File Comment */ +/************************/ diff --git a/apps/sch/fsw/src/sch_version.h b/apps/sch/fsw/src/sch_version.h new file mode 100644 index 0000000..0394c07 --- /dev/null +++ b/apps/sch/fsw/src/sch_version.h @@ -0,0 +1,33 @@ +/* +** $Id: sch_version.h 1.3.1.3 2017/07/05 15:37:38EDT sstrege Exp $ +** +** Copyright (c) 2007-2014 United States Government as represented by the +** Administrator of the National Aeronautics and Space Administration. +** All Other Rights Reserved. +** +** This software was created at NASA's Goddard Space Flight Center. +** This software is governed by the NASA Open Source Agreement and may be +** used, distributed and modified only pursuant to the terms of that +** agreement. +** +** Subsystem: Scheduler (SCH) version definitions +** +** Author: +** +** Notes: +*/ + +/************************************************************************* +** +** Ensure that "this" header is included only once +** +**************************************************************************/ + +#ifndef _sch_version_ +#define _sch_version_ + +#define SCH_MAJOR_VERSION 2 +#define SCH_MINOR_VERSION 2 +#define SCH_REVISION 1 + +#endif /* _sch_version_ */ diff --git a/apps/sch/fsw/tables/sch_def_msgtbl.c b/apps/sch/fsw/tables/sch_def_msgtbl.c new file mode 100644 index 0000000..6781c23 --- /dev/null +++ b/apps/sch/fsw/tables/sch_def_msgtbl.c @@ -0,0 +1,434 @@ +/* +** $Id: sch_def_msgtbl.c 1.3 2017/06/21 15:28:56EDT mdeschu Exp $ +** +** Copyright (c) 2007-2014 United States Government as represented by the +** Administrator of the National Aeronautics and Space Administration. +** All Other Rights Reserved. +** +** This software was created at NASA's Goddard Space Flight Center. +** This software is governed by the NASA Open Source Agreement and may be +** used, distributed and modified only pursuant to the terms of that +** agreement. +** +** Purpose: Scheduler (SCH) default message definition table data +** +** Author: +** +** Notes: +** +*/ + +/************************************************************************* +** +** Include section +** +**************************************************************************/ + +#include "cfe.h" +#include "cfe_endian.h" +#include "cfe_tbl_filedef.h" +#include "sch_platform_cfg.h" +#include "sch_tbldefs.h" + +#include "cfe_msgids.h" +/* #include "ci_lab_msgids.h" */ +/* #include "to_lab_msgids.h" */ +/* #include "cs_msgids.h" */ +/* #include "ds_msgids.h" */ +/* #include "fm_msgids.h" */ +/* #include "hk_msgids.h" */ +/* #include "hs_msgids.h" */ +/* #include "lc_msgids.h" */ +/* #include "md_msgids.h" */ +/* #include "mm_msgids.h" */ +/* #include "sc_msgids.h" */ +#include "sch_msgids.h" + +/* +** F Prime application scheduler tick message. +** +** A cFS command message (stream ID 0x1890: command type + secondary header +** flag + APID 0x090) with function code 0. The fprime_app CfsBridge +** subscribes to this message ID and the CfsRouter routes APID 0x090 to the +** FPrimeCfs.SchAppDriver, which drives the F Prime rate groups. +*/ +#define FPRIME_APP_SCH_TICK_MID 0x1890 + + +/************************************************************************* +** +** Macro definitions +** +**************************************************************************/ + +/* +** (none) +*/ + +/************************************************************************* +** +** Type definitions +** +**************************************************************************/ + +/* +** (none) +*/ + +/************************************************************************* +** +** Exported data +** +**************************************************************************/ + +/* +** Message Table entry map... +** +** Entry 0 -- reserved (DO NOT USE) +** +** Several Entries in this default table provide example messages for a default +** system. These messages can be uncommented, and the CFE_MAKE_BIG16(SCH_UNUSED_MID) entry just +** below them can be deleted to enable them. +*/ + +/* +** Default command definition table data +*/ +SCH_MessageEntry_t SCH_DefaultMessageTable[SCH_MAX_MESSAGES] = +{ + /* + ** DO NOT USE -- entry #0 reserved for "unused" command ID - DO NOT USE + */ + /* command ID #0 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + + /* + ** cFE housekeeping request messages + */ + /* command ID #1 - Executive Services HK Request */ + { { CFE_MAKE_BIG16(CFE_ES_SEND_HK_MID), CFE_MAKE_BIG16(0xC000), CFE_MAKE_BIG16(0x0001), 0x0000 } }, + /* command ID #2 - Event Services HK Request */ + { { CFE_MAKE_BIG16(CFE_EVS_SEND_HK_MID), CFE_MAKE_BIG16(0xC000), CFE_MAKE_BIG16(0x0001), 0x0000 } }, + /* command ID #3 - Software Bus HK Request */ + { { CFE_MAKE_BIG16(CFE_SB_SEND_HK_MID), CFE_MAKE_BIG16(0xC000), CFE_MAKE_BIG16(0x0001), 0x0000 } }, + /* command ID #4 - Time Services HK Request */ + { { CFE_MAKE_BIG16(CFE_TIME_SEND_HK_MID), CFE_MAKE_BIG16(0xC000), CFE_MAKE_BIG16(0x0001), 0x0000 } }, + /* command ID #5 - Table Services HK Request */ + { { CFE_MAKE_BIG16(CFE_TBL_SEND_HK_MID), CFE_MAKE_BIG16(0xC000), CFE_MAKE_BIG16(0x0001), 0x0000 } }, + + /* + ** CFS housekeeping request messages + */ + /* command ID #6 - Checksum HK Request */ +/*{ { CFE_MAKE_BIG16(CS_SEND_HK_MID), CFE_MAKE_BIG16(0xC000), CFE_MAKE_BIG16(0x0001), 0x0000 } }, */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #7 - Data Store HK Request */ +/*{ { CFE_MAKE_BIG16(DS_SEND_HK_MID), CFE_MAKE_BIG16(0xC000), CFE_MAKE_BIG16(0x0001), 0x0000 } }, */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #8 - File Manager HK Request */ +/*{ { CFE_MAKE_BIG16(FM_SEND_HK_MID), CFE_MAKE_BIG16(0xC000), CFE_MAKE_BIG16(0x0001), 0x0000 } }, */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #9 - Housekeeping HK Request */ +/*{ { CFE_MAKE_BIG16(HK_SEND_HK_MID), CFE_MAKE_BIG16(0xC000), CFE_MAKE_BIG16(0x0001), 0x0000 } }, */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + + /* command ID #10 - Health & Safety HK Request */ +/*{ { CFE_MAKE_BIG16(HS_SEND_HK_MID), CFE_MAKE_BIG16(0xC000), CFE_MAKE_BIG16(0x0001), 0x0000 } }, */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #11 - Limit Checker HK Request */ +/*{ { CFE_MAKE_BIG16(LC_SEND_HK_MID), CFE_MAKE_BIG16(0xC000), CFE_MAKE_BIG16(0x0001), 0x0000 } }, */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #12 - Memory Dwell HK Request */ +/*{ { CFE_MAKE_BIG16(MD_SEND_HK_MID), CFE_MAKE_BIG16(0xC000), CFE_MAKE_BIG16(0x0001), 0x0000 } }, */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #13 - Memory Manager HK Request */ +/*{ { CFE_MAKE_BIG16(MM_SEND_HK_MID), CFE_MAKE_BIG16(0xC000), CFE_MAKE_BIG16(0x0001), 0x0000 } }, */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #14 - Stored Command HK Request */ +/*{ { CFE_MAKE_BIG16(SC_SEND_HK_MID), CFE_MAKE_BIG16(0xC000), CFE_MAKE_BIG16(0x0001), 0x0000 } }, */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #15 - Scheduler HK Request */ + { { CFE_MAKE_BIG16(SCH_SEND_HK_MID), CFE_MAKE_BIG16(0xC000), CFE_MAKE_BIG16(0x0001), 0x0000 } }, + + /* + ** CFS routine messages + */ + /* command ID #16 - F Prime application scheduler tick */ + { { CFE_MAKE_BIG16(FPRIME_APP_SCH_TICK_MID), CFE_MAKE_BIG16(0xC000), CFE_MAKE_BIG16(0x0001), 0x0000 } }, + /* command ID #17 - HK Send Combined Housekeeping Msg #2 */ +/*{ { CFE_MAKE_BIG16(HK_SEND_COMBINED_PKT_MID), CFE_MAKE_BIG16(0xC000), CFE_MAKE_BIG16(0x0003), 0x0000, HK_COMBINED_PKT2_MID } }, */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #18 - HK Send Combined Housekeeping Msg #3 */ +/*{ { CFE_MAKE_BIG16(HK_SEND_COMBINED_PKT_MID), CFE_MAKE_BIG16(0xC000), CFE_MAKE_BIG16(0x0003), 0x0000, HK_COMBINED_PKT3_MID } }, */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #19 - HK Send Combined Housekeeping Msg #4 */ +/*{ { CFE_MAKE_BIG16(HK_SEND_COMBINED_PKT_MID), CFE_MAKE_BIG16(0xC000), CFE_MAKE_BIG16(0x0003), 0x0000, HK_COMBINED_PKT4_MID } }, */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #20 - CS Background Cycle */ +/*{ { CFE_MAKE_BIG16(CS_BACKGROUND_CYCLE_MID), CFE_MAKE_BIG16(0xC000), CFE_MAKE_BIG16(0x0001), 0x0000 } }, */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #21 - SC 1 Hz Wakeup */ +/*{ { CFE_MAKE_BIG16(SC_1HZ_WAKEUP_MID), CFE_MAKE_BIG16(0xC000), CFE_MAKE_BIG16(0x0001), 0x0000 } }, */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #22 - LC Sample Action Points */ +/*{ { CFE_MAKE_BIG16(LC_SAMPLE_AP_MID), CFE_MAKE_BIG16(0xC000), CFE_MAKE_BIG16(0x0005), 0x0000, LC_ALL_ACTIONPOINTS, 0x0000 } }, */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #23 - DS 1 HZ Wakeup */ +/*{ { CFE_MAKE_BIG16(DS_1HZ_WAKEUP_MID), CFE_MAKE_BIG16(0xC000), CFE_MAKE_BIG16(0x0001), 0x0000 } }, */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #24 - MD Wakeup */ +/*{ { CFE_MAKE_BIG16(MD_WAKEUP_MID), CFE_MAKE_BIG16(0xC000), CFE_MAKE_BIG16(0x0001), 0x0000 } }, */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #25 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #26 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #27 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #28 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #29 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + + /* + ** Mission Defined Messages + */ + /* command ID #30 - Command Ingest HK Request Example */ +/*{ { CFE_MAKE_BIG16(CI_SEND_HK_MID), CFE_MAKE_BIG16(0xC000), CFE_MAKE_BIG16(0x0001), 0x0000 } }, */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #31 - Telemetry Output HK Request Example */ +/*{ { CFE_MAKE_BIG16(TO_SEND_HK_MID), CFE_MAKE_BIG16(0xC000), CFE_MAKE_BIG16(0x0001), 0x0000 } }, */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #32 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #33 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #34 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #35 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #36 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #37 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #38 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #39 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + + /* command ID #40 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #41 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #42 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #43 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #44 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #45 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #46 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #47 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #48 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #49 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + + /* command ID #50 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #51 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #52 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #53 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #54 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #55 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #56 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #57 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #58 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #59 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + + /* command ID #60 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #61 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #62 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #63 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #64 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #65 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #66 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #67 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #68 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #69 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + + /* command ID #70 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #71 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #72 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #73 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #74 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #75 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #76 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #77 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #78 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #79 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + + /* command ID #80 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #81 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #82 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #83 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #84 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #85 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #86 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #87 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #88 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #89 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + + /* command ID #90 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #91 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #92 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #93 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #94 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #95 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #96 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #97 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #98 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #99 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + + /* command ID #100 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #101 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #102 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #103 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #104 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #105 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #106 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #107 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #108 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #109 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + + /* command ID #110 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #111 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #112 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #113 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #114 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #115 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #116 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #117 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #118 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #119 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + + /* command ID #120 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #121 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #122 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #123 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #124 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #125 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #126 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } }, + /* command ID #127 */ + { { CFE_MAKE_BIG16(SCH_UNUSED_MID) } } + +}; + +/* +** Table file header +*/ +CFE_TBL_FILEDEF(SCH_DefaultMessageTable, SCH.MSG_DEFS, SCH message definitions table, sch_def_msgtbl.tbl) + +/************************************************************************* +** +** File data +** +**************************************************************************/ + +/* +** (none) +*/ + +/************************************************************************* +** +** Local function prototypes +** +**************************************************************************/ + +/* +** (none) +*/ + +/************************/ +/* End of File Comment */ +/************************/ + diff --git a/apps/sch/fsw/tables/sch_def_schtbl.c b/apps/sch/fsw/tables/sch_def_schtbl.c new file mode 100644 index 0000000..b576af4 --- /dev/null +++ b/apps/sch/fsw/tables/sch_def_schtbl.c @@ -0,0 +1,859 @@ +/* +** $Id: sch_def_schtbl.c 1.3 2017/06/21 15:29:50EDT mdeschu Exp $ +** +** Copyright (c) 2007-2014 United States Government as represented by the +** Administrator of the National Aeronautics and Space Administration. +** All Other Rights Reserved. +** +** This software was created at NASA's Goddard Space Flight Center. +** This software is governed by the NASA Open Source Agreement and may be +** used, distributed and modified only pursuant to the terms of that +** agreement. +** +** Purpose: Scheduler (SCH) default schedule table data +** +** Author: +** +** Notes: +** +*/ + +/************************************************************************* +** +** Include section +** +**************************************************************************/ + +#include "cfe.h" +#include "cfe_tbl_filedef.h" +#include "sch_platform_cfg.h" +#include "sch_msgdefs.h" +#include "sch_tbldefs.h" + +/************************************************************************* +** +** Macro definitions +** +**************************************************************************/ + +/* +** Schedule Table "group" definitions +*/ +#define SCH_GROUP_NONE (0) + +/* Define highest level multi-groups */ +#define SCH_GROUP_CDH (0x000001) /* All C&DH Messages */ +#define SCH_GROUP_GNC (0x000002) /* All GNC Messages */ + +/* Define sub multi-groups */ +#define SCH_GROUP_CFS_HK ( (0x000010) | SCH_GROUP_CDH) /* CFS HK Messages */ +#define SCH_GROUP_CFE_HK ( (0x000020) | SCH_GROUP_CDH) /* cFE HK Messages */ +#define SCH_GROUP_GNC_HK ( (0x000040) | SCH_GROUP_GNC) /* GNC HK Messages */ + +#define SCH_GROUP_ + +/* Define groups for messages that appear multiple times in Schedule */ +#define SCH_GROUP_MD_WAKEUP ((0x01000000) | SCH_GROUP_CDH) /* MD Wakeup (aka Group #1) */ + + +/************************************************************************* +** +** Type definitions +** +**************************************************************************/ + +/* +** (none) +*/ + +/************************************************************************* +** +** Exported data +** +**************************************************************************/ + +/* +** Default schedule table data +*/ +SCH_ScheduleEntry_t SCH_DefaultScheduleTable[SCH_TABLE_ENTRIES] = +{ + +/* +** Structure definition... +** +** uint8 EnableState -- SCH_UNUSED, SCH_ENABLED, SCH_DISABLED +** uint8 Type -- 0 or SCH_ACTIVITY_SEND_MSG +** uint16 Frequency -- how many seconds between Activity execution +** uint16 Remainder -- seconds offset to perform Activity +** uint16 MessageIndex -- Message Index into Message Definition table +** uint32 GroupData -- Group and Multi-Group membership definitions +*/ + + /* slot #0 */ + { SCH_ENABLED, SCH_ACTIVITY_SEND_MSG, 1, 0, 16, SCH_GROUP_NONE}, /* F Prime app scheduler tick (1 Hz) */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #1 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #2 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #3 */ + { SCH_ENABLED, SCH_ACTIVITY_SEND_MSG, 4, 3, 2, SCH_GROUP_CFE_HK }, /* EVS HK Request */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #4 */ +/*{ SCH_DISABLED, SCH_ACTIVITY_SEND_MSG, 4, 1, 6, SCH_GROUP_CFS_HK }, */ /* CS HK Request */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #5 */ +/*{ SCH_DISABLED, SCH_ACTIVITY_SEND_MSG, 1, 0, 24, SCH_GROUP_MD_WAKEUP }, */ /* MD Wakeup */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #6 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #7 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #8 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #9 */ +/*{ SCH_DISABLED, SCH_ACTIVITY_SEND_MSG, 4, 2, 7, SCH_GROUP_CFS_HK }, */ /* DS HK Request */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #10 */ +/*{ SCH_DISABLED, SCH_ACTIVITY_SEND_MSG, 1, 0, 24, SCH_GROUP_MD_WAKEUP }, */ /* MD Wakeup */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #11 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #12 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #13 */ + { SCH_ENABLED, SCH_ACTIVITY_SEND_MSG, 4, 3, 3, SCH_GROUP_CFE_HK }, /* SB HK Request */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #14 */ +/*{ SCH_DISABLED, SCH_ACTIVITY_SEND_MSG, 4, 1, 8, SCH_GROUP_CFS_HK }, */ /* FM HK Request */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #15 */ +/*{ SCH_DISABLED, SCH_ACTIVITY_SEND_MSG, 1, 0, 24, SCH_GROUP_MD_WAKEUP }, */ /* MD Wakeup */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #16 */ +/*{ SCH_DISABLED, SCH_ACTIVITY_SEND_MSG, 1, 0, 20, SCH_GROUP_NONE }, */ /* CS Wakeup */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #17 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #18 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #19 */ +/*{ SCH_DISABLED, SCH_ACTIVITY_SEND_MSG, 4, 2, 9, SCH_GROUP_CFS_HK }, */ /* HK HK Request */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #20 */ +/*{ SCH_DISABLED, SCH_ACTIVITY_SEND_MSG, 1, 0, 24, SCH_GROUP_MD_WAKEUP }, */ /* MD Wakeup */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #21 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #22 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #23 */ + { SCH_ENABLED, SCH_ACTIVITY_SEND_MSG, 4, 3, 4, SCH_GROUP_CFE_HK }, /* TIME HK Request */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #24 */ +/*{ SCH_DISABLED, SCH_ACTIVITY_SEND_MSG, 4, 1, 10, SCH_GROUP_CFS_HK }, */ /* HS HK Request */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #25 */ +/*{ SCH_DISABLED, SCH_ACTIVITY_SEND_MSG, 1, 0, 24, SCH_GROUP_MD_WAKEUP }, */ /* MD Wakeup */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #26 */ +/*{ SCH_DISABLED, SCH_ACTIVITY_SEND_MSG, 1, 0, 25, SCH_GROUP_NONE }, */ /* SC Wakeup */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #27 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #28 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #29 */ +/*{ SCH_DISABLED, SCH_ACTIVITY_SEND_MSG, 4, 2, 11, SCH_GROUP_CFS_HK }, */ /* LC HK Request */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #30 */ +/*{ SCH_DISABLED, SCH_ACTIVITY_SEND_MSG, 1, 0, 24, SCH_GROUP_MD_WAKEUP }, */ /* MD Wakeup */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #31 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #32 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #33 */ + { SCH_ENABLED, SCH_ACTIVITY_SEND_MSG, 4, 3, 5, SCH_GROUP_CFE_HK }, /* TBL HK Request */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #34 */ +/*{ SCH_DISABLED, SCH_ACTIVITY_SEND_MSG, 4, 1, 12, SCH_GROUP_CFS_HK }, */ /* MD HK Request */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #35 */ +/*{ SCH_DISABLED, SCH_ACTIVITY_SEND_MSG, 1, 0, 24, SCH_GROUP_MD_WAKEUP }, */ /* MD Wakeup */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #36 */ +/*{ SCH_DISABLED, SCH_ACTIVITY_SEND_MSG, 1, 0, 23, SCH_GROUP_NONE }, */ /* DS Wakeup */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #37 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #38 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #39 */ +/*{ SCH_DISABLED, SCH_ACTIVITY_SEND_MSG, 4, 2, 13, SCH_GROUP_CFS_HK }, */ /* MM HK Request */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #40 */ +/*{ SCH_DISABLED, SCH_ACTIVITY_SEND_MSG, 1, 0, 24, SCH_GROUP_MD_WAKEUP }, */ /* MD Wakeup */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #41 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #42 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #43 */ + { SCH_ENABLED, SCH_ACTIVITY_SEND_MSG, 4, 3, 1, SCH_GROUP_CFE_HK }, /* ES HK Request */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #44 */ +/*{ SCH_DISABLED, SCH_ACTIVITY_SEND_MSG, 4, 1, 14, SCH_GROUP_CFS_HK }, */ /* SC HK Request */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #45 */ +/*{ SCH_DISABLED, SCH_ACTIVITY_SEND_MSG, 1, 0, 24, SCH_GROUP_MD_WAKEUP }, */ /* MD Wakeup */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #46 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #47 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #48 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #49 */ + { SCH_ENABLED, SCH_ACTIVITY_SEND_MSG, 4, 2, 15, SCH_GROUP_CFS_HK }, /* SCH HK Request */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #50 */ +/*{ SCH_DISABLED, SCH_ACTIVITY_SEND_MSG, 1, 0, 24, SCH_GROUP_MD_WAKEUP }, */ /* MD Wakeup */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #51 */ +/*{ SCH_DISABLED, SCH_ACTIVITY_SEND_MSG, 1, 0, 22, SCH_GROUP_NONE }, */ /* LC Sample Action Points */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #52 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #53 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #54 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #55 */ +/*{ SCH_DISABLED, SCH_ACTIVITY_SEND_MSG, 1, 0, 24, SCH_GROUP_MD_WAKEUP }, */ /* MD Wakeup */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #56 */ +/*{ SCH_ENABLED, SCH_ACTIVITY_SEND_MSG, 4, 1, 30, SCH_GROUP_NONE }, */ /* CI HK Request */ +/*{ SCH_ENABLED, SCH_ACTIVITY_SEND_MSG, 4, 2, 31, SCH_GROUP_NONE }, */ /* TO HK Request */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #57 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #58 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #59 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #60 */ +/*{ SCH_DISABLED, SCH_ACTIVITY_SEND_MSG, 1, 0, 24, SCH_GROUP_MD_WAKEUP }, */ /* MD Wakeup */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #61 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #62 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #63 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #64 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #65 */ +/*{ SCH_DISABLED, SCH_ACTIVITY_SEND_MSG, 1, 0, 24, SCH_GROUP_MD_WAKEUP }, */ /* MD Wakeup */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #66 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #67 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #68 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #69 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #70 */ +/*{ SCH_DISABLED, SCH_ACTIVITY_SEND_MSG, 1, 0, 24, SCH_GROUP_MD_WAKEUP }, */ /* MD Wakeup */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #71 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #72 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #73 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #74 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #75 */ +/*{ SCH_DISABLED, SCH_ACTIVITY_SEND_MSG, 1, 0, 24, SCH_GROUP_MD_WAKEUP }, */ /* MD Wakeup */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #76 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #77 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #78 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #79 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #80 */ +/*{ SCH_DISABLED, SCH_ACTIVITY_SEND_MSG, 1, 0, 24, SCH_GROUP_MD_WAKEUP }, */ /* MD Wakeup */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #81 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #82 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #83 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #84 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #85 */ +/*{ SCH_DISABLED, SCH_ACTIVITY_SEND_MSG, 1, 0, 24, SCH_GROUP_MD_WAKEUP }, */ /* MD Wakeup */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #86 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #87 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #88 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #89 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #90 */ +/*{ SCH_DISABLED, SCH_ACTIVITY_SEND_MSG, 1, 0, 24, SCH_GROUP_MD_WAKEUP }, */ /* MD Wakeup */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #91 */ +/*{ SCH_DISABLED, SCH_ACTIVITY_SEND_MSG, 4, 0, 16, SCH_GROUP_CFS_HK }, */ /* HK Send Combined HK '1' */ +/*{ SCH_DISABLED, SCH_ACTIVITY_SEND_MSG, 4, 1, 17, SCH_GROUP_CFS_HK }, */ /* HK Send Combined HK '2' */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #92 */ +/*{ SCH_DISABLED, SCH_ACTIVITY_SEND_MSG, 4, 2, 18, SCH_GROUP_CFS_HK }, */ /* HK Send Combined HK '3' */ +/*{ SCH_DISABLED, SCH_ACTIVITY_SEND_MSG, 4, 3, 19, SCH_GROUP_CFS_HK }, */ /* HK Send Combined HK '4' */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #93 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #94 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #95 */ +/*{ SCH_DISABLED, SCH_ACTIVITY_SEND_MSG, 1, 0, 24, SCH_GROUP_MD_WAKEUP }, */ /* MD Wakeup */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #96 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #97 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #98 */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + + /* slot #99 - Left Empty to allow Scheduler to Easily Resynchronize with 1 Hz */ + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, + { SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE} +}; + +/* +** Table file header +*/ +CFE_TBL_FILEDEF(SCH_DefaultScheduleTable, SCH.SCHED_DEF, SCH schedule table, sch_def_schtbl.tbl) + +/************************************************************************* +** +** File data +** +**************************************************************************/ + +/* +** (none) +*/ + +/************************************************************************* +** +** Local function prototypes +** +**************************************************************************/ + +/* +** (none) +*/ + +/************************/ +/* End of File Comment */ +/************************/ + diff --git a/do-clean b/do-clean index a523708..a0cbe33 100755 --- a/do-clean +++ b/do-clean @@ -19,6 +19,6 @@ then cp cfe/cmake/Makefile.sample Makefile fi -rm -r build +rm -rf build build-artifacts make SIMULATION=native prep ./do diff --git a/fprime_cfs_reference_defs/arch_build_custom.cmake b/fprime_cfs_reference_defs/arch_build_custom.cmake index f8249e6..747e041 100644 --- a/fprime_cfs_reference_defs/arch_build_custom.cmake +++ b/fprime_cfs_reference_defs/arch_build_custom.cmake @@ -37,3 +37,6 @@ add_compile_options( -Wno-stringop-truncation # Inhibit string operation truncation warnings ) +# Make fprime_cfs CMake modules (e.g. cfs_compat) available via include() +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/../libs/fprime_cfs/cmake") + diff --git a/fprime_cfs_reference_defs/cpu1_cfe_es_startup.scr b/fprime_cfs_reference_defs/cpu1_cfe_es_startup.scr index b94432c..b452feb 100644 --- a/fprime_cfs_reference_defs/cpu1_cfe_es_startup.scr +++ b/fprime_cfs_reference_defs/cpu1_cfe_es_startup.scr @@ -1,6 +1,7 @@ CFE_LIB, cfe_assert, CFE_Assert_LibInit, ASSERT_LIB, 0, 0, 0x0, 0; CFE_APP, fprime_gds, FPRIME_GDS_Main, FPRIME_GDS, 25, 16384, 0x0, 0; CFE_APP, fprime_app, FPRIME_APP_Main, FPRIME_APP, 25, 65536, 0x0, 0; +CFE_APP, sch, SCH_AppMain, SCH, 10, 16384, 0x0, 0; ! ! Startup script fields: ! 1. Object Type -- CFE_APP for an Application, or CFE_LIB for a library. diff --git a/fprime_cfs_reference_defs/mission_build_custom.cmake b/fprime_cfs_reference_defs/mission_build_custom.cmake index 965b452..31f182f 100644 --- a/fprime_cfs_reference_defs/mission_build_custom.cmake +++ b/fprime_cfs_reference_defs/mission_build_custom.cmake @@ -26,3 +26,6 @@ add_compile_options( add_definitions( -D_XOPEN_SOURCE=600 ) + +# Make fprime_cfs CMake modules (e.g. cfs_compat) available via include() +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/../libs/fprime_cfs/cmake") diff --git a/fprime_cfs_reference_defs/targets.cmake b/fprime_cfs_reference_defs/targets.cmake index 4e679de..63ffbd1 100644 --- a/fprime_cfs_reference_defs/targets.cmake +++ b/fprime_cfs_reference_defs/targets.cmake @@ -102,7 +102,7 @@ SET(FT_INSTALL_SUBDIR "host/functional-test") SET(MISSION_CPUNAMES cpu1) SET(cpu1_PROCESSORID 1) -SET(cpu1_APPLIST) +SET(cpu1_APPLIST sch) SET(cpu1_FILELIST cfe_es_startup.scr) SET(cpu1_SYSTEM i686-linux-gnu) diff --git a/go-draco b/go-draco new file mode 100755 index 0000000..bf9e683 --- /dev/null +++ b/go-draco @@ -0,0 +1,11 @@ +#!/bin/bash +commit="${1:-draco-rc5}" +for dir in cfe psp osal tools/elf2cfetbl tools/tblCRCTool +do + ( + cd ${dir} + git checkout "${commit}" + ) || ( echo "[ERROR] Failed to checkout" && exit 4 ) +done + + diff --git a/libs/fprime b/libs/fprime index 8d8ba50..35d4c0e 160000 --- a/libs/fprime +++ b/libs/fprime @@ -1 +1 @@ -Subproject commit 8d8ba5067efb298afc373bab3ce0f363551ecf4d +Subproject commit 35d4c0e881482adf372b8eee3eb56ad2dee74618 diff --git a/libs/fprime_cfs b/libs/fprime_cfs index 1b28ec9..ddfa7f5 160000 --- a/libs/fprime_cfs +++ b/libs/fprime_cfs @@ -1 +1 @@ -Subproject commit 1b28ec921c286849ad599150069ec5037d4638fa +Subproject commit ddfa7f5062277b189bc9ddfc587eb220ac01db84 diff --git a/test/int/test_fprime_cfs_reference.py b/test/int/test_fprime_cfs_reference.py new file mode 100644 index 0000000..488ed2c --- /dev/null +++ b/test/int/test_fprime_cfs_reference.py @@ -0,0 +1,53 @@ +"""test_fprime_cfs_reference.py: + +Basic integration tests for the F Prime CFS reference. Exercises command dispatch, +event generation, and telemetry through the FPrimeDeployment application running +as a CFS application. +""" + +import time + + +def test_send_command(fprime_test_api): + """Test that commands may be sent + + Tests command send, dispatch, and receipt using send_and_assert_command with a + pair of CommandDispatcher commands. + """ + fprime_test_api.send_and_assert_command("CdhCore.cmdDisp.CMD_NO_OP", max_delay=5) + fprime_test_api.send_and_assert_command( + "CdhCore.cmdDisp.CMD_NO_OP_STRING", ["hello_cfs"], max_delay=5 + ) + + +def test_send_command_args(fprime_test_api): + """Test that commands with arguments may be sent""" + fprime_test_api.send_and_assert_command( + "CdhCore.cmdDisp.CMD_TEST_CMD_1", [17, 3, 49], max_delay=5 + ) + + +def test_commands_dispatched_telemetry(fprime_test_api): + """Test that the CommandsDispatched counter increments after a command""" + result = fprime_test_api.send_and_await_telemetry( + "CdhCore.cmdDisp.CMD_NO_OP", + channels=["CdhCore.cmdDisp.CommandsDispatched"], + timeout=10, + ) + assert len(result) > 0, "Did not receive CommandsDispatched telemetry" + assert result[0].get_val() > 0, "CommandsDispatched did not increment" + + +def test_event_generation(fprime_test_api): + """Test that a NO_OP command produces the NoOpReceived event""" + events = [fprime_test_api.get_event_pred("CdhCore.cmdDisp.NoOpReceived")] + fprime_test_api.send_and_assert_event( + "CdhCore.cmdDisp.CMD_NO_OP", events=events, timeout=10 + ) + + +def test_version_command(fprime_test_api): + """Test that the VERSION command reports framework and project versions""" + fprime_test_api.send_and_assert_command( + "CdhCore.version.VERSION", ["ALL"], max_delay=5 + )