diff --git a/.github/workflows/build-documentation.yml b/.github/workflows/build-documentation.yml new file mode 100644 index 000000000..9240d7854 --- /dev/null +++ b/.github/workflows/build-documentation.yml @@ -0,0 +1,139 @@ +name: "Build cFE Documentation" + +on: + push: + pull_request: + +env: + SIMULATION: native + BUILDTYPE: debug + +jobs: + + #Check 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-docs: + #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-18.04 + timeout-minutes: 15 + + steps: + - name: Install Dependencies + run: sudo apt-get install doxygen graphviz -y + + # Check out the cfs bundle + - name: Checkout bundle + uses: actions/checkout@v2 + with: + repository: nasa/cFS + submodules: true + + - name: Checkout submodule + uses: actions/checkout@v2 + with: + path: cfe + + - name: Check versions + run: git submodule + + # Setup the build system + - name: Set up for build + run: | + cp ./cfe/cmake/Makefile.sample Makefile + cp -r ./cfe/cmake/sample_defs sample_defs + make prep + + - name: Build Docs + run: | + make doc > make_doc_stdout.txt 2> make_doc_stderr.txt + + # Upload documentation logs as artifacts + - name: Archive Documentation Build Logs + uses: actions/upload-artifact@v2 + with: + name: cFS Docs Artifacts + path: | + make_doc_stdout.txt + make_doc_stderr.txt + + - name: Error Check + run: | + if [[ -s make_doc_stderr.txt ]]; then + cat make_doc_stderr.txt + exit -1 + fi + + build-usersguide: + #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-18.04 + timeout-minutes: 15 + + steps: + - name: Install Dependencies + run: sudo apt-get install doxygen graphviz -y + + # Check out the cfs bundle + - name: Checkout bundle + uses: actions/checkout@v2 + with: + repository: nasa/cFS + submodules: true + + - name: Checkout submodule + uses: actions/checkout@v2 + with: + path: cfe + + - name: Check versions + run: git submodule + + # Setup the build system + - name: Set up for build + run: | + cp ./cfe/cmake/Makefile.sample Makefile + cp -r ./cfe/cmake/sample_defs sample_defs + make prep + + - name: Build Usersguide + run: | + make usersguide > make_usersguide_stdout.txt 2> make_usersguide_stderr.txt + mv build/doc/warnings.log usersguide_warnings.log + + - name: Archive Users Guide Build Logs + uses: actions/upload-artifact@v2 + with: + name: Users Guide Artifacts + path: | + make_usersguide_stdout.txt + make_usersguide_stderr.txt + usersguide_warnings.log + + - name: Error Check + run: | + if [[ -s make_usersguide_stderr.txt ]]; then + cat make_usersguide_stderr.txt + exit -1 + fi + + - name: Warning Check + run: | + if [[ -s usersguide_warnings.log ]]; then + cat usersguide_warnings.log + exit -1 + fi diff --git a/.github/workflows/code-coverage.yml b/.github/workflows/code-coverage.yml new file mode 100644 index 000000000..533c43c63 --- /dev/null +++ b/.github/workflows/code-coverage.yml @@ -0,0 +1,97 @@ +name: "Code Coverage Analysis" + +on: + push: + pull_request: + +env: + SIMULATION: native + ENABLE_UNIT_TESTS: true + OMIT_DEPRECATED: true + BUILDTYPE: debug + +jobs: + + #Check 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"]' + + Local-Test-Build: + #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-18.04 + timeout-minutes: 15 + + steps: + - name: Install coverage tools + run: sudo apt-get install lcov -y + + # Checks out a copy of your repository on the ubuntu-latest machine + - name: Checkout bundle + uses: actions/checkout@v2 + with: + repository: nasa/cFS + submodules: true + + - name: Checkout submodule + uses: actions/checkout@v2 + with: + path: cfe + + - name: Check versions + run: git submodule + + # Setup the build system + - name: Set up for build + run: | + cp ./cfe/cmake/Makefile.sample Makefile + cp -r ./cfe/cmake/sample_defs sample_defs + make prep + + # Build the code + - name: Build + run: | + make -C build/native/default_cpu1/core_api + make -C build/native/default_cpu1/core_private + make -C build/native/default_cpu1/es + make -C build/native/default_cpu1/evs + make -C build/native/default_cpu1/fs + make -C build/native/default_cpu1/msg + make -C build/native/default_cpu1/resourceid + make -C build/native/default_cpu1/sb + make -C build/native/default_cpu1/sbr + make -C build/native/default_cpu1/tbl + make -C build/native/default_cpu1/time + + # Initialize lcov and test the code + - name: Test + run: | + lcov --capture --initial --directory build --output-file coverage_base.info + make -C build/native/default_cpu1/core_api test + make -C build/native/default_cpu1/core_private test + make -C build/native/default_cpu1/es test + make -C build/native/default_cpu1/evs test + make -C build/native/default_cpu1/fs test + make -C build/native/default_cpu1/msg test + make -C build/native/default_cpu1/resourceid test + make -C build/native/default_cpu1/sb test + make -C build/native/default_cpu1/sbr test + make -C build/native/default_cpu1/tbl test + make -C build/native/default_cpu1/time test + + - 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 diff --git a/README.md b/README.md index e0447a101..f55a8a793 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,29 @@ The detailed cFE user's guide can be viewed at and + ### Development Build: v6.8.0-rc1+dev642 - Update ES verify errors to match @@ -34,7 +57,7 @@ The detailed cFE user's guide can be viewed at and +- See and ### Development Build: v6.8.0-rc1+dev593 diff --git a/cmake/Makefile.sample b/cmake/Makefile.sample index 62e86b48d..f1d08f4d0 100644 --- a/cmake/Makefile.sample +++ b/cmake/Makefile.sample @@ -145,11 +145,11 @@ lcov: doc: $(MAKE) --no-print-directory -C "$(O)" mission-doc - @/bin/echo -e "\n\nDetail Design: \nfile://$(CURDIR)/$(O)/doc/detaildesign/html/index.html\n" + @/bin/echo -e "\n\nDetail Design: \nfile://$(CURDIR)/$(O)/docs/detaildesign/html/index.html\n" usersguide: $(MAKE) --no-print-directory -C "$(O)" cfe-usersguide - @/bin/echo -e "\n\ncFE Users Guide: \nfile://$(CURDIR)/$(O)/doc/users_guide/html/index.html\n" + @/bin/echo -e "\n\ncFE Users Guide: \nfile://$(CURDIR)/$(O)/docs/users_guide/html/index.html\n" osalguide: $(MAKE) --no-print-directory -C "$(O)" osalguide diff --git a/cmake/arch_build.cmake b/cmake/arch_build.cmake index 7c2e6466e..e51547e1c 100644 --- a/cmake/arch_build.cmake +++ b/cmake/arch_build.cmake @@ -301,7 +301,7 @@ function(add_cfe_coverage_test MODULE_NAME UNIT_NAME TESTCASE_SRC UT_SRCS) # Compile the source unit(s) under test as a separate library # This is done so that special coverage-specific compile flags can be used on these files add_library(${OBJECT_TARGET} OBJECT - ${UT_SRCS} + ${UT_SRCS} ${ARGN} ) # Apply the UT_COVERAGE_COMPILE_FLAGS to the units under test @@ -611,21 +611,11 @@ function(process_arch SYSVAR) # This can help with debugging if things go wrong. message(STATUS "PSP Selection: ${CFE_SYSTEM_PSPNAME}") - # Append the PSP and OSAL selections to the Doxyfile so it will be included - # in the generated documentation automatically. - # Also extract the "-D" options within CFLAGS and inform Doxygen about these - string(REGEX MATCHALL "-D[A-Za-z0-9_=]+" DOXYGEN_DEFINED_MACROS "${CMAKE_C_FLAGS}") - string(REGEX REPLACE "-D" " " DOXYGEN_DEFINED_MACROS "${DOXYGEN_DEFINED_MACROS}") - file(APPEND "${MISSION_BINARY_DIR}/doc/mission-content.doxyfile" - "PREDEFINED += ${DOXYGEN_DEFINED_MACROS}\n" - "INPUT += ${MISSION_SOURCE_DIR}/osal/src/os/${OSAL_SYSTEM_OSTYPE}\n" - "INPUT += ${MISSION_SOURCE_DIR}/psp/fsw/${CFE_SYSTEM_PSPNAME}\n" - "INPUT += ${CMAKE_BINARY_DIR}/inc") - - # Append to usersguide.doxyfile - file(APPEND "${MISSION_BINARY_DIR}/doc/cfe-usersguide.doxyfile" - "INPUT += ${MISSION_SOURCE_DIR}/psp/fsw/${CFE_SYSTEM_PSPNAME}/src\n" - "INPUT += ${CMAKE_BINARY_DIR}/inc") + # Create a documentation content file, with any system-specific doxygen info + # this is done here in arch_build where the CFE_SYSTEM_PSPNAME is known + file(WRITE "${MISSION_BINARY_DIR}/docs/tgtsystem-content-${SYSVAR}.doxyfile" + "INPUT += ${CMAKE_BINARY_DIR}/inc\n" + ) # The PSP and/or OSAL should have defined where to install the binaries. # If not, just install them in /cf as a default (this can be modified diff --git a/cmake/cfe-common.doxyfile.in b/cmake/cfe-common.doxyfile.in index d1c53f9ea..8e504d4af 100644 --- a/cmake/cfe-common.doxyfile.in +++ b/cmake/cfe-common.doxyfile.in @@ -2,7 +2,6 @@ # Project related configuration options, shared for all cFE doxygen outputs #--------------------------------------------------------------------------- @INCLUDE_PATH = @MISSION_SOURCE_DIR@ -OUTPUT_DIRECTORY = . ABBREVIATE_BRIEF = "The $name class " \ "The $name widget " \ "The $name file " \ @@ -55,7 +54,6 @@ GENERATE_DEPRECATEDLIST= YES # configuration options related to warning and progress messages #--------------------------------------------------------------------------- WARN_NO_PARAMDOC = YES -WARN_LOGFILE = @CMAKE_BINARY_DIR@/doc/warnings.log #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- @@ -77,6 +75,12 @@ INPUT += @MISSION_SOURCE_DIR@/cfe/docs/src/cfe_xref.dox FILE_PATTERNS = *.c *.cpp *.cc *.C *.h *.hh *.hpp *.H *.dox *.md RECURSIVE = YES EXAMPLE_PATTERNS = * + +# Exclude coverage tests, stubs and associated framework from the documentation +EXCLUDE_PATTERNS += "*/ut-stubs/*" +EXCLUDE_PATTERNS += "*/ut-coverage/*" +EXCLUDE_PATTERNS += "*/unit-test*/*" + #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- diff --git a/cmake/cfe-usersguide.doxyfile.in b/cmake/cfe-usersguide.doxyfile.in index a884a342e..04606557e 100644 --- a/cmake/cfe-usersguide.doxyfile.in +++ b/cmake/cfe-usersguide.doxyfile.in @@ -6,9 +6,10 @@ INPUT += @MISSION_SOURCE_DIR@/cfe/docs/src/main.dox # Common definitions, some of which are extended or overridden here. -@INCLUDE = @MISSION_BINARY_DIR@/doc/cfe-common.doxyfile +@INCLUDE = @MISSION_BINARY_DIR@/docs/cfe-common.doxyfile PROJECT_NAME = "Core Flight Executive Users Guide" -OUTPUT_DIRECTORY = users_guide +OUTPUT_DIRECTORY = @CMAKE_BINARY_DIR@/docs/users_guide +WARN_LOGFILE = @CMAKE_BINARY_DIR@/docs/cfe-usersguide-warnings.log GENERATE_LATEX = YES # For purposes of the user guide, reference the "stock" mission configuration @@ -17,7 +18,6 @@ GENERATE_LATEX = YES STRIP_FROM_PATH += @MISSION_SOURCE_DIR@/cfe/cmake/sample_defs INPUT += @MISSION_SOURCE_DIR@/cfe/cmake/sample_defs -#PREDEFINED PREDEFINED += @USERGUIDE_PREDEFINED@ # Bring in the cFE header files for the documentation of the various API calls diff --git a/cmake/global_functions.cmake b/cmake/global_functions.cmake index 8289363cc..38477192c 100644 --- a/cmake/global_functions.cmake +++ b/cmake/global_functions.cmake @@ -65,6 +65,7 @@ endfunction(generate_c_headerfile) # source file for the wrapper. # # This function now accepts named parameters: +# OUTPUT_DIRECTORY - non-default directory to write the file to (optional) # FILE_NAME - the name of the file to write # FALLBACK_FILE - if no files are found in "defs" using the name match, this file will be used instead. # MATCH_SUFFIX - the suffix to match in the "defs" directory (optional) @@ -130,18 +131,24 @@ endfunction(generate_config_includefile) # FUNCTION: read_targetconfig # # Scan the list of targets and organize by target system type. -# This function sets up the following variables in the global scope: +# +# If the historical TGT variables are defined, they are translated to name +# based list of MISSION_CPUNAMES (from TGT_NAMEs). The historical settings +# are then translated to the new cpuname based settings as defined in the +# sample_defs/targets.cmake and sets them as global scope. +# +# This function then sets up the following variables in the global scope: # TGTSYS_LIST: list of CPU architectures used in the build. Note this # will always contain a "native" target (for tools at least) which # is forced to be last. -# MISSION_APPS: full list of applications specified in the whole mission -# SYSID_: set for each entry of TGTSYS_LIST, and indicates the -# toolchain specified in the target file for that CPU arch. -# TGTSYS_: set to a list of CPU numbers that utilize the same arch -# TGTSYS__APPS: set for each entry of TGTSYS_LIST, and indicates the -# full set of applications that need to built for that target architecture -# TGTSYS__DRIVERS: set for each entry of TGTSYS_LIST, and indicates the -# full set of device drivers that need to built for that target architecture +# MISSION_APPS: list of all applications in this build +# MISSION_PSPMODULES: list of all psp modules in this build +# +# Additionally for each architechture in TGTSYS_LIST: +# TGTSYS_: list of CPU names that utilize the same architecture +# TGTSYS__APPS: list of apps for the architecture +# TGTSYS__STATICAPPS: list of static apps for the architecture +# TGTSYS__PSPMODULES: list of psp modules for the architecture # function(read_targetconfig) diff --git a/cmake/mission-detaildesign.doxyfile.in b/cmake/mission-detaildesign.doxyfile.in index 0e9aa60d7..88793edf2 100644 --- a/cmake/mission-detaildesign.doxyfile.in +++ b/cmake/mission-detaildesign.doxyfile.in @@ -3,31 +3,17 @@ #--------------------------------------------------------------------------- # Start with the common definitions, some of which are extended or overridden here. -@INCLUDE = @MISSION_BINARY_DIR@/doc/cfe-common.doxyfile +@INCLUDE = @MISSION_BINARY_DIR@/docs/cfe-common.doxyfile PROJECT_NAME = "@MISSION_NAME@" PROJECT_BRIEF = "Core Flight System project built using \"@MISSIONCONFIG@\" configuration" -OUTPUT_DIRECTORY = detaildesign - -INPUT += @MISSION_DEFS@ \ - @MISSION_SOURCE_DIR@/osal/src/os/inc \ - @MISSION_SOURCE_DIR@/osal/src/os/shared \ - @MISSION_SOURCE_DIR@/psp/fsw/inc \ - @MISSION_SOURCE_DIR@/psp/fsw/shared \ - @MISSION_SOURCE_DIR@/cfe/modules/core_api/fsw \ - @MISSION_SOURCE_DIR@/cfe/modules/core_private/fsw \ - @MISSION_SOURCE_DIR@/cfe/modules/es/fsw \ - @MISSION_SOURCE_DIR@/cfe/modules/evs/fsw \ - @MISSION_SOURCE_DIR@/cfe/modules/fs/fsw \ - @MISSION_SOURCE_DIR@/cfe/modules/msg/fsw \ - @MISSION_SOURCE_DIR@/cfe/modules/resourceid/fsw \ - @MISSION_SOURCE_DIR@/cfe/modules/sb/fsw \ - @MISSION_SOURCE_DIR@/cfe/modules/sbr/fsw \ - @MISSION_SOURCE_DIR@/cfe/modules/tbl/fsw \ - @MISSION_SOURCE_DIR@/cfe/modules/time/fsw +OUTPUT_DIRECTORY = @CMAKE_BINARY_DIR@/docs/detaildesign +WARN_LOGFILE = @CMAKE_BINARY_DIR@/docs/detaildesign-warnings.log +INPUT += @MISSION_DEFS@ STRIP_FROM_PATH += @MISSION_DEFS@ #--------------------------------------------------------------------------- # The user content doxyfile contains paths to the mission-specific applications #--------------------------------------------------------------------------- -@INCLUDE = @CMAKE_BINARY_DIR@/doc/mission-content.doxyfile +@DETAILDESIGN_DOXYFILE_USER_CONTENT@ +@TGTSYSTEM_DOXYFILE_USER_CONTENT@ diff --git a/cmake/mission_build.cmake b/cmake/mission_build.cmake index f024f864b..11095431c 100644 --- a/cmake/mission_build.cmake +++ b/cmake/mission_build.cmake @@ -234,49 +234,61 @@ function(prepare) # Doxygen-based documentation generation targets # Create a directory for documentation output - file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/doc") + file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/docs") # Generate a customized Doxyfile file for the Doxygen docs. # This file must be present in the directory where "doxygen" is executed # If the user has provided a "Doxyfile" in their top level documentation directory, # then assume they have also set PROJECT_NAME and PROJECT_BRIEF in that. # Otherwise, generate reasonable strings for these values. - set(MISSION_DOXYFILE_USER_CONTENT) - if (EXISTS "${MISSION_SOURCE_DIR}/doc/Doxyfile") - list(APPEND MISSION_DOXYFILE_USER_CONTENT "@INCLUDE = ${MISSION_SOURCE_DIR}/doc/Doxyfile\n") - endif (EXISTS "${MISSION_SOURCE_DIR}/doc/Doxyfile") + set(DETAILDESIGN_DOXYFILE_USER_CONTENT) + if (EXISTS "${MISSION_SOURCE_DIR}/docs/Doxyfile") + list(APPEND DETAILDESIGN_DOXYFILE_USER_CONTENT "@INCLUDE = ${MISSION_SOURCE_DIR}/docs/Doxyfile\n") + endif (EXISTS "${MISSION_SOURCE_DIR}/docs/Doxyfile") + # Add any detail design information from each app/module foreach(APP ${MISSION_DEPS}) - # OSAL is handled specially, as only part of it is used - if (NOT APP STREQUAL "osal") - if (EXISTS "${${APP}_MISSION_DIR}/docs/${APP}.doxyfile.in") - # If the module provides its own doxyfile, then include it directly - # This allows for app-specific fine-tuning of the sources, based on its own source tree - configure_file("${${APP}_MISSION_DIR}/docs/${APP}.doxyfile.in" - "${CMAKE_BINARY_DIR}/doc/${APP}.doxyfile") - list(APPEND MISSION_DOXYFILE_USER_CONTENT "@INCLUDE = ${CMAKE_BINARY_DIR}/doc/${APP}.doxyfile\n") - else() - # Otherwise just add this entire directory to the "INPUT" list - list(APPEND MISSION_DOXYFILE_USER_CONTENT "INPUT += ${${APP}_MISSION_DIR}\n") - endif() + + set(APP_DOC_DIR "${${APP}_MISSION_DIR}/docs") + + # Now add the app-specific documentation to the detail design input set. + # This depends on whether the app has provided any guidance on this. + # The "doxyfile.in" should provide specific directives for what to include. If + # not specified, then the entire app source tree will be used as a catch-all. + if (EXISTS "${APP_DOC_DIR}/${APP}-detaildesign.doxyfile.in") + + # a "doxyfile.in" is a template that should be passed through configure_file() + # (which will expand any variable refs) then the result of this is included in the doxyfile + configure_file("${APP_DOC_DIR}/${APP}-detaildesign.doxyfile.in" + "${CMAKE_BINARY_DIR}/docs/${APP}-detaildesign.doxyfile") + + list(APPEND DETAILDESIGN_DOXYFILE_USER_CONTENT "@INCLUDE = ${CMAKE_BINARY_DIR}/docs/${APP}-detaildesign.doxyfile\n") + else() + + # Otherwise just add this entire directory to the "INPUT" list + list(APPEND DETAILDESIGN_DOXYFILE_USER_CONTENT "INPUT += ${${APP}_MISSION_DIR}\n") endif() + endforeach() - # In all cases it is assumed to include the CFE documentation as well (could be configurable?) - file(WRITE "${CMAKE_BINARY_DIR}/doc/mission-content.doxyfile" - ${MISSION_DOXYFILE_USER_CONTENT}) + set(TGTSYSTEM_DOXYFILE_USER_CONTENT) + foreach(SYSVAR ${TGTSYS_LIST}) + list(APPEND TGTSYSTEM_DOXYFILE_USER_CONTENT "@INCLUDE = ${CMAKE_BINARY_DIR}/docs/tgtsystem-content-${SYSVAR}.doxyfile\n") + endforeach() - configure_file("${CFE_SOURCE_DIR}/cmake/cfe-common.doxyfile.in" - "${CMAKE_BINARY_DIR}/doc/cfe-common.doxyfile") + # Create single/unified strings from the lists + string(CONCAT DETAILDESIGN_DOXYFILE_USER_CONTENT ${DETAILDESIGN_DOXYFILE_USER_CONTENT}) + string(CONCAT TGTSYSTEM_DOXYFILE_USER_CONTENT ${TGTSYSTEM_DOXYFILE_USER_CONTENT}) - configure_file("${CFE_SOURCE_DIR}/cmake/mission-detaildesign.doxyfile.in" - "${CMAKE_BINARY_DIR}/doc/mission-detaildesign.doxyfile") + configure_file("${CFE_SOURCE_DIR}/cmake/cfe-common.doxyfile.in" + "${CMAKE_BINARY_DIR}/docs/cfe-common.doxyfile" + @ONLY) # Generate an "empty" osconfig.h file for doxygen purposes # this does not have the actual user-defined values, but will # have the documentation associated with each macro definition. configure_file("${osal_MISSION_DIR}/osconfig.h.in" - "${CMAKE_BINARY_DIR}/doc/osconfig-example.h") + "${CMAKE_BINARY_DIR}/docs/osconfig-example.h") # The user guide should include the doxygen from the _public_ API files from CFE + OSAL # NOTE: the userguide is built against the headers of the default core apps. Even if @@ -290,28 +302,33 @@ function(prepare) endforeach() file(GLOB MISSION_USERGUIDE_HEADERFILES ${SUBMODULE_HEADER_PATHS} - "${CMAKE_BINARY_DIR}/doc/osconfig-example.h" + "${CMAKE_BINARY_DIR}/docs/osconfig-example.h" ) string(REPLACE ";" " \\\n" MISSION_USERGUIDE_HEADERFILES "${MISSION_USERGUIDE_HEADERFILES}") - configure_file("${CFE_SOURCE_DIR}/cmake/cfe-usersguide.doxyfile.in" - "${CMAKE_BINARY_DIR}/doc/cfe-usersguide.doxyfile") - - add_custom_target(mission-doc - doxygen mission-detaildesign.doxyfile - WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/doc") + file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/docs/detaildesign") + configure_file("${CFE_SOURCE_DIR}/cmake/mission-detaildesign.doxyfile.in" + "${CMAKE_BINARY_DIR}/docs/detaildesign/Doxyfile" + @ONLY) + add_custom_target(mission-doc doxygen + COMMAND echo "Detail Design: file://${CMAKE_BINARY_DIR}/docs/detaildesign/html/index.html" + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/docs/detaildesign") - add_custom_target(cfe-usersguide - doxygen cfe-usersguide.doxyfile - WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/doc") + file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/docs/users_guide") + configure_file("${CFE_SOURCE_DIR}/cmake/cfe-usersguide.doxyfile.in" + "${CMAKE_BINARY_DIR}/docs/users_guide/Doxyfile" + @ONLY) + add_custom_target(cfe-usersguide doxygen + COMMAND echo "Users Guide: file://${CMAKE_BINARY_DIR}/docs/users_guide/html/index.html" + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/docs/users_guide") # OSAL API GUIDE include PUBLIC API set(OSAL_API_INCLUDE_DIRECTORIES "${osal_MISSION_DIR}/src/os/inc" - "${CMAKE_BINARY_DIR}/doc" + "${CMAKE_BINARY_DIR}/docs" ) - add_subdirectory(${osal_MISSION_DIR}/doc/src ${CMAKE_BINARY_DIR}/doc/osalguide) + add_subdirectory(${osal_MISSION_DIR}/docs/src ${CMAKE_BINARY_DIR}/docs/osalguide) add_custom_target(osalguide) add_dependencies(osalguide osal-apiguide) diff --git a/cmake/sample_defs/targets.cmake b/cmake/sample_defs/targets.cmake index d2ea58a7b..6301a0984 100644 --- a/cmake/sample_defs/targets.cmake +++ b/cmake/sample_defs/targets.cmake @@ -10,6 +10,7 @@ # # MISSION_CPUNAMES : list of user-friendly cpu names. Should be simple # words with no punctuation. This MUST be specified. +# _PROCESSORID : numerical identifier for the processor # _APPLIST : list of applications to build and install on the CPU. # These are built as dynamically-loaded applications and installed # as files in the non-volatile storage of the target, and loaded diff --git a/cmake/target/src/target_config.c b/cmake/target/src/target_config.c index 2995bd73c..956cdf7ab 100644 --- a/cmake/target/src/target_config.c +++ b/cmake/target/src/target_config.c @@ -45,10 +45,6 @@ #define CFE_CPU_NAME_VALUE "unknown" #endif -#ifndef CFE_CPU_ID_VALUE -#define CFE_CPU_ID_VALUE 0 -#endif - #ifndef CFE_SPACECRAFT_ID_VALUE #define CFE_SPACECRAFT_ID_VALUE 0x42 #endif @@ -71,7 +67,8 @@ extern const char CFE_MISSION_NAME[]; /**< Name of CFE mission */ extern const char CFE_MISSION_CONFIG[]; /**< Configuration name used for build */ /** - * A list of modules which are statically linked into CFE core. + * A NULL terminated list of modules which are statically linked into CFE core, + * generated by the build system from MISSION_CORE_MODULES. * * For module names which appear in this list, the code is directly * linked into the core executable binary file, and therefore means @@ -84,7 +81,8 @@ extern const char CFE_MISSION_CONFIG[]; /**< Configuration name used for build * extern CFE_ConfigName_t CFE_CORE_MODULE_LIST[]; /** - * A list of CFS apps which are also statically linked with this binary. + * A NULL terminated list of CFS apps which are also statically linked with this binary, + * generated by the build system from the target STATIC_APPLIST. * * These apps can be started without dynamically loading any modules, * however the entry point must be separately provided in order to avoid @@ -93,8 +91,8 @@ extern CFE_ConfigName_t CFE_CORE_MODULE_LIST[]; extern CFE_ConfigName_t CFE_STATIC_APP_LIST[]; /** - * A key-value table containing certain environment information from the build system - * at the time CFE core was built. + * A NULL terminated key-value table containing certain environment information + * from the build system at the time CFE core was built. * * This contains basic information such as the time of day, build host, and user. */ @@ -103,8 +101,8 @@ extern CFE_ConfigKeyValue_t CFE_BUILD_ENV_TABLE[]; /** * Version control (source code) versions of all modules * - * This list includes all modules known to the build system as determined by the - * version control system in use (e.g. git). It is generated by a post-build step + * This NULL terminated list includes all modules known to the build system as determined + * by the version control system in use (e.g. git). It is generated by a post-build step * to query version control and should change automatically every time code is * checked in or out. * @@ -122,7 +120,8 @@ extern CFE_ConfigKeyValue_t CFE_BUILD_ENV_TABLE[]; extern CFE_ConfigKeyValue_t CFE_MODULE_VERSION_TABLE[]; /** - * A list of PSP modules included in this build of CFE core. + * A NULL terminated list of PSP modules included in this build of CFE core, + * generated by the build system from the target PSPMODULES. * * These are always statically linked, and this table contains a pointer * to its API structure, which in turn contains its entry point. diff --git a/docs/cFE_FunctionalRequirements.csv b/docs/cFE_FunctionalRequirements.csv index f1f90f1d4..8cdc5d2f4 100644 --- a/docs/cFE_FunctionalRequirements.csv +++ b/docs/cFE_FunctionalRequirements.csv @@ -36,11 +36,11 @@ ES: Delete Application - Reject Undefined,cES1006.1,"If the specified Applicatio ES: Restart Application,cES1007,"Upon receipt of a Command, the cFE shall Restart the Command specified Application.","Need to be able to restart an Application. A restart involves deleting it (cleaning up) and then starting it again. This is similar to starting the cFE Application from a file system. When an Application is restarted, the only command parameter required is the application name. All other parameters including the filename are the same as the original cFE Application Create command. The restart is intended for error recovery such as an exception, and should not be used to start a new version of an Application. If a Critical Data Store Area is allocated for the Application, it is preserved, and the Application may re-connect to the Critical Data Store Area when it is running again." ES: Restart Application - Reject Undefined,cES1007.1,"If the Command specified Application is undefined then the cFE shall reject the Command, increment the invalid Command counter and generate an event message.",Can't restart an undefined application. ES: Restart Application - Reject On Missing File,cES1007.2,"If the original cFE Application file is not found then the cFE shall reject the Command, increment the invalid Command counter, and generate an event message.","Can't restart the Application if the original file has been removed. The command is aborted during the attempt to load, after the application has been deleted." -ES: Restart Application - Delete On Non-Parameter Error,cES1007.3,"If the cFE Application Restart fails due to a non-parameter error, then the cFE shall delete the Application, increment the invalid Command counter, and generate an event message.","If the Application is already stopped and there is an error restarting it, then the cFE application will be deleted." +ES: Restart Application - Delete On Non-Parameter Error,cES1007.3,"If the cFE Application Restart fails due to a non-parameter error, then the cFE shall delete the Application and generate an event message.","If the Application is already stopped and there is an error restarting it, then the cFE application will be deleted. Note non-parameter errors do not increment the command error counter, since they are detected after the request has been successfully processed." ES: Reload Application,cES1008,Upon receipt of a Command the cFE shall Reload the Command specified cFE Application from the Command specified cFE Application file.,"This command enables the ground to replace an Application with only one command. This is required for applications such as a Command Uplink Application, which must be replaced with one command. The specified cFE Application file may be from any valid cFE." ES: Reload Application - Reject Undefined,cES1008.1,"If the specified Application is undefined then the cFE shall reject the Command, increment the invalid Command counter and generate an event message.",Can't reload an undefined Application. ES: Reload Application - Reject On Missing File,cES1008.2,"If the specified cFE Application file does not exist then the cFE shall reject the command, increment the invalid Command counter, and generate an event message.",Can't reload the Application if the new file does not exist. -ES: Reload Application - Delete On Non-Parameter Error,cES1008.3,"If the cFE Application Reload fails due to a non-parameter error, then the cFE shall delete the Application, increment the invalid Command counter, and generate an event message.","If the Application is already stopped and there is an error restarting it, then the cFE application will be deleted. Should the old Application be restarted? Need to be able to reset the cFE in the event that there is a critical problem. As a result of the Power On Reset, all code and data are re-initialized and the cFE is returned to a default power-on state. This reset is initiated through a common interface." +ES: Reload Application - Delete On Non-Parameter Error,cES1008.3,"If the cFE Application Reload fails due to a non-parameter error, then the cFE shall delete the Application and generate an event message.","If the Application is already stopped and there is an error restarting it, then the cFE application will be deleted. Note non-parameter errors do not increment the command error counter, since they are detected after the request has been successfully processed." ES: Power On Reset,cES1009,"Upon receipt of a Command, the cFE shall perform a Power On Reset of the Core Flight Executive.","On a flight processor or other embedded processor this command results in rebooting the processor board through the Boot Software. On a desktop system this command will result in the restarting of the cFE, but not the operating system. Note: If the cFE implementation includes more than one cFE core images, it is the responsibility of the Boot Software to select which cFE image is booted." ES: Processor Reset,cES1010,"Upon receipt of a Command, the cFE shall perform a Processor Reset of the Core Flight Executive.",Need to be able to restart the cFE in the event that there is a problem with the Real Time OS or cFE Core software. Note that restarting the cFE will result in a restart of all of the cFE applications. ES: Application Status Message,cES1011,"Upon receipt of a Command, the cFE shall generate a message that contains a summary of the Command specified Application's properties and state as defined in the Systems Resources Definition including: @@ -57,8 +57,7 @@ ES: Application Status Record To File,cES1012,"Upon receipt of a Command, the cF ES: Application Status Record To File - Default Filename,cES1012.1,"If a file is not specified, the cFE shall use the `` filename.",Want to specify a default if the user does not want to specify a new filename. ES: System Log,cES1014,The cFE shall maintain an Executive Services System Log which contains a series of ASCII text strings describing significant events or errors.,"Examples of ES System Log information includes: ""Created new cFE Application: StoredCommand.app"" or ""Could Not Create OS Queue"" or ""File not found error: /eebank1/StoredCommand.app"" This requirement states that the cFE needs to maintain this information. There is a separate requirement for the creation of a file to transfer the information to the ground. Note that the information can also be obtained with a raw memory read." ES: System Log - Timestamps,cES1014.1,Each entry in the Executive Services System Log shall be time tagged with the time that the event happened.,Need to be able to determine when the event occurred. -ES: System Log - Calculate Usage,cES1014.2,"The cFE shall calculate the number of bytes used and number of entries in -Executive Services System Log.","Ground operations need indication of how full the System Log is so that they can clear it, if necessary, in order to make room for new entries (or at least write it to a file to preserve it)." +ES: System Log - Calculate Usage,cES1014.2,The cFE shall calculate the number of bytes used and number of entries in Executive Services System Log.,"Ground operations need indication of how full the System Log is so that they can clear it, if necessary, in order to make room for new entries (or at least write it to a file to preserve it)." ES: System Log - Overwrite On Full,cES1014.2.1,If the Executive Services System Log is full and the System Log Mode is set to OVERWRITE then the cFE shall write all new entries from the top of the log.,Want to provide the capability to continuously record all new System Messages. ES: System Log - Discard On Full,cES1014.2.2,If the Executive Services Syste Log is full and the System Log Mode is set to DISCARD then the cFE shall discard all new entries.,Want to provide capability to stop writing to the System Log in order to preserve to Log which may contain important anomalous messages. ES: System Log - Clear On Command,cES1015,"Upon receipt of a Command, the cFE shall clear the Executive Services System Log.",Want to be able to clear the Executive Services System Log Buffer so that only the new information is saved. @@ -87,12 +86,14 @@ ES: Critical Data Store Write To File,cES1026,"Upon receipt of a Command, the cF 2. Size 3. Memory Handle 4. Table Flag",This provides a registry of the Critical Data Store. +ES: Critical Data Store Write To File - Default Filename,cES1026.1,"If a file is not specified, the cFE shall use the `` filename.",Provide a default file name. ES: Critical Data Store Delete,cES1027,"Upon receipt of a Command, the cFE shall delete the Command Specified Critical Data Store.","As part of an Application clean-up, want to clean-up the allocated resources." ES: System Log Mode,cES1028,"Upon receipt of Command, the cFE shall set the System Log Mode to the Command-specified mode, either overwrite or discard.","While in Overwrite Mode the oldest logged System message will be overwritten by the new System message when the System Log Full Flag is set to true. While in Discard Mode the new message will be discarded, preserving the contents of the full log." ES: Analyzer Log Start,cES1029,"Upon receipt of a Command, the cFE shall start collecting Logic Analyzer Capture Log data.",Provide capability to start collection of performance data by command. ES: Analyzer Log Set Filter Mask,cES1030,"Upon receipt of a Command, the cFE shall set the Analyzer Log filter mask.",Provide capability to filter collection of performance data by command. ES: Analyzer Log Trigger Mask,cES1031,"Upon receipt of a Command, the cFE shall set the Analyzer Log trigger mask.",Provide capability to set the trigger mask for collection of performance data by command. ES: Task Status Record To File,cES1032,"Upon receipt of a Command, the cFE shall generate a Command specified file that contains the cFE Task information.",Provide capability to write all cFE task data to a file for system status and management. +ES: Task Status Record To File - Default Filename,cES1032.1,"If a file is not specified, the cFE shall use the `` filename.",Provide a default file name. ES: Get Memory Pool Statistics,cES1033,"Upon receipt of a Command, the cFE shall generate a message that contains the requested memory pool statistics.",Supports memory pool management. ES: Register Application,cES1300,"Upon receipt of a Request, the cFE shall register the calling cFE Application with the system.",cFE Applications must register with the cFE in order to allow the cFE to track the Application's resources. This function also allows the system to synchronize the application startup. The cFE Application will wait in this function until the cFE starts up. ES: Report Last Reset,cES1301,"Upon receipt of a Request, the cFE shall provide the type of last reset performed by the processor.",cFE Applications may perform processing that is specific to each reset type. @@ -190,10 +191,7 @@ ES: Processor Reset Preservation List,cES1521,"Upon a Processor Reset, the cFE s - Reset Subtype - Reset Reason - Number of Processor Resets -- Maximum Processor Resets -- Number of entries in System Log -- Size of System Log -- Number of bytes used in the System Log",The purpose of the Executive Services Exception and Reset Log is to log all resets and all exceptions that occur. +- Maximum Processor Resets",The purpose of the Executive Services Exception and Reset Log is to log all resets and all exceptions that occur. ES: Processor Reset Set System Log Mode,cES1522,"Upon a Processor Reset, the cFE shall set the System Log Mode to `` default mode.","Typically want to preserve the System Events that may have captured the cause of the processor reset, but system can be configured as desired." ES: Power On Reset Set System Log Mode,cES1523,"Upon a Power-On Reset, the cFE shall set the System Log Mode to `` default mode.","Typically want to overwrite the System Events during normal operations to store the most recent events, but system can be configured as desired." FS: Read File Header,cES1600,Upon receipt of a Request the cFE shall provide the file header contents of the requested file.,File management support. @@ -229,11 +227,11 @@ EVS: Zero Application Message Sent Count,cEVS3009,"Upon receipt of Command, the EVS: Zero App Filter Counter By Event ID,cEVS3010,"Upon receipt of Command, the cFE shall set an Application's Binary Filter Counter to zero for the Command-specified Event ID.",Clearing an Application's Filtered Event Message Counter is a convenient method for resetting the filter on the event. EVS: Zero App Filter Counters,cEVS3011,"Upon receipt of Command, the cFE shall set all of an Application's Binary Filter Counters to zero.",Having the ability to reset all Application Filtered Event Message Counters is a quick method for resetting all the application's event filters. Note: This command gives operators the ability to reset all exhausted event filters (i.e. send 16 and stop) so that filtered events may be generated once again. EVS: Set App Filter Mask By Event ID,cEVS3012,Upon receipt of Command the cFE shall set an Application's Binary Filter Mask to the Command-specified Event Filter for the given Application Event ID.,Allow an operator to tune the system for a particular operational environment. -EVS: Clear Local Event Log,cEVS3013,"_(OPTIONAL)_ Upon receipt of Command, the cFE shall clear the Local Event Log.",Need to be able to clear the log if the event logging is operating in discard mode. -EVS: Set Event Logging Mode,cEVS3014,"_(OPTIONAL)_ Upon receipt of Command, the cFE shall set the Event Logging Mode to the Command-specified mode, either overwrite or discard.","While in Overwrite Mode the oldest logged event will be overwritten by the new event when the Event Log Full Flag is set to true. While in Discard Mode the new event will be discarded, preserving the contents of the full log. Need the ability to switch between Event Message logging modes." -EVS: Write Local Event Log To File,cEVS3015,"_(OPTIONAL)_ Upon receipt of Command, the cFE shall write the contents of the Local Event Log to the Command specified file.",Allows for ground view of the log. Local Event Log is not intended for operation playback. The main purpose of the Local Event Log is for ground testing. Ground operators may view the data file for playing back stored events. +EVS: Clear Local Event Log,cEVS3013,"Upon receipt of Command, the cFE shall clear the Local Event Log.",Need to be able to clear the log if the event logging is operating in discard mode. +EVS: Set Event Logging Mode,cEVS3014,"Upon receipt of Command, the cFE shall set the Event Logging Mode to the Command-specified mode, either overwrite or discard.","While in Overwrite Mode the oldest logged event will be overwritten by the new event when the Event Log Full Flag is set to true. While in Discard Mode the new event will be discarded, preserving the contents of the full log. Need the ability to switch between Event Message logging modes." +EVS: Write Local Event Log To File,cEVS3015,"Upon receipt of Command, the cFE shall write the contents of the Local Event Log to the Command specified file.",Allows for ground view of the log. Local Event Log is not intended for operation playback. The main purpose of the Local Event Log is for ground testing. Ground operators may view the data file for playing back stored events. EVS: Write Local Event Log To File - Default Filename,cEVS3015.1,"If a file is not specified, the cFE shall use the `` filename.",Want to provide a default in the event that a user does not want to specify one. -EVS: Write Local Event Log Order,cEVS3016,_(OPTIONAL)_ The cFE shall write each Event Message from the earliest logged message to the most recently logged message.,"Ground operators like to see the progression of events in the order that they occurred. In a scenario when a time correction has been made, the earliest logged may not necessarily mean the oldest time stamp. This type of playback may not be desirable for Event Logs of considerable size. It is worthwhile for cFE users to keep Event Logs relatively small." +EVS: Write Local Event Log Order,cEVS3016,The cFE shall write each Event Message from the earliest logged message to the most recently logged message.,"Ground operators like to see the progression of events in the order that they occurred. In a scenario when a time correction has been made, the earliest logged may not necessarily mean the oldest time stamp. This type of playback may not be desirable for Event Logs of considerable size. It is worthwhile for cFE users to keep Event Logs relatively small." EVS: Control Message Port Routing,cEVS3017,"Upon receipt of Command the cFE shall enable/disable, as specified in the Command, the routing of all future Event Messages to the Command specified Event Message Port.","Event Message Output Ports may not be available or needed; therefore the ability to configure sending to an Event Message Port is useful." EVS: Housekeeping Message,cEVS3018,"Upon receipt of a Message, the cFE shall generate a housekeeping message that includes the following Event Services items: @@ -244,9 +242,9 @@ EVS: Housekeeping Message,cEVS3018,"Upon receipt of a Message, the cFE shall gen - Event Message Truncation Counter - Unregistered Application Send Counter - Event Message Output Port Enable Statuses -- _(OPTIONAL)_ Local Event Log Full Flag -- _(OPTIONAL)_ Local Event Log Overflow Counter -- _(OPTIONAL)_ Logging Mode +- Local Event Log Full Flag +- Local Event Log Overflow Counter +- Logging Mode - For each registered Application: o Application Event Message Sent Counter o Application Event Service Enable Status",Generate housekeeping message for system awareness and management. @@ -287,17 +285,17 @@ EVS: Increment Message Sent Counter,cEVS3105,"For each created Event Message, th EVS: Increment Message Sent Counter - Retain Maximum Value,cEVS3105.1,"If the Event Message Sent Counter has reached its maximum value of (2^16)-1 the cFE shall retain the maximum value (i.e. do not rollover to zero).",Preventing a counter rollover to zero eliminates the case when a user may think no events have occurred when in fact many events have occurred. EVS: Zero App Filter Counter By Event ID,cEVS3106,"Upon receipt of a request, the cFE shall set an Application's Binary Filter Counter to zero for the Application request-specified Event ID.",Clearing an Application's Binary Filter Counter is a convenient method for resetting the filter on the event. EVS: Zero App Filter Counters,cEVS3107,"Upon receipt of a request, the cFE shall set all of an Application's Binary Filter Counters to zero for the request-specified Application.",Having the ability to reset all Application Filtered Event Message Counters is a quick method for resetting all the application's event filters. -EVS: Store Message In Event Log,cEVS3108,"_(OPTIONAL)_ For each created Event Message, the cFE shall store the Event Message in the Local Event Log in the Long Event Message Format.",It's useful to save Event Messages when external communications is unavailable. This may occur during system initialization (especially events generated from other cFE components) and during a communications failure. -EVS: Store Message In Event Log - Set Full Flag,cEVS3108.1,"_(OPTIONAL)_ If the Local Event Log becomes full, the cFE shall set the Local Event Log Full Flag to true.",Ground operations needs to know the state of the Local Even Log. -EVS: Store Message In Event Log - Increment Overflow Counter,cEVS3108.2,"_(OPTIONAL)_ If the Local Event Log is full, the cFE shall increment the Local Event Log Overflow counter.",Ground operations needs to know how many Event Messages were discarded or overwritten. -EVS: Store Message In Event Log - Log Full Behavior,cEVS3108.3,"_(OPTIONAL)_ If the Local Event Log is full, the cFE shall either (1) overwrite the oldest Event Message if the Event Logging Mode is overwrite, or (2) discard the Event Message if the Event Logging Mode is discard.",Overwriting the oldest message is useful for nominal operations because a user doesn't need to periodically clear the Log. If an error occurs when there's no communication then the Local Event Log size must be large enough to retain the Event Messages since communications was lost. Discarding the newest Event Message is useful for trouble shooting a problem. For example there may be a problem during processor initialization that occurs when there's no communications with the processor interfacing with the User. In this case the original Event Messages are critical to solving the problem so they should be preserved. Note that the Event Logging Mode can be changed via stored commanding. +EVS: Store Message In Event Log,cEVS3108,"For each created Event Message, the cFE shall store the Event Message in the Local Event Log in the Long Event Message Format.",It's useful to save Event Messages when external communications is unavailable. This may occur during system initialization (especially events generated from other cFE components) and during a communications failure. +EVS: Store Message In Event Log - Set Full Flag,cEVS3108.1,"If the Local Event Log becomes full, the cFE shall set the Local Event Log Full Flag to true.",Ground operations needs to know the state of the Local Even Log. +EVS: Store Message In Event Log - Increment Overflow Counter,cEVS3108.2,"If the Local Event Log is full, the cFE shall increment the Local Event Log Overflow counter.",Ground operations needs to know how many Event Messages were discarded or overwritten. +EVS: Store Message In Event Log - Log Full Behavior,cEVS3108.3,"If the Local Event Log is full, the cFE shall either (1) overwrite the oldest Event Message if the Event Logging Mode is overwrite, or (2) discard the Event Message if the Event Logging Mode is discard.",Overwriting the oldest message is useful for nominal operations because a user doesn't need to periodically clear the Log. If an error occurs when there's no communication then the Local Event Log size must be large enough to retain the Event Messages since communications was lost. Discarding the newest Event Message is useful for trouble shooting a problem. For example there may be a problem during processor initialization that occurs when there's no communications with the processor interfacing with the User. In this case the original Event Messages are critical to solving the problem so they should be preserved. Note that the Event Logging Mode can be changed via stored commanding. EVS: Message Port Routing,cEVS3109,"For each created Event Message, the cFE shall route the Event Message, formatted as an ASCII text string, to each enabled Event Message Output Port.",Debug ports are very useful for FSW development and maintenance. EVS: Initialize Format On Power On Reset,cEVS3201,"Upon a Power-on Reset, the cFE shall set SB Event Format Mode to `` default mode.","Each mission must determine what format they need, defaulted to LONG." -EVS: Initialize Full Flag To False On Power On Reset,cEVS3202,"_(OPTIONAL)_ Upon a Power-on Reset, the cFE shall set the Local Event Log Full Flag to false.",Set cFE to default status across Power-on Resets. -EVS: Initialize Logging Mode On Power On Reset,cEVS3203,"_(OPTIONAL)_ Upon a Power-on Reset, the cFE shall set the Event Logging Mode to ``.",Set cFE to default status across Power-on Resets. -EVS: Preserve Event Log Reset Mode On Processor Reset,cEVS3207,"_(OPTIONAL)_ Upon a Processor Reset, the cFE shall preserve the Event Logging Mode configuration parameter.",Try to retain mode across a processor reset. The contents of the Local Event Log will be preserved if the Event Logging Mode is configured to Discard. The contents of the Local Event Log may be overwritten (depending on the size and contents of the log prior to the reset) if the Event Logging Mode is configured to Overwrite. -EVS: Preserve Log Full State On Processor Reset,cEVS3208,"_(OPTIONAL)_ Upon a Processor Reset, the cFE shall preserve the Local Event Log Full state.",Retain the cFE state across Processor Resets. -EVS: Preserve Log Overflow Counter On Processor Reset,cEVS3210,"_(OPTIONAL)_ Upon a Processor Reset, the cFE shall preserve the Local Event Log Overflow Counter.",Retain the cFE state across Processor Resets. +EVS: Initialize Full Flag To False On Power On Reset,cEVS3202,"Upon a Power-on Reset, the cFE shall set the Local Event Log Full Flag to false.",Set cFE to default status across Power-on Resets. +EVS: Initialize Logging Mode On Power On Reset,cEVS3203,"Upon a Power-on Reset, the cFE shall set the Event Logging Mode to ``.",Set cFE to default status across Power-on Resets. +EVS: Preserve Event Log Reset Mode On Processor Reset,cEVS3207,"Upon a Processor Reset, the cFE shall preserve the Event Logging Mode configuration parameter.",Try to retain mode across a processor reset. The contents of the Local Event Log will be preserved if the Event Logging Mode is configured to Discard. The contents of the Local Event Log may be overwritten (depending on the size and contents of the log prior to the reset) if the Event Logging Mode is configured to Overwrite. +EVS: Preserve Log Full State On Processor Reset,cEVS3208,"Upon a Processor Reset, the cFE shall preserve the Local Event Log Full state.",Retain the cFE state across Processor Resets. +EVS: Preserve Log Overflow Counter On Processor Reset,cEVS3210,"Upon a Processor Reset, the cFE shall preserve the Local Event Log Overflow Counter.",Retain the cFE state across Processor Resets. SB: NOOP Event,cSB4000,"Upon receipt of a Command, the cFE shall generate a NO-OP event message.",This command is useful as a general sub-system aliveness test. SB: Zero Counters,cSB4001,"Upon receipt of Command the cFE shall set to zero the following counters in housekeeping telemetry: @@ -389,7 +387,7 @@ SB: Validate Message ID,cSB4345,"Upon receipt of a Request, the cFE shall provid SB: Initialize Routing On Power On Reset,cSB4500,Upon a Power-on Reset the cFE shall initialize the Routing Information and clear all error counters.,The cFE must initialize to a known state. SB: Initialize Routing On Processor Reset,cSB4501,Upon a Processor Reset the cFE shall initialize the Routing Information and clear all error counters,The cFE must initialize to a known state. TBL: Load Inactive Table From File,cTBL6000,Upon receipt of Command the cFE shall load an Inactive Table Image with the contents of the Command specified File.,Loading from a file allows for multiple versions of a table to be stored on board and loaded to the active table when appropriate. The file header will identify the Table that the file contents are for. -TBL: Load Inactive Table From File - Partial Load,cTBL6000.1,"If the Command specified file's header indicates that the file contains only a portion of the Table, the cFE shall first load an Inactive Table Image with the contents of the Active Table Image and then load the contents of the Command specified File.","A Partial Table load capability is useful when dealing with large Tables. It helps to ensure that additional parameters are not unintentionally modified, reduces command time required to perform a Table update and is a feature that has been used on previous missions." +TBL: Load Inactive Table From File - Partial Load,cTBL6000.1,"If the Command specified file contains only a portion of the Table, the cFE shall first load an Inactive Table Image with the contents of the Active Table Image and then load the contents of the Command specified File.","A Partial Table load capability is useful when dealing with large Tables. It helps to ensure that additional parameters are not unintentionally modified, reduces command time required to perform a Table update and is a feature that has been used on previous missions." TBL: Load Inactive Table From File - Greater Than Max Size,cTBL6000.2,If the number of data bytes contained in the file is greater than the maximum size of the table then the load shall be aborted and an event message shall be generated.,This is a sanity check to make sure that the ground generated table load does not include more data than a table can handle. TBL: Load Inactive Table From File - Header Size Mismatch,cTBL6000.3,If the number of bytes specified in the file's header is not equal to the number of data bytes contained in the file then the load shall be aborted and an event message be generated.,This is another sanity check to make sure that the number of bytes specified in the file header is equal to the number of data bytes in the file. TBL: Load Inactive Table From File - Multiple Partial Loads,cTBL6000.4,The Inactive Table Image shall only be loaded with the contents of the Active Table if the Inactive Table Image has not been initialized.,Want to be able to perform successive partial table loads. The first partial load of a table requires that the inactive table image be initialized with the active table image (see cTBL6000.2). Any subsequent loads should be made with the existing contents of the Inactive Buffer. @@ -499,9 +497,7 @@ TIME: Valid Command Counter,cTIME2003,"Upon receipt of valid command, the cFE sh TIME: Invalid Command Counter,cTIME2004,"Upon receipt of an invalid command, the cFE shall in increment the invalid command counter.",The ground needs an indicator if a command is rejected by the cFE. Details of what makes a command invalid are documented in the cFE User's Guide. TIME: Set Leap Seconds,cTIME2005,Upon receipt of Command the cFE shall set the number of Leap Seconds to the Command-specified value.,The decision to introduce a leap second in UTC is the responsibility of the International Earth Rotation Service (IERS). The count of Leap Seconds has been incremented about every 500 days since 1972. It is therefore likely that a mission will need to update. TIME: Set STCF,cTIME2006,Upon receipt of Command the cFE shall set the STCF to the Command specified value.,"The cFE must be provided with the appropriate correlation factor, that when combined with the current MET and Leap Seconds values, will result in current time. Historically this command has been referred to as 'jam loading' time." -TIME: Update STCF Given Current Time,cTIME2007,Upon receipt of Command the cFE shall compute a new value for STCF using the Command-specified value as current time.,"This command provides a useful alternative to setting the STCF -explicitly, as the command does not require knowledge of the current MET value. If the default time format is TAI then the new value for STCF is the -Command-specified time value less MET." +TIME: Update STCF Given Current Time,cTIME2007,Upon receipt of Command the cFE shall compute a new value for STCF using the Command-specified value as current time.,"This command provides a useful alternative to setting the STCF explicitly, as the command does not require knowledge of the current MET value. If the default time format is TAI then the new value for STCF is the Command-specified time value less MET." TIME: Delta Adjust STCF,cTIME2009,Upon receipt of Command the cFE shall make a continuous 1Hz delta adjustment to the STCF by the Command-specified value.,"Upon receipt of a Command to make a 'continuous' adjustment to the STCF, the cFE shall adjust the STCF each second by the Command-specified value. The commanded value is signed so a positive or negative adjustment may be made." TIME: Switch Tone Signal Source,cTIME2010,Upon receipt of Command the cFE shall switch to the Command-specified Tone Signal source.,"The behavior of this command is hardware specific, but provides the capability to command Tone Signal source selection if implemented at the hardware level." TIME: Diagnostic Message,cTIME2011,Upon receipt of Command the cFE shall generate a Software Bus message that includes time diagnostic information.,"When testing or debugging the time application, more details about time services are required." diff --git a/docs/src/cfs_versions.dox b/docs/src/cfs_versions.dox index ddd7593a1..06853530d 100644 --- a/docs/src/cfs_versions.dox +++ b/docs/src/cfs_versions.dox @@ -4,93 +4,64 @@

Version Number Semantics

The version number is a sequence of four numbers, generally separated by dots when written. These are, in order, - the Major number, the Minor number, the Revision number, and the Mission Revision number. Missions may modify the Mission Revision information as needed to suit their needs. + the Major number, the Minor number, the Revision number, and the Mission Revision number. - It is important to note that Major, Minor, and Revision numbers are only updated upon official releases of tagged - versions, \b NOT on development builds. We aim to follow the Semantic Versioning v2.0 specification with our versioning. + It is important to note that version numbers are only updated upon official releases of tagged + versions, \b NOT on development builds. We aim to follow the Semantic Versioning v2.0 specification + with our versioning. - The MAJOR number shall be incremented on release to indicate when there is a change to an API + The MAJOR number is incremented on release to indicate when there is a change to an API that may cause existing, correctly-written cFS components to stop working. It may also be incremented for a release that contains changes deemed to be of similar impact, even if there are no actual changes to the API. - The MINOR number shall be incremented on release to indicate the addition of features to the API + The MINOR number is incremented on release to indicate the addition of features to the API which do not break the existing code. It may also be incremented for a release that contains changes deemed to be of similar impact, even if there are no actual updates to the API. - The REVISION number shall be incremented on changes that benefit from unique identification such as bug fixes or major documentation updates. - The Revision number may also be updated if there are other changes contained within a release that make it desirable for applications to distinguish one release from another. - WARNING: The revision number is set to the number 99 in development builds. To distinguish between development builds refer to the BUILD_NUMBER and BUILD_BASELINE detailed in the section "Identifying Development Builds". + The REVISION number shall be incremented on changes that benefit from unique identification such as + bug fixes or major documentation updates. + The Revision number may also be updated if there are other changes contained within a release that make + it desirable for applications to distinguish one release from another. + WARNING: The revision number is set to the number 99 in development builds. To distinguish between development + builds refer to the BUILD_NUMBER and BUILD_BASELINE detailed in the section "Identifying Development Builds". - The Major, Minor, and Revision numbers are provided in this header file as part of the API - definition; this macro must expand to a simple integer value, so that it can be used in simple if directives by the macro preprocessor. - - The Mission Version number shall be set to zero in all officially released packages, and is entirely reserved for the use of the mission. The Mission Version is provided as a simple macro defined in the cfe_platform_cfg.h header file. - -

Version Number Flexibility

- - The major number may increment when there is no breaking change to the API, if the changes are significant enough to - warrant the same level of attention as a breaking API change. - - The minor number may increment when there have been no augmentations to the API, if changes are as significant as - additions to the public API. - - The revision numbers may increment in implementations where no actual implementation-specific code has changed, if - there are other changes within the release with similar significance. + The Mission Version number is set to zero in all official releases, and is reserved for the mission use.

How and Where Defined

- The Major, Minor, and Revision components of the version are provided as simple macros defined in the cfe_version.h header file as part of the API definition; these macros must expand to simple integer values, so that they can be used in simple if directives by the macro preprocessor. + The version numbers are provided as simple macros defined in the cfe_version.h header file as part of the + API definition; these macros must expand to simple integer values, so that they can be used in simple if + directives by the macro preprocessor. - The Mission Version is provided as a simple macro defined in the cfe_platform_cfg.h header file. As delivered in official releases, these macros must expand to simple integer values, so that they can be used in simple macro preprocessor conditions, but delivered code should not prevent a mission from, for example, deciding that the Mission Version is actually a text string. + Note the Mission Version number is provided for missions to be able to identify unique changes they + have made to the released software (via clone and own).

Identifying Development Builds

In order to distinguish between development versions, we also provide a BUILD_NUMBER. The BUILD_NUMBER reflects the number of commits since the BUILD_BASELINE, a baseline git tag, for each particular - component. The BUILD_NUMBER integer increases monotonically for a given development cycle. The BUILD_BASELINE identifies the current development cycle and is a git tag with format vX.Y.Z. The Codename used in the version string also refers to the current development cycle. When a new baseline tag and codename are created, the the BUILD_NUMBER resets to zero and begins increasing - from a new baseline. - -

Templates for the version and version string

- - The following templates are the code to be used in cfe_version.h for either official releases or development builds. The apps and repositories follow the same pattern by replacing the CFE_ prefix with the appropriate name; for example, osal uses OS_, psp uses CFE_PSP_IMPL, and so on. - -

Template for Official Releases

- - \verbatim - - /* Template for Development Builds - - \verbatim - - /*! @brief Development Build Version Number. - * Baseline git tag + Number of commits since baseline. @n - * See cfs_versions.dox for format differences between development and release versions. - */ - #define CFE_SRC_VERSION \ - CFE_BUILD_BASELINE CFE_STR(CFE_BUILD_NUMBER) - - /*! @brief Development Build Version String. - * Reports the current development build's baseline, number, and name. Also includes a note about the latest official version. @n - * See cfs_versions.dox for format differences between development and release versions. - */ - #define CFE_VERSION_STRING \ - " cFE Development Build " \ - CFE_SRC_VERSION " (Codename: CONSTELLATION_NAME)" /* Codename for current development */ \ - ", Last Official Release: cfe vX.Y.Z" /* For full support please use this version */ - - \endverbatim + component. The BUILD_NUMBER integer monotonically increases for a given baseline. The BUILD_BASELINE + identifies the current development cycle and is a git tag with format vX.Y.Z. The Codename used in the version + string also refers to the current development cycle. When a new baseline tag and codename are created, the the + BUILD_NUMBER resets to zero and begins increasing from a new baseline. + +

Templates for the short and long version string

+ + See cfe_version.h for the standard layout and definition of version information. + The apps and repositories follow the same pattern by replacing the CFE_ prefix with the appropriate + name; for example, osal uses OS_, psp uses CFE_PSP_IMPL, and so on. + + Suggested pattern for development: + - XXX_SRC_VERSION: REFRENCE_GIT_TAG"+dev"BUILD_NUMBER + - Example: "v6.8.0-rc1+dev123" + - XXX_VERSION_STRING: "XXX DEVELOPMENT BUILD "XXX_SRC_VERSION" (Codename: YYY), Last Official Release: ZZZ" + - Example: "cFE DEVELOPMENT BUILD v6.8.0-rc1+dev123 (Codename: Bootes), Last Official Release: cfe v6.7.0" + + Suggested pattern for official releases: + - XXX_SRC_VERSION: OFFICIAL_GIT_TAG + - Example: "v7.0.0" + - XXX_VERSION_STRING: "XXX OFFICIAL RELEASE "XXX_SRC_VERSION" (Codename: YYY)" + - Example: "cFE OFFICIAL RELEASE v7.0.0 (Codename: Caelum)" **/ diff --git a/modules/cfe_assert/src/cfe_assert_init.c b/modules/cfe_assert/src/cfe_assert_init.c index d2852d92d..3e37a3c04 100644 --- a/modules/cfe_assert/src/cfe_assert_init.c +++ b/modules/cfe_assert/src/cfe_assert_init.c @@ -59,7 +59,7 @@ int32 CFE_Assert_LibInit(CFE_ES_LibId_t LibId) status = OS_MutSemCreate(&CFE_Assert_Global.AccessMutex, "CFE_Assert", 0); if (status != OS_SUCCESS) { - CFE_ES_WriteToSysLog("%s(): OS_MutSemCreate failed, rc=%d\n", __func__, (int)status); + CFE_ES_WriteToSysLog("%s: OS_MutSemCreate failed, rc=%d\n", __func__, (int)status); return CFE_STATUS_EXTERNAL_RESOURCE_FAIL; } diff --git a/modules/cfe_assert/src/cfe_assert_io.c b/modules/cfe_assert/src/cfe_assert_io.c index a9561222b..2d36d7099 100644 --- a/modules/cfe_assert/src/cfe_assert_io.c +++ b/modules/cfe_assert/src/cfe_assert_io.c @@ -38,6 +38,28 @@ CFE_Assert_Global_t CFE_Assert_Global; +void UT_BSP_Lock(void) +{ + int32 rc; + + rc = OS_MutSemTake(CFE_Assert_Global.AccessMutex); + if (rc != CFE_SUCCESS) + { + CFE_ES_WriteToSysLog("%s(): Error from OS_MutSemTake(): %d\n", __func__, (int)rc); + } +} + +void UT_BSP_Unlock(void) +{ + int32 rc; + + rc = OS_MutSemGive(CFE_Assert_Global.AccessMutex); + if (rc != CFE_SUCCESS) + { + CFE_ES_WriteToSysLog("%s(): Error from OS_MutSemTake(): %d\n", __func__, (int)rc); + } +} + void UT_BSP_Setup(void) { CFE_Assert_Global.CurrVerbosity = (2 << UTASSERT_CASETYPE_PASS) - 1; diff --git a/modules/cfe_assert/src/cfe_assert_runner.c b/modules/cfe_assert/src/cfe_assert_runner.c index 2d58daf46..21984a78c 100644 --- a/modules/cfe_assert/src/cfe_assert_runner.c +++ b/modules/cfe_assert/src/cfe_assert_runner.c @@ -102,14 +102,15 @@ void CFE_Assert_StatusReport(uint8 MessageType, const char *Prefix, const char * int32 CFE_Assert_RegisterTest(const char *TestName) { - int32 rc; - char SetupSegmentName[64]; + int32 rc; + char SetupSegmentName[64]; + CFE_ES_AppId_t SelfId; rc = CFE_EVS_Register(CFE_TR_EventFilters, sizeof(CFE_TR_EventFilters) / sizeof(CFE_EVS_BinFilter_t), CFE_EVS_EventFilter_BINARY); if (rc != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("Error from CFE_EVS_Register: %08lx\n", (unsigned long)rc); + CFE_ES_WriteToSysLog("%s: Error from CFE_EVS_Register: %08lx\n", __func__, (unsigned long)rc); return rc; } @@ -123,7 +124,14 @@ int32 CFE_Assert_RegisterTest(const char *TestName) rc = CFE_ES_WaitForSystemState(CFE_ES_SystemState_OPERATIONAL, CFE_TESTRUNNER_MAX_STARTUP_WAIT); if (rc != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("Error while waiting for OPERATIONAL state: %08lx\n", (unsigned long)rc); + CFE_ES_WriteToSysLog("%s: Error while waiting for OPERATIONAL state: %08lx\n", __func__, (unsigned long)rc); + return rc; + } + + rc = CFE_ES_GetAppID(&SelfId); + if (rc != CFE_SUCCESS) + { + CFE_ES_WriteToSysLog("%s(): Error from CFE_ES_GetAppId(): %08x\n", __func__, (unsigned int)rc); return rc; } @@ -131,24 +139,25 @@ int32 CFE_Assert_RegisterTest(const char *TestName) * Acquire the mutex. This is needed because UtAssert and its data structures are not thread-safe. * Only one test app should use UtAssert facilities at a given time. */ - rc = OS_MutSemTake(CFE_Assert_Global.AccessMutex); - if (rc != CFE_SUCCESS) - { - CFE_ES_WriteToSysLog("%s(): Error from OS_MutSemTake(): %d\n", __func__, (int)rc); - return CFE_STATUS_EXTERNAL_RESOURCE_FAIL; - } + UT_BSP_Lock(); /* - * After acquiring mutex, record the fact that this app now "owns" the assert functions + * Wait here until "OwnerAppId" is available/undefined */ - rc = CFE_ES_GetAppID(&CFE_Assert_Global.OwnerAppId); - if (rc != CFE_SUCCESS) + while (CFE_RESOURCEID_TEST_DEFINED(CFE_Assert_Global.OwnerAppId)) { - CFE_ES_WriteToSysLog("%s(): Error from CFE_ES_GetAppId(): %08x\n", __func__, (unsigned int)rc); - OS_MutSemGive(CFE_Assert_Global.AccessMutex); - return rc; + UT_BSP_Unlock(); + OS_TaskDelay(100); + UT_BSP_Lock(); } + /* + * After acquiring mutex, record the fact that this app now owns the assert functions + */ + CFE_Assert_Global.OwnerAppId = SelfId; + + UT_BSP_Unlock(); + /* * This means the system is operational and at least one app needs to run tests. * Update library state accordingly. The first test app that gets to this point @@ -197,7 +206,7 @@ void CFE_Assert_ExecuteTest(void) rc = CFE_ES_GetAppID(&AppId); if (rc != CFE_SUCCESS || !CFE_RESOURCEID_TEST_EQUAL(AppId, CFE_Assert_Global.OwnerAppId)) { - CFE_ES_WriteToSysLog("%s(): Invalid calling context, CFE_ES_GetAppId() rc=%08x AppId=%lx, OwnerAppId=%lx\n", + CFE_ES_WriteToSysLog("%s: Invalid calling context, CFE_ES_GetAppId() rc=%08x AppId=%lx, OwnerAppId=%lx\n", __func__, (unsigned int)rc, CFE_RESOURCEID_TO_ULONG(AppId), CFE_RESOURCEID_TO_ULONG(CFE_Assert_Global.OwnerAppId)); return; @@ -211,12 +220,8 @@ void CFE_Assert_ExecuteTest(void) UtTest_Run(); /* unregister the callback and unset the appid */ + UT_BSP_Lock(); CFE_Assert_RegisterCallback(NULL); - - /* Release the access mutex so the next test program can run */ - rc = OS_MutSemGive(CFE_Assert_Global.AccessMutex); - if (rc != CFE_SUCCESS) - { - CFE_ES_WriteToSysLog("%s(): Error from OS_MutSemGive(): %d\n", __func__, (int)rc); - } + CFE_Assert_Global.OwnerAppId = CFE_ES_APPID_UNDEFINED; + UT_BSP_Unlock(); } diff --git a/modules/cfe_testcase/CMakeLists.txt b/modules/cfe_testcase/CMakeLists.txt index d93898691..02df7b00e 100644 --- a/modules/cfe_testcase/CMakeLists.txt +++ b/modules/cfe_testcase/CMakeLists.txt @@ -5,6 +5,8 @@ add_cfe_app(cfe_testcase src/es_info_test.c src/es_task_test.c src/es_cds_test.c + src/es_misc_test.c + src/es_mempool_test.c src/fs_header_test.c src/time_current_test.c ) diff --git a/modules/cfe_testcase/src/cfe_test.c b/modules/cfe_testcase/src/cfe_test.c index d68d65756..445096e60 100644 --- a/modules/cfe_testcase/src/cfe_test.c +++ b/modules/cfe_testcase/src/cfe_test.c @@ -53,6 +53,8 @@ void CFE_TestMain(void) ESInfoTestSetup(); ESTaskTestSetup(); ESCDSTestSetup(); + ESMiscTestSetup(); + ESMemPoolTestSetup(); FSHeaderTestSetup(); TimeCurrentTestSetup(); diff --git a/modules/cfe_testcase/src/cfe_test.h b/modules/cfe_testcase/src/cfe_test.h index e99090141..ef3edc5b2 100644 --- a/modules/cfe_testcase/src/cfe_test.h +++ b/modules/cfe_testcase/src/cfe_test.h @@ -56,6 +56,8 @@ void CFE_TestMain(void); void ESInfoTestSetup(void); void ESTaskTestSetup(void); void ESCDSTestSetup(void); +void ESMiscTestSetup(void); +void ESMemPoolTestSetup(void); void FSHeaderTestSetup(void); void TimeCurrentTestSetup(void); diff --git a/modules/cfe_testcase/src/es_mempool_test.c b/modules/cfe_testcase/src/es_mempool_test.c new file mode 100644 index 000000000..f6542eaf6 --- /dev/null +++ b/modules/cfe_testcase/src/es_mempool_test.c @@ -0,0 +1,157 @@ +/************************************************************************* +** +** GSC-18128-1, "Core Flight Executive Version 6.7" +** +** Copyright (c) 2006-2019 United States Government as represented by +** the Administrator of the National Aeronautics and Space Administration. +** All Rights Reserved. +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +** +** File: es_info_test.c +** +** Purpose: +** Functional test of basic ES Mempool APIs +** +** Demonstration of how to register and use the UT assert functions. +** +*************************************************************************/ + +/* + * Includes + */ + +#include "cfe_test.h" + +void TestMemPoolCreate(void) +{ + CFE_ES_MemHandle_t PoolID; + int8 Pool[1024]; + + UtPrintf("Testing: CFE_ES_PoolCreateNoSem, CFE_ES_PoolCreate, CFE_ES_PoolCreateEx"); + + UtAssert_INT32_EQ(CFE_ES_PoolCreateNoSem(&PoolID, Pool, sizeof(Pool)), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_ES_PoolCreateNoSem(NULL, Pool, sizeof(Pool)), CFE_ES_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_ES_PoolCreateNoSem(&PoolID, NULL, sizeof(Pool)), CFE_ES_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_ES_PoolCreateNoSem(&PoolID, Pool, 0), CFE_ES_BAD_ARGUMENT); + + UtAssert_INT32_EQ(CFE_ES_PoolCreate(&PoolID, Pool, sizeof(Pool)), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_ES_PoolCreate(NULL, Pool, sizeof(Pool)), CFE_ES_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_ES_PoolCreate(&PoolID, NULL, sizeof(Pool)), CFE_ES_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_ES_PoolCreate(&PoolID, Pool, 0), CFE_ES_BAD_ARGUMENT); + + UtAssert_INT32_EQ(CFE_ES_PoolCreateEx(&PoolID, Pool, sizeof(Pool), 0, NULL, CFE_ES_NO_MUTEX), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_ES_PoolCreateEx(NULL, Pool, sizeof(Pool), 0, NULL, CFE_ES_NO_MUTEX), CFE_ES_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_ES_PoolCreateEx(&PoolID, NULL, sizeof(Pool), 0, NULL, CFE_ES_NO_MUTEX), CFE_ES_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_ES_PoolCreateEx(&PoolID, Pool, 0, 0, NULL, CFE_ES_NO_MUTEX), CFE_ES_BAD_ARGUMENT); + + UtAssert_INT32_EQ(CFE_ES_PoolDelete(PoolID), CFE_SUCCESS); +} + +void TestMemPoolGetBuf(void) +{ + CFE_ES_MemHandle_t PoolID; + int8 Pool[1024]; + size_t Buffer = 512; + size_t BufferBig = 2048; + CFE_ES_MemPoolBuf_t addressp = CFE_ES_MEMPOOLBUF_C(0); + + UtPrintf("Testing: TestMemPoolGetBuf"); + + UtAssert_INT32_EQ(CFE_ES_PoolCreate(&PoolID, Pool, sizeof(Pool)), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_ES_GetPoolBuf(&addressp, PoolID, Buffer), Buffer); + + UtAssert_INT32_EQ(CFE_ES_GetPoolBuf(NULL, PoolID, Buffer), CFE_ES_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_ES_GetPoolBuf(&addressp, CFE_ES_MEMHANDLE_UNDEFINED, Buffer), + CFE_ES_ERR_RESOURCEID_NOT_VALID); + + UtAssert_INT32_EQ(CFE_ES_GetPoolBuf(&addressp, PoolID, Buffer), CFE_ES_ERR_MEM_BLOCK_SIZE); + UtAssert_INT32_EQ(CFE_ES_PutPoolBuf(PoolID, addressp), Buffer); + + UtAssert_INT32_EQ(CFE_ES_GetPoolBuf(&addressp, PoolID, BufferBig), CFE_ES_ERR_MEM_BLOCK_SIZE); + + UtAssert_INT32_EQ(CFE_ES_PoolDelete(PoolID), CFE_SUCCESS); +} + +void TestMemPoolBufInfo(void) +{ + CFE_ES_MemHandle_t PoolID; + int8 Pool[1024]; + size_t Buffer = 512; + CFE_ES_MemPoolBuf_t addressp = CFE_ES_MEMPOOLBUF_C(0); + + UtPrintf("Testing: CFE_ES_GetPoolBufInfo"); + + UtAssert_INT32_EQ(CFE_ES_PoolCreate(&PoolID, Pool, sizeof(Pool)), CFE_SUCCESS); + + UtAssert_INT32_EQ(CFE_ES_GetPoolBufInfo(PoolID, addressp), CFE_ES_BAD_ARGUMENT); + + UtAssert_INT32_EQ(CFE_ES_GetPoolBuf(&addressp, PoolID, Buffer), Buffer); + UtAssert_INT32_EQ(CFE_ES_GetPoolBufInfo(PoolID, addressp), Buffer); + + UtAssert_INT32_EQ(CFE_ES_GetPoolBufInfo(CFE_ES_MEMHANDLE_UNDEFINED, addressp), CFE_ES_ERR_RESOURCEID_NOT_VALID); + UtAssert_INT32_EQ(CFE_ES_GetPoolBufInfo(PoolID, NULL), CFE_ES_BAD_ARGUMENT); + + UtAssert_INT32_EQ(CFE_ES_PoolDelete(PoolID), CFE_SUCCESS); +} + +void TestMemPoolPutBuf(void) +{ + CFE_ES_MemHandle_t PoolID; + int8 Pool[1024]; + size_t Buffer = 512; + CFE_ES_MemPoolBuf_t addressp = CFE_ES_MEMPOOLBUF_C(0); + + UtPrintf("Testing: CFE_ES_PutPoolBuf"); + + UtAssert_INT32_EQ(CFE_ES_PoolCreate(&PoolID, Pool, sizeof(Pool)), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_ES_GetPoolBuf(&addressp, PoolID, Buffer), Buffer); + UtAssert_INT32_EQ(CFE_ES_PutPoolBuf(PoolID, addressp), Buffer); + + UtAssert_INT32_EQ(CFE_ES_PutPoolBuf(PoolID, addressp), CFE_ES_POOL_BLOCK_INVALID); + UtAssert_INT32_EQ(CFE_ES_PutPoolBuf(CFE_ES_MEMHANDLE_UNDEFINED, addressp), CFE_ES_ERR_RESOURCEID_NOT_VALID); + UtAssert_INT32_EQ(CFE_ES_PutPoolBuf(PoolID, NULL), CFE_ES_BAD_ARGUMENT); + + UtAssert_INT32_EQ(CFE_ES_GetPoolBuf(&addressp, PoolID, Buffer), Buffer); + + UtAssert_INT32_EQ(CFE_ES_PoolDelete(PoolID), CFE_SUCCESS); +} + +void TestMemPoolDelete(void) +{ + CFE_ES_MemHandle_t PoolID; /* Poo1 1 handle, no mutex */ + uint8 Buffer[1024]; + CFE_ES_MemPoolStats_t Stats; + + UtPrintf("Testing: CFE_ES_PoolDelete, CFE_ES_GetMemPoolStats, CFE_ES_PoolCreateEx"); + + UtAssert_INT32_EQ(CFE_ES_PoolCreateEx(&PoolID, Buffer, sizeof(Buffer), 0, NULL, CFE_ES_NO_MUTEX), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_ES_GetMemPoolStats(&Stats, PoolID), CFE_SUCCESS); + + UtAssert_UINT32_EQ(Stats.PoolSize, sizeof(Buffer)); + UtAssert_UINT32_EQ(Stats.NumBlocksRequested, 0); + UtAssert_UINT32_EQ(Stats.CheckErrCtr, 0); + UtAssert_UINT32_EQ(Stats.NumFreeBytes, sizeof(Buffer)); + + UtAssert_INT32_EQ(CFE_ES_PoolDelete(PoolID), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_ES_GetMemPoolStats(&Stats, PoolID), CFE_ES_ERR_RESOURCEID_NOT_VALID); +} + +void ESMemPoolTestSetup(void) +{ + UtTest_Add(TestMemPoolCreate, NULL, NULL, "Test Mem Pool Create"); + UtTest_Add(TestMemPoolGetBuf, NULL, NULL, "Test Mem Pool Get Buf"); + UtTest_Add(TestMemPoolBufInfo, NULL, NULL, "Test Mem Pool Buf Info"); + UtTest_Add(TestMemPoolPutBuf, NULL, NULL, "Test Mem Pool Put Buf"); + UtTest_Add(TestMemPoolDelete, NULL, NULL, "Test Mem Pool Delete"); +} diff --git a/modules/cfe_testcase/src/es_misc_test.c b/modules/cfe_testcase/src/es_misc_test.c new file mode 100644 index 000000000..f86d660d6 --- /dev/null +++ b/modules/cfe_testcase/src/es_misc_test.c @@ -0,0 +1,75 @@ +/************************************************************************* +** +** GSC-18128-1, "Core Flight Executive Version 6.7" +** +** Copyright (c) 2006-2019 United States Government as represented by +** the Administrator of the National Aeronautics and Space Administration. +** All Rights Reserved. +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +** +** File: es_misc_test.c +** +** Purpose: +** Functional test of basic ES Miscellaneous APIs +** +** Demonstration of how to register and use the UT assert functions. +** +*************************************************************************/ + +/* + * Includes + */ + +#include "cfe_test.h" + +void TestCalculateCRC(void) +{ + const char *Data = "Random Stuff"; + uint8 Data2[12]; + uint32 expectedCrc = 20824; + uint32 inputCrc = 345353; + uint32 expectedBlockCrc = 2688; + + UtPrintf("Testing: CFE_ES_CalculateCRC"); + + UtAssert_UINT32_EQ(CFE_ES_CalculateCRC(Data, sizeof(Data), 0, CFE_MISSION_ES_DEFAULT_CRC), expectedCrc); + + memset(Data2, 1, sizeof(Data2)); + UtAssert_UINT32_EQ(CFE_ES_CalculateCRC(&Data2, sizeof(Data2), inputCrc, CFE_MISSION_ES_CRC_16), expectedBlockCrc); + + UtAssert_UINT32_EQ(CFE_ES_CalculateCRC(Data, sizeof(Data), 0, CFE_MISSION_ES_CRC_8), 0); + UtAssert_UINT32_EQ(CFE_ES_CalculateCRC(Data, sizeof(Data), 0, CFE_MISSION_ES_CRC_32), 0); + + UtAssert_UINT32_EQ(CFE_ES_CalculateCRC(NULL, sizeof(Data), expectedCrc, CFE_MISSION_ES_CRC_16), expectedCrc); + UtAssert_UINT32_EQ(CFE_ES_CalculateCRC(Data, 0, expectedBlockCrc, CFE_MISSION_ES_CRC_16), expectedBlockCrc); +} + +void TestWriteToSysLog(void) +{ + const char *TestString = "Test String for CFE_ES_WriteToSysLog Functional Test"; + + UtPrintf("Testing: CFE_ES_WriteToSysLog"); + CFE_ES_WriteToSysLog("MIR (Manual Inspection Required) for CFE_ES_WriteToSysLog"); + CFE_ES_WriteToSysLog(NULL); + CFE_ES_WriteToSysLog("%s", TestString); + + UtAssertEx(false, UTASSERT_CASETYPE_MIR, __FILE__, __LINE__, "%s", + "MIR (Manual Inspection Required) for CFE_ES_WriteToSysLog"); +} + +void ESMiscTestSetup(void) +{ + UtTest_Add(TestCalculateCRC, NULL, NULL, "Test Calculate CRC"); + UtTest_Add(TestWriteToSysLog, NULL, NULL, "Test Write To Sys Log"); +} diff --git a/modules/cfe_testcase/src/fs_header_test.c b/modules/cfe_testcase/src/fs_header_test.c index 72404440b..ec92eb348 100644 --- a/modules/cfe_testcase/src/fs_header_test.c +++ b/modules/cfe_testcase/src/fs_header_test.c @@ -93,7 +93,7 @@ void TestTimeStamp(void) CFE_FS_InitHeader(&Header, TestDescription, CFE_FS_SubType_ES_ERLOG); UtAssert_INT32_EQ(CFE_FS_WriteHeader(fd, &Header), sizeof(CFE_FS_Header_t)); - UtAssert_INT32_EQ(CFE_FS_SetTimestamp(fd, NewTimestamp), OS_SUCCESS); + UtAssert_INT32_EQ(CFE_FS_SetTimestamp(fd, NewTimestamp), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_FS_ReadHeader(&ReadHeader, fd), sizeof(CFE_FS_Header_t)); UtAssert_INT32_EQ(10, ReadHeader.TimeSeconds); diff --git a/modules/core_api/fsw/inc/cfe_es.h b/modules/core_api/fsw/inc/cfe_es.h index 957838aff..4145cbb01 100644 --- a/modules/core_api/fsw/inc/cfe_es.h +++ b/modules/core_api/fsw/inc/cfe_es.h @@ -355,7 +355,9 @@ void CFE_ES_ExitApp(uint32 ExitStatus); ** the system. ** ** \par Assumptions, External Events, and Notes: -** None +** This API updates the internal task counter tracked by ES for the calling task. +** For ES to report application counters correctly this API should be called +** from the main app task as part of it's main processing loop. ** ** \param[in] RunStatus A pointer to a variable containing the Application's ** desired run status. Acceptable values are: @@ -387,14 +389,13 @@ bool CFE_ES_RunLoop(uint32 *RunStatus); ** to satisfy the global system state it is waiting for, and the apps own ** state will be updated accordingly. ** +** \param[in] MinSystemState Determine the state of the App ** \param[in] TimeOutMilliseconds The timeout value in Milliseconds. ** This parameter must be at least 1000. Lower values ** will be rounded up. There is not an option to ** wait indefinitely to avoid hanging a critical ** application because a non-critical app did not start. ** -** \param[in] MinSystemState Determine the state of the App -** ** \return Execution status, see \ref CFEReturnCodes ** \retval #CFE_SUCCESS State successfully achieved ** \retval #CFE_ES_OPERATION_TIMED_OUT Timeout was reached @@ -794,8 +795,7 @@ int32 CFE_ES_GetModuleInfo(CFE_ES_AppInfo_t *ModuleInfo, CFE_ResourceId_t Resour ** \param[in] StackSize The number of bytes to allocate for the new task's stack. ** ** \param[in] Priority The priority for the new task. Lower numbers are higher priority, with 0 being -** the highest priority. Applications cannot create tasks with a higher priority -** (lower number) than their own priority. +** the highest priority. ** ** \param[in] Flags Reserved for future expansion. ** @@ -1491,7 +1491,8 @@ void CFE_ES_PerfLogAdd(uint32 Marker, uint32 EntryExit); ** \brief Register a generic counter ** ** \par Description -** This routine registers a generic counter. +** This routine registers a generic thread-safe counter which +** can be used for inter-task management. ** ** \par Assumptions, External Events, and Notes: ** None. diff --git a/modules/core_api/fsw/inc/cfe_fs.h b/modules/core_api/fsw/inc/cfe_fs.h index 13aa0f103..1fd3d1bd1 100644 --- a/modules/core_api/fsw/inc/cfe_fs.h +++ b/modules/core_api/fsw/inc/cfe_fs.h @@ -64,7 +64,7 @@ ** \param[in] FileDes File Descriptor obtained from a previous call to #OS_OpenCreate ** that is associated with the file whose header is to be read. ** -** \return Execution status, see \ref CFEReturnCodes +** \return Bytes read or error status, see \ref CFEReturnCodes ** ** \sa #CFE_FS_WriteHeader ** @@ -124,7 +124,7 @@ void CFE_FS_InitHeader(CFE_FS_Header_t *Hdr, const char *Description, uint32 Sub ** filled with the contents of the Standard cFE File Header. *Hdr is the contents of the ** Standard cFE File Header for the specified file. ** -** \return Execution status, see \ref CFEReturnCodes +** \return Bytes written or error status, see \ref CFEReturnCodes ** ** \sa #CFE_FS_ReadHeader ** diff --git a/modules/core_api/fsw/inc/cfe_tbl.h b/modules/core_api/fsw/inc/cfe_tbl.h index f56770276..abb46723b 100644 --- a/modules/core_api/fsw/inc/cfe_tbl.h +++ b/modules/core_api/fsw/inc/cfe_tbl.h @@ -224,14 +224,25 @@ CFE_Status_t CFE_TBL_Share(CFE_TBL_Handle_t *TblHandlePtr, const char *TblName); /*****************************************************************************/ /** -** \brief Unregister a previously registered table and free associated resources +** \brief Unregister a table ** ** \par Description -** When an application is being removed from the system, it should -** unregister those tables that it created. The application should -** call this function as a part of its cleanup process. The table -** will be removed from memory once all table addresses referencing -** it have been released. +** When an application is being removed from the system, ES will +** clean up/free all the application related resources including tables +** so apps are not required to call this function. +** +** A valid use-case for this API is to unregister a shared table if +** access is no longer needed or the owning application was removed from +** the system (CS app is an example). +** +** Typically apps should only register tables during initialization and +** registration/unregistration by the owning application during operation +** should be avoided. If unavoidable, special care needs to be taken +** (especially for shared tables) to avoid race conditions due to +** competing requests from mutiple tasks. +** +** Note the table will not be removed from memory until all table access +** links have been removed (registration and all shared access). ** ** \par Assumptions, External Events, and Notes: ** None diff --git a/modules/core_api/fsw/inc/cfe_version.h b/modules/core_api/fsw/inc/cfe_version.h index e1b71a6d3..99d3c674c 100644 --- a/modules/core_api/fsw/inc/cfe_version.h +++ b/modules/core_api/fsw/inc/cfe_version.h @@ -21,41 +21,40 @@ /** * @file * - * Provide version identifiers for the cFE core. + * Provide version identifiers for the cFE core. See @ref cfsversions for further details. */ #ifndef CFE_VERSION_H #define CFE_VERSION_H /* Development Build Macro Definitions */ -#define CFE_BUILD_NUMBER 642 /*!< Development Build: Number of commits since baseline */ -#define CFE_BUILD_BASELINE \ - "v6.8.0-rc1" /*!< Development Build: git tag that is the base for the current development \ - */ - -/* Version Macro Definitions */ -#define CFE_MAJOR_VERSION 6 /*!< @brief ONLY APPLY for OFFICIAL releases. Major version number. */ -#define CFE_MINOR_VERSION 7 /*!< @brief ONLY APPLY for OFFICIAL releases. Minor version number. */ -#define CFE_REVISION \ - 99 /*!< @brief ONLY APPLY for OFFICIAL releases. Revision version number. A value of "99" indicates a development \ - version. */ -#define CFE_MISSION_REV 0 /*!< @brief ONLY USED by MISSION Implementations. Mission revision */ - -#define CFE_STR_HELPER(x) #x /*!< @brief Helper function to concatenate strings from integer macros */ -#define CFE_STR(x) CFE_STR_HELPER(x) /*!< @brief Helper function to concatenate strings from integer macros */ - -/*! @brief Development Build Version Number. - * @details Baseline git tag + Number of commits since baseline. @n - * See @ref cfsversions for format differences between development and release versions. +#define CFE_BUILD_NUMBER 693 /**< @brief Development: Number of development commits since baseline */ +#define CFE_BUILD_BASELINE "v6.8.0-rc1" /**< @brief Development: Reference git tag for build number */ + +/* Version Macro Definitions updated for official releases only */ +#define CFE_MAJOR_VERSION 6 /**< @brief Major release version (Former for Revision == 99) */ +#define CFE_MINOR_VERSION 7 /**< @brief Minor release version (Former for Revision == 99) */ +#define CFE_REVISION 99 /**< @brief Revision, 99 indicates development */ +#define CFE_MISSION_REV 0 /**< @brief Mission revision, reserved for mission use */ + +#define CFE_STR_HELPER(x) #x /**< @brief Convert agrument to string */ +#define CFE_STR(x) CFE_STR_HELPER(x) /**< @brief Expand macro before conversion */ + +/** + * @brief Short Build Version String + * + * Short string identifying the build, see @ref cfsversions for suggested format for development + * and official releases. */ #define CFE_SRC_VERSION CFE_BUILD_BASELINE "+dev" CFE_STR(CFE_BUILD_NUMBER) -/*! @brief Development Build Version String. - * @details Reports the current development build's baseline, number, and name. Also includes a note about the latest - * official version. @n See @ref cfsversions for format differences between development and release versions. +/** + * @brief Long Build Version String + * + * Long freeform string identifying the build, see @ref cfsversions for suggested format for development + * and official releases. */ -#define CFE_VERSION_STRING \ - " cFE DEVELOPMENT BUILD " CFE_SRC_VERSION " (Codename: Bootes)" /* Codename for current development */ \ - ", Last Official Release: cfe v6.7.0" /* For full support please use this version */ +#define CFE_VERSION_STRING \ + " cFE DEVELOPMENT BUILD " CFE_SRC_VERSION " (Codename: Bootes), Last Official Release: cfe v6.7.0" #endif /* CFE_VERSION_H */ diff --git a/modules/core_private/ut-stubs/src/ut_osprintf_stubs.c b/modules/core_private/ut-stubs/src/ut_osprintf_stubs.c index 5558f57a3..e87e13e91 100644 --- a/modules/core_private/ut-stubs/src/ut_osprintf_stubs.c +++ b/modules/core_private/ut-stubs/src/ut_osprintf_stubs.c @@ -41,123 +41,64 @@ */ const char *UT_OSP_MESSAGES[] = { - [0] = NULL, /* Message 0 is reserved */ - /* ES Startup: Error Mounting Volatile(RAM) Volume. EC = 0x~ */ - [UT_OSP_MOUNT_VOLATILE] = "ES Startup: Error Mounting Volatile(RAM) Volume. EC = 0x%08X\n", - /* CFE_ES_ExitApp: CORE Application CFE_ES Had a Runtime Error. */ - [UT_OSP_CORE_RUNTIME] = "CFE_ES_ExitApp: CORE Application %s Had a Runtime Error.\n", - /* ES Startup: OS_TaskCreate error creating core App: CFE_TBL: EC = 0x~ */ - [UT_OSP_CORE_APP_CREATE] = "ES Startup: OS_TaskCreate error creating core App: %s: EC = 0x%08X\n", - /* ES Startup: Error returned when calling function: CFE_TBL_EarlyInit: EC = 0x~ */ - [UT_OSP_EARLYINIT] = "ES Startup: Error returned when calling function: %s: EC = 0x%08X\n", - /* ES Startup: Could not find Library Init symbol:TST_LIB_Init. EC = 0x~ */ - [UT_OSP_FIND_LIBRARY] = "ES Startup: Could not find Library Init symbol:%s. EC = %d\n", - /* POWER ON RESET due to max proc resets (HW Spec Cmd). */ - [UT_OSP_POR_MAX_HW_SPECIAL] = "POWER ON RESET due to max proc resets (HW Spec Cmd).\n", - /* CFE_ES_ExitChildTask Error: Cannot Call from a cFE App Main Task. ID = ~ */ - [UT_OSP_CANNOT_CALL_APP_MAIN] = "CFE_ES_ExitChildTask Error: Cannot Call from a cFE App Main Task. ID = %d\n", - /* ES Startup: bad function pointer ( table entry = 1). */ - [UT_OSP_FUNCTION_POINTER] = "ES Startup: bad function pointer ( table entry = %d).\n", - /* ES Startup: Error Reading Startup file. EC = 0x~ */ - [UT_OSP_STARTUP_READ] = "ES Startup: Error Reading Startup file. EC = 0x%08X\n", - /* PROCESSOR RESET called from CFE_ES_ResetCFE (Commanded). */ - [UT_OSP_PROC_RESET_COMMANDED] = "PROCESSOR RESET called from CFE_ES_ResetCFE (Commanded).\n", - /* ES SharedData Mutex Take Err Stat=0x~,App=1,Func=TestAPI,Line=12345 */ - [UT_OSP_MUTEX_TAKE] = "ES SharedData Mutex Take Err Stat=0x%x,Func=%s,Line=%d\n", - /* ES Startup: Startup Sync failed - Applications may not have all started */ - [UT_OSP_STARTUP_SYNC_FAIL_1] = "ES Startup: Startup Sync failed - Applications may not have all started\n", - /* Warning: System Log full, log entry discarded. */ - [UT_OSP_SYSTEM_LOG_FULL] = "Warning: System Log full, log entry discarded.\n", - /* ES Startup: ES Startup File Line is too long: 137 bytes. */ - [UT_OSP_FILE_LINE_TOO_LONG] = "ES Startup: **WARNING** File Line %u is malformed: %u bytes, %u tokens.\n", - /* ES Startup: Load Shared Library Init Error. */ - [UT_OSP_SHARED_LIBRARY_INIT] = "ES Startup: Load Shared Library Init Error = 0x%08x\n", - /* ES Startup: Error Removing Volatile(RAM) Volume. EC = 0x~ */ - [UT_OSP_REMOVE_VOLATILE] = "ES Startup: Error Removing Volatile(RAM) Volume. EC = 0x%08X\n", - /* POWER ON RESET due to other cause (See Subtype). */ - [UT_OSP_POR_OTHER] = "POWER ON RESET due to other cause (See Subtype).\n", - /* ES Startup: Error Determining Blocks Free on Volume. EC = 0x~ */ - [UT_OSP_DETERMINE_BLOCKS] = "ES Startup: Error Determining Blocks Free on Volume. EC = 0x%08X\n", - /* ES Startup: Startup Sync failed - Applications may not have all initialized */ - [UT_OSP_STARTUP_SYNC_FAIL_2] = "ES Startup: Startup Sync failed - Applications may not have all initialized\n", - /* ES Startup: No free library slots available */ - [UT_OSP_LIBRARY_SLOTS] = "ES Startup: No free library slots available\n", - /* ES Startup: Unable to extract filename from path: ut/filename.gz. */ - [UT_OSP_EXTRACT_FILENAME_UT] = "ES Startup: Unable to extract filename from path: %s.\n", - /* ES Startup: Application path plus file name length (~) exceeds max allowed (~) */ - [UT_OSP_APP_PATH_FILE_TOO_LONG] = - "ES Startup: Application path plus file name length (%d) exceeds max allowed (%d)\n", - /* ES Startup: Error Re-Formating Volatile(RAM) Volume. EC = 0x~ */ - [UT_OSP_REFORMAT_VOLATILE] = "ES Startup: Error Re-Formating Volatile(RAM) Volume. EC = 0x%08X\n", - /* ES Startup: Could not load cFE application file:ut/filename.x. EC = 0x~ */ - [UT_OSP_EXTRACT_FILENAME_UT55] = "ES Startup: Could not load file:%s. EC = 0x%08X\n", - /* ES Startup: Unable to extract filename from path: ut46/ */ - [UT_OSP_EXTRACT_FILENAME_UT46] = "ES Startup: Unable to extract filename from path: %s.\n", - /* ES Startup: No free application slots available */ - [UT_OSP_NO_FREE_APP_SLOTS] = "ES Startup: No free application slots available\n", - /* ES Startup: Unable to extract filename from path: ut57/ */ - [UT_OSP_EXTRACT_FILENAME_UT57] = "ES Startup: Unable to extract filename from path: %s.\n", - /* ES SharedData Mutex Give Err Stat=0x~,App=1,Func=TestAPI,Line=98765 */ - [UT_OSP_MUTEX_GIVE] = "ES SharedData Mutex Give Err Stat=0x%x,Func=%s,Line=%d\n", - /* ES Startup: Could not find symbol:EntryPoint. EC = 0x~ */ - [UT_OSP_CANNOT_FIND_SYMBOL] = "ES Startup: Could not find symbol:%s. EC = 0x%08X\n", - /* ES Startup: Error Initializing Volatile(RAM) Volume. EC = 0x~ */ - [UT_OSP_INIT_VOLATILE] = "ES Startup: Error Initializing Volatile(RAM) Volume. EC = 0x%08X\n", - /* ES:Application Init Failed,RC=0x~ */ - [UT_OSP_APP_INIT] = "ES:Application Init Failed,RC=0x%08X\n", - /* POWER ON RESET due to max proc resets (Commanded). */ - [UT_OSP_POR_MAX_PROC_RESETS] = "POWER ON RESET due to max proc resets (Commanded).\n", - /* CFE_ES_RestartApp: Cannot Restart Application appName, It is not running. */ - [UT_OSP_CANNOT_RESTART_APP] = "CFE_ES_RestartApp: Cannot Restart Application %s, It is not running.\n", - /* ES Startup: Insufficent Free Space on Volatile Disk, Reformatting. */ - [UT_OSP_INSUFF_FREE_SPACE] = "ES Startup: Insufficent Free Space on Volatile Disk, Reformatting.\n", - /* ES Startup: Could not load cFE Shared Library */ - [UT_OSP_LOAD_SHARED_LIBRARY] = "ES Startup: Could not load cFE Shared Library\n", - /* POWER ON RESET due to HW Special Cmd (Hw Spec Cmd). */ - [UT_OSP_POR_HW_SPECIAL] = "POWER ON RESET due to HW Special Cmd (Hw Spec Cmd).\n", - /* ES Startup: AppCreate Error: TaskCreate AppName Failed. EC = 0x~! */ - [UT_OSP_APP_CREATE] = "ES Startup: AppCreate Error: TaskCreate %s Failed. EC = 0x%08X!\n", - /* ES Startup: Error Creating Volatile(RAM) Volume. EC = 0x~ */ - [UT_OSP_CREATE_VOLATILE] = "ES Startup: Error Creating Volatile(RAM) Volume. EC = 0x%08X\n", - /* ES Startup: Failed to unload APP: AppName. EC = 0x~ */ - [UT_OSP_MODULE_UNLOAD_FAILED] = "ES Startup: Failed to unload: %s. EC = 0x%08X\n", - /* POWERON RESET called from CFE_ES_ResetCFE (Commanded). */ - [UT_OSP_POR_COMMANDED] = "POWERON RESET called from CFE_ES_ResetCFE (Commanded).\n", - /* ES Startup: Error Re-Mounting Volatile(RAM) Volume. EC = 0x~ */ - [UT_OSP_REMOUNT_VOLATILE] = "ES Startup: Error Re-Mounting Volatile(RAM) Volume. EC = 0x%08X\n", - /* CFE_ES_ExitApp, Cannot Exit CORE Application CFE_ES */ - [UT_OSP_CORE_APP_EXIT] = "CFE_ES_ExitApp, Cannot Exit CORE Application %s\n", - /* ES Startup: Opened ES App Startup file: */ - [UT_OSP_ES_APP_STARTUP_OPEN] = "ES Startup: Opened ES App Startup file: %s\n", - /* CFE_ES_ExitApp: CORE Application CFE_ES Had an Init Error. */ - [UT_OSP_CORE_INIT] = "CFE_ES_ExitApp: CORE Application %s Had an Init Error.\n", - /* PROCESSOR RESET due to Hardware Special Command (HW Spec Cmd). */ - [UT_OSP_PROC_RESET_MAX_HW_SPECIAL] = "PROCESSOR RESET due to Hardware Special Command (HW Spec Cmd).\n", - /* ES:Error reading cmd pipe,RC=0x~ */ - [UT_OSP_COMMAND_PIPE] = "ES:Error reading cmd pipe,RC=0x%08X\n", - /* ES Startup: Error Un-Mounting Volatile(RAM) Volume. EC = 0x~ */ - [UT_OSP_UNMOUNT_VOLATILE] = "ES Startup: Error Un-Mounting Volatile(RAM) Volume. EC = 0x%08X\n", - /* ES Startup: Error: ES_TaskTable slot in use at task creation! */ - [UT_OSP_TABLE_SLOT_IN_USE] = "ES Startup: Error: ES_TaskTable slot in use at task creation!\n", - /* ES Startup: Error, Can't Open ES App Startup file: */ - [UT_OSP_CANNOT_OPEN_ES_APP_STARTUP] = "ES Startup: Error, Can't Open ES App Startup file: %s EC = 0x%08X\n", - /* ES Startup: Unable to extract filename from path: /cf/apps/tst_lib.bundle.gz. */ - [UT_OSP_EXTRACT_FILENAME_CF] = "ES Startup: Unable to extract filename from path: %s.\n", - /* Warning: Invalid System Log mode, log entry discarded. */ - [UT_OSP_INVALID_LOG_MODE] = "Warning: Invalid System Log mode, log entry discarded.\n", - /* ES Startup: Library path plus file name length (~) exceeds max allowed (~) */ - [UT_OSP_LIB_PATH_FILE_TOO_LONG] = "ES Startup: Library path plus file name length (%d) exceeds max allowed (%d)\n", - /* ES Startup: Unable to decompress Application File: ut/filename.gz */ - [UT_OSP_DECOMPRESS_APP] = "ES Startup: Unable to decompress Application File: %s\n", - /* ES Startup: Unable to decompress library file: /cf/apps/tst_lib.bundle.gz */ - [UT_OSP_DECOMPRESS_LIBRARY] = "ES Startup: Unable to decompress library file: %s\n", - /* CFE_ES_ExitChildTask Error Calling CFE_ES_GetAppID. Task ID = ~, RC = 0x~ */ - [UT_OSP_GET_APP_ID] = "CFE_ES_ExitChildTask Error Calling CFE_ES_GetAppID. Task ID = %d, RC = 0x%08X\n", - /* ES Startup: Error, No free application slots available for CORE App! */ - [UT_OSP_NO_FREE_CORE_APP_SLOTS] = "ES Startup: Error, No free application slots available for CORE App!\n", - /* ES Startup: CFE_ES_Global.TaskTable record used error for App: CFE_EVS, continuing. */ - [UT_OSP_RECORD_USED] = "ES Startup: Error: ES_TaskTable slot for ID %lx in use at task creation!\n", - /* CFE_ES_ExitChildTask called from invalid task context */ - [UT_OSP_TASKEXIT_BAD_CONTEXT] = "CFE_ES_ExitChildTask called from invalid task context\n", - [UT_OSP_BACKGROUND_TAKE] = "CFE_ES: Failed to take background sem: %08lx\n", + [0] = NULL, /* Message 0 is reserved */ + [UT_OSP_MOUNT_VOLATILE] = "%s: Error Mounting Volatile(RAM) Volume. EC = 0x%08X\n", + [UT_OSP_CORE_RUNTIME] = "%s: CORE Application %s Had a Runtime Error.\n", + [UT_OSP_CORE_APP_CREATE] = "%s: OS_TaskCreate error creating core App: %s: EC = 0x%08X\n", + [UT_OSP_EARLYINIT] = "%s: Error returned when calling function: %s: EC = 0x%08X\n", + [UT_OSP_FIND_LIBRARY] = "%s: Could not find Library Init symbol:%s. EC = %d\n", + [UT_OSP_POR_MAX_HW_SPECIAL] = "%s: POWER ON RESET due to max proc resets (HW Spec Cmd).\n", + [UT_OSP_CANNOT_CALL_APP_MAIN] = "%s: Error: Cannot Call from a cFE App Main Task. ID = %d\n", + [UT_OSP_FUNCTION_POINTER] = "%s: bad function pointer ( table entry = %d).\n", + [UT_OSP_STARTUP_READ] = "%s: Error Reading Startup file. EC = 0x%08X\n", + [UT_OSP_PROC_RESET_COMMANDED] = "%s: PROCESSOR RESET called from CFE_ES_ResetCFE (Commanded).\n", + [UT_OSP_MUTEX_TAKE] = "%s: SharedData Mutex Take Err Stat=0x%x,Func=%s,Line=%d\n", + [UT_OSP_STARTUP_SYNC_FAIL_1] = "%s: Startup Sync failed - Applications may not have all started\n", + [UT_OSP_SYSTEM_LOG_FULL] = "Warning: System Log full, log entry discarded.\n", + [UT_OSP_FILE_LINE_TOO_LONG] = "%s: **WARNING** File Line %u is malformed: %u bytes, %u tokens.\n", + [UT_OSP_SHARED_LIBRARY_INIT] = "%s: Load Shared Library Init Error = 0x%08x\n", + [UT_OSP_REMOVE_VOLATILE] = "%s: Error Removing Volatile(RAM) Volume. EC = 0x%08X\n", + [UT_OSP_POR_OTHER] = "%s: POWER ON RESET due to other cause (See Subtype).\n", + [UT_OSP_DETERMINE_BLOCKS] = "%s: Error Determining Blocks Free on Volume. EC = 0x%08X\n", + [UT_OSP_STARTUP_SYNC_FAIL_2] = "%s: Startup Sync failed - Applications may not have all initialized\n", + [UT_OSP_LIBRARY_SLOTS] = "%s: No free library slots available\n", + [UT_OSP_EXTRACT_FILENAME_UT] = "%s: Unable to extract filename from path: %s.\n", + [UT_OSP_APP_PATH_FILE_TOO_LONG] = "%s: Application path plus file name length (%d) exceeds max allowed (%d)\n", + [UT_OSP_REFORMAT_VOLATILE] = "%s: Error Re-Formating Volatile(RAM) Volume. EC = 0x%08X\n", + [UT_OSP_EXTRACT_FILENAME_UT55] = "%s: Could not load file:%s. EC = 0x%08X\n", + [UT_OSP_EXTRACT_FILENAME_UT46] = "%s: Unable to extract filename from path: %s.\n", + [UT_OSP_NO_FREE_APP_SLOTS] = "%s: No free application slots available\n", + [UT_OSP_EXTRACT_FILENAME_UT57] = "%s: Unable to extract filename from path: %s.\n", + [UT_OSP_MUTEX_GIVE] = "%s: SharedData Mutex Give Err Stat=0x%x,Func=%s,Line=%d\n", + [UT_OSP_CANNOT_FIND_SYMBOL] = "%s: Could not find symbol:%s. EC = 0x%08X\n", + [UT_OSP_INIT_VOLATILE] = "%s: Error Initializing Volatile(RAM) Volume. EC = 0x%08X\n", + [UT_OSP_APP_INIT] = "%s: Application Init Failed,RC=0x%08X\n", + [UT_OSP_POR_MAX_PROC_RESETS] = "%s: POWER ON RESET due to max proc resets (Commanded).\n", + [UT_OSP_CANNOT_RESTART_APP] = "%s: Cannot Restart Application %s, It is not running.\n", + [UT_OSP_INSUFF_FREE_SPACE] = "%s: Insufficent Free Space on Volatile Disk, Reformatting.\n", + [UT_OSP_LOAD_SHARED_LIBRARY] = "%s: Could not load cFE Shared Library\n", + [UT_OSP_POR_HW_SPECIAL] = "%s: POWER ON RESET due to HW Special Cmd (Hw Spec Cmd).\n", + [UT_OSP_APP_CREATE] = "%s: AppCreate Error: TaskCreate %s Failed. EC = 0x%08X!\n", + [UT_OSP_CREATE_VOLATILE] = "%s: Error Creating Volatile(RAM) Volume. EC = 0x%08X\n", + [UT_OSP_MODULE_UNLOAD_FAILED] = "%s: Failed to unload: %s. EC = 0x%08X\n", + [UT_OSP_POR_COMMANDED] = "%s: POWERON RESET called from CFE_ES_ResetCFE (Commanded).\n", + [UT_OSP_REMOUNT_VOLATILE] = "%s: Error Re-Mounting Volatile(RAM) Volume. EC = 0x%08X\n", + [UT_OSP_CORE_APP_EXIT] = "%s: Cannot Exit CORE Application %s\n", + [UT_OSP_ES_APP_STARTUP_OPEN] = "%s: Opened ES App Startup file: %s\n", + [UT_OSP_CORE_INIT] = "%s: CORE Application %s Had an Init Error.\n", + [UT_OSP_PROC_RESET_MAX_HW_SPECIAL] = "%s: PROCESSOR RESET due to Hardware Special Command (HW Spec Cmd).\n", + [UT_OSP_COMMAND_PIPE] = "%s: Error reading cmd pipe,RC=0x%08X\n", + [UT_OSP_UNMOUNT_VOLATILE] = "%s: Error Un-Mounting Volatile(RAM) Volume. EC = 0x%08X\n", + [UT_OSP_TABLE_SLOT_IN_USE] = "%s: Error: ES_TaskTable slot in use at task creation!\n", + [UT_OSP_CANNOT_OPEN_ES_APP_STARTUP] = "%s: Error, Can't Open ES App Startup file: %s EC = 0x%08X\n", + [UT_OSP_EXTRACT_FILENAME_CF] = "%s: Unable to extract filename from path: %s.\n", + [UT_OSP_INVALID_LOG_MODE] = "Warning: Invalid System Log mode, log entry discarded.\n", + [UT_OSP_LIB_PATH_FILE_TOO_LONG] = "%s: Library path plus file name length (%d) exceeds max allowed (%d)\n", + [UT_OSP_DECOMPRESS_APP] = "%s: Unable to decompress Application File: %s\n", + [UT_OSP_DECOMPRESS_LIBRARY] = "%s: Unable to decompress library file: %s\n", + [UT_OSP_GET_APP_ID] = "%s: Error Calling CFE_ES_GetAppID. Task ID = %d, RC = 0x%08X\n", + [UT_OSP_NO_FREE_CORE_APP_SLOTS] = "%s: Error, No free application slots available for CORE App!\n", + [UT_OSP_RECORD_USED] = "%s: Error: ES_TaskTable slot for ID %lx in use at task creation!\n", + [UT_OSP_TASKEXIT_BAD_CONTEXT] = "%s: Called from invalid task context\n", + [UT_OSP_BACKGROUND_TAKE] = "%s: Failed to take background sem: %08lx\n", }; diff --git a/modules/es/fsw/src/cfe_es_api.c b/modules/es/fsw/src/cfe_es_api.c index e58327320..a5235e17d 100644 --- a/modules/es/fsw/src/cfe_es_api.c +++ b/modules/es/fsw/src/cfe_es_api.c @@ -86,7 +86,7 @@ CFE_Status_t CFE_ES_ResetCFE(uint32 ResetType) if (CFE_ES_Global.ResetDataPtr->ResetVars.ProcessorResetCount > CFE_ES_Global.ResetDataPtr->ResetVars.MaxProcessorResetCount) { - CFE_ES_WriteToSysLog("POWER ON RESET due to max proc resets (Commanded).\n"); + CFE_ES_WriteToSysLog("%s: POWER ON RESET due to max proc resets (Commanded).\n", __func__); /* ** Log the reset in the ER Log. The log will be wiped out, but it's good to have @@ -101,7 +101,7 @@ CFE_Status_t CFE_ES_ResetCFE(uint32 ResetType) } else { - CFE_ES_WriteToSysLog("PROCESSOR RESET called from CFE_ES_ResetCFE (Commanded).\n"); + CFE_ES_WriteToSysLog("%s: PROCESSOR RESET called from CFE_ES_ResetCFE (Commanded).\n", __func__); /* ** Update the reset variables @@ -128,7 +128,7 @@ CFE_Status_t CFE_ES_ResetCFE(uint32 ResetType) } else if (ResetType == CFE_PSP_RST_TYPE_POWERON) { - CFE_ES_WriteToSysLog("POWERON RESET called from CFE_ES_ResetCFE (Commanded).\n"); + CFE_ES_WriteToSysLog("%s: POWERON RESET called from CFE_ES_ResetCFE (Commanded).\n", __func__); /* ** Log the reset in the ER Log. The log will be wiped out, but it's good to have @@ -150,7 +150,7 @@ CFE_Status_t CFE_ES_ResetCFE(uint32 ResetType) } else { - CFE_ES_WriteToSysLog("ES ResetCFE: Invalid Reset Type: %d.\n", (int)ResetType); + CFE_ES_WriteToSysLog("%s: Invalid Reset Type: %d.\n", __func__, (int)ResetType); ReturnCode = CFE_ES_BAD_ARGUMENT; } @@ -182,13 +182,13 @@ CFE_Status_t CFE_ES_RestartApp(CFE_ES_AppId_t AppID) */ if (AppRecPtr->Type == CFE_ES_AppType_CORE) { - CFE_ES_SysLogWrite_Unsync("CFE_ES_RestartApp: Cannot Restart a CORE Application: %s.\n", + CFE_ES_SysLogWrite_Unsync("%s: Cannot Restart a CORE Application: %s.\n", __func__, CFE_ES_AppRecordGetName(AppRecPtr)); ReturnCode = CFE_ES_ERR_RESOURCEID_NOT_VALID; } else if (AppRecPtr->AppState != CFE_ES_AppState_RUNNING) { - CFE_ES_SysLogWrite_Unsync("CFE_ES_RestartApp: Cannot Restart Application %s, It is not running.\n", + CFE_ES_SysLogWrite_Unsync("%s: Cannot Restart Application %s, It is not running.\n", __func__, CFE_ES_AppRecordGetName(AppRecPtr)); ReturnCode = CFE_ES_ERR_RESOURCEID_NOT_VALID; } @@ -199,13 +199,13 @@ CFE_Status_t CFE_ES_RestartApp(CFE_ES_AppId_t AppID) */ if (OS_stat(AppRecPtr->StartParams.BasicInfo.FileName, &FileStatus) == OS_SUCCESS) { - CFE_ES_SysLogWrite_Unsync("CFE_ES_RestartApp: Restart Application %s Initiated\n", + CFE_ES_SysLogWrite_Unsync("%s: Restart Application %s Initiated\n", __func__, CFE_ES_AppRecordGetName(AppRecPtr)); AppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_RESTART; } else { - CFE_ES_SysLogWrite_Unsync("CFE_ES_RestartApp: Cannot Restart Application %s, File %s does not exist.\n", + CFE_ES_SysLogWrite_Unsync("%s: Cannot Restart Application %s, File %s does not exist.\n", __func__, CFE_ES_AppRecordGetName(AppRecPtr), AppRecPtr->StartParams.BasicInfo.FileName); ReturnCode = CFE_ES_FILE_IO_ERR; @@ -218,7 +218,7 @@ CFE_Status_t CFE_ES_RestartApp(CFE_ES_AppId_t AppID) { ReturnCode = CFE_ES_ERR_RESOURCEID_NOT_VALID; - CFE_ES_WriteToSysLog("CFE_ES_RestartApp: Invalid Application ID received, AppID = %lu\n", + CFE_ES_WriteToSysLog("%s: Invalid Application ID received, AppID = %lu\n", __func__, CFE_RESOURCEID_TO_ULONG(AppID)); } /* end if */ @@ -252,13 +252,13 @@ CFE_Status_t CFE_ES_ReloadApp(CFE_ES_AppId_t AppID, const char *AppFileName) */ if (AppRecPtr->Type == CFE_ES_AppType_CORE) { - CFE_ES_SysLogWrite_Unsync("CFE_ES_DeleteApp: Cannot Reload a CORE Application: %s.\n", + CFE_ES_SysLogWrite_Unsync("%s: Cannot Reload a CORE Application: %s.\n", __func__, CFE_ES_AppRecordGetName(AppRecPtr)); ReturnCode = CFE_ES_ERR_RESOURCEID_NOT_VALID; } else if (AppRecPtr->AppState != CFE_ES_AppState_RUNNING) { - CFE_ES_SysLogWrite_Unsync("CFE_ES_ReloadApp: Cannot Reload Application %s, It is not running.\n", + CFE_ES_SysLogWrite_Unsync("%s: Cannot Reload Application %s, It is not running.\n", __func__, CFE_ES_AppRecordGetName(AppRecPtr)); ReturnCode = CFE_ES_ERR_RESOURCEID_NOT_VALID; } @@ -269,7 +269,7 @@ CFE_Status_t CFE_ES_ReloadApp(CFE_ES_AppId_t AppID, const char *AppFileName) */ if (OS_stat(AppFileName, &FileStatus) == OS_SUCCESS) { - CFE_ES_SysLogWrite_Unsync("CFE_ES_ReloadApp: Reload Application %s Initiated. New filename = %s\n", + CFE_ES_SysLogWrite_Unsync("%s: Reload Application %s Initiated. New filename = %s\n", __func__, CFE_ES_AppRecordGetName(AppRecPtr), AppFileName); strncpy(AppRecPtr->StartParams.BasicInfo.FileName, AppFileName, sizeof(AppRecPtr->StartParams.BasicInfo.FileName) - 1); @@ -278,7 +278,7 @@ CFE_Status_t CFE_ES_ReloadApp(CFE_ES_AppId_t AppID, const char *AppFileName) } else { - CFE_ES_SysLogWrite_Unsync("CFE_ES_ReloadApp: Cannot Reload Application %s, File %s does not exist.\n", + CFE_ES_SysLogWrite_Unsync("%s: Cannot Reload Application %s, File %s does not exist.\n", __func__, CFE_ES_AppRecordGetName(AppRecPtr), AppFileName); ReturnCode = CFE_ES_FILE_IO_ERR; } @@ -314,19 +314,19 @@ CFE_Status_t CFE_ES_DeleteApp(CFE_ES_AppId_t AppID) */ if (AppRecPtr->Type == CFE_ES_AppType_CORE) { - CFE_ES_SysLogWrite_Unsync("CFE_ES_DeleteApp: Cannot Delete a CORE Application: %s.\n", + CFE_ES_SysLogWrite_Unsync("%s: Cannot Delete a CORE Application: %s.\n", __func__, CFE_ES_AppRecordGetName(AppRecPtr)); ReturnCode = CFE_ES_ERR_RESOURCEID_NOT_VALID; } else if (AppRecPtr->AppState != CFE_ES_AppState_RUNNING) { - CFE_ES_SysLogWrite_Unsync("CFE_ES_DeleteApp: Cannot Delete Application %s, It is not running.\n", + CFE_ES_SysLogWrite_Unsync("%s: Cannot Delete Application %s, It is not running.\n", __func__, CFE_ES_AppRecordGetName(AppRecPtr)); ReturnCode = CFE_ES_ERR_RESOURCEID_NOT_VALID; } else { - CFE_ES_SysLogWrite_Unsync("CFE_ES_DeleteApp: Delete Application %s Initiated\n", + CFE_ES_SysLogWrite_Unsync("%s: Delete Application %s Initiated\n", __func__, CFE_ES_AppRecordGetName(AppRecPtr)); AppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_DELETE; } @@ -358,7 +358,7 @@ void CFE_ES_ExitApp(uint32 ExitStatus) if (ExitStatus == CFE_ES_RunStatus_UNDEFINED || ExitStatus >= CFE_ES_RunStatus_MAX) { - CFE_ES_SysLogWrite_Unsync("CFE_ES_ExitApp: Called with invalid status (%u).\n", (unsigned int)ExitStatus); + CFE_ES_SysLogWrite_Unsync("%s: Called with invalid status (%u).\n", __func__, (unsigned int)ExitStatus); /* revert to the ERROR status */ ExitStatus = CFE_ES_RunStatus_APP_ERROR; @@ -392,7 +392,7 @@ void CFE_ES_ExitApp(uint32 ExitStatus) */ if (ExitStatus == CFE_ES_RunStatus_CORE_APP_INIT_ERROR) { - CFE_ES_SysLogWrite_Unsync("CFE_ES_ExitApp: CORE Application %s Had an Init Error.\n", + CFE_ES_SysLogWrite_Unsync("%s: CORE Application %s Had an Init Error.\n", __func__, CFE_ES_AppRecordGetName(AppRecPtr)); /* @@ -410,14 +410,14 @@ void CFE_ES_ExitApp(uint32 ExitStatus) ** but it may return during unit testing. If it does, ** log the return code (even if it claims CFE_SUCCESS). */ - CFE_ES_WriteToSysLog("CFE_ES_ExitApp: CORE Application Init Error Processor Reset, RC = 0x%08X\n", + CFE_ES_WriteToSysLog("%s: CORE Application Init Error Processor Reset, RC = 0x%08X\n", __func__, (unsigned int)ReturnCode); return; } else if (ExitStatus == CFE_ES_RunStatus_CORE_APP_RUNTIME_ERROR) { - CFE_ES_SysLogWrite_Unsync("CFE_ES_ExitApp: CORE Application %s Had a Runtime Error.\n", + CFE_ES_SysLogWrite_Unsync("%s: CORE Application %s Had a Runtime Error.\n", __func__, CFE_ES_AppRecordGetName(AppRecPtr)); /* @@ -437,14 +437,15 @@ void CFE_ES_ExitApp(uint32 ExitStatus) } else { - CFE_ES_SysLogWrite_Unsync("CFE_ES_ExitApp, Cannot Exit CORE Application %s\n", + CFE_ES_SysLogWrite_Unsync("%s: Cannot Exit CORE Application %s\n", __func__, CFE_ES_AppRecordGetName(AppRecPtr)); } } else /* It is an external App */ { - CFE_ES_SysLogWrite_Unsync("Application %s called CFE_ES_ExitApp\n", CFE_ES_AppRecordGetName(AppRecPtr)); + CFE_ES_SysLogWrite_Unsync("%s: Application %s called CFE_ES_ExitApp\n", __func__, + CFE_ES_AppRecordGetName(AppRecPtr)); AppRecPtr->AppState = CFE_ES_AppState_STOPPED; @@ -550,7 +551,7 @@ bool CFE_ES_RunLoop(uint32 *RunStatus) /* * Cannot do anything without the AppID */ - CFE_ES_SysLogWrite_Unsync("CFE_ES_RunLoop Error: Cannot get AppID for the caller\n"); + CFE_ES_SysLogWrite_Unsync("%s: Error getting AppID for the caller\n", __func__); ReturnCode = false; } /* end if Status == CFE_SUCCESS */ @@ -702,7 +703,7 @@ CFE_Status_t CFE_ES_GetAppIDByName(CFE_ES_AppId_t *AppIdPtr, const char *AppName { /* * ensure the output value is set to a safe value, - * in case the does not check the return code. + * in case the caller does not check the return code. */ Result = CFE_ES_ERR_NAME_NOT_FOUND; *AppIdPtr = CFE_ES_APPID_UNDEFINED; @@ -743,7 +744,7 @@ CFE_Status_t CFE_ES_GetLibIDByName(CFE_ES_LibId_t *LibIdPtr, const char *LibName { /* * ensure the output value is set to a safe value, - * in case the does not check the return code. + * in case the caller does not check the return code. */ Result = CFE_ES_ERR_NAME_NOT_FOUND; *LibIdPtr = CFE_ES_LIBID_UNDEFINED; @@ -1013,7 +1014,7 @@ CFE_Status_t CFE_ES_GetAppInfo(CFE_ES_AppInfo_t *AppInfo, CFE_ES_AppId_t AppId) if (AppInfo == NULL) { - CFE_ES_WriteToSysLog("CFE_ES_GetAppInfo: Invalid Parameter ( Null Pointer )\n"); + CFE_ES_WriteToSysLog("%s: Invalid Parameter ( Null Pointer )\n", __func__); return CFE_ES_BAD_ARGUMENT; } @@ -1029,7 +1030,7 @@ CFE_Status_t CFE_ES_GetAppInfo(CFE_ES_AppInfo_t *AppInfo, CFE_ES_AppId_t AppId) /* * Log a message if called with an invalid ID. */ - CFE_ES_WriteToSysLog("CFE_ES_GetAppInfo: App ID not active: %lu\n", CFE_RESOURCEID_TO_ULONG(AppId)); + CFE_ES_WriteToSysLog("%s: App ID not active: %lu\n", __func__, CFE_RESOURCEID_TO_ULONG(AppId)); Status = CFE_ES_ERR_RESOURCEID_NOT_VALID; } @@ -1108,7 +1109,7 @@ int32 CFE_ES_GetLibInfo(CFE_ES_AppInfo_t *LibInfo, CFE_ES_LibId_t LibId) if (LibInfo == NULL) { - CFE_ES_WriteToSysLog("CFE_ES_GetLibInfo: Invalid Parameter ( Null Pointer )\n"); + CFE_ES_WriteToSysLog("%s: Invalid Parameter ( Null Pointer )\n", __func__); return CFE_ES_BAD_ARGUMENT; } @@ -1124,7 +1125,7 @@ int32 CFE_ES_GetLibInfo(CFE_ES_AppInfo_t *LibInfo, CFE_ES_LibId_t LibId) /* * Log a message if called with an invalid ID. */ - CFE_ES_SysLogWrite_Unsync("CFE_ES_GetLibInfo: Lib ID not active: %lu\n", CFE_RESOURCEID_TO_ULONG(LibId)); + CFE_ES_SysLogWrite_Unsync("%s: Lib ID not active: %lu\n", __func__, CFE_RESOURCEID_TO_ULONG(LibId)); Status = CFE_ES_ERR_RESOURCEID_NOT_VALID; } @@ -1168,6 +1169,7 @@ int32 CFE_ES_GetModuleInfo(CFE_ES_AppInfo_t *ModuleInfo, CFE_ResourceId_t Resour { int32 Status; + /* Note - ModuleInfo NULL pointer check is perfromed by CFE_ES_GetAppInfo or CFE_ES_GetLibInfo */ switch (CFE_ResourceId_GetBase(ResourceId)) { case CFE_ES_APPID_BASE: @@ -1180,8 +1182,7 @@ int32 CFE_ES_GetModuleInfo(CFE_ES_AppInfo_t *ModuleInfo, CFE_ResourceId_t Resour /* * Log a message if called with an invalid ID. */ - CFE_ES_WriteToSysLog("CFE_ES_GetModuleInfo: Resource ID not valid: %lu\n", - CFE_ResourceId_ToInteger(ResourceId)); + CFE_ES_WriteToSysLog("%s: Resource ID not valid: %lu\n", __func__, CFE_ResourceId_ToInteger(ResourceId)); Status = CFE_ES_ERR_RESOURCEID_NOT_VALID; break; } @@ -1205,7 +1206,7 @@ CFE_Status_t CFE_ES_GetTaskInfo(CFE_ES_TaskInfo_t *TaskInfo, CFE_ES_TaskId_t Tas if (TaskInfo == NULL) { - CFE_ES_WriteToSysLog("CFE_ES_GetTaskInfo: Invalid Parameter ( Null Pointer )\n"); + CFE_ES_WriteToSysLog("%s: Invalid Parameter ( Null Pointer )\n", __func__); return CFE_ES_BAD_ARGUMENT; } @@ -1219,7 +1220,7 @@ CFE_Status_t CFE_ES_GetTaskInfo(CFE_ES_TaskInfo_t *TaskInfo, CFE_ES_TaskId_t Tas { /* task ID is bad */ Status = CFE_ES_ERR_RESOURCEID_NOT_VALID; - CFE_ES_SysLogWrite_Unsync("CFE_ES_GetTaskInfo: Task ID Not Active: %lu\n", CFE_RESOURCEID_TO_ULONG(TaskId)); + CFE_ES_SysLogWrite_Unsync("%s: Task ID Not Active: %lu\n", __func__, CFE_RESOURCEID_TO_ULONG(TaskId)); } else { @@ -1296,24 +1297,23 @@ CFE_Status_t CFE_ES_CreateChildTask(CFE_ES_TaskId_t *TaskIdPtr, const char *Task { if (TaskName == NULL) { - CFE_ES_WriteToSysLog("CFE_ES_CreateChildTask: Task Id and Name Pointer Parameters are NULL.\n"); + CFE_ES_WriteToSysLog("%s: Task Id and Name Pointer Parameters are NULL.\n", __func__); ReturnCode = CFE_ES_BAD_ARGUMENT; } else { - CFE_ES_WriteToSysLog("CFE_ES_CreateChildTask: Task Id Pointer Parameter is NULL for Task '%s'.\n", - TaskName); + CFE_ES_WriteToSysLog("%s: Task Id Pointer Parameter is NULL for Task '%s'.\n", __func__, TaskName); ReturnCode = CFE_ES_BAD_ARGUMENT; } } else if (TaskName == NULL) { - CFE_ES_WriteToSysLog("CFE_ES_CreateChildTask: TaskName Parameter is NULL\n"); + CFE_ES_WriteToSysLog("%s: TaskName Parameter is NULL\n", __func__); ReturnCode = CFE_ES_BAD_ARGUMENT; } else if (FunctionPtr == NULL) { - CFE_ES_WriteToSysLog("CFE_ES_CreateChildTask: Function Pointer Parameter is NULL for Task '%s'\n", TaskName); + CFE_ES_WriteToSysLog("%s: Function Pointer Parameter is NULL for Task '%s'\n", __func__, TaskName); ReturnCode = CFE_ES_BAD_ARGUMENT; } else @@ -1332,13 +1332,12 @@ CFE_Status_t CFE_ES_CreateChildTask(CFE_ES_TaskId_t *TaskIdPtr, const char *Task AppRecPtr = CFE_ES_GetAppRecordByContext(); if (AppRecPtr == NULL) { - CFE_ES_SysLogWrite_Unsync("CFE_ES_CreateChildTask: Invalid calling context when creating Task '%s'\n", - TaskName); + CFE_ES_SysLogWrite_Unsync("%s: Invalid calling context when creating Task '%s'\n", __func__, TaskName); ReturnCode = CFE_ES_ERR_RESOURCEID_NOT_VALID; } else if (!CFE_RESOURCEID_TEST_EQUAL(SelfTaskId, AppRecPtr->MainTaskId)) { - CFE_ES_SysLogWrite_Unsync("CFE_ES_CreateChildTask: Error: Cannot call from a Child Task (for Task '%s').\n", + CFE_ES_SysLogWrite_Unsync("%s: Error: Cannot call from a Child Task (for Task '%s').\n", __func__, TaskName); ReturnCode = CFE_ES_ERR_CHILD_TASK_CREATE; } @@ -1466,15 +1465,13 @@ CFE_Status_t CFE_ES_DeleteChildTask(CFE_ES_TaskId_t TaskId) /* ** Report the task delete */ - CFE_ES_SysLogWrite_Unsync("CFE_ES_DeleteChildTask Task %lu Deleted\n", - CFE_RESOURCEID_TO_ULONG(TaskId)); + CFE_ES_SysLogWrite_Unsync("%s: Task %lu Deleted\n", __func__, CFE_RESOURCEID_TO_ULONG(TaskId)); ReturnCode = CFE_SUCCESS; } else { - CFE_ES_SysLogWrite_Unsync( - "CFE_ES_DeleteChildTask Error: Error Calling OS_TaskDelete: Task %lu, RC = 0x%08X\n", - CFE_RESOURCEID_TO_ULONG(TaskId), (unsigned int)OSReturnCode); + CFE_ES_SysLogWrite_Unsync("%s: Error Calling OS_TaskDelete: Task %lu, RC = 0x%08X\n", __func__, + CFE_RESOURCEID_TO_ULONG(TaskId), (unsigned int)OSReturnCode); ReturnCode = CFE_ES_ERR_CHILD_TASK_DELETE; } } @@ -1483,7 +1480,7 @@ CFE_Status_t CFE_ES_DeleteChildTask(CFE_ES_TaskId_t TaskId) /* ** Error: The task is a cFE Application Main task */ - CFE_ES_SysLogWrite_Unsync("CFE_ES_DeleteChildTask Error: Task %lu is a cFE Main Task.\n", + CFE_ES_SysLogWrite_Unsync("%s: Error: Task %lu is a cFE Main Task.\n", __func__, CFE_RESOURCEID_TO_ULONG(TaskId)); ReturnCode = CFE_ES_ERR_CHILD_TASK_DELETE_MAIN_TASK; } /* end if TaskMain == false */ @@ -1493,7 +1490,7 @@ CFE_Status_t CFE_ES_DeleteChildTask(CFE_ES_TaskId_t TaskId) /* ** Task ID is not in use, so it is invalid */ - CFE_ES_SysLogWrite_Unsync("CFE_ES_DeleteChildTask Error: Task ID is not active: %lu\n", + CFE_ES_SysLogWrite_Unsync("%s: Error: Task ID is not active: %lu\n", __func__, CFE_RESOURCEID_TO_ULONG(TaskId)); ReturnCode = CFE_ES_ERR_RESOURCEID_NOT_VALID; @@ -1506,7 +1503,7 @@ CFE_Status_t CFE_ES_DeleteChildTask(CFE_ES_TaskId_t TaskId) /* ** Task ID is invalid ( too large ) */ - CFE_ES_WriteToSysLog("CFE_ES_DeleteChildTask Error: Invalid Task ID: %lu\n", CFE_RESOURCEID_TO_ULONG(TaskId)); + CFE_ES_WriteToSysLog("%s: Error: Invalid Task ID: %lu\n", __func__, CFE_RESOURCEID_TO_ULONG(TaskId)); ReturnCode = CFE_ES_ERR_RESOURCEID_NOT_VALID; } return (ReturnCode); @@ -1558,13 +1555,13 @@ void CFE_ES_ExitChildTask(void) } else { - CFE_ES_SysLogWrite_Unsync("CFE_ES_ExitChildTask Error: Cannot Call from a cFE App Main Task. ID = %lu\n", + CFE_ES_SysLogWrite_Unsync("%s: Error: Cannot Call from a cFE App Main Task. ID = %lu\n", __func__, CFE_RESOURCEID_TO_ULONG(CFE_ES_TaskRecordGetID(TaskRecPtr))); } } else { - CFE_ES_SysLogWrite_Unsync("CFE_ES_ExitChildTask called from invalid task context\n"); + CFE_ES_SysLogWrite_Unsync("%s: Called from invalid task context\n", __func__); } /* end if GetAppId */ CFE_ES_UnlockSharedData(__func__, __LINE__); @@ -1655,7 +1652,7 @@ uint32 CFE_ES_CalculateCRC(const void *DataPtr, size_t DataLength, uint32 InputC switch (TypeCRC) { case CFE_MISSION_ES_CRC_32: - CFE_ES_WriteToSysLog("CFE ES Calculate CRC32 not Implemented\n"); + CFE_ES_WriteToSysLog("%s: Calculate CRC32 not Implemented\n", __func__); break; case CFE_MISSION_ES_CRC_16: @@ -1676,7 +1673,7 @@ uint32 CFE_ES_CalculateCRC(const void *DataPtr, size_t DataLength, uint32 InputC break; case CFE_MISSION_ES_CRC_8: - CFE_ES_WriteToSysLog("CFE ES Calculate CRC8 not Implemented\n"); + CFE_ES_WriteToSysLog("%s: Calculate CRC8 not Implemented\n", __func__); break; default: @@ -1707,7 +1704,7 @@ CFE_Status_t CFE_ES_RegisterCDS(CFE_ES_CDSHandle_t *CDSHandlePtr, size_t BlockSi if (CDSHandlePtr == NULL || Name == NULL) { - CFE_ES_WriteToSysLog("CFE_ES_RegisterCDS:-Failed invalid arguments\n"); + CFE_ES_WriteToSysLog("%s: Failed invalid arguments\n", __func__); return CFE_ES_BAD_ARGUMENT; } @@ -1716,11 +1713,11 @@ CFE_Status_t CFE_ES_RegisterCDS(CFE_ES_CDSHandle_t *CDSHandlePtr, size_t BlockSi if (Status != CFE_SUCCESS) /* Application ID was invalid */ { - CFE_ES_WriteToSysLog("CFE_CDS:Register-Bad AppId context\n"); + CFE_ES_WriteToSysLog("%s: Bad AppId context\n", __func__); } else if (!CFE_ES_Global.CDSIsAvailable) { - CFE_ES_WriteToSysLog("CFE_CDS:Register-CDS not available\n"); + CFE_ES_WriteToSysLog("%s: CDS not available\n", __func__); Status = CFE_ES_NOT_IMPLEMENTED; } else @@ -1735,7 +1732,7 @@ CFE_Status_t CFE_ES_RegisterCDS(CFE_ES_CDSHandle_t *CDSHandlePtr, size_t BlockSi strncpy(CDSName, Name, sizeof(CDSName) - 1); CDSName[sizeof(CDSName) - 1] = '\0'; - CFE_ES_WriteToSysLog("CFE_CDS:Register-CDS Name (%s) is too long\n", CDSName); + CFE_ES_WriteToSysLog("%s: CDS Name (%s) is too long\n", __func__, CDSName); } else { @@ -1749,8 +1746,7 @@ CFE_Status_t CFE_ES_RegisterCDS(CFE_ES_CDSHandle_t *CDSHandlePtr, size_t BlockSi /* If size is unacceptable, log it */ if (Status == CFE_ES_CDS_INVALID_SIZE) { - CFE_ES_WriteToSysLog("CFE_CDS:Register-CDS %s has invalid size (%lu)\n", Name, - (unsigned long)BlockSize); + CFE_ES_WriteToSysLog("%s: CDS %s has invalid size (%lu)\n", __func__, Name, (unsigned long)BlockSize); } } } @@ -1922,7 +1918,7 @@ CFE_Status_t CFE_ES_RegisterGenCounter(CFE_ES_CounterId_t *CounterIdPtr, const c CountRecPtr = CFE_ES_LocateCounterRecordByName(CounterName); if (CountRecPtr != NULL) { - CFE_ES_SysLogWrite_Unsync("ES Startup: Duplicate Counter name '%s'\n", CounterName); + CFE_ES_SysLogWrite_Unsync("%s: Duplicate Counter name '%s'\n", __func__, CounterName); Status = CFE_ES_ERR_DUPLICATE_NAME; PendingResourceId = CFE_RESOURCEID_UNDEFINED; } @@ -1935,7 +1931,7 @@ CFE_Status_t CFE_ES_RegisterGenCounter(CFE_ES_CounterId_t *CounterIdPtr, const c if (CountRecPtr == NULL) { - CFE_ES_SysLogWrite_Unsync("ES Startup: No free Counter slots available\n"); + CFE_ES_SysLogWrite_Unsync("%s: No free Counter slots available\n", __func__); Status = CFE_ES_NO_RESOURCE_IDS_AVAILABLE; } else @@ -2078,7 +2074,7 @@ CFE_Status_t CFE_ES_GetGenCounterIDByName(CFE_ES_CounterId_t *CounterIdPtr, cons { /* * ensure the output value is set to a safe value, - * in case the does not check the return code. + * in case the caller does not check the return code. */ Result = CFE_ES_ERR_NAME_NOT_FOUND; *CounterIdPtr = CFE_ES_COUNTERID_UNDEFINED; @@ -2226,8 +2222,8 @@ void CFE_ES_LockSharedData(const char *FunctionName, int32 LineNumber) * NOTE: this is going to write into a buffer that itself * is _supposed_ to be protected by this same mutex. */ - CFE_ES_SysLogWrite_Unsync("ES SharedData Mutex Take Err Stat=0x%x,Func=%s,Line=%d\n", (unsigned int)Status, - FunctionName, (int)LineNumber); + CFE_ES_SysLogWrite_Unsync("%s: SharedData Mutex Take Err Stat=0x%x,Func=%s,Line=%d\n", __func__, + (unsigned int)Status, FunctionName, (int)LineNumber); } /* end if */ @@ -2253,8 +2249,8 @@ void CFE_ES_UnlockSharedData(const char *FunctionName, int32 LineNumber) * NOTE: this is going to write into a buffer that itself * is _supposed_ to be protected by this same mutex. */ - CFE_ES_SysLogWrite_Unsync("ES SharedData Mutex Give Err Stat=0x%x,Func=%s,Line=%d\n", (unsigned int)Status, - FunctionName, (int)LineNumber); + CFE_ES_SysLogWrite_Unsync("%s: SharedData Mutex Give Err Stat=0x%x,Func=%s,Line=%d\n", __func__, + (unsigned int)Status, FunctionName, (int)LineNumber); } /* end if */ diff --git a/modules/es/fsw/src/cfe_es_apps.c b/modules/es/fsw/src/cfe_es_apps.c index f40096e2b..2dab9e8b3 100644 --- a/modules/es/fsw/src/cfe_es_apps.c +++ b/modules/es/fsw/src/cfe_es_apps.c @@ -105,12 +105,12 @@ void CFE_ES_StartApplications(uint32 ResetType, const char *StartFilePath) if (Status >= 0) { - CFE_ES_WriteToSysLog("ES Startup: Opened ES App Startup file: %s\n", ScriptFileName); + CFE_ES_WriteToSysLog("%s: Opened ES App Startup file: %s\n", __func__, ScriptFileName); FileOpened = true; } else { - CFE_ES_WriteToSysLog("ES Startup: Cannot Open Volatile Startup file, Trying Nonvolatile.\n"); + CFE_ES_WriteToSysLog("%s: Cannot Open Volatile Startup file, Trying Nonvolatile.\n", __func__); } } /* end if */ @@ -134,12 +134,12 @@ void CFE_ES_StartApplications(uint32 ResetType, const char *StartFilePath) if (Status >= 0) { - CFE_ES_WriteToSysLog("ES Startup: Opened ES App Startup file: %s\n", ScriptFileName); + CFE_ES_WriteToSysLog("%s: Opened ES App Startup file: %s\n", __func__, ScriptFileName); FileOpened = true; } else { - CFE_ES_WriteToSysLog("ES Startup: Error, Can't Open ES App Startup file: %s EC = 0x%08X\n", StartFilePath, + CFE_ES_WriteToSysLog("%s: Error, Can't Open ES App Startup file: %s EC = 0x%08X\n", __func__, StartFilePath, (unsigned int)Status); } } @@ -164,7 +164,7 @@ void CFE_ES_StartApplications(uint32 ResetType, const char *StartFilePath) Status = OS_read(AppFile, &c, 1); if (Status < 0) { - CFE_ES_WriteToSysLog("ES Startup: Error Reading Startup file. EC = 0x%08X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Error Reading Startup file. EC = 0x%08X\n", __func__, (unsigned int)Status); break; } else if (Status == 0) @@ -236,9 +236,9 @@ void CFE_ES_StartApplications(uint32 ResetType, const char *StartFilePath) /* ** The line was not formed correctly */ - CFE_ES_WriteToSysLog( - "ES Startup: **WARNING** File Line %u is malformed: %u bytes, %u tokens.\n", - (unsigned int)NumLines, (unsigned int)BuffLen, (unsigned int)NumTokens); + CFE_ES_WriteToSysLog("%s: **WARNING** File Line %u is malformed: %u bytes, %u tokens.\n", + __func__, (unsigned int)NumLines, (unsigned int)BuffLen, + (unsigned int)NumTokens); LineTooLong = false; } else @@ -295,7 +295,7 @@ int32 CFE_ES_ParseFileEntry(const char **TokenList, uint32 NumTokens) */ if (NumTokens < 8) { - CFE_ES_WriteToSysLog("ES Startup: Invalid ES Startup file entry: %u\n", (unsigned int)NumTokens); + CFE_ES_WriteToSysLog("%s: Invalid ES Startup file entry: %u\n", __func__, (unsigned int)NumTokens); return CFE_ES_BAD_ARGUMENT; } @@ -312,7 +312,7 @@ int32 CFE_ES_ParseFileEntry(const char **TokenList, uint32 NumTokens) CFE_FS_FileCategory_DYNAMIC_MODULE); if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("ES Startup: Invalid ES Startup script file name: %s\n", TokenList[1]); + CFE_ES_WriteToSysLog("%s: Invalid ES Startup script file name: %s\n", __func__, TokenList[1]); return Status; } @@ -320,7 +320,7 @@ int32 CFE_ES_ParseFileEntry(const char **TokenList, uint32 NumTokens) if (strcmp(EntryType, "CFE_APP") == 0) { - CFE_ES_WriteToSysLog("ES Startup: Loading file: %s, APP: %s\n", ParamBuf.BasicInfo.FileName, ModuleName); + CFE_ES_WriteToSysLog("%s: Loading file: %s, APP: %s\n", __func__, ParamBuf.BasicInfo.FileName, ModuleName); /* * Priority and Exception action have limited ranges, which is checked here @@ -364,7 +364,7 @@ int32 CFE_ES_ParseFileEntry(const char **TokenList, uint32 NumTokens) } else if (strcmp(EntryType, "CFE_LIB") == 0) { - CFE_ES_WriteToSysLog("ES Startup: Loading shared library: %s\n", ParamBuf.BasicInfo.FileName); + CFE_ES_WriteToSysLog("%s: Loading shared library: %s\n", __func__, ParamBuf.BasicInfo.FileName); /* ** Now load the library @@ -373,7 +373,7 @@ int32 CFE_ES_ParseFileEntry(const char **TokenList, uint32 NumTokens) } else { - CFE_ES_WriteToSysLog("ES Startup: Unexpected EntryType %s in startup file.\n", EntryType); + CFE_ES_WriteToSysLog("%s: Unexpected EntryType %s in startup file.\n", __func__, EntryType); Status = CFE_ES_ERR_APP_CREATE; } @@ -436,7 +436,7 @@ int32 CFE_ES_LoadModule(CFE_ResourceId_t ParentResourceId, const char *ModuleNam if (StatusCode != OS_SUCCESS) { - CFE_ES_WriteToSysLog("ES Startup: Could not load file:%s. EC = 0x%08X\n", LoadParams->FileName, + CFE_ES_WriteToSysLog("%s: Could not load file:%s. EC = 0x%08X\n", __func__, LoadParams->FileName, (unsigned int)StatusCode); ModuleId = OS_OBJECT_ID_UNDEFINED; ReturnCode = CFE_STATUS_EXTERNAL_RESOURCE_FAIL; @@ -456,7 +456,7 @@ int32 CFE_ES_LoadModule(CFE_ResourceId_t ParentResourceId, const char *ModuleNam StatusCode = OS_ModuleSymbolLookup(ModuleId, &InitSymbolAddress, LoadParams->InitSymbolName); if (StatusCode != OS_SUCCESS) { - CFE_ES_WriteToSysLog("ES Startup: Could not find symbol:%s. EC = 0x%08X\n", LoadParams->InitSymbolName, + CFE_ES_WriteToSysLog("%s: Could not find symbol:%s. EC = 0x%08X\n", __func__, LoadParams->InitSymbolName, (unsigned int)StatusCode); ReturnCode = CFE_STATUS_EXTERNAL_RESOURCE_FAIL; } @@ -475,7 +475,7 @@ int32 CFE_ES_LoadModule(CFE_ResourceId_t ParentResourceId, const char *ModuleNam StatusCode = OS_ModuleUnload(ModuleId); if (StatusCode != OS_SUCCESS) /* There's not much we can do except notify */ { - CFE_ES_WriteToSysLog("ES Startup: Failed to unload: %s. EC = 0x%08X\n", ModuleName, + CFE_ES_WriteToSysLog("%s: Failed to unload: %s. EC = 0x%08X\n", __func__, ModuleName, (unsigned int)StatusCode); } } @@ -610,7 +610,7 @@ int32 CFE_ES_StartAppTask(CFE_ES_TaskId_t *TaskIdPtr, const char *TaskName, CFE_ TaskRecPtr = CFE_ES_LocateTaskRecordByID(LocalTaskId); if (CFE_ES_TaskRecordIsUsed(TaskRecPtr)) { - CFE_ES_SysLogWrite_Unsync("ES Startup: Error: ES_TaskTable slot for ID %lx in use at task creation!\n", + CFE_ES_SysLogWrite_Unsync("%s: Error: ES_TaskTable slot for ID %lx in use at task creation!\n", __func__, OS_ObjectIdToInteger(OsalTaskId)); } @@ -638,7 +638,7 @@ int32 CFE_ES_StartAppTask(CFE_ES_TaskId_t *TaskIdPtr, const char *TaskName, CFE_ } else { - CFE_ES_SysLogWrite_Unsync("ES Startup: AppCreate Error: TaskCreate %s Failed. EC = 0x%08X!\n", TaskName, + CFE_ES_SysLogWrite_Unsync("%s: AppCreate Error: TaskCreate %s Failed. EC = 0x%08X!\n", __func__, TaskName, (unsigned int)StatusCode); ReturnCode = CFE_STATUS_EXTERNAL_RESOURCE_FAIL; *TaskIdPtr = CFE_ES_TASKID_UNDEFINED; @@ -703,7 +703,7 @@ int32 CFE_ES_AppCreate(CFE_ES_AppId_t *ApplicationIdPtr, const char *AppName, co AppRecPtr = CFE_ES_LocateAppRecordByName(AppName); if (AppRecPtr != NULL) { - CFE_ES_SysLogWrite_Unsync("ES Startup: Duplicate app name '%s'\n", AppName); + CFE_ES_SysLogWrite_Unsync("%s: Duplicate app name '%s'\n", __func__, AppName); Status = CFE_ES_ERR_DUPLICATE_NAME; } else @@ -715,7 +715,7 @@ int32 CFE_ES_AppCreate(CFE_ES_AppId_t *ApplicationIdPtr, const char *AppName, co if (AppRecPtr == NULL) { - CFE_ES_SysLogWrite_Unsync("ES Startup: No free application slots available\n"); + CFE_ES_SysLogWrite_Unsync("%s: No free application slots available\n", __func__); Status = CFE_ES_NO_RESOURCE_IDS_AVAILABLE; } else @@ -871,7 +871,7 @@ int32 CFE_ES_LoadLibrary(CFE_ES_LibId_t *LibraryIdPtr, const char *LibName, cons LibSlotPtr = CFE_ES_LocateLibRecordByName(LibName); if (LibSlotPtr != NULL || CFE_ES_LocateAppRecordByName(LibName) != NULL) { - CFE_ES_SysLogWrite_Unsync("ES Startup: Duplicate Lib name '%s'\n", LibName); + CFE_ES_SysLogWrite_Unsync("%s: Duplicate Lib name '%s'\n", __func__, LibName); if (LibSlotPtr != NULL) { PendingResourceId = CFE_RESOURCEID_UNWRAP(CFE_ES_LibRecordGetID(LibSlotPtr)); @@ -887,7 +887,7 @@ int32 CFE_ES_LoadLibrary(CFE_ES_LibId_t *LibraryIdPtr, const char *LibName, cons if (LibSlotPtr == NULL) { - CFE_ES_SysLogWrite_Unsync("ES Startup: No free library slots available\n"); + CFE_ES_SysLogWrite_Unsync("%s: No free library slots available\n", __func__); Status = CFE_ES_NO_RESOURCE_IDS_AVAILABLE; } else @@ -932,7 +932,7 @@ int32 CFE_ES_LoadLibrary(CFE_ES_LibId_t *LibraryIdPtr, const char *LibName, cons Status = (*FunctionPointer)(CFE_ES_LIBID_C(PendingResourceId)); if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("ES Startup: Load Shared Library Init Error = 0x%08x\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Load Shared Library Init Error = 0x%08x\n", __func__, (unsigned int)Status); } } } @@ -1421,7 +1421,7 @@ int32 CFE_ES_CleanUpApp(CFE_ES_AppId_t AppId) } else { - CFE_ES_SysLogWrite_Unsync("CFE_ES_CleanUpApp: AppID %lu is not valid for deletion\n", + CFE_ES_SysLogWrite_Unsync("%s: AppID %lu is not valid for deletion\n", __func__, CFE_RESOURCEID_TO_ULONG(AppId)); ReturnCode = CFE_ES_APP_CLEANUP_ERR; } @@ -1462,8 +1462,7 @@ int32 CFE_ES_CleanUpApp(CFE_ES_AppId_t AppId) Status = CFE_EVS_CleanUpApp(AppId); if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("CFE_ES_CleanUpApp: Call to CFE_EVS_CleanUpApp returned Error: 0x%08X\n", - (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Call to CFE_EVS_CleanUpApp returned Error: 0x%08X\n", __func__, (unsigned int)Status); ReturnCode = CFE_ES_APP_CLEANUP_ERR; } @@ -1482,7 +1481,7 @@ int32 CFE_ES_CleanUpApp(CFE_ES_AppId_t AppId) Status = CFE_ES_CleanupTaskResources(TaskList[i]); if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("CFE_ES_CleanUpApp: CleanUpTaskResources for Task ID:%lu returned Error: 0x%08X\n", + CFE_ES_WriteToSysLog("%s: CleanUpTaskResources for Task ID:%lu returned Error: 0x%08X\n", __func__, CFE_RESOURCEID_TO_ULONG(TaskList[i]), (unsigned int)Status); ReturnCode = CFE_ES_APP_CLEANUP_ERR; } @@ -1496,7 +1495,7 @@ int32 CFE_ES_CleanUpApp(CFE_ES_AppId_t AppId) Status = CFE_ES_PoolDelete(PoolList[i]); if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("CFE_ES_MemPoolCleanupApp: delete pool %lu returned Error: 0x%08X\n", + CFE_ES_WriteToSysLog("%s: delete pool %lu returned Error: 0x%08X\n", __func__, CFE_RESOURCEID_TO_ULONG(PoolList[i]), (unsigned int)Status); ReturnCode = CFE_ES_APP_CLEANUP_ERR; } @@ -1513,7 +1512,7 @@ int32 CFE_ES_CleanUpApp(CFE_ES_AppId_t AppId) Status = OS_ModuleUnload(ModuleId); if (Status != OS_SUCCESS) { - CFE_ES_WriteToSysLog("CFE_ES_CleanUpApp: Module (ID:0x%08lX) Unload failed. RC=0x%08X\n", + CFE_ES_WriteToSysLog("%s: Module (ID:0x%08lX) Unload failed. RC=0x%08X\n", __func__, OS_ObjectIdToInteger(ModuleId), (unsigned int)Status); ReturnCode = CFE_ES_APP_CLEANUP_ERR; } @@ -1626,7 +1625,7 @@ void CFE_ES_CleanupObjectCallback(osal_id_t ObjectId, void *arg) } else { - CFE_ES_SysLogWrite_Unsync("Call to OSAL Delete Object (ID:%lu) failed. RC=0x%08X\n", + CFE_ES_SysLogWrite_Unsync("%s: Call to OSAL Delete Object (ID:%lu) failed. RC=0x%08X\n", __func__, OS_ObjectIdToInteger(ObjectId), (unsigned int)Status); if (CleanState->OverallStatus == CFE_SUCCESS) { diff --git a/modules/es/fsw/src/cfe_es_backgroundtask.c b/modules/es/fsw/src/cfe_es_backgroundtask.c index 593e69e94..e886ebbd8 100644 --- a/modules/es/fsw/src/cfe_es_backgroundtask.c +++ b/modules/es/fsw/src/cfe_es_backgroundtask.c @@ -157,7 +157,7 @@ void CFE_ES_BackgroundTask(void) if (status != OS_SUCCESS && status != OS_SEM_TIMEOUT) { /* should never occur */ - CFE_ES_WriteToSysLog("CFE_ES: Failed to take background sem: %08lx\n", (unsigned long)status); + CFE_ES_WriteToSysLog("%s: Failed to take background sem: %08lx\n", __func__, (unsigned long)status); break; } } @@ -178,7 +178,7 @@ int32 CFE_ES_BackgroundInit(void) status = OS_BinSemCreate(&CFE_ES_Global.BackgroundTask.WorkSem, CFE_ES_BACKGROUND_SEM_NAME, 0, 0); if (status != OS_SUCCESS) { - CFE_ES_WriteToSysLog("CFE_ES: Failed to create background sem: %08lx\n", (unsigned long)status); + CFE_ES_WriteToSysLog("%s: Failed to create background sem: %08lx\n", __func__, (unsigned long)status); return status; } @@ -190,7 +190,7 @@ int32 CFE_ES_BackgroundInit(void) if (status != OS_SUCCESS) { - CFE_ES_WriteToSysLog("CFE_ES: Failed to create background task: %08lx\n", (unsigned long)status); + CFE_ES_WriteToSysLog("%s: Failed to create background task: %08lx\n", __func__, (unsigned long)status); return status; } diff --git a/modules/es/fsw/src/cfe_es_cds.c b/modules/es/fsw/src/cfe_es_cds.c index 28db45c6c..f173dec77 100644 --- a/modules/es/fsw/src/cfe_es_cds.c +++ b/modules/es/fsw/src/cfe_es_cds.c @@ -65,7 +65,7 @@ int32 CFE_ES_CDS_EarlyInit(void) Status = OS_MutSemCreate(&CDS->GenMutex, CFE_ES_CDS_MUT_REG_NAME, CFE_ES_CDS_MUT_REG_VALUE); if (Status != OS_SUCCESS) { - CFE_ES_SysLogWrite_Unsync("CFE_ES_CDS_EarlyInit: Failed to create mutex with error %d\n", (int)Status); + CFE_ES_SysLogWrite_Unsync("%s: Failed to create mutex with error %d\n", __func__, (int)Status); return CFE_STATUS_EXTERNAL_RESOURCE_FAIL; } @@ -77,8 +77,7 @@ int32 CFE_ES_CDS_EarlyInit(void) if (Status != CFE_PSP_SUCCESS) { /* Error getting the size of the CDS from the BSP */ - CFE_ES_WriteToSysLog("CFE_CDS:EarlyInit-Unable to obtain CDS Size from BSP (Err=0x%08X)\n", - (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Unable to obtain CDS Size from BSP (Err=0x%08X)\n", __func__, (unsigned int)Status); return Status; } @@ -91,8 +90,8 @@ int32 CFE_ES_CDS_EarlyInit(void) if (CDS->TotalSize < MinRequiredSize) { - CFE_ES_WriteToSysLog("CFE_CDS:EarlyInit-CDS Size (%lu) less than required (%lu)\n", - (unsigned long)CDS->TotalSize, (unsigned long)MinRequiredSize); + CFE_ES_WriteToSysLog("%s: CDS Size (%lu) less than required (%lu)\n", __func__, (unsigned long)CDS->TotalSize, + (unsigned long)MinRequiredSize); Status = CFE_SUCCESS; } else @@ -135,8 +134,7 @@ int32 CFE_ES_CDS_EarlyInit(void) if (Status != CFE_SUCCESS) { /* Unrecoverable error while reading the CDS */ - CFE_ES_WriteToSysLog("CFE_CDS:EarlyInit-error validating/initializing CDS (0x%08lX)\n", - (unsigned long)Status); + CFE_ES_WriteToSysLog("%s: Error validating/initializing CDS (0x%08lX)\n", __func__, (unsigned long)Status); } else { @@ -441,7 +439,7 @@ int32 CFE_ES_RegisterCDSEx(CFE_ES_CDSHandle_t *HandlePtr, size_t UserBlockSize, /* Log any failures AFTER releasing the lock */ if (RegUpdateStatus != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("CFE_CDS:RegCDS-Failed to update CDS Registry (Stat=0x%08X)\n", + CFE_ES_WriteToSysLog("%s: Failed to update CDS Registry (Stat=0x%08X)\n", __func__, (unsigned int)RegUpdateStatus); /* @@ -492,7 +490,7 @@ int32 CFE_ES_ValidateCDS(void) Status = CFE_ES_CDS_CacheFetch(&CDS->Cache, CDS_SIG_BEGIN_OFFSET, SIG_CDS_SIZE); if (Status != CFE_PSP_SUCCESS) { - CFE_ES_WriteToSysLog("CFE_CDS:Validate-1st ReadFromCDS Failed. Status=0x%X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: 1st ReadFromCDS Failed. Status=0x%X\n", __func__, (unsigned int)Status); return Status; } @@ -509,7 +507,7 @@ int32 CFE_ES_ValidateCDS(void) if (Status != CFE_PSP_SUCCESS) { /* BSP reported an error reading from CDS */ - CFE_ES_WriteToSysLog("CFE_CDS:Validate-2nd ReadFromCDS Failed. Status=0x%X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: 2nd ReadFromCDS Failed. Status=0x%X\n", __func__, (unsigned int)Status); return Status; } @@ -563,7 +561,7 @@ int32 CFE_ES_ClearCDS(void) if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("CFE_CDS:Init-Clear CDS failed @ Offset=%lu Status=0x%08X\n", + CFE_ES_WriteToSysLog("%s: Clear CDS failed @ Offset=%lu Status=0x%08X\n", __func__, (unsigned long)CDS->Cache.Offset, (unsigned int)CDS->Cache.AccessStatus); } @@ -591,7 +589,7 @@ int32 CFE_ES_InitCDSSignatures(void) if (Status != CFE_SUCCESS) { /* BSP reported an error writing to CDS */ - CFE_ES_WriteToSysLog("CFE_CDS:Init-'_CDSBeg_' write failed. Status=0x%08X\n", + CFE_ES_WriteToSysLog("%s: '_CDSBeg_' write failed. Status=0x%08X\n", __func__, (unsigned int)CDS->Cache.AccessStatus); return Status; } @@ -603,7 +601,7 @@ int32 CFE_ES_InitCDSSignatures(void) Status = CFE_ES_CDS_CacheFlush(&CDS->Cache); if (Status != CFE_PSP_SUCCESS) { - CFE_ES_WriteToSysLog("CFE_CDS:Init-'_CDSEnd_' write failed. Status=0x%08X\n", + CFE_ES_WriteToSysLog("%s: '_CDSEnd_' write failed. Status=0x%08X\n", __func__, (unsigned int)CDS->Cache.AccessStatus); return Status; } @@ -638,7 +636,7 @@ int32 CFE_ES_InitCDSRegistry(void) } else { - CFE_ES_WriteToSysLog("CFE_CDS:InitReg-Failed to write Reg Size. Status=0x%08X\n", + CFE_ES_WriteToSysLog("%s: Failed to write Reg Size. Status=0x%08X\n", __func__, (unsigned int)CDS->Cache.AccessStatus); } @@ -663,7 +661,7 @@ int32 CFE_ES_UpdateCDSRegistry(void) if (Status != CFE_PSP_SUCCESS) { - CFE_ES_WriteToSysLog("CFE_CDS:UpdateReg-Failed to write CDS Registry. Status=0x%08X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Failed to write CDS Registry. Status=0x%08X\n", __func__, (unsigned int)Status); Status = CFE_ES_CDS_ACCESS_ERROR; } @@ -809,7 +807,7 @@ int32 CFE_ES_RebuildCDS(void) Status = CFE_ES_CDS_CacheFetch(&CDS->Cache, CDS_REG_SIZE_OFFSET, sizeof(CDS->Cache.Data.RegistrySize)); if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("CFE_CDS:Rebuild-PSP Error reading Registry size (%lx)\n", + CFE_ES_WriteToSysLog("%s: PSP Error reading Registry size (%lx)\n", __func__, (unsigned long)CDS->Cache.AccessStatus); return CFE_ES_CDS_INVALID; } @@ -817,7 +815,7 @@ int32 CFE_ES_RebuildCDS(void) if (CDS->Cache.Data.RegistrySize != CFE_PLATFORM_ES_CDS_MAX_NUM_ENTRIES) { /* Registry in CDS is incompatible size to recover */ - CFE_ES_WriteToSysLog("CFE_CDS:Rebuild-Registry in CDS incorrect size (%lu)\n", + CFE_ES_WriteToSysLog("%s: Registry in CDS incorrect size (%lu)\n", __func__, (unsigned long)CDS->Cache.Data.RegistrySize); return CFE_ES_CDS_INVALID; } @@ -832,7 +830,7 @@ int32 CFE_ES_RebuildCDS(void) else { /* Registry in CDS is unreadable */ - CFE_ES_WriteToSysLog("CFE_CDS:Rebuild-Registry in CDS is unreadable, PSP error %lx\n", (unsigned long)Status); + CFE_ES_WriteToSysLog("%s: Registry in CDS is unreadable, PSP error %lx\n", __func__, (unsigned long)Status); Status = CFE_ES_CDS_INVALID; } @@ -937,7 +935,7 @@ int32 CFE_ES_DeleteCDS(const char *CDSName, bool CalledByTblServices) /* Output the message to syslog once the CDS registry resource is unlocked */ if (LogMessage[0] != 0) { - CFE_ES_WriteToSysLog("%s(): %s", __func__, LogMessage); + CFE_ES_WriteToSysLog("%s: %s", __func__, LogMessage); } return Status; diff --git a/modules/es/fsw/src/cfe_es_cds_mempool.c b/modules/es/fsw/src/cfe_es_cds_mempool.c index 3b60461e1..2c041c084 100644 --- a/modules/es/fsw/src/cfe_es_cds_mempool.c +++ b/modules/es/fsw/src/cfe_es_cds_mempool.c @@ -122,7 +122,7 @@ int32 CFE_ES_CreateCDSPool(size_t CDSPoolSize, size_t StartOffset) if (ActualSize < SizeCheck) { /* Must be able make Pool verification, block descriptor and at least one of the smallest blocks */ - CFE_ES_SysLogWrite_Unsync("CFE_ES:CreateCDSPool-Pool size(%lu) too small for one CDS Block, need >=%lu\n", + CFE_ES_SysLogWrite_Unsync("%s: Pool size(%lu) too small for one CDS Block, need >=%lu\n", __func__, (unsigned long)ActualSize, (unsigned long)SizeCheck); return CFE_ES_CDS_INVALID_SIZE; } @@ -163,7 +163,7 @@ int32 CFE_ES_RebuildCDSPool(size_t CDSPoolSize, size_t StartOffset) if (Status != CFE_SUCCESS) { - CFE_ES_SysLogWrite_Unsync("CFE_ES:RebuildCDS-Err rebuilding CDS (Stat=0x%08x)\n", (unsigned int)Status); + CFE_ES_SysLogWrite_Unsync("%s: Err rebuilding CDS (Stat=0x%08x)\n", __func__, (unsigned int)Status); Status = CFE_ES_CDS_ACCESS_ERROR; } @@ -259,7 +259,7 @@ int32 CFE_ES_CDSBlockWrite(CFE_ES_CDSHandle_t Handle, const void *DataToWrite) /* Do the actual syslog if something went wrong */ if (LogMessage[0] != 0) { - CFE_ES_WriteToSysLog("%s(): %s", __func__, LogMessage); + CFE_ES_WriteToSysLog("%s: %s", __func__, LogMessage); } return Status; diff --git a/modules/es/fsw/src/cfe_es_erlog.c b/modules/es/fsw/src/cfe_es_erlog.c index 736fecae7..841918b0a 100644 --- a/modules/es/fsw/src/cfe_es_erlog.c +++ b/modules/es/fsw/src/cfe_es_erlog.c @@ -245,13 +245,7 @@ void CFE_ES_BackgroundERLogFileEventHandler(void *Meta, CFE_FS_FileWriteEvent_t BgFilePtr = (CFE_ES_BackgroundLogDumpGlobal_t *)Meta; - /* - * Note that this runs in the context of ES background task (file writer background job) - * It does NOT run in the context of the CFE_TBL app task. - * - * Events should use CFE_EVS_SendEventWithAppID() rather than CFE_EVS_SendEvent() - * to get proper association with TBL task. - */ + /* Note that this runs in the context of ES background task (file writer background job) */ switch (Event) { case CFE_FS_FileWriteEvent_COMPLETE: @@ -321,7 +315,7 @@ bool CFE_ES_RunExceptionScan(uint32 ElapsedTime, void *Arg) * Note that writes to the ES ER log actually do not get propagated to the debug console. * so by writing to SysLog here it becomes visible in both places. */ - CFE_ES_WriteToSysLog("ExceptionID 0x%lx in TaskID %lu: %s\n", (unsigned long)PspContextId, + CFE_ES_WriteToSysLog("%s: ExceptionID 0x%lx in TaskID %lu: %s\n", __func__, (unsigned long)PspContextId, OS_ObjectIdToInteger(ExceptionTaskID), ReasonString); /* @@ -376,14 +370,14 @@ bool CFE_ES_RunExceptionScan(uint32 ElapsedTime, void *Arg) if (CFE_ES_Global.ResetDataPtr->ResetVars.ProcessorResetCount >= CFE_ES_Global.ResetDataPtr->ResetVars.MaxProcessorResetCount) { - CFE_ES_WriteToSysLog("Maximum Processor Reset count reached (%u)", + CFE_ES_WriteToSysLog("%s: Maximum Processor Reset count reached (%u)", __func__, (unsigned int)CFE_ES_Global.ResetDataPtr->ResetVars.MaxProcessorResetCount); ResetType = CFE_PSP_RST_TYPE_POWERON; } else { - CFE_ES_WriteToSysLog("Processor Reset count not reached (%u/%u)", + CFE_ES_WriteToSysLog("%s: Processor Reset count not reached (%u/%u)", __func__, (unsigned int)CFE_ES_Global.ResetDataPtr->ResetVars.ProcessorResetCount, (unsigned int)CFE_ES_Global.ResetDataPtr->ResetVars.MaxProcessorResetCount); diff --git a/modules/es/fsw/src/cfe_es_generic_pool.c b/modules/es/fsw/src/cfe_es_generic_pool.c index 4afeaae54..ea6482f19 100644 --- a/modules/es/fsw/src/cfe_es_generic_pool.c +++ b/modules/es/fsw/src/cfe_es_generic_pool.c @@ -277,7 +277,7 @@ int32 CFE_ES_GenPoolInitialize(CFE_ES_GenPoolRecord_t *PoolRecPtr, size_t StartO */ if ((AlignMask & AlignSize) != 0) { - CFE_ES_WriteToSysLog("%s(): invalid alignment for pool: %lu\n", __func__, (unsigned long)AlignSize); + CFE_ES_WriteToSysLog("%s: invalid alignment for pool: %lu\n", __func__, (unsigned long)AlignSize); return CFE_ES_BAD_ARGUMENT; } @@ -380,7 +380,7 @@ int32 CFE_ES_GenPoolGetBlock(CFE_ES_GenPoolRecord_t *PoolRecPtr, size_t *BlockOf BucketId = CFE_ES_GenPoolFindBucket(PoolRecPtr, ReqSize); if (BucketId == 0) { - CFE_ES_WriteToSysLog("CFE_ES:getPoolBlock err:size(%lu) > max(%lu).\n", (unsigned long)ReqSize, + CFE_ES_WriteToSysLog("%s: Err:size(%lu) > max(%lu)\n", __func__, (unsigned long)ReqSize, (unsigned long)PoolRecPtr->Buckets[PoolRecPtr->NumBuckets - 1].BlockSize); return (CFE_ES_ERR_MEM_BLOCK_SIZE); } diff --git a/modules/es/fsw/src/cfe_es_mempool.c b/modules/es/fsw/src/cfe_es_mempool.c index 96c8a3d30..1aacb5d26 100644 --- a/modules/es/fsw/src/cfe_es_mempool.c +++ b/modules/es/fsw/src/cfe_es_mempool.c @@ -217,7 +217,7 @@ CFE_Status_t CFE_ES_PoolCreateEx(CFE_ES_MemHandle_t *PoolID, void *MemPtr, size_ /* If too many sizes are specified, return an error */ if (NumBlockSizes > CFE_PLATFORM_ES_POOL_MAX_BUCKETS) { - CFE_ES_WriteToSysLog("CFE_ES:poolCreate Num Block Sizes (%d) greater than max (%d)\n", (int)NumBlockSizes, + CFE_ES_WriteToSysLog("%s: Num Block Sizes (%d) greater than max (%d)\n", __func__, (int)NumBlockSizes, CFE_PLATFORM_ES_POOL_MAX_BUCKETS); return (CFE_ES_BAD_ARGUMENT); } @@ -240,7 +240,7 @@ CFE_Status_t CFE_ES_PoolCreateEx(CFE_ES_MemHandle_t *PoolID, void *MemPtr, size_ MinimumSize = CFE_ES_GenPoolCalcMinSize(NumBlockSizes, BlockSizes, 1); if (Size < MinimumSize) { - CFE_ES_WriteToSysLog("CFE_ES:poolCreate Pool size(%lu) too small, need >=%lu bytes\n", (unsigned long)Size, + CFE_ES_WriteToSysLog("%s: Pool size(%lu) too small, need >=%lu bytes\n", __func__, (unsigned long)Size, (unsigned long)MinimumSize); return CFE_ES_BAD_ARGUMENT; } @@ -254,7 +254,7 @@ CFE_Status_t CFE_ES_PoolCreateEx(CFE_ES_MemHandle_t *PoolID, void *MemPtr, size_ if (PoolRecPtr == NULL) { - CFE_ES_SysLogWrite_Unsync("ES Startup: No free MemPoolrary slots available\n"); + CFE_ES_SysLogWrite_Unsync("%s: No free MemPoolrary slots available\n", __func__); Status = CFE_ES_NO_RESOURCE_IDS_AVAILABLE; } else @@ -315,7 +315,7 @@ CFE_Status_t CFE_ES_PoolCreateEx(CFE_ES_MemHandle_t *PoolID, void *MemPtr, size_ if (Status != OS_SUCCESS) { /* log error and rewrite to CFE status code */ - CFE_ES_WriteToSysLog("CFE_ES:poolCreate OSAL error %d while creating mutex\n", (int)Status); + CFE_ES_WriteToSysLog("%s: OSAL error %d while creating mutex\n", __func__, (int)Status); Status = CFE_STATUS_EXTERNAL_RESOURCE_FAIL; } @@ -352,7 +352,7 @@ CFE_Status_t CFE_ES_PoolCreateEx(CFE_ES_MemHandle_t *PoolID, void *MemPtr, size_ if (Status == CFE_ES_POOL_BOUNDS_ERROR) { - CFE_ES_WriteToSysLog("CFE_ES:poolCreate Pool size(%lu) too small\n", (unsigned long)Size); + CFE_ES_WriteToSysLog("%s: Pool size(%lu) too small\n", __func__, (unsigned long)Size); } } @@ -412,7 +412,7 @@ int32 CFE_ES_PoolDelete(CFE_ES_MemHandle_t PoolID) * The MemPool entry has already been deleted, so this * function should not return an error at this point. */ - CFE_ES_WriteToSysLog("CFE_ES:poolDelete error %d deleting mutex\n", (int)MutDeleteStatus); + CFE_ES_WriteToSysLog("%s: Error %d deleting mutex\n", __func__, (int)MutDeleteStatus); } } @@ -445,7 +445,7 @@ int32 CFE_ES_GetPoolBuf(CFE_ES_MemPoolBuf_t *BufPtr, CFE_ES_MemHandle_t Handle, if (!CFE_ES_MemPoolRecordIsMatch(PoolRecPtr, Handle)) { CFE_ES_GetAppID(&AppId); - CFE_ES_WriteToSysLog("CFE_ES:getPoolBuf err:Bad handle(0x%08lX) AppId=%lu\n", CFE_RESOURCEID_TO_ULONG(Handle), + CFE_ES_WriteToSysLog("%s: Err:Bad handle(0x%08lX) AppId=%lu\n", __func__, CFE_RESOURCEID_TO_ULONG(Handle), CFE_RESOURCEID_TO_ULONG(AppId)); return (CFE_ES_ERR_RESOURCEID_NOT_VALID); } @@ -575,8 +575,7 @@ int32 CFE_ES_PutPoolBuf(CFE_ES_MemHandle_t Handle, CFE_ES_MemPoolBuf_t BufPtr) /* basic sanity check */ if (!CFE_ES_MemPoolRecordIsMatch(PoolRecPtr, Handle)) { - CFE_ES_WriteToSysLog("CFE_ES:putPoolBuf err:Invalid Memory Handle (0x%08lX).\n", - CFE_RESOURCEID_TO_ULONG(Handle)); + CFE_ES_WriteToSysLog("%s: Err:Invalid Memory Handle (0x%08lX).\n", __func__, CFE_RESOURCEID_TO_ULONG(Handle)); return (CFE_ES_ERR_RESOURCEID_NOT_VALID); } @@ -621,13 +620,12 @@ int32 CFE_ES_PutPoolBuf(CFE_ES_MemHandle_t Handle, CFE_ES_MemPoolBuf_t BufPtr) } else if (Status == CFE_ES_POOL_BLOCK_INVALID) { - CFE_ES_WriteToSysLog("CFE_ES:putPoolBuf err:Deallocating invalid or corrupt memory block @ 0x%08lX\n", + CFE_ES_WriteToSysLog("%s: Err:Deallocating invalid or corrupt memory block @ 0x%08lX\n", __func__, (unsigned long)BufPtr); } else if (Status == CFE_ES_BUFFER_NOT_IN_POOL) { - CFE_ES_WriteToSysLog("CFE_ES_GenPoolPutBlock err:Bad offset(%lu) outside pool boundary\n", - (unsigned long)DataOffset); + CFE_ES_WriteToSysLog("%s: Err:Bad offset(%lu) outside pool boundary\n", __func__, (unsigned long)DataOffset); } return Status; @@ -659,8 +657,8 @@ CFE_Status_t CFE_ES_GetMemPoolStats(CFE_ES_MemPoolStats_t *BufPtr, CFE_ES_MemHan if (!CFE_ES_MemPoolRecordIsMatch(PoolRecPtr, Handle)) { CFE_ES_GetAppID(&AppId); - CFE_ES_WriteToSysLog("CFE_ES:getMemPoolStats err:Bad handle(0x%08lX) AppId=%lu\n", - CFE_RESOURCEID_TO_ULONG(Handle), CFE_RESOURCEID_TO_ULONG(AppId)); + CFE_ES_WriteToSysLog("%s: Err:Bad handle(0x%08lX) AppId=%lu\n", __func__, CFE_RESOURCEID_TO_ULONG(Handle), + CFE_RESOURCEID_TO_ULONG(AppId)); return (CFE_ES_ERR_RESOURCEID_NOT_VALID); } diff --git a/modules/es/fsw/src/cfe_es_objtab.c b/modules/es/fsw/src/cfe_es_objtab.c index 2d8782e75..6bf370f3b 100644 --- a/modules/es/fsw/src/cfe_es_objtab.c +++ b/modules/es/fsw/src/cfe_es_objtab.c @@ -23,7 +23,7 @@ ** cfe_es_objtab.c ** ** Purpose: -** This file contains the OS_object_table for MAP Build1. +** This file contains the OS_object_table for system initialization/startup. ** ** References: ** Flight Software Branch C Coding Standard Version 1.0a diff --git a/modules/es/fsw/src/cfe_es_perf.c b/modules/es/fsw/src/cfe_es_perf.c index 1ea940325..bb50bd385 100644 --- a/modules/es/fsw/src/cfe_es_perf.c +++ b/modules/es/fsw/src/cfe_es_perf.c @@ -611,7 +611,7 @@ void CFE_ES_PerfLogAdd(uint32 Marker, uint32 EntryExit) /* if marker has not been reported previously ... */ if (Perf->MetaData.InvalidMarkerReported == false) { - CFE_ES_WriteToSysLog("ES PERF:Invalid performance marker %d,max is %d\n", (unsigned int)Marker, + CFE_ES_WriteToSysLog("%s: Invalid performance marker %d,max is %d\n", __func__, (unsigned int)Marker, (CFE_MISSION_ES_PERF_MAX_IDS - 1)); Perf->MetaData.InvalidMarkerReported = true; } /* end if */ diff --git a/modules/es/fsw/src/cfe_es_start.c b/modules/es/fsw/src/cfe_es_start.c index ec550bfa1..6cd5ede42 100644 --- a/modules/es/fsw/src/cfe_es_start.c +++ b/modules/es/fsw/src/cfe_es_start.c @@ -101,7 +101,7 @@ void CFE_ES_Main(uint32 StartType, uint32 StartSubtype, uint32 ModeId, const cha (unsigned int)ReturnCode); /* - ** Delay to allow the message to be read + ** Delay to allow the message to be printed */ OS_TaskDelay(CFE_ES_PANIC_DELAY); @@ -137,7 +137,7 @@ void CFE_ES_Main(uint32 StartType, uint32 StartSubtype, uint32 ModeId, const cha ReturnCode = OS_MutSemCreate(&CFE_ES_Global.PerfDataMutex, "ES_PERF_MUTEX", 0); if (ReturnCode != OS_SUCCESS) { - CFE_ES_SysLogWrite_Unsync("ES Startup: Error: ES Performance Data Mutex could not be created. RC=0x%08X\n", + CFE_ES_SysLogWrite_Unsync("%s: Error: ES Performance Data Mutex could not be created. RC=0x%08X\n", __func__, (unsigned int)ReturnCode); /* @@ -159,7 +159,7 @@ void CFE_ES_Main(uint32 StartType, uint32 StartSubtype, uint32 ModeId, const cha /* ** Announce the startup */ - CFE_ES_WriteToSysLog("ES Startup: CFE_ES_Main in EARLY_INIT state\n"); + CFE_ES_WriteToSysLog("%s: CFE_ES_Main in EARLY_INIT state\n", __func__); /* ** Create and Mount the filesystems needed @@ -182,7 +182,7 @@ void CFE_ES_Main(uint32 StartType, uint32 StartSubtype, uint32 ModeId, const cha /* ** Indicate that the CFE core is now starting up / going multi-threaded */ - CFE_ES_WriteToSysLog("ES Startup: CFE_ES_Main entering CORE_STARTUP state\n"); + CFE_ES_WriteToSysLog("%s: CFE_ES_Main entering CORE_STARTUP state\n", __func__); CFE_ES_Global.SystemState = CFE_ES_SystemState_CORE_STARTUP; /* @@ -193,7 +193,7 @@ void CFE_ES_Main(uint32 StartType, uint32 StartSubtype, uint32 ModeId, const cha /* ** Indicate that the CFE core is ready */ - CFE_ES_WriteToSysLog("ES Startup: CFE_ES_Main entering CORE_READY state\n"); + CFE_ES_WriteToSysLog("%s: CFE_ES_Main entering CORE_READY state\n", __func__); CFE_ES_Global.SystemState = CFE_ES_SystemState_CORE_READY; /* @@ -212,10 +212,10 @@ void CFE_ES_Main(uint32 StartType, uint32 StartSubtype, uint32 ModeId, const cha */ if (CFE_ES_MainTaskSyncDelay(CFE_ES_AppState_LATE_INIT, CFE_PLATFORM_ES_STARTUP_SCRIPT_TIMEOUT_MSEC) != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("ES Startup: Startup Sync failed - Applications may not have all initialized\n"); + CFE_ES_WriteToSysLog("%s: Startup Sync failed - Applications may not have all initialized\n", __func__); } - CFE_ES_WriteToSysLog("ES Startup: CFE_ES_Main entering APPS_INIT state\n"); + CFE_ES_WriteToSysLog("%s: CFE_ES_Main entering APPS_INIT state\n", __func__); CFE_ES_Global.SystemState = CFE_ES_SystemState_APPS_INIT; /* @@ -227,13 +227,13 @@ void CFE_ES_Main(uint32 StartType, uint32 StartSubtype, uint32 ModeId, const cha */ if (CFE_ES_MainTaskSyncDelay(CFE_ES_AppState_RUNNING, CFE_PLATFORM_ES_STARTUP_SCRIPT_TIMEOUT_MSEC) != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("ES Startup: Startup Sync failed - Applications may not have all started\n"); + CFE_ES_WriteToSysLog("%s: Startup Sync failed - Applications may not have all started\n", __func__); } /* ** Startup is fully complete */ - CFE_ES_WriteToSysLog("ES Startup: CFE_ES_Main entering OPERATIONAL state\n"); + CFE_ES_WriteToSysLog("%s: CFE_ES_Main entering OPERATIONAL state\n", __func__); CFE_ES_Global.SystemState = CFE_ES_SystemState_OPERATIONAL; } @@ -339,19 +339,19 @@ void CFE_ES_SetupResetVariables(uint32 StartType, uint32 StartSubtype, uint32 Bo */ if (StartSubtype == CFE_PSP_RST_SUBTYPE_POWER_CYCLE) { - CFE_ES_SysLogWrite_Unsync("POWER ON RESET due to Power Cycle (Power Cycle).\n"); + CFE_ES_SysLogWrite_Unsync("%s: POWER ON RESET due to Power Cycle (Power Cycle).\n", __func__); CFE_ES_WriteToERLog(CFE_ES_LogEntryType_CORE, CFE_PSP_RST_TYPE_POWERON, StartSubtype, "POWER ON RESET due to Power Cycle (Power Cycle)"); } else if (StartSubtype == CFE_PSP_RST_SUBTYPE_HW_SPECIAL_COMMAND) { - CFE_ES_SysLogWrite_Unsync("POWER ON RESET due to HW Special Cmd (Hw Spec Cmd).\n"); + CFE_ES_SysLogWrite_Unsync("%s: POWER ON RESET due to HW Special Cmd (Hw Spec Cmd).\n", __func__); CFE_ES_WriteToERLog(CFE_ES_LogEntryType_CORE, CFE_PSP_RST_TYPE_POWERON, StartSubtype, "POWER ON RESET due to HW Special Cmd (Hw Spec Cmd)"); } else { - CFE_ES_SysLogWrite_Unsync("POWER ON RESET due to other cause (See Subtype).\n"); + CFE_ES_SysLogWrite_Unsync("%s: POWER ON RESET due to other cause (See Subtype).\n", __func__); CFE_ES_WriteToERLog(CFE_ES_LogEntryType_CORE, CFE_PSP_RST_TYPE_POWERON, StartSubtype, "POWER ON RESET due to other cause (See Subtype)"); } @@ -384,7 +384,7 @@ void CFE_ES_SetupResetVariables(uint32 StartType, uint32 StartSubtype, uint32 Bo if (StartSubtype == CFE_PSP_RST_SUBTYPE_HW_SPECIAL_COMMAND) { CFE_ES_Global.ResetDataPtr->ResetVars.ResetSubtype = CFE_PSP_RST_SUBTYPE_HW_SPECIAL_COMMAND; - CFE_ES_SysLogWrite_Unsync("POWER ON RESET due to max proc resets (HW Spec Cmd).\n"); + CFE_ES_SysLogWrite_Unsync("%s: POWER ON RESET due to max proc resets (HW Spec Cmd).\n", __func__); /* ** Log the reset in the ER Log. The log will be wiped out, but it's good to have @@ -396,7 +396,7 @@ void CFE_ES_SetupResetVariables(uint32 StartType, uint32 StartSubtype, uint32 Bo else { CFE_ES_Global.ResetDataPtr->ResetVars.ResetSubtype = CFE_PSP_RST_SUBTYPE_HW_WATCHDOG; - CFE_ES_SysLogWrite_Unsync("POWER ON RESET due to max proc resets (Watchdog).\n"); + CFE_ES_SysLogWrite_Unsync("%s: POWER ON RESET due to max proc resets (Watchdog).\n", __func__); /* ** Log the reset in the ER Log. The log will be wiped out, but it's good to have @@ -413,14 +413,15 @@ void CFE_ES_SetupResetVariables(uint32 StartType, uint32 StartSubtype, uint32 Bo /* ** Should not return here. */ - CFE_ES_SysLogWrite_Unsync("ES Startup: Error: CFE_PSP_Restart returned.\n"); + CFE_ES_SysLogWrite_Unsync("%s: Error: CFE_PSP_Restart returned.\n", __func__); } else /* Maximum processor reset not exceeded */ { if (StartSubtype == CFE_PSP_RST_SUBTYPE_HW_SPECIAL_COMMAND) { CFE_ES_Global.ResetDataPtr->ResetVars.ResetSubtype = CFE_PSP_RST_SUBTYPE_HW_SPECIAL_COMMAND; - CFE_ES_SysLogWrite_Unsync("PROCESSOR RESET due to Hardware Special Command (HW Spec Cmd).\n"); + CFE_ES_SysLogWrite_Unsync("%s: PROCESSOR RESET due to Hardware Special Command (HW Spec Cmd).\n", + __func__); /* ** Log the watchdog reset @@ -431,7 +432,7 @@ void CFE_ES_SetupResetVariables(uint32 StartType, uint32 StartSubtype, uint32 Bo else { CFE_ES_Global.ResetDataPtr->ResetVars.ResetSubtype = CFE_PSP_RST_SUBTYPE_HW_WATCHDOG; - CFE_ES_SysLogWrite_Unsync("PROCESSOR RESET due to Watchdog (Watchdog).\n"); + CFE_ES_SysLogWrite_Unsync("%s: PROCESSOR RESET due to Watchdog (Watchdog).\n", __func__); /* ** Log the watchdog reset @@ -489,7 +490,8 @@ void CFE_ES_InitializeFileSystems(uint32 StartType) if (RetStatus != CFE_PSP_SUCCESS) { - CFE_ES_WriteToSysLog("ES Startup: Cannot Get Memory for Volatile Disk. EC = 0x%08X\n", (unsigned int)RetStatus); + CFE_ES_WriteToSysLog("%s: Cannot Get Memory for Volatile Disk. EC = 0x%08X\n", __func__, + (unsigned int)RetStatus); /* ** Delay to allow the message to be read @@ -512,7 +514,7 @@ void CFE_ES_InitializeFileSystems(uint32 StartType) CFE_PLATFORM_ES_RAM_DISK_NUM_SECTORS); if (RetStatus != OS_SUCCESS) { - CFE_ES_WriteToSysLog("ES Startup: Error Creating Volatile(RAM) Volume. EC = 0x%08X\n", + CFE_ES_WriteToSysLog("%s: Error Creating Volatile(RAM) Volume. EC = 0x%08X\n", __func__, (unsigned int)RetStatus); /* @@ -532,15 +534,15 @@ void CFE_ES_InitializeFileSystems(uint32 StartType) CFE_PLATFORM_ES_RAM_DISK_NUM_SECTORS); if (RetStatus != OS_SUCCESS) { - CFE_ES_WriteToSysLog("ES Startup: Error Initializing Volatile(RAM) Volume. EC = 0x%08X\n", + CFE_ES_WriteToSysLog("%s: Error Initializing Volatile(RAM) Volume. EC = 0x%08X\n", __func__, (unsigned int)RetStatus); - CFE_ES_WriteToSysLog("ES Startup: Formatting Volatile(RAM) Volume.\n"); + CFE_ES_WriteToSysLog("%s: Formatting Volatile(RAM) Volume.\n", __func__); RetStatus = OS_mkfs((void *)RamDiskMemoryAddress, "/ramdev0", "RAM", CFE_PLATFORM_ES_RAM_DISK_SECTOR_SIZE, CFE_PLATFORM_ES_RAM_DISK_NUM_SECTORS); if (RetStatus != OS_SUCCESS) { - CFE_ES_WriteToSysLog("ES Startup: Error Creating Volatile(RAM) Volume. EC = 0x%08X\n", + CFE_ES_WriteToSysLog("%s: Error Creating Volatile(RAM) Volume. EC = 0x%08X\n", __func__, (unsigned int)RetStatus); /* @@ -562,7 +564,8 @@ void CFE_ES_InitializeFileSystems(uint32 StartType) RetStatus = OS_mount("/ramdev0", CFE_PLATFORM_ES_RAM_DISK_MOUNT_STRING); if (RetStatus != OS_SUCCESS) { - CFE_ES_WriteToSysLog("ES Startup: Error Mounting Volatile(RAM) Volume. EC = 0x%08X\n", (unsigned int)RetStatus); + CFE_ES_WriteToSysLog("%s: Error Mounting Volatile(RAM) Volume. EC = 0x%08X\n", __func__, + (unsigned int)RetStatus); /* ** Delay to allow the message to be read */ @@ -593,11 +596,11 @@ void CFE_ES_InitializeFileSystems(uint32 StartType) ** Determine if the disk is too full */ PercentFree = (StatBuf.blocks_free * 100) / StatBuf.total_blocks; - CFE_ES_WriteToSysLog("Volatile Disk has %d Percent free space.\n", (int)PercentFree); + CFE_ES_WriteToSysLog("%s: Volatile Disk has %d Percent free space.\n", __func__, (int)PercentFree); if (PercentFree < CFE_PLATFORM_ES_RAM_DISK_PERCENT_RESERVED) { - CFE_ES_WriteToSysLog("ES Startup: Insufficent Free Space on Volatile Disk, Reformatting.\n"); + CFE_ES_WriteToSysLog("%s: Insufficent Free Space on Volatile Disk, Reformatting.\n", __func__); /* ** First, unmount the disk @@ -626,9 +629,8 @@ void CFE_ES_InitializeFileSystems(uint32 StartType) RetStatus = OS_mount("/ramdev0", CFE_PLATFORM_ES_RAM_DISK_MOUNT_STRING); if (RetStatus != OS_SUCCESS) { - CFE_ES_WriteToSysLog( - "ES Startup: Error Re-Mounting Volatile(RAM) Volume. EC = 0x%08X\n", - (unsigned int)RetStatus); + CFE_ES_WriteToSysLog("%s: Error Re-Mounting Volatile(RAM) Volume. EC = 0x%08X\n", + __func__, (unsigned int)RetStatus); /* ** Delay to allow the message to be read */ @@ -644,7 +646,7 @@ void CFE_ES_InitializeFileSystems(uint32 StartType) else { - CFE_ES_WriteToSysLog("ES Startup: Error Re-Formating Volatile(RAM) Volume. EC = 0x%08X\n", + CFE_ES_WriteToSysLog("%s: Error Re-Formating Volatile(RAM) Volume. EC = 0x%08X\n", __func__, (unsigned int)RetStatus); /* ** Delay to allow the message to be read @@ -661,7 +663,7 @@ void CFE_ES_InitializeFileSystems(uint32 StartType) else /* could not Remove File system */ { - CFE_ES_WriteToSysLog("ES Startup: Error Removing Volatile(RAM) Volume. EC = 0x%08X\n", + CFE_ES_WriteToSysLog("%s: Error Removing Volatile(RAM) Volume. EC = 0x%08X\n", __func__, (unsigned int)RetStatus); /* ** Delay to allow the message to be read @@ -677,7 +679,7 @@ void CFE_ES_InitializeFileSystems(uint32 StartType) } else /* could not un-mount disk */ { - CFE_ES_WriteToSysLog("ES Startup: Error Un-Mounting Volatile(RAM) Volume. EC = 0x%08X\n", + CFE_ES_WriteToSysLog("%s: Error Un-Mounting Volatile(RAM) Volume. EC = 0x%08X\n", __func__, (unsigned int)RetStatus); /* ** Delay to allow the message to be read @@ -695,7 +697,7 @@ void CFE_ES_InitializeFileSystems(uint32 StartType) else /* could not determine free blocks */ { /* Log error message -- note that BlocksFree returns the error code in this case */ - CFE_ES_WriteToSysLog("ES Startup: Error Determining Blocks Free on Volume. EC = 0x%08X\n", + CFE_ES_WriteToSysLog("%s: Error Determining Blocks Free on Volume. EC = 0x%08X\n", __func__, (unsigned int)RetStatus); /* @@ -728,7 +730,7 @@ void CFE_ES_CreateObjects(void) CFE_ES_AppRecord_t *AppRecPtr; CFE_ResourceId_t PendingAppId; - CFE_ES_WriteToSysLog("ES Startup: Starting Object Creation calls.\n"); + CFE_ES_WriteToSysLog("%s: Starting Object Creation calls.\n", __func__); for (i = 0; i < CFE_PLATFORM_ES_OBJECT_TABLE_SIZE; i++) { @@ -815,7 +817,7 @@ void CFE_ES_CreateObjects(void) else { /* appSlot not found -- This should never happen!*/ - CFE_ES_WriteToSysLog("ES Startup: Error, No free application slots available for CORE App!\n"); + CFE_ES_WriteToSysLog("%s: Error, No free application slots available for CORE App!\n", __func__); ReturnCode = CFE_ES_ERR_APP_CREATE; } @@ -831,7 +833,7 @@ void CFE_ES_CreateObjects(void) if (ReturnCode != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("ES Startup: OS_TaskCreate error creating core App: %s: EC = 0x%08X\n", + CFE_ES_WriteToSysLog("%s: OS_TaskCreate error creating core App: %s: EC = 0x%08X\n", __func__, CFE_ES_ObjectTable[i].ObjectName, (unsigned int)ReturnCode); /* @@ -850,14 +852,14 @@ void CFE_ES_CreateObjects(void) if (CFE_ES_ObjectTable[i].FuncPtrUnion.FunctionPtr != NULL) { - CFE_ES_WriteToSysLog("ES Startup: Calling %s\n", CFE_ES_ObjectTable[i].ObjectName); + CFE_ES_WriteToSysLog("%s: Calling %s\n", __func__, CFE_ES_ObjectTable[i].ObjectName); /* ** Call the function */ ReturnCode = (*CFE_ES_ObjectTable[i].FuncPtrUnion.FunctionPtr)(); if (ReturnCode != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("ES Startup: Error returned when calling function: %s: EC = 0x%08X\n", + CFE_ES_WriteToSysLog("%s: Error returned when calling function: %s: EC = 0x%08X\n", __func__, CFE_ES_ObjectTable[i].ObjectName, (unsigned int)ReturnCode); /* @@ -874,7 +876,7 @@ void CFE_ES_CreateObjects(void) } else { - CFE_ES_WriteToSysLog("ES Startup: bad function pointer ( table entry = %d).\n", i); + CFE_ES_WriteToSysLog("%s: bad function pointer ( table entry = %d).\n", __func__, i); } break; @@ -886,7 +888,7 @@ void CFE_ES_CreateObjects(void) } /* end for */ - CFE_ES_WriteToSysLog("ES Startup: Finished ES CreateObject table entries.\n"); + CFE_ES_WriteToSysLog("%s: Finished ES CreateObject table entries.\n", __func__); } /*---------------------------------------------------------------- diff --git a/modules/es/fsw/src/cfe_es_task.c b/modules/es/fsw/src/cfe_es_task.c index f1275f59d..08f2fca00 100644 --- a/modules/es/fsw/src/cfe_es_task.c +++ b/modules/es/fsw/src/cfe_es_task.c @@ -92,7 +92,7 @@ void CFE_ES_TaskMain(void) /* ** Create a syslog entry */ - CFE_ES_WriteToSysLog("ES:Application Init Failed,RC=0x%08X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Application Init Failed,RC=0x%08X\n", __func__, (unsigned int)Status); /* ** Allow Core App to Exit @@ -155,7 +155,7 @@ void CFE_ES_TaskMain(void) /* ** SB Error: Write a SysLog Message */ - CFE_ES_WriteToSysLog("ES:Error reading cmd pipe,RC=0x%08X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Error reading cmd pipe,RC=0x%08X\n", __func__, (unsigned int)Status); /* ** Allow Core App to Exit @@ -261,7 +261,7 @@ void CFE_ES_GenerateVersionEvents(void) Status = CFE_ES_GenerateSingleVersionEvent("Mission", GLOBAL_CONFIGDATA.MissionName); if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("ES:Error sending mission version event:RC=0x%08X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Error sending mission version event:RC=0x%08X\n", __func__, (unsigned int)Status); } /* @@ -276,7 +276,8 @@ void CFE_ES_GenerateVersionEvents(void) Status = CFE_ES_GenerateSingleVersionEvent("Core Module", ModuleNamePtr->Name); if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("ES:Error sending core module version event:RC=0x%08X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Error sending core module version event:RC=0x%08X\n", __func__, + (unsigned int)Status); } ++ModuleNamePtr; } @@ -293,7 +294,8 @@ void CFE_ES_GenerateVersionEvents(void) Status = CFE_ES_GenerateSingleVersionEvent("PSP Module", StaticModulePtr->Name); if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("ES:Error sending PSP module version event:RC=0x%08X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Error sending PSP module version event:RC=0x%08X\n", __func__, + (unsigned int)Status); } ++StaticModulePtr; } @@ -340,7 +342,7 @@ void CFE_ES_GenerateBuildInfoEvents(void) BuildDate, BuildUser, BuildHost, GLOBAL_CONFIGDATA.Config); if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("ES:Error sending build info event:RC=0x%08X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Error sending build info event:RC=0x%08X\n", __func__, (unsigned int)Status); } } @@ -383,7 +385,7 @@ int32 CFE_ES_TaskInit(void) Status = CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY); if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("ES:Call to CFE_EVS_Register Failed, RC = 0x%08X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Call to CFE_EVS_Register Failed, RC = 0x%08X\n", __func__, (unsigned int)Status); return (Status); } @@ -411,7 +413,7 @@ int32 CFE_ES_TaskInit(void) Status = CFE_SB_CreatePipe(&CFE_ES_Global.TaskData.CmdPipe, CFE_ES_PIPE_DEPTH, CFE_ES_PIPE_NAME); if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("ES:Cannot Create SB Pipe, RC = 0x%08X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Cannot Create SB Pipe, RC = 0x%08X\n", __func__, (unsigned int)Status); return (Status); } @@ -421,7 +423,7 @@ int32 CFE_ES_TaskInit(void) Status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(CFE_ES_SEND_HK_MID), CFE_ES_Global.TaskData.CmdPipe); if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("ES:Cannot Subscribe to HK packet, RC = 0x%08X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Cannot Subscribe to HK packet, RC = 0x%08X\n", __func__, (unsigned int)Status); return (Status); } @@ -431,7 +433,8 @@ int32 CFE_ES_TaskInit(void) Status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(CFE_ES_CMD_MID), CFE_ES_Global.TaskData.CmdPipe); if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("ES:Cannot Subscribe to ES ground commands, RC = 0x%08X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Cannot Subscribe to ES ground commands, RC = 0x%08X\n", __func__, + (unsigned int)Status); return (Status); } @@ -474,10 +477,11 @@ int32 CFE_ES_TaskInit(void) /* ** Task startup event message. */ - Status = CFE_EVS_SendEvent(CFE_ES_INIT_INF_EID, CFE_EVS_EventType_INFORMATION, "cFE ES Initialized"); + Status = CFE_EVS_SendEvent(CFE_ES_INIT_INF_EID, CFE_EVS_EventType_INFORMATION, "cFE ES Initialized: %s", + CFE_VERSION_STRING); if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("ES:Error sending init event:RC=0x%08X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Error sending init event:RC=0x%08X\n", __func__, (unsigned int)Status); return (Status); } @@ -488,7 +492,7 @@ int32 CFE_ES_TaskInit(void) if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("ES:Error sending init stats event:RC=0x%08X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Error sending init stats event:RC=0x%08X\n", __func__, (unsigned int)Status); return (Status); } @@ -506,7 +510,7 @@ int32 CFE_ES_TaskInit(void) Status = CFE_ES_BackgroundInit(); if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("ES:Error initializing background task:RC=0x%08X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Error initializing background task:RC=0x%08X\n", __func__, (unsigned int)Status); return (Status); } diff --git a/modules/evs/fsw/src/cfe_evs.c b/modules/evs/fsw/src/cfe_evs.c index e1a8ab98f..480508404 100644 --- a/modules/evs/fsw/src/cfe_evs.c +++ b/modules/evs/fsw/src/cfe_evs.c @@ -82,7 +82,7 @@ CFE_Status_t CFE_EVS_Register(const void *Filters, uint16 NumEventFilters, uint1 else { FilterLimit = CFE_PLATFORM_EVS_MAX_EVENT_FILTERS; - CFE_ES_WriteToSysLog("CFE_EVS_Register: Filter limit truncated to %d\n", (int)FilterLimit); + CFE_ES_WriteToSysLog("%s: Filter limit truncated to %d\n", __func__, (int)FilterLimit); } if (Filters != NULL) diff --git a/modules/evs/fsw/src/cfe_evs_task.c b/modules/evs/fsw/src/cfe_evs_task.c index 99d6f6366..5ebd5eef1 100644 --- a/modules/evs/fsw/src/cfe_evs_task.c +++ b/modules/evs/fsw/src/cfe_evs_task.c @@ -86,7 +86,7 @@ int32 CFE_EVS_EarlyInit(void) if (Status != CFE_PSP_SUCCESS) { /* Can't log evs messages without the reset area */ - CFE_ES_WriteToSysLog("EVS call to CFE_PSP_GetResetArea failed, RC=0x%08x\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Call to CFE_PSP_GetResetArea failed, RC=0x%08x\n", __func__, (unsigned int)Status); /* Delay to allow message to be read */ OS_TaskDelay(CFE_EVS_PANIC_DELAY); @@ -97,8 +97,8 @@ int32 CFE_EVS_EarlyInit(void) { /* Got the pointer but the size is wrong */ Status = CFE_EVS_RESET_AREA_POINTER; - CFE_ES_WriteToSysLog("Unexpected size from CFE_PSP_GetResetArea: expected = 0x%08lX, actual = 0x%08lX\n", - (unsigned long)sizeof(CFE_ES_ResetData_t), (unsigned long)resetAreaSize); + CFE_ES_WriteToSysLog("%s: Unexpected size from CFE_PSP_GetResetArea: expected = 0x%08lX, actual = 0x%08lX\n", + __func__, (unsigned long)sizeof(CFE_ES_ResetData_t), (unsigned long)resetAreaSize); /* Delay to allow message to be read */ OS_TaskDelay(CFE_EVS_PANIC_DELAY); @@ -116,7 +116,7 @@ int32 CFE_EVS_EarlyInit(void) if (Status != OS_SUCCESS) { - CFE_ES_WriteToSysLog("EVS call to OS_MutSemCreate failed, RC=0x%08x\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: OS_MutSemCreate failed, RC=0x%08x\n", __func__, (unsigned int)Status); /* Delay to allow message to be read */ OS_TaskDelay(CFE_EVS_PANIC_DELAY); @@ -135,7 +135,7 @@ int32 CFE_EVS_EarlyInit(void) /* Clear event log if power-on reset or bad contents */ if (CFE_ES_GetResetType(NULL) == CFE_PSP_RST_TYPE_POWERON) { - CFE_ES_WriteToSysLog("Event Log cleared following power-on reset\n"); + CFE_ES_WriteToSysLog("%s: Event Log cleared following power-on reset\n", __func__); EVS_ClearLog(); CFE_EVS_Global.EVS_LogPtr->LogMode = CFE_PLATFORM_EVS_DEFAULT_LOG_MODE; } @@ -145,7 +145,7 @@ int32 CFE_EVS_EarlyInit(void) (CFE_EVS_Global.EVS_LogPtr->LogFullFlag != true)) || (CFE_EVS_Global.EVS_LogPtr->Next >= CFE_PLATFORM_EVS_LOG_MAX)) { - CFE_ES_WriteToSysLog("Event Log cleared, n=%d, c=%d, f=%d, m=%d, o=%d\n", + CFE_ES_WriteToSysLog("%s: Event Log cleared, n=%d, c=%d, f=%d, m=%d, o=%d\n", __func__, (int)CFE_EVS_Global.EVS_LogPtr->Next, (int)CFE_EVS_Global.EVS_LogPtr->LogCount, (int)CFE_EVS_Global.EVS_LogPtr->LogFullFlag, (int)CFE_EVS_Global.EVS_LogPtr->LogMode, (int)CFE_EVS_Global.EVS_LogPtr->LogOverflowCounter); @@ -154,7 +154,7 @@ int32 CFE_EVS_EarlyInit(void) } else { - CFE_ES_WriteToSysLog("Event Log restored, n=%d, c=%d, f=%d, m=%d, o=%d\n", + CFE_ES_WriteToSysLog("%s: Event Log restored, n=%d, c=%d, f=%d, m=%d, o=%d\n", __func__, (int)CFE_EVS_Global.EVS_LogPtr->Next, (int)CFE_EVS_Global.EVS_LogPtr->LogCount, (int)CFE_EVS_Global.EVS_LogPtr->LogFullFlag, (int)CFE_EVS_Global.EVS_LogPtr->LogMode, (int)CFE_EVS_Global.EVS_LogPtr->LogOverflowCounter); @@ -210,7 +210,7 @@ void CFE_EVS_TaskMain(void) if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("EVS:Application Init Failed,RC=0x%08X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Application Init Failed,RC=0x%08X\n", __func__, (unsigned int)Status); CFE_ES_PerfLogExit(CFE_MISSION_EVS_MAIN_PERF_ID); /* Note: CFE_ES_ExitApp will not return */ CFE_ES_ExitApp(CFE_ES_RunStatus_CORE_APP_INIT_ERROR); @@ -244,7 +244,7 @@ void CFE_EVS_TaskMain(void) } else { - CFE_ES_WriteToSysLog("EVS:Error reading cmd pipe,RC=0x%08X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Error reading cmd pipe,RC=0x%08X\n", __func__, (unsigned int)Status); } /* end if */ } /* end while */ @@ -270,7 +270,7 @@ int32 CFE_EVS_TaskInit(void) Status = CFE_ES_GetAppID(&AppID); if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("EVS:Call to CFE_ES_GetAppID Failed:RC=0x%08X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Call to CFE_ES_GetAppID Failed:RC=0x%08X\n", __func__, (unsigned int)Status); return Status; } @@ -278,7 +278,7 @@ int32 CFE_EVS_TaskInit(void) Status = CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY); if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("EVS:Call to CFE_EVS_Register Failed:RC=0x%08X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Call to CFE_EVS_Register Failed:RC=0x%08X\n", __func__, (unsigned int)Status); return Status; } @@ -286,7 +286,7 @@ int32 CFE_EVS_TaskInit(void) Status = CFE_SB_CreatePipe(&CFE_EVS_Global.EVS_CommandPipe, CFE_EVS_PIPE_DEPTH, CFE_EVS_PIPE_NAME); if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("EVS:Call to CFE_SB_CreatePipe Failed:RC=0x%08X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Call to CFE_SB_CreatePipe Failed:RC=0x%08X\n", __func__, (unsigned int)Status); return Status; } @@ -294,20 +294,20 @@ int32 CFE_EVS_TaskInit(void) Status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(CFE_EVS_CMD_MID), CFE_EVS_Global.EVS_CommandPipe); if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("EVS:Subscribing to Cmds Failed:RC=0x%08X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Subscribing to Cmds Failed:RC=0x%08X\n", __func__, (unsigned int)Status); return Status; } Status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(CFE_EVS_SEND_HK_MID), CFE_EVS_Global.EVS_CommandPipe); if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("EVS:Subscribing to HK Request Failed:RC=0x%08X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Subscribing to HK Request Failed:RC=0x%08X\n", __func__, (unsigned int)Status); return Status; } /* Write the AppID to the global location, now that the rest of initialization is done */ CFE_EVS_Global.EVS_AppID = AppID; - EVS_SendEvent(CFE_EVS_STARTUP_EID, CFE_EVS_EventType_INFORMATION, "cFE EVS Initialized.%s", CFE_VERSION_STRING); + EVS_SendEvent(CFE_EVS_STARTUP_EID, CFE_EVS_EventType_INFORMATION, "cFE EVS Initialized: %s", CFE_VERSION_STRING); return CFE_SUCCESS; } @@ -608,7 +608,7 @@ bool CFE_EVS_VerifyCmdLength(CFE_MSG_Message_t *MsgPtr, size_t ExpectedLength) *-----------------------------------------------------------------*/ int32 CFE_EVS_NoopCmd(const CFE_EVS_NoopCmd_t *data) { - EVS_SendEvent(CFE_EVS_NOOP_EID, CFE_EVS_EventType_INFORMATION, "No-op command. %s", CFE_VERSION_STRING); + EVS_SendEvent(CFE_EVS_NOOP_EID, CFE_EVS_EventType_INFORMATION, "No-op Cmd Rcvd: %s", CFE_VERSION_STRING); return CFE_SUCCESS; } diff --git a/modules/evs/fsw/src/cfe_evs_utils.c b/modules/evs/fsw/src/cfe_evs_utils.c index 63be13efd..669dc9cc8 100644 --- a/modules/evs/fsw/src/cfe_evs_utils.c +++ b/modules/evs/fsw/src/cfe_evs_utils.c @@ -183,7 +183,8 @@ int32 EVS_NotRegistered(EVS_AppData_t *AppDataPtr, CFE_ES_AppId_t CallerID) "App %s not registered with Event Services. Unable to send event.", AppName); /* Write the "not registered" info to the system log */ - CFE_ES_WriteToSysLog("App %s not registered with Event Services. Unable to send event.\n", AppName); + CFE_ES_WriteToSysLog("%s: App %s not registered with Event Services. Unable to send event.\n", __func__, + AppName); } return (CFE_EVS_APP_NOT_REGISTERED); diff --git a/modules/evs/ut-coverage/evs_UT.c b/modules/evs/ut-coverage/evs_UT.c index d06817d58..188fba8d2 100644 --- a/modules/evs/ut-coverage/evs_UT.c +++ b/modules/evs/ut-coverage/evs_UT.c @@ -42,20 +42,20 @@ static const char *EVS_SYSLOG_MSGS[] = { NULL, - "EVS call to CFE_PSP_GetResetArea failed, RC=0x%08x\n", - "Unexpected size from CFE_PSP_GetResetArea: expected = 0x%08lX, actual = 0x%08lX\n", - "EVS call to OS_MutSemCreate failed, RC=0x%08x\n", - "Event Log cleared following power-on reset\n", - "Event Log cleared, n=%d, c=%d, f=%d, m=%d, o=%d\n", - "Event Log restored, n=%d, c=%d, f=%d, m=%d, o=%d\n", - "EVS:Application Init Failed,RC=0x%08X\n", - "EVS:Error reading cmd pipe,RC=0x%08X\n", + "%s: Call to CFE_PSP_GetResetArea failed, RC=0x%08x\n", + "%s: Unexpected size from CFE_PSP_GetResetArea: expected = 0x%08lX, actual = 0x%08lX\n", + "%s: OS_MutSemCreate failed, RC=0x%08x\n", + "%s: Event Log cleared following power-on reset\n", + "%s: Event Log cleared, n=%d, c=%d, f=%d, m=%d, o=%d\n", + "%s: Event Log restored, n=%d, c=%d, f=%d, m=%d, o=%d\n", + "%s: Application Init Failed,RC=0x%08X\n", + "%s: Error reading cmd pipe,RC=0x%08X\n", NULL, /* old message removed - placeholder to maintain indices */ - "EVS:Call to CFE_ES_GetAppID Failed:RC=0x%08X\n", - "EVS:Call to CFE_EVS_Register Failed:RC=0x%08X\n", - "EVS:Call to CFE_SB_CreatePipe Failed:RC=0x%08X\n", - "EVS:Subscribing to Cmds Failed:RC=0x%08X\n", - "EVS:Subscribing to HK Request Failed:RC=0x%08X\n"}; + "%s: Call to CFE_ES_GetAppID Failed:RC=0x%08X\n", + "%s: Call to CFE_EVS_Register Failed:RC=0x%08X\n", + "%s: Call to CFE_SB_CreatePipe Failed:RC=0x%08X\n", + "%s: Subscribing to Cmds Failed:RC=0x%08X\n", + "%s: Subscribing to HK Request Failed:RC=0x%08X\n"}; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_NOOP_CC = {.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), .CommandCode = CFE_EVS_NOOP_CC}; diff --git a/modules/fs/fsw/src/cfe_fs_api.c b/modules/fs/fsw/src/cfe_fs_api.c index a0c6d09ac..3b5d034b8 100644 --- a/modules/fs/fsw/src/cfe_fs_api.c +++ b/modules/fs/fsw/src/cfe_fs_api.c @@ -173,7 +173,7 @@ void CFE_FS_InitHeader(CFE_FS_Header_t *Hdr, const char *Description, uint32 Sub { if (Hdr == NULL || Description == NULL) { - CFE_ES_WriteToSysLog("CFE_FS:InitHeader-Failed invalid arguments\n"); + CFE_ES_WriteToSysLog("%s: Failed invalid arguments\n", __func__); } else { @@ -293,30 +293,22 @@ CFE_Status_t CFE_FS_SetTimestamp(osal_id_t FileDes, CFE_TIME_SysTime_t NewTimest CFE_FS_ByteSwapUint32(&OutTimestamp.Subseconds); } - Result = OS_write(FileDes, &OutTimestamp.Seconds, sizeof(OutTimestamp.Seconds)); + Result = OS_write(FileDes, &OutTimestamp, sizeof(OutTimestamp)); /* On a good write, the value returned will equal the number of bytes written */ - if (Result == sizeof(OutTimestamp.Seconds)) + if (Result == sizeof(OutTimestamp)) { - Result = OS_write(FileDes, &OutTimestamp.Subseconds, sizeof(OutTimestamp.Subseconds)); - - if (Result == sizeof(OutTimestamp.Subseconds)) - { - Result = OS_SUCCESS; - } - else - { - CFE_ES_WriteToSysLog("CFE_FS:SetTime-Failed to write Seconds (Status=0x%08X)\n", (unsigned int)Result); - } + Result = CFE_SUCCESS; } else { - CFE_ES_WriteToSysLog("CFE_FS:SetTime-Failed to write Seconds (Status=0x%08X)\n", (unsigned int)Result); + CFE_ES_WriteToSysLog("%s: Failed to write timestamp (Status=0x%08X)\n", __func__, (unsigned int)Result); + Result = CFE_STATUS_EXTERNAL_RESOURCE_FAIL; } } else { - CFE_ES_WriteToSysLog("CFE_FS:SetTime-Failed to lseek time fields (Status=0x%08X)\n", (unsigned int)Result); + CFE_ES_WriteToSysLog("%s: Failed to lseek time fields (Status=0x%08X)\n", __func__, (unsigned int)Result); } return (Result); diff --git a/modules/fs/fsw/src/cfe_fs_priv.c b/modules/fs/fsw/src/cfe_fs_priv.c index bd6d13a3a..37e771112 100644 --- a/modules/fs/fsw/src/cfe_fs_priv.c +++ b/modules/fs/fsw/src/cfe_fs_priv.c @@ -59,7 +59,7 @@ int32 CFE_FS_EarlyInit(void) Stat = OS_MutSemCreate(&CFE_FS_Global.SharedDataMutexId, "CFE_FS_SharedMutex", 0); if (Stat != OS_SUCCESS) { - CFE_ES_WriteToSysLog("FS Shared Data Mutex creation failed! RC=0x%08x\n", (unsigned int)Stat); + CFE_ES_WriteToSysLog("%s: Shared Data Mutex creation failed! RC=0x%08x\n", __func__, (unsigned int)Stat); return Stat; } /* end if */ @@ -84,8 +84,8 @@ void CFE_FS_LockSharedData(const char *FunctionName) { CFE_ES_GetAppID(&AppId); - CFE_ES_WriteToSysLog("FS SharedData Mutex Take Err Stat=0x%x,App=%lu,Function=%s\n", (unsigned int)Status, - CFE_RESOURCEID_TO_ULONG(AppId), FunctionName); + CFE_ES_WriteToSysLog("%s: SharedData Mutex Take Err Stat=0x%x,App=%lu,Function=%s\n", __func__, + (unsigned int)Status, CFE_RESOURCEID_TO_ULONG(AppId), FunctionName); } /* end if */ @@ -109,8 +109,8 @@ void CFE_FS_UnlockSharedData(const char *FunctionName) if (Status != OS_SUCCESS) { CFE_ES_GetAppID(&AppId); - CFE_ES_WriteToSysLog("FS SharedData Mutex Give Err Stat=0x%x,App=%lu,Function=%s\n", (unsigned int)Status, - CFE_RESOURCEID_TO_ULONG(AppId), FunctionName); + CFE_ES_WriteToSysLog("%s: SharedData Mutex Give Err Stat=0x%x,App=%lu,Function=%s\n", __func__, + (unsigned int)Status, CFE_RESOURCEID_TO_ULONG(AppId), FunctionName); } /* end if */ return; diff --git a/modules/fs/ut-coverage/fs_UT.c b/modules/fs/ut-coverage/fs_UT.c index 8eb7b53eb..6d138926b 100644 --- a/modules/fs/ut-coverage/fs_UT.c +++ b/modules/fs/ut-coverage/fs_UT.c @@ -42,8 +42,8 @@ #include "target_config.h" -const char *FS_SYSLOG_MSGS[] = {NULL, "FS SharedData Mutex Take Err Stat=0x%x,App=%lu,Function=%s\n", - "FS SharedData Mutex Give Err Stat=0x%x,App=%lu,Function=%s\n"}; +const char *FS_SYSLOG_MSGS[] = {NULL, "%s: SharedData Mutex Take Err Stat=0x%x,App=%lu,Function=%s\n", + "%s: SharedData Mutex Give Err Stat=0x%x,App=%lu,Function=%s\n"}; /* counts the number of times UT_FS_OnEvent() was invoked (below) */ uint32 UT_FS_FileWriteEventCount[CFE_FS_FileWriteEvent_MAX]; @@ -167,18 +167,18 @@ void Test_CFE_FS_SetTimestamp(void) /* Test setting the time stamp with a seconds write failure */ UT_InitData(); UT_SetDefaultReturnValue(UT_KEY(OS_write), OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_FS_SetTimestamp(FileDes, NewTimestamp) != OS_SUCCESS, "CFE_FS_SetTimestamp", + UT_Report(__FILE__, __LINE__, CFE_FS_SetTimestamp(FileDes, NewTimestamp) != CFE_SUCCESS, "CFE_FS_SetTimestamp", "Failed to write seconds"); /* Test setting the time stamp with a subeconds write failure */ UT_InitData(); - UT_SetDeferredRetcode(UT_KEY(OS_write), 2, 0); - UT_Report(__FILE__, __LINE__, CFE_FS_SetTimestamp(FileDes, NewTimestamp) == OS_SUCCESS, "CFE_FS_SetTimestamp", + UT_SetDeferredRetcode(UT_KEY(OS_write), 1, 0); + UT_Report(__FILE__, __LINE__, CFE_FS_SetTimestamp(FileDes, NewTimestamp) != CFE_SUCCESS, "CFE_FS_SetTimestamp", "Failed to write subseconds"); /* Test successfully setting the time stamp */ UT_InitData(); - UT_Report(__FILE__, __LINE__, CFE_FS_SetTimestamp(FileDes, NewTimestamp) == OS_SUCCESS, "CFE_FS_SetTimestamp", + UT_Report(__FILE__, __LINE__, CFE_FS_SetTimestamp(FileDes, NewTimestamp) == CFE_SUCCESS, "CFE_FS_SetTimestamp", "Write time stamp - successful"); } diff --git a/modules/sb/fsw/src/cfe_sb_api.c b/modules/sb/fsw/src/cfe_sb_api.c index 4cc541070..5ce76600e 100644 --- a/modules/sb/fsw/src/cfe_sb_api.c +++ b/modules/sb/fsw/src/cfe_sb_api.c @@ -2041,7 +2041,7 @@ CFE_SB_Buffer_t *CFE_SB_AllocateMessageBuffer(size_t MsgSize) if (MsgSize > CFE_MISSION_SB_MAX_SB_MSG_SIZE) { - CFE_ES_WriteToSysLog(" CFE_SB:ZeroCopyGetPtr-Failed, MsgSize is too large\n"); + CFE_ES_WriteToSysLog("%s: ZeroCopyGetPtr-Failed, MsgSize is too large\n", __func__); return NULL; } diff --git a/modules/sb/fsw/src/cfe_sb_init.c b/modules/sb/fsw/src/cfe_sb_init.c index b2db162e5..4d28cdaf7 100644 --- a/modules/sb/fsw/src/cfe_sb_init.c +++ b/modules/sb/fsw/src/cfe_sb_init.c @@ -67,7 +67,7 @@ int32 CFE_SB_EarlyInit(void) Stat = OS_MutSemCreate(&CFE_SB_Global.SharedDataMutexId, "CFE_SB_DataMutex", 0); if (Stat != OS_SUCCESS) { - CFE_ES_WriteToSysLog("SB shared data mutex creation failed! RC=0x%08x\n", (unsigned int)Stat); + CFE_ES_WriteToSysLog("%s: Shared data mutex creation failed! RC=0x%08x\n", __func__, (unsigned int)Stat); return Stat; } /* end if */ @@ -114,7 +114,7 @@ int32 CFE_SB_InitBuffers(void) if (Stat != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("PoolCreate failed for SB Buffers, gave adr 0x%lx,size %d,stat=0x%x\n", + CFE_ES_WriteToSysLog("%s: PoolCreate failed for SB Buffers, gave adr 0x%lx,size %d,stat=0x%x\n", __func__, (unsigned long)CFE_SB_Global.Mem.Partition.Data, CFE_PLATFORM_SB_BUF_MEMORY_BYTES, (unsigned int)Stat); return Stat; diff --git a/modules/sb/fsw/src/cfe_sb_priv.c b/modules/sb/fsw/src/cfe_sb_priv.c index cdac4dd25..001da7582 100644 --- a/modules/sb/fsw/src/cfe_sb_priv.c +++ b/modules/sb/fsw/src/cfe_sb_priv.c @@ -144,8 +144,8 @@ void CFE_SB_LockSharedData(const char *FuncName, int32 LineNumber) CFE_ES_GetAppID(&AppId); - CFE_ES_WriteToSysLog("SB SharedData Mutex Take Err Stat=0x%x,App=%lu,Func=%s,Line=%d\n", (unsigned int)Status, - CFE_RESOURCEID_TO_ULONG(AppId), FuncName, (int)LineNumber); + CFE_ES_WriteToSysLog("%s: SharedData Mutex Take Err Stat=0x%x,App=%lu,Func=%s,Line=%d\n", __func__, + (unsigned int)Status, CFE_RESOURCEID_TO_ULONG(AppId), FuncName, (int)LineNumber); } /* end if */ @@ -172,8 +172,8 @@ void CFE_SB_UnlockSharedData(const char *FuncName, int32 LineNumber) CFE_ES_GetAppID(&AppId); - CFE_ES_WriteToSysLog("SB SharedData Mutex Give Err Stat=0x%x,App=%lu,Func=%s,Line=%d\n", (unsigned int)Status, - CFE_RESOURCEID_TO_ULONG(AppId), FuncName, (int)LineNumber); + CFE_ES_WriteToSysLog("%s: SharedData Mutex Give Err Stat=0x%x,App=%lu,Func=%s,Line=%d\n", __func__, + (unsigned int)Status, CFE_RESOURCEID_TO_ULONG(AppId), FuncName, (int)LineNumber); } /* end if */ diff --git a/modules/sb/fsw/src/cfe_sb_task.c b/modules/sb/fsw/src/cfe_sb_task.c index 81137deda..5e66eff9a 100644 --- a/modules/sb/fsw/src/cfe_sb_task.c +++ b/modules/sb/fsw/src/cfe_sb_task.c @@ -69,7 +69,7 @@ void CFE_SB_TaskMain(void) if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("SB:Application Init Failed,RC=0x%08X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Application Init Failed,RC=0x%08X\n", __func__, (unsigned int)Status); CFE_ES_PerfLogExit(CFE_MISSION_SB_MAIN_PERF_ID); /* Note: CFE_ES_ExitApp will not return */ CFE_ES_ExitApp(CFE_ES_RunStatus_CORE_APP_INIT_ERROR); @@ -103,7 +103,7 @@ void CFE_SB_TaskMain(void) } else { - CFE_ES_WriteToSysLog("SB:Error reading cmd pipe,RC=0x%08X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Error reading cmd pipe,RC=0x%08X\n", __func__, (unsigned int)Status); } /* end if */ } /* end while */ @@ -198,11 +198,11 @@ int32 CFE_SB_AppInit(void) Status = CFE_EVS_Register(CFE_SB_Global.EventFilters, CfgFileEventsToFilter, CFE_EVS_EventFilter_BINARY); if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("SB:Call to CFE_EVS_Register Failed:RC=0x%08X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Call to CFE_EVS_Register Failed:RC=0x%08X\n", __func__, (unsigned int)Status); return Status; } /* end if */ - CFE_ES_WriteToSysLog("SB:Registered %d events for filtering\n", (int)CfgFileEventsToFilter); + CFE_ES_WriteToSysLog("%s: Registered %d events for filtering\n", __func__, (int)CfgFileEventsToFilter); CFE_MSG_Init(&CFE_SB_Global.HKTlmMsg.Hdr.Msg, CFE_SB_ValueToMsgId(CFE_SB_HK_TLM_MID), sizeof(CFE_SB_Global.HKTlmMsg)); @@ -224,7 +224,7 @@ int32 CFE_SB_AppInit(void) Status = CFE_SB_CreatePipe(&CFE_SB_Global.CmdPipe, CFE_SB_CMD_PIPE_DEPTH, CFE_SB_CMD_PIPE_NAME); if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("SB:Call to CFE_SB_CreatePipe Failed:RC=0x%08X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Call to CFE_SB_CreatePipe Failed:RC=0x%08X\n", __func__, (unsigned int)Status); return Status; } /* end if */ @@ -232,7 +232,7 @@ int32 CFE_SB_AppInit(void) if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("SB:Subscribe to Cmds Failed:RC=0x%08X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Subscribe to Cmds Failed:RC=0x%08X\n", __func__, (unsigned int)Status); return Status; } /* end if */ @@ -240,7 +240,7 @@ int32 CFE_SB_AppInit(void) if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("SB:Subscribe to HK Request Failed:RC=0x%08X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Subscribe to HK Request Failed:RC=0x%08X\n", __func__, (unsigned int)Status); return Status; } /* end if */ @@ -248,7 +248,8 @@ int32 CFE_SB_AppInit(void) if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("SB:Subscribe to Subscription Report Request Failed:RC=0x%08X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Subscribe to Subscription Report Request Failed:RC=0x%08X\n", __func__, + (unsigned int)Status); return Status; } /* end if */ @@ -258,7 +259,7 @@ int32 CFE_SB_AppInit(void) if (Status < 0) { - CFE_ES_WriteToSysLog("SB:Init error, GetPool Failed:RC=0x%08X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Init error, GetPool Failed:RC=0x%08X\n", __func__, (unsigned int)Status); return Status; } /* end if */ @@ -268,14 +269,15 @@ int32 CFE_SB_AppInit(void) if (Status < 0) { - CFE_ES_WriteToSysLog("SB:Init error, PutPool Failed:RC=0x%08X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Init error, PutPool Failed:RC=0x%08X\n", __func__, (unsigned int)Status); return Status; } /* end if */ - Status = CFE_EVS_SendEvent(CFE_SB_INIT_EID, CFE_EVS_EventType_INFORMATION, "cFE SB Initialized"); + Status = + CFE_EVS_SendEvent(CFE_SB_INIT_EID, CFE_EVS_EventType_INFORMATION, "cFE SB Initialized: %s", CFE_VERSION_STRING); if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("SB:Error sending init event:RC=0x%08X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Error sending init event:RC=0x%08X\n", __func__, (unsigned int)Status); return Status; } /* end if */ @@ -464,7 +466,7 @@ void CFE_SB_ProcessCmdPipePkt(CFE_SB_Buffer_t *SBBufPtr) *-----------------------------------------------------------------*/ int32 CFE_SB_NoopCmd(const CFE_SB_NoopCmd_t *data) { - CFE_EVS_SendEvent(CFE_SB_CMD0_RCVD_EID, CFE_EVS_EventType_INFORMATION, "No-op Cmd Rcvd. %s", CFE_VERSION_STRING); + CFE_EVS_SendEvent(CFE_SB_CMD0_RCVD_EID, CFE_EVS_EventType_INFORMATION, "No-op Cmd Rcvd: %s", CFE_VERSION_STRING); CFE_SB_Global.HKTlmMsg.Payload.CommandCounter++; return CFE_SUCCESS; diff --git a/modules/sb/fsw/src/cfe_sb_util.c b/modules/sb/fsw/src/cfe_sb_util.c index c8f92ba52..0ea966c61 100644 --- a/modules/sb/fsw/src/cfe_sb_util.c +++ b/modules/sb/fsw/src/cfe_sb_util.c @@ -92,7 +92,7 @@ void *CFE_SB_GetUserData(CFE_MSG_Message_t *MsgPtr) if (MsgPtr == NULL) { - CFE_ES_WriteToSysLog("CFE_SB:GetUserData-Failed invalid arguments\n"); + CFE_ES_WriteToSysLog("%s: Failed invalid arguments\n", __func__); return 0; } @@ -141,7 +141,7 @@ void CFE_SB_SetUserDataLength(CFE_MSG_Message_t *MsgPtr, size_t DataLength) if (MsgPtr == NULL) { - CFE_ES_WriteToSysLog("CFE_SB:SetUserDataLength-Failed invalid arguments\n"); + CFE_ES_WriteToSysLog("%s: Failed invalid arguments\n", __func__); } else { @@ -154,7 +154,7 @@ void CFE_SB_SetUserDataLength(CFE_MSG_Message_t *MsgPtr, size_t DataLength) } else { - CFE_ES_WriteToSysLog("CFE_SB:SetUserDataLength-Failed TotalMsgSize too large\n"); + CFE_ES_WriteToSysLog("%s: Failed TotalMsgSize too large\n", __func__); } } } diff --git a/modules/tbl/fsw/src/cfe_tbl_api.c b/modules/tbl/fsw/src/cfe_tbl_api.c index 3fca5d83a..c51f7188b 100644 --- a/modules/tbl/fsw/src/cfe_tbl_api.c +++ b/modules/tbl/fsw/src/cfe_tbl_api.c @@ -85,7 +85,7 @@ CFE_Status_t CFE_TBL_Register(CFE_TBL_Handle_t *TblHandlePtr, const char *Name, /* Perform a buffer overrun safe copy of name for debug log message */ strncpy(TblName, Name, sizeof(TblName) - 1); TblName[sizeof(TblName) - 1] = '\0'; - CFE_ES_WriteToSysLog("CFE_TBL:Register-Table Name (%s) is bad length (%d)", TblName, (int)NameLen); + CFE_ES_WriteToSysLog("%s: Table Name (%s) is bad length (%d)", __func__, TblName, (int)NameLen); } else { @@ -99,14 +99,14 @@ CFE_Status_t CFE_TBL_Register(CFE_TBL_Handle_t *TblHandlePtr, const char *Name, { Status = CFE_TBL_ERR_INVALID_SIZE; - CFE_ES_WriteToSysLog("CFE_TBL:Register-Table %s has size of zero\n", Name); + CFE_ES_WriteToSysLog("%s: Table %s has size of zero\n", __func__, Name); } else if ((Size > CFE_PLATFORM_TBL_MAX_SNGL_TABLE_SIZE) && ((TblOptionFlags & CFE_TBL_OPT_BUFFER_MSK) == CFE_TBL_OPT_SNGL_BUFFER)) { Status = CFE_TBL_ERR_INVALID_SIZE; - CFE_ES_WriteToSysLog("CFE_TBL:Register-Single Buffered Table '%s' has size %d > %d\n", Name, (int)Size, + CFE_ES_WriteToSysLog("%s: Single Buffered Table '%s' has size %d > %d\n", __func__, Name, (int)Size, CFE_PLATFORM_TBL_MAX_SNGL_TABLE_SIZE); } else if ((Size > CFE_PLATFORM_TBL_MAX_DBL_TABLE_SIZE) && @@ -114,7 +114,7 @@ CFE_Status_t CFE_TBL_Register(CFE_TBL_Handle_t *TblHandlePtr, const char *Name, { Status = CFE_TBL_ERR_INVALID_SIZE; - CFE_ES_WriteToSysLog("CFE_TBL:Register-Dbl Buffered Table '%s' has size %d > %d\n", Name, (int)Size, + CFE_ES_WriteToSysLog("%s: Dbl Buffered Table '%s' has size %d > %d\n", __func__, Name, (int)Size, CFE_PLATFORM_TBL_MAX_DBL_TABLE_SIZE); } @@ -128,8 +128,8 @@ CFE_Status_t CFE_TBL_Register(CFE_TBL_Handle_t *TblHandlePtr, const char *Name, { Status = CFE_TBL_ERR_INVALID_OPTIONS; - CFE_ES_WriteToSysLog( - "CFE_TBL:Register-User Def tbl '%s' cannot be dbl buff, load/dump or critical\n", Name); + CFE_ES_WriteToSysLog("%s: User Def tbl '%s' cannot be dbl buff, load/dump or critical\n", __func__, + Name); } } else if ((TblOptionFlags & CFE_TBL_OPT_LD_DMP_MSK) == CFE_TBL_OPT_DUMP_ONLY) @@ -140,7 +140,7 @@ CFE_Status_t CFE_TBL_Register(CFE_TBL_Handle_t *TblHandlePtr, const char *Name, { Status = CFE_TBL_ERR_INVALID_OPTIONS; - CFE_ES_WriteToSysLog("CFE_TBL:Register-Dump Only tbl '%s' cannot be double buffered or critical\n", + CFE_ES_WriteToSysLog("%s: Dump Only tbl '%s' cannot be double buffered or critical\n", __func__, Name); } } @@ -148,7 +148,7 @@ CFE_Status_t CFE_TBL_Register(CFE_TBL_Handle_t *TblHandlePtr, const char *Name, } else /* Application ID was invalid */ { - CFE_ES_WriteToSysLog("CFE_TBL:Register-Bad AppId(%lu)\n", CFE_RESOURCEID_TO_ULONG(ThisAppId)); + CFE_ES_WriteToSysLog("%s: Bad AppId(%lu)\n", __func__, CFE_RESOURCEID_TO_ULONG(ThisAppId)); } /* If input parameters appear acceptable, register the table */ @@ -179,9 +179,8 @@ CFE_Status_t CFE_TBL_Register(CFE_TBL_Handle_t *TblHandlePtr, const char *Name, /* to clean up this mess. */ Status = CFE_TBL_ERR_DUPLICATE_DIFF_SIZE; - CFE_ES_WriteToSysLog( - "CFE_TBL:Register-Attempt to register existing table ('%s') with different size(%d!=%d)\n", - TblName, (int)Size, (int)RegRecPtr->Size); + CFE_ES_WriteToSysLog("%s: Attempt to register existing table ('%s') with different size(%d!=%d)\n", + __func__, TblName, (int)Size, (int)RegRecPtr->Size); } else { @@ -210,7 +209,7 @@ CFE_Status_t CFE_TBL_Register(CFE_TBL_Handle_t *TblHandlePtr, const char *Name, { Status = CFE_TBL_ERR_DUPLICATE_NOT_OWNED; - CFE_ES_WriteToSysLog("CFE_TBL:Register-App(%lu) Registering Duplicate Table '%s' owned by App(%lu)\n", + CFE_ES_WriteToSysLog("%s: App(%lu) Registering Duplicate Table '%s' owned by App(%lu)\n", __func__, CFE_RESOURCEID_TO_ULONG(ThisAppId), TblName, CFE_RESOURCEID_TO_ULONG(RegRecPtr->OwnerAppId)); } @@ -225,7 +224,7 @@ CFE_Status_t CFE_TBL_Register(CFE_TBL_Handle_t *TblHandlePtr, const char *Name, if (RegIndx == CFE_TBL_NOT_FOUND) { Status = CFE_TBL_ERR_REGISTRY_FULL; - CFE_ES_WriteToSysLog("CFE_TBL:Register-Registry full\n"); + CFE_ES_WriteToSysLog("%s: Registry full\n", __func__); } /* If this is a duplicate registration, no other work is required */ @@ -238,7 +237,7 @@ CFE_Status_t CFE_TBL_Register(CFE_TBL_Handle_t *TblHandlePtr, const char *Name, if (*TblHandlePtr == CFE_TBL_END_OF_LIST) { Status = CFE_TBL_ERR_HANDLES_FULL; - CFE_ES_WriteToSysLog("CFE_TBL:Register-No more free handles\n"); + CFE_ES_WriteToSysLog("%s: No more free handles\n", __func__); } /* If no errors, then initialize the table registry entry */ @@ -259,9 +258,9 @@ CFE_Status_t CFE_TBL_Register(CFE_TBL_Handle_t *TblHandlePtr, const char *Name, Status = CFE_ES_GetPoolBuf(&RegRecPtr->Buffers[0].BufferPtr, CFE_TBL_Global.Buf.PoolHdl, Size); if (Status < 0) { - CFE_ES_WriteToSysLog( - "CFE_TBL:Register-1st Buf Alloc GetPool fail Stat=0x%08X MemPoolHndl=0x%08lX\n", - (unsigned int)Status, CFE_RESOURCEID_TO_ULONG(CFE_TBL_Global.Buf.PoolHdl)); + CFE_ES_WriteToSysLog("%s: 1st Buf Alloc GetPool fail Stat=0x%08X MemPoolHndl=0x%08lX\n", + __func__, (unsigned int)Status, + CFE_RESOURCEID_TO_ULONG(CFE_TBL_Global.Buf.PoolHdl)); } else { @@ -284,9 +283,9 @@ CFE_Status_t CFE_TBL_Register(CFE_TBL_Handle_t *TblHandlePtr, const char *Name, Status = CFE_ES_GetPoolBuf(&RegRecPtr->Buffers[1].BufferPtr, CFE_TBL_Global.Buf.PoolHdl, Size); if (Status < 0) { - CFE_ES_WriteToSysLog( - "CFE_TBL:Register-2nd Buf Alloc GetPool fail Stat=0x%08X MemPoolHndl=0x%08lX\n", - (unsigned int)Status, CFE_RESOURCEID_TO_ULONG(CFE_TBL_Global.Buf.PoolHdl)); + CFE_ES_WriteToSysLog("%s: 2nd Buf Alloc GetPool fail Stat=0x%08X MemPoolHndl=0x%08lX\n", + __func__, (unsigned int)Status, + CFE_RESOURCEID_TO_ULONG(CFE_TBL_Global.Buf.PoolHdl)); } else { @@ -369,9 +368,8 @@ CFE_Status_t CFE_TBL_Register(CFE_TBL_Handle_t *TblHandlePtr, const char *Name, /* do need to handle the error case because if the function */ /* call did fail, WorkingBufferPtr would be a NULL pointer. */ CFE_ES_GetAppName(AppName, ThisAppId, sizeof(AppName)); - CFE_ES_WriteToSysLog( - "CFE_TBL:Register-Failed to get work buffer for '%s.%s' (ErrCode=0x%08X)\n", - AppName, Name, (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Failed to get work buffer for '%s.%s' (ErrCode=0x%08X)\n", + __func__, AppName, Name, (unsigned int)Status); } else { @@ -381,9 +379,8 @@ CFE_Status_t CFE_TBL_Register(CFE_TBL_Handle_t *TblHandlePtr, const char *Name, if (Status != CFE_SUCCESS) { CFE_ES_GetAppName(AppName, ThisAppId, sizeof(AppName)); - CFE_ES_WriteToSysLog( - "CFE_TBL:Register-Failed to recover '%s.%s' from CDS (ErrCode=0x%08X)\n", - AppName, Name, (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Failed to recover '%s.%s' from CDS (ErrCode=0x%08X)\n", + __func__, AppName, Name, (unsigned int)Status); } } @@ -427,9 +424,8 @@ CFE_Status_t CFE_TBL_Register(CFE_TBL_Handle_t *TblHandlePtr, const char *Name, /* If an error occurred while trying to get the previous contents registry info, */ /* Log the error in the System Log and pretend like we created a new CDS */ CFE_ES_GetAppName(AppName, ThisAppId, sizeof(AppName)); - CFE_ES_WriteToSysLog( - "CFE_TBL:Register-Failed to recover '%s.%s' info from CDS TblReg\n", AppName, - Name); + CFE_ES_WriteToSysLog("%s: Failed to recover '%s.%s' info from CDS TblReg\n", + __func__, AppName, Name); Status = CFE_SUCCESS; } } @@ -459,9 +455,8 @@ CFE_Status_t CFE_TBL_Register(CFE_TBL_Handle_t *TblHandlePtr, const char *Name, } else { - CFE_ES_WriteToSysLog( - "CFE_TBL:Register-Failed to find a free Crit Tbl Reg Rec for '%s'\n", - RegRecPtr->Name); + CFE_ES_WriteToSysLog("%s: Failed to find a free Crit Tbl Reg Rec for '%s'\n", __func__, + RegRecPtr->Name); } /* Mark the table as critical for future reference */ @@ -469,9 +464,8 @@ CFE_Status_t CFE_TBL_Register(CFE_TBL_Handle_t *TblHandlePtr, const char *Name, } else if (Status != CFE_TBL_INFO_RECOVERED_TBL) { - CFE_ES_WriteToSysLog( - "CFE_TBL:Register-Failed to register '%s.%s' as a CDS (ErrCode=0x%08X)\n", AppName, - Name, (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Failed to register '%s.%s' as a CDS (ErrCode=0x%08X)\n", __func__, + AppName, Name, (unsigned int)Status); /* Notify caller that although they asked for it to be critical, it isn't */ Status = CFE_TBL_WARN_NOT_CRITICAL; @@ -553,7 +547,7 @@ CFE_Status_t CFE_TBL_Share(CFE_TBL_Handle_t *TblHandlePtr, const char *TblName) if (*TblHandlePtr == CFE_TBL_END_OF_LIST) { Status = CFE_TBL_ERR_HANDLES_FULL; - CFE_ES_WriteToSysLog("CFE_TBL:Share-No more free handles\n"); + CFE_ES_WriteToSysLog("%s: No more free handles\n", __func__); } else { @@ -587,14 +581,14 @@ CFE_Status_t CFE_TBL_Share(CFE_TBL_Handle_t *TblHandlePtr, const char *TblName) { Status = CFE_TBL_ERR_INVALID_NAME; - CFE_ES_WriteToSysLog("CFE_TBL:Share-Table '%s' not found in Registry\n", TblName); + CFE_ES_WriteToSysLog("%s: Table '%s' not found in Registry\n", __func__, TblName); } CFE_TBL_UnlockRegistry(); } else /* Application ID was invalid */ { - CFE_ES_WriteToSysLog("CFE_TBL:Share-Bad AppId(%lu)\n", CFE_RESOURCEID_TO_ULONG(ThisAppId)); + CFE_ES_WriteToSysLog("%s: Bad AppId(%lu)\n", __func__, CFE_RESOURCEID_TO_ULONG(ThisAppId)); } /* On Error conditions, notify ground of screw up */ @@ -658,7 +652,7 @@ CFE_Status_t CFE_TBL_Unregister(CFE_TBL_Handle_t TblHandle) } else { - CFE_ES_WriteToSysLog("CFE_TBL:Unregister-App(%lu) does not have access to Tbl Handle=%d\n", + CFE_ES_WriteToSysLog("%s: App(%lu) does not have access to Tbl Handle=%d\n", __func__, CFE_RESOURCEID_TO_ULONG(ThisAppId), (int)TblHandle); } @@ -935,13 +929,13 @@ CFE_Status_t CFE_TBL_Update(CFE_TBL_Handle_t TblHandle) if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("CFE_TBL:Update-App(%lu) fail to update Tbl '%s' (Stat=0x%08X)\n", + CFE_ES_WriteToSysLog("%s: App(%lu) fail to update Tbl '%s' (Stat=0x%08X)\n", __func__, CFE_RESOURCEID_TO_ULONG(ThisAppId), RegRecPtr->Name, (unsigned int)Status); } } else { - CFE_ES_WriteToSysLog("CFE_TBL:Update-App(%lu) does not have access to Tbl Handle=%d\n", + CFE_ES_WriteToSysLog("%s: App(%lu) does not have access to Tbl Handle=%d\n", __func__, CFE_RESOURCEID_TO_ULONG(ThisAppId), (int)TblHandle); } @@ -1017,7 +1011,7 @@ CFE_Status_t CFE_TBL_GetAddress(void **TblPtr, CFE_TBL_Handle_t TblHandle) } else { - CFE_ES_WriteToSysLog("CFE_TBL:GetAddress-Bad AppId=%lu\n", CFE_RESOURCEID_TO_ULONG(ThisAppId)); + CFE_ES_WriteToSysLog("%s: Bad AppId=%lu\n", __func__, CFE_RESOURCEID_TO_ULONG(ThisAppId)); } return Status; @@ -1053,7 +1047,7 @@ CFE_Status_t CFE_TBL_ReleaseAddress(CFE_TBL_Handle_t TblHandle) } else { - CFE_ES_WriteToSysLog("CFE_TBL:ReleaseAddress-App(%lu) does not have access to Tbl Handle=%u\n", + CFE_ES_WriteToSysLog("%s: App(%lu) does not have access to Tbl Handle=%u\n", __func__, CFE_RESOURCEID_TO_ULONG(ThisAppId), (unsigned int)TblHandle); } @@ -1107,7 +1101,7 @@ CFE_Status_t CFE_TBL_GetAddresses(void **TblPtrs[], uint16 NumTables, const CFE_ } else { - CFE_ES_WriteToSysLog("CFE_TBL:GetAddresses-Bad AppId=%lu\n", CFE_RESOURCEID_TO_ULONG(ThisAppId)); + CFE_ES_WriteToSysLog("%s: Bad AppId=%lu\n", __func__, CFE_RESOURCEID_TO_ULONG(ThisAppId)); } return Status; @@ -1214,9 +1208,9 @@ CFE_Status_t CFE_TBL_Validate(CFE_TBL_Handle_t TblHandle) if (Status > CFE_SUCCESS) { - CFE_ES_WriteToSysLog( - "CFE_TBL:Validate-App(%lu) Validation func return code invalid (Stat=0x%08X) for '%s'\n", - CFE_RESOURCEID_TO_ULONG(CFE_TBL_Global.TableTaskAppId), (unsigned int)Status, RegRecPtr->Name); + CFE_ES_WriteToSysLog("%s: App(%lu) Validation func return code invalid (Stat=0x%08X) for '%s'\n", + __func__, CFE_RESOURCEID_TO_ULONG(CFE_TBL_Global.TableTaskAppId), + (unsigned int)Status, RegRecPtr->Name); } } @@ -1261,9 +1255,9 @@ CFE_Status_t CFE_TBL_Validate(CFE_TBL_Handle_t TblHandle) if (Status > CFE_SUCCESS) { - CFE_ES_WriteToSysLog( - "CFE_TBL:Validate-App(%lu) Validation func return code invalid (Stat=0x%08X) for '%s'\n", - CFE_RESOURCEID_TO_ULONG(CFE_TBL_Global.TableTaskAppId), (unsigned int)Status, RegRecPtr->Name); + CFE_ES_WriteToSysLog("%s: App(%lu) Validation func return code invalid (Stat=0x%08X) for '%s'\n", + __func__, CFE_RESOURCEID_TO_ULONG(CFE_TBL_Global.TableTaskAppId), + (unsigned int)Status, RegRecPtr->Name); } } @@ -1285,7 +1279,7 @@ CFE_Status_t CFE_TBL_Validate(CFE_TBL_Handle_t TblHandle) } else { - CFE_ES_WriteToSysLog("CFE_TBL:Validate-App(%lu) does not have access to Tbl Handle=%d\n", + CFE_ES_WriteToSysLog("%s: App(%lu) does not have access to Tbl Handle=%d\n", __func__, CFE_RESOURCEID_TO_ULONG(ThisAppId), (int)TblHandle); } @@ -1393,7 +1387,7 @@ CFE_Status_t CFE_TBL_GetStatus(CFE_TBL_Handle_t TblHandle) } else { - CFE_ES_WriteToSysLog("CFE_TBL:GetStatus-App(%lu) does not have access to Tbl Handle=%d\n", + CFE_ES_WriteToSysLog("%s: App(%lu) does not have access to Tbl Handle=%d\n", __func__, CFE_RESOURCEID_TO_ULONG(ThisAppId), (int)TblHandle); } @@ -1572,7 +1566,7 @@ CFE_Status_t CFE_TBL_Modified(CFE_TBL_Handle_t TblHandle) } else { - CFE_ES_WriteToSysLog("CFE_TBL:Modified-App(%lu) does not have access to Tbl Handle=%d\n", + CFE_ES_WriteToSysLog("%s: App(%lu) does not have access to Tbl Handle=%d\n", __func__, CFE_RESOURCEID_TO_ULONG(ThisAppId), (int)TblHandle); } @@ -1615,7 +1609,7 @@ CFE_Status_t CFE_TBL_NotifyByMessage(CFE_TBL_Handle_t TblHandle, CFE_SB_MsgId_t else { Status = CFE_TBL_ERR_NO_ACCESS; - CFE_ES_WriteToSysLog("CFE_TBL:NotifyByMsg-App(%lu) does not own Tbl Handle=%d\n", + CFE_ES_WriteToSysLog("%s: App(%lu) does not own Tbl Handle=%d\n", __func__, CFE_RESOURCEID_TO_ULONG(ThisAppId), (int)TblHandle); } } diff --git a/modules/tbl/fsw/src/cfe_tbl_internal.c b/modules/tbl/fsw/src/cfe_tbl_internal.c index f551d31ee..c1d73ba5d 100644 --- a/modules/tbl/fsw/src/cfe_tbl_internal.c +++ b/modules/tbl/fsw/src/cfe_tbl_internal.c @@ -155,7 +155,7 @@ int32 CFE_TBL_EarlyInit(void) if (Status != CFE_SUCCESS) { /* Note if we were unable to recover error free Critical Table Registry from the CDS */ - CFE_ES_WriteToSysLog("CFE_TBL:EarlyInit-Failed to recover Critical Table Registry (Err=0x%08X)\n", + CFE_ES_WriteToSysLog("%s: Failed to recover Critical Table Registry (Err=0x%08X)\n", __func__, (unsigned int)Status); } @@ -166,7 +166,7 @@ int32 CFE_TBL_EarlyInit(void) { /* Not being able to support Critical Tables is not the end of the world */ /* Note the problem and move on */ - CFE_ES_WriteToSysLog("CFE_TBL:EarlyInit-Failed to create Critical Table Registry (Err=0x%08X)\n", + CFE_ES_WriteToSysLog("%s: Failed to create Critical Table Registry (Err=0x%08X)\n", __func__, (unsigned int)Status); /* Failure to support critical tables is not a good enough reason to exit the cFE on start up */ @@ -181,7 +181,7 @@ int32 CFE_TBL_EarlyInit(void) { /* Not being able to support Critical Tables is not the end of the world */ /* Note the problem and move on */ - CFE_ES_WriteToSysLog("CFE_TBL:EarlyInit-Failed to save Critical Table Registry (Err=0x%08X)\n", + CFE_ES_WriteToSysLog("%s: Failed to save Critical Table Registry (Err=0x%08X)\n", __func__, (unsigned int)Status); /* Failure to support critical tables is not a good enough reason to exit the cFE on start up */ @@ -355,10 +355,9 @@ int32 CFE_TBL_RemoveAccessLink(CFE_TBL_Handle_t TblHandle) if (Status < 0) { - CFE_ES_WriteToSysLog( - "CFE_TBL:RemoveAccessLink-PutPoolBuf[0] Fail Stat=0x%08X, Hndl=0x%08lX, Buf=0x%08lX\n", - (unsigned int)Status, CFE_RESOURCEID_TO_ULONG(CFE_TBL_Global.Buf.PoolHdl), - (unsigned long)RegRecPtr->Buffers[0].BufferPtr); + CFE_ES_WriteToSysLog("%s: PutPoolBuf[0] Fail Stat=0x%08X, Hndl=0x%08lX, Buf=0x%08lX\n", __func__, + (unsigned int)Status, CFE_RESOURCEID_TO_ULONG(CFE_TBL_Global.Buf.PoolHdl), + (unsigned long)RegRecPtr->Buffers[0].BufferPtr); } /* If a double buffered table, then free the second buffer as well */ @@ -369,10 +368,9 @@ int32 CFE_TBL_RemoveAccessLink(CFE_TBL_Handle_t TblHandle) if (Status < 0) { - CFE_ES_WriteToSysLog( - "CFE_TBL:RemoveAccessLink-PutPoolBuf[1] Fail Stat=0x%08X, Hndl=0x%08lX, Buf=0x%08lX\n", - (unsigned int)Status, CFE_RESOURCEID_TO_ULONG(CFE_TBL_Global.Buf.PoolHdl), - (unsigned long)RegRecPtr->Buffers[1].BufferPtr); + CFE_ES_WriteToSysLog("%s: PutPoolBuf[1] Fail Stat=0x%08X, Hndl=0x%08lX, Buf=0x%08lX\n", __func__, + (unsigned int)Status, CFE_RESOURCEID_TO_ULONG(CFE_TBL_Global.Buf.PoolHdl), + (unsigned long)RegRecPtr->Buffers[1].BufferPtr); } } else @@ -429,7 +427,7 @@ int32 CFE_TBL_GetAddressInternal(void **TblPtr, CFE_TBL_Handle_t TblHandle, CFE_ { Status = CFE_TBL_ERR_UNREGISTERED; - CFE_ES_WriteToSysLog("CFE_TBL:GetAddressInternal-App(%lu) attempt to access unowned Tbl Handle=%d\n", + CFE_ES_WriteToSysLog("%s: App(%lu) attempt to access unowned Tbl Handle=%d\n", __func__, CFE_RESOURCEID_TO_ULONG(ThisAppId), (int)TblHandle); } else /* Table Registry Entry is valid */ @@ -453,14 +451,14 @@ int32 CFE_TBL_GetAddressInternal(void **TblPtr, CFE_TBL_Handle_t TblHandle, CFE_ } else { - CFE_ES_WriteToSysLog("CFE_TBL:GetAddressInternal-App(%lu) does not have access to Tbl Handle=%d\n", + CFE_ES_WriteToSysLog("%s: App(%lu) does not have access to Tbl Handle=%d\n", __func__, CFE_RESOURCEID_TO_ULONG(ThisAppId), (int)TblHandle); } } else { - CFE_ES_WriteToSysLog("CFE_TBL:GetAddressInternal-App(%lu) using invalid Tbl Handle=%d\n", - CFE_RESOURCEID_TO_ULONG(ThisAppId), (int)TblHandle); + CFE_ES_WriteToSysLog("%s: App(%lu) using invalid Tbl Handle=%d\n", __func__, CFE_RESOURCEID_TO_ULONG(ThisAppId), + (int)TblHandle); } return Status; @@ -719,9 +717,9 @@ int32 CFE_TBL_GetWorkingBuffer(CFE_TBL_LoadBuff_t **WorkingBufferPtr, CFE_TBL_Re { Status = CFE_TBL_ERR_NO_BUFFER_AVAIL; - CFE_ES_WriteToSysLog( - "CFE_TBL:GetWorkingBuffer-Inactive Dbl Buff Locked for '%s' by AppId=%lu\n", - RegRecPtr->Name, CFE_RESOURCEID_TO_ULONG(CFE_TBL_Global.Handles[AccessIterator].AppId)); + CFE_ES_WriteToSysLog("%s: Inactive Dbl Buff Locked for '%s' by AppId=%lu\n", __func__, + RegRecPtr->Name, + CFE_RESOURCEID_TO_ULONG(CFE_TBL_Global.Handles[AccessIterator].AppId)); } /* Move to next access descriptor in linked list */ @@ -744,7 +742,7 @@ int32 CFE_TBL_GetWorkingBuffer(CFE_TBL_LoadBuff_t **WorkingBufferPtr, CFE_TBL_Re /* Make note of any errors but continue and hope for the best */ if (Status != OS_SUCCESS) { - CFE_ES_WriteToSysLog("CFE_TBL:GetWorkBuf-Internal error taking WorkBuf Mutex (Status=0x%08X)\n", + CFE_ES_WriteToSysLog("%s: Internal error taking WorkBuf Mutex (Status=0x%08X)\n", __func__, (unsigned int)Status); } @@ -769,7 +767,7 @@ int32 CFE_TBL_GetWorkingBuffer(CFE_TBL_LoadBuff_t **WorkingBufferPtr, CFE_TBL_Re { Status = CFE_TBL_ERR_NO_BUFFER_AVAIL; - CFE_ES_WriteToSysLog("CFE_TBL:GetWorkingBuffer-All shared buffers are locked\n"); + CFE_ES_WriteToSysLog("%s: All shared buffers are locked\n", __func__); } /* Allow others to obtain a shared working buffer */ @@ -974,7 +972,7 @@ int32 CFE_TBL_UpdateInternal(CFE_TBL_Handle_t TblHandle, CFE_TBL_RegistryRec_t * { Status = CFE_TBL_INFO_TABLE_LOCKED; - CFE_ES_WriteToSysLog("CFE_TBL:UpdateInternal-Unable to update locked table Handle=%d\n", TblHandle); + CFE_ES_WriteToSysLog("%s: Unable to update locked table Handle=%d\n", __func__, TblHandle); } else { @@ -1342,7 +1340,7 @@ void CFE_TBL_UpdateCriticalTblCDS(CFE_TBL_RegistryRec_t *RegRecPtr) if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("CFE_TBL:UpdateCritTbl-Unable to update Critical Table '%s' in CDS (Err=0x%08X)\n", + CFE_ES_WriteToSysLog("%s: Unable to update Critical Table '%s' in CDS (Err=0x%08X)\n", __func__, RegRecPtr->Name, (unsigned int)Status); } else @@ -1366,15 +1364,13 @@ void CFE_TBL_UpdateCriticalTblCDS(CFE_TBL_RegistryRec_t *RegRecPtr) if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog( - "CFE_TBL:UpdateCritTbl-Unable to update Critical Table Registry in CDS (Err=0x%08X)\n", - (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Unable to update Critical Table Registry in CDS (Err=0x%08X)\n", __func__, + (unsigned int)Status); } } else { - CFE_ES_WriteToSysLog("CFE_TBL:UpdateCritTbl-Error finding '%s' in Critical Table Registry\n", - RegRecPtr->Name); + CFE_ES_WriteToSysLog("%s: Error finding '%s' in Critical Table Registry\n", __func__, RegRecPtr->Name); } } diff --git a/modules/tbl/fsw/src/cfe_tbl_task.c b/modules/tbl/fsw/src/cfe_tbl_task.c index 73f082c48..dc941abc5 100644 --- a/modules/tbl/fsw/src/cfe_tbl_task.c +++ b/modules/tbl/fsw/src/cfe_tbl_task.c @@ -105,7 +105,7 @@ void CFE_TBL_TaskMain(void) if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("TBL:Application Init Failed,RC=0x%08X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Application Init Failed,RC=0x%08X\n", __func__, (unsigned int)Status); CFE_ES_PerfLogExit(CFE_MISSION_TBL_MAIN_PERF_ID); /* Note: CFE_ES_ExitApp will not return */ CFE_ES_ExitApp(CFE_ES_RunStatus_CORE_APP_INIT_ERROR); @@ -139,7 +139,7 @@ void CFE_TBL_TaskMain(void) } else { - CFE_ES_WriteToSysLog("TBL:Error reading cmd pipe,RC=0x%08X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Error reading cmd pipe,RC=0x%08X\n", __func__, (unsigned int)Status); } /* end if */ } /* end while */ @@ -172,7 +172,7 @@ int32 CFE_TBL_TaskInit(void) if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("TBL:Call to CFE_EVS_Register Failed:RC=0x%08X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Call to CFE_EVS_Register Failed:RC=0x%08X\n", __func__, (unsigned int)Status); return Status; } /* end if */ @@ -182,7 +182,7 @@ int32 CFE_TBL_TaskInit(void) Status = CFE_SB_CreatePipe(&CFE_TBL_Global.CmdPipe, CFE_TBL_TASK_PIPE_DEPTH, CFE_TBL_TASK_PIPE_NAME); if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("TBL:Error creating cmd pipe:RC=0x%08X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Error creating cmd pipe:RC=0x%08X\n", __func__, (unsigned int)Status); return Status; } /* end if */ @@ -193,7 +193,7 @@ int32 CFE_TBL_TaskInit(void) if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("TBL:Error subscribing to HK Request:RC=0x%08X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Error subscribing to HK Request:RC=0x%08X\n", __func__, (unsigned int)Status); return Status; } /* end if */ @@ -204,19 +204,19 @@ int32 CFE_TBL_TaskInit(void) if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("TBL:Error subscribing to gnd cmds:RC=0x%08X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Error subscribing to gnd cmds:RC=0x%08X\n", __func__, (unsigned int)Status); return Status; } /* end if */ /* ** Task startup event message */ - Status = CFE_EVS_SendEvent(CFE_TBL_INIT_INF_EID, CFE_EVS_EventType_INFORMATION, "cFE TBL Initialized.%s", + Status = CFE_EVS_SendEvent(CFE_TBL_INIT_INF_EID, CFE_EVS_EventType_INFORMATION, "cFE TBL Initialized: %s", CFE_VERSION_STRING); if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("TBL:Error sending init event:RC=0x%08X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Error sending init event:RC=0x%08X\n", __func__, (unsigned int)Status); return Status; } /* end if */ diff --git a/modules/tbl/fsw/src/cfe_tbl_task_cmds.c b/modules/tbl/fsw/src/cfe_tbl_task_cmds.c index baef3503c..0032eef8c 100644 --- a/modules/tbl/fsw/src/cfe_tbl_task_cmds.c +++ b/modules/tbl/fsw/src/cfe_tbl_task_cmds.c @@ -108,9 +108,9 @@ int32 CFE_TBL_HousekeepingCmd(const CFE_MSG_CommandHeader_t *data) { Status = CFE_FS_SetTimestamp(FileDescriptor, DumpTime); - if (Status != OS_SUCCESS) + if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("CFE_TBL:HkCmd-Unable to update timestamp in dump file '%s'\n", + CFE_ES_WriteToSysLog("%s: Unable to update timestamp in dump file '%s'\n", __func__, DumpCtrlPtr->DumpBufferPtr->DataSource); } @@ -118,7 +118,7 @@ int32 CFE_TBL_HousekeepingCmd(const CFE_MSG_CommandHeader_t *data) } else { - CFE_ES_WriteToSysLog("CFE_TBL:HkCmd-Unable to open dump file '%s' to update timestamp\n", + CFE_ES_WriteToSysLog("%s: Unable to open dump file '%s' to update timestamp\n", __func__, DumpCtrlPtr->DumpBufferPtr->DataSource); } } @@ -320,7 +320,7 @@ void CFE_TBL_GetTblRegData(void) int32 CFE_TBL_NoopCmd(const CFE_TBL_NoopCmd_t *data) { /* Acknowledge receipt of NOOP with Event Message */ - CFE_EVS_SendEvent(CFE_TBL_NOOP_INF_EID, CFE_EVS_EventType_INFORMATION, "No-op command. %s", CFE_VERSION_STRING); + CFE_EVS_SendEvent(CFE_TBL_NOOP_INF_EID, CFE_EVS_EventType_INFORMATION, "No-op Cmd Rcvd: %s", CFE_VERSION_STRING); return CFE_TBL_INC_CMD_CTR; } diff --git a/modules/time/fsw/inc/cfe_time_msg.h b/modules/time/fsw/inc/cfe_time_msg.h index 9aad58e12..3924fe4ec 100644 --- a/modules/time/fsw/inc/cfe_time_msg.h +++ b/modules/time/fsw/inc/cfe_time_msg.h @@ -717,7 +717,9 @@ #define CFE_TIME_FLAG_ADDTCL 0x0080 /**< \brief Time Client Latency is applied in a positive direction */ #define CFE_TIME_FLAG_SERVER 0x0040 /**< \brief This instance of Time Services is a Time Server */ #define CFE_TIME_FLAG_GDTONE 0x0020 /**< \brief The tone received is good compared to the last tone received */ -#define CFE_TIME_FLAG_UNUSED 0x001F /**< \brief Reserved flags - should be zero */ +#define CFE_TIME_FLAG_REFERR \ + 0x0010 /**< \brief GetReference read error, will be set if unable to get a consistent ref value */ +#define CFE_TIME_FLAG_UNUSED 0x000F /**< \brief Reserved flags - should be zero */ /** \} */ /*************************************************************************/ diff --git a/modules/time/fsw/src/cfe_time_api.c b/modules/time/fsw/src/cfe_time_api.c index f6eb1246e..c286f3df5 100644 --- a/modules/time/fsw/src/cfe_time_api.c +++ b/modules/time/fsw/src/cfe_time_api.c @@ -284,6 +284,14 @@ uint16 CFE_TIME_GetClockInfo(void) StateFlags |= CFE_TIME_FLAG_GDTONE; } + /* + ** Check if CFE_TIME_GetReference ever failed to get a good value + */ + if (CFE_TIME_Global.GetReferenceFail) + { + StateFlags |= CFE_TIME_FLAG_REFERR; + } + return (StateFlags); } @@ -606,7 +614,7 @@ void CFE_TIME_Print(char *PrintBuffer, CFE_TIME_SysTime_t TimeToPrint) if (PrintBuffer == NULL) { - CFE_ES_WriteToSysLog("CFE_TIME:Print-Failed invalid arguments\n"); + CFE_ES_WriteToSysLog("%s: Failed invalid arguments\n", __func__); return; } diff --git a/modules/time/fsw/src/cfe_time_task.c b/modules/time/fsw/src/cfe_time_task.c index 2119a6c78..c4f3a2a63 100644 --- a/modules/time/fsw/src/cfe_time_task.c +++ b/modules/time/fsw/src/cfe_time_task.c @@ -78,7 +78,7 @@ void CFE_TIME_TaskMain(void) if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("TIME:Application Init Failed,RC=0x%08X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Application Init Failed,RC=0x%08X\n", __func__, (unsigned int)Status); CFE_ES_PerfLogExit(CFE_MISSION_TIME_MAIN_PERF_ID); /* Note: CFE_ES_ExitApp will not return */ CFE_ES_ExitApp(CFE_ES_RunStatus_CORE_APP_INIT_ERROR); @@ -113,7 +113,7 @@ void CFE_TIME_TaskMain(void) } else { - CFE_ES_WriteToSysLog("TIME:Error reading cmd pipe,RC=0x%08X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Error reading cmd pipe,RC=0x%08X\n", __func__, (unsigned int)Status); } /* end if */ } /* end while */ @@ -139,7 +139,7 @@ int32 CFE_TIME_TaskInit(void) Status = CFE_EVS_Register(NULL, 0, 0); if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("TIME:Call to CFE_EVS_Register Failed:RC=0x%08X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Call to CFE_EVS_Register Failed:RC=0x%08X\n", __func__, (unsigned int)Status); return Status; } /* end if */ @@ -147,7 +147,7 @@ int32 CFE_TIME_TaskInit(void) CFE_TIME_SEM_OPTIONS); if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("TIME:Error creating tone semaphore:RC=0x%08X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Error creating tone semaphore:RC=0x%08X\n", __func__, (unsigned int)Status); return Status; } /* end if */ @@ -155,7 +155,7 @@ int32 CFE_TIME_TaskInit(void) CFE_TIME_SEM_OPTIONS); if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("TIME:Error creating local semaphore:RC=0x%08X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Error creating local semaphore:RC=0x%08X\n", __func__, (unsigned int)Status); return Status; } /* end if */ @@ -164,7 +164,7 @@ int32 CFE_TIME_TaskInit(void) CFE_PLATFORM_TIME_TONE_TASK_PRIORITY, CFE_TIME_TASK_FLAGS); if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("TIME:Error creating tone 1Hz child task:RC=0x%08X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Error creating tone 1Hz child task:RC=0x%08X\n", __func__, (unsigned int)Status); return Status; } /* end if */ @@ -173,21 +173,21 @@ int32 CFE_TIME_TaskInit(void) CFE_PLATFORM_TIME_1HZ_TASK_PRIORITY, CFE_TIME_TASK_FLAGS); if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("TIME:Error creating local 1Hz child task:RC=0x%08X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Error creating local 1Hz child task:RC=0x%08X\n", __func__, (unsigned int)Status); return Status; } /* end if */ Status = CFE_SB_CreatePipe(&CFE_TIME_Global.CmdPipe, CFE_TIME_TASK_PIPE_DEPTH, CFE_TIME_TASK_PIPE_NAME); if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("TIME:Error creating cmd pipe:RC=0x%08X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Error creating cmd pipe:RC=0x%08X\n", __func__, (unsigned int)Status); return Status; } /* end if */ Status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(CFE_TIME_SEND_HK_MID), CFE_TIME_Global.CmdPipe); if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("TIME:Error subscribing to HK Request:RC=0x%08X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Error subscribing to HK Request:RC=0x%08X\n", __func__, (unsigned int)Status); return Status; } /* end if */ @@ -203,7 +203,7 @@ int32 CFE_TIME_TaskInit(void) #endif if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("TIME:Error subscribing to tone cmd:RC=0x%08X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Error subscribing to tone cmd:RC=0x%08X\n", __func__, (unsigned int)Status); return Status; } /* end if */ @@ -219,7 +219,7 @@ int32 CFE_TIME_TaskInit(void) #endif if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("TIME:Error subscribing to time data cmd:RC=0x%08X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Error subscribing to time data cmd:RC=0x%08X\n", __func__, (unsigned int)Status); return Status; } /* end if */ @@ -236,7 +236,8 @@ int32 CFE_TIME_TaskInit(void) if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("TIME:Error subscribing to fake tone signal cmds:RC=0x%08X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Error subscribing to fake tone signal cmds:RC=0x%08X\n", __func__, + (unsigned int)Status); return Status; } /* end if */ @@ -247,7 +248,7 @@ int32 CFE_TIME_TaskInit(void) Status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(CFE_TIME_SEND_CMD_MID), CFE_TIME_Global.CmdPipe); if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("TIME:Error subscribing to time at the tone request data cmds:RC=0x%08X\n", + CFE_ES_WriteToSysLog("%s: Error subscribing to time at the tone request data cmds:RC=0x%08X\n", __func__, (unsigned int)Status); return Status; } /* end if */ @@ -259,14 +260,15 @@ int32 CFE_TIME_TaskInit(void) Status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(CFE_TIME_CMD_MID), CFE_TIME_Global.CmdPipe); if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("TIME:Error subscribing to time task gnd cmds:RC=0x%08X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Error subscribing to time task gnd cmds:RC=0x%08X\n", __func__, (unsigned int)Status); return Status; } /* end if */ - Status = CFE_EVS_SendEvent(CFE_TIME_INIT_EID, CFE_EVS_EventType_INFORMATION, "cFE TIME Initialized"); + Status = CFE_EVS_SendEvent(CFE_TIME_INIT_EID, CFE_EVS_EventType_INFORMATION, "cFE TIME Initialized: %s", + CFE_VERSION_STRING); if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("TIME:Error sending init event:RC=0x%08X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: Error sending init event:RC=0x%08X\n", __func__, (unsigned int)Status); return Status; } /* end if */ @@ -296,12 +298,12 @@ int32 CFE_TIME_TaskInit(void) Status = OS_TimerSet(TimerId, 500000, 1000000); if (Status != OS_SUCCESS) { - CFE_ES_WriteToSysLog("TIME:1Hz OS_TimerSet failed:RC=0x%08X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: 1Hz OS_TimerSet failed:RC=0x%08X\n", __func__, (unsigned int)Status); } } else { - CFE_ES_WriteToSysLog("TIME:1Hz OS_TimerAdd failed:RC=0x%08X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("%s: 1Hz OS_TimerAdd failed:RC=0x%08X\n", __func__, (unsigned int)Status); } } @@ -703,7 +705,7 @@ int32 CFE_TIME_NoopCmd(const CFE_TIME_NoopCmd_t *data) CFE_TIME_Global.CommandCounter++; - CFE_EVS_SendEvent(CFE_TIME_NOOP_EID, CFE_EVS_EventType_INFORMATION, "No-op command.%s", CFE_VERSION_STRING); + CFE_EVS_SendEvent(CFE_TIME_NOOP_EID, CFE_EVS_EventType_INFORMATION, "No-op Cmd Rcvd: %s", CFE_VERSION_STRING); return CFE_SUCCESS; } diff --git a/modules/time/fsw/src/cfe_time_utils.c b/modules/time/fsw/src/cfe_time_utils.c index 764cd0acd..aee970c9d 100644 --- a/modules/time/fsw/src/cfe_time_utils.c +++ b/modules/time/fsw/src/cfe_time_utils.c @@ -619,6 +619,27 @@ void CFE_TIME_GetReference(CFE_TIME_Reference_t *Reference) --RetryCount; } + /* + * This should really never happen: if RetryCount reaches its limit, it means something is + * continously changing the time structure to the point where this task was not able to + * get a consistent copy. The only way this could happen is if some update task got into + * a continuous loop, or if the memory itself has gone bad and reads inconsistently. But + * if the latter is the case, the whole system has undefined behavior. + */ + if (RetryCount == 0) + { + /* set the flag that indicates this failed */ + CFE_TIME_Global.GetReferenceFail = true; + + /* + * Zeroing out the structure produces an identifiable output, in particular + * this sets the ClockSetState to CFE_TIME_SetState_NOT_SET, which the CFE_TIME_CalculateState() + * will in turn translate to CFE_TIME_ClockState_INVALID in TLM. + */ + memset(Reference, 0, sizeof(*Reference)); + return; + } + /* ** Compute the amount of time "since" the tone... */ diff --git a/modules/time/fsw/src/cfe_time_utils.h b/modules/time/fsw/src/cfe_time_utils.h index 232940f16..ec08f7aa6 100644 --- a/modules/time/fsw/src/cfe_time_utils.h +++ b/modules/time/fsw/src/cfe_time_utils.h @@ -257,9 +257,9 @@ typedef struct bool IsToneGood; /* - ** Spare byte for alignment + ** Flag that indicates if "CFE_TIME_GetReference()" ever failed to get a valid time */ - bool Spare; + bool GetReferenceFail; /* ** Local 1Hz wake-up command packet (not related to time at tone)... diff --git a/modules/time/ut-coverage/time_UT.c b/modules/time/ut-coverage/time_UT.c index aac8c2d00..161851d7d 100644 --- a/modules/time/ut-coverage/time_UT.c +++ b/modules/time/ut-coverage/time_UT.c @@ -43,9 +43,9 @@ /* ** External global variables */ -const char *TIME_SYSLOG_MSGS[] = {NULL, "TIME:Error reading cmd pipe,RC=0x%08X\n", - "TIME:Application Init Failed,RC=0x%08X\n", "TIME:1Hz OS_TimerAdd failed:RC=0x%08X\n", - "TIME:1Hz OS_TimerSet failed:RC=0x%08X\n"}; +const char *TIME_SYSLOG_MSGS[] = {NULL, "%s: Error reading cmd pipe,RC=0x%08X\n", + "%s: Application Init Failed,RC=0x%08X\n", "%s: 1Hz OS_TimerAdd failed:RC=0x%08X\n", + "%s: 1Hz OS_TimerSet failed:RC=0x%08X\n"}; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_SEND_HK = {.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_SEND_HK_MID)}; @@ -124,6 +124,36 @@ int32 ut_time_CallbackCalled; void OS_SelectTone(int16 Signal) {} #endif +/* + * A hook functions for CFE_PSP_GetTime that updates the Reference State. + * This mimmics what would happen if a time update occurred at the moment + * another task was reading the time. + */ +int32 UT_TimeRefUpdateHook(void *UserObj, int32 StubRetcode, uint32 CallCount, const UT_StubContext_t *Context) +{ + volatile CFE_TIME_ReferenceState_t *RefState; + uint32 * UpdateCount = UserObj; + uint32 i; + + /* + * NOTE: in order to trigger a read retry, this actually needs to do CFE_TIME_REFERENCE_BUF_DEPTH + * updates, such that the buffer being read is overwritten. + */ + if (*UpdateCount > 0) + { + for (i = 0; i < CFE_TIME_REFERENCE_BUF_DEPTH; ++i) + { + RefState = CFE_TIME_StartReferenceUpdate(); + RefState->AtToneLatch.Seconds = 1 + CallCount; + RefState->ClockSetState = CFE_TIME_SetState_WAS_SET; + CFE_TIME_FinishReferenceUpdate(RefState); + } + --(*UpdateCount); + } + + return StubRetcode; +} + void UtTest_Setup(void) { /* Initialize unit test */ @@ -492,6 +522,7 @@ void Test_GetTime(void) CFE_TIME_Global.OneHzDirection = CFE_TIME_AdjustDirection_SUBTRACT; RefState->DelayDirection = CFE_TIME_AdjustDirection_SUBTRACT; CFE_TIME_Global.IsToneGood = false; + CFE_TIME_Global.GetReferenceFail = false; CFE_TIME_FinishReferenceUpdate(RefState); ActFlags = CFE_TIME_GetClockInfo(); StateFlags = 0; @@ -517,10 +548,11 @@ void Test_GetTime(void) CFE_TIME_Global.OneTimeDirection = CFE_TIME_AdjustDirection_ADD; CFE_TIME_Global.OneHzDirection = CFE_TIME_AdjustDirection_ADD; CFE_TIME_Global.IsToneGood = true; + CFE_TIME_Global.GetReferenceFail = true; StateFlags = CFE_TIME_FLAG_CLKSET | CFE_TIME_FLAG_FLYING | CFE_TIME_FLAG_SRCINT | CFE_TIME_FLAG_SIGPRI | CFE_TIME_FLAG_SRVFLY | CFE_TIME_FLAG_CMDFLY | CFE_TIME_FLAG_ADD1HZ | CFE_TIME_FLAG_ADDADJ | - CFE_TIME_FLAG_ADDTCL | CFE_TIME_FLAG_GDTONE; + CFE_TIME_FLAG_ADDTCL | CFE_TIME_FLAG_GDTONE | CFE_TIME_FLAG_REFERR; #if (CFE_PLATFORM_TIME_CFG_SERVER == true) StateFlags |= CFE_TIME_FLAG_SERVER; @@ -529,6 +561,8 @@ void Test_GetTime(void) ActFlags = CFE_TIME_GetClockInfo(); snprintf(testDesc, UT_MAX_MESSAGE_LENGTH, "Expected = 0x%04X, actual = 0x%04X", StateFlags, ActFlags); UT_Report(__FILE__, __LINE__, ActFlags == StateFlags, "CFE_TIME_GetClockInfo", testDesc); + + CFE_TIME_Global.GetReferenceFail = false; } /* @@ -2009,6 +2043,7 @@ void Test_GetReference(void) { CFE_TIME_Reference_t Reference; volatile CFE_TIME_ReferenceState_t *RefState; + uint32 UpdateCount; UtPrintf("Begin Test Get Reference"); @@ -2050,6 +2085,35 @@ void Test_GetReference(void) */ UT_Report(__FILE__, __LINE__, Reference.CurrentMET.Seconds == 25 && Reference.CurrentMET.Subseconds == 0, "CFE_TIME_GetReference", "Local clock > latch at tone time"); + + /* Use a hook function to test the behavior when the read needs to be retried */ + /* This just causes a single retry, the process should still succeed */ + UT_InitData(); + memset((void *)CFE_TIME_Global.ReferenceState, 0, sizeof(CFE_TIME_Global.ReferenceState)); + CFE_TIME_Global.GetReferenceFail = false; + UpdateCount = 1; + UT_SetHookFunction(UT_KEY(CFE_PSP_GetTime), UT_TimeRefUpdateHook, &UpdateCount); + UT_SetBSP_Time(20, 0); + UT_SetBSP_Time(20, 100); + CFE_TIME_GetReference(&Reference); + + /* This should not have set the flag, and the output should be valid*/ + UtAssert_UINT32_EQ(CFE_TIME_Global.GetReferenceFail, false); + UtAssert_UINT32_EQ(Reference.CurrentMET.Seconds, 19); + UtAssert_UINT32_EQ(Reference.CurrentMET.Subseconds, 429497); + UtAssert_UINT32_EQ(Reference.ClockSetState, CFE_TIME_SetState_WAS_SET); + + /* With multiple retries, it should fail */ + UpdateCount = 1000000; + CFE_TIME_GetReference(&Reference); + + /* This should have set the flag, and the output should be all zero */ + UtAssert_UINT32_EQ(CFE_TIME_Global.GetReferenceFail, true); + UtAssert_UINT32_EQ(Reference.CurrentMET.Seconds, 0); + UtAssert_UINT32_EQ(Reference.CurrentMET.Subseconds, 0); + UtAssert_UINT32_EQ(Reference.ClockSetState, CFE_TIME_SetState_NOT_SET); + + CFE_TIME_Global.GetReferenceFail = false; } /*