From 377246aa3c8e5e64ba4a910b8d6c30b1643d21ae Mon Sep 17 00:00:00 2001 From: Jacob Hageman Date: Wed, 3 Feb 2021 09:30:09 -0500 Subject: [PATCH 1/5] Fix #230, Add workflow timeout and format check --- .github/workflows/format-check.yml | 53 +++++++++++++++++++++++++++ .github/workflows/static-analysis.yml | 1 + .travis.yml | 29 --------------- README.md | 3 +- 4 files changed, 56 insertions(+), 30 deletions(-) create mode 100644 .github/workflows/format-check.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/format-check.yml b/.github/workflows/format-check.yml new file mode 100644 index 00000000..0a998ecc --- /dev/null +++ b/.github/workflows/format-check.yml @@ -0,0 +1,53 @@ +name: Format Check + +# Run on main push and pull requests +on: + push: + branches: + - main + pull_request: + +jobs: + + static-analysis: + name: Run format check + runs-on: ubuntu-18.04 + timeout-minutes: 15 + + steps: + + - name: Install format checker + run: | + wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - + sudo add-apt-repository 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-10 main' + sudo apt-get update && sudo apt-get install clang-format-10 + + - name: Checkout bundle + uses: actions/checkout@v2 + with: + repository: nasa/cFS + + - name: Checkout + uses: actions/checkout@v2 + with: + path: repo + + - name: Generate format differences + run: | + cd repo + find . -name "*.[ch]" -exec clang-format-10 -i -style=file {} + + git diff > $GITHUB_WORKSPACE/style_differences.txt + + - name: Archive Static Analysis Artifacts + uses: actions/upload-artifact@v2 + with: + name: style_differences + path: style_differences.txt + + - name: Error on differences + run: | + if [[ -s style_differences.txt ]]; + then + cat style_differences.txt + exit -1 + fi diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 23d9383b..6cd027f9 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -13,6 +13,7 @@ jobs: static-analysis: name: Run cppcheck runs-on: ubuntu-18.04 + timeout-minutes: 15 strategy: fail-fast: false diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index dc7ddea5..00000000 --- a/.travis.yml +++ /dev/null @@ -1,29 +0,0 @@ -os: linux -dist: bionic -language: c -compiler: - - gcc -addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - cmake - -before_install: - - sudo apt-get install cppcheck - -script: - # Check versions - - cppcheck --version - - #cppcheck flight software psp/fsw - - cppcheck --force --inline-suppr --std=c99 --language=c --error-exitcode=1 --enable=warning,performance,portability,style --suppress=variableScope --inconclusive fsw 2>cppcheck_flight_psp.txt - - | - if [[ -s cppcheck_flight_psp.txt ]]; then - echo "You must fix cppcheck errors before submitting a pull request" - echo "" - cat cppcheck_flight_psp.txt - exit -1 - fi - diff --git a/README.md b/README.md index f5e28c1f..6cc43c30 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ -Travis-CI: [![Build Status](https://travis-ci.com/nasa/PSP.svg)](https://travis-ci.com/nasa/PSP) +![Static Analysis](https://github.com/nasa/psp/workflows/Static%20Analysis/badge.svg) +![Format Check](https://github.com/nasa/psp/workflows/Format%20Check/badge.svg) # Core Flight System : Framework : Platform Support Package From d27eaa1caabd0fc794cca86d9fd56c71c9caa2b3 Mon Sep 17 00:00:00 2001 From: Jacob Hageman Date: Wed, 3 Feb 2021 10:23:29 -0500 Subject: [PATCH 2/5] Fix #210, Apply standard formatting --- fsw/inc/cfe_psp.h | 212 ++--- fsw/inc/cfe_psp_configdata.h | 33 +- fsw/mcp750-vxworks/inc/cfe_psp_config.h | 28 +- fsw/mcp750-vxworks/inc/psp_version.h | 35 +- .../src/bsp-integration/cfeSupport.c | 285 ++++--- fsw/mcp750-vxworks/src/cfe_psp_exception.c | 58 +- fsw/mcp750-vxworks/src/cfe_psp_memory.c | 479 +++++------ fsw/mcp750-vxworks/src/cfe_psp_memtab.c | 25 +- fsw/mcp750-vxworks/src/cfe_psp_ssr.c | 35 +- fsw/mcp750-vxworks/src/cfe_psp_start.c | 299 ++++--- fsw/mcp750-vxworks/src/cfe_psp_support.c | 61 +- fsw/mcp750-vxworks/src/cfe_psp_timer.c | 54 +- fsw/mcp750-vxworks/src/cfe_psp_watchdog.c | 97 +-- .../cfe_psp_eeprom_mmap_file.c | 201 +++-- fsw/modules/eeprom_stub/cfe_psp_eeprom_stub.c | 22 +- fsw/pc-linux/inc/cfe_psp_config.h | 27 +- fsw/pc-linux/inc/psp_version.h | 35 +- fsw/pc-linux/src/cfe_psp_exception.c | 85 +- fsw/pc-linux/src/cfe_psp_memory.c | 656 +++++++------- fsw/pc-linux/src/cfe_psp_memtab.c | 28 +- fsw/pc-linux/src/cfe_psp_ssr.c | 10 +- fsw/pc-linux/src/cfe_psp_start.c | 799 +++++++++--------- fsw/pc-linux/src/cfe_psp_support.c | 126 ++- fsw/pc-linux/src/cfe_psp_timer.c | 56 +- fsw/pc-linux/src/cfe_psp_watchdog.c | 49 +- fsw/pc-rtems/inc/cfe_psp_config.h | 14 +- fsw/pc-rtems/inc/psp_version.h | 4 +- fsw/pc-rtems/src/cfe_psp_exception.c | 16 +- fsw/pc-rtems/src/cfe_psp_memory.c | 545 ++++++------ fsw/pc-rtems/src/cfe_psp_memtab.c | 26 +- fsw/pc-rtems/src/cfe_psp_ssr.c | 15 +- fsw/pc-rtems/src/cfe_psp_start.c | 181 ++-- fsw/pc-rtems/src/cfe_psp_support.c | 46 +- fsw/pc-rtems/src/cfe_psp_timer.c | 56 +- fsw/pc-rtems/src/cfe_psp_watchdog.c | 49 +- fsw/shared/inc/cfe_psp_exceptionstorage_api.h | 9 +- .../inc/cfe_psp_exceptionstorage_types.h | 16 +- fsw/shared/inc/cfe_psp_memory.h | 20 +- fsw/shared/inc/cfe_psp_module.h | 18 +- fsw/shared/src/cfe_psp_configdata.c | 26 +- fsw/shared/src/cfe_psp_eeprom.c | 300 ++++--- fsw/shared/src/cfe_psp_exceptionstorage.c | 40 +- fsw/shared/src/cfe_psp_memrange.c | 273 +++--- fsw/shared/src/cfe_psp_memutils.c | 19 +- fsw/shared/src/cfe_psp_module.c | 31 +- fsw/shared/src/cfe_psp_port.c | 86 +- fsw/shared/src/cfe_psp_ram.c | 88 +- .../adaptors/inc/ut-adaptor-bootrec.h | 15 +- .../adaptors/src/ut-adaptor-bootrec.c | 15 +- .../src/coveragetest-cfe-psp-start.c | 14 +- .../src/coveragetest-cfe-psp-support.c | 10 +- .../src/coveragetest-psp-mcp750-vxworks.c | 17 +- .../src/coveragetest-psp-mcp750-vxworks.h | 14 +- .../adaptors/inc/ut-adaptor-exceptions.h | 14 +- .../adaptors/src/ut-adaptor-exceptions.c | 21 +- .../shared/inc/coveragetest-psp-shared.h | 11 +- .../coveragetest-cfe-psp-exceptionstorage.c | 42 +- .../ut-stubs/inc/PCS_arch_ppc_esfPpc.h | 2 - .../ut-stubs/inc/PCS_arch_ppc_vxPpcLib.h | 62 +- .../ut-stubs/inc/PCS_basetypes.h | 10 +- unit-test-coverage/ut-stubs/inc/PCS_blkIo.h | 9 +- .../ut-stubs/inc/PCS_cacheLib.h | 3 +- .../ut-stubs/inc/PCS_cfe_configdata.h | 24 +- .../ut-stubs/inc/PCS_dosFsLib.h | 5 +- .../ut-stubs/inc/PCS_drv_hdisk_ataDrv.h | 5 +- .../ut-stubs/inc/PCS_errnoLib.h | 4 +- unit-test-coverage/ut-stubs/inc/PCS_excLib.h | 4 +- unit-test-coverage/ut-stubs/inc/PCS_fppLib.h | 3 +- unit-test-coverage/ut-stubs/inc/PCS_mcpx750.h | 14 +- .../ut-stubs/inc/PCS_moduleLib.h | 13 +- unit-test-coverage/ut-stubs/inc/PCS_ramDrv.h | 7 +- .../ut-stubs/inc/PCS_rebootLib.h | 6 +- unit-test-coverage/ut-stubs/inc/PCS_stdarg.h | 12 +- unit-test-coverage/ut-stubs/inc/PCS_stdio.h | 31 +- unit-test-coverage/ut-stubs/inc/PCS_stdlib.h | 17 +- unit-test-coverage/ut-stubs/inc/PCS_string.h | 25 +- unit-test-coverage/ut-stubs/inc/PCS_sysLib.h | 17 +- .../ut-stubs/inc/PCS_sys_types.h | 17 +- unit-test-coverage/ut-stubs/inc/PCS_taskLib.h | 73 +- unit-test-coverage/ut-stubs/inc/PCS_unistd.h | 37 +- unit-test-coverage/ut-stubs/inc/PCS_usrLib.h | 3 - unit-test-coverage/ut-stubs/inc/PCS_vxLib.h | 3 - unit-test-coverage/ut-stubs/inc/PCS_vxWorks.h | 44 +- .../ut-stubs/inc/PCS_xbdBlkDev.h | 9 +- .../ut-stubs/inc/PCS_xbdRamDisk.h | 3 - .../ut-stubs/override_inc/arch/ppc/esfPpc.h | 3 +- .../ut-stubs/override_inc/arch/ppc/vxPpcLib.h | 38 +- .../ut-stubs/override_inc/blkIo.h | 7 +- .../ut-stubs/override_inc/cacheLib.h | 3 +- .../ut-stubs/override_inc/dosFsLib.h | 14 +- .../ut-stubs/override_inc/drv/hdisk/ataDrv.h | 5 +- .../ut-stubs/override_inc/errnoLib.h | 4 +- .../ut-stubs/override_inc/excLib.h | 3 +- .../ut-stubs/override_inc/fppLib.h | 4 +- .../ut-stubs/override_inc/mcpx750.h | 22 +- .../ut-stubs/override_inc/moduleLib.h | 6 +- .../ut-stubs/override_inc/ramDrv.h | 3 +- .../ut-stubs/override_inc/rebootLib.h | 7 +- .../ut-stubs/override_inc/stdarg.h | 7 +- .../ut-stubs/override_inc/stdio.h | 32 +- .../ut-stubs/override_inc/stdlib.h | 15 +- .../ut-stubs/override_inc/string.h | 24 +- .../ut-stubs/override_inc/sys/types.h | 12 +- .../ut-stubs/override_inc/sysLib.h | 16 +- .../ut-stubs/override_inc/taskLib.h | 45 +- .../ut-stubs/override_inc/unistd.h | 38 +- .../ut-stubs/override_inc/usrLib.h | 2 - .../ut-stubs/override_inc/vxLib.h | 1 - .../ut-stubs/override_inc/vxWorks.h | 51 +- .../ut-stubs/override_inc/xbdBlkDev.h | 11 +- .../ut-stubs/override_inc/xbdRamDisk.h | 2 - .../ut-stubs/src/cfe-configdata-stubs.c | 57 +- .../ut-stubs/src/libc-stdio-stubs.c | 52 +- .../ut-stubs/src/libc-stdlib-stubs.c | 71 +- .../ut-stubs/src/libc-string-stubs.c | 44 +- .../ut-stubs/src/vxworks-ataDrv-stubs.c | 2 +- .../ut-stubs/src/vxworks-cacheLib-stubs.c | 2 +- .../ut-stubs/src/vxworks-excLib-stubs.c | 2 +- .../ut-stubs/src/vxworks-fppLib-stubs.c | 2 +- .../ut-stubs/src/vxworks-moduleLib-stubs.c | 8 +- .../ut-stubs/src/vxworks-sysLib-stubs.c | 18 +- .../ut-stubs/src/vxworks-taskLib-stubs.c | 46 +- .../ut-stubs/src/vxworks-vxLib-stubs.c | 13 +- ut-stubs/ut_psp_stubs.c | 102 +-- 124 files changed, 3312 insertions(+), 3790 deletions(-) diff --git a/fsw/inc/cfe_psp.h b/fsw/inc/cfe_psp.h index f322323d..c340f983 100644 --- a/fsw/inc/cfe_psp.h +++ b/fsw/inc/cfe_psp.h @@ -23,7 +23,7 @@ ** ** Author: A. Cudmore ** -** Purpose: This file contains the cFE Platform Support Package(PSP) +** Purpose: This file contains the cFE Platform Support Package(PSP) ** prototypes. ** The PSP routines serve as the "glue" between the RTOS and ** the cFE Flight Software. The routines fill gaps that are not @@ -50,24 +50,22 @@ /* ** Error and return codes */ -#define CFE_PSP_SUCCESS (0) -#define CFE_PSP_ERROR (-1) -#define CFE_PSP_INVALID_POINTER (-2) -#define CFE_PSP_ERROR_ADDRESS_MISALIGNED (-3) -#define CFE_PSP_ERROR_TIMEOUT (-4) -#define CFE_PSP_INVALID_INT_NUM (-5) -#define CFE_PSP_INVALID_MEM_ADDR (-21) -#define CFE_PSP_INVALID_MEM_TYPE (-22) -#define CFE_PSP_INVALID_MEM_RANGE (-23) -#define CFE_PSP_INVALID_MEM_WORDSIZE (-24) -#define CFE_PSP_INVALID_MEM_SIZE (-25) -#define CFE_PSP_INVALID_MEM_ATTR (-26) -#define CFE_PSP_ERROR_NOT_IMPLEMENTED (-27) -#define CFE_PSP_INVALID_MODULE_NAME (-28) -#define CFE_PSP_INVALID_MODULE_ID (-29) -#define CFE_PSP_NO_EXCEPTION_DATA (-30) - - +#define CFE_PSP_SUCCESS (0) +#define CFE_PSP_ERROR (-1) +#define CFE_PSP_INVALID_POINTER (-2) +#define CFE_PSP_ERROR_ADDRESS_MISALIGNED (-3) +#define CFE_PSP_ERROR_TIMEOUT (-4) +#define CFE_PSP_INVALID_INT_NUM (-5) +#define CFE_PSP_INVALID_MEM_ADDR (-21) +#define CFE_PSP_INVALID_MEM_TYPE (-22) +#define CFE_PSP_INVALID_MEM_RANGE (-23) +#define CFE_PSP_INVALID_MEM_WORDSIZE (-24) +#define CFE_PSP_INVALID_MEM_SIZE (-25) +#define CFE_PSP_INVALID_MEM_ATTR (-26) +#define CFE_PSP_ERROR_NOT_IMPLEMENTED (-27) +#define CFE_PSP_INVALID_MODULE_NAME (-28) +#define CFE_PSP_INVALID_MODULE_ID (-29) +#define CFE_PSP_NO_EXCEPTION_DATA (-30) /* ** Definitions for PSP PANIC types @@ -83,18 +81,18 @@ /* ** Macros for the file loader */ -#define BUFF_SIZE 256 -#define SIZE_BYTE 1 -#define SIZE_HALF 2 -#define SIZE_WORD 3 +#define BUFF_SIZE 256 +#define SIZE_BYTE 1 +#define SIZE_HALF 2 +#define SIZE_WORD 3 /* ** Define memory types */ -#define CFE_PSP_MEM_RAM 1 -#define CFE_PSP_MEM_EEPROM 2 -#define CFE_PSP_MEM_ANY 3 -#define CFE_PSP_MEM_INVALID 4 +#define CFE_PSP_MEM_RAM 1 +#define CFE_PSP_MEM_EEPROM 2 +#define CFE_PSP_MEM_ANY 3 +#define CFE_PSP_MEM_INVALID 4 /* ** Define Memory Read/Write Attributes @@ -106,18 +104,18 @@ /* ** Define the Memory Word Sizes */ -#define CFE_PSP_MEM_SIZE_BYTE 0x01 -#define CFE_PSP_MEM_SIZE_WORD 0x02 -#define CFE_PSP_MEM_SIZE_DWORD 0x04 +#define CFE_PSP_MEM_SIZE_BYTE 0x01 +#define CFE_PSP_MEM_SIZE_WORD 0x02 +#define CFE_PSP_MEM_SIZE_DWORD 0x04 /* * Common definition for reset types at the PSP layer */ /** \name Reset Types */ /** \{ */ -#define CFE_PSP_RST_TYPE_PROCESSOR 1 /**< Volatile disk, Critical Data Store and User Reserved memory could still be valid */ -#define CFE_PSP_RST_TYPE_POWERON 2 /**< All memory has been cleared */ -#define CFE_PSP_RST_TYPE_MAX 3 /**< Placeholder to indicate 1+ the maximum value that the PSP will ever use. */ +#define CFE_PSP_RST_TYPE_PROCESSOR 1 /**< Volatile disk, CDS and User Reserved memory may be valid */ +#define CFE_PSP_RST_TYPE_POWERON 2 /**< All memory has been cleared */ +#define CFE_PSP_RST_TYPE_MAX 3 /**< Placeholder to indicate 1+ the maximum value that the PSP will ever use. */ /** \} */ /* @@ -125,25 +123,35 @@ */ /** \name Reset Sub-Types */ /** \{ */ -#define CFE_PSP_RST_SUBTYPE_POWER_CYCLE 1 /**< \brief Reset caused by power having been removed and restored */ -#define CFE_PSP_RST_SUBTYPE_PUSH_BUTTON 2 /**< \brief Reset caused by reset button on the board having been pressed */ -#define CFE_PSP_RST_SUBTYPE_HW_SPECIAL_COMMAND 3 /**< \brief Reset was caused by a reset line having been stimulated by a hardware special command */ -#define CFE_PSP_RST_SUBTYPE_HW_WATCHDOG 4 /**< \brief Reset was caused by a watchdog timer expiring */ -#define CFE_PSP_RST_SUBTYPE_RESET_COMMAND 5 /**< \brief Reset was caused by cFE ES processing a \link #CFE_ES_RESTART_CC Reset Command \endlink */ -#define CFE_PSP_RST_SUBTYPE_EXCEPTION 6 /**< \brief Reset was caused by a Processor Exception */ -#define CFE_PSP_RST_SUBTYPE_UNDEFINED_RESET 7 /**< \brief Reset was caused in an unknown manner */ -#define CFE_PSP_RST_SUBTYPE_HWDEBUG_RESET 8 /**< \brief Reset was caused by a JTAG or BDM connection */ -#define CFE_PSP_RST_SUBTYPE_BANKSWITCH_RESET 9 /**< \brief Reset reverted to a cFE POWERON due to a boot bank switch */ -#define CFE_PSP_RST_SUBTYPE_MAX 10 /**< \brief Placeholder to indicate 1+ the maximum value that the PSP will ever use. */ -/** \} */ +/** \brief Reset caused by power having been removed and restored */ +#define CFE_PSP_RST_SUBTYPE_POWER_CYCLE 1 +/** \brief Reset caused by reset button on the board */ +#define CFE_PSP_RST_SUBTYPE_PUSH_BUTTON 2 +/** \brief Reset was caused by a reset line having been stimulated by a hardware special command */ +#define CFE_PSP_RST_SUBTYPE_HW_SPECIAL_COMMAND 3 +/** \brief Reset was caused by a watchdog timer expiring */ +#define CFE_PSP_RST_SUBTYPE_HW_WATCHDOG 4 +/** \brief Reset was caused by cFE ES processing a \link #CFE_ES_RESTART_CC Reset Command \endlink */ +#define CFE_PSP_RST_SUBTYPE_RESET_COMMAND 5 +/** \brief Reset was caused by a Processor Exception */ +#define CFE_PSP_RST_SUBTYPE_EXCEPTION 6 +/** \brief Reset was caused in an unknown manner */ +#define CFE_PSP_RST_SUBTYPE_UNDEFINED_RESET 7 +/** \brief Reset was caused by a JTAG or BDM connection */ +#define CFE_PSP_RST_SUBTYPE_HWDEBUG_RESET 8 +/** \brief Reset reverted to a cFE POWERON due to a boot bank switch */ +#define CFE_PSP_RST_SUBTYPE_BANKSWITCH_RESET 9 +/** \brief Placeholder to indicate 1+ the maximum value that the PSP will ever use. */ +#define CFE_PSP_RST_SUBTYPE_MAX 10 +/** \} */ /* Implement the "version" macros */ -#define CFE_PSP_MAJOR_VERSION (GLOBAL_PSP_CONFIGDATA.PSP_VersionInfo.MajorVersion) -#define CFE_PSP_MINOR_VERSION (GLOBAL_PSP_CONFIGDATA.PSP_VersionInfo.MinorVersion) -#define CFE_PSP_REVISION (GLOBAL_PSP_CONFIGDATA.PSP_VersionInfo.Revision) -#define CFE_PSP_MISSION_REV (GLOBAL_PSP_CONFIGDATA.PSP_VersionInfo.MissionRev) -#define CFE_PSP_VERSION (GLOBAL_PSP_CONFIGDATA.PSP_VersionInfo.Version) +#define CFE_PSP_MAJOR_VERSION (GLOBAL_PSP_CONFIGDATA.PSP_VersionInfo.MajorVersion) +#define CFE_PSP_MINOR_VERSION (GLOBAL_PSP_CONFIGDATA.PSP_VersionInfo.MinorVersion) +#define CFE_PSP_REVISION (GLOBAL_PSP_CONFIGDATA.PSP_VersionInfo.Revision) +#define CFE_PSP_MISSION_REV (GLOBAL_PSP_CONFIGDATA.PSP_VersionInfo.MissionRev) +#define CFE_PSP_VERSION (GLOBAL_PSP_CONFIGDATA.PSP_VersionInfo.Version) /* ** Type Definitions @@ -154,11 +162,11 @@ */ typedef struct { - uint32 MemoryType; - uint32 WordSize; - cpuaddr StartAddr; - uint32 Size; - uint32 Attributes; + uint32 MemoryType; + uint32 WordSize; + cpuaddr StartAddr; + uint32 Size; + uint32 Attributes; } CFE_PSP_MemTable_t; /* @@ -168,7 +176,7 @@ typedef struct /* ** PSP entry point and reset routines */ -extern void CFE_PSP_Main(void); +extern void CFE_PSP_Main(void); /* ** CFE_PSP_Main is the entry point that the real time OS calls to start our @@ -177,20 +185,18 @@ extern void CFE_PSP_Main(void); ** The flight software (i.e. cFE ) should not call this routine. */ -extern void CFE_PSP_GetTime(OS_time_t *LocalTime); +extern void CFE_PSP_GetTime(OS_time_t *LocalTime); /* This call gets the local time from the hardware on the Vxworks system * on the mcp750s * on the other os/hardware setup, it will get the time the normal way */ - -extern void CFE_PSP_Restart(uint32 resetType); +extern void CFE_PSP_Restart(uint32 resetType); /* ** CFE_PSP_Restart is the entry point back to the BSP to restart the processor. ** The flight software calls this routine to restart the processor. */ - -extern uint32 CFE_PSP_GetRestartType(uint32 *restartSubType ); +extern uint32 CFE_PSP_GetRestartType(uint32 *restartSubType); /* ** CFE_PSP_GetRestartType returns the last reset type and if a pointer to a valid ** memory space is passed in, it returns the reset sub-type in that memory. @@ -198,25 +204,23 @@ extern uint32 CFE_PSP_GetRestartType(uint32 *restartSubType ); ** are defined in the cfe_es.h file. */ - -extern void CFE_PSP_FlushCaches(uint32 type, void* address, uint32 size); +extern void CFE_PSP_FlushCaches(uint32 type, void *address, uint32 size); /* ** This is a BSP specific cache flush routine */ -extern uint32 CFE_PSP_GetProcessorId ( void ); +extern uint32 CFE_PSP_GetProcessorId(void); /* ** CFE_PSP_GetProcessorId returns the CPU ID as defined by the specific board ** and BSP. */ - -extern uint32 CFE_PSP_GetSpacecraftId ( void ); +extern uint32 CFE_PSP_GetSpacecraftId(void); /* ** CFE_PSP_GetSpacecraftId retuns the Spacecraft ID (if any ) */ -extern const char * CFE_PSP_GetProcessorName(void); +extern const char *CFE_PSP_GetProcessorName(void); /* ** CFE_PSP_GetProcessorName returns the processor name */ @@ -269,20 +273,20 @@ extern int32 CFE_PSP_ReadFromCDS(void *PtrToDataToRead, uint32 CDSOffset, uint32 ** CFE_PSP_ReadFromCDS reads from the CDS Block */ -extern int32 CFE_PSP_GetResetArea (cpuaddr *PtrToResetArea, uint32 *SizeOfResetArea); +extern int32 CFE_PSP_GetResetArea(cpuaddr *PtrToResetArea, uint32 *SizeOfResetArea); /* ** CFE_PSP_GetResetArea returns the location and size of the ES Reset information area. ** This area is preserved during a processor reset and is used to store the ** ER Log, System Log and reset related variables */ -extern int32 CFE_PSP_GetUserReservedArea(cpuaddr *PtrToUserArea, uint32 *SizeOfUserArea ); +extern int32 CFE_PSP_GetUserReservedArea(cpuaddr *PtrToUserArea, uint32 *SizeOfUserArea); /* ** CFE_PSP_GetUserReservedArea returns the location and size of the memory used for the cFE ** User reserved area. */ -extern int32 CFE_PSP_GetVolatileDiskMem(cpuaddr *PtrToVolDisk, uint32 *SizeOfVolDisk ); +extern int32 CFE_PSP_GetVolatileDiskMem(cpuaddr *PtrToVolDisk, uint32 *SizeOfVolDisk); /* ** CFE_PSP_GetVolatileDiskMem returns the location and size of the memory used for the cFE ** volatile disk. @@ -315,13 +319,13 @@ extern void CFE_PSP_WatchdogDisable(void); extern void CFE_PSP_WatchdogService(void); /* -** CFE_PSP_WatchdogService services the watchdog timer according to the +** CFE_PSP_WatchdogService services the watchdog timer according to the ** value set in WatchDogSet. */ extern uint32 CFE_PSP_WatchdogGet(void); /* -** CFE_PSP_WatchdogGet gets the watchdog time in milliseconds +** CFE_PSP_WatchdogGet gets the watchdog time in milliseconds */ extern void CFE_PSP_WatchdogSet(uint32 WatchdogValue); @@ -335,26 +339,25 @@ extern void CFE_PSP_Panic(int32 ErrorCode); ** cFE startup. This should not be called by applications. */ -extern int32 CFE_PSP_InitSSR(uint32 bus, uint32 device, char *DeviceName ); +extern int32 CFE_PSP_InitSSR(uint32 bus, uint32 device, char *DeviceName); /* ** CFE_PSP_InitSSR will initialize the Solid state recorder memory for a particular platform */ -extern int32 CFE_PSP_Decompress( char * srcFileName, char * dstFileName ); +extern int32 CFE_PSP_Decompress(char *srcFileName, char *dstFileName); /* ** CFE_PSP_Decompress will uncompress the source file to the file specified in the ** destination file name. The Decompress uses the "gzip" algorithm. Files can ** be compressed using the "gzip" program available on almost all host platforms. */ -extern void CFE_PSP_AttachExceptions(void); +extern void CFE_PSP_AttachExceptions(void); /* ** CFE_PSP_AttachExceptions will setup the exception environment for the chosen platform ** On a board, this can be configured to look at a debug flag or switch in order to ** keep the standard OS exeption handlers, rather than restarting the system */ - extern void CFE_PSP_SetDefaultExceptionEnvironment(void); /* ** @@ -364,48 +367,47 @@ extern void CFE_PSP_SetDefaultExceptionEnvironment(void); ** called for each task that that wants to do floating point and catch exceptions */ - extern uint32 CFE_PSP_Exception_GetCount(void); -extern int32 CFE_PSP_Exception_GetSummary(uint32 *ContextLogId, osal_id_t *TaskId, char *ReasonBuf, uint32 ReasonSize); -extern int32 CFE_PSP_Exception_CopyContext(uint32 ContextLogId, void *ContextBuf, uint32 ContextSize); +extern int32 CFE_PSP_Exception_GetSummary(uint32 *ContextLogId, osal_id_t *TaskId, char *ReasonBuf, uint32 ReasonSize); +extern int32 CFE_PSP_Exception_CopyContext(uint32 ContextLogId, void *ContextBuf, uint32 ContextSize); /* ** I/O Port API */ -int32 CFE_PSP_PortRead8 (cpuaddr PortAddress, uint8 *ByteValue); -int32 CFE_PSP_PortWrite8 (cpuaddr PortAddress, uint8 ByteValue); -int32 CFE_PSP_PortRead16 (cpuaddr PortAddress, uint16 *uint16Value); -int32 CFE_PSP_PortWrite16 (cpuaddr PortAddress, uint16 uint16Value); -int32 CFE_PSP_PortRead32 (cpuaddr PortAddress, uint32 *uint32Value); -int32 CFE_PSP_PortWrite32 (cpuaddr PortAddress, uint32 uint32Value); +int32 CFE_PSP_PortRead8(cpuaddr PortAddress, uint8 *ByteValue); +int32 CFE_PSP_PortWrite8(cpuaddr PortAddress, uint8 ByteValue); +int32 CFE_PSP_PortRead16(cpuaddr PortAddress, uint16 *uint16Value); +int32 CFE_PSP_PortWrite16(cpuaddr PortAddress, uint16 uint16Value); +int32 CFE_PSP_PortRead32(cpuaddr PortAddress, uint32 *uint32Value); +int32 CFE_PSP_PortWrite32(cpuaddr PortAddress, uint32 uint32Value); /* ** Memory API */ -int32 CFE_PSP_MemRead8 (cpuaddr MemoryAddress, uint8 *ByteValue); -int32 CFE_PSP_MemWrite8 (cpuaddr MemoryAddress, uint8 ByteValue); -int32 CFE_PSP_MemRead16 (cpuaddr MemoryAddress, uint16 *uint16Value); -int32 CFE_PSP_MemWrite16 (cpuaddr MemoryAddress, uint16 uint16Value); -int32 CFE_PSP_MemRead32 (cpuaddr MemoryAddress, uint32 *uint32Value); -int32 CFE_PSP_MemWrite32 (cpuaddr MemoryAddress, uint32 uint32Value); +int32 CFE_PSP_MemRead8(cpuaddr MemoryAddress, uint8 *ByteValue); +int32 CFE_PSP_MemWrite8(cpuaddr MemoryAddress, uint8 ByteValue); +int32 CFE_PSP_MemRead16(cpuaddr MemoryAddress, uint16 *uint16Value); +int32 CFE_PSP_MemWrite16(cpuaddr MemoryAddress, uint16 uint16Value); +int32 CFE_PSP_MemRead32(cpuaddr MemoryAddress, uint32 *uint32Value); +int32 CFE_PSP_MemWrite32(cpuaddr MemoryAddress, uint32 uint32Value); -int32 CFE_PSP_MemCpy (void *dest, const void *src, uint32 n); -int32 CFE_PSP_MemSet (void *dest, uint8 value, uint32 n); +int32 CFE_PSP_MemCpy(void *dest, const void *src, uint32 n); +int32 CFE_PSP_MemSet(void *dest, uint8 value, uint32 n); -int32 CFE_PSP_MemValidateRange (cpuaddr Address, uint32 Size, uint32 MemoryType); -uint32 CFE_PSP_MemRanges (void); -int32 CFE_PSP_MemRangeSet (uint32 RangeNum, uint32 MemoryType, cpuaddr StartAddr, - uint32 Size, uint32 WordSize, uint32 Attributes); -int32 CFE_PSP_MemRangeGet (uint32 RangeNum, uint32 *MemoryType, cpuaddr *StartAddr, - uint32 *Size, uint32 *WordSize, uint32 *Attributes); +int32 CFE_PSP_MemValidateRange(cpuaddr Address, uint32 Size, uint32 MemoryType); +uint32 CFE_PSP_MemRanges(void); +int32 CFE_PSP_MemRangeSet(uint32 RangeNum, uint32 MemoryType, cpuaddr StartAddr, uint32 Size, uint32 WordSize, + uint32 Attributes); +int32 CFE_PSP_MemRangeGet(uint32 RangeNum, uint32 *MemoryType, cpuaddr *StartAddr, uint32 *Size, uint32 *WordSize, + uint32 *Attributes); -int32 CFE_PSP_EepromWrite8 (cpuaddr MemoryAddress, uint8 ByteValue); -int32 CFE_PSP_EepromWrite16 (cpuaddr MemoryAddress, uint16 uint16Value); -int32 CFE_PSP_EepromWrite32 (cpuaddr MemoryAddress, uint32 uint32Value); +int32 CFE_PSP_EepromWrite8(cpuaddr MemoryAddress, uint8 ByteValue); +int32 CFE_PSP_EepromWrite16(cpuaddr MemoryAddress, uint16 uint16Value); +int32 CFE_PSP_EepromWrite32(cpuaddr MemoryAddress, uint32 uint32Value); -int32 CFE_PSP_EepromWriteEnable (uint32 Bank); +int32 CFE_PSP_EepromWriteEnable(uint32 Bank); int32 CFE_PSP_EepromWriteDisable(uint32 Bank); -int32 CFE_PSP_EepromPowerUp (uint32 Bank); -int32 CFE_PSP_EepromPowerDown (uint32 Bank); +int32 CFE_PSP_EepromPowerUp(uint32 Bank); +int32 CFE_PSP_EepromPowerDown(uint32 Bank); -#endif /* _cfe_psp_ */ +#endif /* _cfe_psp_ */ diff --git a/fsw/inc/cfe_psp_configdata.h b/fsw/inc/cfe_psp_configdata.h index 05b6424b..8c77b1b2 100644 --- a/fsw/inc/cfe_psp_configdata.h +++ b/fsw/inc/cfe_psp_configdata.h @@ -39,15 +39,13 @@ */ typedef const struct { - uint8 MajorVersion; - uint8 MinorVersion; - uint8 Revision; - uint8 MissionRev; - char Version[16]; + uint8 MajorVersion; + uint8 MinorVersion; + uint8 Revision; + uint8 MissionRev; + char Version[16]; } CFE_PSP_VersionInfo_t; - - /** * PSP/Hardware configuration parameters * This structure should be instantiated by the PSP according @@ -56,18 +54,18 @@ typedef const struct */ typedef const struct { - uint32 PSP_WatchdogMin; /**< PSP Minimum watchdog in milliseconds */ - uint32 PSP_WatchdogMax; /**< PSP Maximum watchdog in milliseconds */ - uint32 PSP_MemTableSize; /**< Size of PSP memory table */ - uint32 PSP_ExceptionLogSize; /**< Size of PSP exception log */ - CFE_PSP_MemTable_t *PSP_MemoryTable; /**< Pointer to PSP memory table (forward reference) */ + uint32 PSP_WatchdogMin; /**< PSP Minimum watchdog in milliseconds */ + uint32 PSP_WatchdogMax; /**< PSP Maximum watchdog in milliseconds */ + uint32 PSP_MemTableSize; /**< Size of PSP memory table */ + uint32 PSP_ExceptionLogSize; /**< Size of PSP exception log */ + CFE_PSP_MemTable_t *PSP_MemoryTable; /**< Pointer to PSP memory table (forward reference) */ - /** - * Number of EEPROM banks on this platform - */ - uint32 HW_NumEepromBanks; + /** + * Number of EEPROM banks on this platform + */ + uint32 HW_NumEepromBanks; - CFE_PSP_VersionInfo_t PSP_VersionInfo; + CFE_PSP_VersionInfo_t PSP_VersionInfo; } Target_PspConfigData; @@ -83,5 +81,4 @@ extern Target_PspConfigData GLOBAL_PSP_CONFIGDATA; */ extern CFE_PSP_MemTable_t CFE_PSP_MemoryTable[]; - #endif /* CFE_PSP_CONFIG_H_ */ diff --git a/fsw/mcp750-vxworks/inc/cfe_psp_config.h b/fsw/mcp750-vxworks/inc/cfe_psp_config.h index 337b497b..fc88a42f 100644 --- a/fsw/mcp750-vxworks/inc/cfe_psp_config.h +++ b/fsw/mcp750-vxworks/inc/cfe_psp_config.h @@ -26,7 +26,6 @@ #ifndef _cfe_psp_config_ #define _cfe_psp_config_ - #include "common_types.h" #include @@ -50,7 +49,7 @@ * * It must always be a power of two. */ -#define CFE_PSP_MAX_EXCEPTION_ENTRIES 4 +#define CFE_PSP_MAX_EXCEPTION_ENTRIES 4 /* ** Typedef for the layout of the vxWorks boot record structure @@ -60,14 +59,13 @@ */ typedef struct { - uint32 bsp_reset_type; - uint32 spare1; - uint32 spare2; - uint32 spare3; + uint32 bsp_reset_type; + uint32 spare1; + uint32 spare2; + uint32 spare3; } CFE_PSP_ReservedMemoryBootRecord_t; - /** * \brief The data type used by the underlying OS to represent a thread ID. */ @@ -78,11 +76,11 @@ typedef TASK_ID CFE_PSP_Exception_SysTaskId_t; */ typedef struct { - UINT32 timebase_upper; /* Upper 32 bits of timebase as sampled by hook */ - UINT32 timebase_lower; /* Lower 32 bits of timebase as sampled by hook */ - int vector; /* vector number */ - ESFPPC esf; /* Exception stack frame */ - FP_CONTEXT fp; /* floating point registers */ + UINT32 timebase_upper; /* Upper 32 bits of timebase as sampled by hook */ + UINT32 timebase_lower; /* Lower 32 bits of timebase as sampled by hook */ + int vector; /* vector number */ + ESFPPC esf; /* Exception stack frame */ + FP_CONTEXT fp; /* floating point registers */ } CFE_PSP_Exception_ContextDataEntry_t; @@ -90,7 +88,7 @@ typedef struct ** Watchdog minimum and maximum values ( in milliseconds ) */ #define CFE_PSP_WATCHDOG_MIN (0) -#define CFE_PSP_WATCHDOG_MAX (0xFFFFFFFF) +#define CFE_PSP_WATCHDOG_MAX (0xFFFFFFFF) /* ** Number of EEPROM banks on this platform @@ -105,8 +103,6 @@ typedef struct * Chosen as the cache line size of the MPC750 processor (32 bytes) * such that the blocks will be cached more efficiently. */ -#define CFE_PSP_MEMALIGN_MASK ((cpuaddr)0x1F) - +#define CFE_PSP_MEMALIGN_MASK ((cpuaddr)0x1F) #endif - diff --git a/fsw/mcp750-vxworks/inc/psp_version.h b/fsw/mcp750-vxworks/inc/psp_version.h index 34ca70a6..4d57d844 100644 --- a/fsw/mcp750-vxworks/inc/psp_version.h +++ b/fsw/mcp750-vxworks/inc/psp_version.h @@ -19,17 +19,17 @@ */ /*! @file mcp750-vxworks/inc/psp_version.h - * @brief Purpose: - * @details Provide version identifiers for the cFE Platform Support Packages (PSP). + * @brief Purpose: + * @details Provide version identifiers for the cFE Platform Support Packages (PSP). * See @ref cfsversions for version and build number and description */ #ifndef _psp_version_ #define _psp_version_ /* - * Development Build Macro Definitions + * Development Build Macro Definitions */ -#define CFE_PSP_IMPL_BUILD_NUMBER 58 +#define CFE_PSP_IMPL_BUILD_NUMBER 58 #define CFE_PSP_IMPL_BUILD_BASELINE "v1.5.0-rc1" /* @@ -38,26 +38,29 @@ #define CFE_PSP_IMPL_MAJOR_VERSION 1 /*!< @brief ONLY APPLY for OFFICIAL releases. Major version number. */ #define CFE_PSP_IMPL_MINOR_VERSION 4 /*!< @brief ONLY APPLY for OFFICIAL releases. Minor version number. */ #define CFE_PSP_IMPL_REVISION 0 /*!< @brief ONLY APPLY for OFFICIAL releases. Revision number. */ -#define CFE_PSP_IMPL_MISSION_REV 99 /*!< @brief ONLY APPLY for OFFICIAL releases. Revision version number. A value of "99" indicates an unreleased development version. */ +#define CFE_PSP_IMPL_MISSION_REV \ + 99 /*!< @brief ONLY APPLY for OFFICIAL releases. Revision version number. A value of "99" indicates an unreleased \ + development version. */ /* * Tools to construct version string - */ -#define CFE_PSP_IMPL_STR_HELPER(x) #x /*!< @brief Helper function to concatenate strings from integer */ -#define CFE_PSP_IMPL_STR(x) CFE_PSP_IMPL_STR_HELPER(x) /*!< @brief Helper function to concatenate strings from integer */ + */ +#define CFE_PSP_IMPL_STR_HELPER(x) #x /*!< @brief Helper function to concatenate strings from integer */ +#define CFE_PSP_IMPL_STR(x) \ + CFE_PSP_IMPL_STR_HELPER(x) /*!< @brief Helper function to concatenate strings from integer */ -/*! @brief Development Build Version Number. +/*! @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_PSP_IMPL_VERSION CFE_PSP_IMPL_BUILD_BASELINE CFE_PSP_IMPL_STR(CFE_PSP_IMPL_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. - */ -#define CFE_PSP_IMPL_VERSION_STRING \ - " PSP Development Build " CFE_PSP_IMPL_VERSION /* Codename for current development */ \ - ", Last Official Release: psp v1.4.0" /* For full support please use this version */ + * @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. + */ +#define CFE_PSP_IMPL_VERSION_STRING \ + " PSP Development Build " CFE_PSP_IMPL_VERSION /* Codename for current development */ \ + ", Last Official Release: psp v1.4.0" /* For full support please use this version */ -#endif /* _psp_version_ */ +#endif /* _psp_version_ */ diff --git a/fsw/mcp750-vxworks/src/bsp-integration/cfeSupport.c b/fsw/mcp750-vxworks/src/bsp-integration/cfeSupport.c index 54f90a15..b25534b7 100644 --- a/fsw/mcp750-vxworks/src/bsp-integration/cfeSupport.c +++ b/fsw/mcp750-vxworks/src/bsp-integration/cfeSupport.c @@ -22,7 +22,7 @@ ** cFE Support routines ** ** This module is a collection of support routines needed to run the cFE on vxWorks. -** +** */ #include @@ -42,8 +42,8 @@ /* ** External reference to wrs_kernel_text_start and wrs_kernel_text_end -** The cFE core needs these symbols, but when the cfe-core.o is loaded as a -** dynamic module, these symbols are not in the symbol table. +** The cFE core needs these symbols, but when the cfe-core.o is loaded as a +** dynamic module, these symbols are not in the symbol table. */ extern unsigned int wrs_kernel_text_start; @@ -64,9 +64,9 @@ extern int DriveNum; ** Purpose: This function returns the start address of the kernel code. ** */ -unsigned int GetWrsKernelTextStart (void) +unsigned int GetWrsKernelTextStart(void) { - return (unsigned int) &wrs_kernel_text_start; + return (unsigned int)&wrs_kernel_text_start; } /* @@ -74,101 +74,99 @@ unsigned int GetWrsKernelTextStart (void) ** Purpose: This function returns the end address of the kernel code. ** */ -unsigned int GetWrsKernelTextEnd (void) +unsigned int GetWrsKernelTextEnd(void) { - return (unsigned int) &wrs_kernel_text_end; + return (unsigned int)&wrs_kernel_text_end; } - /* ** Function: loadCfeCore ** Purpose: This function unzips ( if needed ) , loads, and starts the cFE core. ** */ -int startCfeCore ( char *cfevolume, char *cfepath ) +int startCfeCore(char *cfevolume, char *cfepath) { - int fd; - int status; - MODULE_ID moduleID; - SYM_TYPE symType; - char *symValue; - void (*cFEFuncPtr)(void); - char cfeCorePath[64]; + int fd; + int status; + MODULE_ID moduleID; + SYM_TYPE symType; + char * symValue; + void (*cFEFuncPtr)(void); + char cfeCorePath[64]; + + if (cfevolume == NULL || cfepath == NULL) + { + printf("Error: No cFE volume or path/filename given.\n"); + return (-1); + } - if ( cfevolume == NULL || cfepath == NULL ) - { - printf("Error: No cFE volume or path/filename given.\n"); - return(-1); - } + /* + ** Recreate cFE core path name + ** This is a kludge to account for the vxWorks XBD volume name + ** ( CF:0, CF:1, etc ) + ** This assumes that the CFE_PSP_InitFlashDisk function has been called. + */ + snprintf(cfeCorePath, 64, "%s:%d%s", cfevolume, DriveNum, cfepath); - /* - ** Recreate cFE core path name - ** This is a kludge to account for the vxWorks XBD volume name - ** ( CF:0, CF:1, etc ) - ** This assumes that the CFE_PSP_InitFlashDisk function has been called. - */ - snprintf(cfeCorePath,64,"%s:%d%s",cfevolume,DriveNum,cfepath); + /* + ** Open the cFE core module + */ + fd = open(cfeCorePath, O_RDONLY, 0); + if (fd < 0) + { + printf("Error: Cannot open cFE core file: %s!\n", cfeCorePath); + return (-1); + } + else + { + printf("Opened %s.\n", cfepath); + } - /* - ** Open the cFE core module - */ - fd = open( cfeCorePath, O_RDONLY, 0); - if ( fd < 0 ) - { - printf("Error: Cannot open cFE core file: %s!\n",cfeCorePath); - return(-1); - } - else - { - printf("Opened %s.\n",cfepath); - } - - /* - ** Load the cFE core - */ - moduleID = loadModule ( fd, LOAD_ALL_SYMBOLS ); - if ( moduleID == NULL ) - { - printf("Error: Cannot load cFE core module.\n"); - close(fd); - return(-1); - } - else - { - printf("Loaded %s module OK.\n",cfepath); - } - - /* - ** Close the file - */ - close(fd); - - /* - ** Lookup the cFE core entry point - */ - status = symFindByName(sysSymTbl, "CFE_PSP_Main", &symValue, &symType); - if ( status == ERROR ) - { - printf("Cannot locate CFE_PSP_Main symbol, trying OS_BSPMain\n"); - status = symFindByName(sysSymTbl, "OS_BSPMain", &symValue, &symType); - if ( status == ERROR ) - { - printf("Error: Cannot locate CFE_PSP_Main or OS_BSPMain symbols.\n"); - return(-1); - } - } + /* + ** Load the cFE core + */ + moduleID = loadModule(fd, LOAD_ALL_SYMBOLS); + if (moduleID == NULL) + { + printf("Error: Cannot load cFE core module.\n"); + close(fd); + return (-1); + } + else + { + printf("Loaded %s module OK.\n", cfepath); + } + + /* + ** Close the file + */ + close(fd); + + /* + ** Lookup the cFE core entry point + */ + status = symFindByName(sysSymTbl, "CFE_PSP_Main", &symValue, &symType); + if (status == ERROR) + { + printf("Cannot locate CFE_PSP_Main symbol, trying OS_BSPMain\n"); + status = symFindByName(sysSymTbl, "OS_BSPMain", &symValue, &symType); + if (status == ERROR) + { + printf("Error: Cannot locate CFE_PSP_Main or OS_BSPMain symbols.\n"); + return (-1); + } + } - /* - ** Call the cFE startup routine - */ + /* + ** Call the cFE startup routine + */ cFEFuncPtr = (void *)symValue; (*cFEFuncPtr)(); - - /* - ** Return to the vxWorks shell - */ - return(0); - + + /* + ** Return to the vxWorks shell + */ + return (0); } /****************************************************************************** @@ -181,77 +179,76 @@ int startCfeCore ( char *cfevolume, char *cfepath ) ** (none) ** ** Return: -** Returns -1 for error, or Compact flash device number on success ( 0 or 1 ) +** Returns -1 for error, or Compact flash device number on success ( 0 or 1 ) */ -int CFE_PSP_InitFlashDisk( void) +int CFE_PSP_InitFlashDisk(void) { - BLK_DEV *ataBlkDev; - int Status = 0; - device_t xbd; - int i; - int cfNameFound; - int tempFd; - char CompactFlashName[32]; + BLK_DEV *ataBlkDev; + int Status = 0; + device_t xbd; + int i; + int cfNameFound; + int tempFd; + char CompactFlashName[32]; printf("CFE_PSP: Re-mounting the ATA/FLASH DISK\n"); - + /* ** Create the Flash disk device */ - if( (ataBlkDev = ataDevCreate( 0, 0, 0, 0)) == NULL) + if ((ataBlkDev = ataDevCreate(0, 0, 0, 0)) == NULL) { - printf("CFE_PSP: Error Creating flash disk device.\n"); - Status = -1; + printf("CFE_PSP: Error Creating flash disk device.\n"); + Status = -1; } else { - /* - ** Attach to the XBD layer - */ - xbd = xbdBlkDevCreate(ataBlkDev,"CF"); - if (xbd == NULLDEV) - { - printf("CFE_PSP: Error Creating XBD device on ATA/FLASH disk.\n"); - Status = -1; - } - else - { - /* - ** Delay to allow the XBD operation to complete - */ - (void) taskDelay(100); - - /* - ** Determine the name of the Compact flash drive - */ - cfNameFound = 0; - for ( i = 0; i < 4; i++ ) - { - snprintf(CompactFlashName, 32, "%s:%d","CF", i); - tempFd = open ( CompactFlashName, O_RDONLY, 0644 ); - if ( tempFd != ERROR ) - { - close(tempFd); - cfNameFound = 1; - break; - } - } - if ( cfNameFound == 1 ) - { - printf("CFE_PSP: FLASH device initialized. vxWorks name = %s\n",CompactFlashName); - Status = i; - } - else - { - printf("CFE_PSP: Warning: Compact flash name not found! Run devs command in shell\n"); - Status = -1; - } + /* + ** Attach to the XBD layer + */ + xbd = xbdBlkDevCreate(ataBlkDev, "CF"); + if (xbd == NULLDEV) + { + printf("CFE_PSP: Error Creating XBD device on ATA/FLASH disk.\n"); + Status = -1; + } + else + { + /* + ** Delay to allow the XBD operation to complete + */ + (void)taskDelay(100); + + /* + ** Determine the name of the Compact flash drive + */ + cfNameFound = 0; + for (i = 0; i < 4; i++) + { + snprintf(CompactFlashName, 32, "%s:%d", "CF", i); + tempFd = open(CompactFlashName, O_RDONLY, 0644); + if (tempFd != ERROR) + { + close(tempFd); + cfNameFound = 1; + break; + } + } + if (cfNameFound == 1) + { + printf("CFE_PSP: FLASH device initialized. vxWorks name = %s\n", CompactFlashName); + Status = i; + } + else + { + printf("CFE_PSP: Warning: Compact flash name not found! Run devs command in shell\n"); + Status = -1; + } + + } /* end if */ - } /* end if */ - } /* end if */ - - return(Status); -} + return (Status); +} diff --git a/fsw/mcp750-vxworks/src/cfe_psp_exception.c b/fsw/mcp750-vxworks/src/cfe_psp_exception.c index 33fa1b50..5caa972e 100644 --- a/fsw/mcp750-vxworks/src/cfe_psp_exception.c +++ b/fsw/mcp750-vxworks/src/cfe_psp_exception.c @@ -66,8 +66,7 @@ ** */ -void CFE_PSP_ExceptionHook ( TASK_ID task_id, int vector, void* vpEsf ); - +void CFE_PSP_ExceptionHook(TASK_ID task_id, int vector, void *vpEsf); /*************************************************************************** ** FUNCTIONS DEFINITIONS @@ -88,12 +87,12 @@ void CFE_PSP_ExceptionHook ( TASK_ID task_id, int vector, void* vpEsf ); void CFE_PSP_AttachExceptions(void) { - excHookAdd( CFE_PSP_ExceptionHook ); - OS_printf("CFE_PSP: Attached cFE Exception Handler. Context Size = %lu bytes.\n",(unsigned long)sizeof(CFE_PSP_Exception_ContextDataEntry_t)); + excHookAdd(CFE_PSP_ExceptionHook); + OS_printf("CFE_PSP: Attached cFE Exception Handler. Context Size = %lu bytes.\n", + (unsigned long)sizeof(CFE_PSP_Exception_ContextDataEntry_t)); CFE_PSP_Exception_Reset(); } - /* ** Name: CFE_PSP_ExceptionHook ** @@ -113,9 +112,9 @@ void CFE_PSP_AttachExceptions(void) ** then it will be valid. ** */ -void CFE_PSP_ExceptionHook (TASK_ID task_id, int vector, void* vpEsf ) +void CFE_PSP_ExceptionHook(TASK_ID task_id, int vector, void *vpEsf) { - CFE_PSP_Exception_LogData_t* Buffer; + CFE_PSP_Exception_LogData_t *Buffer; Buffer = CFE_PSP_Exception_GetNextContextBuffer(); if (Buffer != NULL) @@ -129,7 +128,7 @@ void CFE_PSP_ExceptionHook (TASK_ID task_id, int vector, void* vpEsf ) */ vxTimeBaseGet(&Buffer->context_info.timebase_upper, &Buffer->context_info.timebase_lower); - Buffer->sys_task_id = task_id; + Buffer->sys_task_id = task_id; Buffer->context_info.vector = vector; /* @@ -157,10 +156,8 @@ void CFE_PSP_ExceptionHook (TASK_ID task_id, int vector, void* vpEsf ) GLOBAL_CFE_CONFIGDATA.SystemNotify(); } - } /* end function */ - /* ** ** Name: CFE_PSP_SetDefaultExceptionEnvironment @@ -172,23 +169,20 @@ void CFE_PSP_ExceptionHook (TASK_ID task_id, int vector, void* vpEsf ) */ void CFE_PSP_SetDefaultExceptionEnvironment(void) { - vxMsrSet( vxMsrGet() | - _PPC_MSR_EE | /* enable the external interrupt */ - _PPC_MSR_FP | /* enable floating point */ - _PPC_MSR_ME | /* major hardware failures */ - _PPC_MSR_FE0 | /* floating point exception 0 */ - _PPC_MSR_FE1 | /* generate unrecoverable floating point exceptions */ - _PPC_MSR_DR ); /* enable data address translation (dbats?) */ - - vxFpscrSet( vxFpscrGet() | - _PPC_FPSCR_VE | /* enable exceptions for invalid operations */ - _PPC_FPSCR_OE | /* enable overflow exceptions */ - _PPC_FPSCR_NI | /* Non-IEEE mode for denormailized numbers */ - _PPC_FPSCR_ZE ); /* enable divide by zero exceptions */ - - vxFpscrSet( vxFpscrGet() | - _PPC_FPSCR_XE | /* fp inexact exc enable */ - _PPC_FPSCR_UE ); /* fp underflow enable */ + vxMsrSet(vxMsrGet() | _PPC_MSR_EE | /* enable the external interrupt */ + _PPC_MSR_FP | /* enable floating point */ + _PPC_MSR_ME | /* major hardware failures */ + _PPC_MSR_FE0 | /* floating point exception 0 */ + _PPC_MSR_FE1 | /* generate unrecoverable floating point exceptions */ + _PPC_MSR_DR); /* enable data address translation (dbats?) */ + + vxFpscrSet(vxFpscrGet() | _PPC_FPSCR_VE | /* enable exceptions for invalid operations */ + _PPC_FPSCR_OE | /* enable overflow exceptions */ + _PPC_FPSCR_NI | /* Non-IEEE mode for denormailized numbers */ + _PPC_FPSCR_ZE); /* enable divide by zero exceptions */ + + vxFpscrSet(vxFpscrGet() | _PPC_FPSCR_XE | /* fp inexact exc enable */ + _PPC_FPSCR_UE); /* fp underflow enable */ } /* @@ -196,7 +190,7 @@ void CFE_PSP_SetDefaultExceptionEnvironment(void) * * Purpose: Translate a stored exception log entry into a summary string */ -int32 CFE_PSP_ExceptionGetSummary_Impl(const CFE_PSP_Exception_LogData_t* Buffer, char *ReasonBuf, uint32 ReasonSize) +int32 CFE_PSP_ExceptionGetSummary_Impl(const CFE_PSP_Exception_LogData_t *Buffer, char *ReasonBuf, uint32 ReasonSize) { const char *TaskName; @@ -205,15 +199,13 @@ int32 CFE_PSP_ExceptionGetSummary_Impl(const CFE_PSP_Exception_LogData_t* Buffer */ TaskName = taskName(Buffer->sys_task_id); - if ( TaskName == NULL ) + if (TaskName == NULL) { TaskName = "NULL"; } - snprintf(ReasonBuf, ReasonSize, "Vector=0x%06X, vxWorks Task Name=%s, Task ID=0x%08X", - Buffer->context_info.vector,TaskName,Buffer->sys_task_id); + snprintf(ReasonBuf, ReasonSize, "Vector=0x%06X, vxWorks Task Name=%s, Task ID=0x%08X", Buffer->context_info.vector, + TaskName, Buffer->sys_task_id); return CFE_PSP_SUCCESS; } - - diff --git a/fsw/mcp750-vxworks/src/cfe_psp_memory.c b/fsw/mcp750-vxworks/src/cfe_psp_memory.c index 6a4478d0..34bcd9fa 100644 --- a/fsw/mcp750-vxworks/src/cfe_psp_memory.c +++ b/fsw/mcp750-vxworks/src/cfe_psp_memory.c @@ -24,7 +24,7 @@ ** MCP750 vxWorks 6.x Version ** ** Purpose: -** cFE PSP Memory related functions. This is the implementation of the cFE +** cFE PSP Memory related functions. This is the implementation of the cFE ** memory areas that have to be preserved, and the API that is designed to allow ** acccess to them. It also contains memory related routines to return the ** address of the kernel code used in the cFE checksum. @@ -45,7 +45,7 @@ #include /* -** cFE includes +** cFE includes */ #include "common_types.h" #include "osapi.h" @@ -53,8 +53,8 @@ /* ** Types and prototypes for this module */ -#include "cfe_psp.h" -#include "cfe_psp_memory.h" +#include "cfe_psp.h" +#include "cfe_psp_memory.h" #include @@ -62,7 +62,7 @@ ** External Declarations */ extern unsigned int GetWrsKernelTextStart(void); -extern unsigned int GetWrsKernelTextEnd (void); +extern unsigned int GetWrsKernelTextEnd(void); /* ** Global variables @@ -74,10 +74,8 @@ extern unsigned int GetWrsKernelTextEnd (void); */ CFE_PSP_ReservedMemoryMap_t CFE_PSP_ReservedMemoryMap; - CFE_PSP_MemoryBlock_t MCP750_ReservedMemBlock; - /* ********************************************************************************* ** CDS related functions @@ -87,7 +85,7 @@ CFE_PSP_MemoryBlock_t MCP750_ReservedMemBlock; /****************************************************************************** ** Function: CFE_PSP_GetCDSSize ** -** Purpose: +** Purpose: ** This function fetches the size of the OS Critical Data Store area. ** ** Arguments: @@ -99,18 +97,18 @@ CFE_PSP_MemoryBlock_t MCP750_ReservedMemBlock; int32 CFE_PSP_GetCDSSize(uint32 *SizeOfCDS) { - int32 return_code; - - if ( SizeOfCDS == NULL ) - { - return_code = CFE_PSP_ERROR; - } - else - { - *SizeOfCDS = CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize; - return_code = CFE_PSP_SUCCESS; - } - return(return_code); + int32 return_code; + + if (SizeOfCDS == NULL) + { + return_code = CFE_PSP_ERROR; + } + else + { + *SizeOfCDS = CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize; + return_code = CFE_PSP_SUCCESS; + } + return (return_code); } /****************************************************************************** @@ -127,34 +125,33 @@ int32 CFE_PSP_GetCDSSize(uint32 *SizeOfCDS) */ int32 CFE_PSP_WriteToCDS(const void *PtrToDataToWrite, uint32 CDSOffset, uint32 NumBytes) { - uint8 *CopyPtr; - int32 return_code; - - if ( PtrToDataToWrite == NULL ) - { - return_code = CFE_PSP_ERROR; - } - else - { - if ( (CDSOffset < CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize ) && - ( (CDSOffset + NumBytes) <= CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize )) - { - CopyPtr = CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr; - CopyPtr += CDSOffset; - memcpy(CopyPtr, (char *)PtrToDataToWrite,NumBytes); - - return_code = CFE_PSP_SUCCESS; - } - else - { - return_code = CFE_PSP_ERROR; - } - - } /* end if PtrToDataToWrite == NULL */ - - return(return_code); -} + uint8 *CopyPtr; + int32 return_code; + + if (PtrToDataToWrite == NULL) + { + return_code = CFE_PSP_ERROR; + } + else + { + if ((CDSOffset < CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize) && + ((CDSOffset + NumBytes) <= CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize)) + { + CopyPtr = CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr; + CopyPtr += CDSOffset; + memcpy(CopyPtr, (char *)PtrToDataToWrite, NumBytes); + + return_code = CFE_PSP_SUCCESS; + } + else + { + return_code = CFE_PSP_ERROR; + } + + } /* end if PtrToDataToWrite == NULL */ + return (return_code); +} /****************************************************************************** ** Function: CFE_PSP_ReadFromCDS @@ -171,33 +168,32 @@ int32 CFE_PSP_WriteToCDS(const void *PtrToDataToWrite, uint32 CDSOffset, uint32 int32 CFE_PSP_ReadFromCDS(void *PtrToDataToRead, uint32 CDSOffset, uint32 NumBytes) { - uint8 *CopyPtr; - int32 return_code; - - if ( PtrToDataToRead == NULL ) - { - return_code = CFE_PSP_ERROR; - } - else - { - if ( (CDSOffset < CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize ) && - ( (CDSOffset + NumBytes) <= CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize )) - { - CopyPtr = CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr; - CopyPtr += CDSOffset; - memcpy((char *)PtrToDataToRead,CopyPtr, NumBytes); - - return_code = CFE_PSP_SUCCESS; - } - else - { - return_code = CFE_PSP_ERROR; - } - - } /* end if PtrToDataToWrite == NULL */ - - return(return_code); - + uint8 *CopyPtr; + int32 return_code; + + if (PtrToDataToRead == NULL) + { + return_code = CFE_PSP_ERROR; + } + else + { + if ((CDSOffset < CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize) && + ((CDSOffset + NumBytes) <= CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize)) + { + CopyPtr = CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr; + CopyPtr += CDSOffset; + memcpy((char *)PtrToDataToRead, CopyPtr, NumBytes); + + return_code = CFE_PSP_SUCCESS; + } + else + { + return_code = CFE_PSP_ERROR; + } + + } /* end if PtrToDataToWrite == NULL */ + + return (return_code); } /* @@ -210,8 +206,8 @@ int32 CFE_PSP_ReadFromCDS(void *PtrToDataToRead, uint32 CDSOffset, uint32 NumByt ** Function: CFE_PSP_GetResetArea ** ** Purpose: -** This function returns the location and size of the ES Reset information area. -** This area is preserved during a processor reset and is used to store the +** This function returns the location and size of the ES Reset information area. +** This area is preserved during a processor reset and is used to store the ** ER Log, System Log and reset related variables ** ** Arguments: @@ -220,22 +216,22 @@ int32 CFE_PSP_ReadFromCDS(void *PtrToDataToRead, uint32 CDSOffset, uint32 NumByt ** Return: ** (none) */ -int32 CFE_PSP_GetResetArea (cpuaddr *PtrToResetArea, uint32 *SizeOfResetArea) +int32 CFE_PSP_GetResetArea(cpuaddr *PtrToResetArea, uint32 *SizeOfResetArea) { - int32 return_code; - - if ((PtrToResetArea == NULL) || (SizeOfResetArea == NULL)) - { - return_code = CFE_PSP_ERROR; - } - else - { - *PtrToResetArea = (cpuaddr)(CFE_PSP_ReservedMemoryMap.ResetMemory.BlockPtr); - *SizeOfResetArea = CFE_PSP_ReservedMemoryMap.ResetMemory.BlockSize; - return_code = CFE_PSP_SUCCESS; - } - - return(return_code); + int32 return_code; + + if ((PtrToResetArea == NULL) || (SizeOfResetArea == NULL)) + { + return_code = CFE_PSP_ERROR; + } + else + { + *PtrToResetArea = (cpuaddr)(CFE_PSP_ReservedMemoryMap.ResetMemory.BlockPtr); + *SizeOfResetArea = CFE_PSP_ReservedMemoryMap.ResetMemory.BlockSize; + return_code = CFE_PSP_SUCCESS; + } + + return (return_code); } /* @@ -257,22 +253,22 @@ int32 CFE_PSP_GetResetArea (cpuaddr *PtrToResetArea, uint32 *SizeOfResetArea) ** Return: ** (none) */ -int32 CFE_PSP_GetUserReservedArea(cpuaddr *PtrToUserArea, uint32 *SizeOfUserArea ) +int32 CFE_PSP_GetUserReservedArea(cpuaddr *PtrToUserArea, uint32 *SizeOfUserArea) { - int32 return_code; - - if ((PtrToUserArea == NULL) || (SizeOfUserArea == NULL)) - { - return_code = CFE_PSP_ERROR; - } - else - { - *PtrToUserArea = (cpuaddr)(CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockPtr); - *SizeOfUserArea = CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockSize; - return_code = CFE_PSP_SUCCESS; - } - - return(return_code); + int32 return_code; + + if ((PtrToUserArea == NULL) || (SizeOfUserArea == NULL)) + { + return_code = CFE_PSP_ERROR; + } + else + { + *PtrToUserArea = (cpuaddr)(CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockPtr); + *SizeOfUserArea = CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockSize; + return_code = CFE_PSP_SUCCESS; + } + + return (return_code); } /* @@ -294,24 +290,22 @@ int32 CFE_PSP_GetUserReservedArea(cpuaddr *PtrToUserArea, uint32 *SizeOfUserArea ** Return: ** (none) */ -int32 CFE_PSP_GetVolatileDiskMem(cpuaddr *PtrToVolDisk, uint32 *SizeOfVolDisk ) +int32 CFE_PSP_GetVolatileDiskMem(cpuaddr *PtrToVolDisk, uint32 *SizeOfVolDisk) { - int32 return_code; - - if ((PtrToVolDisk == NULL) || (SizeOfVolDisk == NULL)) - { - return_code = CFE_PSP_ERROR; - } - else - { - *PtrToVolDisk = (cpuaddr)(CFE_PSP_ReservedMemoryMap.VolatileDiskMemory.BlockPtr); - *SizeOfVolDisk = CFE_PSP_ReservedMemoryMap.VolatileDiskMemory.BlockSize; - return_code = CFE_PSP_SUCCESS; - - } - - return(return_code); - + int32 return_code; + + if ((PtrToVolDisk == NULL) || (SizeOfVolDisk == NULL)) + { + return_code = CFE_PSP_ERROR; + } + else + { + *PtrToVolDisk = (cpuaddr)(CFE_PSP_ReservedMemoryMap.VolatileDiskMemory.BlockPtr); + *SizeOfVolDisk = CFE_PSP_ReservedMemoryMap.VolatileDiskMemory.BlockSize; + return_code = CFE_PSP_SUCCESS; + } + + return (return_code); } /* @@ -332,24 +326,22 @@ int32 CFE_PSP_GetVolatileDiskMem(cpuaddr *PtrToVolDisk, uint32 *SizeOfVolDisk ) ** Return: ** (none) */ -int32 CFE_PSP_InitProcessorReservedMemory( uint32 RestartType ) +int32 CFE_PSP_InitProcessorReservedMemory(uint32 RestartType) { - int32 return_code; - - if ( RestartType != CFE_PSP_RST_TYPE_PROCESSOR ) - { - OS_printf("CFE_PSP: Clearing Processor Reserved Memory.\n"); - memset(MCP750_ReservedMemBlock.BlockPtr, 0, MCP750_ReservedMemBlock.BlockSize); - - /* - ** Set the default reset type in case a watchdog reset occurs - */ - CFE_PSP_ReservedMemoryMap.BootPtr->bsp_reset_type = CFE_PSP_RST_TYPE_PROCESSOR; - - } - return_code = CFE_PSP_SUCCESS; - return(return_code); - + int32 return_code; + + if (RestartType != CFE_PSP_RST_TYPE_PROCESSOR) + { + OS_printf("CFE_PSP: Clearing Processor Reserved Memory.\n"); + memset(MCP750_ReservedMemBlock.BlockPtr, 0, MCP750_ReservedMemBlock.BlockSize); + + /* + ** Set the default reset type in case a watchdog reset occurs + */ + CFE_PSP_ReservedMemoryMap.BootPtr->bsp_reset_type = CFE_PSP_RST_TYPE_PROCESSOR; + } + return_code = CFE_PSP_SUCCESS; + return (return_code); } /****************************************************************************** @@ -376,8 +368,8 @@ void CFE_PSP_SetupReservedMemoryMap(void) ** should be aligned to hold any data type, being the very start ** of the memory space. */ - start_addr = (cpuaddr) sysMemTop(); - end_addr = start_addr; + start_addr = (cpuaddr)sysMemTop(); + end_addr = start_addr; memset(&CFE_PSP_ReservedMemoryMap, 0, sizeof(CFE_PSP_ReservedMemoryMap)); @@ -389,35 +381,33 @@ void CFE_PSP_SetupReservedMemoryMap(void) end_addr += sizeof(CFE_PSP_ExceptionStorage_t); end_addr = (end_addr + CFE_PSP_MEMALIGN_MASK) & ~CFE_PSP_MEMALIGN_MASK; - CFE_PSP_ReservedMemoryMap.ResetMemory.BlockPtr = (void*)end_addr; + CFE_PSP_ReservedMemoryMap.ResetMemory.BlockPtr = (void *)end_addr; CFE_PSP_ReservedMemoryMap.ResetMemory.BlockSize = GLOBAL_CONFIGDATA.CfeConfig->ResetAreaSize; end_addr += CFE_PSP_ReservedMemoryMap.ResetMemory.BlockSize; end_addr = (end_addr + CFE_PSP_MEMALIGN_MASK) & ~CFE_PSP_MEMALIGN_MASK; - CFE_PSP_ReservedMemoryMap.VolatileDiskMemory.BlockPtr = (void*)end_addr; + CFE_PSP_ReservedMemoryMap.VolatileDiskMemory.BlockPtr = (void *)end_addr; CFE_PSP_ReservedMemoryMap.VolatileDiskMemory.BlockSize = GLOBAL_CONFIGDATA.CfeConfig->RamDiskSectorSize * GLOBAL_CONFIGDATA.CfeConfig->RamDiskTotalSectors; end_addr += CFE_PSP_ReservedMemoryMap.VolatileDiskMemory.BlockSize; end_addr = (end_addr + CFE_PSP_MEMALIGN_MASK) & ~CFE_PSP_MEMALIGN_MASK; - CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr = (void*)end_addr; + CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr = (void *)end_addr; CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize = GLOBAL_CONFIGDATA.CfeConfig->CdsSize; end_addr += CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize; end_addr = (end_addr + CFE_PSP_MEMALIGN_MASK) & ~CFE_PSP_MEMALIGN_MASK; - CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockPtr = (void*)end_addr; + CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockPtr = (void *)end_addr; CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockSize = GLOBAL_CONFIGDATA.CfeConfig->UserReservedSize; end_addr += CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockSize; end_addr = (end_addr + CFE_PSP_MEMALIGN_MASK) & ~CFE_PSP_MEMALIGN_MASK; /* The total size of the entire block is the difference in address */ - MCP750_ReservedMemBlock.BlockPtr = (void*)start_addr; - MCP750_ReservedMemBlock.BlockSize = end_addr - start_addr; - + MCP750_ReservedMemBlock.BlockPtr = (void *)start_addr; + MCP750_ReservedMemBlock.BlockSize = end_addr - start_addr; OS_printf("CFE_PSP: MCP750 Reserved Memory Block at 0x%08lx, Total Size = 0x%lx\n", - (unsigned long)MCP750_ReservedMemBlock.BlockPtr, - (unsigned long)MCP750_ReservedMemBlock.BlockSize); + (unsigned long)MCP750_ReservedMemBlock.BlockPtr, (unsigned long)MCP750_ReservedMemBlock.BlockSize); } /****************************************************************************** @@ -426,9 +416,7 @@ void CFE_PSP_SetupReservedMemoryMap(void) * No action on MCP750 - reserved block is statically allocated at sysMemTop. * Implemented for API consistency with other PSPs. */ -void CFE_PSP_DeleteProcessorReservedMemory(void) -{ -} +void CFE_PSP_DeleteProcessorReservedMemory(void) {} /* ********************************************************************************* @@ -451,31 +439,31 @@ void CFE_PSP_DeleteProcessorReservedMemory(void) */ int32 CFE_PSP_GetKernelTextSegmentInfo(cpuaddr *PtrToKernelSegment, uint32 *SizeOfKernelSegment) { - int32 return_code; - cpuaddr StartAddress; - cpuaddr EndAddress; - - if ( SizeOfKernelSegment == NULL ) - { - return_code = CFE_PSP_ERROR; - } - else - { - /* - ** Get the kernel start and end - ** addresses from the BSP, because the - ** symbol table does not contain the symbls we need for this - */ - StartAddress = (cpuaddr) GetWrsKernelTextStart(); - EndAddress = (cpuaddr) GetWrsKernelTextEnd(); - - *PtrToKernelSegment = StartAddress; - *SizeOfKernelSegment = (uint32) (EndAddress - StartAddress); - - return_code = CFE_PSP_SUCCESS; - } - - return(return_code); + int32 return_code; + cpuaddr StartAddress; + cpuaddr EndAddress; + + if (SizeOfKernelSegment == NULL) + { + return_code = CFE_PSP_ERROR; + } + else + { + /* + ** Get the kernel start and end + ** addresses from the BSP, because the + ** symbol table does not contain the symbls we need for this + */ + StartAddress = (cpuaddr)GetWrsKernelTextStart(); + EndAddress = (cpuaddr)GetWrsKernelTextEnd(); + + *PtrToKernelSegment = StartAddress; + *SizeOfKernelSegment = (uint32)(EndAddress - StartAddress); + + return_code = CFE_PSP_SUCCESS; + } + + return (return_code); } /****************************************************************************** @@ -493,72 +481,69 @@ int32 CFE_PSP_GetKernelTextSegmentInfo(cpuaddr *PtrToKernelSegment, uint32 *Size */ int32 CFE_PSP_GetCFETextSegmentInfo(cpuaddr *PtrToCFESegment, uint32 *SizeOfCFESegment) { - int32 return_code; - STATUS status; - MODULE_ID cFEModuleId; - MODULE_INFO cFEModuleInfo; - cpuaddr GetModuleIdAddr; - MODULE_ID (*GetModuldIdFunc)(void); - - - - if ( PtrToCFESegment == NULL || SizeOfCFESegment == NULL ) - { - return_code = CFE_PSP_ERROR; - } - else - { - /* - * First attempt to call a function called GetCfeCoreModuleID(). - * - * If CFE core was started via the "startCfeCore" routine, this - * provides the actual module ID that was loaded by that routine, - * no matter what it is actually named. This is provided by the - * support/integration code compiled directly into the VxWorks kernel - * image. - * - * The prototype should be: - * MODULE_ID GetCfeCoreModuleID(void); - */ - cFEModuleId = NULL; - GetModuleIdAddr = 0; - return_code = OS_SymbolLookup(&GetModuleIdAddr, "GetCfeCoreModuleID"); - if ( return_code == OS_SUCCESS && GetModuleIdAddr != 0 ) - { - GetModuldIdFunc = (MODULE_ID (*)(void))GetModuleIdAddr; - cFEModuleId = GetModuldIdFunc(); - } - - /* - * If the above did not yield a valid module ID, - * then attempt to find the module ID by name. - * This assumes the core executable name as built by CMake - */ - if ( cFEModuleId == NULL ) - { - cFEModuleId = moduleFindByName((char *)GLOBAL_CONFIGDATA.Default_CoreFilename); - } - - if ( cFEModuleId == NULL ) - { - return_code = CFE_PSP_ERROR; - } - else - { - status = moduleInfoGet(cFEModuleId, &cFEModuleInfo); - if ( status != ERROR ) - { - *PtrToCFESegment = (cpuaddr) (cFEModuleInfo.segInfo.textAddr); - *SizeOfCFESegment = (uint32) (cFEModuleInfo.segInfo.textSize); - return_code = CFE_PSP_SUCCESS; - } - else - { - return_code = CFE_PSP_SUCCESS; - } - } - } - - return(return_code); + int32 return_code; + STATUS status; + MODULE_ID cFEModuleId; + MODULE_INFO cFEModuleInfo; + cpuaddr GetModuleIdAddr; + MODULE_ID (*GetModuldIdFunc)(void); + + if (PtrToCFESegment == NULL || SizeOfCFESegment == NULL) + { + return_code = CFE_PSP_ERROR; + } + else + { + /* + * First attempt to call a function called GetCfeCoreModuleID(). + * + * If CFE core was started via the "startCfeCore" routine, this + * provides the actual module ID that was loaded by that routine, + * no matter what it is actually named. This is provided by the + * support/integration code compiled directly into the VxWorks kernel + * image. + * + * The prototype should be: + * MODULE_ID GetCfeCoreModuleID(void); + */ + cFEModuleId = NULL; + GetModuleIdAddr = 0; + return_code = OS_SymbolLookup(&GetModuleIdAddr, "GetCfeCoreModuleID"); + if (return_code == OS_SUCCESS && GetModuleIdAddr != 0) + { + GetModuldIdFunc = (MODULE_ID(*)(void))GetModuleIdAddr; + cFEModuleId = GetModuldIdFunc(); + } + + /* + * If the above did not yield a valid module ID, + * then attempt to find the module ID by name. + * This assumes the core executable name as built by CMake + */ + if (cFEModuleId == NULL) + { + cFEModuleId = moduleFindByName((char *)GLOBAL_CONFIGDATA.Default_CoreFilename); + } + + if (cFEModuleId == NULL) + { + return_code = CFE_PSP_ERROR; + } + else + { + status = moduleInfoGet(cFEModuleId, &cFEModuleInfo); + if (status != ERROR) + { + *PtrToCFESegment = (cpuaddr)(cFEModuleInfo.segInfo.textAddr); + *SizeOfCFESegment = (uint32)(cFEModuleInfo.segInfo.textSize); + return_code = CFE_PSP_SUCCESS; + } + else + { + return_code = CFE_PSP_SUCCESS; + } + } + } + + return (return_code); } - diff --git a/fsw/mcp750-vxworks/src/cfe_psp_memtab.c b/fsw/mcp750-vxworks/src/cfe_psp_memtab.c index 2abd3227..ca04fab2 100644 --- a/fsw/mcp750-vxworks/src/cfe_psp_memtab.c +++ b/fsw/mcp750-vxworks/src/cfe_psp_memtab.c @@ -21,7 +21,7 @@ /* ** File : cfe_psp_memtab.c ** -** Author : Alan Cudmore +** Author : Alan Cudmore ** ** Purpose: ** @@ -40,16 +40,15 @@ ** Valid memory map for this target. ** If you need to add more entries, increase CFE_PSP_MEM_TABLE_SIZE in the osconfig.h file. */ -CFE_PSP_MemTable_t CFE_PSP_MemoryTable[CFE_PSP_MEM_TABLE_SIZE] = -{ - { CFE_PSP_MEM_RAM, CFE_PSP_MEM_SIZE_DWORD, 0, 0x8000000, CFE_PSP_MEM_ATTR_READWRITE }, - { CFE_PSP_MEM_INVALID, 0, 0, 0, CFE_PSP_MEM_ATTR_READWRITE }, - { CFE_PSP_MEM_INVALID, 0, 0, 0, CFE_PSP_MEM_ATTR_READWRITE }, - { CFE_PSP_MEM_INVALID, 0, 0, 0, CFE_PSP_MEM_ATTR_READWRITE }, - { CFE_PSP_MEM_INVALID, 0, 0, 0, CFE_PSP_MEM_ATTR_READWRITE }, - { CFE_PSP_MEM_INVALID, 0, 0, 0, CFE_PSP_MEM_ATTR_READWRITE }, - { CFE_PSP_MEM_INVALID, 0, 0, 0, CFE_PSP_MEM_ATTR_READWRITE }, - { CFE_PSP_MEM_INVALID, 0, 0, 0, CFE_PSP_MEM_ATTR_READWRITE }, - { CFE_PSP_MEM_INVALID, 0, 0, 0, CFE_PSP_MEM_ATTR_READWRITE }, - { CFE_PSP_MEM_INVALID, 0, 0, 0, CFE_PSP_MEM_ATTR_READWRITE }, +CFE_PSP_MemTable_t CFE_PSP_MemoryTable[CFE_PSP_MEM_TABLE_SIZE] = { + {CFE_PSP_MEM_RAM, CFE_PSP_MEM_SIZE_DWORD, 0, 0x8000000, CFE_PSP_MEM_ATTR_READWRITE}, + {CFE_PSP_MEM_INVALID, 0, 0, 0, CFE_PSP_MEM_ATTR_READWRITE}, + {CFE_PSP_MEM_INVALID, 0, 0, 0, CFE_PSP_MEM_ATTR_READWRITE}, + {CFE_PSP_MEM_INVALID, 0, 0, 0, CFE_PSP_MEM_ATTR_READWRITE}, + {CFE_PSP_MEM_INVALID, 0, 0, 0, CFE_PSP_MEM_ATTR_READWRITE}, + {CFE_PSP_MEM_INVALID, 0, 0, 0, CFE_PSP_MEM_ATTR_READWRITE}, + {CFE_PSP_MEM_INVALID, 0, 0, 0, CFE_PSP_MEM_ATTR_READWRITE}, + {CFE_PSP_MEM_INVALID, 0, 0, 0, CFE_PSP_MEM_ATTR_READWRITE}, + {CFE_PSP_MEM_INVALID, 0, 0, 0, CFE_PSP_MEM_ATTR_READWRITE}, + {CFE_PSP_MEM_INVALID, 0, 0, 0, CFE_PSP_MEM_ATTR_READWRITE}, }; diff --git a/fsw/mcp750-vxworks/src/cfe_psp_ssr.c b/fsw/mcp750-vxworks/src/cfe_psp_ssr.c index e067a979..e5139310 100644 --- a/fsw/mcp750-vxworks/src/cfe_psp_ssr.c +++ b/fsw/mcp750-vxworks/src/cfe_psp_ssr.c @@ -31,7 +31,6 @@ ** ******************************************************************************/ - /* ** Include Files */ @@ -51,7 +50,6 @@ #include "xbdBlkDev.h" #include "xbdRamDisk.h" - /* ** cFE includes */ @@ -64,7 +62,6 @@ #include "cfe_psp.h" #include "cfe_psp_memory.h" - /****************************************************************************** ** Function: CFE_PSP_InitSSR ** @@ -80,23 +77,21 @@ ** (none) */ -int32 CFE_PSP_InitSSR(uint32 bus, uint32 device, char *DeviceName ) +int32 CFE_PSP_InitSSR(uint32 bus, uint32 device, char *DeviceName) { - int32 ReturnCode; - device_t xbd; - - xbd = ataXbdDevCreate(bus, device, 0, 0, DeviceName); - - if (xbd == NULLDEV) - { - ReturnCode = CFE_PSP_ERROR; - } - else - { - ReturnCode = CFE_PSP_SUCCESS; - } + int32 ReturnCode; + device_t xbd; - return(ReturnCode); - -} + xbd = ataXbdDevCreate(bus, device, 0, 0, DeviceName); + + if (xbd == NULLDEV) + { + ReturnCode = CFE_PSP_ERROR; + } + else + { + ReturnCode = CFE_PSP_SUCCESS; + } + return (ReturnCode); +} diff --git a/fsw/mcp750-vxworks/src/cfe_psp_start.c b/fsw/mcp750-vxworks/src/cfe_psp_start.c index 97125c25..ebf0798d 100644 --- a/fsw/mcp750-vxworks/src/cfe_psp_start.c +++ b/fsw/mcp750-vxworks/src/cfe_psp_start.c @@ -52,19 +52,18 @@ #include "mcpx750.h" /* -** cFE includes +** cFE includes */ #include "common_types.h" #include "osapi.h" -#include "cfe_psp.h" -#include "cfe_psp_memory.h" +#include "cfe_psp.h" +#include "cfe_psp_memory.h" /* ** External Declarations */ -IMPORT void sysPciWrite32 (UINT32, UINT32); - +IMPORT void sysPciWrite32(UINT32, UINT32); /* * The preferred way to obtain the CFE tunable values at runtime is via @@ -73,11 +72,9 @@ IMPORT void sysPciWrite32 (UINT32, UINT32); */ #include -#define CFE_PSP_MAIN_FUNCTION (*GLOBAL_CONFIGDATA.CfeConfig->SystemMain) -#define CFE_PSP_NONVOL_STARTUP_FILE (GLOBAL_CONFIGDATA.CfeConfig->NonvolStartupFile) -#define CFE_PSP_1HZ_FUNCTION (*GLOBAL_CONFIGDATA.CfeConfig->System1HzISR) - - +#define CFE_PSP_MAIN_FUNCTION (*GLOBAL_CONFIGDATA.CfeConfig->SystemMain) +#define CFE_PSP_NONVOL_STARTUP_FILE (GLOBAL_CONFIGDATA.CfeConfig->NonvolStartupFile) +#define CFE_PSP_1HZ_FUNCTION (*GLOBAL_CONFIGDATA.CfeConfig->System1HzISR) /****************************************************************************** ** Function: OS_Application_Startup() @@ -93,150 +90,147 @@ IMPORT void sysPciWrite32 (UINT32, UINT32); */ void OS_Application_Startup(void) { - int TicksPerSecond; - uint32 reset_type; - uint32 reset_subtype; - osal_id_t fs_id; - char reset_register; - int32 Status; - + int TicksPerSecond; + uint32 reset_type; + uint32 reset_subtype; + osal_id_t fs_id; + char reset_register; + int32 Status; - /* - ** Initialize the OS API - */ - Status = OS_API_Init(); - if (Status != OS_SUCCESS) - { - /* irrecoverable error if OS_API_Init() fails. */ - /* note: use printf here, as OS_printf may not work */ - printf("CFE_PSP: OS_API_Init() failure\n"); - CFE_PSP_Panic(Status); + /* + ** Initialize the OS API + */ + Status = OS_API_Init(); + if (Status != OS_SUCCESS) + { + /* irrecoverable error if OS_API_Init() fails. */ + /* note: use printf here, as OS_printf may not work */ + printf("CFE_PSP: OS_API_Init() failure\n"); + CFE_PSP_Panic(Status); - /* - * normally CFE_PSP_Panic() does not return, except - * during unit testing. This return avoids executing - * the rest of this function in that case. - */ - return; - } + /* + * normally CFE_PSP_Panic() does not return, except + * during unit testing. This return avoids executing + * the rest of this function in that case. + */ + return; + } - /* - ** Set up the virtual FS mapping for the "/cf" directory - ** On this platform it is will use the CF:0 physical device. - */ - Status = OS_FileSysAddFixedMap(&fs_id, "CF:0", "/cf"); - if (Status != OS_SUCCESS) - { - /* Print for informational purposes -- - * startup can continue, but loads may fail later, depending on config. */ - OS_printf("CFE_PSP: OS_FileSysAddFixedMap() failure: %d\n", (int)Status); - } + /* + ** Set up the virtual FS mapping for the "/cf" directory + ** On this platform it is will use the CF:0 physical device. + */ + Status = OS_FileSysAddFixedMap(&fs_id, "CF:0", "/cf"); + if (Status != OS_SUCCESS) + { + /* Print for informational purposes -- + * startup can continue, but loads may fail later, depending on config. */ + OS_printf("CFE_PSP: OS_FileSysAddFixedMap() failure: %d\n", (int)Status); + } - /* - ** Delay for one second. - */ - TicksPerSecond = sysClkRateGet(); - (void) taskDelay( TicksPerSecond ); + /* + ** Delay for one second. + */ + TicksPerSecond = sysClkRateGet(); + (void)taskDelay(TicksPerSecond); - /* - ** This starts up the hardware timer on the board that - ** will be used to get the local time - */ - sysPciWrite32(0xFC0011D0, 0x0D6937E5); + /* + ** This starts up the hardware timer on the board that + ** will be used to get the local time + */ + sysPciWrite32(0xFC0011D0, 0x0D6937E5); - /* - ** Setup the pointer to the reserved area in vxWorks. - ** This must be done before any of the reset variables are used. - */ - CFE_PSP_SetupReservedMemoryMap(); + /* + ** Setup the pointer to the reserved area in vxWorks. + ** This must be done before any of the reset variables are used. + */ + CFE_PSP_SetupReservedMemoryMap(); - /* - ** Determine Reset type by reading the hardware reset register. - */ - reset_register = *(SYS_REG_BLRR); - OS_printf("CFE_PSP: Reset Register = %02X\n",reset_register); - - if ( reset_register & SYS_REG_BLRR_PWRON ) - { - OS_printf("CFE_PSP: POWERON Reset: Power Switch ON.\n"); - reset_type = CFE_PSP_RST_TYPE_POWERON; - reset_subtype = CFE_PSP_RST_SUBTYPE_POWER_CYCLE; - } - else if ( reset_register & SYS_REG_BLRR_PBRST ) - { - OS_printf("CFE_PSP: POWERON Reset: CPCI Push Button Reset.\n"); - reset_type = CFE_PSP_RST_TYPE_POWERON; - reset_subtype = CFE_PSP_RST_SUBTYPE_PUSH_BUTTON; - } - else if ( reset_register & SYS_REG_BLRR_FBTN ) - { - OS_printf("CFE_PSP: POWERON Reset: Front Panel Push Button Reset.\n"); - reset_type = CFE_PSP_RST_SUBTYPE_PUSH_BUTTON; - reset_subtype = 3; - } - else if ( reset_register & SYS_REG_BLRR_WDT2 ) - { - OS_printf("CFE_PSP: PROCESSOR Reset: Watchdog level 2 Reset.\n"); - reset_type = CFE_PSP_RST_TYPE_PROCESSOR; - reset_subtype = CFE_PSP_RST_SUBTYPE_HW_WATCHDOG; - } - else if ( reset_register & SYS_REG_BLRR_SWSRST ) - { - OS_printf("CFE_PSP: PROCESSOR Reset: Software Soft Reset.\n"); - reset_type = CFE_PSP_RST_TYPE_PROCESSOR; - reset_subtype = CFE_PSP_RST_SUBTYPE_RESET_COMMAND; - } - else if ( reset_register & SYS_REG_BLRR_SWHRST ) - { - - /* - ** For a Software hard reset, we want to look at the special - ** BSP reset variable to determine if we wanted a - ** Power ON or a Processor reset. Because the vxWorks sysToMonitor and - ** reboot functions use this reset type, we want to use this for a software - ** commanded processor or Power on reset. - */ - if ( CFE_PSP_ReservedMemoryMap.BootPtr->bsp_reset_type == CFE_PSP_RST_TYPE_POWERON) - { - OS_printf("CFE_PSP: POWERON Reset: Software Hard Reset.\n"); - reset_type = CFE_PSP_RST_TYPE_POWERON; - reset_subtype = CFE_PSP_RST_SUBTYPE_RESET_COMMAND; - } - else - { - OS_printf("CFE_PSP: PROCESSOR Reset: Software Hard Reset.\n"); - reset_type = CFE_PSP_RST_TYPE_PROCESSOR; - reset_subtype = CFE_PSP_RST_SUBTYPE_RESET_COMMAND; - } - } - else - { - OS_printf("CFE_PSP: POWERON Reset: UNKNOWN Reset.\n"); - reset_type = CFE_PSP_RST_TYPE_POWERON; - reset_subtype = CFE_PSP_RST_SUBTYPE_UNDEFINED_RESET; - } - - /* - * If CFE fails to boot with a processor reset, - * then make sure next time it uses a power on reset. + /* + ** Determine Reset type by reading the hardware reset register. */ - if ( reset_type == CFE_PSP_RST_TYPE_PROCESSOR ) - { - CFE_PSP_ReservedMemoryMap.BootPtr->bsp_reset_type = CFE_PSP_RST_TYPE_POWERON; - } + reset_register = *(SYS_REG_BLRR); + OS_printf("CFE_PSP: Reset Register = %02X\n", reset_register); - /* - ** Initialize the reserved memory - */ - CFE_PSP_InitProcessorReservedMemory(reset_type); + if (reset_register & SYS_REG_BLRR_PWRON) + { + OS_printf("CFE_PSP: POWERON Reset: Power Switch ON.\n"); + reset_type = CFE_PSP_RST_TYPE_POWERON; + reset_subtype = CFE_PSP_RST_SUBTYPE_POWER_CYCLE; + } + else if (reset_register & SYS_REG_BLRR_PBRST) + { + OS_printf("CFE_PSP: POWERON Reset: CPCI Push Button Reset.\n"); + reset_type = CFE_PSP_RST_TYPE_POWERON; + reset_subtype = CFE_PSP_RST_SUBTYPE_PUSH_BUTTON; + } + else if (reset_register & SYS_REG_BLRR_FBTN) + { + OS_printf("CFE_PSP: POWERON Reset: Front Panel Push Button Reset.\n"); + reset_type = CFE_PSP_RST_SUBTYPE_PUSH_BUTTON; + reset_subtype = 3; + } + else if (reset_register & SYS_REG_BLRR_WDT2) + { + OS_printf("CFE_PSP: PROCESSOR Reset: Watchdog level 2 Reset.\n"); + reset_type = CFE_PSP_RST_TYPE_PROCESSOR; + reset_subtype = CFE_PSP_RST_SUBTYPE_HW_WATCHDOG; + } + else if (reset_register & SYS_REG_BLRR_SWSRST) + { + OS_printf("CFE_PSP: PROCESSOR Reset: Software Soft Reset.\n"); + reset_type = CFE_PSP_RST_TYPE_PROCESSOR; + reset_subtype = CFE_PSP_RST_SUBTYPE_RESET_COMMAND; + } + else if (reset_register & SYS_REG_BLRR_SWHRST) + { + + /* + ** For a Software hard reset, we want to look at the special + ** BSP reset variable to determine if we wanted a + ** Power ON or a Processor reset. Because the vxWorks sysToMonitor and + ** reboot functions use this reset type, we want to use this for a software + ** commanded processor or Power on reset. + */ + if (CFE_PSP_ReservedMemoryMap.BootPtr->bsp_reset_type == CFE_PSP_RST_TYPE_POWERON) + { + OS_printf("CFE_PSP: POWERON Reset: Software Hard Reset.\n"); + reset_type = CFE_PSP_RST_TYPE_POWERON; + reset_subtype = CFE_PSP_RST_SUBTYPE_RESET_COMMAND; + } + else + { + OS_printf("CFE_PSP: PROCESSOR Reset: Software Hard Reset.\n"); + reset_type = CFE_PSP_RST_TYPE_PROCESSOR; + reset_subtype = CFE_PSP_RST_SUBTYPE_RESET_COMMAND; + } + } + else + { + OS_printf("CFE_PSP: POWERON Reset: UNKNOWN Reset.\n"); + reset_type = CFE_PSP_RST_TYPE_POWERON; + reset_subtype = CFE_PSP_RST_SUBTYPE_UNDEFINED_RESET; + } + /* + * If CFE fails to boot with a processor reset, + * then make sure next time it uses a power on reset. + */ + if (reset_type == CFE_PSP_RST_TYPE_PROCESSOR) + { + CFE_PSP_ReservedMemoryMap.BootPtr->bsp_reset_type = CFE_PSP_RST_TYPE_POWERON; + } - /* - ** Call cFE entry point. This will return when cFE startup - ** is complete. - */ - CFE_PSP_MAIN_FUNCTION(reset_type,reset_subtype, 1, CFE_PSP_NONVOL_STARTUP_FILE); + /* + ** Initialize the reserved memory + */ + CFE_PSP_InitProcessorReservedMemory(reset_type); + /* + ** Call cFE entry point. This will return when cFE startup + ** is complete. + */ + CFE_PSP_MAIN_FUNCTION(reset_type, reset_subtype, 1, CFE_PSP_NONVOL_STARTUP_FILE); } /****************************************************************************** @@ -253,16 +247,15 @@ void OS_Application_Startup(void) */ void OS_Application_Run(void) { - int TicksPerSecond; + int TicksPerSecond; - /* - ** Main loop for default task and simulated 1hz - */ - for ( ;; ) - { - TicksPerSecond = sysClkRateGet(); - (void) taskDelay( TicksPerSecond ); - CFE_PSP_1HZ_FUNCTION(); - } + /* + ** Main loop for default task and simulated 1hz + */ + for (;;) + { + TicksPerSecond = sysClkRateGet(); + (void)taskDelay(TicksPerSecond); + CFE_PSP_1HZ_FUNCTION(); + } } - diff --git a/fsw/mcp750-vxworks/src/cfe_psp_support.c b/fsw/mcp750-vxworks/src/cfe_psp_support.c index 61b3623b..765c61cf 100644 --- a/fsw/mcp750-vxworks/src/cfe_psp_support.c +++ b/fsw/mcp750-vxworks/src/cfe_psp_support.c @@ -31,7 +31,6 @@ ** ******************************************************************************/ - /* ** Include Files */ @@ -50,7 +49,6 @@ #include "cacheLib.h" #include "rebootLib.h" - /* ** cFE includes */ @@ -65,9 +63,9 @@ #include -#define CFE_PSP_CPU_ID (GLOBAL_CONFIGDATA.Default_CpuId) -#define CFE_PSP_CPU_NAME (GLOBAL_CONFIGDATA.Default_CpuName) -#define CFE_PSP_SPACECRAFT_ID (GLOBAL_CONFIGDATA.Default_SpacecraftId) +#define CFE_PSP_CPU_ID (GLOBAL_CONFIGDATA.Default_CpuId) +#define CFE_PSP_CPU_NAME (GLOBAL_CONFIGDATA.Default_CpuName) +#define CFE_PSP_SPACECRAFT_ID (GLOBAL_CONFIGDATA.Default_SpacecraftId) /* * Track the overall "reserved memory block" at the start of RAM. @@ -75,7 +73,6 @@ */ extern CFE_PSP_MemoryBlock_t MCP750_ReservedMemBlock; - /****************************************************************************** ** Function: CFE_PSP_Restart() ** @@ -92,19 +89,18 @@ extern CFE_PSP_MemoryBlock_t MCP750_ReservedMemBlock; void CFE_PSP_Restart(uint32 reset_type) { - if ( reset_type == CFE_PSP_RST_TYPE_POWERON ) - { - CFE_PSP_ReservedMemoryMap.BootPtr->bsp_reset_type = CFE_PSP_RST_TYPE_POWERON; - CFE_PSP_FlushCaches(1, MCP750_ReservedMemBlock.BlockPtr, MCP750_ReservedMemBlock.BlockSize); - reboot(BOOT_CLEAR); - } - else - { - CFE_PSP_ReservedMemoryMap.BootPtr->bsp_reset_type = CFE_PSP_RST_TYPE_PROCESSOR; - CFE_PSP_FlushCaches(1, MCP750_ReservedMemBlock.BlockPtr, MCP750_ReservedMemBlock.BlockSize); - reboot(BOOT_NORMAL); - } - + if (reset_type == CFE_PSP_RST_TYPE_POWERON) + { + CFE_PSP_ReservedMemoryMap.BootPtr->bsp_reset_type = CFE_PSP_RST_TYPE_POWERON; + CFE_PSP_FlushCaches(1, MCP750_ReservedMemBlock.BlockPtr, MCP750_ReservedMemBlock.BlockSize); + reboot(BOOT_CLEAR); + } + else + { + CFE_PSP_ReservedMemoryMap.BootPtr->bsp_reset_type = CFE_PSP_RST_TYPE_PROCESSOR; + CFE_PSP_FlushCaches(1, MCP750_ReservedMemBlock.BlockPtr, MCP750_ReservedMemBlock.BlockSize); + reboot(BOOT_NORMAL); + } } /****************************************************************************** @@ -123,8 +119,8 @@ void CFE_PSP_Restart(uint32 reset_type) void CFE_PSP_Panic(int32 ErrorCode) { - printf("CFE_PSP_Panic Called with error code = 0x%08X. Exiting.\n",(unsigned int )ErrorCode); - exit(-1); /* Need to improve this */ + printf("CFE_PSP_Panic Called with error code = 0x%08X. Exiting.\n", (unsigned int)ErrorCode); + exit(-1); /* Need to improve this */ } /****************************************************************************** @@ -141,13 +137,12 @@ void CFE_PSP_Panic(int32 ErrorCode) ** (none) */ -void CFE_PSP_FlushCaches(uint32 type, void* address, uint32 size) +void CFE_PSP_FlushCaches(uint32 type, void *address, uint32 size) { - if ( type == 1 ) - { - cacheTextUpdate(address, size); - } - + if (type == 1) + { + cacheTextUpdate(address, size); + } } /* @@ -167,12 +162,11 @@ void CFE_PSP_FlushCaches(uint32 type, void* address, uint32 size) ** ** Return Values: Processor ID */ -uint32 CFE_PSP_GetProcessorId (void) +uint32 CFE_PSP_GetProcessorId(void) { return CFE_PSP_CPU_ID; } - /* ** Name: CFE_PSP_GetSpacecraftId ** @@ -188,9 +182,9 @@ uint32 CFE_PSP_GetProcessorId (void) ** ** Return Values: Spacecraft ID */ -uint32 CFE_PSP_GetSpacecraftId (void) +uint32 CFE_PSP_GetSpacecraftId(void) { - return CFE_PSP_SPACECRAFT_ID; + return CFE_PSP_SPACECRAFT_ID; } /* @@ -208,8 +202,7 @@ uint32 CFE_PSP_GetSpacecraftId (void) ** ** Return Values: Processor name */ -const char *CFE_PSP_GetProcessorName (void) +const char *CFE_PSP_GetProcessorName(void) { - return CFE_PSP_CPU_NAME; + return CFE_PSP_CPU_NAME; } - diff --git a/fsw/mcp750-vxworks/src/cfe_psp_timer.c b/fsw/mcp750-vxworks/src/cfe_psp_timer.c index b71a6205..72e7a787 100644 --- a/fsw/mcp750-vxworks/src/cfe_psp_timer.c +++ b/fsw/mcp750-vxworks/src/cfe_psp_timer.c @@ -64,20 +64,27 @@ */ #include "cfe_psp.h" -IMPORT void sysPciRead32 (UINT32, UINT32 *); - +IMPORT void sysPciRead32(UINT32, UINT32 *); /******************* Macro Definitions ***********************/ -#define CFE_PSP_TIMER_TICKS_PER_SECOND 16666666 /* Resolution of the least significant 32 bits of the 64 bit - time stamp returned by CFE_PSP_Get_Timebase in timer ticks per second. - The timer resolution for accuracy should not be any slower than 1000000 - ticks per second or 1 us per tick */ -#define CFE_PSP_TIMER_LOW32_ROLLOVER 0 /* The number that the least significant 32 bits of the 64 bit - time stamp returned by CFE_PSP_Get_Timebase rolls over. If the lower 32 - bits rolls at 1 second, then the CFE_PSP_TIMER_LOW32_ROLLOVER will be 1000000. - if the lower 32 bits rolls at its maximum value (2^32) then - CFE_PSP_TIMER_LOW32_ROLLOVER will be 0. */ +/** + * \brief Resolution of the least significant 32 bits of the 64 bit + * time stamp returned by CFE_PSP_Get_Timebase in timer ticks per second. + * The timer resolution for accuracy should not be any slower than 1000000 + * ticks per second or 1 us per tick + */ +#define CFE_PSP_TIMER_TICKS_PER_SECOND 16666666 + +/** + * \brief The number that the least significant 32 bits of the 64 bit + * time stamp returned by CFE_PSP_Get_Timebase rolls over. If the lower 32 + * bits rolls at 1 second, then the CFE_PSP_TIMER_LOW32_ROLLOVER will be 1000000. + * if the lower 32 bits rolls at its maximum value (2^32) then + * CFE_PSP_TIMER_LOW32_ROLLOVER will be 0. + */ +#define CFE_PSP_TIMER_LOW32_ROLLOVER 0 + /* ** MCP750/vxWorks timers */ @@ -89,7 +96,7 @@ IMPORT void sysPciRead32 (UINT32, UINT32 *); ** Arguments: LocalTime - where the time is returned through ******************************************************************************/ -void CFE_PSP_GetTime( OS_time_t *LocalTime) +void CFE_PSP_GetTime(OS_time_t *LocalTime) { uint32 DecCount; uint32 Seconds; @@ -98,7 +105,7 @@ void CFE_PSP_GetTime( OS_time_t *LocalTime) * into an OS_time_t value */ sysPciRead32(0xFC0011C0, (UINT32 *)(&DecCount)); DecCount = DecCount & 0x7FFFFFFF; - DecCount = ((uint32) 0x0D6937E5) - DecCount; + DecCount = ((uint32)0x0D6937E5) - DecCount; Seconds = DecCount / 8333311; @@ -113,17 +120,17 @@ void CFE_PSP_GetTime( OS_time_t *LocalTime) * - Approximation: ((300 * DecCount) + (DecCount / 1244)) / 2500 * At cost of up to 2us error (at max value): * - Approximation: (DecCount * 3) / 25 - * - * Same basic ratio but adjusted to produce units in nanoseconds + * + * Same basic ratio but adjusted to produce units in nanoseconds * instead of microseconds: * - ((480 * DecCount) + (DecCount / 777)) / 4 */ - + DecCount = ((480 * DecCount) + (DecCount / 777)) / 4; *LocalTime = OS_TimeAssembleFromNanoseconds(Seconds, DecCount); -}/* end CFE_PSP_GetLocalTime */ +} /* end CFE_PSP_GetLocalTime */ /****************************************************************************** ** Function: CFE_PSP_Get_Timer_Tick() @@ -140,7 +147,7 @@ void CFE_PSP_GetTime( OS_time_t *LocalTime) */ uint32 CFE_PSP_Get_Timer_Tick(void) { - return (sysClkRateGet()); + return (sysClkRateGet()); } /****************************************************************************** @@ -160,7 +167,7 @@ uint32 CFE_PSP_Get_Timer_Tick(void) */ uint32 CFE_PSP_GetTimerTicksPerSecond(void) { - return(CFE_PSP_TIMER_TICKS_PER_SECOND); + return (CFE_PSP_TIMER_TICKS_PER_SECOND); } /****************************************************************************** @@ -181,7 +188,7 @@ uint32 CFE_PSP_GetTimerTicksPerSecond(void) */ uint32 CFE_PSP_GetTimerLow32Rollover(void) { - return(CFE_PSP_TIMER_LOW32_ROLLOVER); + return (CFE_PSP_TIMER_LOW32_ROLLOVER); } /****************************************************************************** @@ -197,9 +204,9 @@ uint32 CFE_PSP_GetTimerLow32Rollover(void) ** Return: ** Timebase register value */ -void CFE_PSP_Get_Timebase(uint32 *Tbu, uint32* Tbl) +void CFE_PSP_Get_Timebase(uint32 *Tbu, uint32 *Tbl) { - vxTimeBaseGet((UINT32 *)Tbu, (UINT32 *)Tbl); + vxTimeBaseGet((UINT32 *)Tbu, (UINT32 *)Tbl); } /****************************************************************************** @@ -218,6 +225,5 @@ void CFE_PSP_Get_Timebase(uint32 *Tbu, uint32* Tbl) uint32 CFE_PSP_Get_Dec(void) { - return(vxDecGet()); + return (vxDecGet()); } - diff --git a/fsw/mcp750-vxworks/src/cfe_psp_watchdog.c b/fsw/mcp750-vxworks/src/cfe_psp_watchdog.c index 5081bea3..8a1636a6 100644 --- a/fsw/mcp750-vxworks/src/cfe_psp_watchdog.c +++ b/fsw/mcp750-vxworks/src/cfe_psp_watchdog.c @@ -35,7 +35,6 @@ ** Include Files */ - /* ** cFE includes */ @@ -87,16 +86,14 @@ uint32 CFE_PSP_WatchdogValue = CFE_PSP_WATCHDOG_MAX; void CFE_PSP_WatchdogInit(void) { - /* - ** Just set it to a value right now - ** The pc-linux desktop platform does not actually implement a watchdog - ** timeout ( but could with a signal ) - */ - CFE_PSP_WatchdogValue = CFE_PSP_WATCHDOG_MAX; - + /* + ** Just set it to a value right now + ** The pc-linux desktop platform does not actually implement a watchdog + ** timeout ( but could with a signal ) + */ + CFE_PSP_WatchdogValue = CFE_PSP_WATCHDOG_MAX; } - /****************************************************************************** ** Function: CFE_PSP_WatchdogEnable() ** @@ -109,15 +106,13 @@ void CFE_PSP_WatchdogInit(void) */ void CFE_PSP_WatchdogEnable(void) { - /* Arm the WDT2 control register */ - PCI_OUT_BYTE(0xFEFF0068, 0x55); - - /* The enable/disable bit is bit 15, a setting of 1 enables the timer.*/ - PCI_OUT_LONG(0xFEFF0068,0xFFFFFFAA); + /* Arm the WDT2 control register */ + PCI_OUT_BYTE(0xFEFF0068, 0x55); + /* The enable/disable bit is bit 15, a setting of 1 enables the timer.*/ + PCI_OUT_LONG(0xFEFF0068, 0xFFFFFFAA); } - /****************************************************************************** ** Function: CFE_PSP_WatchdogDisable() ** @@ -130,12 +125,11 @@ void CFE_PSP_WatchdogEnable(void) */ void CFE_PSP_WatchdogDisable(void) { - /* Arm the WDT2 control register */ - PCI_OUT_BYTE(0xFEFF0068, 0x55); - - /* The enable/disable bit is bit 15, a setting of 0 disables the timer.*/ - PCI_OUT_LONG(0xFEFF0068,0xFFFF7FAA); + /* Arm the WDT2 control register */ + PCI_OUT_BYTE(0xFEFF0068, 0x55); + /* The enable/disable bit is bit 15, a setting of 0 disables the timer.*/ + PCI_OUT_LONG(0xFEFF0068, 0xFFFF7FAA); } /****************************************************************************** @@ -158,63 +152,61 @@ void CFE_PSP_WatchdogDisable(void) */ void CFE_PSP_WatchdogService(void) { - /* Arm the WDT2 control register */ - PCI_OUT_BYTE(0xFEFF0068, 0x55); - - /* - ** The mcp750 watchdog register is settable to time values between 0 to 1.024 - ** seconds in increments of 16us. The resolution can be set to less than 16us, but - ** the result is a max time of less than 1 second. - ** This setting is always added to the fixed delay of 4.5 seconds internal to the - ** board. So essentially the watchdog timer on this board can be programmed to - ** expire between 4.5 seconds and 5.5 seconds. - ** The actual watchdog timer counter is the upper 16 bits of the data word. - ** The enable/disable bit is bit 15, a setting of 1 enables the timer. - ** The 32 bit word shown below may get byte swapped and/or word swapped before it - ** gets to the actual register on the board. - */ - if( CFE_PSP_WatchdogValue == CFE_PSP_WATCHDOG_MIN) - { - PCI_OUT_LONG(0xFEFF0068,0x0000FFAA); - } - else - { - PCI_OUT_LONG(0xFEFF0068,0xFFFFFFAA); - } - + /* Arm the WDT2 control register */ + PCI_OUT_BYTE(0xFEFF0068, 0x55); + + /* + ** The mcp750 watchdog register is settable to time values between 0 to 1.024 + ** seconds in increments of 16us. The resolution can be set to less than 16us, but + ** the result is a max time of less than 1 second. + ** This setting is always added to the fixed delay of 4.5 seconds internal to the + ** board. So essentially the watchdog timer on this board can be programmed to + ** expire between 4.5 seconds and 5.5 seconds. + ** The actual watchdog timer counter is the upper 16 bits of the data word. + ** The enable/disable bit is bit 15, a setting of 1 enables the timer. + ** The 32 bit word shown below may get byte swapped and/or word swapped before it + ** gets to the actual register on the board. + */ + if (CFE_PSP_WatchdogValue == CFE_PSP_WATCHDOG_MIN) + { + PCI_OUT_LONG(0xFEFF0068, 0x0000FFAA); + } + else + { + PCI_OUT_LONG(0xFEFF0068, 0xFFFFFFAA); + } } /****************************************************************************** ** Function: CFE_PSP_WatchdogGet ** ** Purpose: -** Get the current watchdog value. +** Get the current watchdog value. ** ** Arguments: -** none +** none ** ** Return: -** the current watchdog value +** the current watchdog value ** ** Notes: ** */ uint32 CFE_PSP_WatchdogGet(void) { - return(CFE_PSP_WatchdogValue); + return (CFE_PSP_WatchdogValue); } - /****************************************************************************** ** Function: CFE_PSP_WatchdogSet ** ** Purpose: -** Get the current watchdog value. +** Get the current watchdog value. ** ** Arguments: -** The new watchdog value +** The new watchdog value ** ** Return: -** nothing +** nothing ** ** Notes: ** @@ -223,4 +215,3 @@ void CFE_PSP_WatchdogSet(uint32 WatchdogValue) { CFE_PSP_WatchdogValue = WatchdogValue; } - diff --git a/fsw/modules/eeprom_mmap_file/cfe_psp_eeprom_mmap_file.c b/fsw/modules/eeprom_mmap_file/cfe_psp_eeprom_mmap_file.c index 894ddb97..f4915b66 100644 --- a/fsw/modules/eeprom_mmap_file/cfe_psp_eeprom_mmap_file.c +++ b/fsw/modules/eeprom_mmap_file/cfe_psp_eeprom_mmap_file.c @@ -41,7 +41,6 @@ */ #define EEPROM_FILE "EEPROM.DAT" - CFE_PSP_MODULE_DECLARE_SIMPLE(eeprom_mmap_file); /* @@ -50,130 +49,130 @@ CFE_PSP_MODULE_DECLARE_SIMPLE(eeprom_mmap_file); int32 CFE_PSP_SetupEEPROM(uint32 EEPROMSize, cpuaddr *EEPROMAddress) { - int FileDescriptor; - int ReturnStatus; - char *DataBuffer; - struct stat StatBuf; - - /* - ** Check to see if the file has been created. - ** If not, create it. - ** If so, then open it for read/write - */ - ReturnStatus = stat(EEPROM_FILE, &StatBuf); - if ( ReturnStatus == -1 ) - { - /* - ** File does not exist, create it. - */ - FileDescriptor = open(EEPROM_FILE, O_RDWR | O_CREAT, S_IRWXU); - if ( FileDescriptor == -1 ) - { - OS_printf("CFE_PSP: Cannot open EEPROM File: %s\n",EEPROM_FILE); - return(-1); - } - else - { - /* - ** Need to seek to the desired EEPROM size - */ - if (lseek (FileDescriptor, EEPROMSize - 1, SEEK_SET) == -1) - { - OS_printf("CFE_PSP: Cannot Seek to end of EEPROM file.\n"); - close(FileDescriptor); - return(-1); - } - - /* - ** Write a byte at the end of the File - */ - if (write (FileDescriptor, "", 1) != 1) - { - OS_printf("CFE_PSP: Cannot write to EEPROM file\n"); - close(FileDescriptor); - return(-1); - } - } - } - else - { - /* - ** File exists - */ - FileDescriptor = open(EEPROM_FILE, O_RDWR); - if ( FileDescriptor == -1 ) - { - OS_printf("CFE_PSP: Cannot open EEPROM File: %s\n",EEPROM_FILE); - perror("CFE_PSP: open"); - return(-1); - } - } - - /* - ** Map the file to a memory space - */ - if ((DataBuffer = mmap(NULL, EEPROMSize, PROT_READ | PROT_WRITE, MAP_SHARED, FileDescriptor, 0)) == (void*)(-1)) - { - OS_printf("CFE_PSP: mmap to EEPROM File failed\n"); - close(FileDescriptor); - return(-1); - } - - /* - ** Return the address to the caller - */ - *EEPROMAddress = (cpuaddr)DataBuffer; - - return(0); + int FileDescriptor; + int ReturnStatus; + char * DataBuffer; + struct stat StatBuf; + + /* + ** Check to see if the file has been created. + ** If not, create it. + ** If so, then open it for read/write + */ + ReturnStatus = stat(EEPROM_FILE, &StatBuf); + if (ReturnStatus == -1) + { + /* + ** File does not exist, create it. + */ + FileDescriptor = open(EEPROM_FILE, O_RDWR | O_CREAT, S_IRWXU); + if (FileDescriptor == -1) + { + OS_printf("CFE_PSP: Cannot open EEPROM File: %s\n", EEPROM_FILE); + return (-1); + } + else + { + /* + ** Need to seek to the desired EEPROM size + */ + if (lseek(FileDescriptor, EEPROMSize - 1, SEEK_SET) == -1) + { + OS_printf("CFE_PSP: Cannot Seek to end of EEPROM file.\n"); + close(FileDescriptor); + return (-1); + } + + /* + ** Write a byte at the end of the File + */ + if (write(FileDescriptor, "", 1) != 1) + { + OS_printf("CFE_PSP: Cannot write to EEPROM file\n"); + close(FileDescriptor); + return (-1); + } + } + } + else + { + /* + ** File exists + */ + FileDescriptor = open(EEPROM_FILE, O_RDWR); + if (FileDescriptor == -1) + { + OS_printf("CFE_PSP: Cannot open EEPROM File: %s\n", EEPROM_FILE); + perror("CFE_PSP: open"); + return (-1); + } + } + + /* + ** Map the file to a memory space + */ + if ((DataBuffer = mmap(NULL, EEPROMSize, PROT_READ | PROT_WRITE, MAP_SHARED, FileDescriptor, 0)) == (void *)(-1)) + { + OS_printf("CFE_PSP: mmap to EEPROM File failed\n"); + close(FileDescriptor); + return (-1); + } + + /* + ** Return the address to the caller + */ + *EEPROMAddress = (cpuaddr)DataBuffer; + + return (0); } /* For read/write - As this is mmap'ed we dereference the pointer directly. * Hopefully the caller didn't get it wrong. * No need to anything special for 8/16/32 width access in this mode. */ -int32 CFE_PSP_EepromWrite32( cpuaddr MemoryAddress, uint32 uint32Value ) +int32 CFE_PSP_EepromWrite32(cpuaddr MemoryAddress, uint32 uint32Value) { - *((uint32*)MemoryAddress) = uint32Value; - return(CFE_PSP_SUCCESS); + *((uint32 *)MemoryAddress) = uint32Value; + return (CFE_PSP_SUCCESS); } -int32 CFE_PSP_EepromWrite16( cpuaddr MemoryAddress, uint16 uint16Value ) +int32 CFE_PSP_EepromWrite16(cpuaddr MemoryAddress, uint16 uint16Value) { - *((uint16*)MemoryAddress) = uint16Value; - return(CFE_PSP_SUCCESS); + *((uint16 *)MemoryAddress) = uint16Value; + return (CFE_PSP_SUCCESS); } -int32 CFE_PSP_EepromWrite8( cpuaddr MemoryAddress, uint8 ByteValue ) +int32 CFE_PSP_EepromWrite8(cpuaddr MemoryAddress, uint8 ByteValue) { - *((uint8*)MemoryAddress) = ByteValue; - return(CFE_PSP_SUCCESS); + *((uint8 *)MemoryAddress) = ByteValue; + return (CFE_PSP_SUCCESS); } int32 CFE_PSP_EepromWriteEnable(uint32 Bank) { - return(CFE_PSP_ERROR_NOT_IMPLEMENTED); + return (CFE_PSP_ERROR_NOT_IMPLEMENTED); } int32 CFE_PSP_EepromWriteDisable(uint32 Bank) { - return(CFE_PSP_ERROR_NOT_IMPLEMENTED); + return (CFE_PSP_ERROR_NOT_IMPLEMENTED); } int32 CFE_PSP_EepromPowerUp(uint32 Bank) { - return(CFE_PSP_SUCCESS); + return (CFE_PSP_SUCCESS); } int32 CFE_PSP_EepromPowerDown(uint32 Bank) { - return(CFE_PSP_SUCCESS); + return (CFE_PSP_SUCCESS); } void eeprom_mmap_file_Init(uint32 PspModuleId) { - int32 Status; + int32 Status; cpuaddr eeprom_address; - uint32 eeprom_size; + uint32 eeprom_size; /* ** Create the simulated EEPROM segment by mapping a memory segment to a file. @@ -181,21 +180,19 @@ void eeprom_mmap_file_Init(uint32 PspModuleId) ** Set up 512Kbytes of EEPROM */ eeprom_size = 0x80000; - Status = CFE_PSP_SetupEEPROM(eeprom_size, &eeprom_address); + Status = CFE_PSP_SetupEEPROM(eeprom_size, &eeprom_address); - if ( Status == 0 ) + if (Status == 0) { - /* - ** Install the 2nd memory range as the mapped file ( EEPROM ) - */ - Status = CFE_PSP_MemRangeSet (1, CFE_PSP_MEM_EEPROM, eeprom_address, - eeprom_size, CFE_PSP_MEM_SIZE_DWORD, 0 ); - OS_printf("CFE_PSP: EEPROM Range (2) created: Start Address = %08lX, Size = %08X Status = %d\n", (unsigned long)eeprom_address, (unsigned int)eeprom_size, Status); - + /* + ** Install the 2nd memory range as the mapped file ( EEPROM ) + */ + Status = CFE_PSP_MemRangeSet(1, CFE_PSP_MEM_EEPROM, eeprom_address, eeprom_size, CFE_PSP_MEM_SIZE_DWORD, 0); + OS_printf("CFE_PSP: EEPROM Range (2) created: Start Address = %08lX, Size = %08X Status = %d\n", + (unsigned long)eeprom_address, (unsigned int)eeprom_size, Status); } else { - OS_printf("CFE_PSP: Cannot create EEPROM Range from Memory Mapped file.\n"); + OS_printf("CFE_PSP: Cannot create EEPROM Range from Memory Mapped file.\n"); } } - diff --git a/fsw/modules/eeprom_stub/cfe_psp_eeprom_stub.c b/fsw/modules/eeprom_stub/cfe_psp_eeprom_stub.c index 1554d25b..a2df1424 100644 --- a/fsw/modules/eeprom_stub/cfe_psp_eeprom_stub.c +++ b/fsw/modules/eeprom_stub/cfe_psp_eeprom_stub.c @@ -37,39 +37,37 @@ void eeprom_stub_Init(uint32 PspModuleId) /* Nothing to init */ } - -int32 CFE_PSP_EepromWrite32( cpuaddr MemoryAddress, uint32 uint32Value ) +int32 CFE_PSP_EepromWrite32(cpuaddr MemoryAddress, uint32 uint32Value) { - return(CFE_PSP_ERROR_NOT_IMPLEMENTED); + return (CFE_PSP_ERROR_NOT_IMPLEMENTED); } -int32 CFE_PSP_EepromWrite16( cpuaddr MemoryAddress, uint16 uint16Value ) +int32 CFE_PSP_EepromWrite16(cpuaddr MemoryAddress, uint16 uint16Value) { - return(CFE_PSP_ERROR_NOT_IMPLEMENTED); + return (CFE_PSP_ERROR_NOT_IMPLEMENTED); } -int32 CFE_PSP_EepromWrite8( cpuaddr MemoryAddress, uint8 ByteValue ) +int32 CFE_PSP_EepromWrite8(cpuaddr MemoryAddress, uint8 ByteValue) { - return(CFE_PSP_ERROR_NOT_IMPLEMENTED); + return (CFE_PSP_ERROR_NOT_IMPLEMENTED); } int32 CFE_PSP_EepromWriteEnable(uint32 Bank) { - return(CFE_PSP_ERROR_NOT_IMPLEMENTED); + return (CFE_PSP_ERROR_NOT_IMPLEMENTED); } int32 CFE_PSP_EepromWriteDisable(uint32 Bank) { - return(CFE_PSP_ERROR_NOT_IMPLEMENTED); + return (CFE_PSP_ERROR_NOT_IMPLEMENTED); } int32 CFE_PSP_EepromPowerUp(uint32 Bank) { - return(CFE_PSP_ERROR_NOT_IMPLEMENTED); + return (CFE_PSP_ERROR_NOT_IMPLEMENTED); } int32 CFE_PSP_EepromPowerDown(uint32 Bank) { - return(CFE_PSP_ERROR_NOT_IMPLEMENTED); + return (CFE_PSP_ERROR_NOT_IMPLEMENTED); } - diff --git a/fsw/pc-linux/inc/cfe_psp_config.h b/fsw/pc-linux/inc/cfe_psp_config.h index 8937a2dc..02c66a2a 100644 --- a/fsw/pc-linux/inc/cfe_psp_config.h +++ b/fsw/pc-linux/inc/cfe_psp_config.h @@ -25,8 +25,6 @@ #ifndef _cfe_psp_config_ #define _cfe_psp_config_ - - #include "common_types.h" #include @@ -45,17 +43,16 @@ * * It must always be a power of two. */ -#define CFE_PSP_MAX_EXCEPTION_ENTRIES 4 -#define CFE_PSP_MAX_EXCEPTION_BACKTRACE_SIZE 16 - +#define CFE_PSP_MAX_EXCEPTION_ENTRIES 4 +#define CFE_PSP_MAX_EXCEPTION_BACKTRACE_SIZE 16 /* * A random 32-bit value that is used as the "validity flag" * of the PC-Linux boot record structure. This is simply * a value that is unlikely to occur unless specifically set. */ -#define CFE_PSP_BOOTRECORD_VALID ((uint32)0x2aebe984) -#define CFE_PSP_BOOTRECORD_INVALID (~CFE_PSP_BOOTRECORD_VALID) +#define CFE_PSP_BOOTRECORD_VALID ((uint32)0x2aebe984) +#define CFE_PSP_BOOTRECORD_INVALID (~CFE_PSP_BOOTRECORD_VALID) /* * The amount of time to wait for an orderly shutdown @@ -63,11 +60,10 @@ * * If this expires, then an abnormal exit/abort() is triggered. */ -#define CFE_PSP_RESTART_DELAY 10000 +#define CFE_PSP_RESTART_DELAY 10000 /* use the "USR1" signal to wake the idle thread when an exception occurs */ -#define CFE_PSP_EXCEPTION_EVENT_SIGNAL SIGUSR1 - +#define CFE_PSP_EXCEPTION_EVENT_SIGNAL SIGUSR1 /* ** Global variables @@ -100,12 +96,10 @@ typedef struct */ typedef struct { - pthread_t ThreadID; + pthread_t ThreadID; volatile bool ShutdownReq; } CFE_PSP_IdleTaskState_t; - - /** * \brief The data type used by the underlying OS to represent a thread ID. */ @@ -119,7 +113,7 @@ typedef pthread_t CFE_PSP_Exception_SysTaskId_t; typedef struct { struct timespec event_time; - siginfo_t si; + siginfo_t si; /* * Note this is a variably-filled array based on the number of addresses @@ -132,7 +126,7 @@ typedef struct ** Watchdog minimum and maximum values ( in milliseconds ) */ #define CFE_PSP_WATCHDOG_MIN (0) -#define CFE_PSP_WATCHDOG_MAX (0xFFFFFFFF) +#define CFE_PSP_WATCHDOG_MAX (0xFFFFFFFF) /* ** Number of EEPROM banks on this platform @@ -143,7 +137,6 @@ typedef struct * Information about the "idle task" -- * this is used by exception handling to wake it when an event occurs */ -extern CFE_PSP_IdleTaskState_t CFE_PSP_IdleTaskState; +extern CFE_PSP_IdleTaskState_t CFE_PSP_IdleTaskState; #endif - diff --git a/fsw/pc-linux/inc/psp_version.h b/fsw/pc-linux/inc/psp_version.h index 85cdb133..dc3eb209 100644 --- a/fsw/pc-linux/inc/psp_version.h +++ b/fsw/pc-linux/inc/psp_version.h @@ -19,17 +19,17 @@ */ /*! @file pc-linux/inc/psp_version.h - * @brief Purpose: - * @details Provide version identifiers for the cFE Platform Support Packages (PSP). + * @brief Purpose: + * @details Provide version identifiers for the cFE Platform Support Packages (PSP). * See @ref cfsversions for version and build number and description */ #ifndef _psp_version_ #define _psp_version_ /* - * Development Build Macro Definitions + * Development Build Macro Definitions */ -#define CFE_PSP_IMPL_BUILD_NUMBER 58 +#define CFE_PSP_IMPL_BUILD_NUMBER 58 #define CFE_PSP_IMPL_BUILD_BASELINE "v1.5.0-rc1" /* @@ -38,26 +38,29 @@ #define CFE_PSP_IMPL_MAJOR_VERSION 1 /*!< @brief ONLY APPLY for OFFICIAL releases. Major version number. */ #define CFE_PSP_IMPL_MINOR_VERSION 4 /*!< @brief ONLY APPLY for OFFICIAL releases. Minor version number. */ #define CFE_PSP_IMPL_REVISION 0 /*!< @brief ONLY APPLY for OFFICIAL releases. Revision number. */ -#define CFE_PSP_IMPL_MISSION_REV 99 /*!< @brief ONLY APPLY for OFFICIAL releases. Revision version number. A value of "99" indicates an unreleased development version. */ +#define CFE_PSP_IMPL_MISSION_REV \ + 99 /*!< @brief ONLY APPLY for OFFICIAL releases. Revision version number. A value of "99" indicates an unreleased \ + development version. */ /* * Tools to construct version string - */ -#define CFE_PSP_IMPL_STR_HELPER(x) #x /*!< @brief Helper function to concatenate strings from integer */ -#define CFE_PSP_IMPL_STR(x) CFE_PSP_IMPL_STR_HELPER(x) /*!< @brief Helper function to concatenate strings from integer */ + */ +#define CFE_PSP_IMPL_STR_HELPER(x) #x /*!< @brief Helper function to concatenate strings from integer */ +#define CFE_PSP_IMPL_STR(x) \ + CFE_PSP_IMPL_STR_HELPER(x) /*!< @brief Helper function to concatenate strings from integer */ -/*! @brief Development Build Version Number. +/*! @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_PSP_IMPL_VERSION CFE_PSP_IMPL_BUILD_BASELINE CFE_PSP_IMPL_STR(CFE_PSP_IMPL_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. - */ -#define CFE_PSP_IMPL_VERSION_STRING \ - " PSP DEVELOPMENT BUILD " CFE_PSP_IMPL_VERSION \ - ", Last Official Release: psp v1.4.0" /* For full support please use this version */ + * @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. + */ +#define CFE_PSP_IMPL_VERSION_STRING \ + " PSP DEVELOPMENT BUILD " CFE_PSP_IMPL_VERSION \ + ", Last Official Release: psp v1.4.0" /* For full support please use this version */ -#endif /* _psp_version_ */ +#endif /* _psp_version_ */ diff --git a/fsw/pc-linux/src/cfe_psp_exception.c b/fsw/pc-linux/src/cfe_psp_exception.c index 2bd16be8..b86ea03f 100644 --- a/fsw/pc-linux/src/cfe_psp_exception.c +++ b/fsw/pc-linux/src/cfe_psp_exception.c @@ -55,26 +55,22 @@ S /* * A set of asynchronous signals which will be masked during other signal processing */ -sigset_t CFE_PSP_AsyncMask; - - - +sigset_t CFE_PSP_AsyncMask; /*************************************************************************** ** FUNCTIONS DEFINITIONS ***************************************************************************/ - /* ** Name: CFE_PSP_ExceptionSigHandler ** ** Installed as a signal handler to log exception events. ** */ -void CFE_PSP_ExceptionSigHandler (int signo, siginfo_t *si, void *ctxt) +void CFE_PSP_ExceptionSigHandler(int signo, siginfo_t *si, void *ctxt) { - CFE_PSP_Exception_LogData_t* Buffer; - int NumAddrs; + CFE_PSP_Exception_LogData_t *Buffer; + int NumAddrs; /* * Note that the time between CFE_PSP_Exception_GetNextContextBuffer() @@ -102,7 +98,7 @@ void CFE_PSP_ExceptionSigHandler (int signo, siginfo_t *si, void *ctxt) */ clock_gettime(CLOCK_MONOTONIC, &Buffer->context_info.event_time); memcpy(&Buffer->context_info.si, si, sizeof(Buffer->context_info.si)); - NumAddrs = backtrace(Buffer->context_info.bt_addrs, CFE_PSP_MAX_EXCEPTION_BACKTRACE_SIZE); + NumAddrs = backtrace(Buffer->context_info.bt_addrs, CFE_PSP_MAX_EXCEPTION_BACKTRACE_SIZE); Buffer->context_size = offsetof(CFE_PSP_Exception_ContextDataEntry_t, bt_addrs[NumAddrs]); /* pthread_self() is signal-safe per POSIX.1-2013 */ Buffer->sys_task_id = pthread_self(); @@ -128,7 +124,7 @@ void CFE_PSP_ExceptionSigHandler (int signo, siginfo_t *si, void *ctxt) ** and re-trigger the exception, resulting in a loop. ** */ -void CFE_PSP_ExceptionSigHandlerSuspend (int signo, siginfo_t *si, void *ctxt) +void CFE_PSP_ExceptionSigHandlerSuspend(int signo, siginfo_t *si, void *ctxt) { /* * Perform normal exception logging @@ -151,14 +147,14 @@ void CFE_PSP_ExceptionSigHandlerSuspend (int signo, siginfo_t *si, void *ctxt) /* * Helper function to call sigaction() to attach a signal handler */ -void CFE_PSP_AttachSigHandler (int signo) +void CFE_PSP_AttachSigHandler(int signo) { struct sigaction sa; memset(&sa, 0, sizeof(sa)); sa.sa_mask = CFE_PSP_AsyncMask; - if(!sigismember(&CFE_PSP_AsyncMask, signo)) + if (!sigismember(&CFE_PSP_AsyncMask, signo)) { /* * In the event that the handler is being installed for one of the @@ -188,8 +184,6 @@ void CFE_PSP_AttachSigHandler (int signo) sigaction(signo, &sa, NULL); } - - /* ** Name: CFE_PSP_AttachExceptions ** @@ -282,45 +276,44 @@ void CFE_PSP_SetDefaultExceptionEnvironment(void) CFE_PSP_AttachSigHandler(SIGFPE); } -int32 CFE_PSP_ExceptionGetSummary_Impl(const CFE_PSP_Exception_LogData_t* Buffer, char *ReasonBuf, uint32 ReasonSize) +int32 CFE_PSP_ExceptionGetSummary_Impl(const CFE_PSP_Exception_LogData_t *Buffer, char *ReasonBuf, uint32 ReasonSize) { const char *ComputedReason = "unknown"; /* check the "code" within the siginfo structure, which reveals more info about the FP exception */ if (Buffer->context_info.si.si_signo == SIGFPE) { - switch(Buffer->context_info.si.si_code) + switch (Buffer->context_info.si.si_code) { - case FPE_INTDIV: - ComputedReason = "Integer divide by zero"; - break; - case FPE_INTOVF: - ComputedReason = "Integer overflow"; - break; - case FPE_FLTDIV: - ComputedReason = "Floating-point divide by zero"; - break; - case FPE_FLTOVF: - ComputedReason = "Floating-point overflow"; - break; - case FPE_FLTUND: - ComputedReason = "Floating-point underflow"; - break; - case FPE_FLTRES: - ComputedReason = "Floating-point inexact result"; - break; - case FPE_FLTINV: - ComputedReason = "Invalid floating-point operation"; - break; - case FPE_FLTSUB: - ComputedReason = "Subscript out of range"; - break; - default: - ComputedReason = "Unknown SIGFPE"; + case FPE_INTDIV: + ComputedReason = "Integer divide by zero"; + break; + case FPE_INTOVF: + ComputedReason = "Integer overflow"; + break; + case FPE_FLTDIV: + ComputedReason = "Floating-point divide by zero"; + break; + case FPE_FLTOVF: + ComputedReason = "Floating-point overflow"; + break; + case FPE_FLTUND: + ComputedReason = "Floating-point underflow"; + break; + case FPE_FLTRES: + ComputedReason = "Floating-point inexact result"; + break; + case FPE_FLTINV: + ComputedReason = "Invalid floating-point operation"; + break; + case FPE_FLTSUB: + ComputedReason = "Subscript out of range"; + break; + default: + ComputedReason = "Unknown SIGFPE"; } (void)snprintf(ReasonBuf, ReasonSize, "%s at ip 0x%lx", ComputedReason, - (unsigned long)Buffer->context_info.si.si_addr); - + (unsigned long)Buffer->context_info.si.si_addr); } else if (Buffer->context_info.si.si_signo == SIGINT) { @@ -334,10 +327,8 @@ int32 CFE_PSP_ExceptionGetSummary_Impl(const CFE_PSP_Exception_LogData_t* Buffer * POSIX 2008 does provide a strsignal() function to get the name, but this * is a newer spec than what is targeted by CFE, so just print the number. */ - (void)snprintf(ReasonBuf, ReasonSize, "Caught Signal %d",Buffer->context_info.si.si_signo); + (void)snprintf(ReasonBuf, ReasonSize, "Caught Signal %d", Buffer->context_info.si.si_signo); } return CFE_PSP_SUCCESS; } - - diff --git a/fsw/pc-linux/src/cfe_psp_memory.c b/fsw/pc-linux/src/cfe_psp_memory.c index a1414ac7..60f9bda0 100644 --- a/fsw/pc-linux/src/cfe_psp_memory.c +++ b/fsw/pc-linux/src/cfe_psp_memory.c @@ -24,13 +24,13 @@ ** OSX x86 Linux Version ** ** Purpose: -** cFE PSP Memory related functions. This is the implementation of the cFE +** cFE PSP Memory related functions. This is the implementation of the cFE ** memory areas that have to be preserved, and the API that is designed to allow ** acccess to them. It also contains memory related routines to return the ** address of the kernel code used in the cFE checksum. ** ** History: -** 2006/09/29 A. Cudmore | Initial version for OS X +** 2006/09/29 A. Cudmore | Initial version for OS X ** ******************************************************************************/ @@ -48,7 +48,7 @@ #include /* -** cFE includes +** cFE includes */ #include "common_types.h" #include "osapi.h" @@ -64,8 +64,8 @@ #include "cfe_psp_config.h" #include "cfe_psp_memory.h" -#define CFE_PSP_CDS_KEY_FILE ".cdskeyfile" -#define CFE_PSP_RESET_KEY_FILE ".resetkeyfile" +#define CFE_PSP_CDS_KEY_FILE ".cdskeyfile" +#define CFE_PSP_RESET_KEY_FILE ".resetkeyfile" #define CFE_PSP_RESERVED_KEY_FILE ".reservedkeyfile" #include @@ -74,18 +74,16 @@ * Define the PSP-supported capacities to be the maximum allowed, * (since the PC-linux PSP has the advantage of abundant disk space to hold this) */ -#define CFE_PSP_CDS_SIZE (GLOBAL_CONFIGDATA.CfeConfig->CdsSize) -#define CFE_PSP_RESET_AREA_SIZE (GLOBAL_CONFIGDATA.CfeConfig->ResetAreaSize) -#define CFE_PSP_USER_RESERVED_SIZE (GLOBAL_CONFIGDATA.CfeConfig->UserReservedSize) - +#define CFE_PSP_CDS_SIZE (GLOBAL_CONFIGDATA.CfeConfig->CdsSize) +#define CFE_PSP_RESET_AREA_SIZE (GLOBAL_CONFIGDATA.CfeConfig->ResetAreaSize) +#define CFE_PSP_USER_RESERVED_SIZE (GLOBAL_CONFIGDATA.CfeConfig->UserReservedSize) typedef struct { CFE_PSP_ReservedMemoryBootRecord_t BootRecord; - CFE_PSP_ExceptionStorage_t ExceptionStorage; + CFE_PSP_ExceptionStorage_t ExceptionStorage; } CFE_PSP_LinuxReservedAreaFixedLayout_t; - /* ** Internal prototypes for this module */ @@ -103,31 +101,30 @@ extern unsigned int _fini; /* ** Global variables */ -int ResetAreaShmId; -int CDSShmId; -int UserShmId; - +int ResetAreaShmId; +int CDSShmId; +int UserShmId; + /* ** Pointer to the vxWorks USER_RESERVED_MEMORY area ** The sizes of each memory area is defined in os_processor.h for this architecture. */ CFE_PSP_ReservedMemoryMap_t CFE_PSP_ReservedMemoryMap; - /* ********************************************************************************* ** CDS related functions ********************************************************************************* */ /* -** +** */ /****************************************************************************** ** Function: CFE_PSP_InitCDS ** -** Purpose: This function is used by the ES startup code to initialize the +** Purpose: This function is used by the ES startup code to initialize the ** Critical Data store area -** +** ** ** Arguments: ** (none) @@ -138,45 +135,44 @@ CFE_PSP_ReservedMemoryMap_t CFE_PSP_ReservedMemoryMap; void CFE_PSP_InitCDS(void) { - key_t key; + key_t key; - /* - ** Make the Shared memory key - */ - if ((key = ftok(CFE_PSP_CDS_KEY_FILE, 'R')) == -1) - { + /* + ** Make the Shared memory key + */ + if ((key = ftok(CFE_PSP_CDS_KEY_FILE, 'R')) == -1) + { OS_printf("CFE_PSP: Cannot Create CDS Shared memory key!\n"); exit(-1); - } + } - /* - ** connect to (and possibly create) the segment: - */ - if ((CDSShmId = shmget(key, CFE_PSP_CDS_SIZE, 0644 | IPC_CREAT)) == -1) - { + /* + ** connect to (and possibly create) the segment: + */ + if ((CDSShmId = shmget(key, CFE_PSP_CDS_SIZE, 0644 | IPC_CREAT)) == -1) + { OS_printf("CFE_PSP: Cannot shmget CDS Shared memory Segment!\n"); exit(-1); - } - - /* - ** attach to the segment to get a pointer to it: - */ - CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr = shmat(CDSShmId, (void *)0, 0); - if (CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr == (void*)(-1)) - { + } + + /* + ** attach to the segment to get a pointer to it: + */ + CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr = shmat(CDSShmId, (void *)0, 0); + if (CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr == (void *)(-1)) + { OS_printf("CFE_PSP: Cannot shmat to CDS Shared memory Segment!\n"); exit(-1); - } + } - CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize = CFE_PSP_CDS_SIZE; + CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize = CFE_PSP_CDS_SIZE; } - /****************************************************************************** ** Function: CFE_PSP_DeleteCDS ** ** Purpose: -** This is an internal function to delete the CDS Shared memory segment. +** This is an internal function to delete the CDS Shared memory segment. ** ** Arguments: ** (none) @@ -187,28 +183,26 @@ void CFE_PSP_InitCDS(void) void CFE_PSP_DeleteCDS(void) { - int ReturnCode; - struct shmid_ds ShmCtrl; - - ReturnCode = shmctl(CDSShmId, IPC_RMID, &ShmCtrl); - - if ( ReturnCode == 0 ) - { - OS_printf("CFE_PSP: Critical Data Store Shared memory segment removed\n"); - } - else - { - OS_printf("CFE_PSP: Error Removing Critical Data Store Shared memory Segment.\n"); - OS_printf("CFE_PSP: It can be manually checked and removed using the ipcs and ipcrm commands.\n"); - } + int ReturnCode; + struct shmid_ds ShmCtrl; + ReturnCode = shmctl(CDSShmId, IPC_RMID, &ShmCtrl); + if (ReturnCode == 0) + { + OS_printf("CFE_PSP: Critical Data Store Shared memory segment removed\n"); + } + else + { + OS_printf("CFE_PSP: Error Removing Critical Data Store Shared memory Segment.\n"); + OS_printf("CFE_PSP: It can be manually checked and removed using the ipcs and ipcrm commands.\n"); + } } /****************************************************************************** ** Function: CFE_PSP_GetCDSSize ** -** Purpose: +** Purpose: ** This function fetches the size of the OS Critical Data Store area. ** ** Arguments: @@ -220,19 +214,19 @@ void CFE_PSP_DeleteCDS(void) int32 CFE_PSP_GetCDSSize(uint32 *SizeOfCDS) { - int32 return_code; - - if ( SizeOfCDS == NULL ) - { - return_code = CFE_PSP_ERROR; - } - else - { - *SizeOfCDS = CFE_PSP_CDS_SIZE; - return_code = CFE_PSP_SUCCESS; - } - - return(return_code); + int32 return_code; + + if (SizeOfCDS == NULL) + { + return_code = CFE_PSP_ERROR; + } + else + { + *SizeOfCDS = CFE_PSP_CDS_SIZE; + return_code = CFE_PSP_SUCCESS; + } + + return (return_code); } /****************************************************************************** @@ -250,34 +244,32 @@ int32 CFE_PSP_GetCDSSize(uint32 *SizeOfCDS) int32 CFE_PSP_WriteToCDS(const void *PtrToDataToWrite, uint32 CDSOffset, uint32 NumBytes) { - uint8 *CopyPtr; - int32 return_code; - - if ( PtrToDataToWrite == NULL ) - { - return_code = CFE_PSP_ERROR; - } - else - { - if ( (CDSOffset < CFE_PSP_CDS_SIZE ) && ( (CDSOffset + NumBytes) <= CFE_PSP_CDS_SIZE )) - { - CopyPtr = CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr; - CopyPtr += CDSOffset; - memcpy(CopyPtr, (char *)PtrToDataToWrite,NumBytes); - - return_code = CFE_PSP_SUCCESS; - } - else - { - return_code = CFE_PSP_ERROR; - } - - } /* end if PtrToDataToWrite == NULL */ - - return(return_code); -} - + uint8 *CopyPtr; + int32 return_code; + if (PtrToDataToWrite == NULL) + { + return_code = CFE_PSP_ERROR; + } + else + { + if ((CDSOffset < CFE_PSP_CDS_SIZE) && ((CDSOffset + NumBytes) <= CFE_PSP_CDS_SIZE)) + { + CopyPtr = CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr; + CopyPtr += CDSOffset; + memcpy(CopyPtr, (char *)PtrToDataToWrite, NumBytes); + + return_code = CFE_PSP_SUCCESS; + } + else + { + return_code = CFE_PSP_ERROR; + } + + } /* end if PtrToDataToWrite == NULL */ + + return (return_code); +} /****************************************************************************** ** Function: CFE_PSP_ReadFromCDS @@ -294,32 +286,31 @@ int32 CFE_PSP_WriteToCDS(const void *PtrToDataToWrite, uint32 CDSOffset, uint32 int32 CFE_PSP_ReadFromCDS(void *PtrToDataToRead, uint32 CDSOffset, uint32 NumBytes) { - uint8 *CopyPtr; - int32 return_code; - - if ( PtrToDataToRead == NULL ) - { - return_code = CFE_PSP_ERROR; - } - else - { - if ( (CDSOffset < CFE_PSP_CDS_SIZE ) && ( (CDSOffset + NumBytes) <= CFE_PSP_CDS_SIZE )) - { - CopyPtr = CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr; - CopyPtr += CDSOffset; - memcpy((char *)PtrToDataToRead,CopyPtr, NumBytes); - - return_code = CFE_PSP_SUCCESS; - } - else - { - return_code = CFE_PSP_ERROR; - } - - } /* end if PtrToDataToWrite == NULL */ - - return(return_code); - + uint8 *CopyPtr; + int32 return_code; + + if (PtrToDataToRead == NULL) + { + return_code = CFE_PSP_ERROR; + } + else + { + if ((CDSOffset < CFE_PSP_CDS_SIZE) && ((CDSOffset + NumBytes) <= CFE_PSP_CDS_SIZE)) + { + CopyPtr = CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr; + CopyPtr += CDSOffset; + memcpy((char *)PtrToDataToRead, CopyPtr, NumBytes); + + return_code = CFE_PSP_SUCCESS; + } + else + { + return_code = CFE_PSP_ERROR; + } + + } /* end if PtrToDataToWrite == NULL */ + + return (return_code); } /* @@ -344,69 +335,68 @@ int32 CFE_PSP_ReadFromCDS(void *PtrToDataToRead, uint32 CDSOffset, uint32 NumByt void CFE_PSP_InitResetArea(void) { - key_t key; - size_t total_size; - size_t reset_offset; - size_t align_mask; - cpuaddr block_addr; - CFE_PSP_LinuxReservedAreaFixedLayout_t *FixedBlocksPtr; - /* - ** Make the Shared memory key - */ - if ((key = ftok(CFE_PSP_RESET_KEY_FILE, 'R')) == -1) - { + key_t key; + size_t total_size; + size_t reset_offset; + size_t align_mask; + cpuaddr block_addr; + CFE_PSP_LinuxReservedAreaFixedLayout_t *FixedBlocksPtr; + /* + ** Make the Shared memory key + */ + if ((key = ftok(CFE_PSP_RESET_KEY_FILE, 'R')) == -1) + { OS_printf("CFE_PSP: Cannot Create Reset Area Shared memory key!\n"); exit(-1); - } + } + + /* + * NOTE: Historically the CFE ES reset area also contains the Exception log. + * This is now allocated as a separate structure in the PSP, but it can + * reside in this shared memory segment so it will be preserved on a processor + * reset. + */ + align_mask = sysconf(_SC_PAGESIZE) - 1; /* align blocks to whole memory pages */ + total_size = sizeof(CFE_PSP_LinuxReservedAreaFixedLayout_t); + total_size = (total_size + align_mask) & ~align_mask; + reset_offset = total_size; + total_size += CFE_PSP_RESET_AREA_SIZE; + total_size = (total_size + align_mask) & ~align_mask; - /* - * NOTE: Historically the CFE ES reset area also contains the Exception log. - * This is now allocated as a separate structure in the PSP, but it can - * reside in this shared memory segment so it will be preserved on a processor - * reset. + /* + ** connect to (and possibly create) the segment: */ - align_mask = sysconf(_SC_PAGESIZE) - 1; /* align blocks to whole memory pages */ - total_size = sizeof(CFE_PSP_LinuxReservedAreaFixedLayout_t); - total_size = (total_size + align_mask) & ~align_mask; - reset_offset = total_size; - total_size += CFE_PSP_RESET_AREA_SIZE; - total_size = (total_size + align_mask) & ~align_mask; - - /* - ** connect to (and possibly create) the segment: - */ - if ((ResetAreaShmId = shmget(key, total_size, 0644 | IPC_CREAT)) == -1) - { + if ((ResetAreaShmId = shmget(key, total_size, 0644 | IPC_CREAT)) == -1) + { OS_printf("CFE_PSP: Cannot shmget Reset Area Shared memory Segment!\n"); exit(-1); - } - - /* - ** attach to the segment to get a pointer to it: - */ - block_addr = (cpuaddr)shmat(ResetAreaShmId, (void *)0, 0); - if (block_addr == (cpuaddr)(-1)) - { + } + + /* + ** attach to the segment to get a pointer to it: + */ + block_addr = (cpuaddr)shmat(ResetAreaShmId, (void *)0, 0); + if (block_addr == (cpuaddr)(-1)) + { OS_printf("CFE_PSP: Cannot shmat to Reset Area Shared memory Segment!\n"); exit(-1); - } + } - FixedBlocksPtr = (CFE_PSP_LinuxReservedAreaFixedLayout_t *)block_addr; - block_addr += reset_offset; + FixedBlocksPtr = (CFE_PSP_LinuxReservedAreaFixedLayout_t *)block_addr; + block_addr += reset_offset; - CFE_PSP_ReservedMemoryMap.BootPtr = &FixedBlocksPtr->BootRecord; - CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr = &FixedBlocksPtr->ExceptionStorage; + CFE_PSP_ReservedMemoryMap.BootPtr = &FixedBlocksPtr->BootRecord; + CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr = &FixedBlocksPtr->ExceptionStorage; - CFE_PSP_ReservedMemoryMap.ResetMemory.BlockPtr = (void*)block_addr; - CFE_PSP_ReservedMemoryMap.ResetMemory.BlockSize = CFE_PSP_RESET_AREA_SIZE; + CFE_PSP_ReservedMemoryMap.ResetMemory.BlockPtr = (void *)block_addr; + CFE_PSP_ReservedMemoryMap.ResetMemory.BlockSize = CFE_PSP_RESET_AREA_SIZE; } - /****************************************************************************** ** Function: CFE_PSP_DeleteResetArea ** ** Purpose: -** This is an internal function to delete the Reset Area Shared memory segment. +** This is an internal function to delete the Reset Area Shared memory segment. ** ** Arguments: ** (none) @@ -416,33 +406,30 @@ void CFE_PSP_InitResetArea(void) */ void CFE_PSP_DeleteResetArea(void) { - int ReturnCode; - struct shmid_ds ShmCtrl; - - ReturnCode = shmctl(ResetAreaShmId, IPC_RMID, &ShmCtrl); - - if ( ReturnCode == 0 ) - { - OS_printf("Reset Area Shared memory segment removed\n"); - } - else - { - OS_printf("Error Removing Reset Area Shared memory Segment.\n"); - OS_printf("It can be manually checked and removed using the ipcs and ipcrm commands.\n"); - } + int ReturnCode; + struct shmid_ds ShmCtrl; + ReturnCode = shmctl(ResetAreaShmId, IPC_RMID, &ShmCtrl); + if (ReturnCode == 0) + { + OS_printf("Reset Area Shared memory segment removed\n"); + } + else + { + OS_printf("Error Removing Reset Area Shared memory Segment.\n"); + OS_printf("It can be manually checked and removed using the ipcs and ipcrm commands.\n"); + } } - /* -*/ + */ /****************************************************************************** ** Function: CFE_PSP_GetResetArea ** ** Purpose: -** This function returns the location and size of the ES Reset information area. -** This area is preserved during a processor reset and is used to store the +** This function returns the location and size of the ES Reset information area. +** This area is preserved during a processor reset and is used to store the ** ER Log, System Log and reset related variables ** ** Arguments: @@ -451,22 +438,22 @@ void CFE_PSP_DeleteResetArea(void) ** Return: ** (none) */ -int32 CFE_PSP_GetResetArea (cpuaddr *PtrToResetArea, uint32 *SizeOfResetArea) +int32 CFE_PSP_GetResetArea(cpuaddr *PtrToResetArea, uint32 *SizeOfResetArea) { - int32 return_code; - - if ( SizeOfResetArea == NULL ) - { - return_code = CFE_PSP_ERROR; - } - else - { - *PtrToResetArea = (cpuaddr)CFE_PSP_ReservedMemoryMap.ResetMemory.BlockPtr; - *SizeOfResetArea = CFE_PSP_ReservedMemoryMap.ResetMemory.BlockSize; - return_code = CFE_PSP_SUCCESS; - } - - return(return_code); + int32 return_code; + + if (SizeOfResetArea == NULL) + { + return_code = CFE_PSP_ERROR; + } + else + { + *PtrToResetArea = (cpuaddr)CFE_PSP_ReservedMemoryMap.ResetMemory.BlockPtr; + *SizeOfResetArea = CFE_PSP_ReservedMemoryMap.ResetMemory.BlockSize; + return_code = CFE_PSP_SUCCESS; + } + + return (return_code); } /* @@ -474,9 +461,9 @@ int32 CFE_PSP_GetResetArea (cpuaddr *PtrToResetArea, uint32 *SizeOfResetArea) ** ES User Reserved Area related functions ********************************************************************************* */ - + /****************************************************************************** -** Function: CFE_PSP_InitUserReservedArea +** Function: CFE_PSP_InitUserReservedArea ** ** Purpose: ** This function is used by the ES startup code to initialize the @@ -490,44 +477,44 @@ int32 CFE_PSP_GetResetArea (cpuaddr *PtrToResetArea, uint32 *SizeOfResetArea) */ void CFE_PSP_InitUserReservedArea(void) { - key_t key; + key_t key; - /* - ** Make the Shared memory key - */ - if ((key = ftok(CFE_PSP_RESERVED_KEY_FILE, 'R')) == -1) - { + /* + ** Make the Shared memory key + */ + if ((key = ftok(CFE_PSP_RESERVED_KEY_FILE, 'R')) == -1) + { OS_printf("CFE_PSP: Cannot Create User Reserved Area Shared memory key!\n"); exit(-1); - } + } - /* - ** connect to (and possibly create) the segment: - */ - if ((UserShmId = shmget(key, CFE_PSP_USER_RESERVED_SIZE, 0644 | IPC_CREAT)) == -1) - { + /* + ** connect to (and possibly create) the segment: + */ + if ((UserShmId = shmget(key, CFE_PSP_USER_RESERVED_SIZE, 0644 | IPC_CREAT)) == -1) + { OS_printf("CFE_PSP: Cannot shmget User Reserved Area Shared memory Segment!\n"); exit(-1); - } - - /* - ** attach to the segment to get a pointer to it: - */ - CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockPtr = shmat(UserShmId, (void *)0, 0); - if (CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockPtr == (void*)(-1)) - { + } + + /* + ** attach to the segment to get a pointer to it: + */ + CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockPtr = shmat(UserShmId, (void *)0, 0); + if (CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockPtr == (void *)(-1)) + { OS_printf("CFE_PSP: Cannot shmat to User Reserved Area Shared memory Segment!\n"); exit(-1); - } + } - CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockSize = CFE_PSP_USER_RESERVED_SIZE; + CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockSize = CFE_PSP_USER_RESERVED_SIZE; } /****************************************************************************** ** Function: CFE_PSP_DeleteUserReservedArea ** ** Purpose: -** This is an internal function to delete the User Reserved Shared memory segment. +** This is an internal function to delete the User Reserved Shared memory segment. ** ** Arguments: ** (none) @@ -537,22 +524,21 @@ void CFE_PSP_InitUserReservedArea(void) */ void CFE_PSP_DeleteUserReservedArea(void) { - int ReturnCode; - struct shmid_ds ShmCtrl; - - ReturnCode = shmctl(UserShmId, IPC_RMID, &ShmCtrl); - - if ( ReturnCode == 0 ) - { - OS_printf("User Reserved Area Shared memory segment removed\n"); - } - else - { - OS_printf("Error Removing User Reserved Area Shared memory Segment.\n"); - OS_printf("It can be manually checked and removed using the ipcs and ipcrm commands.\n"); - } -} + int ReturnCode; + struct shmid_ds ShmCtrl; + ReturnCode = shmctl(UserShmId, IPC_RMID, &ShmCtrl); + + if (ReturnCode == 0) + { + OS_printf("User Reserved Area Shared memory segment removed\n"); + } + else + { + OS_printf("Error Removing User Reserved Area Shared memory Segment.\n"); + OS_printf("It can be manually checked and removed using the ipcs and ipcrm commands.\n"); + } +} /****************************************************************************** ** Function: CFE_PSP_GetUserReservedArea @@ -567,22 +553,22 @@ void CFE_PSP_DeleteUserReservedArea(void) ** Return: ** (none) */ -int32 CFE_PSP_GetUserReservedArea(cpuaddr *PtrToUserArea, uint32 *SizeOfUserArea ) +int32 CFE_PSP_GetUserReservedArea(cpuaddr *PtrToUserArea, uint32 *SizeOfUserArea) { - int32 return_code; - - if ( SizeOfUserArea == NULL ) - { - return_code = CFE_PSP_ERROR; - } - else - { - *PtrToUserArea = (cpuaddr)CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockPtr; - *SizeOfUserArea = CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockSize; - return_code = CFE_PSP_SUCCESS; - } - - return(return_code); + int32 return_code; + + if (SizeOfUserArea == NULL) + { + return_code = CFE_PSP_ERROR; + } + else + { + *PtrToUserArea = (cpuaddr)CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockPtr; + *SizeOfUserArea = CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockSize; + return_code = CFE_PSP_SUCCESS; + } + + return (return_code); } /* @@ -607,10 +593,10 @@ int32 CFE_PSP_GetUserReservedArea(cpuaddr *PtrToUserArea, uint32 *SizeOfUserArea */ void CFE_PSP_InitVolatileDiskMem(void) { - /* - ** Here, we want to clear out the volatile ram disk contents - ** on a power on reset - */ + /* + ** Here, we want to clear out the volatile ram disk contents + ** on a power on reset + */ } /****************************************************************************** @@ -626,23 +612,22 @@ void CFE_PSP_InitVolatileDiskMem(void) ** Return: ** (none) */ -int32 CFE_PSP_GetVolatileDiskMem(cpuaddr *PtrToVolDisk, uint32 *SizeOfVolDisk ) +int32 CFE_PSP_GetVolatileDiskMem(cpuaddr *PtrToVolDisk, uint32 *SizeOfVolDisk) { - int32 return_code; - - if ( SizeOfVolDisk == NULL ) - { - return_code = CFE_PSP_ERROR; - } - else - { - *PtrToVolDisk = (cpuaddr)CFE_PSP_ReservedMemoryMap.VolatileDiskMemory.BlockPtr; - *SizeOfVolDisk = CFE_PSP_ReservedMemoryMap.VolatileDiskMemory.BlockSize; - return_code = CFE_PSP_SUCCESS; - } - - return(return_code); + int32 return_code; + if (SizeOfVolDisk == NULL) + { + return_code = CFE_PSP_ERROR; + } + else + { + *PtrToVolDisk = (cpuaddr)CFE_PSP_ReservedMemoryMap.VolatileDiskMemory.BlockPtr; + *SizeOfVolDisk = CFE_PSP_ReservedMemoryMap.VolatileDiskMemory.BlockSize; + return_code = CFE_PSP_SUCCESS; + } + + return (return_code); } /* @@ -665,33 +650,33 @@ int32 CFE_PSP_GetVolatileDiskMem(cpuaddr *PtrToVolDisk, uint32 *SizeOfVolDisk ) */ void CFE_PSP_SetupReservedMemoryMap(void) { - int tempFd; - - /* - ** Create the key files for the shared memory segments - ** The files are not needed, so they are closed right away. - */ - tempFd = open(CFE_PSP_CDS_KEY_FILE, O_RDONLY | O_CREAT, S_IRWXU ); - close(tempFd); - tempFd = open(CFE_PSP_RESET_KEY_FILE, O_RDONLY | O_CREAT, S_IRWXU ); - close(tempFd); - tempFd = open(CFE_PSP_RESERVED_KEY_FILE, O_RDONLY | O_CREAT, S_IRWXU ); - close(tempFd); - - /* - * The setup of each section is done as a separate init. - * - * Any failures within these routines call exit(), so there - * is no need to check status - failure means no return. + int tempFd; + + /* + ** Create the key files for the shared memory segments + ** The files are not needed, so they are closed right away. */ + tempFd = open(CFE_PSP_CDS_KEY_FILE, O_RDONLY | O_CREAT, S_IRWXU); + close(tempFd); + tempFd = open(CFE_PSP_RESET_KEY_FILE, O_RDONLY | O_CREAT, S_IRWXU); + close(tempFd); + tempFd = open(CFE_PSP_RESERVED_KEY_FILE, O_RDONLY | O_CREAT, S_IRWXU); + close(tempFd); + + /* + * The setup of each section is done as a separate init. + * + * Any failures within these routines call exit(), so there + * is no need to check status - failure means no return. + */ - CFE_PSP_InitCDS(); - CFE_PSP_InitResetArea(); - CFE_PSP_InitVolatileDiskMem(); - CFE_PSP_InitUserReservedArea(); + CFE_PSP_InitCDS(); + CFE_PSP_InitResetArea(); + CFE_PSP_InitVolatileDiskMem(); + CFE_PSP_InitUserReservedArea(); } -int32 CFE_PSP_InitProcessorReservedMemory( uint32 RestartType ) +int32 CFE_PSP_InitProcessorReservedMemory(uint32 RestartType) { /* @@ -700,7 +685,7 @@ int32 CFE_PSP_InitProcessorReservedMemory( uint32 RestartType ) * Newly-created segments should already be zeroed out, * but this ensures it. */ - if ( RestartType == CFE_PSP_RST_TYPE_POWERON ) + if (RestartType == CFE_PSP_RST_TYPE_POWERON) { OS_printf("CFE_PSP: Clearing out CFE CDS Shared memory segment.\n"); memset(CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr, 0, CFE_PSP_CDS_SIZE); @@ -710,7 +695,8 @@ int32 CFE_PSP_InitProcessorReservedMemory( uint32 RestartType ) memset(CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockPtr, 0, CFE_PSP_USER_RESERVED_SIZE); memset(CFE_PSP_ReservedMemoryMap.BootPtr, 0, sizeof(*CFE_PSP_ReservedMemoryMap.BootPtr)); - memset(CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr, 0, sizeof(*CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr)); + memset(CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr, 0, + sizeof(*CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr)); /* * If an unclean shutdown occurs, try to do a PROCESSOR reset next. @@ -741,15 +727,14 @@ int32 CFE_PSP_InitProcessorReservedMemory( uint32 RestartType ) */ CFE_PSP_ReservedMemoryMap.BootPtr->ValidityFlag = CFE_PSP_BOOTRECORD_INVALID; - - return(CFE_PSP_SUCCESS); + return (CFE_PSP_SUCCESS); } /****************************************************************************** ** Function: CFE_PSP_DeleteProcessorReservedMemory ** ** Purpose: -** This function cleans up all of the shared memory segments in the +** This function cleans up all of the shared memory segments in the ** Linux/OSX ports. ** ** Arguments: @@ -760,12 +745,12 @@ int32 CFE_PSP_InitProcessorReservedMemory( uint32 RestartType ) */ void CFE_PSP_DeleteProcessorReservedMemory(void) { - - CFE_PSP_DeleteCDS(); - CFE_PSP_DeleteResetArea(); - CFE_PSP_DeleteUserReservedArea(); + + CFE_PSP_DeleteCDS(); + CFE_PSP_DeleteResetArea(); + CFE_PSP_DeleteUserReservedArea(); } - + /* ********************************************************************************* ** ES BSP kernel memory segment functions @@ -787,18 +772,16 @@ void CFE_PSP_DeleteProcessorReservedMemory(void) */ int32 CFE_PSP_GetKernelTextSegmentInfo(cpuaddr *PtrToKernelSegment, uint32 *SizeOfKernelSegment) { - /* - ** Prevent warnings by referencing parameters - */ - if ( PtrToKernelSegment == NULL || SizeOfKernelSegment == NULL ) - { - return(CFE_PSP_ERROR); - } - - return(CFE_PSP_ERROR_NOT_IMPLEMENTED); - -} + /* + ** Prevent warnings by referencing parameters + */ + if (PtrToKernelSegment == NULL || SizeOfKernelSegment == NULL) + { + return (CFE_PSP_ERROR); + } + return (CFE_PSP_ERROR_NOT_IMPLEMENTED); +} /****************************************************************************** ** Function: CFE_PSP_GetCFETextSegmentInfo @@ -815,20 +798,19 @@ int32 CFE_PSP_GetKernelTextSegmentInfo(cpuaddr *PtrToKernelSegment, uint32 *Size */ int32 CFE_PSP_GetCFETextSegmentInfo(cpuaddr *PtrToCFESegment, uint32 *SizeOfCFESegment) { - int32 return_code; - - if ( SizeOfCFESegment == NULL ) - { - return_code = CFE_PSP_ERROR; - } - else - { - *PtrToCFESegment = (cpuaddr)(&_init); - *SizeOfCFESegment = (uint32) (((cpuaddr) &_fini) - ((cpuaddr) &_init)); - - return_code = CFE_PSP_SUCCESS; - } - - return(return_code); -} + int32 return_code; + if (SizeOfCFESegment == NULL) + { + return_code = CFE_PSP_ERROR; + } + else + { + *PtrToCFESegment = (cpuaddr)(&_init); + *SizeOfCFESegment = (uint32)(((cpuaddr)&_fini) - ((cpuaddr)&_init)); + + return_code = CFE_PSP_SUCCESS; + } + + return (return_code); +} diff --git a/fsw/pc-linux/src/cfe_psp_memtab.c b/fsw/pc-linux/src/cfe_psp_memtab.c index e79cf1ce..af22651b 100644 --- a/fsw/pc-linux/src/cfe_psp_memtab.c +++ b/fsw/pc-linux/src/cfe_psp_memtab.c @@ -21,7 +21,7 @@ /* ** File : cfe_psp_memtab.c ** -** Author : Alan Cudmore +** Author : Alan Cudmore ** ** Purpose: Memory Range Table for cFE/PSP. ** @@ -37,23 +37,19 @@ #include "cfe_psp.h" #include "cfe_psp_config.h" - - /* ** Valid memory map for this target. ** If you need to add more entries, increase CFE_PSP_MEM_TABLE_SIZE in the osconfig.h file. */ -CFE_PSP_MemTable_t CFE_PSP_MemoryTable[CFE_PSP_MEM_TABLE_SIZE] = -{ - { CFE_PSP_MEM_RAM, CFE_PSP_MEM_SIZE_DWORD, 0, 0xFFFFFFFF, CFE_PSP_MEM_ATTR_READWRITE }, - { CFE_PSP_MEM_INVALID, 0, 0, 0, CFE_PSP_MEM_ATTR_READWRITE }, - { CFE_PSP_MEM_INVALID, 0, 0, 0, CFE_PSP_MEM_ATTR_READWRITE }, - { CFE_PSP_MEM_INVALID, 0, 0, 0, CFE_PSP_MEM_ATTR_READWRITE }, - { CFE_PSP_MEM_INVALID, 0, 0, 0, CFE_PSP_MEM_ATTR_READWRITE }, - { CFE_PSP_MEM_INVALID, 0, 0, 0, CFE_PSP_MEM_ATTR_READWRITE }, - { CFE_PSP_MEM_INVALID, 0, 0, 0, CFE_PSP_MEM_ATTR_READWRITE }, - { CFE_PSP_MEM_INVALID, 0, 0, 0, CFE_PSP_MEM_ATTR_READWRITE }, - { CFE_PSP_MEM_INVALID, 0, 0, 0, CFE_PSP_MEM_ATTR_READWRITE }, - { CFE_PSP_MEM_INVALID, 0, 0, 0, CFE_PSP_MEM_ATTR_READWRITE }, +CFE_PSP_MemTable_t CFE_PSP_MemoryTable[CFE_PSP_MEM_TABLE_SIZE] = { + {CFE_PSP_MEM_RAM, CFE_PSP_MEM_SIZE_DWORD, 0, 0xFFFFFFFF, CFE_PSP_MEM_ATTR_READWRITE}, + {CFE_PSP_MEM_INVALID, 0, 0, 0, CFE_PSP_MEM_ATTR_READWRITE}, + {CFE_PSP_MEM_INVALID, 0, 0, 0, CFE_PSP_MEM_ATTR_READWRITE}, + {CFE_PSP_MEM_INVALID, 0, 0, 0, CFE_PSP_MEM_ATTR_READWRITE}, + {CFE_PSP_MEM_INVALID, 0, 0, 0, CFE_PSP_MEM_ATTR_READWRITE}, + {CFE_PSP_MEM_INVALID, 0, 0, 0, CFE_PSP_MEM_ATTR_READWRITE}, + {CFE_PSP_MEM_INVALID, 0, 0, 0, CFE_PSP_MEM_ATTR_READWRITE}, + {CFE_PSP_MEM_INVALID, 0, 0, 0, CFE_PSP_MEM_ATTR_READWRITE}, + {CFE_PSP_MEM_INVALID, 0, 0, 0, CFE_PSP_MEM_ATTR_READWRITE}, + {CFE_PSP_MEM_INVALID, 0, 0, 0, CFE_PSP_MEM_ATTR_READWRITE}, }; - diff --git a/fsw/pc-linux/src/cfe_psp_ssr.c b/fsw/pc-linux/src/cfe_psp_ssr.c index c3dc2627..f32b5958 100644 --- a/fsw/pc-linux/src/cfe_psp_ssr.c +++ b/fsw/pc-linux/src/cfe_psp_ssr.c @@ -63,13 +63,11 @@ ** (none) */ -int32 CFE_PSP_InitSSR(uint32 bus, uint32 device, char *DeviceName ) +int32 CFE_PSP_InitSSR(uint32 bus, uint32 device, char *DeviceName) { - int32 Status; + int32 Status; - Status = CFE_PSP_ERROR; - - return(Status); + Status = CFE_PSP_ERROR; + return (Status); } - diff --git a/fsw/pc-linux/src/cfe_psp_start.c b/fsw/pc-linux/src/cfe_psp_start.c index 3e512ba6..9630611d 100644 --- a/fsw/pc-linux/src/cfe_psp_start.c +++ b/fsw/pc-linux/src/cfe_psp_start.c @@ -25,7 +25,7 @@ ** cFE BSP main entry point. ** ** History: -** 2005/07/26 A. Cudmore | Initial version for OS X/Linux +** 2005/07/26 A. Cudmore | Initial version for OS X/Linux ** ******************************************************************************/ @@ -48,7 +48,7 @@ #include /* -** cFE includes +** cFE includes */ #include "common_types.h" #include "osapi.h" @@ -64,25 +64,25 @@ #include #include "cfe_psp_module.h" -#define CFE_PSP_MAIN_FUNCTION (*GLOBAL_CONFIGDATA.CfeConfig->SystemMain) -#define CFE_PSP_1HZ_FUNCTION (*GLOBAL_CONFIGDATA.CfeConfig->System1HzISR) -#define CFE_PSP_NONVOL_STARTUP_FILE (GLOBAL_CONFIGDATA.CfeConfig->NonvolStartupFile) -#define CFE_PSP_CPU_ID (GLOBAL_CONFIGDATA.Default_CpuId) -#define CFE_PSP_CPU_NAME (GLOBAL_CONFIGDATA.Default_CpuName) -#define CFE_PSP_SPACECRAFT_ID (GLOBAL_CONFIGDATA.Default_SpacecraftId) +#define CFE_PSP_MAIN_FUNCTION (*GLOBAL_CONFIGDATA.CfeConfig->SystemMain) +#define CFE_PSP_1HZ_FUNCTION (*GLOBAL_CONFIGDATA.CfeConfig->System1HzISR) +#define CFE_PSP_NONVOL_STARTUP_FILE (GLOBAL_CONFIGDATA.CfeConfig->NonvolStartupFile) +#define CFE_PSP_CPU_ID (GLOBAL_CONFIGDATA.Default_CpuId) +#define CFE_PSP_CPU_NAME (GLOBAL_CONFIGDATA.Default_CpuName) +#define CFE_PSP_SPACECRAFT_ID (GLOBAL_CONFIGDATA.Default_SpacecraftId) /* ** Defines */ -#define CFE_PSP_CPU_NAME_LENGTH 32 +#define CFE_PSP_CPU_NAME_LENGTH 32 #define CFE_PSP_RESET_NAME_LENGTH 10 /* * Limits for task name length in kernel (fixed by Linux/glibc) * For reference see manpage for "pthread_setname_np". */ -#define CFE_PSP_KERNEL_NAME_LENGTH_MAX 16 +#define CFE_PSP_KERNEL_NAME_LENGTH_MAX 16 /* ** Typedefs for this module @@ -92,42 +92,42 @@ ** Structure for the Command line parameters */ typedef struct -{ - char ResetType[CFE_PSP_RESET_NAME_LENGTH]; /* Reset type can be "PO" for Power on or "PR" for Processor Reset */ - uint32 GotResetType; /* did we get the ResetType parameter ? */ - - uint32 SubType; /* Reset Sub Type ( 1 - 5 ) */ - uint32 GotSubType; /* did we get the ResetSubType parameter ? */ - - char CpuName[CFE_PSP_CPU_NAME_LENGTH]; /* CPU Name */ - uint32 GotCpuName; /* Did we get a CPU Name ? */ - - uint32 CpuId; /* CPU ID */ - uint32 GotCpuId; /* Did we get a CPU Id ?*/ - - uint32 SpacecraftId; /* Spacecraft ID */ - uint32 GotSpacecraftId; /* Did we get a Spacecraft ID */ - +{ + char ResetType[CFE_PSP_RESET_NAME_LENGTH]; /* Reset type can be "PO" for Power on or "PR" for Processor Reset */ + uint32 GotResetType; /* did we get the ResetType parameter ? */ + + uint32 SubType; /* Reset Sub Type ( 1 - 5 ) */ + uint32 GotSubType; /* did we get the ResetSubType parameter ? */ + + char CpuName[CFE_PSP_CPU_NAME_LENGTH]; /* CPU Name */ + uint32 GotCpuName; /* Did we get a CPU Name ? */ + + uint32 CpuId; /* CPU ID */ + uint32 GotCpuId; /* Did we get a CPU Id ?*/ + + uint32 SpacecraftId; /* Spacecraft ID */ + uint32 GotSpacecraftId; /* Did we get a Spacecraft ID */ + } CFE_PSP_CommandData_t; /* ** Prototypes for this module */ -void CFE_PSP_TimerHandler (int signum); -void CFE_PSP_DisplayUsage(char *Name ); +void CFE_PSP_TimerHandler(int signum); +void CFE_PSP_DisplayUsage(char *Name); void CFE_PSP_ProcessArgumentDefaults(CFE_PSP_CommandData_t *CommandDataDefault); void CFE_PSP_SetupLocal1Hz(void); /* ** Global variables */ -uint32 TimerCounter; +uint32 TimerCounter; CFE_PSP_CommandData_t CommandData; -uint32 CFE_PSP_SpacecraftId; -uint32 CFE_PSP_CpuId; -char CFE_PSP_CpuName[CFE_PSP_CPU_NAME_LENGTH]; +uint32 CFE_PSP_SpacecraftId; +uint32 CFE_PSP_CpuId; +char CFE_PSP_CpuName[CFE_PSP_CPU_NAME_LENGTH]; -CFE_PSP_IdleTaskState_t CFE_PSP_IdleTaskState; +CFE_PSP_IdleTaskState_t CFE_PSP_IdleTaskState; /* ** getopts parameter passing options string @@ -137,15 +137,13 @@ static const char *optString = "R:S:C:I:N:h"; /* ** getopts_long long form argument table */ -static const struct option longOpts[] = { - { "reset", required_argument, NULL, 'R' }, - { "subtype", required_argument, NULL, 'S' }, - { "cpuid", required_argument, NULL, 'C' }, - { "scid", required_argument, NULL, 'I'}, - { "cpuname", required_argument, NULL, 'N'}, - { "help", no_argument, NULL, 'h' }, - { NULL, no_argument, NULL, 0 } -}; +static const struct option longOpts[] = {{"reset", required_argument, NULL, 'R'}, + {"subtype", required_argument, NULL, 'S'}, + {"cpuid", required_argument, NULL, 'C'}, + {"scid", required_argument, NULL, 'I'}, + {"cpuname", required_argument, NULL, 'N'}, + {"help", no_argument, NULL, 'h'}, + {NULL, no_argument, NULL, 0}}; /****************************************************************************** ** Function: CFE_PSP_OS_EventHandler() @@ -159,40 +157,40 @@ int32 CFE_PSP_OS_EventHandler(OS_Event_t event, osal_id_t object_id, void *data) { char taskname[OS_MAX_API_NAME]; - switch(event) + switch (event) { - case OS_EVENT_RESOURCE_ALLOCATED: - /* resource/id is newly allocated but not yet created. Invoked within locked region. */ - break; - case OS_EVENT_RESOURCE_CREATED: - /* resource/id has been fully created/finalized. Invoked outside locked region. */ - break; - case OS_EVENT_RESOURCE_DELETED: - /* resource/id has been deleted. Invoked outside locked region. */ - break; - case OS_EVENT_TASK_STARTUP: - { - /* New task is starting. Invoked from within the task context. */ - /* Get the name from OSAL and propagate to the pthread/system layer */ - if (OS_GetResourceName(object_id, taskname, sizeof(taskname)) == OS_SUCCESS) + case OS_EVENT_RESOURCE_ALLOCATED: + /* resource/id is newly allocated but not yet created. Invoked within locked region. */ + break; + case OS_EVENT_RESOURCE_CREATED: + /* resource/id has been fully created/finalized. Invoked outside locked region. */ + break; + case OS_EVENT_RESOURCE_DELETED: + /* resource/id has been deleted. Invoked outside locked region. */ + break; + case OS_EVENT_TASK_STARTUP: { - /* - * glibc/kernel has an internal limit for this name. - * If the OSAL name is longer, just truncate it. - * Otherwise the name isn't set at all - this assumes the first - * chars of the name is better for debug than none of it. - */ - if (strlen(taskname) >= CFE_PSP_KERNEL_NAME_LENGTH_MAX) + /* New task is starting. Invoked from within the task context. */ + /* Get the name from OSAL and propagate to the pthread/system layer */ + if (OS_GetResourceName(object_id, taskname, sizeof(taskname)) == OS_SUCCESS) { - taskname[CFE_PSP_KERNEL_NAME_LENGTH_MAX-1] = 0; + /* + * glibc/kernel has an internal limit for this name. + * If the OSAL name is longer, just truncate it. + * Otherwise the name isn't set at all - this assumes the first + * chars of the name is better for debug than none of it. + */ + if (strlen(taskname) >= CFE_PSP_KERNEL_NAME_LENGTH_MAX) + { + taskname[CFE_PSP_KERNEL_NAME_LENGTH_MAX - 1] = 0; + } + pthread_setname_np(pthread_self(), taskname); } - pthread_setname_np(pthread_self(), taskname); + break; } - break; - } - default: - break; + default: + break; } return OS_SUCCESS; @@ -212,270 +210,266 @@ int32 CFE_PSP_OS_EventHandler(OS_Event_t event, osal_id_t object_id, void *data) */ void OS_Application_Startup(void) { - uint32 reset_type; - uint32 reset_subtype; - int32 time_status; - osal_id_t sys_timebase_id; - osal_id_t fs_id; - int opt = 0; - int longIndex = 0; - int32 Status; - char * const * argv; - int argc; - - /* - ** Initialize the CommandData struct - */ - memset(&(CommandData), 0, sizeof(CFE_PSP_CommandData_t)); - - /* - ** Process the arguments with getopt_long(), then - ** start the cFE - */ - argc = OS_BSP_GetArgC(); - argv = OS_BSP_GetArgV(); - opt = getopt_long( argc, argv, optString, longOpts, &longIndex ); - while( opt != -1 ) - { - switch( opt ) - { - case 'R': - strncpy(CommandData.ResetType, optarg, CFE_PSP_RESET_NAME_LENGTH-1); - CommandData.ResetType[CFE_PSP_RESET_NAME_LENGTH-1] = 0; - - if ((strncmp(CommandData.ResetType, "PO", CFE_PSP_RESET_NAME_LENGTH ) != 0 ) && - (strncmp(CommandData.ResetType, "PR", CFE_PSP_RESET_NAME_LENGTH ) != 0 )) - { - printf("\nERROR: Invalid Reset Type: %s\n\n",CommandData.ResetType); - CommandData.GotResetType = 0; - CFE_PSP_DisplayUsage(argv[0]); - break; - } - printf("CFE_PSP: Reset Type: %s\n",(char *)optarg); - CommandData.GotResetType = 1; - break; - - case 'S': - CommandData.SubType = strtol(optarg, NULL, 0 ); - if ( CommandData.SubType < 1 || CommandData.SubType > 5 ) - { - printf("\nERROR: Invalid Reset SubType: %s\n\n",optarg); - CommandData.SubType = 0; - CommandData.GotSubType = 0; - CFE_PSP_DisplayUsage(argv[0]); - break; - } - printf("CFE_PSP: Reset SubType: %d\n",(int)CommandData.SubType); - CommandData.GotSubType = 1; - break; + uint32 reset_type; + uint32 reset_subtype; + int32 time_status; + osal_id_t sys_timebase_id; + osal_id_t fs_id; + int opt = 0; + int longIndex = 0; + int32 Status; + char *const *argv; + int argc; - case 'N': - strncpy(CommandData.CpuName, optarg, CFE_PSP_CPU_NAME_LENGTH-1 ); - CommandData.CpuName[CFE_PSP_CPU_NAME_LENGTH-1] = 0; - printf("CFE_PSP: CPU Name: %s\n",CommandData.CpuName); - CommandData.GotCpuName = 1; - break; + /* + ** Initialize the CommandData struct + */ + memset(&(CommandData), 0, sizeof(CFE_PSP_CommandData_t)); - case 'C': - CommandData.CpuId = strtol(optarg, NULL, 0 ); - printf("CFE_PSP: CPU ID: %d\n",(int)CommandData.CpuId); - CommandData.GotCpuId = 1; - break; + /* + ** Process the arguments with getopt_long(), then + ** start the cFE + */ + argc = OS_BSP_GetArgC(); + argv = OS_BSP_GetArgV(); + opt = getopt_long(argc, argv, optString, longOpts, &longIndex); + while (opt != -1) + { + switch (opt) + { + case 'R': + strncpy(CommandData.ResetType, optarg, CFE_PSP_RESET_NAME_LENGTH - 1); + CommandData.ResetType[CFE_PSP_RESET_NAME_LENGTH - 1] = 0; + + if ((strncmp(CommandData.ResetType, "PO", CFE_PSP_RESET_NAME_LENGTH) != 0) && + (strncmp(CommandData.ResetType, "PR", CFE_PSP_RESET_NAME_LENGTH) != 0)) + { + printf("\nERROR: Invalid Reset Type: %s\n\n", CommandData.ResetType); + CommandData.GotResetType = 0; + CFE_PSP_DisplayUsage(argv[0]); + break; + } + printf("CFE_PSP: Reset Type: %s\n", (char *)optarg); + CommandData.GotResetType = 1; + break; + + case 'S': + CommandData.SubType = strtol(optarg, NULL, 0); + if (CommandData.SubType < 1 || CommandData.SubType > 5) + { + printf("\nERROR: Invalid Reset SubType: %s\n\n", optarg); + CommandData.SubType = 0; + CommandData.GotSubType = 0; + CFE_PSP_DisplayUsage(argv[0]); + break; + } + printf("CFE_PSP: Reset SubType: %d\n", (int)CommandData.SubType); + CommandData.GotSubType = 1; + break; + + case 'N': + strncpy(CommandData.CpuName, optarg, CFE_PSP_CPU_NAME_LENGTH - 1); + CommandData.CpuName[CFE_PSP_CPU_NAME_LENGTH - 1] = 0; + printf("CFE_PSP: CPU Name: %s\n", CommandData.CpuName); + CommandData.GotCpuName = 1; + break; + + case 'C': + CommandData.CpuId = strtol(optarg, NULL, 0); + printf("CFE_PSP: CPU ID: %d\n", (int)CommandData.CpuId); + CommandData.GotCpuId = 1; + break; + + case 'I': + CommandData.SpacecraftId = strtol(optarg, NULL, 0); + printf("CFE_PSP: Spacecraft ID: %d\n", (int)CommandData.SpacecraftId); + CommandData.GotSpacecraftId = 1; + break; + + case 'h': + CFE_PSP_DisplayUsage(argv[0]); + break; + + default: + CFE_PSP_DisplayUsage(argv[0]); + break; + } - case 'I': - CommandData.SpacecraftId = strtol(optarg, NULL, 0 ); - printf("CFE_PSP: Spacecraft ID: %d\n",(int)CommandData.SpacecraftId); - CommandData.GotSpacecraftId = 1; - break; + opt = getopt_long(argc, argv, optString, longOpts, &longIndex); + } /* end while */ - case 'h': - CFE_PSP_DisplayUsage(argv[0]); - break; - - default: - CFE_PSP_DisplayUsage(argv[0]); - break; - } - - opt = getopt_long( argc, argv, optString, longOpts, &longIndex ); - } /* end while */ - - /* - ** Set the defaults for values that were not given for the - ** optional arguments, and check for arguments that are required. - */ - CFE_PSP_ProcessArgumentDefaults(&CommandData); - - /* - ** Assign the Spacecraft ID, CPU ID, and CPU Name - */ - CFE_PSP_SpacecraftId = CommandData.SpacecraftId; - CFE_PSP_CpuId = CommandData.CpuId; - strncpy(CFE_PSP_CpuName, CommandData.CpuName, sizeof(CFE_PSP_CpuName)-1); - CFE_PSP_CpuName[sizeof(CFE_PSP_CpuName)-1] = 0; - - /* - ** Set the reset subtype - */ - reset_subtype = CommandData.SubType; - - - /* - ** Initialize the OS API data structures - */ - Status = OS_API_Init(); - if (Status != OS_SUCCESS) - { - /* irrecoverable error if OS_API_Init() fails. */ - /* note: use printf here, as OS_printf may not work */ - printf("CFE_PSP: OS_API_Init() failure\n"); - CFE_PSP_Panic(Status); - } - - OS_RegisterEventHandler(CFE_PSP_OS_EventHandler); - - /* - * Map the PSP shared memory segments + /* + ** Set the defaults for values that were not given for the + ** optional arguments, and check for arguments that are required. */ - CFE_PSP_SetupReservedMemoryMap(); + CFE_PSP_ProcessArgumentDefaults(&CommandData); - /* - * Prepare for exception handling in the idle task + /* + ** Assign the Spacecraft ID, CPU ID, and CPU Name */ - memset(&CFE_PSP_IdleTaskState, 0, sizeof(CFE_PSP_IdleTaskState)); - CFE_PSP_IdleTaskState.ThreadID = pthread_self(); - - /* - ** Set up the timebase, if OSAL supports it - ** Done here so that the modules can also use it, if desired - ** - ** This is a clock named "cFS-Master" that will serve to drive - ** all time-related CFE functions including the 1Hz signal. - ** - ** Note the timebase is only prepared here; the application is - ** not ready to receive a callback yet, as it hasn't been started. - ** CFE TIME registers its own callback when it is ready to do so. - */ - time_status = OS_TimeBaseCreate(&sys_timebase_id, "cFS-Master", NULL); - if (time_status == OS_SUCCESS) - { - /* - * Set the clock to trigger with 50ms resolution - slow enough that - * it will not hog CPU resources but fast enough to have sufficient resolution - * for most general timing purposes. - * (It may be better to move this to the mission config file) - */ - time_status = OS_TimeBaseSet(sys_timebase_id, 50000, 50000); - } - else - { - /* - * Cannot create a timebase in OSAL. - * - * Note: Most likely this is due to building with - * the old/classic POSIX OSAL which does not support this. - * - * See below for workaround. - */ - sys_timebase_id = OS_OBJECT_ID_UNDEFINED; - } - - /* - ** Set up the virtual FS mapping for the "/cf" directory - ** On this platform it is just a local/relative dir of the same name. - */ - Status = OS_FileSysAddFixedMap(&fs_id, "./cf", "/cf"); - if (Status != OS_SUCCESS) - { - /* Print for informational purposes -- - * startup can continue, but loads may fail later, depending on config. */ - OS_printf("CFE_PSP: OS_FileSysAddFixedMap() failure: %d\n", (int)Status); - } - - /* - ** Initialize the statically linked modules (if any) - ** This is only applicable to CMake build - classic build - ** does not have the logic to selectively include/exclude modules - */ - CFE_PSP_ModuleInit(); - - sleep(1); - - /* - * For informational purposes, show the state of the last exit + CFE_PSP_SpacecraftId = CommandData.SpacecraftId; + CFE_PSP_CpuId = CommandData.CpuId; + strncpy(CFE_PSP_CpuName, CommandData.CpuName, sizeof(CFE_PSP_CpuName) - 1); + CFE_PSP_CpuName[sizeof(CFE_PSP_CpuName) - 1] = 0; + + /* + ** Set the reset subtype */ - if (CFE_PSP_ReservedMemoryMap.BootPtr->ValidityFlag == CFE_PSP_BOOTRECORD_VALID) - { - OS_printf("CFE_PSP: Normal exit from previous cFE instance\n"); - } - else if (CFE_PSP_ReservedMemoryMap.BootPtr->ValidityFlag == CFE_PSP_BOOTRECORD_INVALID) - { - OS_printf("CFE_PSP: Abnormal exit from previous cFE instance\n"); - } - - /* - * determine reset type... - * If not specified at the command line, then check the "boot record" + reset_subtype = CommandData.SubType; + + /* + ** Initialize the OS API data structures */ - reset_type = 0; - if (!CommandData.GotResetType) - { - if (CFE_PSP_ReservedMemoryMap.BootPtr->ValidityFlag == CFE_PSP_BOOTRECORD_VALID || - CFE_PSP_ReservedMemoryMap.BootPtr->ValidityFlag == CFE_PSP_BOOTRECORD_INVALID) - { - reset_type = CFE_PSP_ReservedMemoryMap.BootPtr->NextResetType; - } - } - else if (strncmp("PR", CommandData.ResetType, 2 ) == 0 ) - { - reset_type = CFE_PSP_RST_TYPE_PROCESSOR; - } - - if (reset_type == CFE_PSP_RST_TYPE_PROCESSOR) - { - OS_printf("CFE_PSP: Starting the cFE with a PROCESSOR reset.\n"); - } - else - { - /* catch-all for anything else */ - reset_type = CFE_PSP_RST_TYPE_POWERON; - OS_printf("CFE_PSP: Starting the cFE with a POWER ON reset.\n"); - } - - - /* - ** Initialize the reserved memory - */ - Status = CFE_PSP_InitProcessorReservedMemory(reset_type); - if (Status != CFE_PSP_SUCCESS) - { - OS_printf("CFE_PSP: CFE_PSP_InitProcessorReservedMemory() Failure"); - CFE_PSP_Panic(Status); - } - - /* - ** Call cFE entry point. - */ - CFE_PSP_MAIN_FUNCTION(reset_type, reset_subtype, 1, CFE_PSP_NONVOL_STARTUP_FILE); - - /* - * Backward compatibility for old OSAL. + Status = OS_API_Init(); + if (Status != OS_SUCCESS) + { + /* irrecoverable error if OS_API_Init() fails. */ + /* note: use printf here, as OS_printf may not work */ + printf("CFE_PSP: OS_API_Init() failure\n"); + CFE_PSP_Panic(Status); + } + + OS_RegisterEventHandler(CFE_PSP_OS_EventHandler); + + /* + * Map the PSP shared memory segments + */ + CFE_PSP_SetupReservedMemoryMap(); + + /* + * Prepare for exception handling in the idle task + */ + memset(&CFE_PSP_IdleTaskState, 0, sizeof(CFE_PSP_IdleTaskState)); + CFE_PSP_IdleTaskState.ThreadID = pthread_self(); + + /* + ** Set up the timebase, if OSAL supports it + ** Done here so that the modules can also use it, if desired + ** + ** This is a clock named "cFS-Master" that will serve to drive + ** all time-related CFE functions including the 1Hz signal. + ** + ** Note the timebase is only prepared here; the application is + ** not ready to receive a callback yet, as it hasn't been started. + ** CFE TIME registers its own callback when it is ready to do so. */ - if (!OS_ObjectIdDefined(sys_timebase_id) || time_status != OS_SUCCESS) - { - OS_printf("CFE_PSP: WARNING - Compatibility mode - using local 1Hz Interrupt\n"); - CFE_PSP_SetupLocal1Hz(); - } + time_status = OS_TimeBaseCreate(&sys_timebase_id, "cFS-Master", NULL); + if (time_status == OS_SUCCESS) + { + /* + * Set the clock to trigger with 50ms resolution - slow enough that + * it will not hog CPU resources but fast enough to have sufficient resolution + * for most general timing purposes. + * (It may be better to move this to the mission config file) + */ + time_status = OS_TimeBaseSet(sys_timebase_id, 50000, 50000); + } + else + { + /* + * Cannot create a timebase in OSAL. + * + * Note: Most likely this is due to building with + * the old/classic POSIX OSAL which does not support this. + * + * See below for workaround. + */ + sys_timebase_id = OS_OBJECT_ID_UNDEFINED; + } + /* + ** Set up the virtual FS mapping for the "/cf" directory + ** On this platform it is just a local/relative dir of the same name. + */ + Status = OS_FileSysAddFixedMap(&fs_id, "./cf", "/cf"); + if (Status != OS_SUCCESS) + { + /* Print for informational purposes -- + * startup can continue, but loads may fail later, depending on config. */ + OS_printf("CFE_PSP: OS_FileSysAddFixedMap() failure: %d\n", (int)Status); + } + + /* + ** Initialize the statically linked modules (if any) + ** This is only applicable to CMake build - classic build + ** does not have the logic to selectively include/exclude modules + */ + CFE_PSP_ModuleInit(); + + sleep(1); + + /* + * For informational purposes, show the state of the last exit + */ + if (CFE_PSP_ReservedMemoryMap.BootPtr->ValidityFlag == CFE_PSP_BOOTRECORD_VALID) + { + OS_printf("CFE_PSP: Normal exit from previous cFE instance\n"); + } + else if (CFE_PSP_ReservedMemoryMap.BootPtr->ValidityFlag == CFE_PSP_BOOTRECORD_INVALID) + { + OS_printf("CFE_PSP: Abnormal exit from previous cFE instance\n"); + } + + /* + * determine reset type... + * If not specified at the command line, then check the "boot record" + */ + reset_type = 0; + if (!CommandData.GotResetType) + { + if (CFE_PSP_ReservedMemoryMap.BootPtr->ValidityFlag == CFE_PSP_BOOTRECORD_VALID || + CFE_PSP_ReservedMemoryMap.BootPtr->ValidityFlag == CFE_PSP_BOOTRECORD_INVALID) + { + reset_type = CFE_PSP_ReservedMemoryMap.BootPtr->NextResetType; + } + } + else if (strncmp("PR", CommandData.ResetType, 2) == 0) + { + reset_type = CFE_PSP_RST_TYPE_PROCESSOR; + } + + if (reset_type == CFE_PSP_RST_TYPE_PROCESSOR) + { + OS_printf("CFE_PSP: Starting the cFE with a PROCESSOR reset.\n"); + } + else + { + /* catch-all for anything else */ + reset_type = CFE_PSP_RST_TYPE_POWERON; + OS_printf("CFE_PSP: Starting the cFE with a POWER ON reset.\n"); + } + + /* + ** Initialize the reserved memory + */ + Status = CFE_PSP_InitProcessorReservedMemory(reset_type); + if (Status != CFE_PSP_SUCCESS) + { + OS_printf("CFE_PSP: CFE_PSP_InitProcessorReservedMemory() Failure"); + CFE_PSP_Panic(Status); + } + + /* + ** Call cFE entry point. + */ + CFE_PSP_MAIN_FUNCTION(reset_type, reset_subtype, 1, CFE_PSP_NONVOL_STARTUP_FILE); + + /* + * Backward compatibility for old OSAL. + */ + if (!OS_ObjectIdDefined(sys_timebase_id) || time_status != OS_SUCCESS) + { + OS_printf("CFE_PSP: WARNING - Compatibility mode - using local 1Hz Interrupt\n"); + CFE_PSP_SetupLocal1Hz(); + } } void OS_Application_Run(void) { - int sig; - int ret; + int sig; + int ret; sigset_t sigset; - /* * Now that all main tasks are created, * this original thread will exist just to service signals @@ -511,22 +505,21 @@ void OS_Application_Run(void) /* go idle and wait for an event */ ret = sigwait(&sigset, &sig); - if (ret == 0 && !CFE_PSP_IdleTaskState.ShutdownReq && - sig == CFE_PSP_EXCEPTION_EVENT_SIGNAL && - GLOBAL_CFE_CONFIGDATA.SystemNotify != NULL) + if (ret == 0 && !CFE_PSP_IdleTaskState.ShutdownReq && sig == CFE_PSP_EXCEPTION_EVENT_SIGNAL && + GLOBAL_CFE_CONFIGDATA.SystemNotify != NULL) { /* notify the CFE of the event */ GLOBAL_CFE_CONFIGDATA.SystemNotify(); } } - /* - * This happens if an unhandled exception occurs, or if the user presses CTRL+C - */ - OS_printf("\nCFE_PSP: Shutdown initiated - Exiting cFE\n"); - OS_TaskDelay(100); + /* + * This happens if an unhandled exception occurs, or if the user presses CTRL+C + */ + OS_printf("\nCFE_PSP: Shutdown initiated - Exiting cFE\n"); + OS_TaskDelay(100); - OS_DeleteAllObjects(); + OS_DeleteAllObjects(); } /****************************************************************************** @@ -542,15 +535,16 @@ void OS_Application_Run(void) ** Return: ** (none) */ -void CFE_PSP_TimerHandler (int signum) +void CFE_PSP_TimerHandler(int signum) { - /* - ** call the CFE_TIME 1hz ISR - */ - if((TimerCounter % 4) == 0) CFE_PSP_1HZ_FUNCTION(); + /* + ** call the CFE_TIME 1hz ISR + */ + if ((TimerCounter % 4) == 0) + CFE_PSP_1HZ_FUNCTION(); - /* update timer counter */ - TimerCounter++; + /* update timer counter */ + TimerCounter++; } /****************************************************************************** @@ -565,47 +559,48 @@ void CFE_PSP_TimerHandler (int signum) ** Return: ** (none) */ -void CFE_PSP_DisplayUsage(char *Name ) +void CFE_PSP_DisplayUsage(char *Name) { - printf("usage : %s [-R ] [-S ] [-C ] [-S ] [-C GotSubType == 0 ) - { - CommandDataDefault->SubType = 1; - printf("CFE_PSP: Default Reset SubType = 1\n"); - CommandDataDefault->GotSubType = 1; - } - - if ( CommandDataDefault->GotCpuId == 0 ) - { - CommandDataDefault->CpuId = CFE_PSP_CPU_ID; - printf("CFE_PSP: Default CPU ID = %d\n",CFE_PSP_CPU_ID); - CommandDataDefault->GotCpuId = 1; - } - - if ( CommandDataDefault->GotSpacecraftId == 0 ) - { - CommandDataDefault->SpacecraftId = CFE_PSP_SPACECRAFT_ID; - printf("CFE_PSP: Default Spacecraft ID = %d\n",CFE_PSP_SPACECRAFT_ID); - CommandDataDefault->GotSpacecraftId = 1; - } - - if ( CommandDataDefault->GotCpuName == 0 ) - { - strncpy(CommandDataDefault->CpuName, CFE_PSP_CPU_NAME, CFE_PSP_CPU_NAME_LENGTH-1 ); - CommandDataDefault->CpuName[CFE_PSP_CPU_NAME_LENGTH-1] = 0; - printf("CFE_PSP: Default CPU Name: %s\n",CFE_PSP_CPU_NAME); - CommandDataDefault->GotCpuName = 1; - } + if (CommandDataDefault->GotSubType == 0) + { + CommandDataDefault->SubType = 1; + printf("CFE_PSP: Default Reset SubType = 1\n"); + CommandDataDefault->GotSubType = 1; + } + + if (CommandDataDefault->GotCpuId == 0) + { + CommandDataDefault->CpuId = CFE_PSP_CPU_ID; + printf("CFE_PSP: Default CPU ID = %d\n", CFE_PSP_CPU_ID); + CommandDataDefault->GotCpuId = 1; + } + + if (CommandDataDefault->GotSpacecraftId == 0) + { + CommandDataDefault->SpacecraftId = CFE_PSP_SPACECRAFT_ID; + printf("CFE_PSP: Default Spacecraft ID = %d\n", CFE_PSP_SPACECRAFT_ID); + CommandDataDefault->GotSpacecraftId = 1; + } + if (CommandDataDefault->GotCpuName == 0) + { + strncpy(CommandDataDefault->CpuName, CFE_PSP_CPU_NAME, CFE_PSP_CPU_NAME_LENGTH - 1); + CommandDataDefault->CpuName[CFE_PSP_CPU_NAME_LENGTH - 1] = 0; + printf("CFE_PSP: Default CPU Name: %s\n", CFE_PSP_CPU_NAME); + CommandDataDefault->GotCpuName = 1; + } } /****************************************************************************** @@ -672,9 +666,9 @@ void CFE_PSP_ProcessArgumentDefaults(CFE_PSP_CommandData_t *CommandDataDefault) void CFE_PSP_SetupLocal1Hz(void) { - struct sigaction sa; - struct itimerval timer; - int ret; + struct sigaction sa; + struct itimerval timer; + int ret; /* ** Init timer counter @@ -684,7 +678,7 @@ void CFE_PSP_SetupLocal1Hz(void) /* ** Install timer_handler as the signal handler for SIGALRM. */ - memset (&sa, 0, sizeof (sa)); + memset(&sa, 0, sizeof(sa)); sa.sa_handler = &CFE_PSP_TimerHandler; /* @@ -694,12 +688,12 @@ void CFE_PSP_SetupLocal1Hz(void) ** only on every 4th timer tick. previous versions of the ** PSP did it this way, so this is preserved here). */ - timer.it_value.tv_sec = 0; - timer.it_value.tv_usec = 250000; + timer.it_value.tv_sec = 0; + timer.it_value.tv_usec = 250000; timer.it_interval.tv_sec = 0; timer.it_interval.tv_usec = 250000; - ret = sigaction (SIGALRM, &sa, NULL); + ret = sigaction(SIGALRM, &sa, NULL); if (ret < 0) { @@ -707,11 +701,10 @@ void CFE_PSP_SetupLocal1Hz(void) } else { - ret = setitimer (ITIMER_REAL, &timer, NULL); + ret = setitimer(ITIMER_REAL, &timer, NULL); if (ret < 0) { OS_printf("CFE_PSP: setitimer() error %d: %s \n", ret, strerror(errno)); } } } - diff --git a/fsw/pc-linux/src/cfe_psp_support.c b/fsw/pc-linux/src/cfe_psp_support.c index 9705efc3..019e7dbc 100644 --- a/fsw/pc-linux/src/cfe_psp_support.c +++ b/fsw/pc-linux/src/cfe_psp_support.c @@ -46,14 +46,12 @@ #include "cfe_psp_config.h" #include "cfe_psp_memory.h" - /* ** External Variables */ -extern uint32 CFE_PSP_SpacecraftId; -extern uint32 CFE_PSP_CpuId; -extern char CFE_PSP_CpuName[]; - +extern uint32 CFE_PSP_SpacecraftId; +extern uint32 CFE_PSP_CpuId; +extern char CFE_PSP_CpuName[]; /****************************************************************************** ** Function: CFE_PSP_Restart() @@ -70,53 +68,52 @@ extern char CFE_PSP_CpuName[]; void CFE_PSP_Restart(uint32 reset_type) { - if ( reset_type == CFE_PSP_RST_TYPE_POWERON ) - { - OS_printf("CFE_PSP: Exiting cFE with POWERON Reset status.\n"); - - /* Also delete the SHM segments, so they will be recreated on next boot */ - /* Deleting these memories will unlink them, but active references should still work */ - CFE_PSP_DeleteProcessorReservedMemory(); - } - else - { - OS_printf("CFE_PSP: Exiting cFE with PROCESSOR Reset status.\n"); - } - - /* - * Record the reset type for the next boot. - */ - CFE_PSP_ReservedMemoryMap.BootPtr->NextResetType = reset_type; - CFE_PSP_ReservedMemoryMap.BootPtr->ValidityFlag = CFE_PSP_BOOTRECORD_VALID; - - /* - * Begin process of orderly shutdown. - * - * This should cause the original thread (main task) to wake up - * and start the shutdown procedure. - */ - CFE_PSP_IdleTaskState.ShutdownReq = true; - pthread_kill(CFE_PSP_IdleTaskState.ThreadID, CFE_PSP_EXCEPTION_EVENT_SIGNAL); - - /* - * Give time for the orderly shutdown to occur. - * - * Normally during shutdown this task will be deleted, and therefore - * this does not return. - * - * However, if problems occur (e.g. deadlock) eventually this timeout - * will expire and return. - */ - OS_TaskDelay(CFE_PSP_RESTART_DELAY); - - /* - * Timeout expired without this task being deleted, so abort(). - * - * This should generate a core file to reveal what went wrong - * with normal shutdown. - */ - abort(); - + if (reset_type == CFE_PSP_RST_TYPE_POWERON) + { + OS_printf("CFE_PSP: Exiting cFE with POWERON Reset status.\n"); + + /* Also delete the SHM segments, so they will be recreated on next boot */ + /* Deleting these memories will unlink them, but active references should still work */ + CFE_PSP_DeleteProcessorReservedMemory(); + } + else + { + OS_printf("CFE_PSP: Exiting cFE with PROCESSOR Reset status.\n"); + } + + /* + * Record the reset type for the next boot. + */ + CFE_PSP_ReservedMemoryMap.BootPtr->NextResetType = reset_type; + CFE_PSP_ReservedMemoryMap.BootPtr->ValidityFlag = CFE_PSP_BOOTRECORD_VALID; + + /* + * Begin process of orderly shutdown. + * + * This should cause the original thread (main task) to wake up + * and start the shutdown procedure. + */ + CFE_PSP_IdleTaskState.ShutdownReq = true; + pthread_kill(CFE_PSP_IdleTaskState.ThreadID, CFE_PSP_EXCEPTION_EVENT_SIGNAL); + + /* + * Give time for the orderly shutdown to occur. + * + * Normally during shutdown this task will be deleted, and therefore + * this does not return. + * + * However, if problems occur (e.g. deadlock) eventually this timeout + * will expire and return. + */ + OS_TaskDelay(CFE_PSP_RESTART_DELAY); + + /* + * Timeout expired without this task being deleted, so abort(). + * + * This should generate a core file to reveal what went wrong + * with normal shutdown. + */ + abort(); } /****************************************************************************** @@ -135,12 +132,11 @@ void CFE_PSP_Restart(uint32 reset_type) void CFE_PSP_Panic(int32 ErrorCode) { - OS_printf("CFE_PSP_Panic Called with error code = 0x%08X. Exiting.\n",(unsigned int)ErrorCode); - OS_printf("The cFE could not start.\n"); - abort(); /* abort() is preferable to exit(-1), as it may create a core file for debug */ + OS_printf("CFE_PSP_Panic Called with error code = 0x%08X. Exiting.\n", (unsigned int)ErrorCode); + OS_printf("The cFE could not start.\n"); + abort(); /* abort() is preferable to exit(-1), as it may create a core file for debug */ } - /****************************************************************************** ** Function: CFE_PSP_FlushCaches) ** @@ -154,9 +150,9 @@ void CFE_PSP_Panic(int32 ErrorCode) ** Return: ** (none) */ -void CFE_PSP_FlushCaches(uint32 type, void* address, uint32 size) +void CFE_PSP_FlushCaches(uint32 type, void *address, uint32 size) { - printf("CFE_PSP_FlushCaches called -- Currently no Linux/OSX/Cygwin implementation\n"); + printf("CFE_PSP_FlushCaches called -- Currently no Linux/OSX/Cygwin implementation\n"); } /* @@ -176,12 +172,11 @@ void CFE_PSP_FlushCaches(uint32 type, void* address, uint32 size) ** ** Return Values: Processor ID */ -uint32 CFE_PSP_GetProcessorId (void) +uint32 CFE_PSP_GetProcessorId(void) { - return(CFE_PSP_CpuId); + return (CFE_PSP_CpuId); } - /* ** Name: CFE_PSP_GetSpacecraftId ** @@ -197,9 +192,9 @@ uint32 CFE_PSP_GetProcessorId (void) ** ** Return Values: Spacecraft ID */ -uint32 CFE_PSP_GetSpacecraftId (void) +uint32 CFE_PSP_GetSpacecraftId(void) { - return(CFE_PSP_SpacecraftId); + return (CFE_PSP_SpacecraftId); } /* @@ -217,8 +212,7 @@ uint32 CFE_PSP_GetSpacecraftId (void) ** ** Return Values: Processor name */ -const char *CFE_PSP_GetProcessorName (void) +const char *CFE_PSP_GetProcessorName(void) { - return(CFE_PSP_CpuName); + return (CFE_PSP_CpuName); } - diff --git a/fsw/pc-linux/src/cfe_psp_timer.c b/fsw/pc-linux/src/cfe_psp_timer.c index 487e308d..f047dca7 100644 --- a/fsw/pc-linux/src/cfe_psp_timer.c +++ b/fsw/pc-linux/src/cfe_psp_timer.c @@ -35,7 +35,6 @@ ** Include Files */ - /* ** cFE includes */ @@ -53,18 +52,24 @@ */ #include "cfe_psp.h" - /******************* Macro Definitions ***********************/ -#define CFE_PSP_TIMER_TICKS_PER_SECOND 1000000 /* Resolution of the least significant 32 bits of the 64 bit - time stamp returned by OS_BSPGet_Timebase in timer ticks per second. - The timer resolution for accuracy should not be any slower than 1000000 - ticks per second or 1 us per tick */ -#define CFE_PSP_TIMER_LOW32_ROLLOVER 1000000 /* The number that the least significant 32 bits of the 64 bit - time stamp returned by OS_BSPGet_Timebase rolls over. If the lower 32 - bits rolls at 1 second, then the OS_BSP_TIMER_LOW32_ROLLOVER will be 1000000. - if the lower 32 bits rolls at its maximum value (2^32) then - OS_BSP_TIMER_LOW32_ROLLOVER will be 0. */ +/** + * \brief Resolution of the least significant 32 bits of the 64 bit + * time stamp returned by OS_BSPGet_Timebase in timer ticks per second. + * The timer resolution for accuracy should not be any slower than 1000000 + * ticks per second or 1 us per tick + */ +#define CFE_PSP_TIMER_TICKS_PER_SECOND 1000000 + +/** + * \brief The number that the least significant 32 bits of the 64 bit + * time stamp returned by OS_BSPGet_Timebase rolls over. If the lower 32 + * bits rolls at 1 second, then the OS_BSP_TIMER_LOW32_ROLLOVER will be 1000000. + * if the lower 32 bits rolls at its maximum value (2^32) then + * OS_BSP_TIMER_LOW32_ROLLOVER will be 0. + */ +#define CFE_PSP_TIMER_LOW32_ROLLOVER 1000000 /****************************************************************************** ** Function: CFE_PSP_GetTime() @@ -74,7 +79,7 @@ ** Arguments: LocalTime - where the time is returned through ******************************************************************************/ -void CFE_PSP_GetTime( OS_time_t *LocalTime) +void CFE_PSP_GetTime(OS_time_t *LocalTime) { /* since we don't have a hardware register to access like the mcp750, @@ -82,9 +87,7 @@ void CFE_PSP_GetTime( OS_time_t *LocalTime) OS_GetLocalTime(LocalTime); -}/* end CFE_PSP_GetLocalTime */ - - +} /* end CFE_PSP_GetLocalTime */ /****************************************************************************** ** Function: CFE_PSP_Get_Timer_Tick() @@ -101,8 +104,8 @@ void CFE_PSP_GetTime( OS_time_t *LocalTime) */ uint32 CFE_PSP_Get_Timer_Tick(void) { - /* SUB -add function call code*/ - return (0); + /* SUB -add function call code*/ + return (0); } /****************************************************************************** @@ -122,7 +125,7 @@ uint32 CFE_PSP_Get_Timer_Tick(void) */ uint32 CFE_PSP_GetTimerTicksPerSecond(void) { - return(CFE_PSP_TIMER_TICKS_PER_SECOND); + return (CFE_PSP_TIMER_TICKS_PER_SECOND); } /****************************************************************************** @@ -143,7 +146,7 @@ uint32 CFE_PSP_GetTimerTicksPerSecond(void) */ uint32 CFE_PSP_GetTimerLow32Rollover(void) { - return(CFE_PSP_TIMER_LOW32_ROLLOVER); + return (CFE_PSP_TIMER_LOW32_ROLLOVER); } /****************************************************************************** @@ -159,13 +162,13 @@ uint32 CFE_PSP_GetTimerLow32Rollover(void) ** Return: ** Timebase register value */ -void CFE_PSP_Get_Timebase(uint32 *Tbu, uint32* Tbl) +void CFE_PSP_Get_Timebase(uint32 *Tbu, uint32 *Tbl) { - OS_time_t time; + OS_time_t time; - OS_GetLocalTime(&time); - *Tbu = OS_TimeGetTotalSeconds(time); - *Tbl = OS_TimeGetMicrosecondsPart(time); + OS_GetLocalTime(&time); + *Tbu = OS_TimeGetTotalSeconds(time); + *Tbl = OS_TimeGetMicrosecondsPart(time); } /****************************************************************************** @@ -184,7 +187,6 @@ void CFE_PSP_Get_Timebase(uint32 *Tbu, uint32* Tbl) uint32 CFE_PSP_Get_Dec(void) { - /* SUB -add function call code*/ - return(0); + /* SUB -add function call code*/ + return (0); } - diff --git a/fsw/pc-linux/src/cfe_psp_watchdog.c b/fsw/pc-linux/src/cfe_psp_watchdog.c index c9e03e58..ed6949da 100644 --- a/fsw/pc-linux/src/cfe_psp_watchdog.c +++ b/fsw/pc-linux/src/cfe_psp_watchdog.c @@ -35,7 +35,6 @@ ** Include Files */ - /* ** cFE includes */ @@ -75,16 +74,14 @@ uint32 CFE_PSP_WatchdogValue = CFE_PSP_WATCHDOG_MAX; void CFE_PSP_WatchdogInit(void) { - /* - ** Just set it to a value right now - ** The pc-linux desktop platform does not actually implement a watchdog - ** timeout ( but could with a signal ) - */ - CFE_PSP_WatchdogValue = CFE_PSP_WATCHDOG_MAX; - + /* + ** Just set it to a value right now + ** The pc-linux desktop platform does not actually implement a watchdog + ** timeout ( but could with a signal ) + */ + CFE_PSP_WatchdogValue = CFE_PSP_WATCHDOG_MAX; } - /****************************************************************************** ** Function: CFE_PSP_WatchdogEnable() ** @@ -95,11 +92,7 @@ void CFE_PSP_WatchdogInit(void) ** ** Return: */ -void CFE_PSP_WatchdogEnable(void) -{ - -} - +void CFE_PSP_WatchdogEnable(void) {} /****************************************************************************** ** Function: CFE_PSP_WatchdogDisable() @@ -111,10 +104,7 @@ void CFE_PSP_WatchdogEnable(void) ** ** Return: */ -void CFE_PSP_WatchdogDisable(void) -{ - -} +void CFE_PSP_WatchdogDisable(void) {} /****************************************************************************** ** Function: CFE_PSP_WatchdogService() @@ -132,44 +122,39 @@ void CFE_PSP_WatchdogDisable(void) ** Notes: ** */ -void CFE_PSP_WatchdogService(void) -{ - - -} +void CFE_PSP_WatchdogService(void) {} /****************************************************************************** ** Function: CFE_PSP_WatchdogGet ** ** Purpose: -** Get the current watchdog value. +** Get the current watchdog value. ** ** Arguments: -** none +** none ** ** Return: -** the current watchdog value +** the current watchdog value ** ** Notes: ** */ uint32 CFE_PSP_WatchdogGet(void) { - return(CFE_PSP_WatchdogValue); + return (CFE_PSP_WatchdogValue); } - /****************************************************************************** ** Function: CFE_PSP_WatchdogSet ** ** Purpose: -** Get the current watchdog value. +** Get the current watchdog value. ** ** Arguments: -** The new watchdog value +** The new watchdog value ** ** Return: -** nothing +** nothing ** ** Notes: ** @@ -178,6 +163,4 @@ void CFE_PSP_WatchdogSet(uint32 WatchdogValue) { CFE_PSP_WatchdogValue = WatchdogValue; - } - diff --git a/fsw/pc-rtems/inc/cfe_psp_config.h b/fsw/pc-rtems/inc/cfe_psp_config.h index 176f941e..376d2f75 100644 --- a/fsw/pc-rtems/inc/cfe_psp_config.h +++ b/fsw/pc-rtems/inc/cfe_psp_config.h @@ -26,8 +26,6 @@ #ifndef _cfe_psp_config_ #define _cfe_psp_config_ - - #include "common_types.h" #include @@ -43,8 +41,7 @@ * * It must always be a power of two. */ -#define CFE_PSP_MAX_EXCEPTION_ENTRIES 1 - +#define CFE_PSP_MAX_EXCEPTION_ENTRIES 1 /* ** Typedef for the layout of the header in the reserved memory block @@ -56,7 +53,6 @@ typedef struct } CFE_PSP_ReservedMemoryBootRecord_t; - /** * \brief The data type used by the underlying OS to represent a thread ID. */ @@ -75,12 +71,11 @@ typedef struct uint32 reserved; /* prevent empty structure */ } CFE_PSP_Exception_ContextDataEntry_t; - /* ** Watchdog minimum and maximum values ( in milliseconds ) */ #define CFE_PSP_WATCHDOG_MIN (0) -#define CFE_PSP_WATCHDOG_MAX (0xFFFFFFFF) +#define CFE_PSP_WATCHDOG_MAX (0xFFFFFFFF) /* ** Number of EEPROM banks on this platform @@ -95,9 +90,6 @@ typedef struct * Using 128 bytes as this is the cache line size of many * modern processors. */ -#define CFE_PSP_MEMALIGN_MASK ((cpuaddr)0x7F) - - +#define CFE_PSP_MEMALIGN_MASK ((cpuaddr)0x7F) #endif - diff --git a/fsw/pc-rtems/inc/psp_version.h b/fsw/pc-rtems/inc/psp_version.h index 3586186b..63daffcd 100644 --- a/fsw/pc-rtems/inc/psp_version.h +++ b/fsw/pc-rtems/inc/psp_version.h @@ -38,7 +38,9 @@ #define CFE_PSP_IMPL_MAJOR_VERSION 1 /*!< @brief ONLY APPLY for OFFICIAL releases. Major version number. */ #define CFE_PSP_IMPL_MINOR_VERSION 4 /*!< @brief ONLY APPLY for OFFICIAL releases. Minor version number. */ #define CFE_PSP_IMPL_REVISION 0 /*!< @brief ONLY APPLY for OFFICIAL releases. Revision number. */ -#define CFE_PSP_IMPL_MISSION_REV 99 /*!< @brief ONLY APPLY for OFFICIAL releases. Revision version number. A value of "99" indicates an unreleased development version. */ +#define CFE_PSP_IMPL_MISSION_REV \ + 99 /*!< @brief ONLY APPLY for OFFICIAL releases. Revision version number. A value of "99" indicates an unreleased \ + development version. */ /* * Tools to construct version string diff --git a/fsw/pc-rtems/src/cfe_psp_exception.c b/fsw/pc-rtems/src/cfe_psp_exception.c index 5570505f..18830995 100644 --- a/fsw/pc-rtems/src/cfe_psp_exception.c +++ b/fsw/pc-rtems/src/cfe_psp_exception.c @@ -25,7 +25,7 @@ ** m5235bcc Coldfire RTEMS Version ** ** Purpose: -** cFE BSP Exception related functions. +** cFE BSP Exception related functions. ** ** History: ** 2007/09/23 A. Cudmore | RTEMS Coldfire m5235bcc version @@ -39,12 +39,12 @@ #include /* -** cFE includes +** cFE includes */ #include "common_types.h" #include "osapi.h" -#include "cfe_psp.h" +#include "cfe_psp.h" #include "cfe_psp_config.h" #include "cfe_psp_memory.h" #include "cfe_psp_exceptionstorage_types.h" @@ -56,7 +56,6 @@ ** */ - /*************************************************************************** ** FUNCTIONS DEFINITIONS ***************************************************************************/ @@ -64,7 +63,7 @@ /* ** ** Name: CFE_PSP_AttachExceptions -** +** ** Purpose: No-op on this platform, implemented for API compatibility. ** */ @@ -79,14 +78,12 @@ void CFE_PSP_AttachExceptions(void) * * Purpose: Translate a stored exception log entry into a summary string */ -int32 CFE_PSP_ExceptionGetSummary_Impl(const CFE_PSP_Exception_LogData_t* Buffer, char *ReasonBuf, uint32 ReasonSize) +int32 CFE_PSP_ExceptionGetSummary_Impl(const CFE_PSP_Exception_LogData_t *Buffer, char *ReasonBuf, uint32 ReasonSize) { /* exceptions are not yet implemented on this platform */ return CFE_PSP_ERROR_NOT_IMPLEMENTED; } - - /* ** ** Name: CFE_PSP_SetDefaultExceptionEnvironment @@ -98,6 +95,5 @@ int32 CFE_PSP_ExceptionGetSummary_Impl(const CFE_PSP_Exception_LogData_t* Buffer */ void CFE_PSP_SetDefaultExceptionEnvironment(void) { - return; + return; } - diff --git a/fsw/pc-rtems/src/cfe_psp_memory.c b/fsw/pc-rtems/src/cfe_psp_memory.c index 7f9068a0..52bbb260 100644 --- a/fsw/pc-rtems/src/cfe_psp_memory.c +++ b/fsw/pc-rtems/src/cfe_psp_memory.c @@ -24,7 +24,7 @@ ** mcf5235 Coldfire RTEMS version ** ** Purpose: -** cFE PSP Memory related functions. This is the implementation of the cFE +** cFE PSP Memory related functions. This is the implementation of the cFE ** memory areas that have to be preserved, and the API that is designed to allow ** acccess to them. It also contains memory related routines to return the ** address of the kernel code used in the cFE checksum. @@ -41,7 +41,7 @@ #include /* -** cFE includes +** cFE includes */ #include "common_types.h" #include "osapi.h" @@ -49,8 +49,8 @@ /* ** Types and prototypes for this module */ -#include "cfe_psp.h" -#include "cfe_psp_memory.h" +#include "cfe_psp.h" +#include "cfe_psp_memory.h" #include "cfe_psp_config.h" /* @@ -62,21 +62,18 @@ * Define the PSP-supported capacities to be the maximum allowed, * (since the PC-linux PSP has the advantage of abundant disk space to hold this) */ -#define CFE_PSP_CDS_SIZE (GLOBAL_CONFIGDATA.CfeConfig->CdsSize) -#define CFE_PSP_RESET_AREA_SIZE (GLOBAL_CONFIGDATA.CfeConfig->ResetAreaSize) -#define CFE_PSP_USER_RESERVED_SIZE (GLOBAL_CONFIGDATA.CfeConfig->UserReservedSize) -#define CFE_PSP_RAM_DISK_SECTOR_SIZE (GLOBAL_CONFIGDATA.CfeConfig->RamDiskSectorSize) -#define CFE_PSP_RAM_DISK_NUM_SECTORS (GLOBAL_CONFIGDATA.CfeConfig->RamDiskTotalSectors) - +#define CFE_PSP_CDS_SIZE (GLOBAL_CONFIGDATA.CfeConfig->CdsSize) +#define CFE_PSP_RESET_AREA_SIZE (GLOBAL_CONFIGDATA.CfeConfig->ResetAreaSize) +#define CFE_PSP_USER_RESERVED_SIZE (GLOBAL_CONFIGDATA.CfeConfig->UserReservedSize) +#define CFE_PSP_RAM_DISK_SECTOR_SIZE (GLOBAL_CONFIGDATA.CfeConfig->RamDiskSectorSize) +#define CFE_PSP_RAM_DISK_NUM_SECTORS (GLOBAL_CONFIGDATA.CfeConfig->RamDiskTotalSectors) typedef struct { CFE_PSP_ReservedMemoryBootRecord_t BootRecord; - CFE_PSP_ExceptionStorage_t ExceptionStorage; + CFE_PSP_ExceptionStorage_t ExceptionStorage; } CFE_PSP_RtemsReservedAreaFixedLayout_t; - - /* ** External Declarations */ @@ -88,12 +85,10 @@ typedef struct /* ** Dynamic map of the reserved memory area */ -CFE_PSP_ReservedMemoryMap_t CFE_PSP_ReservedMemoryMap = { 0 }; - +CFE_PSP_ReservedMemoryMap_t CFE_PSP_ReservedMemoryMap = {0}; CFE_PSP_MemoryBlock_t PcRtems_ReservedMemBlock; - /* ********************************************************************************* ** CDS related functions @@ -103,7 +98,7 @@ CFE_PSP_MemoryBlock_t PcRtems_ReservedMemBlock; /****************************************************************************** ** Function: CFE_PSP_GetCDSSize ** -** Purpose: +** Purpose: ** This function fetches the size of the OS Critical Data Store area. ** ** Arguments: @@ -115,18 +110,18 @@ CFE_PSP_MemoryBlock_t PcRtems_ReservedMemBlock; int32 CFE_PSP_GetCDSSize(uint32 *SizeOfCDS) { - int32 return_code; - - if ( SizeOfCDS == NULL ) - { - return_code = OS_ERROR; - } - else - { - *SizeOfCDS = CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize; - return_code = OS_SUCCESS; - } - return(return_code); + int32 return_code; + + if (SizeOfCDS == NULL) + { + return_code = OS_ERROR; + } + else + { + *SizeOfCDS = CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize; + return_code = OS_SUCCESS; + } + return (return_code); } /****************************************************************************** @@ -143,35 +138,34 @@ int32 CFE_PSP_GetCDSSize(uint32 *SizeOfCDS) */ int32 CFE_PSP_WriteToCDS(const void *PtrToDataToWrite, uint32 CDSOffset, uint32 NumBytes) { - uint8 *CopyPtr; - int32 return_code; - - if ( PtrToDataToWrite == NULL ) - { - return_code = OS_ERROR; - } - else - { - if ( (CDSOffset < CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize ) && - ( (CDSOffset + NumBytes) <= CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize )) - { - CopyPtr = CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr; - CopyPtr += CDSOffset; - memcpy((char *)CopyPtr, (char *)PtrToDataToWrite,NumBytes); - - return_code = OS_SUCCESS; - } - else - { - return_code = OS_ERROR; - } - - } /* end if PtrToDataToWrite == NULL */ - - return(return_code); + uint8 *CopyPtr; + int32 return_code; + + if (PtrToDataToWrite == NULL) + { + return_code = OS_ERROR; + } + else + { + if ((CDSOffset < CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize) && + ((CDSOffset + NumBytes) <= CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize)) + { + CopyPtr = CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr; + CopyPtr += CDSOffset; + memcpy((char *)CopyPtr, (char *)PtrToDataToWrite, NumBytes); + + return_code = OS_SUCCESS; + } + else + { + return_code = OS_ERROR; + } + + } /* end if PtrToDataToWrite == NULL */ + + return (return_code); } - /****************************************************************************** ** Function: CFE_PSP_ReadFromCDS ** @@ -187,33 +181,32 @@ int32 CFE_PSP_WriteToCDS(const void *PtrToDataToWrite, uint32 CDSOffset, uint32 int32 CFE_PSP_ReadFromCDS(void *PtrToDataToRead, uint32 CDSOffset, uint32 NumBytes) { - uint8 *CopyPtr; - int32 return_code; - - if ( PtrToDataToRead == NULL ) - { - return_code = OS_ERROR; - } - else - { - if ( (CDSOffset < CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize ) && - ( (CDSOffset + NumBytes) <= CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize )) - { - CopyPtr = CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr; - CopyPtr += CDSOffset; - memcpy((char *)PtrToDataToRead, (char *)CopyPtr, NumBytes); - - return_code = OS_SUCCESS; - } - else - { - return_code = OS_ERROR; - } - - } /* end if PtrToDataToWrite == NULL */ - - return(return_code); - + uint8 *CopyPtr; + int32 return_code; + + if (PtrToDataToRead == NULL) + { + return_code = OS_ERROR; + } + else + { + if ((CDSOffset < CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize) && + ((CDSOffset + NumBytes) <= CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize)) + { + CopyPtr = CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr; + CopyPtr += CDSOffset; + memcpy((char *)PtrToDataToRead, (char *)CopyPtr, NumBytes); + + return_code = OS_SUCCESS; + } + else + { + return_code = OS_ERROR; + } + + } /* end if PtrToDataToWrite == NULL */ + + return (return_code); } /* @@ -226,8 +219,8 @@ int32 CFE_PSP_ReadFromCDS(void *PtrToDataToRead, uint32 CDSOffset, uint32 NumByt ** Function: CFE_PSP_GetResetArea ** ** Purpose: -** This function returns the location and size of the ES Reset information area. -** This area is preserved during a processor reset and is used to store the +** This function returns the location and size of the ES Reset information area. +** This area is preserved during a processor reset and is used to store the ** ER Log, System Log and reset related variables ** ** Arguments: @@ -236,22 +229,22 @@ int32 CFE_PSP_ReadFromCDS(void *PtrToDataToRead, uint32 CDSOffset, uint32 NumByt ** Return: ** (none) */ -int32 CFE_PSP_GetResetArea (cpuaddr *PtrToResetArea, uint32 *SizeOfResetArea) +int32 CFE_PSP_GetResetArea(cpuaddr *PtrToResetArea, uint32 *SizeOfResetArea) { - int32 return_code; - - if ( SizeOfResetArea == NULL || PtrToResetArea == NULL ) - { - return_code = OS_ERROR; - } - else - { - *PtrToResetArea = (cpuaddr)(CFE_PSP_ReservedMemoryMap.ResetMemory.BlockPtr); - *SizeOfResetArea = CFE_PSP_ReservedMemoryMap.ResetMemory.BlockSize; - return_code = OS_SUCCESS; - } - - return(return_code); + int32 return_code; + + if (SizeOfResetArea == NULL || PtrToResetArea == NULL) + { + return_code = OS_ERROR; + } + else + { + *PtrToResetArea = (cpuaddr)(CFE_PSP_ReservedMemoryMap.ResetMemory.BlockPtr); + *SizeOfResetArea = CFE_PSP_ReservedMemoryMap.ResetMemory.BlockSize; + return_code = OS_SUCCESS; + } + + return (return_code); } /* @@ -273,22 +266,22 @@ int32 CFE_PSP_GetResetArea (cpuaddr *PtrToResetArea, uint32 *SizeOfResetArea) ** Return: ** (none) */ -int32 CFE_PSP_GetUserReservedArea(cpuaddr *PtrToUserArea, uint32 *SizeOfUserArea ) +int32 CFE_PSP_GetUserReservedArea(cpuaddr *PtrToUserArea, uint32 *SizeOfUserArea) { - int32 return_code; - - if ( SizeOfUserArea == NULL || PtrToUserArea == NULL ) - { - return_code = OS_ERROR; - } - else - { - *PtrToUserArea = (cpuaddr)(CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockPtr); - *SizeOfUserArea = CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockSize; - return_code = OS_SUCCESS; - } - - return(return_code); + int32 return_code; + + if (SizeOfUserArea == NULL || PtrToUserArea == NULL) + { + return_code = OS_ERROR; + } + else + { + *PtrToUserArea = (cpuaddr)(CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockPtr); + *SizeOfUserArea = CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockSize; + return_code = OS_SUCCESS; + } + + return (return_code); } /* @@ -310,24 +303,22 @@ int32 CFE_PSP_GetUserReservedArea(cpuaddr *PtrToUserArea, uint32 *SizeOfUserArea ** Return: ** (none) */ -int32 CFE_PSP_GetVolatileDiskMem(cpuaddr *PtrToVolDisk, uint32 *SizeOfVolDisk ) +int32 CFE_PSP_GetVolatileDiskMem(cpuaddr *PtrToVolDisk, uint32 *SizeOfVolDisk) { - int32 return_code; - - if ( SizeOfVolDisk == NULL || PtrToVolDisk == NULL ) - { - return_code = OS_ERROR; - } - else - { - *PtrToVolDisk = (cpuaddr)(CFE_PSP_ReservedMemoryMap.VolatileDiskMemory.BlockPtr); - *SizeOfVolDisk = CFE_PSP_ReservedMemoryMap.VolatileDiskMemory.BlockSize; - return_code = OS_SUCCESS; - - } - - return(return_code); - + int32 return_code; + + if (SizeOfVolDisk == NULL || PtrToVolDisk == NULL) + { + return_code = OS_ERROR; + } + else + { + *PtrToVolDisk = (cpuaddr)(CFE_PSP_ReservedMemoryMap.VolatileDiskMemory.BlockPtr); + *SizeOfVolDisk = CFE_PSP_ReservedMemoryMap.VolatileDiskMemory.BlockSize; + return_code = OS_SUCCESS; + } + + return (return_code); } /* @@ -350,83 +341,83 @@ int32 CFE_PSP_GetVolatileDiskMem(cpuaddr *PtrToVolDisk, uint32 *SizeOfVolDisk ) */ void CFE_PSP_SetupReservedMemoryMap(void) { - CFE_PSP_RtemsReservedAreaFixedLayout_t *FixedPtr; - cpuaddr ReservedMemoryAddr; - size_t FixedSize; - size_t ResetSize; - size_t CDSSize; - size_t UserReservedSize; - size_t VolatileDiskSize; - size_t RequiredSize; - - /* - ** Allocate memory for the cFE memory. Note that this is malloced on - ** the COTS board, but will be a static location in the ETU. - */ - FixedSize = sizeof(CFE_PSP_RtemsReservedAreaFixedLayout_t); - ResetSize = CFE_PSP_RESET_AREA_SIZE; - VolatileDiskSize = (CFE_PSP_RAM_DISK_SECTOR_SIZE * CFE_PSP_RAM_DISK_NUM_SECTORS); - CDSSize = CFE_PSP_CDS_SIZE; - UserReservedSize = CFE_PSP_USER_RESERVED_SIZE; - - FixedSize = (FixedSize + CFE_PSP_MEMALIGN_MASK) & ~CFE_PSP_MEMALIGN_MASK; - ResetSize = (ResetSize + CFE_PSP_MEMALIGN_MASK) & ~CFE_PSP_MEMALIGN_MASK; - CDSSize = (CDSSize + CFE_PSP_MEMALIGN_MASK) & ~CFE_PSP_MEMALIGN_MASK; - VolatileDiskSize = (VolatileDiskSize + CFE_PSP_MEMALIGN_MASK) & ~CFE_PSP_MEMALIGN_MASK; - UserReservedSize = (UserReservedSize + CFE_PSP_MEMALIGN_MASK) & ~CFE_PSP_MEMALIGN_MASK; - - /* Calculate the required size, adding padding so that each element is aligned */ - RequiredSize = FixedSize; - RequiredSize += ResetSize; - RequiredSize += VolatileDiskSize; - RequiredSize += CDSSize; - RequiredSize += UserReservedSize; - - OS_printf("Sizeof BSP reserved memory = %u bytes\n",(unsigned int)RequiredSize); - - PcRtems_ReservedMemBlock.BlockPtr = malloc(RequiredSize); - - if ( PcRtems_ReservedMemBlock.BlockPtr == NULL ) - { - OS_printf("CFE_PSP: Error: Cannot malloc BSP reserved memory!\n"); - abort(); - } - - PcRtems_ReservedMemBlock.BlockSize = RequiredSize; - ReservedMemoryAddr = (cpuaddr)PcRtems_ReservedMemBlock.BlockPtr; - - OS_printf("CFE_PSP: Allocated %u bytes for PSP reserved memory at: 0x%08lX\n", - (unsigned int)RequiredSize, (unsigned long)ReservedMemoryAddr); - - FixedPtr = (CFE_PSP_RtemsReservedAreaFixedLayout_t*)ReservedMemoryAddr; - - CFE_PSP_ReservedMemoryMap.BootPtr = &FixedPtr->BootRecord; - CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr = &FixedPtr->ExceptionStorage; - ReservedMemoryAddr += FixedSize; - - CFE_PSP_ReservedMemoryMap.ResetMemory.BlockPtr = (void*)ReservedMemoryAddr; - CFE_PSP_ReservedMemoryMap.ResetMemory.BlockSize = CFE_PSP_RESET_AREA_SIZE; - ReservedMemoryAddr += ResetSize; - - CFE_PSP_ReservedMemoryMap.VolatileDiskMemory.BlockPtr = (void*)ReservedMemoryAddr; - CFE_PSP_ReservedMemoryMap.VolatileDiskMemory.BlockSize = (CFE_PSP_RAM_DISK_SECTOR_SIZE * CFE_PSP_RAM_DISK_NUM_SECTORS); - ReservedMemoryAddr += VolatileDiskSize; - - CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr = (void*)ReservedMemoryAddr; - CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize = CFE_PSP_CDS_SIZE; - ReservedMemoryAddr += CDSSize; - - CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockPtr = (void*)ReservedMemoryAddr; - CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockSize = CFE_PSP_USER_RESERVED_SIZE; - ReservedMemoryAddr += UserReservedSize; - - /* - * displaying the final address shows how much was actually used, - * and additionally avoids a warning about the result of the final increment not being used. - * (prefer this over removing the increment, as it is safer if another block is added) + CFE_PSP_RtemsReservedAreaFixedLayout_t *FixedPtr; + cpuaddr ReservedMemoryAddr; + size_t FixedSize; + size_t ResetSize; + size_t CDSSize; + size_t UserReservedSize; + size_t VolatileDiskSize; + size_t RequiredSize; + + /* + ** Allocate memory for the cFE memory. Note that this is malloced on + ** the COTS board, but will be a static location in the ETU. */ - OS_printf("CFE_PSP: PSP reserved memory ends at: 0x%08lX\n", - (unsigned long)ReservedMemoryAddr); + FixedSize = sizeof(CFE_PSP_RtemsReservedAreaFixedLayout_t); + ResetSize = CFE_PSP_RESET_AREA_SIZE; + VolatileDiskSize = (CFE_PSP_RAM_DISK_SECTOR_SIZE * CFE_PSP_RAM_DISK_NUM_SECTORS); + CDSSize = CFE_PSP_CDS_SIZE; + UserReservedSize = CFE_PSP_USER_RESERVED_SIZE; + + FixedSize = (FixedSize + CFE_PSP_MEMALIGN_MASK) & ~CFE_PSP_MEMALIGN_MASK; + ResetSize = (ResetSize + CFE_PSP_MEMALIGN_MASK) & ~CFE_PSP_MEMALIGN_MASK; + CDSSize = (CDSSize + CFE_PSP_MEMALIGN_MASK) & ~CFE_PSP_MEMALIGN_MASK; + VolatileDiskSize = (VolatileDiskSize + CFE_PSP_MEMALIGN_MASK) & ~CFE_PSP_MEMALIGN_MASK; + UserReservedSize = (UserReservedSize + CFE_PSP_MEMALIGN_MASK) & ~CFE_PSP_MEMALIGN_MASK; + + /* Calculate the required size, adding padding so that each element is aligned */ + RequiredSize = FixedSize; + RequiredSize += ResetSize; + RequiredSize += VolatileDiskSize; + RequiredSize += CDSSize; + RequiredSize += UserReservedSize; + + OS_printf("Sizeof BSP reserved memory = %u bytes\n", (unsigned int)RequiredSize); + + PcRtems_ReservedMemBlock.BlockPtr = malloc(RequiredSize); + + if (PcRtems_ReservedMemBlock.BlockPtr == NULL) + { + OS_printf("CFE_PSP: Error: Cannot malloc BSP reserved memory!\n"); + abort(); + } + + PcRtems_ReservedMemBlock.BlockSize = RequiredSize; + ReservedMemoryAddr = (cpuaddr)PcRtems_ReservedMemBlock.BlockPtr; + + OS_printf("CFE_PSP: Allocated %u bytes for PSP reserved memory at: 0x%08lX\n", (unsigned int)RequiredSize, + (unsigned long)ReservedMemoryAddr); + + FixedPtr = (CFE_PSP_RtemsReservedAreaFixedLayout_t *)ReservedMemoryAddr; + + CFE_PSP_ReservedMemoryMap.BootPtr = &FixedPtr->BootRecord; + CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr = &FixedPtr->ExceptionStorage; + ReservedMemoryAddr += FixedSize; + + CFE_PSP_ReservedMemoryMap.ResetMemory.BlockPtr = (void *)ReservedMemoryAddr; + CFE_PSP_ReservedMemoryMap.ResetMemory.BlockSize = CFE_PSP_RESET_AREA_SIZE; + ReservedMemoryAddr += ResetSize; + + CFE_PSP_ReservedMemoryMap.VolatileDiskMemory.BlockPtr = (void *)ReservedMemoryAddr; + CFE_PSP_ReservedMemoryMap.VolatileDiskMemory.BlockSize = + (CFE_PSP_RAM_DISK_SECTOR_SIZE * CFE_PSP_RAM_DISK_NUM_SECTORS); + ReservedMemoryAddr += VolatileDiskSize; + + CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr = (void *)ReservedMemoryAddr; + CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize = CFE_PSP_CDS_SIZE; + ReservedMemoryAddr += CDSSize; + + CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockPtr = (void *)ReservedMemoryAddr; + CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockSize = CFE_PSP_USER_RESERVED_SIZE; + ReservedMemoryAddr += UserReservedSize; + + /* + * displaying the final address shows how much was actually used, + * and additionally avoids a warning about the result of the final increment not being used. + * (prefer this over removing the increment, as it is safer if another block is added) + */ + OS_printf("CFE_PSP: PSP reserved memory ends at: 0x%08lX\n", (unsigned long)ReservedMemoryAddr); } /****************************************************************************** @@ -441,14 +432,13 @@ void CFE_PSP_SetupReservedMemoryMap(void) ** Return: ** (none) */ -int32 CFE_PSP_InitProcessorReservedMemory( uint32 RestartType ) +int32 CFE_PSP_InitProcessorReservedMemory(uint32 RestartType) { OS_printf("CFE_PSP: Clearing Processor Reserved Memory.\n"); memset(PcRtems_ReservedMemBlock.BlockPtr, 0, PcRtems_ReservedMemBlock.BlockSize); return CFE_PSP_SUCCESS; } - /* ********************************************************************************* ** ES BSP kernel memory segment functions @@ -470,34 +460,33 @@ int32 CFE_PSP_InitProcessorReservedMemory( uint32 RestartType ) */ int32 CFE_PSP_GetKernelTextSegmentInfo(cpuaddr *PtrToKernelSegment, uint32 *SizeOfKernelSegment) { - int32 return_code; - cpuaddr StartAddress; - cpuaddr EndAddress; - - if ( SizeOfKernelSegment == NULL || PtrToKernelSegment == NULL ) - { - return_code = OS_ERROR; - } - else - { - /* - ** Get the kernel start and end - ** addresses from the BSP, because the - ** symbol table does not contain the symbls we need for this - */ - StartAddress = (cpuaddr) 0x0; - EndAddress = (cpuaddr) 0x1024; - - *PtrToKernelSegment = StartAddress; - *SizeOfKernelSegment = (uint32) (EndAddress - StartAddress); - - return_code = OS_SUCCESS; - } - - return(return_code); + int32 return_code; + cpuaddr StartAddress; + cpuaddr EndAddress; + + if (SizeOfKernelSegment == NULL || PtrToKernelSegment == NULL) + { + return_code = OS_ERROR; + } + else + { + /* + ** Get the kernel start and end + ** addresses from the BSP, because the + ** symbol table does not contain the symbls we need for this + */ + StartAddress = (cpuaddr)0x0; + EndAddress = (cpuaddr)0x1024; + + *PtrToKernelSegment = StartAddress; + *SizeOfKernelSegment = (uint32)(EndAddress - StartAddress); + + return_code = OS_SUCCESS; + } + + return (return_code); } - /****************************************************************************** ** Function: CFE_PSP_GetCFETextSegmentInfo ** @@ -513,54 +502,50 @@ int32 CFE_PSP_GetKernelTextSegmentInfo(cpuaddr *PtrToKernelSegment, uint32 *Size */ int32 CFE_PSP_GetCFETextSegmentInfo(cpuaddr *PtrToCFESegment, uint32 *SizeOfCFESegment) { - int32 return_code; - cpuaddr StartAddress; - cpuaddr EndAddress; - - if ( SizeOfCFESegment == NULL ) - { - return_code = OS_ERROR; - } - else - { - /* - ** Get the kernel start and end - ** addresses from the BSP, because the - ** symbol table does not contain the symbls we need for this - */ - StartAddress = (cpuaddr) 0x0; - EndAddress = (cpuaddr) 0x1024; - - *PtrToCFESegment = StartAddress; - *SizeOfCFESegment = (uint32) (EndAddress - StartAddress); - - return_code = OS_SUCCESS; - } - - return(return_code); + int32 return_code; + cpuaddr StartAddress; + cpuaddr EndAddress; + + if (SizeOfCFESegment == NULL) + { + return_code = OS_ERROR; + } + else + { + /* + ** Get the kernel start and end + ** addresses from the BSP, because the + ** symbol table does not contain the symbls we need for this + */ + StartAddress = (cpuaddr)0x0; + EndAddress = (cpuaddr)0x1024; + + *PtrToCFESegment = StartAddress; + *SizeOfCFESegment = (uint32)(EndAddress - StartAddress); + + return_code = OS_SUCCESS; + } + + return (return_code); } - -//extern int rtems_shell_main_wkspace_info(int argc,char *argv[]); -//extern int rtems_shell_main_malloc_info( int argc, char *argv[]); - +// extern int rtems_shell_main_wkspace_info(int argc,char *argv[]); +// extern int rtems_shell_main_malloc_info( int argc, char *argv[]); void CFE_PSP_MemReport(char *message) { - //int MemStatus; - //char *malloc_argv[] = {"malloc", "info"}; - //char *wkspace_argv[] = {"wkspace", "info"}; - - OS_printf("------------------------ Memory Stat Report ----------------------------\n"); - OS_printf(" Called from: %s\n",message); - OS_printf("------------------------ Dumping Malloc Stats: ----------------------------\n"); - //MemStatus = rtems_shell_main_malloc_info(2, malloc_argv); - //OS_printf("rtems_shell_main_malloc_info() rc=%d\n",(int)MemStatus); - OS_printf("------------------------ Dumping Wkspace Stats: ----------------------------\n"); - //MemStatus = rtems_shell_main_wkspace_info(2, wkspace_argv); - //OS_printf("rtems_shell_main_wkspace_info() rc=%d\n",(int)MemStatus); - OS_printf("------------------------ Done ----------------- ----------------------------\n"); - + // int MemStatus; + // char *malloc_argv[] = {"malloc", "info"}; + // char *wkspace_argv[] = {"wkspace", "info"}; + + OS_printf("------------------------ Memory Stat Report ----------------------------\n"); + OS_printf(" Called from: %s\n", message); + OS_printf("------------------------ Dumping Malloc Stats: ----------------------------\n"); + // MemStatus = rtems_shell_main_malloc_info(2, malloc_argv); + // OS_printf("rtems_shell_main_malloc_info() rc=%d\n",(int)MemStatus); + OS_printf("------------------------ Dumping Wkspace Stats: ----------------------------\n"); + // MemStatus = rtems_shell_main_wkspace_info(2, wkspace_argv); + // OS_printf("rtems_shell_main_wkspace_info() rc=%d\n",(int)MemStatus); + OS_printf("------------------------ Done ----------------- ----------------------------\n"); } - diff --git a/fsw/pc-rtems/src/cfe_psp_memtab.c b/fsw/pc-rtems/src/cfe_psp_memtab.c index a9b0d490..af22651b 100644 --- a/fsw/pc-rtems/src/cfe_psp_memtab.c +++ b/fsw/pc-rtems/src/cfe_psp_memtab.c @@ -21,7 +21,7 @@ /* ** File : cfe_psp_memtab.c ** -** Author : Alan Cudmore +** Author : Alan Cudmore ** ** Purpose: Memory Range Table for cFE/PSP. ** @@ -41,17 +41,15 @@ ** Valid memory map for this target. ** If you need to add more entries, increase CFE_PSP_MEM_TABLE_SIZE in the osconfig.h file. */ -CFE_PSP_MemTable_t CFE_PSP_MemoryTable[CFE_PSP_MEM_TABLE_SIZE] = -{ - { CFE_PSP_MEM_RAM, CFE_PSP_MEM_SIZE_DWORD, 0, 0xFFFFFFFF, CFE_PSP_MEM_ATTR_READWRITE }, - { CFE_PSP_MEM_INVALID, 0, 0, 0, CFE_PSP_MEM_ATTR_READWRITE }, - { CFE_PSP_MEM_INVALID, 0, 0, 0, CFE_PSP_MEM_ATTR_READWRITE }, - { CFE_PSP_MEM_INVALID, 0, 0, 0, CFE_PSP_MEM_ATTR_READWRITE }, - { CFE_PSP_MEM_INVALID, 0, 0, 0, CFE_PSP_MEM_ATTR_READWRITE }, - { CFE_PSP_MEM_INVALID, 0, 0, 0, CFE_PSP_MEM_ATTR_READWRITE }, - { CFE_PSP_MEM_INVALID, 0, 0, 0, CFE_PSP_MEM_ATTR_READWRITE }, - { CFE_PSP_MEM_INVALID, 0, 0, 0, CFE_PSP_MEM_ATTR_READWRITE }, - { CFE_PSP_MEM_INVALID, 0, 0, 0, CFE_PSP_MEM_ATTR_READWRITE }, - { CFE_PSP_MEM_INVALID, 0, 0, 0, CFE_PSP_MEM_ATTR_READWRITE }, +CFE_PSP_MemTable_t CFE_PSP_MemoryTable[CFE_PSP_MEM_TABLE_SIZE] = { + {CFE_PSP_MEM_RAM, CFE_PSP_MEM_SIZE_DWORD, 0, 0xFFFFFFFF, CFE_PSP_MEM_ATTR_READWRITE}, + {CFE_PSP_MEM_INVALID, 0, 0, 0, CFE_PSP_MEM_ATTR_READWRITE}, + {CFE_PSP_MEM_INVALID, 0, 0, 0, CFE_PSP_MEM_ATTR_READWRITE}, + {CFE_PSP_MEM_INVALID, 0, 0, 0, CFE_PSP_MEM_ATTR_READWRITE}, + {CFE_PSP_MEM_INVALID, 0, 0, 0, CFE_PSP_MEM_ATTR_READWRITE}, + {CFE_PSP_MEM_INVALID, 0, 0, 0, CFE_PSP_MEM_ATTR_READWRITE}, + {CFE_PSP_MEM_INVALID, 0, 0, 0, CFE_PSP_MEM_ATTR_READWRITE}, + {CFE_PSP_MEM_INVALID, 0, 0, 0, CFE_PSP_MEM_ATTR_READWRITE}, + {CFE_PSP_MEM_INVALID, 0, 0, 0, CFE_PSP_MEM_ATTR_READWRITE}, + {CFE_PSP_MEM_INVALID, 0, 0, 0, CFE_PSP_MEM_ATTR_READWRITE}, }; - diff --git a/fsw/pc-rtems/src/cfe_psp_ssr.c b/fsw/pc-rtems/src/cfe_psp_ssr.c index 1136f968..a4facc6f 100644 --- a/fsw/pc-rtems/src/cfe_psp_ssr.c +++ b/fsw/pc-rtems/src/cfe_psp_ssr.c @@ -31,14 +31,12 @@ ** ******************************************************************************/ - /* ** Include Files */ #include #include - /* ** cFE includes */ @@ -51,12 +49,11 @@ #include "cfe_psp.h" #include "cfe_psp_memory.h" - /****************************************************************************** ** Function: CFE_PSP_InitSSR ** ** Purpose: -** Initializes the Solid State Recorder device. Dummy function for this +** Initializes the Solid State Recorder device. Dummy function for this ** platform. ** ** @@ -67,13 +64,11 @@ ** (none) */ -int32 CFE_PSP_InitSSR(uint32 bus, uint32 device, char *DeviceName ) +int32 CFE_PSP_InitSSR(uint32 bus, uint32 device, char *DeviceName) { - int32 ReturnCode; + int32 ReturnCode; - ReturnCode = CFE_PSP_SUCCESS; + ReturnCode = CFE_PSP_SUCCESS; - return(ReturnCode); - + return (ReturnCode); } - diff --git a/fsw/pc-rtems/src/cfe_psp_start.c b/fsw/pc-rtems/src/cfe_psp_start.c index acefff18..1433fa65 100644 --- a/fsw/pc-rtems/src/cfe_psp_start.c +++ b/fsw/pc-rtems/src/cfe_psp_start.c @@ -42,15 +42,14 @@ extern int rtems_fxp_attach(struct rtems_bsdnet_ifconfig *config, int attaching); /* -** cFE includes +** cFE includes */ #include "common_types.h" #include "osapi.h" -#include "cfe_psp.h" +#include "cfe_psp.h" #include "cfe_psp_memory.h" #include "cfe_psp_module.h" - /* * The preferred way to obtain the CFE tunable values at runtime is via * the dynamically generated configuration object. This allows a single build @@ -58,38 +57,34 @@ extern int rtems_fxp_attach(struct rtems_bsdnet_ifconfig *config, int attaching) */ #include -#define CFE_PSP_MAIN_FUNCTION (*GLOBAL_CONFIGDATA.CfeConfig->SystemMain) -#define CFE_PSP_NONVOL_STARTUP_FILE (GLOBAL_CONFIGDATA.CfeConfig->NonvolStartupFile) +#define CFE_PSP_MAIN_FUNCTION (*GLOBAL_CONFIGDATA.CfeConfig->SystemMain) +#define CFE_PSP_NONVOL_STARTUP_FILE (GLOBAL_CONFIGDATA.CfeConfig->NonvolStartupFile) /* ** Global variables */ +rtems_id RtemsTimerId; -rtems_id RtemsTimerId; - -static unsigned char ethernet_address[6] = {0x00, 0x04, 0x9F, 0x00, 0x27, 0x61 }; -static char net_name_str[] = "fxp1"; -static char ip_addr_str[] = "10.0.2.17"; -static char ip_netmask_str[] = "255.255.255.0"; +static unsigned char ethernet_address[6] = {0x00, 0x04, 0x9F, 0x00, 0x27, 0x61}; +static char net_name_str[] = "fxp1"; +static char ip_addr_str[] = "10.0.2.17"; +static char ip_netmask_str[] = "255.255.255.0"; static struct rtems_bsdnet_ifconfig netdriver_config = { - .name = net_name_str, - .attach = rtems_fxp_attach, - .next = NULL, - .ip_address = ip_addr_str, - .ip_netmask = ip_netmask_str, - .hardware_address = ethernet_address - /* more options can follow */ + .name = net_name_str, + .attach = rtems_fxp_attach, + .next = NULL, + .ip_address = ip_addr_str, + .ip_netmask = ip_netmask_str, + .hardware_address = ethernet_address + /* more options can follow */ }; struct rtems_bsdnet_config rtems_bsdnet_config = { - .ifconfig = &netdriver_config, - .bootp = rtems_bsdnet_do_dhcp_failsafe, /* fill if DHCP is used*/ + .ifconfig = &netdriver_config, .bootp = rtems_bsdnet_do_dhcp_failsafe, /* fill if DHCP is used*/ }; - - /* ** 1 HZ Timer "ISR" */ @@ -121,20 +116,19 @@ int timer_count = 0; */ int CFE_PSP_Setup(void) { - rtems_status_code status; + rtems_status_code status; - /* - * Initialize the network. This is also optional and only - * works if an appropriate network device is present. - */ - status = rtems_bsdnet_initialize_network(); - if (status != RTEMS_SUCCESSFUL) - { - printf ("Network init not successful: %s / %s (continuing)\n", - rtems_status_text (status),strerror(errno)); - } + /* + * Initialize the network. This is also optional and only + * works if an appropriate network device is present. + */ + status = rtems_bsdnet_initialize_network(); + if (status != RTEMS_SUCCESSFUL) + { + printf("Network init not successful: %s / %s (continuing)\n", rtems_status_text(status), strerror(errno)); + } - return RTEMS_SUCCESSFUL; + return RTEMS_SUCCESSFUL; } /****************************************************************************** @@ -164,7 +158,7 @@ int CFE_PSP_Setup(void) void CFE_PSP_SetupSystemTimer(void) { osal_id_t SystemTimebase; - int32 Status; + int32 Status; Status = OS_TimeBaseCreate(&SystemTimebase, "cFS-Master", NULL); if (Status == OS_SUCCESS) @@ -172,7 +166,6 @@ void CFE_PSP_SetupSystemTimer(void) Status = OS_TimeBaseSet(SystemTimebase, 250000, 250000); } - /* * If anything failed, cFE/cFS will not run properly, so a panic is appropriate */ @@ -183,7 +176,6 @@ void CFE_PSP_SetupSystemTimer(void) } } - /* ** A simple entry point to start from the BSP loader ** @@ -200,15 +192,15 @@ void CFE_PSP_SetupSystemTimer(void) */ void OS_Application_Startup(void) { - if (CFE_PSP_Setup() != RTEMS_SUCCESSFUL) - { - CFE_PSP_Panic(CFE_PSP_ERROR); - } + if (CFE_PSP_Setup() != RTEMS_SUCCESSFUL) + { + CFE_PSP_Panic(CFE_PSP_ERROR); + } - /* - ** Run the PSP Main - this will return when init is complete - */ - CFE_PSP_Main(); + /* + ** Run the PSP Main - this will return when init is complete + */ + CFE_PSP_Main(); } /****************************************************************************** @@ -233,64 +225,61 @@ void OS_Application_Startup(void) void CFE_PSP_Main(void) { - uint32 reset_type; - uint32 reset_subtype; - osal_id_t fs_id; - int32 Status; + uint32 reset_type; + uint32 reset_subtype; + osal_id_t fs_id; + int32 Status; - - - /* - ** Initialize the OS API - */ - Status = OS_API_Init(); - if (Status != OS_SUCCESS) - { - /* irrecoverable error if OS_API_Init() fails. */ - /* note: use printf here, as OS_printf may not work */ - printf("CFE_PSP: OS_API_Init() failure\n"); - CFE_PSP_Panic(Status); - } - - /* - * Initialize the CFE reserved memory map + /* + ** Initialize the OS API */ - CFE_PSP_SetupReservedMemoryMap(); + Status = OS_API_Init(); + if (Status != OS_SUCCESS) + { + /* irrecoverable error if OS_API_Init() fails. */ + /* note: use printf here, as OS_printf may not work */ + printf("CFE_PSP: OS_API_Init() failure\n"); + CFE_PSP_Panic(Status); + } - /* - ** Set up the virtual FS mapping for the "/cf" directory - */ - Status = OS_FileSysAddFixedMap(&fs_id, "/mnt/eeprom", "/cf"); - if (Status != OS_SUCCESS) - { - /* Print for informational purposes -- - * startup can continue, but loads may fail later, depending on config. */ - OS_printf("CFE_PSP: OS_FileSysAddFixedMap() failure: %d\n", (int)Status); - } + /* + * Initialize the CFE reserved memory map + */ + CFE_PSP_SetupReservedMemoryMap(); - /* - ** Initialize the statically linked modules (if any) - */ - CFE_PSP_ModuleInit(); + /* + ** Set up the virtual FS mapping for the "/cf" directory + */ + Status = OS_FileSysAddFixedMap(&fs_id, "/mnt/eeprom", "/cf"); + if (Status != OS_SUCCESS) + { + /* Print for informational purposes -- + * startup can continue, but loads may fail later, depending on config. */ + OS_printf("CFE_PSP: OS_FileSysAddFixedMap() failure: %d\n", (int)Status); + } - /* Prepare the system timing resources */ - CFE_PSP_SetupSystemTimer(); + /* + ** Initialize the statically linked modules (if any) + */ + CFE_PSP_ModuleInit(); - /* - ** Determine Reset type by reading the hardware reset register. - */ - reset_type = CFE_PSP_RST_TYPE_POWERON; - reset_subtype = CFE_PSP_RST_SUBTYPE_POWER_CYCLE; + /* Prepare the system timing resources */ + CFE_PSP_SetupSystemTimer(); - /* - ** Initialize the reserved memory - */ - CFE_PSP_InitProcessorReservedMemory(reset_type); + /* + ** Determine Reset type by reading the hardware reset register. + */ + reset_type = CFE_PSP_RST_TYPE_POWERON; + reset_subtype = CFE_PSP_RST_SUBTYPE_POWER_CYCLE; - /* - ** Call cFE entry point. This will return when cFE startup - ** is complete. - */ - CFE_PSP_MAIN_FUNCTION(reset_type,reset_subtype, 1, CFE_PSP_NONVOL_STARTUP_FILE); + /* + ** Initialize the reserved memory + */ + CFE_PSP_InitProcessorReservedMemory(reset_type); + /* + ** Call cFE entry point. This will return when cFE startup + ** is complete. + */ + CFE_PSP_MAIN_FUNCTION(reset_type, reset_subtype, 1, CFE_PSP_NONVOL_STARTUP_FILE); } diff --git a/fsw/pc-rtems/src/cfe_psp_support.c b/fsw/pc-rtems/src/cfe_psp_support.c index e67b90ff..9e69c294 100644 --- a/fsw/pc-rtems/src/cfe_psp_support.c +++ b/fsw/pc-rtems/src/cfe_psp_support.c @@ -31,7 +31,6 @@ ** ******************************************************************************/ - /* ** Include Files */ @@ -39,7 +38,6 @@ #include #include - /* ** cFE includes */ @@ -59,10 +57,9 @@ */ #include -#define CFE_PSP_CPU_ID (GLOBAL_CONFIGDATA.Default_CpuId) -#define CFE_PSP_CPU_NAME (GLOBAL_CONFIGDATA.Default_CpuName) -#define CFE_PSP_SPACECRAFT_ID (GLOBAL_CONFIGDATA.Default_SpacecraftId) - +#define CFE_PSP_CPU_ID (GLOBAL_CONFIGDATA.Default_CpuId) +#define CFE_PSP_CPU_NAME (GLOBAL_CONFIGDATA.Default_CpuName) +#define CFE_PSP_SPACECRAFT_ID (GLOBAL_CONFIGDATA.Default_SpacecraftId) /* * Track the overall "reserved memory block" at the start of RAM. @@ -70,7 +67,6 @@ */ extern CFE_PSP_MemoryBlock_t PcRtems_ReservedMemBlock; - /****************************************************************************** ** Function: CFE_PSP_Restart() ** @@ -87,10 +83,9 @@ extern CFE_PSP_MemoryBlock_t PcRtems_ReservedMemBlock; void CFE_PSP_Restart(uint32 reset_type) { - CFE_PSP_FlushCaches(1, PcRtems_ReservedMemBlock.BlockPtr, PcRtems_ReservedMemBlock.BlockSize); - OS_printf("CFE_PSP_Restart is not implemented on this platform ( yet ! )\n"); - exit(-1); - + CFE_PSP_FlushCaches(1, PcRtems_ReservedMemBlock.BlockPtr, PcRtems_ReservedMemBlock.BlockSize); + OS_printf("CFE_PSP_Restart is not implemented on this platform ( yet ! )\n"); + exit(-1); } /****************************************************************************** @@ -109,8 +104,8 @@ void CFE_PSP_Restart(uint32 reset_type) void CFE_PSP_Panic(int32 ErrorCode) { - printf("CFE_PSP_Panic Called with error code = 0x%08X. Exiting.\n",(unsigned int )ErrorCode); - OS_ApplicationExit(ErrorCode); + printf("CFE_PSP_Panic Called with error code = 0x%08X. Exiting.\n", (unsigned int)ErrorCode); + OS_ApplicationExit(ErrorCode); } /****************************************************************************** @@ -127,13 +122,12 @@ void CFE_PSP_Panic(int32 ErrorCode) ** (none) */ -void CFE_PSP_FlushCaches(uint32 type, void* address, uint32 size) +void CFE_PSP_FlushCaches(uint32 type, void *address, uint32 size) { - if ( type == 1 ) - { - /* cacheTextUpdate((void *)address, size); */ - } - + if (type == 1) + { + /* cacheTextUpdate((void *)address, size); */ + } } /* @@ -153,12 +147,11 @@ void CFE_PSP_FlushCaches(uint32 type, void* address, uint32 size) ** ** Return Values: Processor ID */ -uint32 CFE_PSP_GetProcessorId (void) +uint32 CFE_PSP_GetProcessorId(void) { - return(CFE_PSP_CPU_ID); + return (CFE_PSP_CPU_ID); } - /* ** Name: CFE_PSP_GetSpacecraftId ** @@ -174,9 +167,9 @@ uint32 CFE_PSP_GetProcessorId (void) ** ** Return Values: Spacecraft ID */ -uint32 CFE_PSP_GetSpacecraftId (void) +uint32 CFE_PSP_GetSpacecraftId(void) { - return(CFE_PSP_SPACECRAFT_ID); + return (CFE_PSP_SPACECRAFT_ID); } /* @@ -194,8 +187,7 @@ uint32 CFE_PSP_GetSpacecraftId (void) ** ** Return Values: Processor name */ -const char *CFE_PSP_GetProcessorName (void) +const char *CFE_PSP_GetProcessorName(void) { - return(CFE_PSP_CPU_NAME); + return (CFE_PSP_CPU_NAME); } - diff --git a/fsw/pc-rtems/src/cfe_psp_timer.c b/fsw/pc-rtems/src/cfe_psp_timer.c index 1760d5ff..60fcb135 100644 --- a/fsw/pc-rtems/src/cfe_psp_timer.c +++ b/fsw/pc-rtems/src/cfe_psp_timer.c @@ -52,20 +52,26 @@ */ #include "cfe_psp.h" - /******************* Macro Definitions ***********************/ -#define WATCHDOG_MIN_TIME 0 -#define WATCHDOG_MAX_TIME 0xFFFFFFFF - -#define CFE_PSP_TIMER_TICKS_PER_SECOND 100 /* Resolution of the least significant 32 bits of the 64 bit - time stamp returned by CFE_PSP_Get_Timebase in timer ticks per second. - The timer resolution for accuracy should not be any slower than 1000000 - ticks per second or 1 us per tick */ -#define CFE_PSP_TIMER_LOW32_ROLLOVER 0 /* The number that the least significant 32 bits of the 64 bit - time stamp returned by CFE_PSP_Get_Timebase rolls over. If the lower 32 - bits rolls at 1 second, then the CFE_PSP_TIMER_LOW32_ROLLOVER will be 1000000. - if the lower 32 bits rolls at its maximum value (2^32) then - CFE_PSP_TIMER_LOW32_ROLLOVER will be 0. */ +#define WATCHDOG_MIN_TIME 0 +#define WATCHDOG_MAX_TIME 0xFFFFFFFF + +/** + * /brief Resolution of the least significant 32 bits of the 64 bit + * time stamp returned by CFE_PSP_Get_Timebase in timer ticks per second. + * The timer resolution for accuracy should not be any slower than 1000000 + * ticks per second or 1 us per tick + */ +#define CFE_PSP_TIMER_TICKS_PER_SECOND 100 + +/** + * /brief The number that the least significant 32 bits of the 64 bit + * time stamp returned by CFE_PSP_Get_Timebase rolls over. If the lower 32 + * bits rolls at 1 second, then the CFE_PSP_TIMER_LOW32_ROLLOVER will be 1000000. + * if the lower 32 bits rolls at its maximum value (2^32) then + * CFE_PSP_TIMER_LOW32_ROLLOVER will be 0. + */ +#define CFE_PSP_TIMER_LOW32_ROLLOVER 0 /****************************************************************************** ** Function: CFE_PSP_GetTime() @@ -75,11 +81,11 @@ ** Arguments: LocalTime - where the time is returned through ******************************************************************************/ -void CFE_PSP_GetTime( OS_time_t *LocalTime) +void CFE_PSP_GetTime(OS_time_t *LocalTime) { OS_GetLocalTime(LocalTime); - -}/* end CFE_PSP_GetLocalTime */ + +} /* end CFE_PSP_GetLocalTime */ /****************************************************************************** ** Function: CFE_PSP_Get_Timer_Tick() @@ -96,7 +102,7 @@ void CFE_PSP_GetTime( OS_time_t *LocalTime) */ uint32 CFE_PSP_Get_Timer_Tick(void) { - return (0); + return (0); } /****************************************************************************** @@ -116,7 +122,7 @@ uint32 CFE_PSP_Get_Timer_Tick(void) */ uint32 CFE_PSP_GetTimerTicksPerSecond(void) { - return(CFE_PSP_TIMER_TICKS_PER_SECOND); + return (CFE_PSP_TIMER_TICKS_PER_SECOND); } /****************************************************************************** @@ -137,7 +143,7 @@ uint32 CFE_PSP_GetTimerTicksPerSecond(void) */ uint32 CFE_PSP_GetTimerLow32Rollover(void) { - return(CFE_PSP_TIMER_LOW32_ROLLOVER); + return (CFE_PSP_TIMER_LOW32_ROLLOVER); } /****************************************************************************** @@ -153,13 +159,13 @@ uint32 CFE_PSP_GetTimerLow32Rollover(void) ** Return: ** Timebase register value */ -void CFE_PSP_Get_Timebase(uint32 *Tbu, uint32* Tbl) +void CFE_PSP_Get_Timebase(uint32 *Tbu, uint32 *Tbl) { - OS_time_t time; + OS_time_t time; - OS_GetLocalTime(&time); - *Tbu = OS_TimeGetTotalSeconds(time); - *Tbl = OS_TimeGetMicrosecondsPart(time); + OS_GetLocalTime(&time); + *Tbu = OS_TimeGetTotalSeconds(time); + *Tbl = OS_TimeGetMicrosecondsPart(time); } /****************************************************************************** @@ -178,5 +184,5 @@ void CFE_PSP_Get_Timebase(uint32 *Tbu, uint32* Tbl) uint32 CFE_PSP_Get_Dec(void) { - return(0); + return (0); } diff --git a/fsw/pc-rtems/src/cfe_psp_watchdog.c b/fsw/pc-rtems/src/cfe_psp_watchdog.c index 4f9c17e4..48176f84 100644 --- a/fsw/pc-rtems/src/cfe_psp_watchdog.c +++ b/fsw/pc-rtems/src/cfe_psp_watchdog.c @@ -35,7 +35,6 @@ ** Include Files */ - /* ** cFE includes */ @@ -75,16 +74,14 @@ uint32 CFE_PSP_WatchdogValue = 0; void CFE_PSP_WatchdogInit(void) { - /* - ** Just set it to a value right now - ** The pc-linux desktop platform does not actually implement a watchdog - ** timeout ( but could with a signal ) - */ - CFE_PSP_WatchdogValue = CFE_PSP_WATCHDOG_MAX; - + /* + ** Just set it to a value right now + ** The pc-linux desktop platform does not actually implement a watchdog + ** timeout ( but could with a signal ) + */ + CFE_PSP_WatchdogValue = CFE_PSP_WATCHDOG_MAX; } - /****************************************************************************** ** Function: CFE_PSP_WatchdogEnable() ** @@ -95,11 +92,7 @@ void CFE_PSP_WatchdogInit(void) ** ** Return: */ -void CFE_PSP_WatchdogEnable(void) -{ - -} - +void CFE_PSP_WatchdogEnable(void) {} /****************************************************************************** ** Function: CFE_PSP_WatchdogDisable() @@ -111,10 +104,7 @@ void CFE_PSP_WatchdogEnable(void) ** ** Return: */ -void CFE_PSP_WatchdogDisable(void) -{ - -} +void CFE_PSP_WatchdogDisable(void) {} /****************************************************************************** ** Function: CFE_PSP_WatchdogService() @@ -132,44 +122,39 @@ void CFE_PSP_WatchdogDisable(void) ** Notes: ** */ -void CFE_PSP_WatchdogService(void) -{ - - -} +void CFE_PSP_WatchdogService(void) {} /****************************************************************************** ** Function: CFE_PSP_WatchdogGet ** ** Purpose: -** Get the current watchdog value. +** Get the current watchdog value. ** ** Arguments: -** none +** none ** ** Return: -** the current watchdog value +** the current watchdog value ** ** Notes: ** */ uint32 CFE_PSP_WatchdogGet(void) { - return(CFE_PSP_WatchdogValue); + return (CFE_PSP_WatchdogValue); } - /****************************************************************************** ** Function: CFE_PSP_WatchdogSet ** ** Purpose: -** Get the current watchdog value. +** Get the current watchdog value. ** ** Arguments: -** The new watchdog value +** The new watchdog value ** ** Return: -** nothing +** nothing ** ** Notes: ** @@ -178,6 +163,4 @@ void CFE_PSP_WatchdogSet(uint32 WatchdogValue) { CFE_PSP_WatchdogValue = WatchdogValue; - } - diff --git a/fsw/shared/inc/cfe_psp_exceptionstorage_api.h b/fsw/shared/inc/cfe_psp_exceptionstorage_api.h index 45bf5137..3ecf72ee 100644 --- a/fsw/shared/inc/cfe_psp_exceptionstorage_api.h +++ b/fsw/shared/inc/cfe_psp_exceptionstorage_api.h @@ -35,8 +35,6 @@ */ struct CFE_PSP_Exception_LogData; - - /* ------------------------------------------------------------- * Functions implemented in shared layer, invoked by impl layer. * ------------------------------------------------------------- */ @@ -51,7 +49,7 @@ struct CFE_PSP_Exception_LogData; * \param seq Sequence number * \returns pointer to buffer. */ -extern struct CFE_PSP_Exception_LogData* CFE_PSP_Exception_GetBuffer(uint32 seq); +extern struct CFE_PSP_Exception_LogData *CFE_PSP_Exception_GetBuffer(uint32 seq); /** * \brief Get the next buffer for exception context storage @@ -62,7 +60,7 @@ extern struct CFE_PSP_Exception_LogData* CFE_PSP_Exception_GetBuffer(uint32 seq) * * \returns pointer to buffer, or NULL if storage is full. */ -extern struct CFE_PSP_Exception_LogData* CFE_PSP_Exception_GetNextContextBuffer(void); +extern struct CFE_PSP_Exception_LogData *CFE_PSP_Exception_GetNextContextBuffer(void); /** * \brief Finish storage of exception data @@ -95,6 +93,7 @@ extern void CFE_PSP_Exception_Reset(void); * * \returns CFE_PSP_SUCCESS on success */ -extern int32 CFE_PSP_ExceptionGetSummary_Impl(const struct CFE_PSP_Exception_LogData* Buffer, char *ReasonBuf, uint32 ReasonSize); +extern int32 CFE_PSP_ExceptionGetSummary_Impl(const struct CFE_PSP_Exception_LogData *Buffer, char *ReasonBuf, + uint32 ReasonSize); #endif /* CFE_PSP_EXCEPTIONSTORAGE_API_H_ */ diff --git a/fsw/shared/inc/cfe_psp_exceptionstorage_types.h b/fsw/shared/inc/cfe_psp_exceptionstorage_types.h index dad4c788..289c0843 100644 --- a/fsw/shared/inc/cfe_psp_exceptionstorage_types.h +++ b/fsw/shared/inc/cfe_psp_exceptionstorage_types.h @@ -40,22 +40,20 @@ */ struct CFE_PSP_Exception_LogData { - uint32 context_id; /**< a unique ID assigned to this exception entry */ - uint32 context_size; /**< actual size of the "context_info" data */ - CFE_PSP_Exception_SysTaskId_t sys_task_id; /**< the BSP-specific task info (not osal abstracted id) */ + uint32 context_id; /**< a unique ID assigned to this exception entry */ + uint32 context_size; /**< actual size of the "context_info" data */ + CFE_PSP_Exception_SysTaskId_t sys_task_id; /**< the BSP-specific task info (not osal abstracted id) */ CFE_PSP_Exception_ContextDataEntry_t context_info; }; - struct CFE_PSP_ExceptionStorage { - volatile uint32 NumWritten; - volatile uint32 NumRead; + volatile uint32 NumWritten; + volatile uint32 NumRead; struct CFE_PSP_Exception_LogData Entries[CFE_PSP_MAX_EXCEPTION_ENTRIES]; }; -typedef struct CFE_PSP_Exception_LogData CFE_PSP_Exception_LogData_t; -typedef struct CFE_PSP_ExceptionStorage CFE_PSP_ExceptionStorage_t; - +typedef struct CFE_PSP_Exception_LogData CFE_PSP_Exception_LogData_t; +typedef struct CFE_PSP_ExceptionStorage CFE_PSP_ExceptionStorage_t; #endif /* CFE_PSP_EXCEPTIONSTORAGE_TYPES_H_ */ diff --git a/fsw/shared/inc/cfe_psp_memory.h b/fsw/shared/inc/cfe_psp_memory.h index 6c42eb35..602340ce 100644 --- a/fsw/shared/inc/cfe_psp_memory.h +++ b/fsw/shared/inc/cfe_psp_memory.h @@ -23,9 +23,9 @@ ** ** Author: A. Cudmore ** -** Purpose: This file contains PSP support routine internal prototypes -** and typedefs. The routines and typedefs are intended for -** the local PSP routines only. +** Purpose: This file contains PSP support routine internal prototypes +** and typedefs. The routines and typedefs are intended for +** the local PSP routines only. ** ** Modification History: ** @@ -44,16 +44,15 @@ typedef struct { - void* BlockPtr; + void * BlockPtr; size_t BlockSize; } CFE_PSP_MemoryBlock_t; - typedef struct { CFE_PSP_ReservedMemoryBootRecord_t *BootPtr; - CFE_PSP_ExceptionStorage_t *ExceptionStoragePtr; + CFE_PSP_ExceptionStorage_t * ExceptionStoragePtr; CFE_PSP_MemoryBlock_t ResetMemory; CFE_PSP_MemoryBlock_t VolatileDiskMemory; @@ -61,8 +60,6 @@ typedef struct CFE_PSP_MemoryBlock_t UserReservedMemory; } CFE_PSP_ReservedMemoryMap_t; - - /** * \brief Initialize the CFE_PSP_ReservedMemoryMap global object * @@ -70,7 +67,6 @@ typedef struct */ extern void CFE_PSP_SetupReservedMemoryMap(void); - /* * CFE_PSP_InitProcessorReservedMemory initializes all of the memory in the * BSP that is preserved on a processor reset. The memory includes the @@ -81,8 +77,7 @@ extern void CFE_PSP_SetupReservedMemoryMap(void); * is preserved on a processor reset, and cleared/reinitialized on a power-on * reset. */ -extern int32 CFE_PSP_InitProcessorReservedMemory(uint32 RestartType ); - +extern int32 CFE_PSP_InitProcessorReservedMemory(uint32 RestartType); /** * \brief Unlink the memory segments within the CFE_PSP_ReservedMemoryMap global object @@ -93,7 +88,6 @@ extern int32 CFE_PSP_InitProcessorReservedMemory(uint32 RestartType ); */ extern void CFE_PSP_DeleteProcessorReservedMemory(void); - /* ** External variables */ @@ -104,4 +98,4 @@ extern void CFE_PSP_DeleteProcessorReservedMemory(void); */ extern CFE_PSP_ReservedMemoryMap_t CFE_PSP_ReservedMemoryMap; -#endif /* _cfe_psp_memory_ */ +#endif /* _cfe_psp_memory_ */ diff --git a/fsw/shared/inc/cfe_psp_module.h b/fsw/shared/inc/cfe_psp_module.h index a02628b9..ee4e6157 100644 --- a/fsw/shared/inc/cfe_psp_module.h +++ b/fsw/shared/inc/cfe_psp_module.h @@ -50,8 +50,8 @@ typedef void (*CFE_PSP_ModuleInitFunc_t)(uint32 PspModuleId); */ typedef const struct { - CFE_PSP_ModuleType_t ModuleType; - uint32 OperationFlags; + CFE_PSP_ModuleType_t ModuleType; + uint32 OperationFlags; CFE_PSP_ModuleInitFunc_t Init; /* More API calls may be added for other module types */ } CFE_PSP_ModuleApi_t; @@ -62,13 +62,12 @@ typedef const struct * * The "name" argument should match the name of the module object file */ -#define CFE_PSP_MODULE_DECLARE_SIMPLE(name) \ - static void name##_Init(uint32 PspModuleId); \ - CFE_PSP_ModuleApi_t CFE_PSP_##name##_API = \ - { \ - .ModuleType = CFE_PSP_MODULE_TYPE_SIMPLE, \ - .OperationFlags = 0, \ - .Init = name##_Init, \ +#define CFE_PSP_MODULE_DECLARE_SIMPLE(name) \ + static void name##_Init(uint32 PspModuleId); \ + CFE_PSP_ModuleApi_t CFE_PSP_##name##_API = { \ + .ModuleType = CFE_PSP_MODULE_TYPE_SIMPLE, \ + .OperationFlags = 0, \ + .Init = name##_Init, \ } /** @@ -112,5 +111,4 @@ int32 CFE_PSP_Module_FindByName(const char *ModuleName, uint32 *PspModuleId); */ int32 CFE_PSP_Module_GetAPIEntry(uint32 PspModuleId, CFE_PSP_ModuleApi_t **API); - #endif /* CFE_PSP_MODULE_H_ */ diff --git a/fsw/shared/src/cfe_psp_configdata.c b/fsw/shared/src/cfe_psp_configdata.c index d7aba840..31e748d3 100644 --- a/fsw/shared/src/cfe_psp_configdata.c +++ b/fsw/shared/src/cfe_psp_configdata.c @@ -38,21 +38,15 @@ * code such as CFE core or apps would not be able to \#include the * PSP cfe_psp_config.h or psp_version.h files */ -Target_PspConfigData GLOBAL_PSP_CONFIGDATA = -{ - .PSP_WatchdogMin = CFE_PSP_WATCHDOG_MIN, - .PSP_WatchdogMax = CFE_PSP_WATCHDOG_MAX, - .PSP_MemTableSize = CFE_PSP_MEM_TABLE_SIZE, - .PSP_MemoryTable = CFE_PSP_MemoryTable, +Target_PspConfigData GLOBAL_PSP_CONFIGDATA = {.PSP_WatchdogMin = CFE_PSP_WATCHDOG_MIN, + .PSP_WatchdogMax = CFE_PSP_WATCHDOG_MAX, + .PSP_MemTableSize = CFE_PSP_MEM_TABLE_SIZE, + .PSP_MemoryTable = CFE_PSP_MemoryTable, - .HW_NumEepromBanks = CFE_PSP_NUM_EEPROM_BANKS, + .HW_NumEepromBanks = CFE_PSP_NUM_EEPROM_BANKS, - .PSP_VersionInfo = - { - .MajorVersion = CFE_PSP_IMPL_MAJOR_VERSION, - .MinorVersion = CFE_PSP_IMPL_MINOR_VERSION, - .Revision = CFE_PSP_IMPL_REVISION, - .MissionRev = CFE_PSP_IMPL_MISSION_REV, - .Version = CFE_PSP_IMPL_VERSION - } -}; + .PSP_VersionInfo = {.MajorVersion = CFE_PSP_IMPL_MAJOR_VERSION, + .MinorVersion = CFE_PSP_IMPL_MINOR_VERSION, + .Revision = CFE_PSP_IMPL_REVISION, + .MissionRev = CFE_PSP_IMPL_MISSION_REV, + .Version = CFE_PSP_IMPL_VERSION}}; diff --git a/fsw/shared/src/cfe_psp_eeprom.c b/fsw/shared/src/cfe_psp_eeprom.c index ec68f7ba..3bf74294 100644 --- a/fsw/shared/src/cfe_psp_eeprom.c +++ b/fsw/shared/src/cfe_psp_eeprom.c @@ -64,20 +64,20 @@ ** CFE_PSP_ERROR_ADD_MISALIGNED The Address is not aligned to 16 bit addressing ** scheme. */ -int32 CFE_PSP_EepromWrite32( cpuaddr MemoryAddress, uint32 uint32Value ) +int32 CFE_PSP_EepromWrite32(cpuaddr MemoryAddress, uint32 uint32Value) { - uint32 ret_value = CFE_PSP_SUCCESS; - - /* check 32 bit alignment */ - if( MemoryAddress & 0x00000003) - { - return(CFE_PSP_ERROR_ADDRESS_MISALIGNED) ; - } - - /* make the Write */ - *((uint32 *)MemoryAddress) = uint32Value; - - return(ret_value) ; + uint32 ret_value = CFE_PSP_SUCCESS; + + /* check 32 bit alignment */ + if (MemoryAddress & 0x00000003) + { + return (CFE_PSP_ERROR_ADDRESS_MISALIGNED); + } + + /* make the Write */ + *((uint32 *)MemoryAddress) = uint32Value; + + return (ret_value); } /* @@ -101,83 +101,79 @@ int32 CFE_PSP_EepromWrite32( cpuaddr MemoryAddress, uint32 uint32Value ) ** CFE_PSP_ERROR_ADD_MISALIGNED The Address is not aligned to 16 bit addressing ** scheme. */ -int32 CFE_PSP_EepromWrite16( cpuaddr MemoryAddress, uint16 uint16Value ) +int32 CFE_PSP_EepromWrite16(cpuaddr MemoryAddress, uint16 uint16Value) { - uint32 write32; - uint32 temp32; - uint32 aligned_address ; - - /* - ** check 16 bit alignment , check the 1st lsb - */ - if( MemoryAddress & 0x00000001) - { - return(CFE_PSP_ERROR_ADDRESS_MISALIGNED) ; - } - - temp32 = uint16Value ; - -#ifdef SOFTWARE_LITTLE_BIT_ORDER - /* - ** Implementation for Little Endian architectures ( x86 ) - */ + uint32 write32; + uint32 temp32; + uint32 aligned_address; + + /* + ** check 16 bit alignment , check the 1st lsb + */ + if (MemoryAddress & 0x00000001) + { + return (CFE_PSP_ERROR_ADDRESS_MISALIGNED); + } - /* - ** check the 2nd lsb to see if it's the 1st or 2nd 16 bit word - */ - if( (MemoryAddress & 0x00000002) ) - { - /* - ** writing the 16 high bit order of 32 bit field - */ - aligned_address = MemoryAddress - 2 ; - CFE_PSP_MemRead32 ( aligned_address ,&write32) ; - write32 = (write32 & 0x0000FFFF) | (temp32 << 16 ) ; - } - else - { - /* - ** writing the 16 low bit order of 32 bit field - */ - aligned_address = MemoryAddress; - CFE_PSP_MemRead32 ( aligned_address, &write32 ) ; - write32 = ( write32 & 0xFFFF0000 ) | ( temp32 ); - - } + temp32 = uint16Value; + +#ifdef SOFTWARE_LITTLE_BIT_ORDER + /* + ** Implementation for Little Endian architectures ( x86 ) + */ + + /* + ** check the 2nd lsb to see if it's the 1st or 2nd 16 bit word + */ + if ((MemoryAddress & 0x00000002)) + { + /* + ** writing the 16 high bit order of 32 bit field + */ + aligned_address = MemoryAddress - 2; + CFE_PSP_MemRead32(aligned_address, &write32); + write32 = (write32 & 0x0000FFFF) | (temp32 << 16); + } + else + { + /* + ** writing the 16 low bit order of 32 bit field + */ + aligned_address = MemoryAddress; + CFE_PSP_MemRead32(aligned_address, &write32); + write32 = (write32 & 0xFFFF0000) | (temp32); + } #else - /* - ** Implementation for Big Endian architectures (PPC, Coldfire ) - */ - /* - ** check the 2nd lsb to see if it's the 1st or 2nd 16 bit word - */ - if( (MemoryAddress & 0x00000002) ) - { - /* - ** writing the 16 high bit order of 32 bit field - */ - aligned_address = MemoryAddress - 2 ; - CFE_PSP_MemRead32 ( aligned_address ,&write32) ; - write32 = (write32 & 0xFFFF0000) | (temp32) ; - } - else - { - /* - ** writing the 16 low bit order of 32 bit field - */ - aligned_address = MemoryAddress; - CFE_PSP_MemRead32 ( aligned_address, &write32 ) ; - write32 = ( write32 & 0x0000FFFF ) | ( temp32 << 16 ); - - } -#endif - - return(CFE_PSP_EepromWrite32(aligned_address,write32)) ; - -} + /* + ** Implementation for Big Endian architectures (PPC, Coldfire ) + */ + /* + ** check the 2nd lsb to see if it's the 1st or 2nd 16 bit word + */ + if ((MemoryAddress & 0x00000002)) + { + /* + ** writing the 16 high bit order of 32 bit field + */ + aligned_address = MemoryAddress - 2; + CFE_PSP_MemRead32(aligned_address, &write32); + write32 = (write32 & 0xFFFF0000) | (temp32); + } + else + { + /* + ** writing the 16 low bit order of 32 bit field + */ + aligned_address = MemoryAddress; + CFE_PSP_MemRead32(aligned_address, &write32); + write32 = (write32 & 0x0000FFFF) | (temp32 << 16); + } +#endif + return (CFE_PSP_EepromWrite32(aligned_address, write32)); +} /* ** Name: CFE_PSP_EepromWrite8 @@ -199,71 +195,69 @@ int32 CFE_PSP_EepromWrite16( cpuaddr MemoryAddress, uint16 uint16Value ) ** timeout. */ -int32 CFE_PSP_EepromWrite8( cpuaddr MemoryAddress, uint8 ByteValue ) +int32 CFE_PSP_EepromWrite8(cpuaddr MemoryAddress, uint8 ByteValue) { - uint32 aligned_address ; - uint16 write16 ,temp16; - - temp16 = ByteValue ; - - -#ifdef SOFTWARE_LITTLE_BIT_ORDER - /* - ** Implementation for Little Endian architectures ( x86 ) - */ - /* - ** check the 1st lsb - */ - if( MemoryAddress & 0x00000001) - { - /* - ** writing the 8 high bit order of 16 bit field - */ - aligned_address = MemoryAddress - 1; - CFE_PSP_MemRead16 ( aligned_address ,&write16) ; - write16 = (write16 & 0x00FF) | ( temp16 << 8) ; - } - else - { - /* - ** writing the 8 low bit order of 16 bit field - */ - aligned_address = MemoryAddress ; - CFE_PSP_MemRead16 ( aligned_address, &write16 ) ; - write16 = (temp16 ) | (write16 & 0xFF00 ) ; - } + uint32 aligned_address; + uint16 write16, temp16; + + temp16 = ByteValue; + +#ifdef SOFTWARE_LITTLE_BIT_ORDER + /* + ** Implementation for Little Endian architectures ( x86 ) + */ + /* + ** check the 1st lsb + */ + if (MemoryAddress & 0x00000001) + { + /* + ** writing the 8 high bit order of 16 bit field + */ + aligned_address = MemoryAddress - 1; + CFE_PSP_MemRead16(aligned_address, &write16); + write16 = (write16 & 0x00FF) | (temp16 << 8); + } + else + { + /* + ** writing the 8 low bit order of 16 bit field + */ + aligned_address = MemoryAddress; + CFE_PSP_MemRead16(aligned_address, &write16); + write16 = (temp16) | (write16 & 0xFF00); + } #else - - /* - ** Implementation for Big Endian architectures (PPC, Coldfire ) - */ - /* - ** check the 1st lsb - */ - if( MemoryAddress & 0x00000001) - { - /* - ** writing the 8 high bit order of 16 bit field - */ - aligned_address = MemoryAddress - 1; - CFE_PSP_MemRead16 ( aligned_address ,&write16) ; - write16 = (write16 & 0xFF00) | ( temp16) ; - } - else - { - /* - ** writing the 8 low bit order of 16 bit field - */ - aligned_address = MemoryAddress ; - CFE_PSP_MemRead16 ( aligned_address, &write16 ) ; - write16 = (temp16 << 8 ) | (write16 & 0x00FF ) ; - } + /* + ** Implementation for Big Endian architectures (PPC, Coldfire ) + */ + + /* + ** check the 1st lsb + */ + if (MemoryAddress & 0x00000001) + { + /* + ** writing the 8 high bit order of 16 bit field + */ + aligned_address = MemoryAddress - 1; + CFE_PSP_MemRead16(aligned_address, &write16); + write16 = (write16 & 0xFF00) | (temp16); + } + else + { + /* + ** writing the 8 low bit order of 16 bit field + */ + aligned_address = MemoryAddress; + CFE_PSP_MemRead16(aligned_address, &write16); + write16 = (temp16 << 8) | (write16 & 0x00FF); + } #endif - return(CFE_PSP_EepromWrite16(aligned_address,write16)) ; - + return (CFE_PSP_EepromWrite16(aligned_address, write16)); } /* @@ -275,7 +269,7 @@ int32 CFE_PSP_EepromWrite8( cpuaddr MemoryAddress, uint8 ByteValue ) ** Assumptions and Notes: ** ** Parameters: -** Bank: Which bank of EEPROM +** Bank: Which bank of EEPROM ** ** Global Inputs: None ** @@ -287,7 +281,7 @@ int32 CFE_PSP_EepromWrite8( cpuaddr MemoryAddress, uint8 ByteValue ) */ int32 CFE_PSP_EepromWriteEnable(uint32 Bank) { - return(CFE_PSP_SUCCESS) ; + return (CFE_PSP_SUCCESS); } /* @@ -299,7 +293,7 @@ int32 CFE_PSP_EepromWriteEnable(uint32 Bank) ** Assumptions and Notes: ** ** Parameters: -** Bank: Which bank of EEPROM +** Bank: Which bank of EEPROM ** ** Global Inputs: None ** @@ -311,10 +305,9 @@ int32 CFE_PSP_EepromWriteEnable(uint32 Bank) */ int32 CFE_PSP_EepromWriteDisable(uint32 Bank) { - return(CFE_PSP_SUCCESS) ; + return (CFE_PSP_SUCCESS); } - /* ** Name: CFE_PSP_EepromPowerUp ** @@ -323,7 +316,7 @@ int32 CFE_PSP_EepromWriteDisable(uint32 Bank) ** Assumptions and Notes: ** ** Parameters: -** Bank: Which bank of EEPROM +** Bank: Which bank of EEPROM ** ** Global Inputs: None ** @@ -335,11 +328,9 @@ int32 CFE_PSP_EepromWriteDisable(uint32 Bank) */ int32 CFE_PSP_EepromPowerUp(uint32 Bank) { - return(CFE_PSP_SUCCESS) ; + return (CFE_PSP_SUCCESS); } - - /* ** Name: CFE_PSP_EepromPowerDown ** @@ -348,7 +339,7 @@ int32 CFE_PSP_EepromPowerUp(uint32 Bank) ** Assumptions and Notes: ** ** Parameters: -** Bank: Which bank of EEPROM +** Bank: Which bank of EEPROM ** ** Global Inputs: None ** @@ -360,6 +351,5 @@ int32 CFE_PSP_EepromPowerUp(uint32 Bank) */ int32 CFE_PSP_EepromPowerDown(uint32 Bank) { - return(CFE_PSP_SUCCESS) ; + return (CFE_PSP_SUCCESS); } - diff --git a/fsw/shared/src/cfe_psp_exceptionstorage.c b/fsw/shared/src/cfe_psp_exceptionstorage.c index 397f7f82..0724c2be 100644 --- a/fsw/shared/src/cfe_psp_exceptionstorage.c +++ b/fsw/shared/src/cfe_psp_exceptionstorage.c @@ -56,9 +56,8 @@ /* ** Constants */ -#define CFE_PSP_MAX_EXCEPTION_ENTRY_MASK (CFE_PSP_MAX_EXCEPTION_ENTRIES-1) -#define CFE_PSP_EXCEPTION_ID_BASE ((OS_OBJECT_TYPE_USER + 0x101) << OS_OBJECT_TYPE_SHIFT) - +#define CFE_PSP_MAX_EXCEPTION_ENTRY_MASK (CFE_PSP_MAX_EXCEPTION_ENTRIES - 1) +#define CFE_PSP_EXCEPTION_ID_BASE ((OS_OBJECT_TYPE_USER + 0x101) << OS_OBJECT_TYPE_SHIFT) /*************************************************************************** ** INTERNAL FUNCTION DEFINITIONS @@ -72,15 +71,14 @@ void CFE_PSP_Exception_Reset(void) { /* just reset the counter */ - CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr->NumRead = - CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr->NumWritten; + CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr->NumRead = CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr->NumWritten; } /*--------------------------------------------------------------------------- * CFE_PSP_Exception_GetBuffer * Internal function - see description in prototype *---------------------------------------------------------------------------*/ -CFE_PSP_Exception_LogData_t* CFE_PSP_Exception_GetBuffer(uint32 seq) +CFE_PSP_Exception_LogData_t *CFE_PSP_Exception_GetBuffer(uint32 seq) { return &CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr->Entries[seq & CFE_PSP_MAX_EXCEPTION_ENTRY_MASK]; } @@ -89,10 +87,10 @@ CFE_PSP_Exception_LogData_t* CFE_PSP_Exception_GetBuffer(uint32 seq) * CFE_PSP_Exception_GetNextContextBuffer * Internal function - see description in prototype *---------------------------------------------------------------------------*/ -CFE_PSP_Exception_LogData_t* CFE_PSP_Exception_GetNextContextBuffer(void) +CFE_PSP_Exception_LogData_t *CFE_PSP_Exception_GetNextContextBuffer(void) { - CFE_PSP_Exception_LogData_t* Buffer; - uint32 NextWrite; + CFE_PSP_Exception_LogData_t *Buffer; + uint32 NextWrite; NextWrite = CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr->NumWritten; if ((NextWrite - CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr->NumRead) >= CFE_PSP_MAX_EXCEPTION_ENTRIES) @@ -115,7 +113,7 @@ CFE_PSP_Exception_LogData_t* CFE_PSP_Exception_GetNextContextBuffer(void) *---------------------------------------------------------------------------*/ void CFE_PSP_Exception_WriteComplete(void) { - CFE_PSP_Exception_LogData_t* Buffer; + CFE_PSP_Exception_LogData_t *Buffer; /* * Incrementing the "NumWritten" field allows the application to receive this data @@ -132,11 +130,10 @@ void CFE_PSP_Exception_WriteComplete(void) * is not possible to "lock out" exceptions, they can occur at * any time code is running) */ - Buffer = CFE_PSP_Exception_GetBuffer(CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr->NumWritten); + Buffer = CFE_PSP_Exception_GetBuffer(CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr->NumWritten); Buffer->context_id = 0; } - /*************************************************************************** ** EXTERNAL FUNCTION DEFINITIONS ** (Functions used by CFE or PSP) @@ -148,7 +145,8 @@ void CFE_PSP_Exception_WriteComplete(void) *---------------------------------------------------------------------------*/ uint32 CFE_PSP_Exception_GetCount(void) { - return (CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr->NumWritten - CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr->NumRead); + return (CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr->NumWritten - + CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr->NumRead); } /*--------------------------------------------------------------------------- @@ -157,9 +155,9 @@ uint32 CFE_PSP_Exception_GetCount(void) *---------------------------------------------------------------------------*/ int32 CFE_PSP_Exception_GetSummary(uint32 *ContextLogId, osal_id_t *TaskId, char *ReasonBuf, uint32 ReasonSize) { - const CFE_PSP_Exception_LogData_t* Buffer; - uint32 NumStored; - int32 Status; + const CFE_PSP_Exception_LogData_t *Buffer; + uint32 NumStored; + int32 Status; NumStored = CFE_PSP_Exception_GetCount(); if (NumStored == 0) @@ -220,9 +218,9 @@ int32 CFE_PSP_Exception_GetSummary(uint32 *ContextLogId, osal_id_t *TaskId, char *---------------------------------------------------------------------------*/ int32 CFE_PSP_Exception_CopyContext(uint32 ContextLogId, void *ContextBuf, uint32 ContextSize) { - const CFE_PSP_Exception_LogData_t* Buffer; - uint32 SeqId; - uint32 ActualSize; + const CFE_PSP_Exception_LogData_t *Buffer; + uint32 SeqId; + uint32 ActualSize; SeqId = ContextLogId - CFE_PSP_EXCEPTION_ID_BASE; if (SeqId > OS_OBJECT_INDEX_MASK) @@ -251,11 +249,10 @@ int32 CFE_PSP_Exception_CopyContext(uint32 ContextLogId, void *ContextBuf, uint3 * where the CFE platform configuration has not allocated enough space for context logs. * Generate a warning message to raise awareness. */ OS_printf("CFE_PSP: Insufficient buffer for exception context, total=%lu bytes, saved=%lu\n", - (unsigned long)Buffer->context_size, (unsigned long)ContextSize); + (unsigned long)Buffer->context_size, (unsigned long)ContextSize); ActualSize = ContextSize; } - memcpy(ContextBuf, &Buffer->context_info, ActualSize); /* @@ -263,4 +260,3 @@ int32 CFE_PSP_Exception_CopyContext(uint32 ContextLogId, void *ContextBuf, uint3 */ return (int32)ActualSize; } - diff --git a/fsw/shared/src/cfe_psp_memrange.c b/fsw/shared/src/cfe_psp_memrange.c index 3d651801..8ddd7800 100644 --- a/fsw/shared/src/cfe_psp_memrange.c +++ b/fsw/shared/src/cfe_psp_memrange.c @@ -50,7 +50,7 @@ ** ** Assumptions and Notes: ** -** Parameters: +** Parameters: ** Address -- A 32 bit starting address of the memory range ** Size -- A 32 bit size of the memory range ( Address + Size = End Address ) ** MemoryType -- The memory type to validate, including but not limited to: @@ -70,90 +70,90 @@ */ int32 CFE_PSP_MemValidateRange(cpuaddr Address, uint32 Size, uint32 MemoryType) { - cpuaddr StartAddressToTest = Address; - cpuaddr EndAddressToTest = Address + Size - 1; - cpuaddr StartAddressInTable; - cpuaddr EndAddressInTable; - uint32 TypeInTable; - int32 ReturnCode = CFE_PSP_INVALID_MEM_ADDR; - uint32 i; - - /* - ** Before searching table, do a preliminary parameter validation - */ - if ( MemoryType != CFE_PSP_MEM_ANY && MemoryType != CFE_PSP_MEM_RAM && MemoryType != CFE_PSP_MEM_EEPROM ) - { - return(CFE_PSP_INVALID_MEM_TYPE); - } - - if ( EndAddressToTest < StartAddressToTest ) - { - return(CFE_PSP_INVALID_MEM_RANGE); - } - - for ( i = 0; i < CFE_PSP_MEM_TABLE_SIZE; i++ ) - { - /* - ** Only look at valid memory table entries - */ - if ( CFE_PSP_MemoryTable[i].MemoryType != CFE_PSP_MEM_INVALID ) - { - StartAddressInTable = CFE_PSP_MemoryTable[i].StartAddr; - EndAddressInTable = CFE_PSP_MemoryTable[i].StartAddr + CFE_PSP_MemoryTable[i].Size - 1; - TypeInTable = CFE_PSP_MemoryTable[i].MemoryType; - - /* - ** Step 1: Get the Address to Fit within the range - */ - if (( StartAddressToTest >= StartAddressInTable ) && ( StartAddressToTest <= EndAddressInTable )) - { + cpuaddr StartAddressToTest = Address; + cpuaddr EndAddressToTest = Address + Size - 1; + cpuaddr StartAddressInTable; + cpuaddr EndAddressInTable; + uint32 TypeInTable; + int32 ReturnCode = CFE_PSP_INVALID_MEM_ADDR; + uint32 i; + + /* + ** Before searching table, do a preliminary parameter validation + */ + if (MemoryType != CFE_PSP_MEM_ANY && MemoryType != CFE_PSP_MEM_RAM && MemoryType != CFE_PSP_MEM_EEPROM) + { + return (CFE_PSP_INVALID_MEM_TYPE); + } + + if (EndAddressToTest < StartAddressToTest) + { + return (CFE_PSP_INVALID_MEM_RANGE); + } + + for (i = 0; i < CFE_PSP_MEM_TABLE_SIZE; i++) + { + /* + ** Only look at valid memory table entries + */ + if (CFE_PSP_MemoryTable[i].MemoryType != CFE_PSP_MEM_INVALID) + { + StartAddressInTable = CFE_PSP_MemoryTable[i].StartAddr; + EndAddressInTable = CFE_PSP_MemoryTable[i].StartAddr + CFE_PSP_MemoryTable[i].Size - 1; + TypeInTable = CFE_PSP_MemoryTable[i].MemoryType; + /* - ** Step 2: Does the End Address Fit within the Range? - ** should not have to test the lower address, - ** since the StartAddressToTest is already in the range. - ** Can it be fooled by overflowing the 32 bit int? + ** Step 1: Get the Address to Fit within the range */ - if ( EndAddressToTest <= EndAddressInTable ) + if ((StartAddressToTest >= StartAddressInTable) && (StartAddressToTest <= EndAddressInTable)) { - /* - ** Step 3: Is the type OK? - */ - if ( MemoryType == CFE_PSP_MEM_ANY ) - { - ReturnCode = CFE_PSP_SUCCESS; - break; /* The range is valid, break out of the loop */ - } - else if ( MemoryType == CFE_PSP_MEM_RAM && TypeInTable == CFE_PSP_MEM_RAM ) - { - ReturnCode = CFE_PSP_SUCCESS; - break; /* The range is valid, break out of the loop */ - } - else if ( MemoryType == CFE_PSP_MEM_EEPROM && TypeInTable == CFE_PSP_MEM_EEPROM ) - { - ReturnCode = CFE_PSP_SUCCESS; - break; /* The range is valid, break out of the loop */ - } - else - { - ReturnCode = CFE_PSP_INVALID_MEM_TYPE; - /* The range is not valid, move to the next entry */ - } + /* + ** Step 2: Does the End Address Fit within the Range? + ** should not have to test the lower address, + ** since the StartAddressToTest is already in the range. + ** Can it be fooled by overflowing the 32 bit int? + */ + if (EndAddressToTest <= EndAddressInTable) + { + /* + ** Step 3: Is the type OK? + */ + if (MemoryType == CFE_PSP_MEM_ANY) + { + ReturnCode = CFE_PSP_SUCCESS; + break; /* The range is valid, break out of the loop */ + } + else if (MemoryType == CFE_PSP_MEM_RAM && TypeInTable == CFE_PSP_MEM_RAM) + { + ReturnCode = CFE_PSP_SUCCESS; + break; /* The range is valid, break out of the loop */ + } + else if (MemoryType == CFE_PSP_MEM_EEPROM && TypeInTable == CFE_PSP_MEM_EEPROM) + { + ReturnCode = CFE_PSP_SUCCESS; + break; /* The range is valid, break out of the loop */ + } + else + { + ReturnCode = CFE_PSP_INVALID_MEM_TYPE; + /* The range is not valid, move to the next entry */ + } + } + else + { + ReturnCode = CFE_PSP_INVALID_MEM_RANGE; + /* The range is not valid, move to the next entry */ + } } else { - ReturnCode = CFE_PSP_INVALID_MEM_RANGE; - /* The range is not valid, move to the next entry */ + ReturnCode = CFE_PSP_INVALID_MEM_ADDR; + /* The range is not valid, move to the next entry */ } - } - else - { - ReturnCode = CFE_PSP_INVALID_MEM_ADDR; - /* The range is not valid, move to the next entry */ - } - } /* End if MemoryType != CFE_PSP_MEM_INVALID */ - - } /* End for */ - return(ReturnCode); + } /* End if MemoryType != CFE_PSP_MEM_INVALID */ + + } /* End for */ + return (ReturnCode); } /* @@ -164,7 +164,7 @@ int32 CFE_PSP_MemValidateRange(cpuaddr Address, uint32 Size, uint32 MemoryType) ** ** Assumptions and Notes: ** -** Parameters: +** Parameters: ** None ** ** Global Inputs: None @@ -176,10 +176,9 @@ int32 CFE_PSP_MemValidateRange(cpuaddr Address, uint32 Size, uint32 MemoryType) */ uint32 CFE_PSP_MemRanges(void) { - return(CFE_PSP_MEM_TABLE_SIZE) ; + return (CFE_PSP_MEM_TABLE_SIZE); } - /* ** Name: CFE_PSP_MemRangeSet ** @@ -188,9 +187,9 @@ uint32 CFE_PSP_MemRanges(void) ** ** Assumptions and Notes: ** Because the table is fixed size, the entries are set by using the integer index. -** No validation is done with the address or size. +** No validation is done with the address or size. ** -** Parameters: +** Parameters: ** RangeNum -- A 32 bit integer ( starting with 0 ) specifying the MemoryTable entry. ** MemoryType -- The memory type to validate, including but not limited to: ** CFE_PSP_MEM_RAM, CFE_PSP_MEM_EEPROM, or CFE_PSP_MEM_ANY @@ -216,42 +215,42 @@ uint32 CFE_PSP_MemRanges(void) ** CFE_PSP_INVALID_MEM_WORDSIZE -- The WordSIze parameter is not one of the predefined types. ** CFE_PSP_INVALID_MEM_ATTR -- The Attributes parameter is not one of the predefined types. */ -int32 CFE_PSP_MemRangeSet (uint32 RangeNum, uint32 MemoryType, cpuaddr StartAddr, - uint32 Size, uint32 WordSize, uint32 Attributes) +int32 CFE_PSP_MemRangeSet(uint32 RangeNum, uint32 MemoryType, cpuaddr StartAddr, uint32 Size, uint32 WordSize, + uint32 Attributes) { - if ( RangeNum >= CFE_PSP_MEM_TABLE_SIZE ) - { - return(CFE_PSP_INVALID_MEM_RANGE); - } + if (RangeNum >= CFE_PSP_MEM_TABLE_SIZE) + { + return (CFE_PSP_INVALID_MEM_RANGE); + } + + if ((MemoryType != CFE_PSP_MEM_RAM) && (MemoryType != CFE_PSP_MEM_EEPROM)) + { + return (CFE_PSP_INVALID_MEM_TYPE); + } - if ( ( MemoryType != CFE_PSP_MEM_RAM ) && ( MemoryType != CFE_PSP_MEM_EEPROM ) ) - { - return(CFE_PSP_INVALID_MEM_TYPE); - } - - if ( ( WordSize != CFE_PSP_MEM_SIZE_BYTE ) && ( WordSize != CFE_PSP_MEM_SIZE_WORD ) && - ( WordSize != CFE_PSP_MEM_SIZE_DWORD ) ) - { - return(CFE_PSP_INVALID_MEM_WORDSIZE); - } - - if ( ( Attributes != CFE_PSP_MEM_ATTR_READ ) && ( Attributes != CFE_PSP_MEM_ATTR_WRITE ) && - ( Attributes != CFE_PSP_MEM_ATTR_READWRITE )) - { - return(CFE_PSP_INVALID_MEM_ATTR); - } - - /* - ** Parameters check out, add the range - */ - CFE_PSP_MemoryTable[RangeNum].MemoryType = MemoryType; - CFE_PSP_MemoryTable[RangeNum].StartAddr = StartAddr; - CFE_PSP_MemoryTable[RangeNum].Size = Size; - CFE_PSP_MemoryTable[RangeNum].WordSize = WordSize; - CFE_PSP_MemoryTable[RangeNum].Attributes = Attributes; - - return(CFE_PSP_SUCCESS) ; + if ((WordSize != CFE_PSP_MEM_SIZE_BYTE) && (WordSize != CFE_PSP_MEM_SIZE_WORD) && + (WordSize != CFE_PSP_MEM_SIZE_DWORD)) + { + return (CFE_PSP_INVALID_MEM_WORDSIZE); + } + + if ((Attributes != CFE_PSP_MEM_ATTR_READ) && (Attributes != CFE_PSP_MEM_ATTR_WRITE) && + (Attributes != CFE_PSP_MEM_ATTR_READWRITE)) + { + return (CFE_PSP_INVALID_MEM_ATTR); + } + + /* + ** Parameters check out, add the range + */ + CFE_PSP_MemoryTable[RangeNum].MemoryType = MemoryType; + CFE_PSP_MemoryTable[RangeNum].StartAddr = StartAddr; + CFE_PSP_MemoryTable[RangeNum].Size = Size; + CFE_PSP_MemoryTable[RangeNum].WordSize = WordSize; + CFE_PSP_MemoryTable[RangeNum].Attributes = Attributes; + + return (CFE_PSP_SUCCESS); } /* @@ -263,13 +262,13 @@ int32 CFE_PSP_MemRangeSet (uint32 RangeNum, uint32 MemoryType, cpuaddr Sta ** Assumptions and Notes: ** Becasue the table is fixed size, the entries are accessed by using the integer index. ** -** Parameters: +** Parameters: ** RangeNum -- A 32 bit integer ( starting with 0 ) specifying the MemoryTable entry. ** *MemoryType -- A pointer to the 32 bit integer where the Memory Type is stored. ** Any defined CFE_PSP_MEM_* enumeration can be specified ** *Address -- A pointer to the 32 bit integer where the 32 bit starting address of the memory range ** is stored. -** *Size -- A pointer to the 32 bit integer where the 32 bit size of the memory range +** *Size -- A pointer to the 32 bit integer where the 32 bit size of the memory range ** is stored. ** *WordSize -- A pointer to the 32 bit integer where the the minimum addressable size of the range: ** ( CFE_PSP_MEM_SIZE_BYTE, CFE_PSP_MEM_SIZE_WORD, CFE_PSP_MEM_SIZE_DWORD ) @@ -285,25 +284,25 @@ int32 CFE_PSP_MemRangeSet (uint32 RangeNum, uint32 MemoryType, cpuaddr Sta ** CFE_PSP_INVALID_POINTER -- Parameter error ** CFE_PSP_INVALID_MEM_RANGE -- The index into the table is invalid */ -int32 CFE_PSP_MemRangeGet (uint32 RangeNum, uint32 *MemoryType, cpuaddr *StartAddr, - uint32 *Size, uint32 *WordSize, uint32 *Attributes) +int32 CFE_PSP_MemRangeGet(uint32 RangeNum, uint32 *MemoryType, cpuaddr *StartAddr, uint32 *Size, uint32 *WordSize, + uint32 *Attributes) { - if ( MemoryType == NULL || StartAddr == NULL || Size == NULL || WordSize == NULL || Attributes == NULL ) - { - return(CFE_PSP_INVALID_POINTER); - } - - if ( RangeNum >= CFE_PSP_MEM_TABLE_SIZE ) - { - return(CFE_PSP_INVALID_MEM_RANGE); - } - - *MemoryType = CFE_PSP_MemoryTable[RangeNum].MemoryType; - *StartAddr = CFE_PSP_MemoryTable[RangeNum].StartAddr; - *Size = CFE_PSP_MemoryTable[RangeNum].Size; - *WordSize = CFE_PSP_MemoryTable[RangeNum].WordSize; - *Attributes = CFE_PSP_MemoryTable[RangeNum].Attributes; - - return(CFE_PSP_SUCCESS) ; + if (MemoryType == NULL || StartAddr == NULL || Size == NULL || WordSize == NULL || Attributes == NULL) + { + return (CFE_PSP_INVALID_POINTER); + } + + if (RangeNum >= CFE_PSP_MEM_TABLE_SIZE) + { + return (CFE_PSP_INVALID_MEM_RANGE); + } + + *MemoryType = CFE_PSP_MemoryTable[RangeNum].MemoryType; + *StartAddr = CFE_PSP_MemoryTable[RangeNum].StartAddr; + *Size = CFE_PSP_MemoryTable[RangeNum].Size; + *WordSize = CFE_PSP_MemoryTable[RangeNum].WordSize; + *Attributes = CFE_PSP_MemoryTable[RangeNum].Attributes; + + return (CFE_PSP_SUCCESS); } diff --git a/fsw/shared/src/cfe_psp_memutils.c b/fsw/shared/src/cfe_psp_memutils.c index 91990d87..66b68745 100644 --- a/fsw/shared/src/cfe_psp_memutils.c +++ b/fsw/shared/src/cfe_psp_memutils.c @@ -69,13 +69,11 @@ ** ** Return Values: CFE_PSP_SUCCESS */ -int32 CFE_PSP_MemCpy ( void *dst, const void *src, uint32 size) +int32 CFE_PSP_MemCpy(void *dst, const void *src, uint32 size) { - memcpy( dst, src, size); - return(CFE_PSP_SUCCESS) ; -} - - + memcpy(dst, src, size); + return (CFE_PSP_SUCCESS); +} /* ** Name: CFE_PSP_MemSet @@ -101,9 +99,8 @@ int32 CFE_PSP_MemCpy ( void *dst, const void *src, uint32 size) /* ** CFE_PSP_MemSet */ -int32 CFE_PSP_MemSet ( void *dst, uint8 value , uint32 size) +int32 CFE_PSP_MemSet(void *dst, uint8 value, uint32 size) { - memset( dst, (int)value, (size_t)size); - return(CFE_PSP_SUCCESS) ; -} - + memset(dst, (int)value, (size_t)size); + return (CFE_PSP_SUCCESS); +} diff --git a/fsw/shared/src/cfe_psp_module.c b/fsw/shared/src/cfe_psp_module.c index f8f19892..5e2c0830 100644 --- a/fsw/shared/src/cfe_psp_module.c +++ b/fsw/shared/src/cfe_psp_module.c @@ -37,11 +37,11 @@ * that will fit in with the OSAL object ID values and not overlap anything. */ #ifdef OS_OBJECT_TYPE_USER -#define CFE_PSP_MODULE_BASE ((OS_OBJECT_TYPE_USER + 0x100) << OS_OBJECT_TYPE_SHIFT) -#define CFE_PSP_MODULE_INDEX_MASK OS_OBJECT_INDEX_MASK +#define CFE_PSP_MODULE_BASE ((OS_OBJECT_TYPE_USER + 0x100) << OS_OBJECT_TYPE_SHIFT) +#define CFE_PSP_MODULE_INDEX_MASK OS_OBJECT_INDEX_MASK #else -#define CFE_PSP_MODULE_BASE 0x01100000 -#define CFE_PSP_MODULE_INDEX_MASK 0xFFFF +#define CFE_PSP_MODULE_BASE 0x01100000 +#define CFE_PSP_MODULE_INDEX_MASK 0xFFFF #endif static uint32 CFE_PSP_ModuleCount = 0; @@ -54,7 +54,7 @@ static uint32 CFE_PSP_ModuleCount = 0; void CFE_PSP_ModuleInit(void) { CFE_StaticModuleLoadEntry_t *Entry; - CFE_PSP_ModuleApi_t *ApiPtr; + CFE_PSP_ModuleApi_t * ApiPtr; /* * Call the init function for all statically linked modules @@ -62,11 +62,10 @@ void CFE_PSP_ModuleInit(void) Entry = GLOBAL_CONFIGDATA.PspModuleList; if (Entry != NULL) { - while(Entry->Name != NULL) + while (Entry->Name != NULL) { ApiPtr = (CFE_PSP_ModuleApi_t *)Entry->Api; - if ((uint32)ApiPtr->ModuleType == CFE_PSP_MODULE_TYPE_SIMPLE && - ApiPtr->Init != NULL) + if ((uint32)ApiPtr->ModuleType == CFE_PSP_MODULE_TYPE_SIMPLE && ApiPtr->Init != NULL) { (*ApiPtr->Init)(CFE_PSP_MODULE_BASE | CFE_PSP_ModuleCount); } @@ -76,7 +75,6 @@ void CFE_PSP_ModuleInit(void) } } - /*************************************************** * Function Name: CFE_PSP_Module_GetAPIEntry * @@ -84,7 +82,7 @@ void CFE_PSP_ModuleInit(void) */ int32 CFE_PSP_Module_GetAPIEntry(uint32 PspModuleId, CFE_PSP_ModuleApi_t **API) { - int32 Result; + int32 Result; uint32 LocalId; Result = CFE_PSP_INVALID_MODULE_ID; @@ -93,7 +91,7 @@ int32 CFE_PSP_Module_GetAPIEntry(uint32 PspModuleId, CFE_PSP_ModuleApi_t **API) LocalId = PspModuleId & CFE_PSP_MODULE_INDEX_MASK; if (LocalId < CFE_PSP_ModuleCount) { - *API = (CFE_PSP_ModuleApi_t *)GLOBAL_CONFIGDATA.PspModuleList[LocalId].Api; + *API = (CFE_PSP_ModuleApi_t *)GLOBAL_CONFIGDATA.PspModuleList[LocalId].Api; Result = CFE_PSP_SUCCESS; } } @@ -101,7 +99,6 @@ int32 CFE_PSP_Module_GetAPIEntry(uint32 PspModuleId, CFE_PSP_ModuleApi_t **API) return Result; } - /*************************************************** * Function Name: CFE_PSP_Module_FindByName * @@ -109,19 +106,19 @@ int32 CFE_PSP_Module_GetAPIEntry(uint32 PspModuleId, CFE_PSP_ModuleApi_t **API) */ int32 CFE_PSP_Module_FindByName(const char *ModuleName, uint32 *PspModuleId) { - uint32 i; - int32 Result; + uint32 i; + int32 Result; CFE_StaticModuleLoadEntry_t *Entry; - Entry = GLOBAL_CONFIGDATA.PspModuleList; + Entry = GLOBAL_CONFIGDATA.PspModuleList; Result = CFE_PSP_INVALID_MODULE_NAME; - i = 0; + i = 0; while (i < CFE_PSP_ModuleCount) { if (strcmp(Entry->Name, ModuleName) == 0) { *PspModuleId = CFE_PSP_MODULE_BASE | (i & CFE_PSP_MODULE_INDEX_MASK); - Result = CFE_PSP_SUCCESS; + Result = CFE_PSP_SUCCESS; break; } ++Entry; diff --git a/fsw/shared/src/cfe_psp_port.c b/fsw/shared/src/cfe_psp_port.c index e4feac48..695941bf 100644 --- a/fsw/shared/src/cfe_psp_port.c +++ b/fsw/shared/src/cfe_psp_port.c @@ -38,14 +38,10 @@ #include "cfe_psp.h" - /* ** global memory */ - - - /* ** Name: CFE_PSP_PortRead8 ** @@ -66,12 +62,12 @@ ** ** Return Values: CFE_PSP_SUCCESS */ -int32 CFE_PSP_PortRead8( cpuaddr PortAddress, uint8 *ByteValue ) +int32 CFE_PSP_PortRead8(cpuaddr PortAddress, uint8 *ByteValue) { - (*ByteValue) = (uint8)*((uint8 *)PortAddress) ; + (*ByteValue) = (uint8) * ((uint8 *)PortAddress); - return(CFE_PSP_SUCCESS) ; + return (CFE_PSP_SUCCESS); } /* @@ -95,11 +91,10 @@ int32 CFE_PSP_PortRead8( cpuaddr PortAddress, uint8 *ByteValue ) ** Return Values: ** CFE_PSP_SUCCESS */ -int32 CFE_PSP_PortWrite8 ( cpuaddr PortAddress, uint8 ByteValue ) +int32 CFE_PSP_PortWrite8(cpuaddr PortAddress, uint8 ByteValue) { - *((uint8 *)PortAddress) = ByteValue; - return(CFE_PSP_SUCCESS) ; - + *((uint8 *)PortAddress) = ByteValue; + return (CFE_PSP_SUCCESS); } /* @@ -125,19 +120,17 @@ int32 CFE_PSP_PortWrite8 ( cpuaddr PortAddress, uint8 ByteValue ) ** CFE_PSP_ERROR_ADD_MISALIGNED The Address is not aligned to 16 bit ** addressing scheme. */ -int32 CFE_PSP_PortRead16( cpuaddr PortAddress, uint16 *uint16Value ) +int32 CFE_PSP_PortRead16(cpuaddr PortAddress, uint16 *uint16Value) { - /* check 16 bit alignment , check the 1st lsb */ - if( PortAddress & 0x00000001) - { - return(CFE_PSP_ERROR_ADDRESS_MISALIGNED) ; - } - (*uint16Value) = *((uint16 *)PortAddress) ; - return(CFE_PSP_SUCCESS) ; - + /* check 16 bit alignment , check the 1st lsb */ + if (PortAddress & 0x00000001) + { + return (CFE_PSP_ERROR_ADDRESS_MISALIGNED); + } + (*uint16Value) = *((uint16 *)PortAddress); + return (CFE_PSP_SUCCESS); } - /* ** Name: CFE_PSP_PortWrite16 ** @@ -161,15 +154,15 @@ int32 CFE_PSP_PortRead16( cpuaddr PortAddress, uint16 *uint16Value ) ** CFE_PSP_ERROR_ADD_MISALIGNED The Address is not aligned to 16 bit ** addressing scheme. */ -int32 CFE_PSP_PortWrite16 ( cpuaddr PortAddress, uint16 uint16Value ) +int32 CFE_PSP_PortWrite16(cpuaddr PortAddress, uint16 uint16Value) { - /* check 16 bit alignment , check the 1st lsb */ - if( PortAddress & 0x00000001) - { - return(CFE_PSP_ERROR_ADDRESS_MISALIGNED) ; - } - *((uint16 *)PortAddress) = uint16Value; - return(CFE_PSP_SUCCESS) ; + /* check 16 bit alignment , check the 1st lsb */ + if (PortAddress & 0x00000001) + { + return (CFE_PSP_ERROR_ADDRESS_MISALIGNED); + } + *((uint16 *)PortAddress) = uint16Value; + return (CFE_PSP_SUCCESS); } /* @@ -195,16 +188,15 @@ int32 CFE_PSP_PortWrite16 ( cpuaddr PortAddress, uint16 uint16Value ) ** CFE_PSP_ERROR_ADD_MISALIGNED The Address is not aligned to 16 bit ** addressing scheme. */ -int32 CFE_PSP_PortRead32( cpuaddr PortAddress, uint32 *uint32Value ) +int32 CFE_PSP_PortRead32(cpuaddr PortAddress, uint32 *uint32Value) { - /* check 32 bit alignment */ - if( PortAddress & 0x00000003) - { - return(CFE_PSP_ERROR_ADDRESS_MISALIGNED) ; - } - (*uint32Value) = *((uint32 *)PortAddress) ; - return(CFE_PSP_SUCCESS) ; - + /* check 32 bit alignment */ + if (PortAddress & 0x00000003) + { + return (CFE_PSP_ERROR_ADDRESS_MISALIGNED); + } + (*uint32Value) = *((uint32 *)PortAddress); + return (CFE_PSP_SUCCESS); } /* @@ -230,15 +222,13 @@ int32 CFE_PSP_PortRead32( cpuaddr PortAddress, uint32 *uint32Value ) ** CFE_PSP_ERROR_ADD_MISALIGNED The Address is not aligned to 16 bit ** addressing scheme. */ -int32 CFE_PSP_PortWrite32 ( cpuaddr PortAddress, uint32 uint32Value ) +int32 CFE_PSP_PortWrite32(cpuaddr PortAddress, uint32 uint32Value) { - /* check 32 bit alignment */ - if( PortAddress & 0x00000003) - { - return(CFE_PSP_ERROR_ADDRESS_MISALIGNED) ; - } - *((uint32 *)PortAddress) = uint32Value; - return(CFE_PSP_SUCCESS) ; - + /* check 32 bit alignment */ + if (PortAddress & 0x00000003) + { + return (CFE_PSP_ERROR_ADDRESS_MISALIGNED); + } + *((uint32 *)PortAddress) = uint32Value; + return (CFE_PSP_SUCCESS); } - diff --git a/fsw/shared/src/cfe_psp_ram.c b/fsw/shared/src/cfe_psp_ram.c index fd054cc5..d3653ba8 100644 --- a/fsw/shared/src/cfe_psp_ram.c +++ b/fsw/shared/src/cfe_psp_ram.c @@ -38,7 +38,6 @@ #include "cfe_psp.h" - /* ** global memory */ @@ -62,12 +61,12 @@ ** ** Return Values: CFE_PSP_SUCCESS */ -int32 CFE_PSP_MemRead8( cpuaddr MemoryAddress, uint8 *ByteValue ) +int32 CFE_PSP_MemRead8(cpuaddr MemoryAddress, uint8 *ByteValue) { - - (*ByteValue) = *((uint8 *)MemoryAddress) ; - - return(CFE_PSP_SUCCESS) ; + + (*ByteValue) = *((uint8 *)MemoryAddress); + + return (CFE_PSP_SUCCESS); } /* @@ -90,11 +89,10 @@ int32 CFE_PSP_MemRead8( cpuaddr MemoryAddress, uint8 *ByteValue ) ** Return Values: ** CFE_PSP_SUCCESS */ -int32 CFE_PSP_MemWrite8 ( cpuaddr MemoryAddress, uint8 ByteValue ) +int32 CFE_PSP_MemWrite8(cpuaddr MemoryAddress, uint8 ByteValue) { *((uint8 *)MemoryAddress) = ByteValue; - return(CFE_PSP_SUCCESS) ; - + return (CFE_PSP_SUCCESS); } /* @@ -120,16 +118,15 @@ int32 CFE_PSP_MemWrite8 ( cpuaddr MemoryAddress, uint8 ByteValue ) ** CFE_PSP_ERROR_ADD_MISALIGNED The Address is not aligned to 16 bit ** addressing scheme. */ -int32 CFE_PSP_MemRead16( cpuaddr MemoryAddress, uint16 *uint16Value ) +int32 CFE_PSP_MemRead16(cpuaddr MemoryAddress, uint16 *uint16Value) { - /* check 16 bit alignment , check the 1st lsb */ - if( MemoryAddress & 0x00000001) - { - return(CFE_PSP_ERROR_ADDRESS_MISALIGNED) ; - } - (*uint16Value) = *((uint16 *)MemoryAddress) ; - return(CFE_PSP_SUCCESS) ; - + /* check 16 bit alignment , check the 1st lsb */ + if (MemoryAddress & 0x00000001) + { + return (CFE_PSP_ERROR_ADDRESS_MISALIGNED); + } + (*uint16Value) = *((uint16 *)MemoryAddress); + return (CFE_PSP_SUCCESS); } /* ** Name: CFE_PSP_MemWrite16 @@ -154,15 +151,15 @@ int32 CFE_PSP_MemRead16( cpuaddr MemoryAddress, uint16 *uint16Value ) ** CFE_PSP_ERROR_ADD_MISALIGNED The MemoryAddress is not aligned to 16 bit ** addressing scheme. */ -int32 CFE_PSP_MemWrite16 ( cpuaddr MemoryAddress, uint16 uint16Value ) +int32 CFE_PSP_MemWrite16(cpuaddr MemoryAddress, uint16 uint16Value) { - /* check 16 bit alignment , check the 1st lsb */ - if( MemoryAddress & 0x00000001) - { - return(CFE_PSP_ERROR_ADDRESS_MISALIGNED) ; - } - *((uint16 *)MemoryAddress) = uint16Value; - return(CFE_PSP_SUCCESS) ; + /* check 16 bit alignment , check the 1st lsb */ + if (MemoryAddress & 0x00000001) + { + return (CFE_PSP_ERROR_ADDRESS_MISALIGNED); + } + *((uint16 *)MemoryAddress) = uint16Value; + return (CFE_PSP_SUCCESS); } /* ** Name: CFE_PSP_MemRead32 @@ -187,16 +184,16 @@ int32 CFE_PSP_MemWrite16 ( cpuaddr MemoryAddress, uint16 uint16Value ) ** CFE_PSP_ERROR_ADD_MISALIGNED The Address is not aligned to 16 bit ** addressing scheme. */ -int32 CFE_PSP_MemRead32( cpuaddr MemoryAddress, uint32 *uint32Value ) -{ - /* check 32 bit alignment */ - if( MemoryAddress & 0x00000003) - { - return(CFE_PSP_ERROR_ADDRESS_MISALIGNED) ; - } - (*uint32Value) = *((uint32 *)MemoryAddress) ; - - return(CFE_PSP_SUCCESS) ; +int32 CFE_PSP_MemRead32(cpuaddr MemoryAddress, uint32 *uint32Value) +{ + /* check 32 bit alignment */ + if (MemoryAddress & 0x00000003) + { + return (CFE_PSP_ERROR_ADDRESS_MISALIGNED); + } + (*uint32Value) = *((uint32 *)MemoryAddress); + + return (CFE_PSP_SUCCESS); } /* @@ -222,19 +219,16 @@ int32 CFE_PSP_MemRead32( cpuaddr MemoryAddress, uint32 *uint32Value ) ** CFE_PSP_ERROR_ADD_MISALIGNED The Address is not aligned to 16 bit ** addressing scheme. */ -int32 CFE_PSP_MemWrite32 ( cpuaddr MemoryAddress, uint32 uint32Value ) +int32 CFE_PSP_MemWrite32(cpuaddr MemoryAddress, uint32 uint32Value) { - - /* check 32 bit alignment */ - if( MemoryAddress & 0x00000003) - { - return(CFE_PSP_ERROR_ADDRESS_MISALIGNED) ; - } + + /* check 32 bit alignment */ + if (MemoryAddress & 0x00000003) + { + return (CFE_PSP_ERROR_ADDRESS_MISALIGNED); + } *((uint32 *)MemoryAddress) = uint32Value; - return(CFE_PSP_SUCCESS) ; + return (CFE_PSP_SUCCESS); } - - - diff --git a/unit-test-coverage/mcp750-vxworks/adaptors/inc/ut-adaptor-bootrec.h b/unit-test-coverage/mcp750-vxworks/adaptors/inc/ut-adaptor-bootrec.h index f87b4b91..de49c624 100644 --- a/unit-test-coverage/mcp750-vxworks/adaptors/inc/ut-adaptor-bootrec.h +++ b/unit-test-coverage/mcp750-vxworks/adaptors/inc/ut-adaptor-bootrec.h @@ -1,16 +1,15 @@ /* - * + * * Copyright (c) 2020, United States government as represented by the * administrator of the National Aeronautics Space Administration. * All rights reserved. This software was created at NASA Goddard * Space Flight Center pursuant to government contracts. - * + * * This is governed by the NASA Open Source Agreement and may be used, * distributed and modified only according to the terms of that agreement. - * + * */ - /** * \file ut-adaptor-bootrec.h * \ingroup adaptors @@ -23,10 +22,8 @@ #include -void UT_Setup_ReservedMem_BootRec(void); +void UT_Setup_ReservedMem_BootRec(void); uint32 UT_Get_ReservedMem_BootType(void); -void UT_Set_ReservedMem_BootType(uint32 reset_type); - - -#endif /* INCLUDE_UT_ADAPTOR_BOOTREC_H_ */ +void UT_Set_ReservedMem_BootType(uint32 reset_type); +#endif /* INCLUDE_UT_ADAPTOR_BOOTREC_H_ */ diff --git a/unit-test-coverage/mcp750-vxworks/adaptors/src/ut-adaptor-bootrec.c b/unit-test-coverage/mcp750-vxworks/adaptors/src/ut-adaptor-bootrec.c index 181c95f5..8319a749 100644 --- a/unit-test-coverage/mcp750-vxworks/adaptors/src/ut-adaptor-bootrec.c +++ b/unit-test-coverage/mcp750-vxworks/adaptors/src/ut-adaptor-bootrec.c @@ -1,16 +1,15 @@ /* - * + * * Copyright (c) 2020, United States government as represented by the * administrator of the National Aeronautics Space Administration. * All rights reserved. This software was created at NASA Goddard * Space Flight Center pursuant to government contracts. - * + * * This is governed by the NASA Open Source Agreement and may be used, * distributed and modified only according to the terms of that agreement. - * + * */ - /** * \file ut-adaptor-bootrec.c * \ingroup adaptors @@ -22,15 +21,13 @@ #include #include - static CFE_PSP_ReservedMemoryBootRecord_t UT_BOOTREC; -static const CFE_PSP_ReservedMemoryBootRecord_t UT_DEFAULT_BOOTREC = { 0 }; - +static const CFE_PSP_ReservedMemoryBootRecord_t UT_DEFAULT_BOOTREC = {0}; void UT_Setup_ReservedMem_BootRec(void) { - UT_BOOTREC = UT_DEFAULT_BOOTREC; + UT_BOOTREC = UT_DEFAULT_BOOTREC; CFE_PSP_ReservedMemoryMap.BootPtr = &UT_BOOTREC; } @@ -43,5 +40,3 @@ void UT_Set_ReservedMem_BootType(uint32 reset_type) { UT_BOOTREC.bsp_reset_type = reset_type; } - - diff --git a/unit-test-coverage/mcp750-vxworks/src/coveragetest-cfe-psp-start.c b/unit-test-coverage/mcp750-vxworks/src/coveragetest-cfe-psp-start.c index e7334288..befaa4be 100644 --- a/unit-test-coverage/mcp750-vxworks/src/coveragetest-cfe-psp-start.c +++ b/unit-test-coverage/mcp750-vxworks/src/coveragetest-cfe-psp-start.c @@ -1,16 +1,15 @@ /* - * + * * Copyright (c) 2020, United States government as represented by the * administrator of the National Aeronautics Space Administration. * All rights reserved. This software was created at NASA Goddard * Space Flight Center pursuant to government contracts. - * + * * This is governed by the NASA Open Source Agreement and may be used, * distributed and modified only according to the terms of that agreement. - * + * */ - /** * \file coveragetest-binsem.c * \ingroup vxworks @@ -18,7 +17,6 @@ * */ - #include "coveragetest-psp-mcp750-vxworks.h" #include "ut-adaptor-bootrec.h" @@ -46,8 +44,8 @@ typedef struct static int32 Test_Hook_ResetSubType(void *UserObj, int32 StubRetcode, uint32 CallCount, const UT_StubContext_t *Context) { PSP_UT_StartType_t *UserBuffer = UserObj; - UserBuffer->StartType = UT_Hook_GetArgValueByName(Context, "StartType", uint32); - UserBuffer->StartSubtype = UT_Hook_GetArgValueByName(Context, "StartSubtype", uint32); + UserBuffer->StartType = UT_Hook_GetArgValueByName(Context, "StartType", uint32); + UserBuffer->StartSubtype = UT_Hook_GetArgValueByName(Context, "StartSubtype", uint32); return StubRetcode; } @@ -131,7 +129,6 @@ void Test_OS_Application_Startup(void) UtAssert_INT32_EQ(UT_GetStubCount(UT_KEY(PCS_SystemMain)), 9); UtAssert_INT32_EQ(StartType.StartType, CFE_PSP_RST_TYPE_PROCESSOR); UtAssert_INT32_EQ(StartType.StartSubtype, CFE_PSP_RST_SUBTYPE_RESET_COMMAND); - } void Test_OS_Application_Run(void) @@ -147,4 +144,3 @@ void Test_OS_Application_Run(void) /* The function currently contains an infinite loop so cannot be tested now */ } - diff --git a/unit-test-coverage/mcp750-vxworks/src/coveragetest-cfe-psp-support.c b/unit-test-coverage/mcp750-vxworks/src/coveragetest-cfe-psp-support.c index a43b4539..7b2a6b25 100644 --- a/unit-test-coverage/mcp750-vxworks/src/coveragetest-cfe-psp-support.c +++ b/unit-test-coverage/mcp750-vxworks/src/coveragetest-cfe-psp-support.c @@ -1,16 +1,15 @@ /* - * + * * Copyright (c) 2020, United States government as represented by the * administrator of the National Aeronautics Space Administration. * All rights reserved. This software was created at NASA Goddard * Space Flight Center pursuant to government contracts. - * + * * This is governed by the NASA Open Source Agreement and may be used, * distributed and modified only according to the terms of that agreement. - * + * */ - /** * \file coveragetest-binsem.c * \ingroup vxworks @@ -18,7 +17,6 @@ * */ - #include "coveragetest-psp-mcp750-vxworks.h" #include "ut-adaptor-bootrec.h" @@ -98,6 +96,4 @@ void Test_CFE_PSP_GetSpacecraftId(void) * there is no way to modify the value at runtime, even in unit test. */ UtAssert_INT32_EQ(CFE_PSP_GetSpacecraftId(), PCS_CONFIG_SPACECRAFT); - } - diff --git a/unit-test-coverage/mcp750-vxworks/src/coveragetest-psp-mcp750-vxworks.c b/unit-test-coverage/mcp750-vxworks/src/coveragetest-psp-mcp750-vxworks.c index 2cb50510..214d6826 100644 --- a/unit-test-coverage/mcp750-vxworks/src/coveragetest-psp-mcp750-vxworks.c +++ b/unit-test-coverage/mcp750-vxworks/src/coveragetest-psp-mcp750-vxworks.c @@ -1,16 +1,15 @@ /* - * + * * Copyright (c) 2020, United States government as represented by the * administrator of the National Aeronautics Space Administration. * All rights reserved. This software was created at NASA Goddard * Space Flight Center pursuant to government contracts. - * + * * This is governed by the NASA Open Source Agreement and may be used, * distributed and modified only according to the terms of that agreement. - * + * */ - /** * \file coveragetest-binsem.c * \ingroup vxworks @@ -18,10 +17,8 @@ * */ - #include "coveragetest-psp-mcp750-vxworks.h" - /* Psp_Test_Setup * * Purpose: @@ -38,10 +35,7 @@ void Psp_Test_Setup(void) * Purpose: * Called by the unit test tool to tear down the app after each test */ -void Psp_Test_Teardown(void) -{ - -} +void Psp_Test_Teardown(void) {} /* UtTest_Setup * @@ -63,7 +57,4 @@ void UtTest_Setup(void) ADD_TEST(CFE_PSP_Exception_GetNextContextBuffer); ADD_TEST(CFE_PSP_Exception_GetSummary); ADD_TEST(CFE_PSP_Exception_CopyContext); - } - - diff --git a/unit-test-coverage/mcp750-vxworks/src/coveragetest-psp-mcp750-vxworks.h b/unit-test-coverage/mcp750-vxworks/src/coveragetest-psp-mcp750-vxworks.h index aad7e935..9ef50cb6 100644 --- a/unit-test-coverage/mcp750-vxworks/src/coveragetest-psp-mcp750-vxworks.h +++ b/unit-test-coverage/mcp750-vxworks/src/coveragetest-psp-mcp750-vxworks.h @@ -1,16 +1,15 @@ /* - * + * * Copyright (c) 2020, United States government as represented by the * administrator of the National Aeronautics Space Administration. * All rights reserved. This software was created at NASA Goddard * Space Flight Center pursuant to government contracts. - * + * * This is governed by the NASA Open Source Agreement and may be used, * distributed and modified only according to the terms of that agreement. - * + * */ - /** * \file psp-mcp750-vxworks-coveragetest.h * \ingroup vxworks @@ -27,7 +26,7 @@ #include -#define ADD_TEST(test) UtTest_Add((Test_ ## test), Psp_Test_Setup, Psp_Test_Teardown, #test) +#define ADD_TEST(test) UtTest_Add((Test_##test), Psp_Test_Setup, Psp_Test_Teardown, #test) /* Psp_Test_Setup * @@ -37,7 +36,6 @@ void Psp_Test_Setup(void); void Psp_Test_Teardown(void); - /* * Test routine dedicated to coverage of each of the PSP implementation functions */ @@ -50,6 +48,4 @@ void Test_CFE_PSP_GetSpacecraftId(void); void Test_OS_Application_Startup(void); void Test_OS_Application_Run(void); - -#endif /* INCLUDE_PSP_MCP750_VXWORKS_COVERAGETEST_H_ */ - +#endif /* INCLUDE_PSP_MCP750_VXWORKS_COVERAGETEST_H_ */ diff --git a/unit-test-coverage/shared/adaptors/inc/ut-adaptor-exceptions.h b/unit-test-coverage/shared/adaptors/inc/ut-adaptor-exceptions.h index ee251c25..e63534b5 100644 --- a/unit-test-coverage/shared/adaptors/inc/ut-adaptor-exceptions.h +++ b/unit-test-coverage/shared/adaptors/inc/ut-adaptor-exceptions.h @@ -1,16 +1,15 @@ /* - * + * * Copyright (c) 2020, United States government as represented by the * administrator of the National Aeronautics Space Administration. * All rights reserved. This software was created at NASA Goddard * Space Flight Center pursuant to government contracts. - * + * * This is governed by the NASA Open Source Agreement and may be used, * distributed and modified only according to the terms of that agreement. - * + * */ - /** * \file ut-adaptor-exceptions.h * \ingroup adaptors @@ -26,8 +25,7 @@ uint32 UT_Get_Exception_MaxEntries(void); size_t UT_Get_Exception_Size(void); -uint32 UT_Get_Exception_Id(struct CFE_PSP_Exception_LogData* Buffer); -void UT_Generate_Exception_Context(struct CFE_PSP_Exception_LogData* Buffer, size_t Size); - -#endif /* INCLUDE_UT_ADAPTOR_EXCEPTIONS_H_ */ +uint32 UT_Get_Exception_Id(struct CFE_PSP_Exception_LogData *Buffer); +void UT_Generate_Exception_Context(struct CFE_PSP_Exception_LogData *Buffer, size_t Size); +#endif /* INCLUDE_UT_ADAPTOR_EXCEPTIONS_H_ */ diff --git a/unit-test-coverage/shared/adaptors/src/ut-adaptor-exceptions.c b/unit-test-coverage/shared/adaptors/src/ut-adaptor-exceptions.c index 438c1a57..72d80bce 100644 --- a/unit-test-coverage/shared/adaptors/src/ut-adaptor-exceptions.c +++ b/unit-test-coverage/shared/adaptors/src/ut-adaptor-exceptions.c @@ -1,16 +1,15 @@ /* - * + * * Copyright (c) 2020, United States government as represented by the * administrator of the National Aeronautics Space Administration. * All rights reserved. This software was created at NASA Goddard * Space Flight Center pursuant to government contracts. - * + * * This is governed by the NASA Open Source Agreement and may be used, * distributed and modified only according to the terms of that agreement. - * + * */ - /** * \file ut-adaptor-exceptions.c * \ingroup adaptors @@ -22,8 +21,8 @@ #include #include -#define CFE_PSP_MAX_EXCEPTION_ENTRIES 4 -#define CFE_PSP_MAX_EXCEPTION_BACKTRACE_SIZE 16 +#define CFE_PSP_MAX_EXCEPTION_ENTRIES 4 +#define CFE_PSP_MAX_EXCEPTION_BACKTRACE_SIZE 16 uint32 UT_Get_Exception_MaxEntries(void) { @@ -35,20 +34,18 @@ size_t UT_Get_Exception_Size(void) return sizeof(CFE_PSP_Exception_ContextDataEntry_t); } -void UT_Generate_Exception_Context(struct CFE_PSP_Exception_LogData* Buffer, size_t Size) +void UT_Generate_Exception_Context(struct CFE_PSP_Exception_LogData *Buffer, size_t Size) { size_t i; - uint8 *Dest = (uint8*)&Buffer->context_info; - for(i=0; i < Size && i < sizeof(Buffer->context_info); ++i) + uint8 *Dest = (uint8 *)&Buffer->context_info; + for (i = 0; i < Size && i < sizeof(Buffer->context_info); ++i) { *Dest = i & 0xFF; } Buffer->context_size = i; } -uint32 UT_Get_Exception_Id(struct CFE_PSP_Exception_LogData* Buffer) +uint32 UT_Get_Exception_Id(struct CFE_PSP_Exception_LogData *Buffer) { return Buffer->context_id; } - - diff --git a/unit-test-coverage/shared/inc/coveragetest-psp-shared.h b/unit-test-coverage/shared/inc/coveragetest-psp-shared.h index 0701909e..dd568fe8 100644 --- a/unit-test-coverage/shared/inc/coveragetest-psp-shared.h +++ b/unit-test-coverage/shared/inc/coveragetest-psp-shared.h @@ -1,16 +1,15 @@ /* - * + * * Copyright (c) 2020, United States government as represented by the * administrator of the National Aeronautics Space Administration. * All rights reserved. This software was created at NASA Goddard * Space Flight Center pursuant to government contracts. - * + * * This is governed by the NASA Open Source Agreement and may be used, * distributed and modified only according to the terms of that agreement. - * + * */ - /** * \file psp-shared-coveragetest.h * \ingroup vxworks @@ -30,6 +29,4 @@ void Test_CFE_PSP_Exception_GetNextContextBuffer(void); void Test_CFE_PSP_Exception_GetSummary(void); void Test_CFE_PSP_Exception_CopyContext(void); - -#endif /* INCLUDE_PSP_SHARED_COVERAGETEST_H_ */ - +#endif /* INCLUDE_PSP_SHARED_COVERAGETEST_H_ */ diff --git a/unit-test-coverage/shared/src/coveragetest-cfe-psp-exceptionstorage.c b/unit-test-coverage/shared/src/coveragetest-cfe-psp-exceptionstorage.c index 81afe414..f9431fc7 100644 --- a/unit-test-coverage/shared/src/coveragetest-cfe-psp-exceptionstorage.c +++ b/unit-test-coverage/shared/src/coveragetest-cfe-psp-exceptionstorage.c @@ -1,16 +1,15 @@ /* - * + * * Copyright (c) 2020, United States government as represented by the * administrator of the National Aeronautics Space Administration. * All rights reserved. This software was created at NASA Goddard * Space Flight Center pursuant to government contracts. - * + * * This is governed by the NASA Open Source Agreement and may be used, * distributed and modified only according to the terms of that agreement. - * + * */ - /** * \file coveragetest-binsem.c * \ingroup vxworks @@ -32,24 +31,22 @@ #include "PCS_cfe_configdata.h" #endif - void Test_CFE_PSP_Exception_GetBuffer(void) { /* * Test Case For: * CFE_PSP_Exception_LogData_t* CFE_PSP_Exception_GetBuffer(uint32 seq) */ - struct CFE_PSP_Exception_LogData* Ptr0; - struct CFE_PSP_Exception_LogData* Ptr1; + struct CFE_PSP_Exception_LogData *Ptr0; + struct CFE_PSP_Exception_LogData *Ptr1; Ptr0 = CFE_PSP_Exception_GetBuffer(0); - UtAssert_True(Ptr0 != NULL, "CFE_PSP_Exception_GetBuffer(0) (%p) != NULL", (void*)Ptr0); + UtAssert_True(Ptr0 != NULL, "CFE_PSP_Exception_GetBuffer(0) (%p) != NULL", (void *)Ptr0); Ptr1 = CFE_PSP_Exception_GetBuffer(1); - UtAssert_True(Ptr1 != NULL, "CFE_PSP_Exception_GetBuffer(1) (%p) != NULL", (void*)Ptr1); + UtAssert_True(Ptr1 != NULL, "CFE_PSP_Exception_GetBuffer(1) (%p) != NULL", (void *)Ptr1); UtAssert_True(Ptr0 != Ptr1, "CFE_PSP_Exception_GetBuffer(0) (%p) != CFE_PSP_Exception_GetBuffer(1) (%p)", - (void*)Ptr0, (void*)Ptr1); - + (void *)Ptr0, (void *)Ptr1); } void Test_CFE_PSP_Exception_GetNextContextBuffer(void) { @@ -88,15 +85,15 @@ void Test_CFE_PSP_Exception_GetSummary(void) * Test Case For: * int32 CFE_PSP_Exception_GetSummary(uint32 *ContextLogId, uint32 *TaskId, char *ReasonBuf, uint32 ReasonSize) */ - char ReasonBuf[128]; - uint32 LogId; + char ReasonBuf[128]; + uint32 LogId; osal_id_t TaskId; osal_id_t TestId; /* Nominal - no exceptions pending should return CFE_PSP_NO_EXCEPTION_DATA */ CFE_PSP_Exception_Reset(); - UtAssert_INT32_EQ(CFE_PSP_Exception_GetSummary(&LogId, &TaskId, ReasonBuf, sizeof(ReasonBuf)), CFE_PSP_NO_EXCEPTION_DATA); - + UtAssert_INT32_EQ(CFE_PSP_Exception_GetSummary(&LogId, &TaskId, ReasonBuf, sizeof(ReasonBuf)), + CFE_PSP_NO_EXCEPTION_DATA); /* Set up an entry and then run again */ TestId = OS_ObjectIdFromInteger(2857); @@ -132,18 +129,18 @@ void Test_CFE_PSP_Exception_CopyContext(void) * Test Case For: * int32 CFE_PSP_Exception_CopyContext(uint32 ContextLogId, void *ContextBuf, uint32 ContextSize) */ - struct CFE_PSP_Exception_LogData* Ptr; - uint32 LogId; - uint32 NumEntries; - uint32 Count; - uint32 SmallBuf[1]; - uint32 LargeBuf[4]; + struct CFE_PSP_Exception_LogData *Ptr; + uint32 LogId; + uint32 NumEntries; + uint32 Count; + uint32 SmallBuf[1]; + uint32 LargeBuf[4]; CFE_PSP_Exception_Reset(); UtAssert_INT32_EQ(CFE_PSP_Exception_CopyContext(0, SmallBuf, sizeof(SmallBuf)), CFE_PSP_NO_EXCEPTION_DATA); Ptr = CFE_PSP_Exception_GetNextContextBuffer(); - UtAssert_True(Ptr != NULL, "CFE_PSP_Exception_GetNextContextBuffer() (%p) != NULL", (void*)Ptr); + UtAssert_True(Ptr != NULL, "CFE_PSP_Exception_GetNextContextBuffer() (%p) != NULL", (void *)Ptr); LogId = UT_Get_Exception_Id(Ptr); UT_Generate_Exception_Context(Ptr, sizeof(LargeBuf)); CFE_PSP_Exception_WriteComplete(); @@ -171,4 +168,3 @@ void Test_CFE_PSP_Exception_CopyContext(void) UtAssert_UINT32_EQ(CFE_PSP_Exception_GetCount(), NumEntries); UtAssert_INT32_EQ(CFE_PSP_Exception_CopyContext(LogId, SmallBuf, sizeof(SmallBuf)), CFE_PSP_NO_EXCEPTION_DATA); } - diff --git a/unit-test-coverage/ut-stubs/inc/PCS_arch_ppc_esfPpc.h b/unit-test-coverage/ut-stubs/inc/PCS_arch_ppc_esfPpc.h index dea48cda..809a51bb 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_arch_ppc_esfPpc.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_arch_ppc_esfPpc.h @@ -21,6 +21,4 @@ typedef struct uint32_t pad[32]; } PCS_ESFPPC; - #endif /* _PSP_STUB_ESFPPC_H_ */ - diff --git a/unit-test-coverage/ut-stubs/inc/PCS_arch_ppc_vxPpcLib.h b/unit-test-coverage/ut-stubs/inc/PCS_arch_ppc_vxPpcLib.h index affbaef9..d227d312 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_arch_ppc_vxPpcLib.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_arch_ppc_vxPpcLib.h @@ -11,19 +11,19 @@ */ #if defined(_VXWORKS_OS_) && defined(__PPC__) -#define PCS_PPC_MSR_EE _PPC_MSR_EE -#define PCS_PPC_MSR_FP _PPC_MSR_FP -#define PCS_PPC_MSR_ME _PPC_MSR_ME -#define PCS_PPC_MSR_FE0 _PPC_MSR_FE0 -#define PCS_PPC_MSR_FE1 _PPC_MSR_FE1 -#define PCS_PPC_MSR_DR _PPC_MSR_DR +#define PCS_PPC_MSR_EE _PPC_MSR_EE +#define PCS_PPC_MSR_FP _PPC_MSR_FP +#define PCS_PPC_MSR_ME _PPC_MSR_ME +#define PCS_PPC_MSR_FE0 _PPC_MSR_FE0 +#define PCS_PPC_MSR_FE1 _PPC_MSR_FE1 +#define PCS_PPC_MSR_DR _PPC_MSR_DR -#define PCS_PPC_FPSCR_VE _PPC_FPSCR_VE -#define PCS_PPC_FPSCR_OE _PPC_FPSCR_OE -#define PCS_PPC_FPSCR_NI _PPC_FPSCR_NI -#define PCS_PPC_FPSCR_ZE _PPC_FPSCR_ZE -#define PCS_PPC_FPSCR_XE _PPC_FPSCR_XE -#define PCS_PPC_FPSCR_UE _PPC_FPSCR_UE +#define PCS_PPC_FPSCR_VE _PPC_FPSCR_VE +#define PCS_PPC_FPSCR_OE _PPC_FPSCR_OE +#define PCS_PPC_FPSCR_NI _PPC_FPSCR_NI +#define PCS_PPC_FPSCR_ZE _PPC_FPSCR_ZE +#define PCS_PPC_FPSCR_XE _PPC_FPSCR_XE +#define PCS_PPC_FPSCR_UE _PPC_FPSCR_UE #else @@ -31,23 +31,22 @@ /* constants normally defined in vxPpcLib.h */ /* ----------------------------------------- */ -#define PCS_PPC_MSR_EE 0x2101 -#define PCS_PPC_MSR_FP 0x2102 -#define PCS_PPC_MSR_ME 0x2104 -#define PCS_PPC_MSR_FE0 0x2108 -#define PCS_PPC_MSR_FE1 0x2110 -#define PCS_PPC_MSR_DR 0x2120 +#define PCS_PPC_MSR_EE 0x2101 +#define PCS_PPC_MSR_FP 0x2102 +#define PCS_PPC_MSR_ME 0x2104 +#define PCS_PPC_MSR_FE0 0x2108 +#define PCS_PPC_MSR_FE1 0x2110 +#define PCS_PPC_MSR_DR 0x2120 -#define PCS_PPC_FPSCR_VE 0x2201 -#define PCS_PPC_FPSCR_OE 0x2202 -#define PCS_PPC_FPSCR_NI 0x2204 -#define PCS_PPC_FPSCR_ZE 0x2208 -#define PCS_PPC_FPSCR_XE 0x2210 -#define PCS_PPC_FPSCR_UE 0x2220 +#define PCS_PPC_FPSCR_VE 0x2201 +#define PCS_PPC_FPSCR_OE 0x2202 +#define PCS_PPC_FPSCR_NI 0x2204 +#define PCS_PPC_FPSCR_ZE 0x2208 +#define PCS_PPC_FPSCR_XE 0x2210 +#define PCS_PPC_FPSCR_UE 0x2220 #endif - /* ----------------------------------------- */ /* types normally defined in vxPpcLib.h */ /* ----------------------------------------- */ @@ -55,12 +54,11 @@ /* ----------------------------------------- */ /* prototypes normally declared in vxPpcLib.h */ /* ----------------------------------------- */ -extern void PCS_vxTimeBaseGet (uint32_t *u, uint32_t *l); -extern void PCS_vxMsrSet (uint32_t); -extern uint32_t PCS_vxMsrGet (void); -extern void PCS_vxFpscrSet (uint32_t); -extern uint32_t PCS_vxFpscrGet (void); -extern uint32_t PCS_vxDecGet (void); +extern void PCS_vxTimeBaseGet(uint32_t *u, uint32_t *l); +extern void PCS_vxMsrSet(uint32_t); +extern uint32_t PCS_vxMsrGet(void); +extern void PCS_vxFpscrSet(uint32_t); +extern uint32_t PCS_vxFpscrGet(void); +extern uint32_t PCS_vxDecGet(void); #endif /* _PSP_STUB_VXPPCLIB_H_ */ - diff --git a/unit-test-coverage/ut-stubs/inc/PCS_basetypes.h b/unit-test-coverage/ut-stubs/inc/PCS_basetypes.h index 3845781e..291df083 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_basetypes.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_basetypes.h @@ -21,11 +21,9 @@ * potential re-mapping (#define) statements are done. */ -#include /* for correct size_t and ptrdiff_t types */ -#include /* for correct fixed-width integer types */ -#include /* for correct INT_MAX, etc. */ -#include /* for correct boolean semantics */ - +#include /* for correct size_t and ptrdiff_t types */ +#include /* for correct fixed-width integer types */ +#include /* for correct INT_MAX, etc. */ +#include /* for correct boolean semantics */ #endif /* _PSP_STUB_BASETYPES_H_ */ - diff --git a/unit-test-coverage/ut-stubs/inc/PCS_blkIo.h b/unit-test-coverage/ut-stubs/inc/PCS_blkIo.h index 04ca49c5..35268ceb 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_blkIo.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_blkIo.h @@ -16,9 +16,10 @@ #include /* The module and blk_dev types are used in several headers */ -typedef struct PCS_BLK_DEV { int bd; } PCS_BLK_DEV; -typedef PCS_BLK_DEV* PCS_BLK_DEV_ID; - +typedef struct PCS_BLK_DEV +{ + int bd; +} PCS_BLK_DEV; +typedef PCS_BLK_DEV *PCS_BLK_DEV_ID; #endif /* _PSP_STUB_BLKIO_H_ */ - diff --git a/unit-test-coverage/ut-stubs/inc/PCS_cacheLib.h b/unit-test-coverage/ut-stubs/inc/PCS_cacheLib.h index bea12788..3e0f385e 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_cacheLib.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_cacheLib.h @@ -16,7 +16,6 @@ /* ----------------------------------------- */ /* prototypes normally declared in cacheLib.h */ /* ----------------------------------------- */ -extern PCS_STATUS PCS_cacheTextUpdate (void * adrs, size_t bytes); +extern PCS_STATUS PCS_cacheTextUpdate(void *adrs, size_t bytes); #endif /* _PSP_STUB_CACHELIB_H_ */ - diff --git a/unit-test-coverage/ut-stubs/inc/PCS_cfe_configdata.h b/unit-test-coverage/ut-stubs/inc/PCS_cfe_configdata.h index 756485a4..63bae598 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_cfe_configdata.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_cfe_configdata.h @@ -3,17 +3,15 @@ #include - -#define PCS_CONFIG_MISSIONVERSION "UT-mission" -#define PCS_CONFIG_CFEVERSION "UT-CFE" -#define PCS_CONFIG_OSALVERSION "UT-OSAL" -#define PCS_CONFIG_CONFIGSTR "UT-config" -#define PCS_CONFIG_DATESTR "UT-date" -#define PCS_CONFIG_USERSTR "UT-user" -#define PCS_CONFIG_CPUNAME "UT-cpuname" -#define PCS_CONFIG_CPUNUMBER 111 -#define PCS_CONFIG_SPACECRAFT 222 - +#define PCS_CONFIG_MISSIONVERSION "UT-mission" +#define PCS_CONFIG_CFEVERSION "UT-CFE" +#define PCS_CONFIG_OSALVERSION "UT-OSAL" +#define PCS_CONFIG_CONFIGSTR "UT-config" +#define PCS_CONFIG_DATESTR "UT-date" +#define PCS_CONFIG_USERSTR "UT-user" +#define PCS_CONFIG_CPUNAME "UT-cpuname" +#define PCS_CONFIG_CPUNUMBER 111 +#define PCS_CONFIG_SPACECRAFT 222 /** * Stub for the main system entry function implemented in CFE ES @@ -25,13 +23,9 @@ void PCS_SystemMain(uint32 StartType, uint32 StartSubtype, uint32 ModeId, const */ void PCS_System1HzISR(void); - /** * Stub for notification function implemented in CFE ES */ void PCS_SystemNotify(void); - - #endif /* _PSP_STUB_CFE_CONFIGDATA_H_ */ - diff --git a/unit-test-coverage/ut-stubs/inc/PCS_dosFsLib.h b/unit-test-coverage/ut-stubs/inc/PCS_dosFsLib.h index fcb366ea..5e0accf0 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_dosFsLib.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_dosFsLib.h @@ -12,7 +12,7 @@ #define PCS_DOS_CHK_REPAIR 0x00000002 #define PCS_DOS_CHK_VERB_0 0x0000ff00 /* verbosity level/flags */ #define PCS_DOS_CHK_VERB_SILENT PCS_DOS_CHK_VERB_0 -#define PCS_DOS_OPT_BLANK 0x0002 /* create a clean boot block */ +#define PCS_DOS_OPT_BLANK 0x0002 /* create a clean boot block */ /* ----------------------------------------- */ /* types normally defined in dosFsLib.h */ @@ -23,7 +23,4 @@ /* ----------------------------------------- */ extern PCS_STATUS PCS_dosFsVolFormat(char *path, int opt, PCS_FUNCPTR pPromptFunc); - - #endif /* _PSP_STUB_DOSFSLIB_H_ */ - diff --git a/unit-test-coverage/ut-stubs/inc/PCS_drv_hdisk_ataDrv.h b/unit-test-coverage/ut-stubs/inc/PCS_drv_hdisk_ataDrv.h index 1b8d68ee..8e83fbe5 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_drv_hdisk_ataDrv.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_drv_hdisk_ataDrv.h @@ -18,9 +18,6 @@ /* ----------------------------------------- */ /* prototypes normally declared in drv/hdisk/ataDrv.h */ /* ----------------------------------------- */ -extern PCS_device_t PCS_ataXbdDevCreate (int ctrl, int drive, unsigned int nBlks, unsigned int offset, const char *); - - +extern PCS_device_t PCS_ataXbdDevCreate(int ctrl, int drive, unsigned int nBlks, unsigned int offset, const char *); #endif /* _PSP_STUB_DRV_HDISK_ATADRV_H_ */ - diff --git a/unit-test-coverage/ut-stubs/inc/PCS_errnoLib.h b/unit-test-coverage/ut-stubs/inc/PCS_errnoLib.h index 6ee7338d..10204a64 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_errnoLib.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_errnoLib.h @@ -17,8 +17,6 @@ /* prototypes normally declared in errnoLib.h */ /* ----------------------------------------- */ -extern int PCS_errnoGet (void); - +extern int PCS_errnoGet(void); #endif /* _PSP_STUB_ERRNOLIB_H_ */ - diff --git a/unit-test-coverage/ut-stubs/inc/PCS_excLib.h b/unit-test-coverage/ut-stubs/inc/PCS_excLib.h index 564b1f3a..4daad260 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_excLib.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_excLib.h @@ -17,8 +17,6 @@ /* prototypes normally declared in excLib.h */ /* ----------------------------------------- */ -extern void PCS_excHookAdd (void (*Hook)(PCS_TASK_ID, int, void *)); - +extern void PCS_excHookAdd(void (*Hook)(PCS_TASK_ID, int, void *)); #endif /* _PSP_STUB_EXCLIB_H_ */ - diff --git a/unit-test-coverage/ut-stubs/inc/PCS_fppLib.h b/unit-test-coverage/ut-stubs/inc/PCS_fppLib.h index 678e7e36..56d2646e 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_fppLib.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_fppLib.h @@ -20,7 +20,6 @@ typedef struct /* ----------------------------------------- */ /* prototypes normally declared in fppLib.h */ /* ----------------------------------------- */ -extern void PCS_fppSave (PCS_FP_CONTEXT *fpc); +extern void PCS_fppSave(PCS_FP_CONTEXT *fpc); #endif /* _PSP_STUB_FPPLIB_H_ */ - diff --git a/unit-test-coverage/ut-stubs/inc/PCS_mcpx750.h b/unit-test-coverage/ut-stubs/inc/PCS_mcpx750.h index c768a432..fdcaae75 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_mcpx750.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_mcpx750.h @@ -7,12 +7,12 @@ /* ----------------------------------------- */ /* constants normally defined in mcpx750.h */ /* ----------------------------------------- */ -#define PCS_SYS_REG_BLRR_PWRON 0x01 -#define PCS_SYS_REG_BLRR_PBRST 0x02 -#define PCS_SYS_REG_BLRR_FBTN 0x04 -#define PCS_SYS_REG_BLRR_WDT2 0x08 -#define PCS_SYS_REG_BLRR_SWSRST 0x10 -#define PCS_SYS_REG_BLRR_SWHRST 0x20 +#define PCS_SYS_REG_BLRR_PWRON 0x01 +#define PCS_SYS_REG_BLRR_PBRST 0x02 +#define PCS_SYS_REG_BLRR_FBTN 0x04 +#define PCS_SYS_REG_BLRR_WDT2 0x08 +#define PCS_SYS_REG_BLRR_SWSRST 0x10 +#define PCS_SYS_REG_BLRR_SWHRST 0x20 extern uint32_t *PCS_SYS_REG_BLRR; @@ -24,6 +24,4 @@ extern uint32_t *PCS_SYS_REG_BLRR; /* prototypes normally declared in mcpx750.h */ /* ----------------------------------------- */ - #endif /* _PSP_STUB_MCPX750_H_ */ - diff --git a/unit-test-coverage/ut-stubs/inc/PCS_moduleLib.h b/unit-test-coverage/ut-stubs/inc/PCS_moduleLib.h index bee1fce6..130f89aa 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_moduleLib.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_moduleLib.h @@ -12,8 +12,11 @@ /* ----------------------------------------- */ /* types normally defined in moduleLib.h */ /* ----------------------------------------- */ -typedef struct PCS_MODULE { int m; } PCS_MODULE; -typedef PCS_MODULE* PCS_MODULE_ID; +typedef struct PCS_MODULE +{ + int m; +} PCS_MODULE; +typedef PCS_MODULE *PCS_MODULE_ID; typedef struct PCS_MODULE_INFO { @@ -33,9 +36,7 @@ typedef struct PCS_MODULE_INFO /* prototypes normally declared in moduleLib.h */ /* ----------------------------------------- */ -extern PCS_STATUS PCS_moduleInfoGet(PCS_MODULE_ID moduleId, PCS_MODULE_INFO * pModuleInfo); -extern PCS_MODULE_ID PCS_moduleFindByName (const char *moduleName); - +extern PCS_STATUS PCS_moduleInfoGet(PCS_MODULE_ID moduleId, PCS_MODULE_INFO *pModuleInfo); +extern PCS_MODULE_ID PCS_moduleFindByName(const char *moduleName); #endif /* _PSP_STUB_MODULELIB_H_ */ - diff --git a/unit-test-coverage/ut-stubs/inc/PCS_ramDrv.h b/unit-test-coverage/ut-stubs/inc/PCS_ramDrv.h index c0dac8d9..2386af76 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_ramDrv.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_ramDrv.h @@ -17,11 +17,6 @@ /* ----------------------------------------- */ /* prototypes normally declared in ramDrv.h */ /* ----------------------------------------- */ -extern PCS_BLK_DEV *PCS_ramDevCreate (char *ramAddr, int bytesPerSec, int secPerTrack, - int nSectors, int secOffset); - - - +extern PCS_BLK_DEV *PCS_ramDevCreate(char *ramAddr, int bytesPerSec, int secPerTrack, int nSectors, int secOffset); #endif /* _PSP_STUB_RAMDRV_H_ */ - diff --git a/unit-test-coverage/ut-stubs/inc/PCS_rebootLib.h b/unit-test-coverage/ut-stubs/inc/PCS_rebootLib.h index 2f75f0f9..27dd8118 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_rebootLib.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_rebootLib.h @@ -7,8 +7,8 @@ /* ----------------------------------------- */ /* constants normally defined in rebootLib.h */ /* ----------------------------------------- */ -#define PCS_BOOT_CLEAR 0x2401 -#define PCS_BOOT_NORMAL 0x2402 +#define PCS_BOOT_CLEAR 0x2401 +#define PCS_BOOT_NORMAL 0x2402 /* ----------------------------------------- */ /* types normally defined in rebootLib.h */ @@ -19,6 +19,4 @@ /* ----------------------------------------- */ extern void PCS_reboot(int); - #endif /* _PSP_STUB_REBOOTLIB_H_ */ - diff --git a/unit-test-coverage/ut-stubs/inc/PCS_stdarg.h b/unit-test-coverage/ut-stubs/inc/PCS_stdarg.h index fc668bfc..5736f854 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_stdarg.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_stdarg.h @@ -11,18 +11,16 @@ /* ----------------------------------------- */ /* types normally defined in stdarg.h */ /* ----------------------------------------- */ -typedef struct { void *p; } PCS_va_list; - - +typedef struct +{ + void *p; +} PCS_va_list; /* ----------------------------------------- */ /* prototypes normally declared in stdarg.h */ /* ----------------------------------------- */ -#define PCS_va_start(ap, last) ap.p = &last +#define PCS_va_start(ap, last) ap.p = &last #define PCS_va_end(ap) - - #endif /* _PSP_STUB_STDARG_H_ */ - diff --git a/unit-test-coverage/ut-stubs/inc/PCS_stdio.h b/unit-test-coverage/ut-stubs/inc/PCS_stdio.h index 2cb93c8a..fabfc4db 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_stdio.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_stdio.h @@ -14,26 +14,23 @@ /* ----------------------------------------- */ typedef struct PCS_FILE PCS_FILE; - /* ----------------------------------------- */ /* prototypes normally declared in stdio.h */ /* ----------------------------------------- */ -extern int PCS_fclose (PCS_FILE * stream); -extern char *PCS_fgets (char * s, int n, PCS_FILE * stream); -extern PCS_FILE *PCS_fopen (const char * filename, const char * modes); -extern int PCS_fputs (const char * s, PCS_FILE * stream); -extern int PCS_remove (const char * filename); -extern int PCS_rename (const char * old, const char * nw); -extern int PCS_snprintf (char * s, size_t maxlen, const char * format, ...); -extern int PCS_vsnprintf (char * s, size_t maxlen, const char * format, PCS_va_list arg); -extern int PCS_printf (const char * format, ...); -extern int PCS_putchar (int c); - -extern PCS_FILE* PCS_stdin; -extern PCS_FILE* PCS_stdout; -extern PCS_FILE* PCS_stderr; - +extern int PCS_fclose(PCS_FILE *stream); +extern char * PCS_fgets(char *s, int n, PCS_FILE *stream); +extern PCS_FILE *PCS_fopen(const char *filename, const char *modes); +extern int PCS_fputs(const char *s, PCS_FILE *stream); +extern int PCS_remove(const char *filename); +extern int PCS_rename(const char *old, const char *nw); +extern int PCS_snprintf(char *s, size_t maxlen, const char *format, ...); +extern int PCS_vsnprintf(char *s, size_t maxlen, const char *format, PCS_va_list arg); +extern int PCS_printf(const char *format, ...); +extern int PCS_putchar(int c); + +extern PCS_FILE *PCS_stdin; +extern PCS_FILE *PCS_stdout; +extern PCS_FILE *PCS_stderr; #endif /* _PSP_STUB_STDIO_H_ */ - diff --git a/unit-test-coverage/ut-stubs/inc/PCS_stdlib.h b/unit-test-coverage/ut-stubs/inc/PCS_stdlib.h index 42ba094d..cdb09590 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_stdlib.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_stdlib.h @@ -8,9 +8,8 @@ /* constants normally defined in stdlib.h */ /* ----------------------------------------- */ -#define PCS_EXIT_SUCCESS 0x0100 -#define PCS_EXIT_FAILURE 0x0101 - +#define PCS_EXIT_SUCCESS 0x0100 +#define PCS_EXIT_FAILURE 0x0101 /* ----------------------------------------- */ /* types normally defined in stdlib.h */ @@ -20,12 +19,10 @@ /* prototypes normally declared in stdlib.h */ /* ----------------------------------------- */ -extern void PCS_exit (int status); -extern unsigned long int PCS_strtoul (const char * nptr, char ** endptr, int base); -extern int PCS_system (const char * command); -extern void *PCS_malloc(size_t sz); -extern void PCS_free(void *ptr); - +extern void PCS_exit(int status); +extern unsigned long int PCS_strtoul(const char *nptr, char **endptr, int base); +extern int PCS_system(const char *command); +extern void * PCS_malloc(size_t sz); +extern void PCS_free(void *ptr); #endif /* _PSP_STUB_STDLIB_H_ */ - diff --git a/unit-test-coverage/ut-stubs/inc/PCS_string.h b/unit-test-coverage/ut-stubs/inc/PCS_string.h index b7aceaa4..8d6137f7 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_string.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_string.h @@ -16,18 +16,17 @@ /* prototypes normally declared in string.h */ /* ----------------------------------------- */ -extern void *PCS_memcpy (void * dest, const void * src, size_t n); -extern void *PCS_memset (void * s, int c, size_t n); -extern int PCS_strcmp (const char * s1, const char * s2); -extern char *PCS_strcpy (char * dest, const char * src); -extern size_t PCS_strlen (const char * s); -extern int PCS_strncmp (const char * s1, const char * s2, size_t n); -extern char *PCS_strncpy (char * dest, const char * src, size_t n); -extern char *PCS_strchr(const char *s, int c); -extern char *PCS_strrchr (const char * s, int c); -extern char *PCS_strcat(char *dest, const char *src); -extern char *PCS_strncat(char *dest, const char *src, size_t n); -extern char *PCS_strerror(int errnum); +extern void * PCS_memcpy(void *dest, const void *src, size_t n); +extern void * PCS_memset(void *s, int c, size_t n); +extern int PCS_strcmp(const char *s1, const char *s2); +extern char * PCS_strcpy(char *dest, const char *src); +extern size_t PCS_strlen(const char *s); +extern int PCS_strncmp(const char *s1, const char *s2, size_t n); +extern char * PCS_strncpy(char *dest, const char *src, size_t n); +extern char * PCS_strchr(const char *s, int c); +extern char * PCS_strrchr(const char *s, int c); +extern char * PCS_strcat(char *dest, const char *src); +extern char * PCS_strncat(char *dest, const char *src, size_t n); +extern char * PCS_strerror(int errnum); #endif /* _PSP_STUB_STRING_H_ */ - diff --git a/unit-test-coverage/ut-stubs/inc/PCS_sysLib.h b/unit-test-coverage/ut-stubs/inc/PCS_sysLib.h index ef5b2389..034fd6dc 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_sysLib.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_sysLib.h @@ -16,18 +16,15 @@ /* ----------------------------------------- */ /* prototypes normally declared in sysLib.h */ /* ----------------------------------------- */ -extern int PCS_sysClkRateGet(void); -extern char *PCS_sysMemTop (void); - -extern void PCS_PciOutByte (uint32_t address, uint8_t data); -extern void PCS_PciOutLong (uint32_t address, uint32_t data); -extern void PCS_sysPciWrite32 (uint32_t address, uint32_t data); -extern void PCS_sysPciRead32 (uint32_t address, uint32_t *data); +extern int PCS_sysClkRateGet(void); +extern char *PCS_sysMemTop(void); +extern void PCS_PciOutByte(uint32_t address, uint8_t data); +extern void PCS_PciOutLong(uint32_t address, uint32_t data); +extern void PCS_sysPciWrite32(uint32_t address, uint32_t data); +extern void PCS_sysPciRead32(uint32_t address, uint32_t *data); extern unsigned int PCS_GetWrsKernelTextStart(void); -extern unsigned int PCS_GetWrsKernelTextEnd (void); - +extern unsigned int PCS_GetWrsKernelTextEnd(void); #endif /* _PSP_STUB_SYSLIB_H_ */ - diff --git a/unit-test-coverage/ut-stubs/inc/PCS_sys_types.h b/unit-test-coverage/ut-stubs/inc/PCS_sys_types.h index 3fbbf80c..f5633e59 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_sys_types.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_sys_types.h @@ -11,19 +11,16 @@ /* ----------------------------------------- */ /* types normally defined in sys/types.h */ /* ----------------------------------------- */ -typedef ptrdiff_t PCS_ssize_t; -typedef size_t PCS_off_t; -typedef unsigned int PCS_mode_t; -typedef long PCS_time_t; -typedef int PCS_pid_t; -typedef int PCS_gid_t; -typedef int PCS_uid_t; +typedef ptrdiff_t PCS_ssize_t; +typedef size_t PCS_off_t; +typedef unsigned int PCS_mode_t; +typedef long PCS_time_t; +typedef int PCS_pid_t; +typedef int PCS_gid_t; +typedef int PCS_uid_t; /* ----------------------------------------- */ /* prototypes normally declared in sys/types.h */ /* ----------------------------------------- */ - - #endif /* _PSP_STUB_SYS_TYPES_H_ */ - diff --git a/unit-test-coverage/ut-stubs/inc/PCS_taskLib.h b/unit-test-coverage/ut-stubs/inc/PCS_taskLib.h index 9042afed..db69815d 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_taskLib.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_taskLib.h @@ -8,8 +8,7 @@ /* ----------------------------------------- */ /* constants normally defined in taskLib.h */ /* ----------------------------------------- */ -#define PCS_VX_FP_TASK 0x1b01 /* execute with floating-point coprocessor support. */ - +#define PCS_VX_FP_TASK 0x1b01 /* execute with floating-point coprocessor support. */ /* ----------------------------------------- */ /* types normally defined in taskLib.h */ @@ -19,14 +18,13 @@ typedef struct PCS_WIND_TCB int data; } PCS_WIND_TCB; -typedef struct PCS_WIND_TCB* PCS_TASK_ID; +typedef struct PCS_WIND_TCB *PCS_TASK_ID; typedef struct PCS_TASK_DESC { PCS_TASK_ID tid; } PCS_TASK_DESC; - /* ----------------------------------------- */ /* prototypes normally declared in taskInfo.h */ /* ----------------------------------------- */ @@ -34,62 +32,31 @@ typedef struct PCS_TASK_DESC extern const char *PCS_taskName(PCS_TASK_ID task_id); extern PCS_TASK_ID PCS_taskNameToId(const char *name); extern PCS_TASK_ID PCS_taskIdDefault(PCS_TASK_ID task_id); -extern PCS_BOOL PCS_taskIsReady(PCS_TASK_ID task_id); -extern PCS_BOOL PCS_taskIsSuspended (PCS_TASK_ID task_id); -extern PCS_STATUS PCS_taskGetInfo(PCS_TASK_ID task_id, PCS_TASK_DESC *desc); - - +extern PCS_BOOL PCS_taskIsReady(PCS_TASK_ID task_id); +extern PCS_BOOL PCS_taskIsSuspended(PCS_TASK_ID task_id); +extern PCS_STATUS PCS_taskGetInfo(PCS_TASK_ID task_id, PCS_TASK_DESC *desc); /* ----------------------------------------- */ /* prototypes normally declared in taskLib.h */ /* ----------------------------------------- */ -extern PCS_STATUS PCS_taskActivate(PCS_TASK_ID tid); -extern void PCS_taskExit(int code); +extern PCS_STATUS PCS_taskActivate(PCS_TASK_ID tid); +extern void PCS_taskExit(int code); extern PCS_TASK_ID PCS_taskIdSelf(void); -extern PCS_STATUS PCS_taskDelay(int ticks); -extern PCS_STATUS PCS_taskDelete(PCS_TASK_ID tid); -extern PCS_STATUS PCS_taskDeleteForce(PCS_TASK_ID tid); -extern PCS_STATUS PCS_taskSuspend(PCS_TASK_ID tid); -extern PCS_STATUS PCS_taskResume(PCS_TASK_ID tid); -extern PCS_STATUS PCS_taskPrioritySet(PCS_TASK_ID tid, int newPriority); -extern PCS_TASK_ID PCS_taskSpawn(char * name, - int priority, - int options, - int stackSize, - PCS_FUNCPTR entryPt, - int arg1, - int arg2, - int arg3, - int arg4, - int arg5, - int arg6, - int arg7, - int arg8, - int arg9, - int arg10); - -PCS_STATUS PCS_taskInit(PCS_WIND_TCB *pTcb, - char *name, - int priority, - int options, - char * pStackBase, - int stackSize, - PCS_FUNCPTR entryPt, - int arg1, - int arg2, - int arg3, - int arg4, - int arg5, - int arg6, - int arg7, - int arg8, - int arg9, - int arg10 -); +extern PCS_STATUS PCS_taskDelay(int ticks); +extern PCS_STATUS PCS_taskDelete(PCS_TASK_ID tid); +extern PCS_STATUS PCS_taskDeleteForce(PCS_TASK_ID tid); +extern PCS_STATUS PCS_taskSuspend(PCS_TASK_ID tid); +extern PCS_STATUS PCS_taskResume(PCS_TASK_ID tid); +extern PCS_STATUS PCS_taskPrioritySet(PCS_TASK_ID tid, int newPriority); +extern PCS_TASK_ID PCS_taskSpawn(char *name, int priority, int options, int stackSize, PCS_FUNCPTR entryPt, int arg1, + int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9, + int arg10); + +PCS_STATUS PCS_taskInit(PCS_WIND_TCB *pTcb, char *name, int priority, int options, char *pStackBase, int stackSize, + PCS_FUNCPTR entryPt, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, + int arg8, int arg9, int arg10); PCS_WIND_TCB *PCS_taskTcb(PCS_TASK_ID tid); - #endif /* _PSP_STUB_TASKLIB_H_ */ - diff --git a/unit-test-coverage/ut-stubs/inc/PCS_unistd.h b/unit-test-coverage/ut-stubs/inc/PCS_unistd.h index e2c91f4b..d9307be3 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_unistd.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_unistd.h @@ -9,13 +9,12 @@ /* constants normally defined in unistd.h */ /* ----------------------------------------- */ -#define PCS_SEEK_SET 0x1C01 -#define PCS_SEEK_CUR 0x1C02 -#define PCS_SEEK_END 0x1C03 -#define PCS_STDIN_FILENO 0x1C04 -#define PCS_STDOUT_FILENO 0x1C05 -#define PCS_STDERR_FILENO 0x1C06 - +#define PCS_SEEK_SET 0x1C01 +#define PCS_SEEK_CUR 0x1C02 +#define PCS_SEEK_END 0x1C03 +#define PCS_STDIN_FILENO 0x1C04 +#define PCS_STDOUT_FILENO 0x1C05 +#define PCS_STDERR_FILENO 0x1C06 /* ----------------------------------------- */ /* types normally defined in unistd.h */ @@ -25,18 +24,16 @@ /* prototypes normally declared in unistd.h */ /* ----------------------------------------- */ -extern int PCS_close (int fd); -extern PCS_gid_t PCS_getegid (void); -extern PCS_uid_t PCS_geteuid (void); -extern long int PCS_gethostid (void); -extern int PCS_gethostname (char * name, size_t len); -extern PCS_pid_t PCS_getpid (void); -extern PCS_off_t PCS_lseek (int fd, PCS_off_t offset, int whence); -extern PCS_ssize_t PCS_read (int fd, void * buf, size_t nbytes); -extern int PCS_rmdir (const char * path); -extern long int PCS_sysconf (int name); -extern PCS_ssize_t PCS_write (int fd, const void * buf, size_t n); - +extern int PCS_close(int fd); +extern PCS_gid_t PCS_getegid(void); +extern PCS_uid_t PCS_geteuid(void); +extern long int PCS_gethostid(void); +extern int PCS_gethostname(char *name, size_t len); +extern PCS_pid_t PCS_getpid(void); +extern PCS_off_t PCS_lseek(int fd, PCS_off_t offset, int whence); +extern PCS_ssize_t PCS_read(int fd, void *buf, size_t nbytes); +extern int PCS_rmdir(const char *path); +extern long int PCS_sysconf(int name); +extern PCS_ssize_t PCS_write(int fd, const void *buf, size_t n); #endif /* _PSP_STUB_UNISTD_H_ */ - diff --git a/unit-test-coverage/ut-stubs/inc/PCS_usrLib.h b/unit-test-coverage/ut-stubs/inc/PCS_usrLib.h index a14ebb73..d8dbeb9a 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_usrLib.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_usrLib.h @@ -17,7 +17,4 @@ /* prototypes normally declared in usrLib.h */ /* ----------------------------------------- */ - - #endif /* _PSP_STUB_USRLIB_H_ */ - diff --git a/unit-test-coverage/ut-stubs/inc/PCS_vxLib.h b/unit-test-coverage/ut-stubs/inc/PCS_vxLib.h index 5501d93b..710efe2e 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_vxLib.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_vxLib.h @@ -16,7 +16,4 @@ /* prototypes normally declared in vxLib.h */ /* ----------------------------------------- */ - - #endif /* _PSP_STUB_VXLIB_H_ */ - diff --git a/unit-test-coverage/ut-stubs/inc/PCS_vxWorks.h b/unit-test-coverage/ut-stubs/inc/PCS_vxWorks.h index bf422816..fc4da4e5 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_vxWorks.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_vxWorks.h @@ -1,21 +1,20 @@ /* - * + * * Copyright (c) 2020, United States government as represented by the * administrator of the National Aeronautics Space Administration. * All rights reserved. This software was created at NASA Goddard * Space Flight Center pursuant to government contracts. - * + * * This is governed by the NASA Open Source Agreement and may be used, * distributed and modified only according to the terms of that agreement. - * + * */ - /** * \file PCS_vxWorks.h * \ingroup ut-stubs * \author joseph.p.hickey@nasa.gov - * PSP coverage stub replacement for vxWorks.h + * PSP coverage stub replacement for vxWorks.h */ #ifndef INCLUDE_OCS_VXWORKS_H_ @@ -29,7 +28,7 @@ enum { PCS_ERROR = -1, - PCS_OK = 0 + PCS_OK = 0 }; enum @@ -38,22 +37,20 @@ enum PCS_NO_WAIT = 0 }; - - /* ----------------------------------------- */ /* types normally defined in vxWorks.h */ /* ----------------------------------------- */ -typedef int PCS_STATUS; -typedef bool PCS_BOOL; -typedef unsigned int PCS_UINT; -typedef int8_t PCS_INT8; -typedef uint8_t PCS_UINT8; -typedef int16_t PCS_INT16; -typedef uint16_t PCS_UINT16; -typedef int32_t PCS_INT32; -typedef uint32_t PCS_UINT32; - -typedef long PCS_Vx_usr_arg_t; +typedef int PCS_STATUS; +typedef bool PCS_BOOL; +typedef unsigned int PCS_UINT; +typedef int8_t PCS_INT8; +typedef uint8_t PCS_UINT8; +typedef int16_t PCS_INT16; +typedef uint16_t PCS_UINT16; +typedef int32_t PCS_INT32; +typedef uint32_t PCS_UINT32; + +typedef long PCS_Vx_usr_arg_t; /* Function pointers are used in many VxWorks modules. */ /* @@ -64,14 +61,11 @@ typedef long PCS_Vx_usr_arg_t; * is defined as a int argument. This means that application code * may need to cast it at the time of use (which is generally done anyway). */ -typedef int (*PCS_FUNCPTR)(int); -typedef void (*PCS_VOIDFUNCPTR)(void); - +typedef int (*PCS_FUNCPTR)(int); +typedef void (*PCS_VOIDFUNCPTR)(void); /* ----------------------------------------- */ /* prototypes normally declared in vxWorks.h */ /* ----------------------------------------- */ - -#endif /* INCLUDE_OCS_VXWORKS_H_ */ - +#endif /* INCLUDE_OCS_VXWORKS_H_ */ diff --git a/unit-test-coverage/ut-stubs/inc/PCS_xbdBlkDev.h b/unit-test-coverage/ut-stubs/inc/PCS_xbdBlkDev.h index 47cebe76..93c7a14b 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_xbdBlkDev.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_xbdBlkDev.h @@ -9,7 +9,7 @@ /* ----------------------------------------- */ /* constants normally defined in xbdBlkDev.h */ /* ----------------------------------------- */ -#define PCS_NULLDEV ((PCS_device_t)0) +#define PCS_NULLDEV ((PCS_device_t)0) /* ----------------------------------------- */ /* types normally defined in xbdBlkDev.h */ @@ -19,10 +19,7 @@ typedef int PCS_device_t; /* ----------------------------------------- */ /* prototypes normally declared in xbdBlkDev.h */ /* ----------------------------------------- */ -extern PCS_device_t PCS_xbdBlkDevCreateSync (PCS_BLK_DEV *bd, const char *name); -extern PCS_STATUS PCS_xbdBlkDevDelete (PCS_device_t dev, PCS_BLK_DEV **ppbd); - - +extern PCS_device_t PCS_xbdBlkDevCreateSync(PCS_BLK_DEV *bd, const char *name); +extern PCS_STATUS PCS_xbdBlkDevDelete(PCS_device_t dev, PCS_BLK_DEV **ppbd); #endif /* _PSP_STUB_XBDBLKDEV_H_ */ - diff --git a/unit-test-coverage/ut-stubs/inc/PCS_xbdRamDisk.h b/unit-test-coverage/ut-stubs/inc/PCS_xbdRamDisk.h index cd586db0..1d62e325 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_xbdRamDisk.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_xbdRamDisk.h @@ -17,7 +17,4 @@ /* prototypes normally declared in xbdRamDisk.h */ /* ----------------------------------------- */ - - #endif /* _PSP_STUB_XBDRAMDISK_H_ */ - diff --git a/unit-test-coverage/ut-stubs/override_inc/arch/ppc/esfPpc.h b/unit-test-coverage/ut-stubs/override_inc/arch/ppc/esfPpc.h index 9424fa62..bf7b4a5c 100644 --- a/unit-test-coverage/ut-stubs/override_inc/arch/ppc/esfPpc.h +++ b/unit-test-coverage/ut-stubs/override_inc/arch/ppc/esfPpc.h @@ -17,7 +17,6 @@ /* ----------------------------------------- */ /* mappings for declarations in fenv.h */ /* ----------------------------------------- */ -#define ESFPPC PCS_ESFPPC - +#define ESFPPC PCS_ESFPPC #endif /* _PSP_OVERRIDE_ESFPPC_H_ */ diff --git a/unit-test-coverage/ut-stubs/override_inc/arch/ppc/vxPpcLib.h b/unit-test-coverage/ut-stubs/override_inc/arch/ppc/vxPpcLib.h index 0c810502..0c7bbe88 100644 --- a/unit-test-coverage/ut-stubs/override_inc/arch/ppc/vxPpcLib.h +++ b/unit-test-coverage/ut-stubs/override_inc/arch/ppc/vxPpcLib.h @@ -24,28 +24,28 @@ /* ----------------------------------------- */ /* mappings for declarations in vxPpcLib.h */ /* ----------------------------------------- */ -#define _PPC_MSR_EE PCS_PPC_MSR_EE -#define _PPC_MSR_FP PCS_PPC_MSR_FP -#define _PPC_MSR_ME PCS_PPC_MSR_ME -#define _PPC_MSR_FE0 PCS_PPC_MSR_FE0 -#define _PPC_MSR_FE1 PCS_PPC_MSR_FE1 -#define _PPC_MSR_DR PCS_PPC_MSR_DR - -#define _PPC_FPSCR_VE PCS_PPC_FPSCR_VE -#define _PPC_FPSCR_OE PCS_PPC_FPSCR_OE -#define _PPC_FPSCR_NI PCS_PPC_FPSCR_NI -#define _PPC_FPSCR_ZE PCS_PPC_FPSCR_ZE -#define _PPC_FPSCR_XE PCS_PPC_FPSCR_XE -#define _PPC_FPSCR_UE PCS_PPC_FPSCR_UE +#define _PPC_MSR_EE PCS_PPC_MSR_EE +#define _PPC_MSR_FP PCS_PPC_MSR_FP +#define _PPC_MSR_ME PCS_PPC_MSR_ME +#define _PPC_MSR_FE0 PCS_PPC_MSR_FE0 +#define _PPC_MSR_FE1 PCS_PPC_MSR_FE1 +#define _PPC_MSR_DR PCS_PPC_MSR_DR + +#define _PPC_FPSCR_VE PCS_PPC_FPSCR_VE +#define _PPC_FPSCR_OE PCS_PPC_FPSCR_OE +#define _PPC_FPSCR_NI PCS_PPC_FPSCR_NI +#define _PPC_FPSCR_ZE PCS_PPC_FPSCR_ZE +#define _PPC_FPSCR_XE PCS_PPC_FPSCR_XE +#define _PPC_FPSCR_UE PCS_PPC_FPSCR_UE #endif -#define vxTimeBaseGet PCS_vxTimeBaseGet +#define vxTimeBaseGet PCS_vxTimeBaseGet -#define vxMsrSet PCS_vxMsrSet -#define vxMsrGet PCS_vxMsrGet -#define vxFpscrSet PCS_vxFpscrSet -#define vxFpscrGet PCS_vxFpscrGet -#define vxDecGet PCS_vxDecGet +#define vxMsrSet PCS_vxMsrSet +#define vxMsrGet PCS_vxMsrGet +#define vxFpscrSet PCS_vxFpscrSet +#define vxFpscrGet PCS_vxFpscrGet +#define vxDecGet PCS_vxDecGet #endif /* _PSP_OVERRIDE_VXPPCLIB_H_ */ diff --git a/unit-test-coverage/ut-stubs/override_inc/blkIo.h b/unit-test-coverage/ut-stubs/override_inc/blkIo.h index 2e615e6d..79b7cbec 100644 --- a/unit-test-coverage/ut-stubs/override_inc/blkIo.h +++ b/unit-test-coverage/ut-stubs/override_inc/blkIo.h @@ -18,9 +18,8 @@ /* ---------------------------------------*/ /* mappings for declarations in blkIo.h */ /* ---------------------------------------*/ -#define NULLDEV PCS_NULLDEV -#define BLK_DEV PCS_BLK_DEV -#define BLK_DEV_ID PCS_BLK_DEV_ID - +#define NULLDEV PCS_NULLDEV +#define BLK_DEV PCS_BLK_DEV +#define BLK_DEV_ID PCS_BLK_DEV_ID #endif /* _PSP_OVERRIDE_BLKIO_H_ */ diff --git a/unit-test-coverage/ut-stubs/override_inc/cacheLib.h b/unit-test-coverage/ut-stubs/override_inc/cacheLib.h index 865e5ddc..519da6f0 100644 --- a/unit-test-coverage/ut-stubs/override_inc/cacheLib.h +++ b/unit-test-coverage/ut-stubs/override_inc/cacheLib.h @@ -17,7 +17,6 @@ /* ----------------------------------------- */ /* mappings for declarations in cacheLib.h */ /* ----------------------------------------- */ -#define cacheTextUpdate PCS_cacheTextUpdate - +#define cacheTextUpdate PCS_cacheTextUpdate #endif /* _PSP_OVERRIDE_CACHELIB_H_ */ diff --git a/unit-test-coverage/ut-stubs/override_inc/dosFsLib.h b/unit-test-coverage/ut-stubs/override_inc/dosFsLib.h index 673b66f2..6a200587 100644 --- a/unit-test-coverage/ut-stubs/override_inc/dosFsLib.h +++ b/unit-test-coverage/ut-stubs/override_inc/dosFsLib.h @@ -18,14 +18,12 @@ /* ----------------------------------------- */ /* mappings for declarations in dosFsLib.h */ /* ----------------------------------------- */ -#define DOS_CHK_ONLY PCS_DOS_CHK_ONLY -#define DOS_CHK_REPAIR PCS_DOS_CHK_REPAIR -#define DOS_CHK_VERB_0 PCS_DOS_CHK_VERB_0 -#define DOS_CHK_VERB_SILENT PCS_DOS_CHK_VERB_SILENT -#define DOS_OPT_BLANK PCS_DOS_OPT_BLANK - -#define dosFsVolFormat PCS_dosFsVolFormat - +#define DOS_CHK_ONLY PCS_DOS_CHK_ONLY +#define DOS_CHK_REPAIR PCS_DOS_CHK_REPAIR +#define DOS_CHK_VERB_0 PCS_DOS_CHK_VERB_0 +#define DOS_CHK_VERB_SILENT PCS_DOS_CHK_VERB_SILENT +#define DOS_OPT_BLANK PCS_DOS_OPT_BLANK +#define dosFsVolFormat PCS_dosFsVolFormat #endif /* _PSP_OVERRIDE_DOSFSLIB_H_ */ diff --git a/unit-test-coverage/ut-stubs/override_inc/drv/hdisk/ataDrv.h b/unit-test-coverage/ut-stubs/override_inc/drv/hdisk/ataDrv.h index af875f76..10ad3101 100644 --- a/unit-test-coverage/ut-stubs/override_inc/drv/hdisk/ataDrv.h +++ b/unit-test-coverage/ut-stubs/override_inc/drv/hdisk/ataDrv.h @@ -19,8 +19,7 @@ /* ----------------------------------------- */ /* mappings for declarations in drv/hdisk/ataDrv.h */ /* ----------------------------------------- */ -#define ataDevCreate PCS_ataDevCreate -#define ataXbdDevCreate PCS_ataXbdDevCreate - +#define ataDevCreate PCS_ataDevCreate +#define ataXbdDevCreate PCS_ataXbdDevCreate #endif /* _PSP_OVERRIDE_DRV_HDISK_ATADRV_H_ */ diff --git a/unit-test-coverage/ut-stubs/override_inc/errnoLib.h b/unit-test-coverage/ut-stubs/override_inc/errnoLib.h index 04be9c0c..b567f49e 100644 --- a/unit-test-coverage/ut-stubs/override_inc/errnoLib.h +++ b/unit-test-coverage/ut-stubs/override_inc/errnoLib.h @@ -15,11 +15,9 @@ #include #include - /* ----------------------------------------- */ /* mappings for declarations in errnoLib.h */ /* ----------------------------------------- */ -#define errnoGet PCS_errnoGet - +#define errnoGet PCS_errnoGet #endif /* _PSP_OVERRIDE_ERRNOLIB_H_ */ diff --git a/unit-test-coverage/ut-stubs/override_inc/excLib.h b/unit-test-coverage/ut-stubs/override_inc/excLib.h index 74e7162a..ef9e16c5 100644 --- a/unit-test-coverage/ut-stubs/override_inc/excLib.h +++ b/unit-test-coverage/ut-stubs/override_inc/excLib.h @@ -15,10 +15,9 @@ #include #include - /* ----------------------------------------- */ /* mappings for declarations in excLib.h */ /* ----------------------------------------- */ -#define excHookAdd PCS_excHookAdd +#define excHookAdd PCS_excHookAdd #endif /* _PSP_OVERRIDE_EXCLIB_H_ */ diff --git a/unit-test-coverage/ut-stubs/override_inc/fppLib.h b/unit-test-coverage/ut-stubs/override_inc/fppLib.h index 29bf1a38..63e27f0a 100644 --- a/unit-test-coverage/ut-stubs/override_inc/fppLib.h +++ b/unit-test-coverage/ut-stubs/override_inc/fppLib.h @@ -17,7 +17,7 @@ /* ----------------------------------------- */ /* mappings for declarations in fppLib.h */ /* ----------------------------------------- */ -#define FP_CONTEXT PCS_FP_CONTEXT -#define fppSave PCS_fppSave +#define FP_CONTEXT PCS_FP_CONTEXT +#define fppSave PCS_fppSave #endif /* _PSP_OVERRIDE_FPPLIB_H_ */ diff --git a/unit-test-coverage/ut-stubs/override_inc/mcpx750.h b/unit-test-coverage/ut-stubs/override_inc/mcpx750.h index 29855f71..f3906346 100644 --- a/unit-test-coverage/ut-stubs/override_inc/mcpx750.h +++ b/unit-test-coverage/ut-stubs/override_inc/mcpx750.h @@ -17,17 +17,17 @@ /* ----------------------------------------- */ /* mappings for declarations in mcpx750.h */ /* ----------------------------------------- */ -#define SYS_REG_BLRR PCS_SYS_REG_BLRR -#define SYS_REG_BLRR_PWRON PCS_SYS_REG_BLRR_PWRON -#define SYS_REG_BLRR_PBRST PCS_SYS_REG_BLRR_PBRST -#define SYS_REG_BLRR_FBTN PCS_SYS_REG_BLRR_FBTN -#define SYS_REG_BLRR_WDT2 PCS_SYS_REG_BLRR_WDT2 -#define SYS_REG_BLRR_SWSRST PCS_SYS_REG_BLRR_SWSRST -#define SYS_REG_BLRR_SWHRST PCS_SYS_REG_BLRR_SWHRST +#define SYS_REG_BLRR PCS_SYS_REG_BLRR +#define SYS_REG_BLRR_PWRON PCS_SYS_REG_BLRR_PWRON +#define SYS_REG_BLRR_PBRST PCS_SYS_REG_BLRR_PBRST +#define SYS_REG_BLRR_FBTN PCS_SYS_REG_BLRR_FBTN +#define SYS_REG_BLRR_WDT2 PCS_SYS_REG_BLRR_WDT2 +#define SYS_REG_BLRR_SWSRST PCS_SYS_REG_BLRR_SWSRST +#define SYS_REG_BLRR_SWHRST PCS_SYS_REG_BLRR_SWHRST -#define PCI_OUT_BYTE PCS_PciOutByte -#define PCI_OUT_LONG PCS_PciOutLong -#define sysPciWrite32 PCS_sysPciWrite32 -#define sysPciRead32 PCS_sysPciRead32 +#define PCI_OUT_BYTE PCS_PciOutByte +#define PCI_OUT_LONG PCS_PciOutLong +#define sysPciWrite32 PCS_sysPciWrite32 +#define sysPciRead32 PCS_sysPciRead32 #endif /* _PSP_OVERRIDE_MCPX750_H_ */ diff --git a/unit-test-coverage/ut-stubs/override_inc/moduleLib.h b/unit-test-coverage/ut-stubs/override_inc/moduleLib.h index 3a550e8a..cf89eeab 100644 --- a/unit-test-coverage/ut-stubs/override_inc/moduleLib.h +++ b/unit-test-coverage/ut-stubs/override_inc/moduleLib.h @@ -19,12 +19,10 @@ /* mappings for declarations in moduleLib.h */ /* ----------------------------------------- */ -#define MODULE_ID PCS_MODULE_ID -#define MODULE_INFO PCS_MODULE_INFO +#define MODULE_ID PCS_MODULE_ID +#define MODULE_INFO PCS_MODULE_INFO #define moduleInfoGet PCS_moduleInfoGet #define moduleFindByName PCS_moduleFindByName - #endif /* _PSP_OVERRIDE_MODULELIB_H_ */ - diff --git a/unit-test-coverage/ut-stubs/override_inc/ramDrv.h b/unit-test-coverage/ut-stubs/override_inc/ramDrv.h index 67327faa..d2f3c85f 100644 --- a/unit-test-coverage/ut-stubs/override_inc/ramDrv.h +++ b/unit-test-coverage/ut-stubs/override_inc/ramDrv.h @@ -20,7 +20,6 @@ /* mappings for declarations in ramDrv.h */ /* ----------------------------------------- */ -#define ramDevCreate PCS_ramDevCreate - +#define ramDevCreate PCS_ramDevCreate #endif /* _PSP_OVERRIDE_RAMDRV_H_ */ diff --git a/unit-test-coverage/ut-stubs/override_inc/rebootLib.h b/unit-test-coverage/ut-stubs/override_inc/rebootLib.h index da481701..edeea362 100644 --- a/unit-test-coverage/ut-stubs/override_inc/rebootLib.h +++ b/unit-test-coverage/ut-stubs/override_inc/rebootLib.h @@ -17,10 +17,9 @@ /* ----------------------------------------- */ /* mappings for declarations in rebootLib.h */ /* ----------------------------------------- */ -#define BOOT_CLEAR PCS_BOOT_CLEAR -#define BOOT_NORMAL PCS_BOOT_NORMAL - -#define reboot PCS_reboot +#define BOOT_CLEAR PCS_BOOT_CLEAR +#define BOOT_NORMAL PCS_BOOT_NORMAL +#define reboot PCS_reboot #endif /* _PSP_OVERRIDE_REBOOTLIB_H_ */ diff --git a/unit-test-coverage/ut-stubs/override_inc/stdarg.h b/unit-test-coverage/ut-stubs/override_inc/stdarg.h index adc2f3e8..d35eb937 100644 --- a/unit-test-coverage/ut-stubs/override_inc/stdarg.h +++ b/unit-test-coverage/ut-stubs/override_inc/stdarg.h @@ -18,9 +18,8 @@ /* mappings for declarations in stdarg.h */ /* ----------------------------------------- */ -#define va_list PCS_va_list -#define va_start(ap, last) PCS_va_start(ap, last) -#define va_end(ap) PCS_va_end(ap) - +#define va_list PCS_va_list +#define va_start(ap, last) PCS_va_start(ap, last) +#define va_end(ap) PCS_va_end(ap) #endif /* _PSP_OVERRIDE_STDARG_H_ */ diff --git a/unit-test-coverage/ut-stubs/override_inc/stdio.h b/unit-test-coverage/ut-stubs/override_inc/stdio.h index 61431b01..38802fa8 100644 --- a/unit-test-coverage/ut-stubs/override_inc/stdio.h +++ b/unit-test-coverage/ut-stubs/override_inc/stdio.h @@ -18,22 +18,20 @@ /* mappings for declarations in stdio.h */ /* ----------------------------------------- */ -#define FILE PCS_FILE -#define fclose PCS_fclose -#define fgets PCS_fgets -#define fopen PCS_fopen -#define fputs PCS_fputs -#define remove PCS_remove -#define rename PCS_rename -#define snprintf PCS_snprintf -#define vsnprintf PCS_vsnprintf -#define printf(...) PCS_printf(__VA_ARGS__) -#define putchar PCS_putchar - -#define stdin PCS_stdin -#define stdout PCS_stdout -#define stderr PCS_stderr - +#define FILE PCS_FILE +#define fclose PCS_fclose +#define fgets PCS_fgets +#define fopen PCS_fopen +#define fputs PCS_fputs +#define remove PCS_remove +#define rename PCS_rename +#define snprintf PCS_snprintf +#define vsnprintf PCS_vsnprintf +#define printf(...) PCS_printf(__VA_ARGS__) +#define putchar PCS_putchar + +#define stdin PCS_stdin +#define stdout PCS_stdout +#define stderr PCS_stderr #endif /* _PSP_OVERRIDE_STDIO_H_ */ - diff --git a/unit-test-coverage/ut-stubs/override_inc/stdlib.h b/unit-test-coverage/ut-stubs/override_inc/stdlib.h index 72c76e12..dd2ed941 100644 --- a/unit-test-coverage/ut-stubs/override_inc/stdlib.h +++ b/unit-test-coverage/ut-stubs/override_inc/stdlib.h @@ -18,13 +18,12 @@ /* mappings for declarations in stdlib.h */ /* ----------------------------------------- */ -#define EXIT_SUCCESS PCS_EXIT_SUCCESS -#define EXIT_FAILURE PCS_EXIT_FAILURE -#define exit PCS_exit -#define strtoul PCS_strtoul -#define system PCS_system -#define malloc PCS_malloc -#define free PCS_free - +#define EXIT_SUCCESS PCS_EXIT_SUCCESS +#define EXIT_FAILURE PCS_EXIT_FAILURE +#define exit PCS_exit +#define strtoul PCS_strtoul +#define system PCS_system +#define malloc PCS_malloc +#define free PCS_free #endif /* _PSP_OVERRIDE_STDLIB_H_ */ diff --git a/unit-test-coverage/ut-stubs/override_inc/string.h b/unit-test-coverage/ut-stubs/override_inc/string.h index 247e4a9e..2273e834 100644 --- a/unit-test-coverage/ut-stubs/override_inc/string.h +++ b/unit-test-coverage/ut-stubs/override_inc/string.h @@ -17,17 +17,17 @@ /* ----------------------------------------- */ /* mappings for declarations in string.h */ /* ----------------------------------------- */ -#define memcpy PCS_memcpy -#define memset PCS_memset -#define strcmp PCS_strcmp -#define strcpy PCS_strcpy -#define strlen PCS_strlen -#define strncmp PCS_strncmp -#define strncpy PCS_strncpy -#define strchr PCS_strchr -#define strrchr PCS_strrchr -#define strcat PCS_strcat -#define strncat PCS_strncat -#define strerror PCS_strerror +#define memcpy PCS_memcpy +#define memset PCS_memset +#define strcmp PCS_strcmp +#define strcpy PCS_strcpy +#define strlen PCS_strlen +#define strncmp PCS_strncmp +#define strncpy PCS_strncpy +#define strchr PCS_strchr +#define strrchr PCS_strrchr +#define strcat PCS_strcat +#define strncat PCS_strncat +#define strerror PCS_strerror #endif /* _PSP_OVERRIDE_STRING_H_ */ diff --git a/unit-test-coverage/ut-stubs/override_inc/sys/types.h b/unit-test-coverage/ut-stubs/override_inc/sys/types.h index 3c32cb45..9ff54bd0 100644 --- a/unit-test-coverage/ut-stubs/override_inc/sys/types.h +++ b/unit-test-coverage/ut-stubs/override_inc/sys/types.h @@ -17,11 +17,11 @@ /* ----------------------------------------- */ /* mappings for declarations in sys/types.h */ /* ----------------------------------------- */ -#define ssize_t PCS_ssize_t -#define off_t PCS_off_t -#define mode_t PCS_mode_t -#define pid_t PCS_pid_t -#define gid_t PCS_gid_t -#define uid_t PCS_uid_t +#define ssize_t PCS_ssize_t +#define off_t PCS_off_t +#define mode_t PCS_mode_t +#define pid_t PCS_pid_t +#define gid_t PCS_gid_t +#define uid_t PCS_uid_t #endif /* _PSP_OVERRIDE_SYS_TYPES_H_ */ diff --git a/unit-test-coverage/ut-stubs/override_inc/sysLib.h b/unit-test-coverage/ut-stubs/override_inc/sysLib.h index 49cffb4c..2ab3c81f 100644 --- a/unit-test-coverage/ut-stubs/override_inc/sysLib.h +++ b/unit-test-coverage/ut-stubs/override_inc/sysLib.h @@ -18,21 +18,21 @@ /* ----------------------------------------- */ /* mappings for declarations in sysLib.h */ /* ----------------------------------------- */ -#define sysClkRateGet PCS_sysClkRateGet -#define sysMemTop PCS_sysMemTop +#define sysClkRateGet PCS_sysClkRateGet +#define sysMemTop PCS_sysMemTop /* * These PCI accessors are related to sysLib but the prototype does not necessarily appear in this file */ -#define PciOutByte PCS_PciOutByte -#define PciOutLong PCS_PciOutLong -#define sysPciWrite32 PCS_sysPciWrite32 -#define sysPciRead32 PCS_sysPciRead32 +#define PciOutByte PCS_PciOutByte +#define PciOutLong PCS_PciOutLong +#define sysPciWrite32 PCS_sysPciWrite32 +#define sysPciRead32 PCS_sysPciRead32 /* * These definitions are part of BSP integration which does not have a header file */ -#define GetWrsKernelTextStart PCS_GetWrsKernelTextStart -#define GetWrsKernelTextEnd PCS_GetWrsKernelTextEnd +#define GetWrsKernelTextStart PCS_GetWrsKernelTextStart +#define GetWrsKernelTextEnd PCS_GetWrsKernelTextEnd #endif /* _PSP_OVERRIDE_SYSLIB_H_ */ diff --git a/unit-test-coverage/ut-stubs/override_inc/taskLib.h b/unit-test-coverage/ut-stubs/override_inc/taskLib.h index 9469e54e..6ebcf6f6 100644 --- a/unit-test-coverage/ut-stubs/override_inc/taskLib.h +++ b/unit-test-coverage/ut-stubs/override_inc/taskLib.h @@ -18,30 +18,29 @@ /* ----------------------------------------- */ /* mappings for declarations in taskLib.h */ /* ----------------------------------------- */ -#define VX_FP_TASK PCS_VX_FP_TASK -#define TASK_ID PCS_TASK_ID -#define WIND_TCB PCS_WIND_TCB -#define TASK_DESC PCS_TASK_DESC +#define VX_FP_TASK PCS_VX_FP_TASK +#define TASK_ID PCS_TASK_ID +#define WIND_TCB PCS_WIND_TCB +#define TASK_DESC PCS_TASK_DESC -#define taskName PCS_taskName -#define taskNameToId PCS_taskNameToId -#define taskIdDefault PCS_taskIdDefault -#define taskIsReady PCS_taskIsReady -#define taskIsSuspended PCS_taskIsSuspended -#define taskGetInfo PCS_taskGetInfo - -#define taskActivate PCS_taskActivate -#define taskExit PCS_taskExit -#define taskIdSelf PCS_taskIdSelf -#define taskDelay PCS_taskDelay -#define taskDelete PCS_taskDelete -#define taskDeleteForce PCS_taskDeleteForce -#define taskSuspend PCS_taskSuspend -#define taskResume PCS_taskResume -#define taskPrioritySet PCS_taskPrioritySet -#define taskSpawn PCS_taskSpawn -#define taskInit PCS_taskInit -#define taskTcb PCS_taskTcb +#define taskName PCS_taskName +#define taskNameToId PCS_taskNameToId +#define taskIdDefault PCS_taskIdDefault +#define taskIsReady PCS_taskIsReady +#define taskIsSuspended PCS_taskIsSuspended +#define taskGetInfo PCS_taskGetInfo +#define taskActivate PCS_taskActivate +#define taskExit PCS_taskExit +#define taskIdSelf PCS_taskIdSelf +#define taskDelay PCS_taskDelay +#define taskDelete PCS_taskDelete +#define taskDeleteForce PCS_taskDeleteForce +#define taskSuspend PCS_taskSuspend +#define taskResume PCS_taskResume +#define taskPrioritySet PCS_taskPrioritySet +#define taskSpawn PCS_taskSpawn +#define taskInit PCS_taskInit +#define taskTcb PCS_taskTcb #endif /* _PSP_OVERRIDE_TASKLIB_H_ */ diff --git a/unit-test-coverage/ut-stubs/override_inc/unistd.h b/unit-test-coverage/ut-stubs/override_inc/unistd.h index 107d9fea..7a55b29a 100644 --- a/unit-test-coverage/ut-stubs/override_inc/unistd.h +++ b/unit-test-coverage/ut-stubs/override_inc/unistd.h @@ -18,25 +18,23 @@ /* mappings for declarations in unistd.h */ /* ----------------------------------------- */ -#define SEEK_SET PCS_SEEK_SET -#define SEEK_CUR PCS_SEEK_CUR -#define SEEK_END PCS_SEEK_END -#define STDIN_FILENO PCS_STDIN_FILENO -#define STDOUT_FILENO PCS_STDOUT_FILENO -#define STDERR_FILENO PCS_STDERR_FILENO - -#define close PCS_close -#define getegid PCS_getegid -#define geteuid PCS_geteuid -#define gethostid PCS_gethostid -#define gethostname PCS_gethostname -#define getpid PCS_getpid -#define lseek PCS_lseek -#define read PCS_read -#define rmdir PCS_rmdir -#define sysconf PCS_sysconf -#define write PCS_write - +#define SEEK_SET PCS_SEEK_SET +#define SEEK_CUR PCS_SEEK_CUR +#define SEEK_END PCS_SEEK_END +#define STDIN_FILENO PCS_STDIN_FILENO +#define STDOUT_FILENO PCS_STDOUT_FILENO +#define STDERR_FILENO PCS_STDERR_FILENO + +#define close PCS_close +#define getegid PCS_getegid +#define geteuid PCS_geteuid +#define gethostid PCS_gethostid +#define gethostname PCS_gethostname +#define getpid PCS_getpid +#define lseek PCS_lseek +#define read PCS_read +#define rmdir PCS_rmdir +#define sysconf PCS_sysconf +#define write PCS_write #endif /* _PSP_OVERRIDE_UNISTD_H_ */ - diff --git a/unit-test-coverage/ut-stubs/override_inc/usrLib.h b/unit-test-coverage/ut-stubs/override_inc/usrLib.h index 2a4dea5b..7b17e097 100644 --- a/unit-test-coverage/ut-stubs/override_inc/usrLib.h +++ b/unit-test-coverage/ut-stubs/override_inc/usrLib.h @@ -19,6 +19,4 @@ /* mappings for declarations in usrLib.h */ /* ----------------------------------------- */ - - #endif /* _PSP_OVERRIDE_USRLIB_H_ */ diff --git a/unit-test-coverage/ut-stubs/override_inc/vxLib.h b/unit-test-coverage/ut-stubs/override_inc/vxLib.h index a62edb5f..0847715e 100644 --- a/unit-test-coverage/ut-stubs/override_inc/vxLib.h +++ b/unit-test-coverage/ut-stubs/override_inc/vxLib.h @@ -19,5 +19,4 @@ /* mappings for declarations in vxLib.h */ /* ----------------------------------------- */ - #endif /* _PSP_OVERRIDE_VXLIB_H_ */ diff --git a/unit-test-coverage/ut-stubs/override_inc/vxWorks.h b/unit-test-coverage/ut-stubs/override_inc/vxWorks.h index 40aefd0c..fdc69209 100644 --- a/unit-test-coverage/ut-stubs/override_inc/vxWorks.h +++ b/unit-test-coverage/ut-stubs/override_inc/vxWorks.h @@ -1,16 +1,15 @@ /* - * + * * Copyright (c) 2020, United States government as represented by the * administrator of the National Aeronautics Space Administration. * All rights reserved. This software was created at NASA Goddard * Space Flight Center pursuant to government contracts. - * + * * This is governed by the NASA Open Source Agreement and may be used, * distributed and modified only according to the terms of that agreement. - * + * */ - /** * \file vxWorks.h * \ingroup ut-stubs @@ -28,26 +27,24 @@ /* ----------------------------------------- */ /* mappings for declarations in vxWorks.h */ /* ----------------------------------------- */ -#define ERROR PCS_ERROR -#define OK PCS_OK -#define WAIT_FOREVER PCS_WAIT_FOREVER -#define NO_WAIT PCS_NO_WAIT - - -#define STATUS PCS_STATUS -#define BOOL PCS_BOOL -#define FUNCPTR PCS_FUNCPTR -#define VOIDFUNCPTR PCS_VOIDFUNCPTR - -#define UINT PCS_UINT -#define INT8 PCS_INT8 -#define UINT8 PCS_UINT8 -#define INT16 PCS_INT16 -#define UINT16 PCS_UINT16 -#define INT32 PCS_INT32 -#define UINT32 PCS_UINT32 - -#define _Vx_usr_arg_t PCS_Vx_usr_arg_t - -#endif /* INCLUDE_VXWORKS_H_ */ - +#define ERROR PCS_ERROR +#define OK PCS_OK +#define WAIT_FOREVER PCS_WAIT_FOREVER +#define NO_WAIT PCS_NO_WAIT + +#define STATUS PCS_STATUS +#define BOOL PCS_BOOL +#define FUNCPTR PCS_FUNCPTR +#define VOIDFUNCPTR PCS_VOIDFUNCPTR + +#define UINT PCS_UINT +#define INT8 PCS_INT8 +#define UINT8 PCS_UINT8 +#define INT16 PCS_INT16 +#define UINT16 PCS_UINT16 +#define INT32 PCS_INT32 +#define UINT32 PCS_UINT32 + +#define _Vx_usr_arg_t PCS_Vx_usr_arg_t + +#endif /* INCLUDE_VXWORKS_H_ */ diff --git a/unit-test-coverage/ut-stubs/override_inc/xbdBlkDev.h b/unit-test-coverage/ut-stubs/override_inc/xbdBlkDev.h index b2067a86..de1f91b5 100644 --- a/unit-test-coverage/ut-stubs/override_inc/xbdBlkDev.h +++ b/unit-test-coverage/ut-stubs/override_inc/xbdBlkDev.h @@ -20,12 +20,9 @@ /* mappings for declarations in xbdBlkDev.h */ /* ----------------------------------------- */ -#define NULLDEV PCS_NULLDEV -#define device_t PCS_device_t -#define xbdBlkDevCreateSync PCS_xbdBlkDevCreateSync -#define xbdBlkDevDelete PCS_xbdBlkDevDelete - - +#define NULLDEV PCS_NULLDEV +#define device_t PCS_device_t +#define xbdBlkDevCreateSync PCS_xbdBlkDevCreateSync +#define xbdBlkDevDelete PCS_xbdBlkDevDelete #endif /* _PSP_OVERRIDE_XBDBLKDEV_H_ */ - diff --git a/unit-test-coverage/ut-stubs/override_inc/xbdRamDisk.h b/unit-test-coverage/ut-stubs/override_inc/xbdRamDisk.h index 86d52655..b729b35e 100644 --- a/unit-test-coverage/ut-stubs/override_inc/xbdRamDisk.h +++ b/unit-test-coverage/ut-stubs/override_inc/xbdRamDisk.h @@ -19,6 +19,4 @@ /* mappings for declarations in xbdRamDisk.h */ /* ----------------------------------------- */ - - #endif /* _PSP_OVERRIDE_XBDRAMDISK_H_ */ diff --git a/unit-test-coverage/ut-stubs/src/cfe-configdata-stubs.c b/unit-test-coverage/ut-stubs/src/cfe-configdata-stubs.c index 0a46ec4c..7deb1f8b 100644 --- a/unit-test-coverage/ut-stubs/src/cfe-configdata-stubs.c +++ b/unit-test-coverage/ut-stubs/src/cfe-configdata-stubs.c @@ -19,41 +19,34 @@ #include -Target_CfeConfigData GLOBAL_CFE_CONFIGDATA = -{ - - /** - * 1Hz ISR entry point. Called from PSP once per second on HW clock. - */ - .System1HzISR = PCS_System1HzISR, - - /** - * Main CFE entry point. Called from PSP startup code. - */ - .SystemMain = PCS_SystemMain, +Target_CfeConfigData GLOBAL_CFE_CONFIGDATA = { - /** - * Notification function. Called from PSP after async event handling. - */ - .SystemNotify = PCS_SystemNotify -}; + /** + * 1Hz ISR entry point. Called from PSP once per second on HW clock. + */ + .System1HzISR = PCS_System1HzISR, -Target_ConfigData GLOBAL_CONFIGDATA = -{ - .MissionVersion = PCS_CONFIG_MISSIONVERSION, - .CfeVersion = PCS_CONFIG_CFEVERSION, - .OsalVersion = PCS_CONFIG_OSALVERSION, - .Config = PCS_CONFIG_CONFIGSTR, - .Date = PCS_CONFIG_DATESTR, - .User = PCS_CONFIG_USERSTR, - .Default_CpuName = PCS_CONFIG_CPUNAME, - .Default_CpuId = PCS_CONFIG_CPUNUMBER, - .Default_SpacecraftId = PCS_CONFIG_SPACECRAFT, - .CfeConfig = &GLOBAL_CFE_CONFIGDATA, - .PspConfig = &GLOBAL_PSP_CONFIGDATA -}; + /** + * Main CFE entry point. Called from PSP startup code. + */ + .SystemMain = PCS_SystemMain, + /** + * Notification function. Called from PSP after async event handling. + */ + .SystemNotify = PCS_SystemNotify}; +Target_ConfigData GLOBAL_CONFIGDATA = {.MissionVersion = PCS_CONFIG_MISSIONVERSION, + .CfeVersion = PCS_CONFIG_CFEVERSION, + .OsalVersion = PCS_CONFIG_OSALVERSION, + .Config = PCS_CONFIG_CONFIGSTR, + .Date = PCS_CONFIG_DATESTR, + .User = PCS_CONFIG_USERSTR, + .Default_CpuName = PCS_CONFIG_CPUNAME, + .Default_CpuId = PCS_CONFIG_CPUNUMBER, + .Default_SpacecraftId = PCS_CONFIG_SPACECRAFT, + .CfeConfig = &GLOBAL_CFE_CONFIGDATA, + .PspConfig = &GLOBAL_PSP_CONFIGDATA}; /** * Stub for the main system entry function implemented in CFE ES @@ -75,7 +68,6 @@ void PCS_System1HzISR(void) UT_DEFAULT_IMPL(PCS_System1HzISR); } - /** * Stub for notification function implemented in CFE ES */ @@ -83,4 +75,3 @@ void PCS_SystemNotify(void) { UT_DEFAULT_IMPL(PCS_SystemNotify); } - diff --git a/unit-test-coverage/ut-stubs/src/libc-stdio-stubs.c b/unit-test-coverage/ut-stubs/src/libc-stdio-stubs.c index e9c69eed..b7b2b84e 100644 --- a/unit-test-coverage/ut-stubs/src/libc-stdio-stubs.c +++ b/unit-test-coverage/ut-stubs/src/libc-stdio-stubs.c @@ -21,9 +21,9 @@ struct PCS_FILE int f; }; -#define PCS_STDIO_MAX_SIZE 0x01000000 +#define PCS_STDIO_MAX_SIZE 0x01000000 -int PCS_fclose (PCS_FILE * stream) +int PCS_fclose(PCS_FILE *stream) { int32 Status; @@ -32,9 +32,9 @@ int PCS_fclose (PCS_FILE * stream) return Status; } -char *PCS_fgets (char * s, int n, PCS_FILE * stream) +char *PCS_fgets(char *s, int n, PCS_FILE *stream) { - int32 Status; + int32 Status; uint32 CopySize; Status = UT_DEFAULT_IMPL_RC(PCS_fgets, PCS_STDIO_MAX_SIZE); @@ -79,11 +79,11 @@ char *PCS_fgets (char * s, int n, PCS_FILE * stream) return s; } -PCS_FILE *PCS_fopen (const char * filename, const char * modes) +PCS_FILE *PCS_fopen(const char *filename, const char *modes) { - int32 Status; - PCS_FILE *retval; - static PCS_FILE FOPEN_FP = { 0 }; + int32 Status; + PCS_FILE * retval; + static PCS_FILE FOPEN_FP = {0}; Status = UT_DEFAULT_IMPL(PCS_fopen); @@ -99,7 +99,7 @@ PCS_FILE *PCS_fopen (const char * filename, const char * modes) return retval; } -int PCS_fputs (const char * s, PCS_FILE * stream) +int PCS_fputs(const char *s, PCS_FILE *stream) { int32 Status; @@ -108,7 +108,7 @@ int PCS_fputs (const char * s, PCS_FILE * stream) return Status; } -int PCS_putchar (int c) +int PCS_putchar(int c) { int32 Status; @@ -117,8 +117,7 @@ int PCS_putchar (int c) return Status; } - -int PCS_remove (const char * filename) +int PCS_remove(const char *filename) { int32 Status; @@ -127,7 +126,7 @@ int PCS_remove (const char * filename) return Status; } -int PCS_rename (const char * old, const char * nw) +int PCS_rename(const char *old, const char *nw) { int32 Status; @@ -136,10 +135,10 @@ int PCS_rename (const char * old, const char * nw) return Status; } -int PCS_snprintf (char * s, size_t maxlen, const char * format, ...) +int PCS_snprintf(char *s, size_t maxlen, const char *format, ...) { - int32 Status; - int actual = 0; + int32 Status; + int actual = 0; va_list ap; Status = UT_DEFAULT_IMPL(PCS_snprintf); @@ -148,7 +147,7 @@ int PCS_snprintf (char * s, size_t maxlen, const char * format, ...) if (Status >= 0) { va_start(ap, format); - actual = vsnprintf(s,maxlen,format,ap); + actual = vsnprintf(s, maxlen, format, ap); va_end(ap); } @@ -160,10 +159,10 @@ int PCS_snprintf (char * s, size_t maxlen, const char * format, ...) return actual; } -int PCS_vsnprintf (char * s, size_t maxlen, const char * format, PCS_va_list arg) +int PCS_vsnprintf(char *s, size_t maxlen, const char *format, PCS_va_list arg) { int32 Status; - int actual = 0; + int actual = 0; Status = UT_DEFAULT_IMPL(PCS_vsnprintf); @@ -171,7 +170,7 @@ int PCS_vsnprintf (char * s, size_t maxlen, const char * format, PCS_va_list arg * cannot do the real vsnprintf because we lost the args. */ if (Status >= 0) { - actual = snprintf(s,maxlen,"%s",format); + actual = snprintf(s, maxlen, "%s", format); } if (Status != 0) @@ -182,16 +181,13 @@ int PCS_vsnprintf (char * s, size_t maxlen, const char * format, PCS_va_list arg return actual; } -int PCS_printf (const char * format, ...) +int PCS_printf(const char *format, ...) { return UT_DEFAULT_IMPL(PCS_printf); } +static PCS_FILE LOCAL_FP[3] = {{10}, {11}, {12}}; -static PCS_FILE LOCAL_FP[3] = { { 10 }, { 11 }, { 12 } }; - -PCS_FILE* PCS_stdin = &LOCAL_FP[0]; -PCS_FILE* PCS_stdout = &LOCAL_FP[1]; -PCS_FILE* PCS_stderr = &LOCAL_FP[2]; - - +PCS_FILE *PCS_stdin = &LOCAL_FP[0]; +PCS_FILE *PCS_stdout = &LOCAL_FP[1]; +PCS_FILE *PCS_stderr = &LOCAL_FP[2]; diff --git a/unit-test-coverage/ut-stubs/src/libc-stdlib-stubs.c b/unit-test-coverage/ut-stubs/src/libc-stdlib-stubs.c index 2eaa9a79..e96ff024 100644 --- a/unit-test-coverage/ut-stubs/src/libc-stdlib-stubs.c +++ b/unit-test-coverage/ut-stubs/src/libc-stdlib-stubs.c @@ -25,19 +25,17 @@ * it only allocates sequential blocks and does not recover * the space after free. */ -#define MPOOL_START_SIGNATURE 0x8a458c6b -#define MPOOL_BLOCK_SIGNATURE 0x3ef65721 -#define MPOOL_ALIGN 16 +#define MPOOL_START_SIGNATURE 0x8a458c6b +#define MPOOL_BLOCK_SIGNATURE 0x3ef65721 +#define MPOOL_ALIGN 16 struct MPOOL_REC { cpuaddr BlockAddr; - uint32 Magic; - uint32 Size; + uint32 Magic; + uint32 Size; }; - - void PCS_exit(int c) { UT_DEFAULT_IMPL(PCS_exit); @@ -51,9 +49,9 @@ void PCS_exit(int c) */ } -unsigned long int PCS_strtoul (const char * nptr, char ** endptr, int base) +unsigned long int PCS_strtoul(const char *nptr, char **endptr, int base) { - int32 Status; + int32 Status; unsigned long Result = 0; Status = UT_DEFAULT_IMPL_RC(PCS_strtoul, -1); @@ -69,46 +67,45 @@ unsigned long int PCS_strtoul (const char * nptr, char ** endptr, int base) } return Result; - } -int PCS_system (const char * command) +int PCS_system(const char *command) { return UT_DEFAULT_IMPL(PCS_system); } void *PCS_malloc(size_t sz) { - int32 Status; - void *PoolPtr; - cpuaddr PoolStart; - cpuaddr PoolEnd; - cpuaddr NextBlock; - size_t NextSize; - size_t PoolSize; - uint32 CallCnt; + int32 Status; + void * PoolPtr; + cpuaddr PoolStart; + cpuaddr PoolEnd; + cpuaddr NextBlock; + size_t NextSize; + size_t PoolSize; + uint32 CallCnt; struct MPOOL_REC *Rec; - Rec = NULL; + Rec = NULL; CallCnt = UT_GetStubCount(UT_KEY(PCS_malloc)); UT_GetDataBuffer(UT_KEY(PCS_malloc), &PoolPtr, &PoolSize, NULL); if (PoolPtr != NULL) { PoolStart = (cpuaddr)PoolPtr; - PoolEnd = PoolStart + PoolSize; + PoolEnd = PoolStart + PoolSize; PoolStart = (PoolStart + MPOOL_ALIGN - 1) & ~((cpuaddr)MPOOL_ALIGN - 1); - PoolSize = PoolEnd - PoolStart; + PoolSize = PoolEnd - PoolStart; if (PoolSize > (MPOOL_ALIGN * 2)) { - Rec = (struct MPOOL_REC*)PoolStart; + Rec = (struct MPOOL_REC *)PoolStart; NextBlock = PoolStart + MPOOL_ALIGN; PoolSize -= MPOOL_ALIGN; if (CallCnt == 0) { - Rec->Magic = MPOOL_START_SIGNATURE; - Rec->Size = 0; + Rec->Magic = MPOOL_START_SIGNATURE; + Rec->Size = 0; Rec->BlockAddr = NextBlock; } else if (Rec->Magic != MPOOL_START_SIGNATURE) @@ -138,25 +135,25 @@ void *PCS_malloc(size_t sz) return NULL; } - NextSize = (NextSize + MPOOL_ALIGN - 1) & ~((size_t)MPOOL_ALIGN); + NextSize = (NextSize + MPOOL_ALIGN - 1) & ~((size_t)MPOOL_ALIGN); NextBlock = Rec->BlockAddr + MPOOL_ALIGN; Rec->BlockAddr += NextSize; Rec->Size += NextSize; - Rec = (struct MPOOL_REC*)(NextBlock - sizeof(struct MPOOL_REC)); + Rec = (struct MPOOL_REC *)(NextBlock - sizeof(struct MPOOL_REC)); Rec->BlockAddr = NextBlock; - Rec->Magic = MPOOL_BLOCK_SIGNATURE; - Rec->Size = sz; + Rec->Magic = MPOOL_BLOCK_SIGNATURE; + Rec->Size = sz; - return ((void*)NextBlock); + return ((void *)NextBlock); } void PCS_free(void *ptr) { - int32 Status; - cpuaddr BlockAddr; - void *PoolPtr; - size_t PoolSize; + int32 Status; + cpuaddr BlockAddr; + void * PoolPtr; + size_t PoolSize; struct MPOOL_REC *Rec; /* @@ -175,7 +172,7 @@ void PCS_free(void *ptr) } else { - Rec = (struct MPOOL_REC*)(BlockAddr - sizeof(struct MPOOL_REC)); + Rec = (struct MPOOL_REC *)(BlockAddr - sizeof(struct MPOOL_REC)); if (Rec->Magic == MPOOL_BLOCK_SIGNATURE) { Rec->Magic = ~MPOOL_BLOCK_SIGNATURE; @@ -190,8 +187,4 @@ void PCS_free(void *ptr) } } } - - } - - diff --git a/unit-test-coverage/ut-stubs/src/libc-string-stubs.c b/unit-test-coverage/ut-stubs/src/libc-string-stubs.c index 40de07a6..8dcd255a 100644 --- a/unit-test-coverage/ut-stubs/src/libc-string-stubs.c +++ b/unit-test-coverage/ut-stubs/src/libc-string-stubs.c @@ -16,7 +16,7 @@ #include -void* PCS_memset(void * s, int c, size_t n) +void *PCS_memset(void *s, int c, size_t n) { int32 Status; void *Result; @@ -35,7 +35,7 @@ void* PCS_memset(void * s, int c, size_t n) return Result; } -void *PCS_memcpy (void * dest, const void * src, size_t n) +void *PCS_memcpy(void *dest, const void *src, size_t n) { int32 Status; void *Result; @@ -63,14 +63,14 @@ char *PCS_strchr(const char *s, int c) if (Status == 0) { /* "nominal" response */ - return strchr(s,c); + return strchr(s, c); } if (Status < 0) { - return (char*)0; + return (char *)0; } - return (char*)&s[Status-1]; + return (char *)&s[Status - 1]; } char *PCS_strrchr(const char *s, int c) @@ -82,14 +82,14 @@ char *PCS_strrchr(const char *s, int c) if (Status == 0) { /* "nominal" response */ - return strrchr(s,c); + return strrchr(s, c); } if (Status < 0) { - return (char*)0; + return (char *)0; } - return (char*)&s[Status-1]; + return (char *)&s[Status - 1]; } size_t PCS_strlen(const char *s) @@ -110,10 +110,10 @@ char *PCS_strcat(char *dest, const char *src) if (Status == 0) { /* "nominal" response */ - return strcat(dest,src); + return strcat(dest, src); } - return (char*)0; + return (char *)0; } char *PCS_strncat(char *dest, const char *src, size_t size) @@ -125,17 +125,17 @@ char *PCS_strncat(char *dest, const char *src, size_t size) if (Status == 0) { /* "nominal" response */ - return strncat(dest,src,size); + return strncat(dest, src, size); } - return (char*)0; + return (char *)0; } int PCS_strncmp(const char *s1, const char *s2, size_t size) { int32 Status; - Status = UT_DEFAULT_IMPL_RC(PCS_strncmp, strncmp(s1,s2,size)); + Status = UT_DEFAULT_IMPL_RC(PCS_strncmp, strncmp(s1, s2, size)); return Status; } @@ -144,7 +144,7 @@ int PCS_strcmp(const char *s1, const char *s2) { int32 Status; - Status = UT_DEFAULT_IMPL_RC(PCS_strcmp, strcmp(s1,s2)); + Status = UT_DEFAULT_IMPL_RC(PCS_strcmp, strcmp(s1, s2)); return Status; } @@ -158,10 +158,10 @@ char *PCS_strcpy(char *dst, const char *src) if (Status == 0) { /* "nominal" response */ - return strcpy(dst,src); + return strcpy(dst, src); } - return (char*)0; + return (char *)0; } char *PCS_strncpy(char *dst, const char *src, size_t size) @@ -173,16 +173,16 @@ char *PCS_strncpy(char *dst, const char *src, size_t size) if (Status == 0) { /* "nominal" response */ - return strncpy(dst,src,size); + return strncpy(dst, src, size); } - return (char*)0; + return (char *)0; } char *PCS_strerror(int errnum) { static char str[16]; - int32 Status; + int32 Status; Status = UT_DEFAULT_IMPL(PCS_strerror); @@ -192,10 +192,6 @@ char *PCS_strerror(int errnum) } /* "nominal" response */ - snprintf(str,sizeof(str),"UT_ERR_%d", errnum); + snprintf(str, sizeof(str), "UT_ERR_%d", errnum); return str; } - - - - diff --git a/unit-test-coverage/ut-stubs/src/vxworks-ataDrv-stubs.c b/unit-test-coverage/ut-stubs/src/vxworks-ataDrv-stubs.c index ac6f2ca1..c9b2b52b 100644 --- a/unit-test-coverage/ut-stubs/src/vxworks-ataDrv-stubs.c +++ b/unit-test-coverage/ut-stubs/src/vxworks-ataDrv-stubs.c @@ -15,7 +15,7 @@ #include -PCS_device_t PCS_ataXbdDevCreate (int ctrl, int drive, unsigned int nBlks, unsigned int offset, const char *name) +PCS_device_t PCS_ataXbdDevCreate(int ctrl, int drive, unsigned int nBlks, unsigned int offset, const char *name) { return UT_DEFAULT_IMPL(PCS_ataXbdDevCreate); } diff --git a/unit-test-coverage/ut-stubs/src/vxworks-cacheLib-stubs.c b/unit-test-coverage/ut-stubs/src/vxworks-cacheLib-stubs.c index 55a04d06..7dceaabf 100644 --- a/unit-test-coverage/ut-stubs/src/vxworks-cacheLib-stubs.c +++ b/unit-test-coverage/ut-stubs/src/vxworks-cacheLib-stubs.c @@ -15,7 +15,7 @@ #include -PCS_STATUS PCS_cacheTextUpdate (void * adrs, size_t bytes) +PCS_STATUS PCS_cacheTextUpdate(void *adrs, size_t bytes) { return UT_DEFAULT_IMPL(PCS_cacheTextUpdate); } diff --git a/unit-test-coverage/ut-stubs/src/vxworks-excLib-stubs.c b/unit-test-coverage/ut-stubs/src/vxworks-excLib-stubs.c index 2c31b1d8..93cbca07 100644 --- a/unit-test-coverage/ut-stubs/src/vxworks-excLib-stubs.c +++ b/unit-test-coverage/ut-stubs/src/vxworks-excLib-stubs.c @@ -15,7 +15,7 @@ #include -void PCS_excHookAdd (void (*Hook)(PCS_TASK_ID, int, void *)) +void PCS_excHookAdd(void (*Hook)(PCS_TASK_ID, int, void *)) { UT_DEFAULT_IMPL(PCS_excHookAdd); } diff --git a/unit-test-coverage/ut-stubs/src/vxworks-fppLib-stubs.c b/unit-test-coverage/ut-stubs/src/vxworks-fppLib-stubs.c index e0db7063..7f07e697 100644 --- a/unit-test-coverage/ut-stubs/src/vxworks-fppLib-stubs.c +++ b/unit-test-coverage/ut-stubs/src/vxworks-fppLib-stubs.c @@ -15,7 +15,7 @@ #include -void PCS_fppSave (PCS_FP_CONTEXT *fpc) +void PCS_fppSave(PCS_FP_CONTEXT *fpc) { UT_DEFAULT_IMPL(PCS_fppSave); } diff --git a/unit-test-coverage/ut-stubs/src/vxworks-moduleLib-stubs.c b/unit-test-coverage/ut-stubs/src/vxworks-moduleLib-stubs.c index 793340de..13137639 100644 --- a/unit-test-coverage/ut-stubs/src/vxworks-moduleLib-stubs.c +++ b/unit-test-coverage/ut-stubs/src/vxworks-moduleLib-stubs.c @@ -15,10 +15,10 @@ #include -PCS_MODULE_ID PCS_moduleFindByName (const char *moduleName) +PCS_MODULE_ID PCS_moduleFindByName(const char *moduleName) { PCS_MODULE_ID retval; - int32 Status; + int32 Status; retval = NULL; Status = UT_DEFAULT_IMPL(PCS_moduleFindByName); @@ -30,14 +30,14 @@ PCS_MODULE_ID PCS_moduleFindByName (const char *moduleName) return retval; } -PCS_STATUS PCS_moduleInfoGet(PCS_MODULE_ID moduleId, PCS_MODULE_INFO * pModuleInfo) +PCS_STATUS PCS_moduleInfoGet(PCS_MODULE_ID moduleId, PCS_MODULE_INFO *pModuleInfo) { int32 Status; Status = UT_DEFAULT_IMPL(PCS_moduleInfoGet); if (Status == 0 && - UT_Stub_CopyToLocal(UT_KEY(PCS_moduleInfoGet), pModuleInfo, sizeof(*pModuleInfo)) < sizeof(*pModuleInfo)) + UT_Stub_CopyToLocal(UT_KEY(PCS_moduleInfoGet), pModuleInfo, sizeof(*pModuleInfo)) < sizeof(*pModuleInfo)) { memset(pModuleInfo, 0, sizeof(*pModuleInfo)); } diff --git a/unit-test-coverage/ut-stubs/src/vxworks-sysLib-stubs.c b/unit-test-coverage/ut-stubs/src/vxworks-sysLib-stubs.c index 387a1e1d..a2dad2a7 100644 --- a/unit-test-coverage/ut-stubs/src/vxworks-sysLib-stubs.c +++ b/unit-test-coverage/ut-stubs/src/vxworks-sysLib-stubs.c @@ -17,9 +17,9 @@ int PCS_sysClkRateGet(void) { - return (UT_DEFAULT_IMPL_RC(PCS_sysClkRateGet,10000)); + return (UT_DEFAULT_IMPL_RC(PCS_sysClkRateGet, 10000)); } -char *PCS_sysMemTop (void) +char *PCS_sysMemTop(void) { int32 Status; char *BufPtr; @@ -28,37 +28,35 @@ char *PCS_sysMemTop (void) Status = UT_DEFAULT_IMPL(PCS_sysMemTop); if (Status == 0) { - UT_GetDataBuffer(UT_KEY(PCS_sysMemTop), (void**)&BufPtr, NULL, NULL); + UT_GetDataBuffer(UT_KEY(PCS_sysMemTop), (void **)&BufPtr, NULL, NULL); } return BufPtr; } - -void PCS_PciOutByte (uint32_t address, uint8_t data) +void PCS_PciOutByte(uint32_t address, uint8_t data) { UT_DEFAULT_IMPL(PCS_PciOutByte); } -void PCS_PciOutLong (uint32_t address, uint32_t data) +void PCS_PciOutLong(uint32_t address, uint32_t data) { UT_DEFAULT_IMPL(PCS_PciOutLong); } -void PCS_sysPciWrite32 (uint32_t address, uint32_t data) +void PCS_sysPciWrite32(uint32_t address, uint32_t data) { UT_DEFAULT_IMPL(PCS_sysPciWrite32); } -void PCS_sysPciRead32 (uint32_t address, uint32_t *data) +void PCS_sysPciRead32(uint32_t address, uint32_t *data) { UT_DEFAULT_IMPL(PCS_sysPciRead32); } - unsigned int PCS_GetWrsKernelTextStart(void) { return (UT_DEFAULT_IMPL(PCS_GetWrsKernelTextStart)); } -unsigned int PCS_GetWrsKernelTextEnd (void) +unsigned int PCS_GetWrsKernelTextEnd(void) { return (UT_DEFAULT_IMPL(PCS_GetWrsKernelTextEnd)); } diff --git a/unit-test-coverage/ut-stubs/src/vxworks-taskLib-stubs.c b/unit-test-coverage/ut-stubs/src/vxworks-taskLib-stubs.c index a6b8712b..5093710c 100644 --- a/unit-test-coverage/ut-stubs/src/vxworks-taskLib-stubs.c +++ b/unit-test-coverage/ut-stubs/src/vxworks-taskLib-stubs.c @@ -16,12 +16,12 @@ #include #include -static PCS_WIND_TCB PCS_LOCAL_TASK = { 0 }; +static PCS_WIND_TCB PCS_LOCAL_TASK = {0}; const char *PCS_taskName(PCS_TASK_ID task_id) { const char *retval; - int32 Status; + int32 Status; retval = NULL; Status = UT_DEFAULT_IMPL(PCS_taskName); @@ -31,7 +31,6 @@ const char *PCS_taskName(PCS_TASK_ID task_id) } return retval; - } void PCS_taskExit(int code) { @@ -86,43 +85,15 @@ PCS_STATUS PCS_taskPrioritySet(PCS_TASK_ID tid, int newPriority) return (UT_DEFAULT_IMPL(PCS_taskPrioritySet)); } -PCS_STATUS PCS_taskInit(PCS_WIND_TCB *pTcb, - char *name, - int priority, - int options, - char * pStackBase, - int stackSize, - PCS_FUNCPTR entryPt, - int arg1, - int arg2, - int arg3, - int arg4, - int arg5, - int arg6, - int arg7, - int arg8, - int arg9, - int arg10 -) +PCS_STATUS PCS_taskInit(PCS_WIND_TCB *pTcb, char *name, int priority, int options, char *pStackBase, int stackSize, + PCS_FUNCPTR entryPt, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, + int arg8, int arg9, int arg10) { return (UT_DEFAULT_IMPL(PCS_taskInit)); } -PCS_TASK_ID PCS_taskSpawn(char * name, - int priority, - int options, - int stackSize, - PCS_FUNCPTR entryPt, - int arg1, - int arg2, - int arg3, - int arg4, - int arg5, - int arg6, - int arg7, - int arg8, - int arg9, - int arg10) +PCS_TASK_ID PCS_taskSpawn(char *name, int priority, int options, int stackSize, PCS_FUNCPTR entryPt, int arg1, int arg2, + int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9, int arg10) { int32 Status; @@ -147,7 +118,7 @@ PCS_STATUS PCS_taskActivate(PCS_TASK_ID tid) PCS_WIND_TCB *PCS_taskTcb(PCS_TASK_ID tid) { - int32 Status; + int32 Status; PCS_WIND_TCB *LocalTcb; Status = UT_DEFAULT_IMPL(PCS_taskTcb); @@ -169,4 +140,3 @@ PCS_WIND_TCB *PCS_taskTcb(PCS_TASK_ID tid) return LocalTcb; } - diff --git a/unit-test-coverage/ut-stubs/src/vxworks-vxLib-stubs.c b/unit-test-coverage/ut-stubs/src/vxworks-vxLib-stubs.c index b7d33699..28902071 100644 --- a/unit-test-coverage/ut-stubs/src/vxworks-vxLib-stubs.c +++ b/unit-test-coverage/ut-stubs/src/vxworks-vxLib-stubs.c @@ -16,30 +16,29 @@ #include #include - -void PCS_vxTimeBaseGet (uint32_t *u, uint32_t *l) +void PCS_vxTimeBaseGet(uint32_t *u, uint32_t *l) { UT_DEFAULT_IMPL(PCS_vxTimeBaseGet); *u = 0; *l = 0; } -void PCS_vxMsrSet (uint32_t val) +void PCS_vxMsrSet(uint32_t val) { UT_DEFAULT_IMPL(PCS_vxMsrSet); } -uint32_t PCS_vxMsrGet (void) +uint32_t PCS_vxMsrGet(void) { return UT_DEFAULT_IMPL(PCS_vxMsrGet); } -void PCS_vxFpscrSet (uint32_t val) +void PCS_vxFpscrSet(uint32_t val) { UT_DEFAULT_IMPL(PCS_vxFpscrSet); } -uint32_t PCS_vxFpscrGet (void) +uint32_t PCS_vxFpscrGet(void) { return UT_DEFAULT_IMPL(PCS_vxFpscrGet); } -uint32_t PCS_vxDecGet (void) +uint32_t PCS_vxDecGet(void) { return UT_DEFAULT_IMPL(PCS_vxDecGet); } diff --git a/ut-stubs/ut_psp_stubs.c b/ut-stubs/ut_psp_stubs.c index 8a07aa1e..872d3022 100644 --- a/ut-stubs/ut_psp_stubs.c +++ b/ut-stubs/ut_psp_stubs.c @@ -23,7 +23,7 @@ ** ** Purpose: ** Unit test stubs for BSP routines -** +** ** Notes: ** Minimal work is done, only what is required for unit testing ** @@ -39,8 +39,8 @@ #include -Target_PspConfigData GLOBAL_PSP_CONFIGDATA = { 0 }; -Target_CfeConfigData GLOBAL_CFE_CONFIGDATA = { 0 }; +Target_PspConfigData GLOBAL_PSP_CONFIGDATA = {0}; +Target_CfeConfigData GLOBAL_CFE_CONFIGDATA = {0}; /** * Instantiation of global system-wide configuration struct @@ -48,21 +48,17 @@ Target_CfeConfigData GLOBAL_CFE_CONFIGDATA = { 0 }; * configuration structures. Everything will be linked together * in the final executable. */ -Target_ConfigData GLOBAL_CONFIGDATA = -{ - .MissionVersion = "MissionUnitTest", - .CfeVersion = "CfeUnitTest", - .OsalVersion = "OsalUnitTest", - .Config = "MissionConfig", - .Date = "MissionBuildDate", - .User = "MissionBuildUser", - .Default_CpuName = "UnitTestCpu", - .Default_CpuId = 1, - .Default_SpacecraftId = 0x42, - .CfeConfig = &GLOBAL_CFE_CONFIGDATA, - .PspConfig = &GLOBAL_PSP_CONFIGDATA -}; - +Target_ConfigData GLOBAL_CONFIGDATA = {.MissionVersion = "MissionUnitTest", + .CfeVersion = "CfeUnitTest", + .OsalVersion = "OsalUnitTest", + .Config = "MissionConfig", + .Date = "MissionBuildDate", + .User = "MissionBuildUser", + .Default_CpuName = "UnitTestCpu", + .Default_CpuId = 1, + .Default_SpacecraftId = 0x42, + .CfeConfig = &GLOBAL_CFE_CONFIGDATA, + .PspConfig = &GLOBAL_PSP_CONFIGDATA}; /* ** Functions @@ -90,7 +86,7 @@ Target_ConfigData GLOBAL_CONFIGDATA = void CFE_PSP_Panic(int32 ErrorCode) { UT_DEFAULT_IMPL(CFE_PSP_Panic); - UT_Stub_CopyFromLocal(UT_KEY(CFE_PSP_Panic), (uint8*)&ErrorCode, sizeof(ErrorCode)); + UT_Stub_CopyFromLocal(UT_KEY(CFE_PSP_Panic), (uint8 *)&ErrorCode, sizeof(ErrorCode)); } /*****************************************************************************/ @@ -161,7 +157,7 @@ uint32 CFE_PSP_GetSpacecraftId(void) ******************************************************************************/ const char *CFE_PSP_GetProcessorName(void) { - int32 status; + int32 status; const char *ptr = GLOBAL_CONFIGDATA.Default_CpuName; status = UT_DEFAULT_IMPL(CFE_PSP_GetProcessorName); @@ -198,9 +194,9 @@ void CFE_PSP_GetTime(OS_time_t *LocalTime) if (status >= 0) { - if (UT_Stub_CopyToLocal(UT_KEY(CFE_PSP_GetTime), (uint8*)LocalTime, sizeof(*LocalTime)) < sizeof(*LocalTime)) + if (UT_Stub_CopyToLocal(UT_KEY(CFE_PSP_GetTime), (uint8 *)LocalTime, sizeof(*LocalTime)) < sizeof(*LocalTime)) { - *LocalTime = OS_TimeAssembleFromNanoseconds(100,200000); + *LocalTime = OS_TimeAssembleFromNanoseconds(100, 200000); } } } @@ -226,20 +222,18 @@ void CFE_PSP_GetTime(OS_time_t *LocalTime) ** Returns either OS_SUCCESS, OS_ERROR, or a user-defined value. ** ******************************************************************************/ -int32 CFE_PSP_WriteToCDS(const void *PtrToDataToWrite, - uint32 CDSOffset, - uint32 NumBytes) +int32 CFE_PSP_WriteToCDS(const void *PtrToDataToWrite, uint32 CDSOffset, uint32 NumBytes) { uint8 *BufPtr; size_t CdsSize; size_t Position; - int32 status; + int32 status; status = UT_DEFAULT_IMPL(CFE_PSP_WriteToCDS); if (status >= 0) { - UT_GetDataBuffer(UT_KEY(CFE_PSP_WriteToCDS), (void**)&BufPtr, &CdsSize, &Position); + UT_GetDataBuffer(UT_KEY(CFE_PSP_WriteToCDS), (void **)&BufPtr, &CdsSize, &Position); if (BufPtr != NULL && (CDSOffset + NumBytes) <= CdsSize) { memcpy(BufPtr + CDSOffset, PtrToDataToWrite, NumBytes); @@ -270,20 +264,18 @@ int32 CFE_PSP_WriteToCDS(const void *PtrToDataToWrite, ** Returns either OS_SUCCESS, OS_ERROR, or a user-defined value. ** ******************************************************************************/ -int32 CFE_PSP_ReadFromCDS(void *PtrToDataToRead, - uint32 CDSOffset, - uint32 NumBytes) +int32 CFE_PSP_ReadFromCDS(void *PtrToDataToRead, uint32 CDSOffset, uint32 NumBytes) { uint8 *BufPtr; size_t CdsSize; size_t Position; - int32 status; + int32 status; status = UT_DEFAULT_IMPL(CFE_PSP_ReadFromCDS); if (status >= 0) { - UT_GetDataBuffer(UT_KEY(CFE_PSP_ReadFromCDS), (void**)&BufPtr, &CdsSize, &Position); + UT_GetDataBuffer(UT_KEY(CFE_PSP_ReadFromCDS), (void **)&BufPtr, &CdsSize, &Position); if (BufPtr != NULL && (CDSOffset + NumBytes) <= CdsSize) { memcpy(PtrToDataToRead, BufPtr + CDSOffset, NumBytes); @@ -311,7 +303,7 @@ int32 CFE_PSP_ReadFromCDS(void *PtrToDataToRead, ******************************************************************************/ int32 CFE_PSP_GetCDSSize(uint32 *SizeOfCDS) { - int32 status; + int32 status; size_t TempSize; status = UT_DEFAULT_IMPL(CFE_PSP_GetCDSSize); @@ -343,9 +335,9 @@ int32 CFE_PSP_GetCDSSize(uint32 *SizeOfCDS) ******************************************************************************/ int32 CFE_PSP_GetVolatileDiskMem(cpuaddr *PtrToVolDisk, uint32 *SizeOfVolDisk) { - int32 status; + int32 status; size_t TempSize; - void *TempAddr; + void * TempAddr; status = UT_DEFAULT_IMPL(CFE_PSP_GetVolatileDiskMem); @@ -353,7 +345,7 @@ int32 CFE_PSP_GetVolatileDiskMem(cpuaddr *PtrToVolDisk, uint32 *SizeOfVolDisk) { UT_GetDataBuffer(UT_KEY(CFE_PSP_GetVolatileDiskMem), &TempAddr, &TempSize, NULL); - *PtrToVolDisk = (cpuaddr)TempAddr; + *PtrToVolDisk = (cpuaddr)TempAddr; *SizeOfVolDisk = TempSize; } @@ -382,7 +374,7 @@ int32 CFE_PSP_GetVolatileDiskMem(cpuaddr *PtrToVolDisk, uint32 *SizeOfVolDisk) void CFE_PSP_Restart(uint32 reset_type) { UT_DEFAULT_IMPL(CFE_PSP_Restart); - UT_Stub_CopyFromLocal(UT_KEY(CFE_PSP_Restart), (uint8*)&reset_type, sizeof(reset_type)); + UT_Stub_CopyFromLocal(UT_KEY(CFE_PSP_Restart), (uint8 *)&reset_type, sizeof(reset_type)); } /*****************************************************************************/ @@ -400,7 +392,7 @@ void CFE_PSP_Restart(uint32 reset_type) ** This function does not return a value. ** ******************************************************************************/ -void CFE_PSP_Get_Timebase(uint32 *Tbu, uint32* Tbl) +void CFE_PSP_Get_Timebase(uint32 *Tbu, uint32 *Tbl) { *Tbu = 0; *Tbl = 0; @@ -428,9 +420,9 @@ void CFE_PSP_Get_Timebase(uint32 *Tbu, uint32* Tbl) ******************************************************************************/ int32 CFE_PSP_GetResetArea(cpuaddr *PtrToResetArea, uint32 *SizeOfResetArea) { - int32 status; + int32 status; size_t TempSize; - void *TempAddr; + void * TempAddr; status = UT_DEFAULT_IMPL(CFE_PSP_GetResetArea); @@ -438,7 +430,7 @@ int32 CFE_PSP_GetResetArea(cpuaddr *PtrToResetArea, uint32 *SizeOfResetArea) { UT_GetDataBuffer(UT_KEY(CFE_PSP_GetResetArea), &TempAddr, &TempSize, NULL); - *PtrToResetArea = (cpuaddr)TempAddr; + *PtrToResetArea = (cpuaddr)TempAddr; *SizeOfResetArea = TempSize; } @@ -460,7 +452,7 @@ int32 CFE_PSP_GetResetArea(cpuaddr *PtrToResetArea, uint32 *SizeOfResetArea) ** This function does not return a value. ** ******************************************************************************/ -void CFE_PSP_AttachExceptions(void) +void CFE_PSP_AttachExceptions(void) { UT_DEFAULT_IMPL(CFE_PSP_AttachExceptions); } @@ -555,13 +547,12 @@ uint32 CFE_PSP_GetTimerLow32Rollover(void) ** Returns either a user-defined status flag or OS_SUCCESS. ** ******************************************************************************/ -int32 CFE_PSP_GetCFETextSegmentInfo(cpuaddr *PtrToCFESegment, - uint32 *SizeOfCFESegment) +int32 CFE_PSP_GetCFETextSegmentInfo(cpuaddr *PtrToCFESegment, uint32 *SizeOfCFESegment) { static uint32 LocalTextSegment; - int32 status; - void *TempAddr; - size_t TempSize; + int32 status; + void * TempAddr; + size_t TempSize; status = UT_DEFAULT_IMPL(CFE_PSP_GetCFETextSegmentInfo); @@ -571,12 +562,12 @@ int32 CFE_PSP_GetCFETextSegmentInfo(cpuaddr *PtrToCFESegment, if (*PtrToCFESegment == 0) { /* Backup -- Set the pointer and size to anything */ - *PtrToCFESegment = (cpuaddr)&LocalTextSegment; + *PtrToCFESegment = (cpuaddr)&LocalTextSegment; *SizeOfCFESegment = sizeof(LocalTextSegment); } else { - *PtrToCFESegment = (cpuaddr)TempAddr; + *PtrToCFESegment = (cpuaddr)TempAddr; *SizeOfCFESegment = TempSize; } } @@ -688,7 +679,7 @@ int32 CFE_PSP_MemCpy(void *dst, const void *src, uint32 size) ** Returns OS_SUCCESS. ** ******************************************************************************/ -int32 CFE_PSP_MemSet(void *dst, uint8 value , uint32 size) +int32 CFE_PSP_MemSet(void *dst, uint8 value, uint32 size) { int32 status; @@ -707,9 +698,9 @@ uint32 CFE_PSP_Exception_GetCount(void) { int32 status; - status = UT_DEFAULT_IMPL(CFE_PSP_Exception_GetCount); + status = UT_DEFAULT_IMPL(CFE_PSP_Exception_GetCount); - return status; + return status; } int32 CFE_PSP_Exception_GetSummary(uint32 *ContextLogId, osal_id_t *TaskId, char *ReasonBuf, uint32 ReasonSize) @@ -717,8 +708,8 @@ int32 CFE_PSP_Exception_GetSummary(uint32 *ContextLogId, osal_id_t *TaskId, char int32 status; *ContextLogId = 0; - *TaskId = OS_OBJECT_ID_UNDEFINED; - *ReasonBuf = 0; + *TaskId = OS_OBJECT_ID_UNDEFINED; + *ReasonBuf = 0; /* allow the testcase to easily set the taskID output, anything more involved needs a hook */ status = UT_DEFAULT_IMPL_ARGS(CFE_PSP_Exception_GetSummary, ContextLogId, TaskId, ReasonBuf, ReasonSize); @@ -727,7 +718,6 @@ int32 CFE_PSP_Exception_GetSummary(uint32 *ContextLogId, osal_id_t *TaskId, char UT_Stub_CopyToLocal(UT_KEY(CFE_PSP_Exception_GetSummary), TaskId, sizeof(*TaskId)); } - return status; } @@ -743,5 +733,3 @@ int32 CFE_PSP_Exception_CopyContext(uint32 ContextLogId, void *ContextBuf, uint3 return status; } - - From fef59a91f86b34d1f096329eee31f958be1a7585 Mon Sep 17 00:00:00 2001 From: Jacob Hageman Date: Mon, 8 Feb 2021 15:36:11 -0500 Subject: [PATCH 3/5] Fix #248, Add CodeQL analysis to workflow --- .github/workflows/codeql-build.yml | 56 ++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 .github/workflows/codeql-build.yml diff --git a/.github/workflows/codeql-build.yml b/.github/workflows/codeql-build.yml new file mode 100644 index 00000000..f5a04854 --- /dev/null +++ b/.github/workflows/codeql-build.yml @@ -0,0 +1,56 @@ +name: "CodeQL Analysis" + +on: + push: + pull_request: + +env: + SIMULATION: native + ENABLE_UNIT_TESTS: true + OMIT_DEPRECATED: true + BUILDTYPE: release + +jobs: + + CodeQL-Build: + runs-on: ubuntu-18.04 + timeout-minutes: 15 + + steps: + # 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: psp + + - name: Check versions + run: git submodule + + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: c + queries: +security-extended, security-and-quality + + # 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 psp-pc-linux + make native/default_cpu1/psp/unit-test-coverage/ + make native/default_cpu1/psp/ut-stubs/ + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 From 6a3a59c92e5ee5d0d938fe4d04e48d5d679edb51 Mon Sep 17 00:00:00 2001 From: "Gerardo E. Cruz-Ortiz" <59618057+astrogeco@users.noreply.github.com> Date: Wed, 13 Jan 2021 17:26:32 -0500 Subject: [PATCH 4/5] Fix #241, add missing '+dev' string to development version report --- fsw/inc/cfe_psp.h | 2 +- fsw/inc/cfe_psp_configdata.h | 2 +- fsw/mcp750-vxworks/inc/psp_version.h | 6 +++--- fsw/pc-linux/inc/psp_version.h | 6 +++--- fsw/pc-rtems/inc/psp_version.h | 6 +++--- fsw/shared/src/cfe_psp_configdata.c | 10 +++++----- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/fsw/inc/cfe_psp.h b/fsw/inc/cfe_psp.h index c340f983..608517c1 100644 --- a/fsw/inc/cfe_psp.h +++ b/fsw/inc/cfe_psp.h @@ -151,7 +151,7 @@ #define CFE_PSP_MINOR_VERSION (GLOBAL_PSP_CONFIGDATA.PSP_VersionInfo.MinorVersion) #define CFE_PSP_REVISION (GLOBAL_PSP_CONFIGDATA.PSP_VersionInfo.Revision) #define CFE_PSP_MISSION_REV (GLOBAL_PSP_CONFIGDATA.PSP_VersionInfo.MissionRev) -#define CFE_PSP_VERSION (GLOBAL_PSP_CONFIGDATA.PSP_VersionInfo.Version) +#define CFE_PSP_VERSION (GLOBAL_PSP_CONFIGDATA.PSP_VersionInfo.VersionString) /* ** Type Definitions diff --git a/fsw/inc/cfe_psp_configdata.h b/fsw/inc/cfe_psp_configdata.h index 8c77b1b2..0dacd68c 100644 --- a/fsw/inc/cfe_psp_configdata.h +++ b/fsw/inc/cfe_psp_configdata.h @@ -43,7 +43,7 @@ typedef const struct uint8 MinorVersion; uint8 Revision; uint8 MissionRev; - char Version[16]; + char VersionString[32]; } CFE_PSP_VersionInfo_t; /** diff --git a/fsw/mcp750-vxworks/inc/psp_version.h b/fsw/mcp750-vxworks/inc/psp_version.h index 4d57d844..980a8898 100644 --- a/fsw/mcp750-vxworks/inc/psp_version.h +++ b/fsw/mcp750-vxworks/inc/psp_version.h @@ -49,13 +49,13 @@ #define CFE_PSP_IMPL_STR(x) \ CFE_PSP_IMPL_STR_HELPER(x) /*!< @brief Helper function to concatenate strings from integer */ -/*! @brief Development Build Version Number. +/*! @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_PSP_IMPL_VERSION CFE_PSP_IMPL_BUILD_BASELINE CFE_PSP_IMPL_STR(CFE_PSP_IMPL_BUILD_NUMBER) +#define CFE_PSP_IMPL_VERSION CFE_PSP_IMPL_BUILD_BASELINE "+dev" CFE_PSP_IMPL_STR(CFE_PSP_IMPL_BUILD_NUMBER) -/*! @brief Development Build Version String. +/*! @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. */ diff --git a/fsw/pc-linux/inc/psp_version.h b/fsw/pc-linux/inc/psp_version.h index dc3eb209..5202395b 100644 --- a/fsw/pc-linux/inc/psp_version.h +++ b/fsw/pc-linux/inc/psp_version.h @@ -49,13 +49,13 @@ #define CFE_PSP_IMPL_STR(x) \ CFE_PSP_IMPL_STR_HELPER(x) /*!< @brief Helper function to concatenate strings from integer */ -/*! @brief Development Build Version Number. +/*! @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_PSP_IMPL_VERSION CFE_PSP_IMPL_BUILD_BASELINE CFE_PSP_IMPL_STR(CFE_PSP_IMPL_BUILD_NUMBER) +#define CFE_PSP_IMPL_VERSION CFE_PSP_IMPL_BUILD_BASELINE "+dev" CFE_PSP_IMPL_STR(CFE_PSP_IMPL_BUILD_NUMBER) -/*! @brief Development Build Version String. +/*! @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. */ diff --git a/fsw/pc-rtems/inc/psp_version.h b/fsw/pc-rtems/inc/psp_version.h index 63daffcd..8572a3d6 100644 --- a/fsw/pc-rtems/inc/psp_version.h +++ b/fsw/pc-rtems/inc/psp_version.h @@ -49,13 +49,13 @@ #define CFE_PSP_IMPL_STR(x) \ CFE_PSP_IMPL_STR_HELPER(x) /*!< @brief Helper function to concatenate strings from integer */ -/*! @brief Development Build Version Number. +/*! @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_PSP_IMPL_VERSION CFE_PSP_IMPL_BUILD_BASELINE CFE_PSP_IMPL_STR(CFE_PSP_IMPL_BUILD_NUMBER) +#define CFE_PSP_IMPL_VERSION CFE_PSP_IMPL_BUILD_BASELINE "+dev" CFE_PSP_IMPL_STR(CFE_PSP_IMPL_BUILD_NUMBER) -/*! @brief Development Build Version String. +/*! @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. */ diff --git a/fsw/shared/src/cfe_psp_configdata.c b/fsw/shared/src/cfe_psp_configdata.c index 31e748d3..1a4374be 100644 --- a/fsw/shared/src/cfe_psp_configdata.c +++ b/fsw/shared/src/cfe_psp_configdata.c @@ -45,8 +45,8 @@ Target_PspConfigData GLOBAL_PSP_CONFIGDATA = {.PSP_WatchdogMin = CFE_PSP_WATCHD .HW_NumEepromBanks = CFE_PSP_NUM_EEPROM_BANKS, - .PSP_VersionInfo = {.MajorVersion = CFE_PSP_IMPL_MAJOR_VERSION, - .MinorVersion = CFE_PSP_IMPL_MINOR_VERSION, - .Revision = CFE_PSP_IMPL_REVISION, - .MissionRev = CFE_PSP_IMPL_MISSION_REV, - .Version = CFE_PSP_IMPL_VERSION}}; + .PSP_VersionInfo = {.MajorVersion = CFE_PSP_IMPL_MAJOR_VERSION, + .MinorVersion = CFE_PSP_IMPL_MINOR_VERSION, + .Revision = CFE_PSP_IMPL_REVISION, + .MissionRev = CFE_PSP_IMPL_MISSION_REV, + .VersionString = CFE_PSP_IMPL_VERSION}}; From b19074dbf94dac7bf38d23e8c4bc520c4a74cbd5 Mon Sep 17 00:00:00 2001 From: "Gerardo E. Cruz-Ortiz" <59618057+astrogeco@users.noreply.github.com> Date: Tue, 16 Feb 2021 09:46:44 -0500 Subject: [PATCH 5/5] Bump to v1.5.0-rc1+dev68 --- README.md | 10 +++++++++- fsw/mcp750-vxworks/inc/psp_version.h | 2 +- fsw/pc-linux/inc/psp_version.h | 2 +- fsw/pc-rtems/inc/psp_version.h | 2 +- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 6cc43c30..dfa1bd63 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,14 @@ This is a collection of APIs abstracting platform specific functionality to be l ## Version History +### Development Build: 1.5.0-rc1+dev68 + +- Updates continuous integration workfow by adding static analysis with timeout and code format check. Adds status badges to ReadMe and removes old TravisCI artifacts. +- Adds CodeQL analysis to continuous integration +- Apply standard formatting to psp codebase. Only changes whitespace. +- Adds missing "+dev" to development version output +- See + ### Development Build: 1.5.0-rc1+dev58 - Add `Security.md` with instructions on reporting vulnerabilities. @@ -42,7 +50,7 @@ This is a collection of APIs abstracting platform specific functionality to be l ### Development Build: 1.5.0-rc1+dev30 -- PR #212 - Use event callback mechanism to invoke pthread_setname_np() such that the OS kernel is informed of the OSAL task name. `/proc` filesystem on Linux now has actual task name, instead of all being core-cpu1. The `pthread_setname_np` API requires `_GNU_SOURCE` to be defined when compiling - this can be local to PSP. +- - Use event callback mechanism to invoke pthread_setname_np() such that the OS kernel is informed of the OSAL task name. `/proc` filesystem on Linux now has actual task name, instead of all being core-cpu1. The `pthread_setname_np` API requires `_GNU_SOURCE` to be defined when compiling - this can be local to PSP. - Set REVISION to "99" to indicate development version - See diff --git a/fsw/mcp750-vxworks/inc/psp_version.h b/fsw/mcp750-vxworks/inc/psp_version.h index 980a8898..c425ccdb 100644 --- a/fsw/mcp750-vxworks/inc/psp_version.h +++ b/fsw/mcp750-vxworks/inc/psp_version.h @@ -29,7 +29,7 @@ /* * Development Build Macro Definitions */ -#define CFE_PSP_IMPL_BUILD_NUMBER 58 +#define CFE_PSP_IMPL_BUILD_NUMBER 68 #define CFE_PSP_IMPL_BUILD_BASELINE "v1.5.0-rc1" /* diff --git a/fsw/pc-linux/inc/psp_version.h b/fsw/pc-linux/inc/psp_version.h index 5202395b..398ec7ad 100644 --- a/fsw/pc-linux/inc/psp_version.h +++ b/fsw/pc-linux/inc/psp_version.h @@ -29,7 +29,7 @@ /* * Development Build Macro Definitions */ -#define CFE_PSP_IMPL_BUILD_NUMBER 58 +#define CFE_PSP_IMPL_BUILD_NUMBER 68 #define CFE_PSP_IMPL_BUILD_BASELINE "v1.5.0-rc1" /* diff --git a/fsw/pc-rtems/inc/psp_version.h b/fsw/pc-rtems/inc/psp_version.h index 8572a3d6..4f1b8d0e 100644 --- a/fsw/pc-rtems/inc/psp_version.h +++ b/fsw/pc-rtems/inc/psp_version.h @@ -29,7 +29,7 @@ /* * Development Build Macro Definitions */ -#define CFE_PSP_IMPL_BUILD_NUMBER 58 +#define CFE_PSP_IMPL_BUILD_NUMBER 68 #define CFE_PSP_IMPL_BUILD_BASELINE "v1.5.0-rc1" /*