diff --git a/CMakeLists.txt b/CMakeLists.txt index 5855677d..3d601212 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -71,5 +71,5 @@ target_include_directories(psp-${CFE_PSP_TARGETNAME} INTERFACE if (ENABLE_UNIT_TESTS) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/ut-stubs) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/unit-test-coverage) -endif (ENABLE_UNIT_TESTS) +endif () diff --git a/fsw/inc/cfe_psp.h b/fsw/inc/cfe_psp.h index 91f7e580..478c9dcc 100644 --- a/fsw/inc/cfe_psp.h +++ b/fsw/inc/cfe_psp.h @@ -32,18 +32,18 @@ #ifndef CFE_PSP_H #define CFE_PSP_H -/* -** Include Files -*/ +/****************************************************************************** + INCLUDE FILES + ******************************************************************************/ #include "common_types.h" #include "osapi.h" #include "cfe_psp_error.h" -/* -** Macro Definitions -*/ +/****************************************************************************** + MACRO DEFINITIONS + ******************************************************************************/ /* ** Definitions for PSP PANIC types @@ -89,7 +89,7 @@ /* * Common definition for reset types at the PSP layer */ -/** \name Reset Types */ +/** @name Reset Types */ /** \{ */ #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 */ @@ -99,344 +99,841 @@ /* ** Reset Sub-Types */ -/** \name Reset Sub-Types */ +/** @name Reset Sub-Types */ /** \{ */ -/** \brief Reset caused by power having been removed and restored */ +/** @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 */ +/** @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 */ +/** @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 */ +/** @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 */ +/** @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 */ +/** @brief Reset was caused by a Processor Exception */ #define CFE_PSP_RST_SUBTYPE_EXCEPTION 6 -/** \brief Reset was caused in an unknown manner */ +/** @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 */ +/** @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 */ +/** @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. */ +/** @brief Placeholder to indicate 1+ the maximum value that the PSP will ever use. */ #define CFE_PSP_RST_SUBTYPE_MAX 10 /** \} */ /** - * \brief The name of the software/RTOS timebase for general system timers. + * @brief The name of the software/RTOS timebase for general system timers. * * This name may be referred to by CFE TIME and/or SCH when setting up its own timers. */ #define CFE_PSP_SOFT_TIMEBASE_NAME "cFS-Master" -/* -** Type Definitions -*/ - -/* -** Function prototypes -*/ +/****************************************************************************** + FUNCTION PROTOTYPES + ******************************************************************************/ /* ** PSP entry point and reset routines */ +/*--------------------------------------------------------------------------------------*/ +/** + * @brief PSP Entry Point to initialize the OSAL and start up the cFE + * + * This is the entry point that the real-time OS calls to start our software. + * This routine will do any BSP/OS-specific setup, then call the entry point of + * the flight software (i.e. the cFE main entry point). + * + * @note The flight software (i.e. cFE) should not call this routine. + */ extern void CFE_PSP_Main(void); -/* -** CFE_PSP_Main is the entry point that the real time OS calls to start our -** software. This routine will do any BSP/OS specific setup, then call the -** entrypoint of the flight software ( i.e. the cFE main entry point ). -** The flight software (i.e. cFE ) should not call this routine. -*/ - +/*--------------------------------------------------------------------------------------*/ /** - * \brief Sample/Read a monotonic platform clock with normalization + * @brief Sample/Read a monotonic platform clock with normalization * - * Outputs an OS_time_t value indicating the time elapsed since an epoch. The - * epoch is not defined, but typically represents the system boot time. The + * Outputs an OS_time_t value indicating the time elapsed since an epoch. The + * epoch is not defined, but typically represents the system boot time. The * value increases continuously over time and cannot be reset by software. * * This is similar to the CFE_PSP_Get_Timebase(), but additionally it normalizes - * the output value to an OS_time_t, thereby providing consistent units to - * the calling application. Any OSAL-provided routine accepts OS_time_t inputs + * the output value to an OS_time_t, thereby providing consistent units to the + * calling application. Any OSAL-provided routine that accepts OS_time_t inputs * may be used to convert this value into other standardized time units. * - * \note This should refer to the same time domain as CFE_PSP_Get_Timebase(), + * @note This should refer to the same time domain as CFE_PSP_Get_Timebase(), * the primary difference being the format and units of the output value. * - * \sa CFE_PSP_Get_Timebase() + * @sa CFE_PSP_Get_Timebase() * - * \param[out] LocalTime Value of PSP tick counter as OS_time_t + * @param[out] LocalTime Value of PSP tick counter as OS_time_t */ extern void CFE_PSP_GetTime(OS_time_t *LocalTime); +/*--------------------------------------------------------------------------------------*/ +/** + * @brief Entry point back to the BSP to restart the processor. + * + * The flight software calls this routine to restart the processor. + * + * @param[in] resetType Type of reset + */ 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. -*/ +/*--------------------------------------------------------------------------------------*/ +/** + * @brief Returns the last reset type + * + * @note If a pointer to a valid memory space is passed in, it returns the reset + * sub-type in that memory. Right now the reset types are application-specific. + * For the cFE they are defined in the cfe_es.h file. + * + * @param 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. -** Right now the reset types are application specific. For the cFE they -** are defined in the cfe_es.h file. -*/ +/*--------------------------------------------------------------------------------------*/ +/** + * @brief This is a BSP-specific cache flush routine + * + * Provides a common interface to flush the processor caches. This routine is in + * the BSP because it is sometimes implemented in hardware and sometimes taken + * care of by the RTOS. + * + * @param[in] type + * @param[in] address + * @param[in] size + */ extern void CFE_PSP_FlushCaches(uint32 type, void *address, uint32 size); -/* -** This is a BSP specific cache flush routine -*/ +/*--------------------------------------------------------------------------------------*/ +/** + * @brief Returns the CPU ID as defined by the specific board and BSP. + * + * @return The processor ID + */ extern uint32 CFE_PSP_GetProcessorId(void); -/* -** CFE_PSP_GetProcessorId returns the CPU ID as defined by the specific board -** and BSP. -*/ +/*--------------------------------------------------------------------------------------*/ +/** + * @brief Returns the Spacecraft ID (if any) + * + * @return The Spacecraft ID + */ extern uint32 CFE_PSP_GetSpacecraftId(void); -/* -** CFE_PSP_GetSpacecraftId returns the Spacecraft ID (if any ) -*/ +/*--------------------------------------------------------------------------------------*/ +/** + * @brief Returns the processor name + * + * @return The processor name + */ extern const char *CFE_PSP_GetProcessorName(void); -/* -** CFE_PSP_GetProcessorName returns the processor name -*/ +/*--------------------------------------------------------------------------------------*/ +/** + * @brief Returns the underlying OS timer tick value + * + * It is used for the performance monitoring software + */ extern uint32 CFE_PSP_Get_Timer_Tick(void); -/* -** CFE_PSP_Get_Timer_Tick returns the underlying OS timer tick value -** It is used for the performance monitoring software -*/ +/*--------------------------------------------------------------------------------------*/ +/** + * Provides the 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 (microsecond) per tick + * + * @return The number of timer ticks per second of the time stamp returned by + * CFE_PSP_Get_Timebase + */ extern uint32 CFE_PSP_GetTimerTicksPerSecond(void); -/* -** CFE_PSP_GetTimerTicksPerSecond provides the 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 -*/ +/*--------------------------------------------------------------------------------------*/ +/** + * Provides 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. + * + * @return The number that the least significant 32 bits of the 64-bit time + * stamp returned by CFE_PSP_Get_Timebase rolls over. + */ extern uint32 CFE_PSP_GetTimerLow32Rollover(void); -/* -** CFE_PSP_GetTimerLow32Rollover provides 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 Sample/Read a monotonic platform clock without normalization + * @brief Sample/Read a monotonic platform clock without normalization * - * This is defined as a free-running, monotonically-increasing tick counter. The - * epoch is not defined, but typically is the system boot time, and the value increases - * indefinitely as the system runs. The tick period/rate is also not defined. + * Provides a common interface to system timebase. This routine is in the BSP + * because it is sometimes implemented in hardware and sometimes taken care of + * by the RTOS. + * + * This is defined as a free-running, monotonically-increasing tick counter. The + * epoch is not defined, but typically is the system boot time, and the value + * increases indefinitely as the system runs. The tick period/rate is also not + * defined. * * Rollover events - where the range of representable values is exceeded - are - * theoretically possible, but would take many years of continuous uptime to occur - * (typically hundreds of years, if not thousands). System designers should ensure - * that the actual tick rate and resulting timebase range is sufficiently large to - * ensure that rollover is not a concern. + * theoretically possible, but would take many years of continuous uptime to + * occur (typically hundreds of years, if not thousands). System designers + * should ensure that the actual tick rate and resulting timebase range is + * sufficiently large to ensure that rollover is not a concern. * - * \note This is a "raw" value from the underlying platform with minimal/no conversions - * or normalization applied. Neither the epoch nor the resolution of this tick - * counter is specified, and it may vary from platform to platform. Use the - * CFE_PSP_GetTime() function to sample the timebase and also convert the units - * into a normalized/more consistent form. + * @note This is a "raw" value from the underlying platform with minimal/no + * conversions or normalization applied. Neither the epoch nor the resolution of + * this tick counter is specified, and it may vary from platform to platform. + * Use the CFE_PSP_GetTime() function to sample the timebase and also convert + * the units into a normalized/more consistent form. * - * \sa CFE_PSP_GetTime() + * @sa CFE_PSP_GetTime() * - * \param[out] Tbu Buffer to hold the upper 32 bits of a 64-bit tick counter - * \param[out] Tbl Buffer to hold the lower 32 bits of a 64-bit tick counter + * @param[out] Tbu Buffer to hold the upper 32 bits of a 64-bit tick counter + * @param[out] Tbl Buffer to hold the lower 32 bits of a 64-bit tick counter */ extern void CFE_PSP_Get_Timebase(uint32 *Tbu, uint32 *Tbl); +/*--------------------------------------------------------------------------------------*/ +/** + * @brief CFE_PSP_Get_Dec + */ extern uint32 CFE_PSP_Get_Dec(void); -/* -** CFE_PSP_Get_Dec -*/ +/*--------------------------------------------------------------------------------------*/ +/** + * @brief Fetches the size of the OS Critical Data Store area. + * + * @param[out] SizeOfCDS Pointer to the variable that will store the size of the CDS + * + * @return 0 (OS_SUCCESS or CFE_PSP_SUCCESS) on success, -1 (OS_ERROR or CFE_PSP_ERROR) on error + */ extern int32 CFE_PSP_GetCDSSize(uint32 *SizeOfCDS); -/* -** CFE_PSP_GetCDSSize fetches the size of the OS Critical Data Store area. -*/ +/*--------------------------------------------------------------------------------------*/ +/** + * @brief Writes to the CDS Block. + * + * @param[in] PtrToDataToWrite Pointer to the data that will be written to the CDS + * @param[in] CDSOffset CDS offset + * @param[in] NumBytes Number of bytes to write + * + * @return 0 (OS_SUCCESS or CFE_PSP_SUCCESS) on success, -1 (OS_ERROR or CFE_PSP_ERROR) on error + */ extern int32 CFE_PSP_WriteToCDS(const void *PtrToDataToWrite, uint32 CDSOffset, uint32 NumBytes); -/* -** CFE_PSP_WriteToCDS writes to the CDS Block. -*/ +/*--------------------------------------------------------------------------------------*/ +/** + * @brief Reads from the CDS Block + * + * @param[out] PtrToDataToRead Pointer to the location that will store the data to be read from the CDS + * @param[in] CDSOffset CDS offset + * @param[in] NumBytes Number of bytes to read + * + * @return 0 (OS_SUCCESS or CFE_PSP_SUCCESS) on success, -1 (OS_ERROR or CFE_PSP_ERROR) on error + */ extern int32 CFE_PSP_ReadFromCDS(void *PtrToDataToRead, uint32 CDSOffset, uint32 NumBytes); -/* -** CFE_PSP_ReadFromCDS reads from the CDS Block -*/ +/*--------------------------------------------------------------------------------------*/ +/** + * @brief 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 + * + * @param[out] PtrToResetArea Pointer to the variable that will store the location of the reset area + * @param[out] SizeOfResetArea Pointer to the variable that will store the reset area size + * + * @return 0 (OS_SUCCESS or CFE_PSP_SUCCESS) on success, -1 (OS_ERROR or CFE_PSP_ERROR) on error + */ 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 -*/ +/*--------------------------------------------------------------------------------------*/ +/** + * @brief Returns the location and size of the memory used for the cFE user-reserved area. + * + * @param[out] PtrToUserArea Pointer to the variable that will store the location of the user-reserved area + * @param[out] SizeOfUserArea Pointer to the variable that will store the size of the user-reserved area + * + * @return 0 (OS_SUCCESS or CFE_PSP_SUCCESS) on success, -1 (OS_ERROR or CFE_PSP_ERROR) on error + */ 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. -*/ +/*--------------------------------------------------------------------------------------*/ +/** + * @brief Returns the location and size of the memory used for the cFE volatile disk. + * + * @param[out] PtrToVolDisk Pointer to the variable that will store the location of the cFE volatile disk + * @param[out] SizeOfVolDisk Pointer to the variable that will store the size of the cFE volatile disk + * + * @return 0 (OS_SUCCESS or CFE_PSP_SUCCESS) on success, -1 (OS_ERROR or CFE_PSP_ERROR) on error + */ 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. -*/ +/*--------------------------------------------------------------------------------------*/ +/** + * @brief Returns the location and size of the kernel memory. + * + * This function returns the start and end address of the kernel text segment. + * It may not be implemented on all architectures. + * + * @param[out] PtrToKernelSegment Pointer to the variable that will store the location of the kernel text segment + * @param[out] SizeOfKernelSegment Pointer to the variable that will store the size of the kernel text segment + * + * @return 0 (OS_SUCCESS or CFE_PSP_SUCCESS) on success, -1 (OS_ERROR or CFE_PSP_ERROR) on error + * or CFE_PSP_ERROR_NOT_IMPLEMENTED if not implemented + */ extern int32 CFE_PSP_GetKernelTextSegmentInfo(cpuaddr *PtrToKernelSegment, uint32 *SizeOfKernelSegment); -/* -** CFE_PSP_GetKernelTextSegmentInfo returns the location and size of the kernel memory. -*/ +/*--------------------------------------------------------------------------------------*/ +/** + * @brief Returns the location and size of the kernel memory. + * + * This function returns the start and end address of the CFE text segment. It + * may not be implemented on all architectures. + * + * @param[out] PtrToCFESegment Pointer to the variable that will store the location of the cFE text segment + * @param[out] SizeOfCFESegment Pointer to the variable that will store the size of the cFE text segment + * + * @return 0 (OS_SUCCESS or CFE_PSP_SUCCESS) on success, -1 (OS_ERROR or CFE_PSP_ERROR) on error + */ extern int32 CFE_PSP_GetCFETextSegmentInfo(cpuaddr *PtrToCFESegment, uint32 *SizeOfCFESegment); -/* -** CFE_PSP_GetCFETextSegmentInfo returns the location and size of the kernel memory. -*/ +/*--------------------------------------------------------------------------------------*/ +/** + * @brief Configures the watchdog timer. + * + * To set up the timer resolution and/or other settings custom to this platform. + */ extern void CFE_PSP_WatchdogInit(void); -/* -** CFE_PSP_WatchdogInit configures the watchdog timer. -*/ +/*--------------------------------------------------------------------------------------*/ +/** + * @brief Enables the watchdog timer. + */ extern void CFE_PSP_WatchdogEnable(void); -/* -** CFE_PSP_WatchdogEnable enables the watchdog timer. -*/ +/*--------------------------------------------------------------------------------------*/ +/** + * @brief Disables the watchdog timer. + */ extern void CFE_PSP_WatchdogDisable(void); -/* -** CFE_PSP_WatchdogDisable disables the watchdog timer. -*/ +/*--------------------------------------------------------------------------------------*/ +/** + * @brief Services the watchdog timer according to the value set in WatchDogSet. + * + * Load the watchdog timer with a count that corresponds to the millisecond + * time given in the parameter. + * + * @note Currently an ExpireTime value of zero will result in the minimum reset + * time of 4.5 seconds. All other ExpireTime values will result in a reset time + * of 5.5 seconds. + */ extern void CFE_PSP_WatchdogService(void); -/* -** CFE_PSP_WatchdogService services the watchdog timer according to the -** value set in WatchDogSet. -*/ +/*--------------------------------------------------------------------------------------*/ +/** + * @brief Gets the watchdog time in milliseconds + * + * @return The current watchdog value + */ extern uint32 CFE_PSP_WatchdogGet(void); -/* -** CFE_PSP_WatchdogGet gets the watchdog time in milliseconds -*/ +/*--------------------------------------------------------------------------------------*/ +/** + * @brief Sets the watchdog time in milliseconds + * + * @param[in] WatchdogValue New watchdog value to set + */ extern void CFE_PSP_WatchdogSet(uint32 WatchdogValue); -/* -** CFE_PSP_WatchdogSet sets the watchdog time in milliseconds -*/ +/*--------------------------------------------------------------------------------------*/ +/** + * @brief Aborts the cFE startup + * + * Provides a common interface to abort the cFE startup process and return back + * to the OS. + * + * @note This is called by the cFE Core startup code when it needs to abort the + * cFE startup. This should not be called by applications. + * + * @param[in] ErrorCode Reason for exiting + */ extern void CFE_PSP_Panic(int32 ErrorCode); -/* -** CFE_PSP_Panic is called by the cFE Core startup code when it needs to abort the -** cFE startup. This should not be called by applications. -*/ +/*--------------------------------------------------------------------------------------*/ +/** + * @brief Initializes the Solid State recorder memory for a particular platform + * + * @note For the MCP750, this simply initializes the Hard Disk device. + * + * @param[in] bus + * @param[in] device + * @param[in] DeviceName + * + * @retval CFE_PSP_SUCCESS on success + * @retval CFE_PSP_ERROR on error + */ 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 -*/ +/*--------------------------------------------------------------------------------------*/ +/** + * @brief Uncompresses the source file to the file specified in the destination file name. + * + * @note The Decompress uses the "gzip" algorithm. Files can be compressed + * using the "gzip" program available on almost all host platforms. + * + * @param srcFileName Source file to decompress + * @param dstFileName Destination file name + */ 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. -*/ +/*--------------------------------------------------------------------------------------*/ +/** + * @brief Sets up 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 exception handlers, rather than restarting the system. + */ 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 -*/ +/*--------------------------------------------------------------------------------------*/ +/** + * @brief Defines the CPU and FPU exceptions that are enabled for each cFE Task/App + * + * This function sets a default exception environment that can be used + * + * @note The exception environment is local to each task. Therefore, this must + * be Called for each task that wants to do floating point and catch exceptions. + */ extern void CFE_PSP_SetDefaultExceptionEnvironment(void); -/* -** -** CFE_PSP_SetDefaultExceptionEnvironment defines the CPU and FPU exceptions that are enabled for each cFE Task/App -** -** Notes: The exception environment is local to each task Therefore this must be -** called for each task that that wants to do floating point and catch exceptions -*/ +/*--------------------------------------------------------------------------------------*/ +/** + * @brief Returns the unread exception count + * + * @return The unread exception count + */ 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); + +/*--------------------------------------------------------------------------------------*/ +/** + * @brief Retrieves a summary of an exception log entry + * + * @note This function returns CFE_PSP_SUCCESS to indicate that an entry was + * popped from the queue. This doesn't necessarily mean that the output fields + * have valid data, but it does mean they are initialized to something. + * + * @param[in] ContextLogId ID of the exception log entry to get a summary for + * @param[in, out] TaskId Pointer to the TaskID buffer + * @param[out] ReasonBuf Pointer to the buffer that will store the exception summary string + * @param[in] ReasonSize Maximum size of the summary string to retrieve + * + * @retval CFE_PSP_SUCCESS on success (see note above) + * @retval CFE_PSP_NO_EXCEPTION_DATA if no context available for reading + */ +extern int32 CFE_PSP_Exception_GetSummary(uint32 *ContextLogId, osal_id_t *TaskId, char *ReasonBuf, uint32 ReasonSize); + +/*--------------------------------------------------------------------------------------*/ +/** + * @brief Retrieves exception log entry context information + * + * @param[in] ContextLogId ID of the exception log entry to copy + * @param[out] ContextBuf Pointer to the buffer where the context information is to be copied to + * @param[in] ContextSize Maximum size of context information data to copy + * + * @return Size of the copied data + * @retval CFE_PSP_NO_EXCEPTION_DATA if data has expired from the memory log + */ +extern int32 CFE_PSP_Exception_CopyContext(uint32 ContextLogId, void *ContextBuf, uint32 ContextSize); /* ** I/O Port API */ +/*--------------------------------------------------------------------------------------*/ +/** + * @brief Read one byte of memory. + * + * @param[in] PortAddress Address to be read + * @param[out] ByteValue The address content will be copied to the location pointed to by this argument + * + * @return Always returns CFE_PSP_SUCCESS (if implemented) + * @retval CFE_PSP_ERROR_NOT_IMPLEMENTED if not implemented + */ int32 CFE_PSP_PortRead8(cpuaddr PortAddress, uint8 *ByteValue); + +/*--------------------------------------------------------------------------------------*/ +/** + * @brief Write one byte of memory. + * + * @param[out] PortAddress Address to be written to + * @param[in] ByteValue The content pointed to by this argument will be copied to the address + * + * @return Always returns CFE_PSP_SUCCESS (if implemented) + * @retval CFE_PSP_ERROR_NOT_IMPLEMENTED if not implemented + */ int32 CFE_PSP_PortWrite8(cpuaddr PortAddress, uint8 ByteValue); + +/*--------------------------------------------------------------------------------------*/ +/** + * @brief Read 2 bytes of memory. + * + * @param[in] PortAddress Address to be read + * @param[out] uint16Value The address content will be copied to the location pointed to by this argument + * + * @retval CFE_PSP_SUCCESS on success + * @retval CFE_PSP_ERROR_ADDRESS_MISALIGNED if the address is not aligned to a 16-bit addressing scheme. + * @retval CFE_PSP_ERROR_NOT_IMPLEMENTED if not implemented + */ int32 CFE_PSP_PortRead16(cpuaddr PortAddress, uint16 *uint16Value); + +/*--------------------------------------------------------------------------------------*/ +/** + * @brief Write 2 bytes of memory. + * + * @param[out] PortAddress Address to be written to + * @param[in] uint16Value the content pointed to by this argument will be copied to the address + * + * @retval CFE_PSP_SUCCESS on success + * @retval CFE_PSP_ERROR_ADDRESS_MISALIGNED if the address is not aligned to a 16-bit addressing scheme. + * @retval CFE_PSP_ERROR_NOT_IMPLEMENTED if not implemented + */ int32 CFE_PSP_PortWrite16(cpuaddr PortAddress, uint16 uint16Value); + +/*--------------------------------------------------------------------------------------*/ +/** + * @brief Read 4 bytes of memory. + * + * @param[in] PortAddress Address to be read + * @param[out] uint32Value The address content will be copied to the location pointed to by this argument + * + * @retval CFE_PSP_SUCCESS on success + * @retval CFE_PSP_ERROR_ADDRESS_MISALIGNED if the address is not aligned to a 16-bit addressing scheme. + * @retval CFE_PSP_ERROR_NOT_IMPLEMENTED if not implemented + */ int32 CFE_PSP_PortRead32(cpuaddr PortAddress, uint32 *uint32Value); + +/*--------------------------------------------------------------------------------------*/ +/** + * @brief Write 4 bytes of memory. + * + * @param[out] PortAddress Address to be written to + * @param[in] uint32Value The content pointed to by this argument will be copied to the address + * + * @retval CFE_PSP_SUCCESS on success + * @retval CFE_PSP_ERROR_ADDRESS_MISALIGNED if the address is not aligned to a 16-bit addressing scheme. + * @retval CFE_PSP_ERROR_NOT_IMPLEMENTED if not implemented + */ int32 CFE_PSP_PortWrite32(cpuaddr PortAddress, uint32 uint32Value); /* ** Memory API */ +/*--------------------------------------------------------------------------------------*/ +/** + * @brief Read one byte of memory. + * + * @param[in] MemoryAddress Address to be read + * @param[out] ByteValue The address content will be copied to the location pointed to by this argument + * + * @return Always returns CFE_PSP_SUCCESS (if implemented) + * @retval CFE_PSP_ERROR_NOT_IMPLEMENTED if not implemented + */ int32 CFE_PSP_MemRead8(cpuaddr MemoryAddress, uint8 *ByteValue); + +/*--------------------------------------------------------------------------------------*/ +/** + * @brief Write one byte of memory. + * + * @param[out] MemoryAddress Address to be written to + * @param[in] ByteValue The content pointed to by this argument will be copied to the address + * + * @return Always returns CFE_PSP_SUCCESS (if implemented) + * @retval CFE_PSP_ERROR_NOT_IMPLEMENTED if not implemented + */ int32 CFE_PSP_MemWrite8(cpuaddr MemoryAddress, uint8 ByteValue); + +/*--------------------------------------------------------------------------------------*/ +/** + * @brief Read 2 bytes of memory. + * + * @param[in] MemoryAddress Address to be read + * @param[out] uint16Value The address content will be copied to the location pointed to by this argument + * + * @retval CFE_PSP_SUCCESS on success + * @retval CFE_PSP_ERROR_ADDRESS_MISALIGNED if the address is not aligned to a 16-bit addressing scheme. + * @retval CFE_PSP_ERROR_NOT_IMPLEMENTED if not implemented + */ int32 CFE_PSP_MemRead16(cpuaddr MemoryAddress, uint16 *uint16Value); + +/*--------------------------------------------------------------------------------------*/ +/** + * @brief Write 2 bytes of memory. + * + * @param[out] MemoryAddress Address to be written to + * @param[in] uint16Value The content pointed to by this argument will be copied to the address + * + * @retval CFE_PSP_SUCCESS on success + * @retval CFE_PSP_ERROR_ADDRESS_MISALIGNED if the address is not aligned to a 16-bit addressing scheme. + * @retval CFE_PSP_ERROR_NOT_IMPLEMENTED if not implemented + */ int32 CFE_PSP_MemWrite16(cpuaddr MemoryAddress, uint16 uint16Value); + +/*--------------------------------------------------------------------------------------*/ +/** + * @brief Read 4 bytes of memory. + * + * @param[in] MemoryAddress Address to be read + * @param[out] uint32Value The address content will be copied to the location pointed to by this argument + * + * @retval CFE_PSP_SUCCESS on success + * @retval CFE_PSP_ERROR_ADDRESS_MISALIGNED if the address is not aligned to a 16-bit addressing scheme. + * @retval CFE_PSP_ERROR_NOT_IMPLEMENTED if not implemented + */ int32 CFE_PSP_MemRead32(cpuaddr MemoryAddress, uint32 *uint32Value); + +/*--------------------------------------------------------------------------------------*/ +/** + * @brief Write 4 bytes of memory. + * + * @param[out] MemoryAddress Address to be written to + * @param[in] uint32Value The content pointed to by this argument will be copied to the address + * + * @retval CFE_PSP_SUCCESS on success + * @retval CFE_PSP_ERROR_ADDRESS_MISALIGNED if the address is not aligned to a 16-bit addressing scheme. + * @retval CFE_PSP_ERROR_NOT_IMPLEMENTED if not implemented + */ int32 CFE_PSP_MemWrite32(cpuaddr MemoryAddress, uint32 uint32Value); +/*--------------------------------------------------------------------------------------*/ +/** + * @brief Copy 'n' bytes from 'src' to 'dest' + * + * Copies 'n' bytes from memory address pointed to by 'src' to memory + * address pointed to by 'dest'. + * + * @note For now we are using the standard C library call 'memcpy' but if we + * find we need to make it more efficient then we'll implement it in assembly. + * + * @param[out] dest Pointer to the destination address to copy to + * @param[in] src Pointer to the address to copy from + * @param[in] n Number of bytes to copy + * + * @return Always returns CFE_PSP_SUCCESS + */ int32 CFE_PSP_MemCpy(void *dest, const void *src, uint32 n); + +/*--------------------------------------------------------------------------------------*/ +/** + * @brief Copy 'n' bytes of value 'value' to 'dest' + * + * Copies 'n' number of bytes of value 'value' to memory address pointed + * to by 'dest'. + * + * @note For now we are using the standard C library call 'memset' but if we + * find we need to make it more efficient then we'll implement it in assembly. + * + * @param[out] dest Pointer to the destination address to copy to + * @param[in] value Value to set + * @param[in] n Number of bytes to copy + * + * @return Always returns CFE_PSP_SUCCESS + */ int32 CFE_PSP_MemSet(void *dest, uint8 value, uint32 n); -int32 CFE_PSP_MemValidateRange(cpuaddr Address, size_t Size, uint32 MemoryType); +/*--------------------------------------------------------------------------------------*/ +/** + * @brief Validates the memory range and type using the global CFE_PSP_MemoryTable + * + * @param[in] Address A 32-bit starting address of the memory range + * @param[in] Size A 32-bit size of the memory range (Address + Size = End Address) + * @param[in] MemoryType The memory type to validate, including but not limited to: + * CFE_PSP_MEM_RAM, CFE_PSP_MEM_EEPROM, or CFE_PSP_MEM_ANY + * Any defined CFE_PSP_MEM_* enumeration can be specified + * + * @retval CFE_PSP_SUCCESS Memory range and type information is valid and can be used. + * @retval CFE_PSP_INVALID_MEM_ADDR Starting address is not valid + * @retval CFE_PSP_INVALID_MEM_TYPE Memory type associated with the range does not match the passed-in type. + * @retval CFE_PSP_INVALID_MEM_RANGE The Memory range associated with the address is not large enough to contain + * Address + Size. + */ +int32 CFE_PSP_MemValidateRange(cpuaddr Address, size_t Size, uint32 MemoryType); + +/*--------------------------------------------------------------------------------------*/ +/** + * @brief Returns the number of memory ranges in the CFE_PSP_MemoryTable + * + * @return Positive integer number of entries in the memory range table + */ uint32 CFE_PSP_MemRanges(void); -int32 CFE_PSP_MemRangeSet(uint32 RangeNum, uint32 MemoryType, cpuaddr StartAddr, size_t Size, size_t WordSize, - uint32 Attributes); -int32 CFE_PSP_MemRangeGet(uint32 RangeNum, uint32 *MemoryType, cpuaddr *StartAddr, size_t *Size, size_t *WordSize, - uint32 *Attributes); +/*--------------------------------------------------------------------------------------*/ +/** + * @brief Populates one of the records in the CFE_PSP_MemoryTable. + * + * @note Because the table is fixed size, the entries are set by using the + * integer index. No validation is done with the address or size. + * + * @param[in] RangeNum A 32-bit integer (starting with 0) specifying the MemoryTable entry. + * @param[in] MemoryType The memory type to validate, including but not limited to: + * CFE_PSP_MEM_RAM, CFE_PSP_MEM_EEPROM, or CFE_PSP_MEM_ANY + * Any defined CFE_PSP_MEM_* enumeration can be specified + * @param[in] StartAddr A 32-bit starting address of the memory range + * @param[in] Size A 32-bit size of the memory range (Address + Size = End Address) + * @param[in] WordSize The minimum addressable size of the range: + * (CFE_PSP_MEM_SIZE_BYTE, CFE_PSP_MEM_SIZE_WORD, CFE_PSP_MEM_SIZE_DWORD) + * @param[in] Attributes The attributes of the Memory Range: + * (CFE_PSP_MEM_ATTR_WRITE, CFE_PSP_MEM_ATTR_READ, CFE_PSP_MEM_ATTR_READWRITE) + * + * @retval CFE_PSP_SUCCESS Memory range set successfully. + * @retval CFE_PSP_INVALID_MEM_RANGE The index into the table is invalid + * @retval FE_PSP_INVALID_MEM_ADDR Starting address is not valid + * @retval CFE_PSP_INVALID_MEM_TYPE Memory type associated with the range does not match the passed-in type. + * @retval CFE_PSP_INVALID_MEM_WORDSIZE The WordSize parameter is not one of the predefined types. + * @retval CFE_PSP_INVALID_MEM_ATTR The Attributes parameter is not one of the predefined types. + * @retval OP_INVALID_MEM_SIZE The Memory range associated with the address is not large enough to contain + * Address + Size. + */ +int32 CFE_PSP_MemRangeSet(uint32 RangeNum, uint32 MemoryType, cpuaddr StartAddr, size_t Size, size_t WordSize, + uint32 Attributes); + +/*--------------------------------------------------------------------------------------*/ +/** + * @brief Retrieves one of the records in the CFE_PSP_MemoryTable. + * + * @note Because the table is fixed size, the entries are accessed by using the integer index. + * + * @param[in] RangeNum A 32-bit integer (starting with 0) specifying the MemoryTable entry. + * @param[out] MemoryType A pointer to the 32-bit integer where the Memory Type is stored. + * Any defined CFE_PSP_MEM_* enumeration can be specified + * @param[out] StartAddr Pointer to the 32-bit integer where the 32-bit starting address of the memory range is stored. + * @param[out] Size A pointer to the 32-bit integer where the 32-bit size of the memory range is stored. + * @param[out] WordSize A pointer to the 32-bit integer where the minimum addressable size of the range: + * (CFE_PSP_MEM_SIZE_BYTE, CFE_PSP_MEM_SIZE_WORD, CFE_PSP_MEM_SIZE_DWORD) + * @param[out] Attributes The attributes of the Memory Range: + * (CFE_PSP_MEM_ATTR_WRITE, CFE_PSP_MEM_ATTR_READ, CFE_PSP_MEM_ATTR_READWRITE) + * + * @retval CFE_PSP_SUCCESS Memory range returned successfully. + * @retval CFE_PSP_INVALID_POINTER Parameter error + * @retval CFE_PSP_INVALID_MEM_RANGE The index into the table is invalid + */ +int32 CFE_PSP_MemRangeGet(uint32 RangeNum, uint32 *MemoryType, cpuaddr *StartAddr, size_t *Size, size_t *WordSize, + uint32 *Attributes); + +/*--------------------------------------------------------------------------------------*/ +/** + * @brief Write one byte (ByteValue) to EEPROM address MemoryAddress + * + * @param[out] MemoryAddress Memory address to write to + * @param[in] ByteValue Value to write to memory + * + * @retval CFE_PSP_SUCCESS on success + * @retval CFE_PSP_ERROR_TIMEOUT write operation did not go through after a specific timeout. + * @retval CFE_PSP_ERROR_ADDRESS_MISALIGNED if the address is not aligned to a 16-bit addressing scheme. + * @retval CFE_PSP_ERROR_NOT_IMPLEMENTED if not implemented + */ int32 CFE_PSP_EepromWrite8(cpuaddr MemoryAddress, uint8 ByteValue); + +/*--------------------------------------------------------------------------------------*/ +/** + * @brief Write two bytes (uint16Value) to EEPROM address MemoryAddress + * + * @param[out] MemoryAddress Memory address to write to + * @param[in] uint16Value Value to write to memory + * + * @retval CFE_PSP_SUCCESS on success + * @retval CFE_PSP_ERROR_TIMEOUT write operation did not go through after a specific timeout. + * @retval CFE_PSP_ERROR_ADDRESS_MISALIGNED if the address is not aligned to a 16-bit addressing scheme. + * @retval CFE_PSP_ERROR_NOT_IMPLEMENTED if not implemented + */ int32 CFE_PSP_EepromWrite16(cpuaddr MemoryAddress, uint16 uint16Value); + +/*--------------------------------------------------------------------------------------*/ +/** + * @brief Write four bytes (uint32Value) to EEPROM address MemoryAddress + * + * @param[out] MemoryAddress Memory address to write to + * @param[in] uint32Value Value to write to memory + * + * @retval CFE_PSP_SUCCESS on success + * @retval CFE_PSP_ERROR_TIMEOUT write operation did not go through after a specific timeout. + * @retval CFE_PSP_ERROR_ADDRESS_MISALIGNED if the address is not aligned to a 16-bit addressing scheme. + * @retval CFE_PSP_ERROR_NOT_IMPLEMENTED if not implemented + */ int32 CFE_PSP_EepromWrite32(cpuaddr MemoryAddress, uint32 uint32Value); +/*--------------------------------------------------------------------------------------*/ +/** + * @brief Enable the EEPROM for write operation + * + * @param[in] Bank The bank of EEPROM to enable + * + * @retval CFE_PSP_SUCCESS on success + * @retval CFE_PSP_ERROR_NOT_IMPLEMENTED if not implemented + */ int32 CFE_PSP_EepromWriteEnable(uint32 Bank); + +/*--------------------------------------------------------------------------------------*/ +/** + * @brief Disable the EEPROM from write operation + * + * @param[in] Bank The bank of EEPROM to disable + * + * @retval CFE_PSP_SUCCESS on success + * @retval CFE_PSP_ERROR_NOT_IMPLEMENTED if not implemented + */ int32 CFE_PSP_EepromWriteDisable(uint32 Bank); + +/*--------------------------------------------------------------------------------------*/ +/** + * @brief Power up the EEPROM + * + * @param[in] Bank The bank of EEPROM to power up + * + * @retval CFE_PSP_SUCCESS on success + * @retval CFE_PSP_ERROR_NOT_IMPLEMENTED if not implemented + */ int32 CFE_PSP_EepromPowerUp(uint32 Bank); + +/*--------------------------------------------------------------------------------------*/ +/** + * @brief Power down the EEPROM + * + * @param[in] Bank The bank of EEPROM to power down + * + * @retval CFE_PSP_SUCCESS on success + * @retval CFE_PSP_ERROR_NOT_IMPLEMENTED if not implemented + */ int32 CFE_PSP_EepromPowerDown(uint32 Bank); +/*--------------------------------------------------------------------------------------*/ /** - * \brief Obtain the PSP version/baseline identifier string + * @brief Obtain the PSP version/baseline identifier string * * This retrieves the PSP version identifier string without extra info * - * \returns Version string. This is a fixed string and cannot be NULL. + * @return Version string. This is a fixed string and cannot be NULL. */ const char *CFE_PSP_GetVersionString(void); +/*--------------------------------------------------------------------------------------*/ /** - * \brief Obtain the version code name + * @brief Obtain the version code name * - * This retrieves the PSP code name. This is a compatibility indicator for the - * overall NASA CFS ecosystem. All modular components which are intended to + * This retrieves the PSP code name. This is a compatibility indicator for the + * overall NASA cFS ecosystem. All modular components which are intended to * interoperate should report the same code name. * - * \returns Code name. This is a fixed string and cannot be NULL. + * @return Code name. This is a fixed string and cannot be NULL. */ const char *CFE_PSP_GetVersionCodeName(void); +/*--------------------------------------------------------------------------------------*/ /** - * \brief Obtain the PSP numeric version numbers as uint8 values - * - * This retrieves the numeric PSP version identifier as an array of 4 uint8 values. + * @brief Retrieves the numeric PSP version identifier as an array of uint8 values * * The array of numeric values is in order of precedence: * [0] = Major Number @@ -450,21 +947,23 @@ const char *CFE_PSP_GetVersionCodeName(void); * 1-254 local patch level (reserved for mission use) * 255 indicates a development build * - * \param[out] VersionNumbers A fixed-size array to be filled with the version numbers + * @param[out] VersionNumbers A fixed-size array to be filled with the version numbers */ void CFE_PSP_GetVersionNumber(uint8 VersionNumbers[4]); +/*--------------------------------------------------------------------------------------*/ /** - * \brief Obtain the PSP library numeric build number + * @brief Obtain the PSP library numeric build number * * The build number is a monotonically increasing number that (coarsely) - * reflects the number of commits/changes that have been merged since the - * epoch release. During development cycles this number should increase - * after each subsequent merge/modification. + * reflects the number of commits/changes that have been merged since the epoch + * release. During development cycles this number should increase after each + * subsequent merge/modification. * - * Like other version information, this is a fixed number assigned at compile time. + * Like other version information, this is a fixed number assigned at compile + * time. * - * \returns The OSAL library build number + * @return The OSAL library build number */ uint32 CFE_PSP_GetBuildNumber(void); diff --git a/fsw/mcp750-vxworks/src/cfe_psp_exception.c b/fsw/mcp750-vxworks/src/cfe_psp_exception.c index 1c641b46..d23b632a 100644 --- a/fsw/mcp750-vxworks/src/cfe_psp_exception.c +++ b/fsw/mcp750-vxworks/src/cfe_psp_exception.c @@ -152,13 +152,12 @@ void CFE_PSP_ExceptionHook(TASK_ID task_id, int vector, void *vpEsf) } } -/* -** -** Purpose: This function sets a default exception environment that can be used -** -** Notes: The exception environment is local to each task Therefore this must be -** called for each task that that wants to do floating point and catch exceptions -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ void CFE_PSP_SetDefaultExceptionEnvironment(void) { vxMsrSet(vxMsrGet() | _PPC_MSR_EE | /* enable the external interrupt */ diff --git a/fsw/mcp750-vxworks/src/cfe_psp_memory.c b/fsw/mcp750-vxworks/src/cfe_psp_memory.c index 648a917f..f326f00a 100644 --- a/fsw/mcp750-vxworks/src/cfe_psp_memory.c +++ b/fsw/mcp750-vxworks/src/cfe_psp_memory.c @@ -538,4 +538,4 @@ int32 CFE_PSP_GetCFETextSegmentInfo(cpuaddr *PtrToCFESegment, uint32 *SizeOfCFES } return return_code; -} +} \ No newline at end of file diff --git a/fsw/mcp750-vxworks/src/cfe_psp_ssr.c b/fsw/mcp750-vxworks/src/cfe_psp_ssr.c index 2b8c14be..30e2f263 100644 --- a/fsw/mcp750-vxworks/src/cfe_psp_ssr.c +++ b/fsw/mcp750-vxworks/src/cfe_psp_ssr.c @@ -60,20 +60,12 @@ #include "cfe_psp.h" #include "cfe_psp_memory.h" -/****************************************************************************** -** -** Purpose: -** Initializes the Solid State Recorder device. For the MCP750, this simply -** initializes the Hard disk device. - -** -** Arguments: -** bus, device, device name -** -** Return: -** (none) -*/ - +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ int32 CFE_PSP_InitSSR(uint32 bus, uint32 device, char *DeviceName) { int32 ReturnCode; diff --git a/fsw/mcp750-vxworks/src/cfe_psp_support.c b/fsw/mcp750-vxworks/src/cfe_psp_support.c index b912c94c..43977eeb 100644 --- a/fsw/mcp750-vxworks/src/cfe_psp_support.c +++ b/fsw/mcp750-vxworks/src/cfe_psp_support.c @@ -71,18 +71,12 @@ */ extern CFE_PSP_MemoryBlock_t MCP750_ReservedMemBlock; -/****************************************************************************** -** -** Purpose: -** Provides a common interface to the processor reset. -** -** Arguments: -** reset_type : Type of reset. -** -** Return: -** (none) -*/ - +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ void CFE_PSP_Restart(uint32 reset_type) { if (reset_type == CFE_PSP_RST_TYPE_POWERON) @@ -99,38 +93,24 @@ void CFE_PSP_Restart(uint32 reset_type) } } -/****************************************************************************** -** -** Purpose: -** Provides a common interface to abort the cFE startup process and return -** back to the OS. -** -** Arguments: -** ErrorCode : Reason for Exiting. -** -** Return: -** (none) -*/ - +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ 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("%s called with error code = 0x%08X. Exiting.\n", __func__, (unsigned int)ErrorCode); + exit(EXIT_FAILURE); } -/****************************************************************************** -** -** Purpose: -** Provides a common interface to flush the processor caches. This routine -** is in the BSP because it is sometimes implemented in hardware and -** sometimes taken care of by the RTOS. -** -** Arguments: -** -** Return: -** (none) -*/ - +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ void CFE_PSP_FlushCaches(uint32 type, void *address, uint32 size) { if (type == 1) @@ -139,60 +119,34 @@ void CFE_PSP_FlushCaches(uint32 type, void *address, uint32 size) } } -/* -** -** Purpose: -** return the processor ID. -** -** -** Parameters: -** -** Global Inputs: None -** -** Global Outputs: None -** -** -** -** Return Values: Processor ID -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ uint32 CFE_PSP_GetProcessorId(void) { return CFE_PSP_CPU_ID; } -/* -** -** Purpose: -** return the spacecraft ID. -** -** Parameters: -** -** Global Inputs: None -** -** Global Outputs: None -** -** -** Return Values: Spacecraft ID -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ uint32 CFE_PSP_GetSpacecraftId(void) { return CFE_PSP_SPACECRAFT_ID; } -/* -** -** Purpose: -** return the processor name. -** -** Parameters: -** -** Global Inputs: None -** -** Global Outputs: None -** -** -** Return Values: Processor name -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ const char *CFE_PSP_GetProcessorName(void) { return CFE_PSP_CPU_NAME; diff --git a/fsw/mcp750-vxworks/src/cfe_psp_watchdog.c b/fsw/mcp750-vxworks/src/cfe_psp_watchdog.c index 8129c865..6cee24a1 100644 --- a/fsw/mcp750-vxworks/src/cfe_psp_watchdog.c +++ b/fsw/mcp750-vxworks/src/cfe_psp_watchdog.c @@ -72,15 +72,12 @@ */ uint32 CFE_PSP_WatchdogValue = CFE_PSP_WATCHDOG_MAX; -/****************************************************************************** -** -** Purpose: -** To setup the timer resolution and/or other settings custom to this platform. -** -** Arguments: -** -** Return: -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ void CFE_PSP_WatchdogInit(void) { /* @@ -91,15 +88,12 @@ void CFE_PSP_WatchdogInit(void) CFE_PSP_WatchdogValue = CFE_PSP_WATCHDOG_MAX; } -/****************************************************************************** -** -** Purpose: -** Enable the watchdog timer -** -** Arguments: -** -** Return: -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ void CFE_PSP_WatchdogEnable(void) { /* Arm the WDT2 control register */ @@ -109,15 +103,12 @@ void CFE_PSP_WatchdogEnable(void) PCI_OUT_LONG(0xFEFF0068, 0xFFFFFFAA); } -/****************************************************************************** -** -** Purpose: -** Disable the watchdog timer -** -** Arguments: -** -** Return: -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ void CFE_PSP_WatchdogDisable(void) { /* Arm the WDT2 control register */ @@ -127,23 +118,12 @@ void CFE_PSP_WatchdogDisable(void) PCI_OUT_LONG(0xFEFF0068, 0xFFFF7FAA); } -/****************************************************************************** -** -** Purpose: -** Load the watchdog timer with a count that corresponds to the millisecond -** time given in the parameter. -** -** Arguments: -** None. -** -** Return: -** None -** -** Note: -** Currently an ExpireTime value of zero will result in the minimum reset time -** of 4.5 seconds. All other ExpireTime values will result in a reset time of -** 5.5 seconds. See comments below. -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ void CFE_PSP_WatchdogService(void) { /* Arm the WDT2 control register */ @@ -171,39 +151,23 @@ void CFE_PSP_WatchdogService(void) } } -/****************************************************************************** -** -** Purpose: -** Get the current watchdog value. -** -** Arguments: -** none -** -** Return: -** the current watchdog value -** -** Notes: -** -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ uint32 CFE_PSP_WatchdogGet(void) { return CFE_PSP_WatchdogValue; } -/****************************************************************************** -** -** Purpose: -** Get the current watchdog value. -** -** Arguments: -** The new watchdog value -** -** Return: -** nothing -** -** Notes: -** -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ void CFE_PSP_WatchdogSet(uint32 WatchdogValue) { CFE_PSP_WatchdogValue = WatchdogValue; diff --git a/fsw/modules/eeprom_direct/cfe_psp_eeprom_direct.c b/fsw/modules/eeprom_direct/cfe_psp_eeprom_direct.c index a1406d86..5a3740ec 100644 --- a/fsw/modules/eeprom_direct/cfe_psp_eeprom_direct.c +++ b/fsw/modules/eeprom_direct/cfe_psp_eeprom_direct.c @@ -50,26 +50,12 @@ void eeprom_direct_Init(uint32 PspModuleId) ** global memory */ -/* - ** - ** Purpose: - ** - ** Assumptions and Notes: - ** - ** Parameters: - ** - ** Global Inputs: None - ** - ** Global Outputs: None - ** - ** - ** Return Values: - ** CFE_PSP_SUCCESS - ** CFE_PSP_ERROR_TIMEOUT write operation did not go through after a specific - ** timeout. - ** CFE_PSP_ERROR_ADD_MISALIGNED The Address is not aligned to 16 bit addressing - ** scheme. - */ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ int32 CFE_PSP_EepromWrite32(cpuaddr MemoryAddress, uint32 uint32Value) { uint32 ret_value = CFE_PSP_SUCCESS; @@ -86,26 +72,12 @@ int32 CFE_PSP_EepromWrite32(cpuaddr MemoryAddress, uint32 uint32Value) return ret_value; } -/* - ** - ** Purpose: - ** - ** Assumptions and Notes: - ** - ** Parameters: - ** - ** Global Inputs: None - ** - ** Global Outputs: None - ** - ** - ** Return Values: - ** CFE_PSP_SUCCESS - ** CFE_PSP_ERROR_TIMEOUT write operation did not go through after a specific - ** timeout. - ** CFE_PSP_ERROR_ADD_MISALIGNED The Address is not aligned to 16 bit addressing - ** scheme. - */ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ int32 CFE_PSP_EepromWrite16(cpuaddr MemoryAddress, uint16 uint16Value) { uint32 write32; @@ -180,25 +152,12 @@ int32 CFE_PSP_EepromWrite16(cpuaddr MemoryAddress, uint16 uint16Value) return CFE_PSP_EepromWrite32(aligned_address, write32); } -/* - ** - ** Purpose: - ** - ** Assumptions and Notes: - ** - ** Parameters: - ** - ** Global Inputs: None - ** - ** Global Outputs: None - ** - ** - ** Return Values: - ** CFE_PSP_SUCCESS - ** CFE_PSP_ERROR_TIMEOUT write operation did not go through after a specific - ** timeout. - */ - +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ int32 CFE_PSP_EepromWrite8(cpuaddr MemoryAddress, uint8 ByteValue) { uint32 aligned_address; @@ -264,91 +223,45 @@ int32 CFE_PSP_EepromWrite8(cpuaddr MemoryAddress, uint8 ByteValue) return CFE_PSP_EepromWrite16(aligned_address, write16); } -/* -** -** Purpose: -** Enable the eeprom for write operation -** -** Assumptions and Notes: -** -** Parameters: -** Bank: Which bank of EEPROM -** -** Global Inputs: None -** -** Global Outputs: None -** -** -** Return Values: -** CFE_PSP_SUCCESS -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ int32 CFE_PSP_EepromWriteEnable(uint32 Bank) { return CFE_PSP_SUCCESS; } -/* -** -** Purpose: -** Disable the eeprom from write operation -** -** Assumptions and Notes: -** -** Parameters: -** Bank: Which bank of EEPROM -** -** Global Inputs: None -** -** Global Outputs: None -** -** -** Return Values: -** CFE_PSP_SUCCESS -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ int32 CFE_PSP_EepromWriteDisable(uint32 Bank) { return CFE_PSP_SUCCESS; } -/* -** -** Purpose: -** Power up the eeprom -** Assumptions and Notes: -** -** Parameters: -** Bank: Which bank of EEPROM -** -** Global Inputs: None -** -** Global Outputs: None -** -** -** Return Values: -** CFE_PSP_SUCCESS -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ int32 CFE_PSP_EepromPowerUp(uint32 Bank) { return CFE_PSP_SUCCESS; } -/* -** -** Purpose: -** Power down the eeprom -** Assumptions and Notes: -** -** Parameters: -** Bank: Which bank of EEPROM -** -** Global Inputs: None -** -** Global Outputs: None -** -** -** Return Values: -** CFE_PSP_SUCCESS -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ int32 CFE_PSP_EepromPowerDown(uint32 Bank) { return CFE_PSP_SUCCESS; diff --git a/fsw/modules/port_direct/cfe_psp_port_direct.c b/fsw/modules/port_direct/cfe_psp_port_direct.c index 147af09e..61af2c31 100644 --- a/fsw/modules/port_direct/cfe_psp_port_direct.c +++ b/fsw/modules/port_direct/cfe_psp_port_direct.c @@ -38,25 +38,12 @@ void port_direct_Init(uint32 PspModuleId) ** global memory */ -/* -** -** Purpose: -** Read one byte of memory. -** -** -** Parameters: -** PortAddress : Address to be read -** ByteValue : The address content will be copied to the location pointed by -** this argument -** -** Global Inputs: None -** -** Global Outputs: None -** -** -** -** Return Values: CFE_PSP_SUCCESS -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ int32 CFE_PSP_PortRead8(cpuaddr PortAddress, uint8 *ByteValue) { (*ByteValue) = (uint8) * ((uint8 *)PortAddress); @@ -64,54 +51,24 @@ int32 CFE_PSP_PortRead8(cpuaddr PortAddress, uint8 *ByteValue) return CFE_PSP_SUCCESS; } -/* -** -** Purpose: -** Write one byte of memory. -** -** -** Parameters: -** PortAddress : Address to be written to -** ByteValue : The content pointed by this argument will be copied to the -** address -** -** Global Inputs: None -** -** Global Outputs: None -** -** -** -** Return Values: -** CFE_PSP_SUCCESS -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ int32 CFE_PSP_PortWrite8(cpuaddr PortAddress, uint8 ByteValue) { *((uint8 *)PortAddress) = ByteValue; return CFE_PSP_SUCCESS; } -/* -** -** Purpose: -** Read 2 bytes of memory. -** -** -** Parameters: -** PortAddress : Address to be read -** uint16Value : The address content will be copied to the location pointed by -** this argument -** -** Global Inputs: None -** -** Global Outputs: None -** -** -** -** Return Values: -** CFE_PSP_SUCCESS -** CFE_PSP_ERROR_ADD_MISALIGNED The Address is not aligned to 16 bit -** addressing scheme. -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ int32 CFE_PSP_PortRead16(cpuaddr PortAddress, uint16 *uint16Value) { /* check 16 bit alignment , check the 1st lsb */ @@ -123,28 +80,12 @@ int32 CFE_PSP_PortRead16(cpuaddr PortAddress, uint16 *uint16Value) return CFE_PSP_SUCCESS; } -/* -** -** Purpose: -** Write 2 byte of memory. -** -** -** Parameters: -** PortAddress : Address to be written to -** uint16Value : The content pointed by this argument will be copied to the -** address -** -** Global Inputs: None -** -** Global Outputs: None -** -** -** -** Return Values: -** CFE_PSP_SUCCESS -** CFE_PSP_ERROR_ADD_MISALIGNED The Address is not aligned to 16 bit -** addressing scheme. -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ int32 CFE_PSP_PortWrite16(cpuaddr PortAddress, uint16 uint16Value) { /* check 16 bit alignment , check the 1st lsb */ @@ -156,28 +97,12 @@ int32 CFE_PSP_PortWrite16(cpuaddr PortAddress, uint16 uint16Value) return CFE_PSP_SUCCESS; } -/* -** -** Purpose: -** Read 4 bytes of memory. -** -** -** Parameters: -** PortAddress : Address to be read -** uint32Value : The address content will be copied to the location pointed by -** this argument -** -** Global Inputs: None -** -** Global Outputs: None -** -** -** -** Return Values: -** CFE_PSP_SUCCESS -** CFE_PSP_ERROR_ADD_MISALIGNED The Address is not aligned to 16 bit -** addressing scheme. -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ int32 CFE_PSP_PortRead32(cpuaddr PortAddress, uint32 *uint32Value) { /* check 32 bit alignment */ @@ -189,28 +114,12 @@ int32 CFE_PSP_PortRead32(cpuaddr PortAddress, uint32 *uint32Value) return CFE_PSP_SUCCESS; } -/* -** -** Purpose: -** Write 4 byte of memory. -** -** -** Parameters: -** PortAddress : Address to be written to -** uint32Value : The content pointed by this argument will be copied to the -** address -** -** Global Inputs: None -** -** Global Outputs: None -** -** -** -** Return Values: -** CFE_PSP_SUCCESS -** CFE_PSP_ERROR_ADD_MISALIGNED The Address is not aligned to 16 bit -** addressing scheme. -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ int32 CFE_PSP_PortWrite32(cpuaddr PortAddress, uint32 uint32Value) { /* check 32 bit alignment */ diff --git a/fsw/modules/ram_direct/cfe_psp_ram_direct.c b/fsw/modules/ram_direct/cfe_psp_ram_direct.c index e6abb08f..271ad6ba 100644 --- a/fsw/modules/ram_direct/cfe_psp_ram_direct.c +++ b/fsw/modules/ram_direct/cfe_psp_ram_direct.c @@ -38,24 +38,12 @@ void ram_direct_Init(uint32 PspModuleId) ** global memory */ -/* - ** - ** Purpose: - ** Read one byte of memory. - ** - ** - ** Parameters: - ** MemoryAddress : Address to be read - ** ByteValue : The address content will be copied to the location pointed by this argument - ** - ** Global Inputs: None - ** - ** Global Outputs: None - ** - ** - ** - ** Return Values: CFE_PSP_SUCCESS - */ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ int32 CFE_PSP_MemRead8(cpuaddr MemoryAddress, uint8 *ByteValue) { (*ByteValue) = *((uint8 *)MemoryAddress); @@ -63,53 +51,24 @@ int32 CFE_PSP_MemRead8(cpuaddr MemoryAddress, uint8 *ByteValue) return CFE_PSP_SUCCESS; } -/* - ** - ** Purpose: - ** Write one byte of memory. - ** - ** - ** Parameters: - ** MemoryAddress : Address to be written to - ** ByteValue : The content pointed by this argument will be copied to the address - ** - ** Global Inputs: None - ** - ** Global Outputs: None - ** - ** - ** - ** Return Values: - ** CFE_PSP_SUCCESS - */ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ int32 CFE_PSP_MemWrite8(cpuaddr MemoryAddress, uint8 ByteValue) { *((uint8 *)MemoryAddress) = ByteValue; return CFE_PSP_SUCCESS; } -/* - ** - ** Purpose: - ** Read 2 bytes of memory. - ** - ** - ** Parameters: - ** MemoryAddress : Address to be read - ** uint16Value : The address content will be copied to the location pointed by - ** this argument - ** - ** Global Inputs: None - ** - ** Global Outputs: None - ** - ** - ** - ** Return Values: - ** CFE_PSP_SUCCESS - ** CFE_PSP_ERROR_ADD_MISALIGNED The Address is not aligned to 16 bit - ** addressing scheme. - */ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ int32 CFE_PSP_MemRead16(cpuaddr MemoryAddress, uint16 *uint16Value) { /* check 16 bit alignment , check the 1st lsb */ @@ -121,28 +80,12 @@ int32 CFE_PSP_MemRead16(cpuaddr MemoryAddress, uint16 *uint16Value) return CFE_PSP_SUCCESS; } -/* - ** - ** Purpose: - ** Write 2 byte of memory. - ** - ** - ** Parameters: - ** MemoryAddress : Address to be written to - ** uint16Value : The content pointed by this argument will be copied to the - ** address - ** - ** Global Inputs: None - ** - ** Global Outputs: None - ** - ** - ** - ** Return Values: - ** CFE_PSP_SUCCESS - ** CFE_PSP_ERROR_ADD_MISALIGNED The MemoryAddress is not aligned to 16 bit - ** addressing scheme. - */ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ int32 CFE_PSP_MemWrite16(cpuaddr MemoryAddress, uint16 uint16Value) { /* check 16 bit alignment , check the 1st lsb */ @@ -154,28 +97,12 @@ int32 CFE_PSP_MemWrite16(cpuaddr MemoryAddress, uint16 uint16Value) return CFE_PSP_SUCCESS; } -/* - ** - ** Purpose: - ** Read 4 bytes of memory. - ** - ** - ** Parameters: - ** MemoryAddress : Address to be read - ** uint32Value : The address content will be copied to the location pointed by - ** this argument - ** - ** Global Inputs: None - ** - ** Global Outputs: None - ** - ** - ** - ** Return Values: - ** CFE_PSP_SUCCESS - ** CFE_PSP_ERROR_ADD_MISALIGNED The Address is not aligned to 16 bit - ** addressing scheme. - */ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ int32 CFE_PSP_MemRead32(cpuaddr MemoryAddress, uint32 *uint32Value) { /* check 32 bit alignment */ @@ -188,28 +115,12 @@ int32 CFE_PSP_MemRead32(cpuaddr MemoryAddress, uint32 *uint32Value) return CFE_PSP_SUCCESS; } -/* - ** - ** Purpose: - ** Write 4 byte of memory. - ** - ** - ** Parameters: - ** MemoryAddress : Address to be written to - ** uint32Value : The content pointed by this argument will be copied to the - ** address - ** - ** Global Inputs: None - ** - ** Global Outputs: None - ** - ** - ** - ** Return Values: - ** CFE_PSP_SUCCESS - ** CFE_PSP_ERROR_ADD_MISALIGNED The Address is not aligned to 16 bit - ** addressing scheme. - */ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ int32 CFE_PSP_MemWrite32(cpuaddr MemoryAddress, uint32 uint32Value) { /* check 32 bit alignment */ diff --git a/fsw/modules/timebase_posix_clock/cfe_psp_timebase_posix_clock.c b/fsw/modules/timebase_posix_clock/cfe_psp_timebase_posix_clock.c index 5c679889..b17f100a 100644 --- a/fsw/modules/timebase_posix_clock/cfe_psp_timebase_posix_clock.c +++ b/fsw/modules/timebase_posix_clock/cfe_psp_timebase_posix_clock.c @@ -115,41 +115,24 @@ void CFE_PSP_GetTime(OS_time_t *LocalTime) *LocalTime = OS_TimeAssembleFromNanoseconds(now.tv_sec, now.tv_nsec); } -/****************************************************************************** -** -** Purpose: -** Provides the 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 -** -** Arguments: -** -** Return: -** The number of timer ticks per second of the time stamp returned -** by CFE_PSP_Get_Timebase -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ uint32 CFE_PSP_GetTimerTicksPerSecond(void) { /* POSIX "struct timespec" resolution is defined as nanoseconds */ return 1000000000; } -/****************************************************************************** -** -** Purpose: -** Provides 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. -** -** Arguments: -** -** Return: -** The number that the least significant 32 bits of the 64 bit time stamp -** returned by CFE_PSP_Get_Timebase rolls over. -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ uint32 CFE_PSP_GetTimerLow32Rollover(void) { /* POSIX "struct timespec" resolution is defined as nanoseconds */ diff --git a/fsw/modules/timebase_vxworks/cfe_psp_timebase_vxworks.c b/fsw/modules/timebase_vxworks/cfe_psp_timebase_vxworks.c index fa0d3190..056b490e 100644 --- a/fsw/modules/timebase_vxworks/cfe_psp_timebase_vxworks.c +++ b/fsw/modules/timebase_vxworks/cfe_psp_timebase_vxworks.c @@ -143,57 +143,34 @@ void timebase_vxworks_Init(uint32 PspModuleId) PSP_VxWorks_Timebase_Global.TicksPerSecond = TicksPerSec & 0xFFFFFFFF; } -/****************************************************************************** -** -** Purpose: -** Provides the 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 -** -** Arguments: -** -** Return: -** The number of timer ticks per second of the time stamp returned -** by CFE_PSP_Get_Timebase -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ uint32 CFE_PSP_GetTimerTicksPerSecond(void) { return PSP_VxWorks_Timebase_Global.TicksPerSecond; } -/****************************************************************************** -** -** Purpose: -** Provides 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. -** -** Arguments: -** -** Return: -** The number that the least significant 32 bits of the 64 bit time stamp -** returned by CFE_PSP_Get_Timebase rolls over. -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ uint32 CFE_PSP_GetTimerLow32Rollover(void) { return 0; } -/****************************************************************************** -** -** Purpose: -** Provides a common interface to system timebase. This routine -** is in the BSP because it is sometimes implemented in hardware and -** sometimes taken care of by the RTOS. -** -** Arguments: -** -** Return: -** Timebase register value -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ void CFE_PSP_Get_Timebase(uint32 *Tbu, uint32 *Tbl) { vxTimeBaseGet((UINT32 *)Tbu, (UINT32 *)Tbl); diff --git a/fsw/pc-linux/src/cfe_psp_exception.c b/fsw/pc-linux/src/cfe_psp_exception.c index 7f7b6847..61276229 100644 --- a/fsw/pc-linux/src/cfe_psp_exception.c +++ b/fsw/pc-linux/src/cfe_psp_exception.c @@ -208,7 +208,7 @@ void CFE_PSP_AttachExceptions(void) */ backtrace(Addr, 1); - OS_printf("CFE_PSP: CFE_PSP_AttachExceptions Called\n"); + OS_printf("CFE_PSP: %s called\n", __func__); /* * Block most other signals during handler execution. @@ -244,14 +244,12 @@ void CFE_PSP_AttachExceptions(void) CFE_PSP_Exception_Reset(); } -/* -** -** Purpose: This function sets a default exception environment that can be used -** -** Notes: The exception environment is local to each task Therefore this must be -** called for each task that that wants to do floating point and catch exceptions -*/ - +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ void CFE_PSP_SetDefaultExceptionEnvironment(void) { /* diff --git a/fsw/pc-linux/src/cfe_psp_memory.c b/fsw/pc-linux/src/cfe_psp_memory.c index 11168fcb..5fcbdc7a 100644 --- a/fsw/pc-linux/src/cfe_psp_memory.c +++ b/fsw/pc-linux/src/cfe_psp_memory.c @@ -194,18 +194,12 @@ void CFE_PSP_DeleteCDS(void) } } -/****************************************************************************** -** -** Purpose: -** This function fetches the size of the OS Critical Data Store area. -** -** Arguments: -** (none) -** -** Return: -** (none) -*/ - +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ int32 CFE_PSP_GetCDSSize(uint32 *SizeOfCDS) { int32 return_code; @@ -223,18 +217,12 @@ int32 CFE_PSP_GetCDSSize(uint32 *SizeOfCDS) return return_code; } -/****************************************************************************** -** -** Purpose: -** This function writes to the CDS Block. -** -** Arguments: -** (none) -** -** Return: -** (none) -*/ - +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ int32 CFE_PSP_WriteToCDS(const void *PtrToDataToWrite, uint32 CDSOffset, uint32 NumBytes) { uint8 *CopyPtr; @@ -264,18 +252,12 @@ int32 CFE_PSP_WriteToCDS(const void *PtrToDataToWrite, uint32 CDSOffset, uint32 return return_code; } -/****************************************************************************** -** -** Purpose: -** This function reads from the CDS Block -** -** Arguments: -** (none) -** -** Return: -** (none) -*/ - +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ int32 CFE_PSP_ReadFromCDS(void *PtrToDataToRead, uint32 CDSOffset, uint32 NumBytes) { uint8 *CopyPtr; @@ -411,21 +393,12 @@ void CFE_PSP_DeleteResetArea(void) } } -/* - */ -/****************************************************************************** -** -** 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 -** ER Log, System Log and reset related variables -** -** Arguments: -** (none) -** -** Return: -** (none) -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ int32 CFE_PSP_GetResetArea(cpuaddr *PtrToResetArea, uint32 *SizeOfResetArea) { int32 return_code; @@ -526,18 +499,12 @@ void CFE_PSP_DeleteUserReservedArea(void) } } -/****************************************************************************** -** -** Purpose: -** This function returns the location and size of the memory used for the cFE -** User reserved area. -** -** Arguments: -** (none) -** -** Return: -** (none) -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ int32 CFE_PSP_GetUserReservedArea(cpuaddr *PtrToUserArea, uint32 *SizeOfUserArea) { int32 return_code; @@ -583,18 +550,12 @@ void CFE_PSP_InitVolatileDiskMem(void) */ } -/****************************************************************************** -** -** Purpose: -** This function returns the location and size of the memory used for the cFE -** volatile disk. -** -** Arguments: -** (none) -** -** Return: -** (none) -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ int32 CFE_PSP_GetVolatileDiskMem(cpuaddr *PtrToVolDisk, uint32 *SizeOfVolDisk) { int32 return_code; @@ -743,18 +704,12 @@ void CFE_PSP_DeleteProcessorReservedMemory(void) ********************************************************************************* */ -/****************************************************************************** -** -** Purpose: -** This function returns the start and end address of the kernel text segment. -** It may not be implemented on all architectures. -** -** Arguments: -** (none) -** -** Return: -** (none) -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ int32 CFE_PSP_GetKernelTextSegmentInfo(cpuaddr *PtrToKernelSegment, uint32 *SizeOfKernelSegment) { /* Check pointers */ @@ -770,18 +725,12 @@ int32 CFE_PSP_GetKernelTextSegmentInfo(cpuaddr *PtrToKernelSegment, uint32 *Size return CFE_PSP_ERROR_NOT_IMPLEMENTED; } -/****************************************************************************** -** -** Purpose: -** This function returns the start and end address of the CFE text segment. -** It may not be implemented on all architectures. -** -** Arguments: -** (none) -** -** Return: -** (none) -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ int32 CFE_PSP_GetCFETextSegmentInfo(cpuaddr *PtrToCFESegment, uint32 *SizeOfCFESegment) { int32 return_code; diff --git a/fsw/pc-linux/src/cfe_psp_ssr.c b/fsw/pc-linux/src/cfe_psp_ssr.c index 3f282dfb..ae4bec3d 100644 --- a/fsw/pc-linux/src/cfe_psp_ssr.c +++ b/fsw/pc-linux/src/cfe_psp_ssr.c @@ -48,18 +48,12 @@ #include #include -/****************************************************************************** -** -** Purpose: -** Initializes the Solid State Recorder device. This can be filled in for the platform. -** -** Arguments: -** bus, device, device name -** -** Return: -** (none) -*/ - +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ int32 CFE_PSP_InitSSR(uint32 bus, uint32 device, char *DeviceName) { int32 Status; diff --git a/fsw/pc-linux/src/cfe_psp_start.c b/fsw/pc-linux/src/cfe_psp_start.c index 71e83b48..2141aa9d 100644 --- a/fsw/pc-linux/src/cfe_psp_start.c +++ b/fsw/pc-linux/src/cfe_psp_start.c @@ -531,7 +531,7 @@ void CFE_PSP_DisplayUsage(char *Name) printf(" %s --reset PO --subtype 1 --cpuid 1 --cpuname CPU1 --scid 32\n", Name); printf(" \n"); - exit(1); + exit(EXIT_FAILURE); } /****************************************************************************** diff --git a/fsw/pc-linux/src/cfe_psp_support.c b/fsw/pc-linux/src/cfe_psp_support.c index 59e39da5..0fa3b0f8 100644 --- a/fsw/pc-linux/src/cfe_psp_support.c +++ b/fsw/pc-linux/src/cfe_psp_support.c @@ -51,18 +51,12 @@ extern uint32 CFE_PSP_SpacecraftId; extern uint32 CFE_PSP_CpuId; extern char CFE_PSP_CpuName[]; -/****************************************************************************** -** -** Purpose: -** Provides a common interface to the processor reset. -** -** Arguments: -** reset_type : Type of reset. -** -** Return: -** (none) -*/ - +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ void CFE_PSP_Restart(uint32 reset_type) { if (reset_type == CFE_PSP_RST_TYPE_POWERON) @@ -113,97 +107,58 @@ void CFE_PSP_Restart(uint32 reset_type) abort(); } -/****************************************************************************** -** -** Purpose: -** Provides a common interface to abort the cFE startup process and return -** back to the OS. -** -** Arguments: -** ErrorCode : Reason for Exiting. -** -** Return: -** (none) -*/ - +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ void CFE_PSP_Panic(int32 ErrorCode) { - OS_printf("CFE_PSP_Panic Called with error code = 0x%08X. Exiting.\n", (unsigned int)ErrorCode); + OS_printf("%s called with error code = 0x%08X. Exiting.\n", __func__, (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 */ + abort(); /* abort() is preferable to exit(EXIT_FAILURE), as it may create a core file for debug */ } -/****************************************************************************** -** -** Purpose: -** Provides a common interface to flush the processor caches. This routine -** is in the BSP because it is sometimes implemented in hardware and -** sometimes taken care of by the RTOS. -** -** Arguments: -** -** Return: -** (none) -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ void CFE_PSP_FlushCaches(uint32 type, void *address, uint32 size) { - printf("CFE_PSP_FlushCaches called -- Currently no Linux/OSX/Cygwin implementation\n"); + printf("%s called -- Currently no Linux/OSX/Cygwin implementation\n", __func__); } -/* -** -** Purpose: -** return the processor ID. -** -** -** Parameters: -** -** Global Inputs: None -** -** Global Outputs: None -** -** -** -** Return Values: Processor ID -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ uint32 CFE_PSP_GetProcessorId(void) { return CFE_PSP_CpuId; } -/* -** -** Purpose: -** return the spacecraft ID. -** -** Parameters: -** -** Global Inputs: None -** -** Global Outputs: None -** -** -** Return Values: Spacecraft ID -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ uint32 CFE_PSP_GetSpacecraftId(void) { return CFE_PSP_SpacecraftId; } -/* -** -** Purpose: -** return the processor name. -** -** Parameters: -** -** Global Inputs: None -** -** Global Outputs: None -** -** -** Return Values: Processor name -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ const char *CFE_PSP_GetProcessorName(void) { return CFE_PSP_CpuName; diff --git a/fsw/pc-linux/src/cfe_psp_watchdog.c b/fsw/pc-linux/src/cfe_psp_watchdog.c index 767a78a3..d7872b1f 100644 --- a/fsw/pc-linux/src/cfe_psp_watchdog.c +++ b/fsw/pc-linux/src/cfe_psp_watchdog.c @@ -60,15 +60,12 @@ */ uint32 CFE_PSP_WatchdogValue = CFE_PSP_WATCHDOG_MAX; -/* -** -** Purpose: -** To setup the timer resolution and/or other settings custom to this platform. -** -** Arguments: -** -** Return: -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ void CFE_PSP_WatchdogInit(void) { /* @@ -79,78 +76,47 @@ void CFE_PSP_WatchdogInit(void) CFE_PSP_WatchdogValue = CFE_PSP_WATCHDOG_MAX; } -/****************************************************************************** -** -** Purpose: -** Enable the watchdog timer -** -** Arguments: -** -** Return: -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ void CFE_PSP_WatchdogEnable(void) {} -/****************************************************************************** -** -** Purpose: -** Disable the watchdog timer -** -** Arguments: -** -** Return: -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ void CFE_PSP_WatchdogDisable(void) {} -/****************************************************************************** -** -** Purpose: -** Load the watchdog timer with a count that corresponds to the millisecond -** time given in the parameter. -** -** Arguments: -** None. -** -** Return: -** None -** -** Notes: -** -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ void CFE_PSP_WatchdogService(void) {} -/****************************************************************************** -** -** Purpose: -** Get the current watchdog value. -** -** Arguments: -** none -** -** Return: -** the current watchdog value -** -** Notes: -** -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ uint32 CFE_PSP_WatchdogGet(void) { return CFE_PSP_WatchdogValue; } -/****************************************************************************** -** -** Purpose: -** Get the current watchdog value. -** -** Arguments: -** The new watchdog value -** -** Return: -** nothing -** -** Notes: -** -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ void CFE_PSP_WatchdogSet(uint32 WatchdogValue) { CFE_PSP_WatchdogValue = WatchdogValue; diff --git a/fsw/pc-rtems/src/cfe_psp_exception.c b/fsw/pc-rtems/src/cfe_psp_exception.c index eaa46e1c..49228e20 100644 --- a/fsw/pc-rtems/src/cfe_psp_exception.c +++ b/fsw/pc-rtems/src/cfe_psp_exception.c @@ -65,7 +65,7 @@ */ void CFE_PSP_AttachExceptions(void) { - OS_printf("CFE_PSP: CFE_PSP_AttachExceptions Called\n"); + OS_printf("CFE_PSP: %s called\n", __func__); CFE_PSP_Exception_Reset(); } @@ -78,11 +78,10 @@ int32 CFE_PSP_ExceptionGetSummary_Impl(const CFE_PSP_Exception_LogData_t *Buffer return CFE_PSP_ERROR_NOT_IMPLEMENTED; } -/* -** -** Purpose: This function sets a default exception environment that can be used -** -** Notes: The exception environment is local to each task Therefore this must be -** called for each task that that wants to do floating point and catch exceptions -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ void CFE_PSP_SetDefaultExceptionEnvironment(void) {} diff --git a/fsw/pc-rtems/src/cfe_psp_memory.c b/fsw/pc-rtems/src/cfe_psp_memory.c index ec259cb0..e8bb018c 100644 --- a/fsw/pc-rtems/src/cfe_psp_memory.c +++ b/fsw/pc-rtems/src/cfe_psp_memory.c @@ -93,18 +93,12 @@ CFE_PSP_MemoryBlock_t PcRtems_ReservedMemBlock; ********************************************************************************* */ -/****************************************************************************** -** -** Purpose: -** This function fetches the size of the OS Critical Data Store area. -** -** Arguments: -** (none) -** -** Return: -** (none) -*/ - +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ int32 CFE_PSP_GetCDSSize(uint32 *SizeOfCDS) { int32 return_code; @@ -121,17 +115,12 @@ int32 CFE_PSP_GetCDSSize(uint32 *SizeOfCDS) return return_code; } -/****************************************************************************** -** -** Purpose: -** This function writes to the CDS Block. -** -** Arguments: -** (none) -** -** Return: -** (none) -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ int32 CFE_PSP_WriteToCDS(const void *PtrToDataToWrite, uint32 CDSOffset, uint32 NumBytes) { uint8 *CopyPtr; @@ -162,18 +151,12 @@ int32 CFE_PSP_WriteToCDS(const void *PtrToDataToWrite, uint32 CDSOffset, uint32 return return_code; } -/****************************************************************************** -** -** Purpose: -** This function reads from the CDS Block -** -** Arguments: -** (none) -** -** Return: -** (none) -*/ - +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ int32 CFE_PSP_ReadFromCDS(void *PtrToDataToRead, uint32 CDSOffset, uint32 NumBytes) { uint8 *CopyPtr; @@ -210,19 +193,12 @@ int32 CFE_PSP_ReadFromCDS(void *PtrToDataToRead, uint32 CDSOffset, uint32 NumByt ********************************************************************************* */ -/****************************************************************************** -** -** 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 -** ER Log, System Log and reset related variables -** -** Arguments: -** (none) -** -** Return: -** (none) -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ int32 CFE_PSP_GetResetArea(cpuaddr *PtrToResetArea, uint32 *SizeOfResetArea) { int32 return_code; @@ -247,18 +223,12 @@ int32 CFE_PSP_GetResetArea(cpuaddr *PtrToResetArea, uint32 *SizeOfResetArea) ********************************************************************************* */ -/****************************************************************************** -** -** Purpose: -** This function returns the location and size of the memory used for the cFE -** User reserved area. -** -** Arguments: -** (none) -** -** Return: -** (none) -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ int32 CFE_PSP_GetUserReservedArea(cpuaddr *PtrToUserArea, uint32 *SizeOfUserArea) { int32 return_code; @@ -283,18 +253,12 @@ int32 CFE_PSP_GetUserReservedArea(cpuaddr *PtrToUserArea, uint32 *SizeOfUserArea ********************************************************************************* */ -/****************************************************************************** -** -** Purpose: -** This function returns the location and size of the memory used for the cFE -** volatile disk. -** -** Arguments: -** (none) -** -** Return: -** (none) -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ int32 CFE_PSP_GetVolatileDiskMem(cpuaddr *PtrToVolDisk, uint32 *SizeOfVolDisk) { int32 return_code; @@ -442,18 +406,12 @@ int32 CFE_PSP_InitProcessorReservedMemory(uint32 RestartType) ********************************************************************************* */ -/****************************************************************************** -** -** Purpose: -** This function returns the start and end address of the kernel text segment. -** It may not be implemented on all architectures. -** -** Arguments: -** (none) -** -** Return: -** (none) -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ int32 CFE_PSP_GetKernelTextSegmentInfo(cpuaddr *PtrToKernelSegment, uint32 *SizeOfKernelSegment) { int32 return_code; @@ -483,18 +441,12 @@ int32 CFE_PSP_GetKernelTextSegmentInfo(cpuaddr *PtrToKernelSegment, uint32 *Size return return_code; } -/****************************************************************************** -** -** Purpose: -** This function returns the start and end address of the CFE text segment. -** It may not be implemented on all architectures. -** -** Arguments: -** (none) -** -** Return: -** (none) -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ int32 CFE_PSP_GetCFETextSegmentInfo(cpuaddr *PtrToCFESegment, uint32 *SizeOfCFESegment) { int32 return_code; diff --git a/fsw/pc-rtems/src/cfe_psp_ssr.c b/fsw/pc-rtems/src/cfe_psp_ssr.c index d9074feb..d0ac00b3 100644 --- a/fsw/pc-rtems/src/cfe_psp_ssr.c +++ b/fsw/pc-rtems/src/cfe_psp_ssr.c @@ -47,20 +47,12 @@ #include "cfe_psp.h" #include "cfe_psp_memory.h" -/****************************************************************************** -** -** Purpose: -** Initializes the Solid State Recorder device. Dummy function for this -** platform. -** -** -** Arguments: -** bus, device, device name -** -** Return: -** (none) -*/ - +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ int32 CFE_PSP_InitSSR(uint32 bus, uint32 device, char *DeviceName) { int32 ReturnCode; diff --git a/fsw/pc-rtems/src/cfe_psp_start.c b/fsw/pc-rtems/src/cfe_psp_start.c index 369cb671..a1ea66cb 100644 --- a/fsw/pc-rtems/src/cfe_psp_start.c +++ b/fsw/pc-rtems/src/cfe_psp_start.c @@ -36,8 +36,6 @@ #include #include -extern int rtems_fxp_attach(struct rtems_bsdnet_ifconfig *config, int attaching); - /* ** cFE includes */ @@ -145,7 +143,7 @@ void OS_Application_Startup(void) { if (CFE_PSP_Setup() != RTEMS_SUCCESSFUL) { - CFE_PSP_Panic(CFE_PSP_ERROR); + CFE_PSP_Panic(CFE_PSP_ERROR); /* Unreachable currently - CFE_PSP_Setup always returns RTEMS_SUCCESSFUL */ } /* diff --git a/fsw/pc-rtems/src/cfe_psp_support.c b/fsw/pc-rtems/src/cfe_psp_support.c index b72bc0d4..642ce8b3 100644 --- a/fsw/pc-rtems/src/cfe_psp_support.c +++ b/fsw/pc-rtems/src/cfe_psp_support.c @@ -65,57 +65,37 @@ */ extern CFE_PSP_MemoryBlock_t PcRtems_ReservedMemBlock; -/****************************************************************************** -** -** Purpose: -** Provides a common interface to the processor reset. -** -** Arguments: -** reset_type : Type of reset. -** -** Return: -** (none) -*/ - +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ 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); + OS_printf("%s is not implemented on this platform ( yet ! )\n", __func__); + exit(EXIT_FAILURE); } -/****************************************************************************** -** -** Purpose: -** Provides a common interface to abort the cFE startup process and return -** back to the OS. -** -** Arguments: -** ErrorCode : Reason for Exiting. -** -** Return: -** (none) -*/ - +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ void CFE_PSP_Panic(int32 ErrorCode) { - printf("CFE_PSP_Panic Called with error code = 0x%08X. Exiting.\n", (unsigned int)ErrorCode); + printf("%s called with error code = 0x%08X. Exiting.\n", __func__, (unsigned int)ErrorCode); OS_ApplicationExit(ErrorCode); } -/****************************************************************************** -** -** Purpose: -** Provides a common interface to flush the processor caches. This routine -** is in the BSP because it is sometimes implemented in hardware and -** sometimes taken care of by the RTOS. -** -** Arguments: -** -** Return: -** (none) -*/ - +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ void CFE_PSP_FlushCaches(uint32 type, void *address, uint32 size) { if (type == 1) @@ -124,60 +104,34 @@ void CFE_PSP_FlushCaches(uint32 type, void *address, uint32 size) } } -/* -** -** Purpose: -** return the processor ID. -** -** -** Parameters: -** -** Global Inputs: None -** -** Global Outputs: None -** -** -** -** Return Values: Processor ID -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ uint32 CFE_PSP_GetProcessorId(void) { return CFE_PSP_CPU_ID; } -/* -** -** Purpose: -** return the spacecraft ID. -** -** Parameters: -** -** Global Inputs: None -** -** Global Outputs: None -** -** -** Return Values: Spacecraft ID -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ uint32 CFE_PSP_GetSpacecraftId(void) { return CFE_PSP_SPACECRAFT_ID; } -/* -** -** Purpose: -** return the processor name. -** -** Parameters: -** -** Global Inputs: None -** -** Global Outputs: None -** -** -** Return Values: Processor name -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ const char *CFE_PSP_GetProcessorName(void) { return CFE_PSP_CPU_NAME; diff --git a/fsw/pc-rtems/src/cfe_psp_watchdog.c b/fsw/pc-rtems/src/cfe_psp_watchdog.c index ade64472..4afac615 100644 --- a/fsw/pc-rtems/src/cfe_psp_watchdog.c +++ b/fsw/pc-rtems/src/cfe_psp_watchdog.c @@ -60,15 +60,12 @@ */ uint32 CFE_PSP_WatchdogValue = 0; -/* -** -** Purpose: -** To setup the timer resolution and/or other settings custom to this platform. -** -** Arguments: -** -** Return: -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ void CFE_PSP_WatchdogInit(void) { /* @@ -79,78 +76,47 @@ void CFE_PSP_WatchdogInit(void) CFE_PSP_WatchdogValue = CFE_PSP_WATCHDOG_MAX; } -/****************************************************************************** -** -** Purpose: -** Enable the watchdog timer -** -** Arguments: -** -** Return: -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ void CFE_PSP_WatchdogEnable(void) {} -/****************************************************************************** -** -** Purpose: -** Disable the watchdog timer -** -** Arguments: -** -** Return: -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ void CFE_PSP_WatchdogDisable(void) {} -/****************************************************************************** -** -** Purpose: -** Load the watchdog timer with a count that corresponds to the millisecond -** time given in the parameter. -** -** Arguments: -** None. -** -** Return: -** None -** -** Notes: -** -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ void CFE_PSP_WatchdogService(void) {} -/****************************************************************************** -** -** Purpose: -** Get the current watchdog value. -** -** Arguments: -** none -** -** Return: -** the current watchdog value -** -** Notes: -** -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ uint32 CFE_PSP_WatchdogGet(void) { return CFE_PSP_WatchdogValue; } -/****************************************************************************** -** -** Purpose: -** Get the current watchdog value. -** -** Arguments: -** The new watchdog value -** -** Return: -** nothing -** -** Notes: -** -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ void CFE_PSP_WatchdogSet(uint32 WatchdogValue) { CFE_PSP_WatchdogValue = WatchdogValue; diff --git a/fsw/shared/src/cfe_psp_exceptionstorage.c b/fsw/shared/src/cfe_psp_exceptionstorage.c index b6843935..fea838ff 100644 --- a/fsw/shared/src/cfe_psp_exceptionstorage.c +++ b/fsw/shared/src/cfe_psp_exceptionstorage.c @@ -137,20 +137,24 @@ void CFE_PSP_Exception_WriteComplete(void) ** (Functions used by CFE or PSP) ***************************************************************************/ -/*--------------------------------------------------------------------------- - * CFE_PSP_Exception_GetCount - * See description in PSP API - *---------------------------------------------------------------------------*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ uint32 CFE_PSP_Exception_GetCount(void) { return (CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr->NumWritten - CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr->NumRead); } -/*--------------------------------------------------------------------------- - * CFE_PSP_Exception_GetSummary - * See description in PSP API - *---------------------------------------------------------------------------*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ int32 CFE_PSP_Exception_GetSummary(uint32 *ContextLogId, osal_id_t *TaskId, char *ReasonBuf, uint32 ReasonSize) { const CFE_PSP_Exception_LogData_t *Buffer; @@ -210,10 +214,12 @@ int32 CFE_PSP_Exception_GetSummary(uint32 *ContextLogId, osal_id_t *TaskId, char return CFE_PSP_SUCCESS; } -/*--------------------------------------------------------------------------- - * CFE_PSP_Exception_CopyContext - * See description in PSP API - *---------------------------------------------------------------------------*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ int32 CFE_PSP_Exception_CopyContext(uint32 ContextLogId, void *ContextBuf, uint32 ContextSize) { const CFE_PSP_Exception_LogData_t *Buffer; diff --git a/fsw/shared/src/cfe_psp_memrange.c b/fsw/shared/src/cfe_psp_memrange.c index b628845d..870f34cb 100644 --- a/fsw/shared/src/cfe_psp_memrange.c +++ b/fsw/shared/src/cfe_psp_memrange.c @@ -35,31 +35,12 @@ #include "cfe_psp.h" #include "cfe_psp_memory.h" -/* -** -** Purpose: -** Validate the memory range and type using the global CFE_PSP_MemoryTable -** -** Assumptions and Notes: -** -** 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: -** CFE_PSP_MEM_RAM, CFE_PSP_MEM_EEPROM, or CFE_PSP_MEM_ANY -** Any defined CFE_PSP_MEM_* enumeration can be specified -** -** Global Inputs: None -** -** Global Outputs: None -** -** Return Values: -** CFE_PSP_SUCCESS -- Memory range and type information is valid and can be used. -** CFE_PSP_INVALID_MEM_ADDR -- Starting address is not valid -** CFE_PSP_INVALID_MEM_TYPE -- Memory type associated with the range does not match the passed in type. -** CFE_PSP_INVALID_MEM_RANGE -- The Memory range associated with the address is not large enough to contain -** Address + Size. -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ int32 CFE_PSP_MemValidateRange(cpuaddr Address, size_t Size, uint32 MemoryType) { cpuaddr StartAddressToTest = Address; @@ -152,63 +133,23 @@ int32 CFE_PSP_MemValidateRange(cpuaddr Address, size_t Size, uint32 MemoryType) return ReturnCode; } -/* -** -** Purpose: -** Return the number of memory ranges in the CFE_PSP_MemoryTable -** -** Assumptions and Notes: -** -** Parameters: -** None -** -** Global Inputs: None -** -** Global Outputs: None -** -** Return Values: -** Positive integer number of entries in the memory range table -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ uint32 CFE_PSP_MemRanges(void) { return CFE_PSP_MEM_TABLE_SIZE; } -/* -** -** Purpose: -** This function populates one of the records in the CFE_PSP_MemoryTable. -** -** 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. -** -** 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 -** Any defined CFE_PSP_MEM_* enumeration can be specified -** Address -- A 32 bit starting address of the memory range -** Size -- A 32 bit size of the memory range ( Address + Size = End Address ) -** WordSize -- The minimum addressable size of the range: -** ( CFE_PSP_MEM_SIZE_BYTE, CFE_PSP_MEM_SIZE_WORD, CFE_PSP_MEM_SIZE_DWORD ) -** Attributes -- The attributes of the Memory Range: -** (CFE_PSP_MEM_ATTR_WRITE, CFE_PSP_MEM_ATTR_READ, CFE_PSP_MEM_ATTR_READWRITE) -** -** Global Inputs: Reads CFE_PSP_MemoryTable -** -** Global Outputs: Changes CFE_PSP_MemoryTable -** -** Return Values: -** CFE_PSP_SUCCESS -- Memory range set successfully. -** CFE_PSP_INVALID_MEM_RANGE -- The index into the table is invalid -** CFE_PSP_INVALID_MEM_ADDR -- Starting address is not valid -** CFE_PSP_INVALID_MEM_TYPE -- Memory type associated with the range does not match the passed in type. -** OP_INVALID_MEM_SIZE -- The Memory range associated with the address is not large enough to contain -** Address + Size. -** 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. -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ int32 CFE_PSP_MemRangeSet(uint32 RangeNum, uint32 MemoryType, cpuaddr StartAddr, size_t Size, size_t WordSize, uint32 Attributes) { @@ -250,36 +191,12 @@ int32 CFE_PSP_MemRangeSet(uint32 RangeNum, uint32 MemoryType, cpuaddr StartAddr, return CFE_PSP_SUCCESS; } -/* -** -** Purpose: -** This function retrieves one of the records in the CFE_PSP_MemoryTable. -** -** Assumptions and Notes: -** Because the table is fixed size, the entries are accessed by using the integer index. -** -** 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 -** is stored. -** *WordSize -- A pointer to the 32 bit integer where the minimum addressable size of the range: -** ( CFE_PSP_MEM_SIZE_BYTE, CFE_PSP_MEM_SIZE_WORD, CFE_PSP_MEM_SIZE_DWORD ) -** Attributes -- The attributes of the Memory Range: -** (CFE_PSP_MEM_ATTR_WRITE, CFE_PSP_MEM_ATTR_READ, CFE_PSP_MEM_ATTR_READWRITE) -** -** Global Inputs: Reads CFE_PSP_MemoryTable -** -** Global Outputs: Changes CFE_PSP_MemoryTable -** -** Return Values: -** CFE_PSP_SUCCESS -- Memory range returned successfully. -** CFE_PSP_INVALID_POINTER -- Parameter error -** CFE_PSP_INVALID_MEM_RANGE -- The index into the table is invalid -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ int32 CFE_PSP_MemRangeGet(uint32 RangeNum, uint32 *MemoryType, cpuaddr *StartAddr, size_t *Size, size_t *WordSize, uint32 *Attributes) { diff --git a/fsw/shared/src/cfe_psp_memutils.c b/fsw/shared/src/cfe_psp_memutils.c index 32ffd654..97c2b289 100644 --- a/fsw/shared/src/cfe_psp_memutils.c +++ b/fsw/shared/src/cfe_psp_memutils.c @@ -45,56 +45,24 @@ ** global memory */ -/* -** -** Purpose: -** Copies 'size' byte from memory address pointed by 'src' to memory -** address pointed by ' dst' For now we are using the standard c library -** call 'memcpy' but if we find we need to make it more efficient then -** we'll implement it in assembly. -** -** Assumptions and Notes: -** -** Parameters: -** dst : pointer to an address to copy to -** src : pointer address to copy from -** -** Global Inputs: None -** -** Global Outputs: None -** -** -** Return Values: CFE_PSP_SUCCESS -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ int32 CFE_PSP_MemCpy(void *dst, const void *src, uint32 size) { memcpy(dst, src, size); return CFE_PSP_SUCCESS; } -/* -** -** Purpose: -** Copies 'size' number of byte of value 'value' to memory address pointed -** by 'dst' .For now we are using the standard c library call 'memset' -** but if we find we need to make it more efficient then we'll implement -** it in assembly. -** -** -** Assumptions and Notes: -** -** Parameters: -** -** Global Inputs: None -** -** Global Outputs: None -** -** -** Return Values: CFE_PSP_SUCCESS -*/ -/* -** CFE_PSP_MemSet -*/ +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ int32 CFE_PSP_MemSet(void *dst, uint8 value, uint32 size) { memset(dst, (int)value, (size_t)size); diff --git a/unit-test-coverage/CMakeLists.txt b/unit-test-coverage/CMakeLists.txt index 447d1484..bf7e05d7 100644 --- a/unit-test-coverage/CMakeLists.txt +++ b/unit-test-coverage/CMakeLists.txt @@ -13,15 +13,14 @@ project(PSPCOVERAGE C) -# Currently only mcp750-vxworks is implemented a demonstration of how this works. -set(PSPCOVERAGE_TARGETS "mcp750-vxworks" CACHE STRING "PSP target(s) to build coverage tests for (default=all)") +set(PSPCOVERAGE_TARGETS mcp750-vxworks pc-rtems CACHE STRING "PSP target(s) to build coverage tests for (default=all)") # Check that coverage has been implemented for this PSPTYPE foreach(PSPTYPE ${PSPCOVERAGE_TARGETS}) if (NOT IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${PSPTYPE}) message(FATAL_ERROR "No coverage tests implemented for ${PSPTYPE}") - endif (NOT IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${PSPTYPE}) -endforeach(PSPTYPE ${PSPCOVERAGE_TARGETS}) + endif () +endforeach() message(STATUS "PSP Coverage Test Targets: ${PSPCOVERAGE_TARGETS}") @@ -35,5 +34,5 @@ add_subdirectory(modules) # Build targets for each of the indicated PSPs foreach(SETNAME ${PSPCOVERAGE_TARGETS}) add_subdirectory(${SETNAME}) -endforeach(SETNAME ${PSPCOVERAGE_TARGETS}) +endforeach() diff --git a/unit-test-coverage/mcp750-vxworks/adaptors/CMakeLists.txt b/unit-test-coverage/mcp750-vxworks/adaptors/CMakeLists.txt index 1a3feee6..bbc2c766 100644 --- a/unit-test-coverage/mcp750-vxworks/adaptors/CMakeLists.txt +++ b/unit-test-coverage/mcp750-vxworks/adaptors/CMakeLists.txt @@ -1,5 +1,5 @@ # "Adaptors" help enable the unit test code to reach functions/objects that -# are otherwise not exposed. +# are otherwise not exposed. # NOTE: These source files are compiled with OVERRIDES on the headers just like # the FSW code is compiled. This is how it is able to include internal headers @@ -21,7 +21,7 @@ target_include_directories(ut-adaptor-${CFE_PSP_TARGETNAME} PUBLIC ${PSPCOVERAGE_SOURCE_DIR}/shared/adaptors/inc ) -target_link_libraries(ut-adaptor-${CFE_PSP_TARGETNAME} PRIVATE +target_link_libraries(ut-adaptor-${CFE_PSP_TARGETNAME} PRIVATE psp_module_api - ut_assert + ut_assert ) 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 7ded8d9d..2968cf6c 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 @@ -92,7 +92,7 @@ void Test_CFE_PSP_GetProcessorId(void) { /* * Test Case For: - * uint32 CFE_PSP_GetProcessorId (void) + * uint32 CFE_PSP_GetProcessorId (void) */ /* @@ -106,7 +106,7 @@ void Test_CFE_PSP_GetSpacecraftId(void) { /* * Test Case For: - * uint32 CFE_PSP_GetSpacecraftId (void) + * uint32 CFE_PSP_GetSpacecraftId (void) */ /* diff --git a/unit-test-coverage/modules/CMakeLists.txt b/unit-test-coverage/modules/CMakeLists.txt index 9e6eb640..1745fd94 100644 --- a/unit-test-coverage/modules/CMakeLists.txt +++ b/unit-test-coverage/modules/CMakeLists.txt @@ -61,7 +61,7 @@ function(add_psp_covtest MODULE_NAME TESTCASE_SRC UT_SRCS) install(TARGETS ${RUNNER_TARGET} DESTINATION ${TGT}/${UT_INSTALL_SUBDIR}) endforeach() -endfunction(add_psp_covtest) +endfunction() # a list of modules for which there is a coverage test implemented diff --git a/unit-test-coverage/pc-rtems/CMakeLists.txt b/unit-test-coverage/pc-rtems/CMakeLists.txt new file mode 100644 index 00000000..4029bd0f --- /dev/null +++ b/unit-test-coverage/pc-rtems/CMakeLists.txt @@ -0,0 +1,50 @@ +###################################################################### +# +# CMake build recipe for pc-rtems PSP white-box coverage tests +# +###################################################################### + +include_directories(${CFEPSP_SOURCE_DIR}/fsw/pc-rtems/inc) +include_directories(${PSPCOVERAGE_SOURCE_DIR}/shared/inc) + +# Target names use a "ut" prefix to avoid confusion with the FSW targets +set(CFE_PSP_TARGETNAME "ut-${SETNAME}") +add_subdirectory(${CFEPSP_SOURCE_DIR}/fsw/${SETNAME} ${CFE_PSP_TARGETNAME}-impl) +add_subdirectory(${CFEPSP_SOURCE_DIR}/fsw/shared ${CFE_PSP_TARGETNAME}-shared) + +# The UT assert library defines OS_Application_Startup, so this redefines ours with a "UT_" prefix +target_compile_definitions(psp-${CFE_PSP_TARGETNAME}-impl PRIVATE + OS_Application_Startup=UT_OS_Application_Startup +) + +foreach(TGT psp-${CFE_PSP_TARGETNAME}-impl psp-${CFE_PSP_TARGETNAME}-shared) + target_compile_options(${TGT} PRIVATE ${UT_COVERAGE_COMPILE_FLAGS}) + target_include_directories(${TGT} BEFORE PRIVATE ${PSPCOVERAGE_SOURCE_DIR}/ut-stubs/override_inc) +endforeach() + +add_executable(coverage-${CFE_PSP_TARGETNAME}-testrunner + src/coveragetest-cfe-psp-exception.c + src/coveragetest-cfe-psp-memory.c + src/coveragetest-cfe-psp-ssr.c + src/coveragetest-cfe-psp-start.c + src/coveragetest-cfe-psp-support.c + src/coveragetest-cfe-psp-watchdog.c + src/coveragetest-psp-pc-rtems.c + $ + $ +) + +target_link_libraries(coverage-${CFE_PSP_TARGETNAME}-testrunner PUBLIC + ${UT_COVERAGE_LINK_FLAGS} + psp_module_api + ut_psp_cfe_stubs + ut_psp_libc_stubs + ut_osapi_stubs + ut_assert +) + +add_test(coverage-${CFE_PSP_TARGETNAME} coverage-${CFE_PSP_TARGETNAME}-testrunner) + +foreach(TGT ${INSTALL_TARGET_LIST}) + install(TARGETS coverage-${CFE_PSP_TARGETNAME}-testrunner DESTINATION ${TGT}/${UT_INSTALL_SUBDIR}) +endforeach() diff --git a/unit-test-coverage/pc-rtems/src/coveragetest-cfe-psp-exception.c b/unit-test-coverage/pc-rtems/src/coveragetest-cfe-psp-exception.c new file mode 100644 index 00000000..edd82b3b --- /dev/null +++ b/unit-test-coverage/pc-rtems/src/coveragetest-cfe-psp-exception.c @@ -0,0 +1,51 @@ +/************************************************************************ + * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * + * Copyright (c) 2020 United States Government as represented by the + * Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ************************************************************************/ + +#include "coveragetest-psp-pc-rtems.h" + +#include "cfe_psp.h" +#include "PCS_stdlib.h" + +extern int32 CFE_PSP_ExceptionGetSummary_Impl(void *, char *, uint32); +extern void CFE_PSP_SetupReservedMemoryMap(void); + +uint32 UT_AttachExceptionsBuffer[1024]; + +void Test_CFE_PSP_AttachExceptions(void) +{ + /* Need to call CFE_PSP_SetupReservedMemoryMap here for initialization of CFE_PSP_ReservedMemoryMap */ + UT_SetDataBuffer(UT_KEY(PCS_malloc), UT_AttachExceptionsBuffer, sizeof(UT_AttachExceptionsBuffer), false); + CFE_PSP_SetupReservedMemoryMap(); + UT_ResetState(UT_KEY(OS_printf)); /* Reset so calls to OS_printf in the setup above don't affect the actual test */ + + /* Nominal path */ + CFE_PSP_AttachExceptions(); + UtAssert_STUB_COUNT(OS_printf, 1); +} + +void Test_CFE_PSP_ExceptionGetSummary_Impl(void) +{ + /* Placeholder test to exercise function - amend tests if/when function is fully implemented */ + UtAssert_INT32_EQ(CFE_PSP_ExceptionGetSummary_Impl(NULL, NULL, 4), CFE_PSP_ERROR_NOT_IMPLEMENTED); +} + +void Test_CFE_PSP_SetDefaultExceptionEnvironment(void) +{ + /* Placeholder test to exercise function - amend tests if/when function is fully implemented */ + CFE_PSP_SetDefaultExceptionEnvironment(); +} diff --git a/unit-test-coverage/pc-rtems/src/coveragetest-cfe-psp-memory.c b/unit-test-coverage/pc-rtems/src/coveragetest-cfe-psp-memory.c new file mode 100644 index 00000000..75db7adf --- /dev/null +++ b/unit-test-coverage/pc-rtems/src/coveragetest-cfe-psp-memory.c @@ -0,0 +1,143 @@ +/************************************************************************ + * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * + * Copyright (c) 2020 United States Government as represented by the + * Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ************************************************************************/ + +#include "coveragetest-psp-pc-rtems.h" + +#include "cfe_psp.h" +#include "PCS_stdlib.h" + +extern int32 CFE_PSP_InitProcessorReservedMemory(uint32 ResetType); +extern void CFE_PSP_SetupReservedMemoryMap(void); + +/* Blocks of 'heap' memory for emulated calls to malloc (via PCS_malloc) in the tests */ +uint32 UT_MemoryMapBuffer[1024]; +uint32 UT_TooSmallMemoryMapBuffer[1]; + +void Test_CFE_PSP_GetCDSSize(void) +{ + uint32 SizeOfCDS; + + /* Test NULL pointer guard */ + UtAssert_INT32_EQ(CFE_PSP_GetCDSSize(NULL), OS_ERROR); + + /* Nominal/success path */ + UtAssert_INT32_EQ(CFE_PSP_GetCDSSize(&SizeOfCDS), OS_SUCCESS); +} + +void Test_CFE_PSP_WriteToCDS(void) +{ + uint32 CDSOffset = 8; + uint32 NumBytes = 8; + + /* Test NULL pointer guard */ + UtAssert_INT32_EQ(CFE_PSP_WriteToCDS(NULL, CDSOffset, NumBytes), OS_ERROR); +} + +void Test_CFE_PSP_ReadFromCDS(void) +{ + uint32 CDSOffset = 8; + uint32 NumBytes = 8; + + /* Test NULL pointer guard */ + UtAssert_INT32_EQ(CFE_PSP_ReadFromCDS(NULL, CDSOffset, NumBytes), OS_ERROR); +} + +void Test_CFE_PSP_GetResetArea(void) +{ + cpuaddr PtrToResetArea; + uint32 SizeOfResetArea; + + /* Test both NULL pointer guards */ + UtAssert_INT32_EQ(CFE_PSP_GetResetArea(NULL, &SizeOfResetArea), OS_ERROR); + UtAssert_INT32_EQ(CFE_PSP_GetResetArea(&PtrToResetArea, NULL), OS_ERROR); + + /* Nominal/success path */ + UtAssert_INT32_EQ(CFE_PSP_GetResetArea(&PtrToResetArea, &SizeOfResetArea), OS_SUCCESS); +} + +void Test_CFE_PSP_GetUserReservedArea(void) +{ + cpuaddr PtrToUserArea; + uint32 SizeOfUserArea; + + /* Test both NULL pointer guards */ + UtAssert_INT32_EQ(CFE_PSP_GetUserReservedArea(NULL, &SizeOfUserArea), OS_ERROR); + UtAssert_INT32_EQ(CFE_PSP_GetUserReservedArea(&PtrToUserArea, NULL), OS_ERROR); + + /* Nominal/success path */ + UtAssert_INT32_EQ(CFE_PSP_GetUserReservedArea(&PtrToUserArea, &SizeOfUserArea), OS_SUCCESS); +} + +void Test_CFE_PSP_GetVolatileDiskMem(void) +{ + cpuaddr PtrToVolDisk; + uint32 SizeOfVolDisk; + + /* Test both NULL pointer guards */ + UtAssert_INT32_EQ(CFE_PSP_GetVolatileDiskMem(NULL, &SizeOfVolDisk), OS_ERROR); + UtAssert_INT32_EQ(CFE_PSP_GetVolatileDiskMem(&PtrToVolDisk, NULL), OS_ERROR); + + /* Nominal/success path */ + UtAssert_INT32_EQ(CFE_PSP_GetVolatileDiskMem(&PtrToVolDisk, &SizeOfVolDisk), OS_SUCCESS); +} + +void Test_CFE_PSP_SetupReservedMemoryMap(void) +{ + /* Test NULL ReservedMemBlock.BlockPtr path and early abort due to failure of malloc with a too-small heap */ + UT_SetDataBuffer(UT_KEY(PCS_malloc), UT_TooSmallMemoryMapBuffer, sizeof(UT_TooSmallMemoryMapBuffer), false); + CFE_PSP_SetupReservedMemoryMap(); + UtAssert_STUB_COUNT(PCS_abort, 1); + UT_ResetState(UT_KEY(PCS_malloc)); /* Reset so cleared for next test */ + UT_ResetState(UT_KEY(OS_printf)); /* Reset so cleared for next test */ + + /* Nominal/success path with sufficiently sized 'heap' for emulated call to malloc */ + UT_SetDataBuffer(UT_KEY(PCS_malloc), UT_MemoryMapBuffer, sizeof(UT_MemoryMapBuffer), false); + CFE_PSP_SetupReservedMemoryMap(); + UtAssert_STUB_COUNT(OS_printf, 3); /* 3 calls to OS_printf along nominal path in CFE_PSP_SetupReservedMemoryMap */ +} + +void Test_CFE_PSP_InitProcessorReservedMemory(void) +{ + /* Always returns CFE_PSP_SUCCESS */ + UtAssert_INT32_EQ(CFE_PSP_InitProcessorReservedMemory(CFE_PSP_RST_TYPE_POWERON), CFE_PSP_SUCCESS); +} + +void Test_CFE_PSP_GetKernelTextSegmentInfo(void) +{ + cpuaddr PtrToKernelSegment; + uint32 SizeOfKernelSegment; + + /* Test both NULL pointer guards */ + UtAssert_INT32_EQ(CFE_PSP_GetKernelTextSegmentInfo(NULL, &SizeOfKernelSegment), OS_ERROR); + UtAssert_INT32_EQ(CFE_PSP_GetKernelTextSegmentInfo(&PtrToKernelSegment, NULL), OS_ERROR); + + /* Nominal/success path */ + UtAssert_INT32_EQ(CFE_PSP_GetKernelTextSegmentInfo(&PtrToKernelSegment, &SizeOfKernelSegment), OS_SUCCESS); +} + +void Test_CFE_PSP_GetCFETextSegmentInfo(void) +{ + cpuaddr PtrToCFESegment; + uint32 SizeOfCFESegment; + + /* Test NULL pointer guard */ + UtAssert_INT32_EQ(CFE_PSP_GetCFETextSegmentInfo(&PtrToCFESegment, NULL), OS_ERROR); + + /* Nominal/success path */ + UtAssert_INT32_EQ(CFE_PSP_GetCFETextSegmentInfo(&PtrToCFESegment, &SizeOfCFESegment), OS_SUCCESS); +} \ No newline at end of file diff --git a/unit-test-coverage/pc-rtems/src/coveragetest-cfe-psp-ssr.c b/unit-test-coverage/pc-rtems/src/coveragetest-cfe-psp-ssr.c new file mode 100644 index 00000000..c670c087 --- /dev/null +++ b/unit-test-coverage/pc-rtems/src/coveragetest-cfe-psp-ssr.c @@ -0,0 +1,31 @@ +/************************************************************************ + * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * + * Copyright (c) 2020 United States Government as represented by the + * Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ************************************************************************/ + +#include "coveragetest-psp-pc-rtems.h" + +#include "cfe_psp.h" + +void Test_CFE_PSP_InitSSR(void) +{ + uint32 bus = 1; + uint32 device = 1; + char DeviceName[] = "TestDevice"; + + /* Placeholder test to exercise function - amend tests if/when function is fully implemented */ + UtAssert_INT32_EQ(CFE_PSP_InitSSR(bus, device, DeviceName), CFE_PSP_SUCCESS); +} \ No newline at end of file diff --git a/unit-test-coverage/pc-rtems/src/coveragetest-cfe-psp-start.c b/unit-test-coverage/pc-rtems/src/coveragetest-cfe-psp-start.c new file mode 100644 index 00000000..ffa95577 --- /dev/null +++ b/unit-test-coverage/pc-rtems/src/coveragetest-cfe-psp-start.c @@ -0,0 +1,85 @@ +/************************************************************************ + * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * + * Copyright (c) 2020 United States Government as represented by the + * Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ************************************************************************/ + +#include "coveragetest-psp-pc-rtems.h" + +#include "cfe_psp.h" + +#include "PCS_rtems.h" +#include "PCS_bsdnet.h" +#include "PCS_stdlib.h" +#include "PCS_stdio.h" + +extern int CFE_PSP_Setup(void); + +/* NOTE: The UT assert library itself defines OS_Application_Startup. To avoid conflict with the UT assert, + * version, the unit under test is renamed to "UT_OS_Application_Startup" using a preprocessor definition. */ +extern void UT_OS_Application_Startup(void); + +/* Blocks of 'heap' memory for emulated calls to malloc (via PCS_malloc) in the tests */ +uint32 UT_StartupBuffer[1024]; +uint32 UT_MainBuffer[1024]; + +void Test_CFE_PSP_Setup(void) +{ + /* Nominal/Success path */ + UtAssert_INT32_EQ(CFE_PSP_Setup(), PCS_RTEMS_SUCCESSFUL); + + /* Test for printf due to error from rtems_bsdnet_initialize_network (function still returns RTEMS_SUCCESSFUL) */ + UT_SetDefaultReturnValue(UT_KEY(PCS_rtems_bsdnet_initialize_network), -1); + UtAssert_INT32_EQ(CFE_PSP_Setup(), PCS_RTEMS_SUCCESSFUL); + UtAssert_STUB_COUNT(PCS_printf, 1); +} + +void Test_OS_Application_Startup(void) +{ + /* Set up 'heap' buffer for emulated calls to malloc */ + UT_SetDataBuffer(UT_KEY(PCS_malloc), UT_StartupBuffer, sizeof(UT_StartupBuffer), false); + UT_OS_Application_Startup(); + UtAssert_STUB_COUNT(OS_API_Init, 1); /* Test for successful initialization (called by CFE_PSP_Main) */ + + /* Cannot test for failure of CFE_PSP_Setup (it always returns RTEMS_SUCCESSFUL in the current implementation - so + * this branch is unreachable) */ +} + +void Test_CFE_PSP_Main(void) +{ + /* Set up 'heap' buffer for emulated calls to malloc */ + UT_SetDataBuffer(UT_KEY(PCS_malloc), UT_MainBuffer, sizeof(UT_MainBuffer), false); + + /* Nominal/Success path */ + CFE_PSP_Main(); + UtAssert_STUB_COUNT(OS_API_Init, 1); + /* Expect 4 x OS_printf - 3 from CFE_PSP_SetupReservedMemoryMap and 1 from CFE_PSP_InitProcessorReservedMemory */ + UtAssert_STUB_COUNT(OS_printf, 4); + UT_ResetState(UT_KEY(OS_printf)); /* Reset so cleared for next test */ + + /* Error return from OS_API_Init */ + UT_SetDefaultReturnValue(UT_KEY(OS_API_Init), OS_ERROR); + CFE_PSP_Main(); + UtAssert_STUB_COUNT(OS_ApplicationExit, 1); + UT_ResetState(UT_KEY(OS_printf)); /* Reset so cleared for next test */ + + /* Error return from OS_FileSysAddFixedMap */ + UT_SetDefaultReturnValue(UT_KEY(OS_FileSysAddFixedMap), -1); + CFE_PSP_Main(); + /* Expect 5 total calls to OS_printf - 3 from CFE_PSP_SetupReservedMemoryMap, 1 from status check due to + * failure of OS_FileSysAddFixedMap, and 1 from CFE_PSP_InitProcessorReservedMemory */ + UtAssert_STUB_COUNT(OS_printf, 5); + UT_ResetState(UT_KEY(OS_printf)); /* Reset so cleared for future tests */ +} \ No newline at end of file diff --git a/unit-test-coverage/pc-rtems/src/coveragetest-cfe-psp-support.c b/unit-test-coverage/pc-rtems/src/coveragetest-cfe-psp-support.c new file mode 100644 index 00000000..f42e070b --- /dev/null +++ b/unit-test-coverage/pc-rtems/src/coveragetest-cfe-psp-support.c @@ -0,0 +1,63 @@ +/************************************************************************ + * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * + * Copyright (c) 2020 United States Government as represented by the + * Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ************************************************************************/ + +#include "cfe_psp.h" + +#include "coveragetest-psp-pc-rtems.h" + +#include "PCS_stdlib.h" +#include "PCS_cfe_configdata.h" + +void Test_CFE_PSP_Restart(void) +{ + CFE_PSP_Restart(CFE_PSP_RST_TYPE_PROCESSOR); + UtAssert_STUB_COUNT(PCS_exit, 1); + UT_ResetState(UT_KEY(PCS_exit)); /* Reset so cleared for next test */ + + CFE_PSP_Restart(CFE_PSP_RST_TYPE_POWERON); + UtAssert_STUB_COUNT(PCS_exit, 1); +} + +void Test_CFE_PSP_Panic(void) +{ + CFE_PSP_Panic(0); + UtAssert_STUB_COUNT(OS_ApplicationExit, 1); +} + +/* Placeholder coverage test */ +void Test_CFE_PSP_FlushCaches(void) +{ + CFE_PSP_FlushCaches(0, NULL, 0); + CFE_PSP_FlushCaches(1, NULL, 0); +} + +void Test_CFE_PSP_GetProcessorId(void) +{ + UtAssert_INT32_EQ(CFE_PSP_GetProcessorId(), PCS_CONFIG_CPUNUMBER); +} + +void Test_CFE_PSP_GetSpacecraftId(void) +{ + UtAssert_INT32_EQ(CFE_PSP_GetSpacecraftId(), PCS_CONFIG_SPACECRAFT); +} + +void Test_CFE_PSP_GetProcessorName(void) +{ + UtAssert_STRINGBUF_EQ(CFE_PSP_GetProcessorName(), UTASSERT_STRINGBUF_NULL_TERM, PCS_CONFIG_CPUNAME, + UTASSERT_STRINGBUF_NULL_TERM); +} \ No newline at end of file diff --git a/unit-test-coverage/pc-rtems/src/coveragetest-cfe-psp-watchdog.c b/unit-test-coverage/pc-rtems/src/coveragetest-cfe-psp-watchdog.c new file mode 100644 index 00000000..273019b8 --- /dev/null +++ b/unit-test-coverage/pc-rtems/src/coveragetest-cfe-psp-watchdog.c @@ -0,0 +1,60 @@ +/************************************************************************ + * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * + * Copyright (c) 2020 United States Government as represented by the + * Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ************************************************************************/ + +#include "coveragetest-psp-pc-rtems.h" + +#include "cfe_psp.h" + +extern uint32 CFE_PSP_WatchdogValue; + +/* Placeholder coverage test */ +void Test_CFE_PSP_WatchdogInit(void) +{ + CFE_PSP_WatchdogInit(); +} + +/* Placeholder coverage test */ +void Test_CFE_PSP_WatchdogEnable(void) +{ + CFE_PSP_WatchdogEnable(); +} + +/* Placeholder coverage test */ +void Test_CFE_PSP_WatchdogDisable(void) +{ + CFE_PSP_WatchdogDisable(); +} + +/* Placeholder coverage test */ +void Test_CFE_PSP_WatchdogService(void) +{ + CFE_PSP_WatchdogService(); +} + +void Test_CFE_PSP_WatchdogGet(void) +{ + UtAssert_INT32_EQ(CFE_PSP_WatchdogGet(), CFE_PSP_WatchdogValue); +} + +void Test_CFE_PSP_WatchdogSet(void) +{ + uint32 WatchdogValueToSet = 42; + + CFE_PSP_WatchdogSet(WatchdogValueToSet); + UtAssert_INT32_EQ(CFE_PSP_WatchdogValue, WatchdogValueToSet); +} diff --git a/unit-test-coverage/pc-rtems/src/coveragetest-psp-pc-rtems.c b/unit-test-coverage/pc-rtems/src/coveragetest-psp-pc-rtems.c new file mode 100644 index 00000000..e1be439a --- /dev/null +++ b/unit-test-coverage/pc-rtems/src/coveragetest-psp-pc-rtems.c @@ -0,0 +1,70 @@ +/************************************************************************ + * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * + * Copyright (c) 2020 United States Government as represented by the + * Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ************************************************************************/ + +#include "coveragetest-psp-pc-rtems.h" + +void Psp_Test_Setup(void) +{ + UT_ResetState(0); +} + +void Psp_Test_Teardown(void) {} + +void UtTest_Setup(void) +{ + /* Coverage test cases for cfs_psp_exception.c */ + ADD_TEST(CFE_PSP_AttachExceptions); + ADD_TEST(CFE_PSP_ExceptionGetSummary_Impl); + ADD_TEST(CFE_PSP_SetDefaultExceptionEnvironment); + + /* Coverage test cases for cfs_psp_memory.c */ + ADD_TEST(CFE_PSP_GetCDSSize); + ADD_TEST(CFE_PSP_WriteToCDS); + ADD_TEST(CFE_PSP_ReadFromCDS); + ADD_TEST(CFE_PSP_GetResetArea); + ADD_TEST(CFE_PSP_GetUserReservedArea); + ADD_TEST(CFE_PSP_GetVolatileDiskMem); + ADD_TEST(CFE_PSP_SetupReservedMemoryMap); + ADD_TEST(CFE_PSP_InitProcessorReservedMemory); + ADD_TEST(CFE_PSP_GetKernelTextSegmentInfo); + ADD_TEST(CFE_PSP_GetCFETextSegmentInfo); + + /* Coverage test cases for cfs_psp_ssr.c */ + ADD_TEST(CFE_PSP_InitSSR); + + /* Coverage test cases for cfs_psp_start.c */ + ADD_TEST(CFE_PSP_Setup); + ADD_TEST(OS_Application_Startup); + ADD_TEST(CFE_PSP_Main); + + /* Coverage test cases for cfs_psp_support.c */ + ADD_TEST(CFE_PSP_Restart); + ADD_TEST(CFE_PSP_Panic); + ADD_TEST(CFE_PSP_FlushCaches); + ADD_TEST(CFE_PSP_GetProcessorId); + ADD_TEST(CFE_PSP_GetSpacecraftId); + ADD_TEST(CFE_PSP_GetProcessorName); + + /* Coverage test cases for cfs_psp_watchdog.c */ + ADD_TEST(CFE_PSP_WatchdogInit); + ADD_TEST(CFE_PSP_WatchdogEnable); + ADD_TEST(CFE_PSP_WatchdogDisable); + ADD_TEST(CFE_PSP_WatchdogService); + ADD_TEST(CFE_PSP_WatchdogGet); + ADD_TEST(CFE_PSP_WatchdogSet); +} diff --git a/unit-test-coverage/pc-rtems/src/coveragetest-psp-pc-rtems.h b/unit-test-coverage/pc-rtems/src/coveragetest-psp-pc-rtems.h new file mode 100644 index 00000000..f095eae1 --- /dev/null +++ b/unit-test-coverage/pc-rtems/src/coveragetest-psp-pc-rtems.h @@ -0,0 +1,74 @@ +/************************************************************************ + * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * + * Copyright (c) 2020 United States Government as represented by the + * Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ************************************************************************/ + +#ifndef COVERAGETEST_PSP_PC_RTEMS_H +#define COVERAGETEST_PSP_PC_RTEMS_H + +#include "utassert.h" +#include "uttest.h" +#include "utstubs.h" + +#include "coveragetest-psp-shared.h" + +#define ADD_TEST(test) UtTest_Add((Test_##test), Psp_Test_Setup, Psp_Test_Teardown, #test) + +void Psp_Test_Setup(void); +void Psp_Test_Teardown(void); + +/* Coverage test cases for cfs_psp_exception.c */ +void Test_CFE_PSP_AttachExceptions(void); +void Test_CFE_PSP_ExceptionGetSummary_Impl(void); +void Test_CFE_PSP_SetDefaultExceptionEnvironment(void); + +/* Coverage test cases for cfs_psp_memory.c */ +void Test_CFE_PSP_GetCDSSize(void); +void Test_CFE_PSP_WriteToCDS(void); +void Test_CFE_PSP_ReadFromCDS(void); +void Test_CFE_PSP_GetResetArea(void); +void Test_CFE_PSP_GetUserReservedArea(void); +void Test_CFE_PSP_GetVolatileDiskMem(void); +void Test_CFE_PSP_SetupReservedMemoryMap(void); +void Test_CFE_PSP_InitProcessorReservedMemory(void); +void Test_CFE_PSP_GetKernelTextSegmentInfo(void); +void Test_CFE_PSP_GetCFETextSegmentInfo(void); + +/* Coverage test cases for cfs_psp_ssr.c */ +void Test_CFE_PSP_InitSSR(void); + +/* Coverage test cases for cfs_psp_start.c */ +void Test_CFE_PSP_Setup(void); +void Test_OS_Application_Startup(void); +void Test_CFE_PSP_Main(void); + +/* Coverage test cases for cfs_psp_support.c */ +void Test_CFE_PSP_Restart(void); +void Test_CFE_PSP_Panic(void); +void Test_CFE_PSP_FlushCaches(void); +void Test_CFE_PSP_GetProcessorId(void); +void Test_CFE_PSP_GetSpacecraftId(void); +void Test_CFE_PSP_GetProcessorName(void); + +/* Coverage test cases for cfs_psp_watchdog.c */ +void Test_CFE_PSP_WatchdogInit(void); +void Test_CFE_PSP_WatchdogEnable(void); +void Test_CFE_PSP_WatchdogDisable(void); +void Test_CFE_PSP_WatchdogService(void); +void Test_CFE_PSP_WatchdogGet(void); +void Test_CFE_PSP_WatchdogSet(void); + +#endif diff --git a/unit-test-coverage/ut-stubs/CMakeLists.txt b/unit-test-coverage/ut-stubs/CMakeLists.txt index 3f9aeb2e..538161d0 100644 --- a/unit-test-coverage/ut-stubs/CMakeLists.txt +++ b/unit-test-coverage/ut-stubs/CMakeLists.txt @@ -51,22 +51,23 @@ add_library(ut_psp_libc_stubs STATIC EXCLUDE_FROM_ALL src/vxworks-vxLib-stubs.c src/vxworks-spyLib-stubs.c src/vxworks-spyLibP-stubs.c + src/rtems-bsdnet-stubs.c ) - -target_include_directories(ut_libc_stubs PUBLIC + +target_include_directories(ut_libc_stubs PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/inc ) -target_link_libraries(ut_psp_libc_stubs PRIVATE +target_link_libraries(ut_psp_libc_stubs PRIVATE psp_module_api - ut_assert + ut_assert ) - + add_library(ut_psp_cfe_stubs STATIC EXCLUDE_FROM_ALL src/cfe-configdata-stubs.c ) -target_link_libraries(ut_psp_cfe_stubs PRIVATE +target_link_libraries(ut_psp_cfe_stubs PRIVATE psp_module_api - ut_assert + ut_assert ) \ No newline at end of file diff --git a/unit-test-coverage/ut-stubs/inc/PCS_bsdnet.h b/unit-test-coverage/ut-stubs/inc/PCS_bsdnet.h new file mode 100644 index 00000000..4dd65ea3 --- /dev/null +++ b/unit-test-coverage/ut-stubs/inc/PCS_bsdnet.h @@ -0,0 +1,31 @@ +/************************************************************************ + * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * + * Copyright (c) 2020 United States Government as represented by the + * Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ************************************************************************/ + +/* PSP coverage stub replacement for bsdnet.h */ +#ifndef PCS_BSDNET_H +#define PCS_BSDNET_H + +#include "PCS_basetypes.h" +#include "PCS_rtems.h" + +extern int PCS_rtems_fxp_attach(struct PCS_rtems_bsdnet_ifconfig *, int); +extern void PCS_rtems_bsdnet_do_dhcp_failsafe(void); +extern int PCS_rtems_bsdnet_initialize_network(void); +extern const char *PCS_rtems_status_text(PCS_rtems_status_code); + +#endif diff --git a/unit-test-coverage/ut-stubs/inc/PCS_dhcs_failsafe.h b/unit-test-coverage/ut-stubs/inc/PCS_dhcs_failsafe.h new file mode 100644 index 00000000..037684f8 --- /dev/null +++ b/unit-test-coverage/ut-stubs/inc/PCS_dhcs_failsafe.h @@ -0,0 +1,26 @@ +/************************************************************************ + * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * + * Copyright (c) 2020 United States Government as represented by the + * Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ************************************************************************/ + +/* PSP coverage stub replacement for rtems_dhcs_failsafe.h */ +#ifndef PCS_DHCP_FAILSAFE_H +#define PCS_DHCP_FAILSAFE_H + +#include "PCS_basetypes.h" +#include "PCS_rtems.h" + +#endif diff --git a/unit-test-coverage/ut-stubs/inc/PCS_rtems.h b/unit-test-coverage/ut-stubs/inc/PCS_rtems.h new file mode 100644 index 00000000..5381e900 --- /dev/null +++ b/unit-test-coverage/ut-stubs/inc/PCS_rtems.h @@ -0,0 +1,49 @@ +/************************************************************************ + * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * + * Copyright (c) 2020 United States Government as represented by the + * Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ************************************************************************/ + +/* PSP coverage stub replacement for rtems.h */ +#ifndef PCS_RTEMS_H +#define PCS_RTEMS_H + +#include "PCS_basetypes.h" + +typedef uint32_t PCS_rtems_task_priority; +typedef uint32_t PCS_rtems_id; + +struct PCS_rtems_bsdnet_ifconfig +{ + char *name; + int (*attach)(struct PCS_rtems_bsdnet_ifconfig *conf, int attaching); + struct PCS_rtems_bsdnet_ifconfig *next; + char * ip_address; + char * ip_netmask; + void * hardware_address; +}; + +struct PCS_rtems_bsdnet_config +{ + struct PCS_rtems_bsdnet_ifconfig *ifconfig; + void (*bootp)(void); +}; + +typedef enum +{ + PCS_RTEMS_SUCCESSFUL = 0, +} PCS_rtems_status_code; + +#endif diff --git a/unit-test-coverage/ut-stubs/inc/PCS_stdlib.h b/unit-test-coverage/ut-stubs/inc/PCS_stdlib.h index b456f608..ad11bb40 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_stdlib.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_stdlib.h @@ -42,5 +42,6 @@ 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_abort(void); #endif diff --git a/unit-test-coverage/ut-stubs/inc/README.md b/unit-test-coverage/ut-stubs/inc/README.md index 5a8cd1f0..d590f02d 100644 --- a/unit-test-coverage/ut-stubs/inc/README.md +++ b/unit-test-coverage/ut-stubs/inc/README.md @@ -2,8 +2,8 @@ ABOUT THE SYSTEM HEADER OVERRIDES ================================= The "overrides" directory contains replacement versions of many system-provided -header files. All replacement functions and types are identified using an -`OCS_` prefix. +header files. All replacement functions and types are identified using a +`PCS_` prefix. The header file that a particular source will use depends on the way that the compiler include path is set up. This is intentional. @@ -12,16 +12,16 @@ way that the compiler include path is set up. This is intentional. This refers to all code _other_ than the unit actually being tested, including stub function implementations and test configuration. - + All coverage test recipes should include `ut-stubs/inc` in the INCLUDE_DIRECTORIES. These prototypes can be explicitly obtained by putting an `overrides/` prefix on the #include statement, for instance: - + #include <-- Gets the regular system version as usual - #include <-- Gets this replacement OCS version - + #include <-- Gets this replacement PCS version + Note that the two shouldn't conflict, so it is possible to include both where needed. - + 2. For code units under test: When compiling the actual unit under test with coverage instrumentation, @@ -29,18 +29,18 @@ the CMake recipe should add "ut-stubs/inc/overrides" into the INCLUDE_DIRECTORIE This way, all source files compiled will find these replacements instead of the regular system header file. So a statement like: - #include <-- Gets this replacement OCS version - + #include <-- Gets this replacement PCS version + This way it is possible to simply recompile the original source files and all the included system headers will be transparently replaced with these override versions. When using the file in this way, one must also provide a companion macro to -divert the actual usage to the OCS namespace as well. For instance: +divert the actual usage to the PCS namespace as well. For instance: + + #define fputs PCS_fputs - #define fputs OCS_fputs - -Will cause all references to `fputs` in the subsequent code to refer to `OCS_fputs` -instead. +Will cause all references to `fputs` in the subsequent code to refer to `PCS_fputs` +instead. Important Notes --------------- @@ -55,9 +55,8 @@ header to be used. These cases are: stddef.h : Macros like offsetof() and size_t/ptrdiff_t must be correct for the CPU stdbool.h : Preserves correct boolean semantics - + Note that header files from all supported platforms (VxWorks, Rtems, Posix) may all be placed here. Since the files are empty placeholders, they simply need to exist, and there is no need to duplicate this entire tree for every OS since they will overlap considerably. - \ No newline at end of file diff --git a/unit-test-coverage/ut-stubs/override_inc/bsp.h b/unit-test-coverage/ut-stubs/override_inc/bsp.h new file mode 100644 index 00000000..b799de29 --- /dev/null +++ b/unit-test-coverage/ut-stubs/override_inc/bsp.h @@ -0,0 +1,23 @@ +/************************************************************************ + * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * + * Copyright (c) 2020 United States Government as represented by the + * Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ************************************************************************/ + +/* PSP coverage stub replacement for bsp.h */ +#ifndef OVERRIDE_BSP_H +#define OVERRIDE_BSP_H + +#endif diff --git a/unit-test-coverage/ut-stubs/override_inc/rtems.h b/unit-test-coverage/ut-stubs/override_inc/rtems.h new file mode 100644 index 00000000..97bb582c --- /dev/null +++ b/unit-test-coverage/ut-stubs/override_inc/rtems.h @@ -0,0 +1,34 @@ +/************************************************************************ + * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * + * Copyright (c) 2020 United States Government as represented by the + * Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ************************************************************************/ + +/* PSP coverage stub replacement for rtems.h */ +#ifndef OVERRIDE_RTEMS_H +#define OVERRIDE_RTEMS_H + +#include "PCS_rtems.h" + +#define rtems_task_priority PCS_rtems_task_priority +#define rtems_id PCS_rtems_id + +#define rtems_status_code PCS_rtems_status_code +#define RTEMS_SUCCESSFUL PCS_RTEMS_SUCCESSFUL + +#define rtems_bsdnet_ifconfig PCS_rtems_bsdnet_ifconfig +#define rtems_bsdnet_config PCS_rtems_bsdnet_config + +#endif diff --git a/unit-test-coverage/ut-stubs/override_inc/rtems/rtems_bsdnet.h b/unit-test-coverage/ut-stubs/override_inc/rtems/rtems_bsdnet.h new file mode 100644 index 00000000..c0dda61b --- /dev/null +++ b/unit-test-coverage/ut-stubs/override_inc/rtems/rtems_bsdnet.h @@ -0,0 +1,30 @@ +/************************************************************************ + * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * + * Copyright (c) 2020 United States Government as represented by the + * Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ************************************************************************/ + +/* PSP coverage stub replacement for rtems_bsdnet.h */ +#ifndef OVERRIDE_BSDNET_H +#define OVERRIDE_BSDNET_H + +#include "PCS_bsdnet.h" + +#define rtems_status_text PCS_rtems_status_text +#define rtems_bsdnet_do_dhcp_failsafe PCS_rtems_bsdnet_do_dhcp_failsafe +#define rtems_bsdnet_initialize_network PCS_rtems_bsdnet_initialize_network +#define rtems_fxp_attach PCS_rtems_fxp_attach + +#endif diff --git a/unit-test-coverage/ut-stubs/override_inc/rtems/rtems_dhcp_failsafe.h b/unit-test-coverage/ut-stubs/override_inc/rtems/rtems_dhcp_failsafe.h new file mode 100644 index 00000000..736c4a28 --- /dev/null +++ b/unit-test-coverage/ut-stubs/override_inc/rtems/rtems_dhcp_failsafe.h @@ -0,0 +1,23 @@ +/************************************************************************ + * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * + * Copyright (c) 2020 United States Government as represented by the + * Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ************************************************************************/ + +/* PSP coverage stub replacement for rtems_dhcp_failsafe.h */ +#ifndef OVERRIDE_DCHP_FAILSAFE_H +#define OVERRIDE_DCHP_FAILSAFE_H + +#endif diff --git a/unit-test-coverage/ut-stubs/override_inc/stdlib.h b/unit-test-coverage/ut-stubs/override_inc/stdlib.h index e2b46537..8c7dcb9e 100644 --- a/unit-test-coverage/ut-stubs/override_inc/stdlib.h +++ b/unit-test-coverage/ut-stubs/override_inc/stdlib.h @@ -33,5 +33,6 @@ #define system PCS_system #define malloc PCS_malloc #define free PCS_free +#define abort PCS_abort #endif 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 c8923014..1dc56700 100644 --- a/unit-test-coverage/ut-stubs/src/libc-stdlib-stubs.c +++ b/unit-test-coverage/ut-stubs/src/libc-stdlib-stubs.c @@ -57,6 +57,11 @@ void PCS_exit(int c) */ } +void PCS_abort(void) +{ + UT_DEFAULT_IMPL(PCS_abort); +} + unsigned long int PCS_strtoul(const char *nptr, char **endptr, int base) { int32 Status; diff --git a/unit-test-coverage/ut-stubs/src/rtems-bsdnet-stubs.c b/unit-test-coverage/ut-stubs/src/rtems-bsdnet-stubs.c new file mode 100644 index 00000000..57499c4f --- /dev/null +++ b/unit-test-coverage/ut-stubs/src/rtems-bsdnet-stubs.c @@ -0,0 +1,53 @@ +/************************************************************************ + * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * + * Copyright (c) 2020 United States Government as represented by the + * Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ************************************************************************/ + +/* PSP coverage stub replacement for rtems_bsdnet.h */ +#include +#include "utstubs.h" + +#include "PCS_bsdnet.h" +#include "PCS_rtems.h" + +void PCS_rtems_bsdnet_do_dhcp_failsafe(void) +{ + UT_DEFAULT_IMPL(PCS_rtems_bsdnet_do_dhcp_failsafe); +} + +const char *PCS_rtems_status_text(PCS_rtems_status_code code) +{ + const char *ReturnCode = NULL; + int32 Status; + + Status = UT_DEFAULT_IMPL(PCS_rtems_status_text); + if (Status == 0) + { + UT_Stub_CopyToLocal(UT_KEY(PCS_rtems_status_text), &ReturnCode, sizeof(ReturnCode)); + } + + return ReturnCode; +} + +int PCS_rtems_bsdnet_initialize_network(void) +{ + return UT_DEFAULT_IMPL(PCS_rtems_bsdnet_initialize_network); +} + +int PCS_rtems_fxp_attach(struct PCS_rtems_bsdnet_ifconfig *config, int attaching) +{ + return UT_DEFAULT_IMPL(PCS_rtems_fxp_attach); +} \ No newline at end of file diff --git a/ut-stubs/ut_psp_stubs.c b/ut-stubs/ut_psp_stubs.c index 853a67e8..2bf16c16 100644 --- a/ut-stubs/ut_psp_stubs.c +++ b/ut-stubs/ut_psp_stubs.c @@ -66,11 +66,7 @@ Target_ConfigData GLOBAL_CONFIGDATA = {.MissionVersion = "MissionUnitTest" ** ** \par Description ** This function is used to mimic the response of the OS API function -** CFE_PSP_Panic. The variable PSPPanicRtn.value is set equal to the -** input variable ErrorCode and the variable PSPPanicRtn.count is -** incremented each time this function is called. The unit tests -** compare these values to expected results to verify proper system -** response. +** CFE_PSP_Panic. ** ** \par Assumptions, External Events, and Notes: ** None @@ -168,7 +164,7 @@ const char *CFE_PSP_GetProcessorName(void) /*****************************************************************************/ /** -v** \brief CFE_PSP_GetTime stub function +** \brief CFE_PSP_GetTime stub function ** ** \par Description ** This function is used as a placeholder for the PSP function @@ -203,13 +199,7 @@ void CFE_PSP_GetTime(OS_time_t *LocalTime) ** ** \par Description ** This function is used to mimic the response of the PSP function -** CFE_PSP_WriteToCDS. The user can adjust the response by setting -** the values in the BSPWriteCDSRtn structure prior to this function -** being called. If the value BSPWriteCDSRtn.count is greater than -** zero then the counter is decremented; if it then equals zero the -** return value is set to the user-defined value BSPWriteCDSRtn.value. -** Otherwise, the value of the user-defined variable UT_BSP_Fail -** determines the status returned by the function. +** CFE_PSP_WriteToCDS. ** ** \par Assumptions, External Events, and Notes: ** None @@ -245,13 +235,7 @@ int32 CFE_PSP_WriteToCDS(const void *PtrToDataToWrite, uint32 CDSOffset, uint32 ** ** \par Description ** This function is used to mimic the response of the PSP function -** CFE_PSP_ReadFromCDS. The user can adjust the response by setting -** the values in the BSPReadCDSRtn structure prior to this function -** being called. If the value BSPReadCDSRtn.count is greater than -** zero then the counter is decremented; if it then equals zero the -** return value is set to the user-defined value BSPReadCDSRtn.value. -** Otherwise, the value of the user-defined variable UT_BSP_Fail -** determines the status returned by the function. +** CFE_PSP_ReadFromCDS. ** ** \par Assumptions, External Events, and Notes: ** None @@ -287,8 +271,7 @@ int32 CFE_PSP_ReadFromCDS(void *PtrToDataToRead, uint32 CDSOffset, uint32 NumByt ** ** \par Description ** This function is used to mimic the response of the PSP function -** CFE_PSP_GetCDSSize. The user can adjust the response by -** setting the value of UT_BSP_Fail prior to this function being called. +** CFE_PSP_GetCDSSize. ** ** \par Assumptions, External Events, and Notes: ** None @@ -319,8 +302,7 @@ int32 CFE_PSP_GetCDSSize(uint32 *SizeOfCDS) ** ** \par Description ** This function is used to mimic the response of the PSP function -** CFE_PSP_GetVolatileDiskMem. The user can adjust the response by -** setting the value of UT_BSP_Fail prior to this function being called. +** CFE_PSP_GetVolatileDiskMem. ** ** \par Assumptions, External Events, and Notes: ** None @@ -354,11 +336,7 @@ int32 CFE_PSP_GetVolatileDiskMem(cpuaddr *PtrToVolDisk, uint32 *SizeOfVolDisk) ** ** \par Description ** This function is used as a placeholder for the PSP function -** CFE_PSP_Restart. The variable PSPRestartRtn.value is set to the -** value passed to the function, reset_type, and the variable -** PSPRestartRtn.count is incremented each time this function is called. -** The unit tests compare these values to expected results to verify -** proper system response. +** CFE_PSP_Restart. ** ** \par Assumptions, External Events, and Notes: ** None